Blob Blame History Raw
From d4a53449abd8759d7935c6b97d0e527d3c87fc8b Mon Sep 17 00:00:00 2001
From: afb <afb@98b59c6a-2706-0410-b7d6-d2fa1a1880c9>
Date: Sat, 28 Aug 2010 13:36:34 +0000
Subject: [PATCH 1/4] * allow running DMD on all platforms

git-svn-id: svn://svn.berlios.de/codeblocks/trunk@6553 98b59c6a-2706-0410-b7d6-d2fa1a1880c9
---
 src/plugins/compilergcc/compilerDMD.cpp |    5 -----
 src/plugins/compilergcc/compilerDMD.h   |    5 -----
 src/plugins/compilergcc/compilergcc.cpp |    2 +-
 3 files changed, 1 insertions(+), 11 deletions(-)

diff --git a/src/plugins/compilergcc/compilerDMD.cpp b/src/plugins/compilergcc/compilerDMD.cpp
index 538db2c..3e23aae 100644
--- a/src/plugins/compilergcc/compilerDMD.cpp
+++ b/src/plugins/compilergcc/compilerDMD.cpp
@@ -7,9 +7,6 @@
  * $HeadURL: svn+ssh://jenslody@svn.berlios.de/svnroot/repos/codeblocks/trunk/src/plugins/compilergcc/compilerDMD.cpp $
  */
 
-#if defined(_WIN32) || defined(__linux__)
-// this compiler is valid only in windows and linux
-
 #include <sdk.h>
 #include <prep.h>
 #include <wx/intl.h>
@@ -182,5 +179,3 @@ AutoDetectResult CompilerDMD::AutoDetectInstallationDir()
 
     return wxFileExists(m_MasterPath + sep + _T("bin") + sep + m_Programs.C) ? adrDetected : adrGuessed;
 }
-
-#endif // _WIN32 || linux
diff --git a/src/plugins/compilergcc/compilerDMD.h b/src/plugins/compilergcc/compilerDMD.h
index 0f5a431..5e0eab4 100644
--- a/src/plugins/compilergcc/compilerDMD.h
+++ b/src/plugins/compilergcc/compilerDMD.h
@@ -3,9 +3,6 @@
  * http://www.gnu.org/licenses/gpl-3.0.html
  */
 
-#if defined(_WIN32) || defined(__linux__)
-// this compiler is valid only in windows and linux
-
 #ifndef COMPILERDMD_H
 #define COMPILERDMD_H
 
@@ -25,5 +22,3 @@ class CompilerDMD : public Compiler
 };
 
 #endif // COMPILERDMD_H
-
-#endif // _WIN32 || linux
diff --git a/src/plugins/compilergcc/compilergcc.cpp b/src/plugins/compilergcc/compilergcc.cpp
index c9964fc..be44e72 100644
--- a/src/plugins/compilergcc/compilergcc.cpp
+++ b/src/plugins/compilergcc/compilergcc.cpp
@@ -394,8 +394,8 @@ void CompilerGCC::OnAttach()
     CompilerFactory::RegisterCompiler(new CompilerSDCC);
     CompilerFactory::RegisterCompiler(new CompilerTcc);
     CompilerFactory::RegisterCompiler(new CompilerGDC);
-#if defined(__WIN32__) || defined(__linux__)
     CompilerFactory::RegisterCompiler(new CompilerDMD);
+#if defined(__WIN32__) || defined(__linux__)
     CompilerFactory::RegisterCompiler(new CompilerGNUARM);
     CompilerFactory::RegisterCompiler(new CompilerGNUAVR);
     CompilerFactory::RegisterCompiler(new CompilerGNUPOWERPC);
-- 
1.7.2.2


From eb7ef89d0b01eb11f742a899f75bb0b0284d40fd Mon Sep 17 00:00:00 2001
From: afb <afb@98b59c6a-2706-0410-b7d6-d2fa1a1880c9>
Date: Sat, 28 Aug 2010 13:41:07 +0000
Subject: [PATCH 2/4] * add LDC compiler, LLVM backend / D1 language / Tango library

git-svn-id: svn://svn.berlios.de/codeblocks/trunk@6554 98b59c6a-2706-0410-b7d6-d2fa1a1880c9
---
 src/CodeBlocks-unix.cbp                 |    6 ++
 src/CodeBlocks.cbp                      |    6 ++
 src/plugins/compilergcc/Makefile.am     |    4 +-
 src/plugins/compilergcc/compilerLDC.cpp |  142 +++++++++++++++++++++++++++++++
 src/plugins/compilergcc/compilerLDC.h   |   24 +++++
 src/plugins/compilergcc/compilergcc.cpp |    2 +
 6 files changed, 183 insertions(+), 1 deletions(-)
 create mode 100644 src/plugins/compilergcc/compilerLDC.cpp
 create mode 100644 src/plugins/compilergcc/compilerLDC.h

diff --git a/src/CodeBlocks-unix.cbp b/src/CodeBlocks-unix.cbp
index eb2d9da..c3c8585 100644
--- a/src/CodeBlocks-unix.cbp
+++ b/src/CodeBlocks-unix.cbp
@@ -1144,6 +1144,12 @@
 		<Unit filename="plugins/compilergcc/compilerGDC.h">
 			<Option target="Compiler" />
 		</Unit>
+		<Unit filename="plugins/compilergcc/compilerLDC.cpp">
+			<Option target="Compiler" />
+		</Unit>
+		<Unit filename="plugins/compilergcc/compilerLDC.h">
+			<Option target="Compiler" />
+		</Unit>
 		<Unit filename="plugins/compilergcc/compilerGNUARM.cpp">
 			<Option target="Compiler" />
 		</Unit>
diff --git a/src/CodeBlocks.cbp b/src/CodeBlocks.cbp
index 47a2196..5a7b2bf 100644
--- a/src/CodeBlocks.cbp
+++ b/src/CodeBlocks.cbp
@@ -1244,6 +1244,12 @@
 		<Unit filename="plugins\compilergcc\compilerGDC.h">
 			<Option target="Compiler" />
 		</Unit>
+		<Unit filename="plugins\compilergcc\compilerLDC.cpp">
+			<Option target="Compiler" />
+		</Unit>
+		<Unit filename="plugins\compilergcc\compilerLDC.h">
+			<Option target="Compiler" />
+		</Unit>
 		<Unit filename="plugins\compilergcc\compilerGNUARM.cpp">
 			<Option target="Compiler" />
 		</Unit>
diff --git a/src/plugins/compilergcc/Makefile.am b/src/plugins/compilergcc/Makefile.am
index 8efa5bf..fe4b245 100644
--- a/src/plugins/compilergcc/Makefile.am
+++ b/src/plugins/compilergcc/Makefile.am
@@ -27,6 +27,7 @@ libcompiler_la_SOURCES = advancedcompileroptionsdlg.cpp \
 			compilererrors.cpp \
 			compilergcc.cpp \
 			compilerGDC.cpp \
+			compilerLDC.cpp \
 			compilerICC.cpp \
 			compilerLCC.cpp \
 			compilermessages.cpp \
@@ -55,6 +56,7 @@ noinst_HEADERS = advancedcompileroptionsdlg.h \
 			compilererrors.h \
 			compilergcc.h \
 			compilerGDC.h \
+			compilerLDC.h \
 			compilerICC.h \
 			compilerLCC.h \
 			compilermessages.h \
@@ -75,4 +77,4 @@ noinst_HEADERS = advancedcompileroptionsdlg.h \
 			makefilegenerator.h
 
 EXTRA_DIST = compilerMSVC8.h \
-			compilerMSVC8.cpp
\ No newline at end of file
+			compilerMSVC8.cpp
diff --git a/src/plugins/compilergcc/compilerLDC.cpp b/src/plugins/compilergcc/compilerLDC.cpp
new file mode 100644
index 0000000..ab60488
--- /dev/null
+++ b/src/plugins/compilergcc/compilerLDC.cpp
@@ -0,0 +1,142 @@
+/*
+ * This file is part of the Code::Blocks IDE and licensed under the GNU General Public License, version 3
+ * http://www.gnu.org/licenses/gpl-3.0.html
+ *
+ * $Revision: 5929 $
+ * $Id: compilerLDC.cpp $
+ * $HeadURL: svn://svn.berlios.de/codeblocks/trunk/src/plugins/compilergcc/compilerLDC.cpp $
+ */
+
+#include <sdk.h>
+#include <prep.h>
+#include "compilerLDC.h"
+#include <wx/intl.h>
+#include <wx/regex.h>
+#include <wx/config.h>
+#include <wx/fileconf.h>
+#include <wx/msgdlg.h>
+#include "manager.h"
+#include "logmanager.h"
+
+#include <configmanager.h>
+
+CompilerLDC::CompilerLDC()
+    : Compiler(_("LLVM D Compiler"), _T("ldc"))
+{
+    Reset();
+}
+
+CompilerLDC::~CompilerLDC()
+{
+    //dtor
+}
+
+Compiler * CompilerLDC::CreateCopy()
+{
+    Compiler* c = new CompilerLDC(*this);
+    c->SetExtraPaths(m_ExtraPaths); // wxArrayString doesn't seem to be copied with the default copy ctor...
+    return c;
+}
+
+void CompilerLDC::Reset()
+{
+    m_Programs.C = _T("ldc");
+    m_Programs.CPP = _T("ldc");
+    m_Programs.LD = _T("ldc");
+    m_Programs.DBG = _T("gdb");
+    m_Programs.LIB = _T("ar");
+    m_Programs.WINDRES = _T("");
+    m_Programs.MAKE = _T("make");
+
+    m_Switches.includeDirs = _T("-I");
+    m_Switches.libDirs = _T("-L");
+    m_Switches.linkLibs = _T("-l");
+    m_Switches.defines = _T("-d-version=");
+    m_Switches.genericSwitch = _T("-");
+    m_Switches.objectExtension = _T("o");
+    m_Switches.needDependencies = true;
+    m_Switches.forceCompilerUseQuotes = false;
+    m_Switches.forceLinkerUseQuotes = false;
+    m_Switches.logging = clogSimple;
+    m_Switches.libPrefix = _T("lib");
+    m_Switches.libExtension = _T("a");
+    m_Switches.linkerNeedsLibPrefix = false;
+    m_Switches.linkerNeedsLibExtension = false;
+
+    m_Options.ClearOptions();
+    m_Options.AddOption(_("Produce debugging symbols"),
+                _T("-g"),
+                _("Debugging"),
+                _T(""),
+                true,
+                _T("-O1 -O2 -O3"),
+                _("You have optimizations enabled. This is Not A Good Thing(tm) when producing debugging symbols..."));
+
+    wxString category = _("Warnings");
+
+    // warnings
+    m_Options.AddOption(_("Enable warnings"), _T("-w"), category);
+    // D features
+    category = _("D");
+    m_Options.AddOption(_("allow deprecated features"), _T("-d"), category);
+    m_Options.AddOption(_("inline expand functions"), _T("-enable-inlining"), category);
+    m_Options.AddOption(_("enable array bounds checks"), _T("-enable-boundscheck"), category);
+    m_Options.AddOption(_("enable contracts"), _T("-enable-contracts"), category);
+    m_Options.AddOption(_("enable assertions"), _T("-enable-asserts"), category);
+    m_Options.AddOption(_("enable invariants"), _T("-enable-invariants"), category);
+ 
+    // optimization
+    category = _("Optimization");
+    m_Options.AddOption(_("No optimization"), _T("-O0"), category);
+    m_Options.AddOption(_("Simple optimizations"), _T("-O1"), category);
+    m_Options.AddOption(_("Good optimizations"), _T("-O2"), category);
+    m_Options.AddOption(_("Aggressive optimizations"), _T("-O3"), category);
+    // machine dependent options - cpu arch
+    category = _("CPU architecture tuning (choose none, or only one of these)");
+    m_Options.AddOption(_("32-bit X86: Pentium-Pro and above"), _T("-march=x86"), category);
+    m_Options.AddOption(_("64-bit X86: EM64T and AMD64"), _T("-march=x86-64"), category);
+
+    m_Commands[(int)ctCompileObjectCmd].push_back(CompilerTool(_T("$compiler $options $includes -c $file -of=$object")));
+    m_Commands[(int)ctGenDependenciesCmd].push_back(CompilerTool(_T("$compiler $options -deps=$dep_object $includes $file")));
+    m_Commands[(int)ctCompileResourceCmd].push_back(CompilerTool(_T("$rescomp -i $file -J rc -o $resource_output -O coff $res_includes")));
+    m_Commands[(int)ctLinkConsoleExeCmd].push_back(CompilerTool(_T("$linker $libdirs -of=$exe_output $link_objects $link_resobjects $link_options $libs")));
+    m_Commands[(int)ctLinkExeCmd] = m_Commands[(int)ctLinkConsoleExeCmd]; // no -mwindows
+    m_Commands[(int)ctLinkDynamicCmd].push_back(CompilerTool(_T("$linker -shared $libdirs $link_objects $link_resobjects -o $exe_output $link_options $libs")));
+    m_Commands[(int)ctLinkStaticCmd].push_back(CompilerTool(_T("$lib_linker -r $static_output $link_objects\nranlib $static_output")));
+    m_Commands[(int)ctLinkNativeCmd] = m_Commands[(int)ctLinkConsoleExeCmd]; // unsupported currently
+
+    LoadDefaultRegExArray();
+
+    m_CompilerOptions.Clear();
+    m_LinkerOptions.Clear();
+    m_LinkLibs.Clear();
+    m_CmdsBefore.Clear();
+    m_CmdsAfter.Clear();
+}
+
+void CompilerLDC::LoadDefaultRegExArray()
+{
+    m_RegExes.Clear();
+    m_RegExes.Add(RegExStruct(_("Fatal error"), cltError, _T("FATAL:[ \t]*(.*)"), 1));
+    m_RegExes.Add(RegExStruct(_("'Instantiated from here' info"), cltNormal, _T("(") + FilePathWithSpaces + _T("):([0-9]+):[ \t]+([iI]nstantiated from here.*)"), 3, 1, 2));    m_RegExes.Add(RegExStruct(_("Resource compiler error"), cltError, _T("windres.exe:[ \t](") + FilePathWithSpaces + _T("):([0-9]+):[ \t](.*)"), 3, 1, 2));
+    m_RegExes.Add(RegExStruct(_("Resource compiler error"), cltError, _T("windres.exe:[ \t](") + FilePathWithSpaces + _T("):([0-9]+):[ \t](.*)"), 3, 1, 2));
+    m_RegExes.Add(RegExStruct(_("Resource compiler error (2)"), cltError, _T("windres.exe:[ \t](.*)"), 1));
+    m_RegExes.Add(RegExStruct(_("Compiler warning"), cltWarning, _T("(") + FilePathWithSpaces + _T(")\\(([0-9]+)\\):[ \t]([Ww]arning:[ \t].*)"), 3, 1, 2));
+    m_RegExes.Add(RegExStruct(_("Compiler error"), cltError, _T("(") + FilePathWithSpaces + _T(")\\(([0-9]+)\\):[ \t](.*)"), 3, 1, 2));
+    m_RegExes.Add(RegExStruct(_("Linker error"), cltError, _T("(") + FilePathWithSpaces + _T("):([0-9]+):[0-9]+:[ \t](.*)"), 3, 1, 2));
+    m_RegExes.Add(RegExStruct(_("Linker error (2)"), cltError, FilePathWithSpaces + _T("\\(.text\\+[0-9A-Za-z]+\\):([ \tA-Za-z0-9_:+/\\.-]+):[ \t](.*)"), 2, 1));
+    m_RegExes.Add(RegExStruct(_("Linker error (lib not found)"), cltError, _T(".*(ld.*):[ \t](cannot find.*)"), 2, 1));
+    m_RegExes.Add(RegExStruct(_("Undefined reference"), cltError, _T("(") + FilePathWithSpaces + _T("):[ \t](undefined reference.*)"), 2, 1));
+    m_RegExes.Add(RegExStruct(_("General warning"), cltWarning, _T("([Ww]arning:[ \t].*)"), 1));
+}
+
+AutoDetectResult CompilerLDC::AutoDetectInstallationDir()
+{
+    wxString sep = wxFileName::GetPathSeparator();
+    m_MasterPath = wxFileExists(_T("/usr/local/bin/ldc")) ? _T("/usr/local") : _T("/usr");
+    
+    AddIncludeDir(m_MasterPath + sep + _T("import"));
+    AddLibDir(m_MasterPath + sep + _T("lib"));
+
+    return wxFileExists(m_MasterPath + sep + _T("bin") + sep + m_Programs.C) ? adrDetected : adrGuessed;
+}
diff --git a/src/plugins/compilergcc/compilerLDC.h b/src/plugins/compilergcc/compilerLDC.h
new file mode 100644
index 0000000..e540dd6
--- /dev/null
+++ b/src/plugins/compilergcc/compilerLDC.h
@@ -0,0 +1,24 @@
+/*
+ * This file is part of the Code::Blocks IDE and licensed under the GNU General Public License, version 3
+ * http://www.gnu.org/licenses/gpl-3.0.html
+ */
+
+#ifndef COMPILER_LDC_H
+#define COMPILER_LDC_H
+
+#include <compiler.h>
+
+class CompilerLDC : public Compiler
+{
+    public:
+        CompilerLDC();
+        virtual ~CompilerLDC();
+        virtual void Reset();
+        virtual void LoadDefaultRegExArray();
+        virtual AutoDetectResult AutoDetectInstallationDir();
+    protected:
+        virtual Compiler* CreateCopy();
+    private:
+};
+
+#endif // COMPILER_LDC_H
diff --git a/src/plugins/compilergcc/compilergcc.cpp b/src/plugins/compilergcc/compilergcc.cpp
index be44e72..1ffa63b 100644
--- a/src/plugins/compilergcc/compilergcc.cpp
+++ b/src/plugins/compilergcc/compilergcc.cpp
@@ -67,6 +67,7 @@
 #include "compilerSDCC.h"
 #include "compilerTcc.h"
 #include "compilerGDC.h"
+#include "compilerLDC.h"
 #include "compilerGNUPOWERPC.h"
 #include "compilerGNUTRICORE.h"
 
@@ -394,6 +395,7 @@ void CompilerGCC::OnAttach()
     CompilerFactory::RegisterCompiler(new CompilerSDCC);
     CompilerFactory::RegisterCompiler(new CompilerTcc);
     CompilerFactory::RegisterCompiler(new CompilerGDC);
+    CompilerFactory::RegisterCompiler(new CompilerLDC);
     CompilerFactory::RegisterCompiler(new CompilerDMD);
 #if defined(__WIN32__) || defined(__linux__)
     CompilerFactory::RegisterCompiler(new CompilerGNUARM);
-- 
1.7.2.2


From 17eb9968e9d7aaa663b5fe2486c3ddfc69558f3e Mon Sep 17 00:00:00 2001
From: afb <afb@98b59c6a-2706-0410-b7d6-d2fa1a1880c9>
Date: Sat, 28 Aug 2010 13:48:25 +0000
Subject: [PATCH 3/4] - add LDC to D console wizard

git-svn-id: svn://svn.berlios.de/codeblocks/trunk@6555 98b59c6a-2706-0410-b7d6-d2fa1a1880c9
---
 .../resources/common_functions.script              |    7 +++++--
 .../scriptedwizard/resources/d/wizard.script       |    2 +-
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/plugins/scriptedwizard/resources/common_functions.script b/src/plugins/scriptedwizard/resources/common_functions.script
index 3f18fc0..c0ebd95 100644
--- a/src/plugins/scriptedwizard/resources/common_functions.script
+++ b/src/plugins/scriptedwizard/resources/common_functions.script
@@ -31,7 +31,8 @@ function WarningsOn(base, compilerID)
         base.AddCompilerOption(_T("-Wall"));
     }
     else if (   GetCompilerFactory().CompilerInheritsFrom(compilerID, _T("bcc*"))
-             || GetCompilerFactory().CompilerInheritsFrom(compilerID, _T("dmd")) )
+             || GetCompilerFactory().CompilerInheritsFrom(compilerID, _T("dmd"))
+             || GetCompilerFactory().CompilerInheritsFrom(compilerID, _T("ldc")) )
     {
         base.AddCompilerOption(_T("-w"));
     }
@@ -68,6 +69,7 @@ function DebugSymbolsOn(base, compilerID)
              || GetCompilerFactory().CompilerInheritsFrom(compilerID, _T("dmd"))
              || GetCompilerFactory().CompilerInheritsFrom(compilerID, _T("gcc"))
              || GetCompilerFactory().CompilerInheritsFrom(compilerID, _T("gdc"))
+             || GetCompilerFactory().CompilerInheritsFrom(compilerID, _T("ldc"))
              || GetCompilerFactory().CompilerInheritsFrom(compilerID, _T("tcc")) )
     {
         base.AddCompilerOption(_T("-g"));
@@ -115,7 +117,8 @@ function OptimizationsOn(base, compilerID)
              || GetCompilerFactory().CompilerInheritsFrom(compilerID, _T("gcc"))
              || GetCompilerFactory().CompilerInheritsFrom(compilerID, _T("tricore*"))
              || GetCompilerFactory().CompilerInheritsFrom(compilerID, _T("ppc*"))
-             || GetCompilerFactory().CompilerInheritsFrom(compilerID, _T("gdc")) )
+             || GetCompilerFactory().CompilerInheritsFrom(compilerID, _T("gdc"))
+             || GetCompilerFactory().CompilerInheritsFrom(compilerID, _T("ldc")) )
     {
         base.AddCompilerOption(_T("-O2"));
 
diff --git a/src/plugins/scriptedwizard/resources/d/wizard.script b/src/plugins/scriptedwizard/resources/d/wizard.script
index 3eb18a9..c5deac1 100644
--- a/src/plugins/scriptedwizard/resources/d/wizard.script
+++ b/src/plugins/scriptedwizard/resources/d/wizard.script
@@ -17,7 +17,7 @@ function BeginWizard()
     // add builtin pages
     Wizard.AddInfoPage(_T("DIntro"), intro_msg); // intro
     Wizard.AddProjectPathPage(); // select project name and path
-    Wizard.AddCompilerPage(_T(""), _T("dmd;gdc"), true, true); // select compiler and configurations
+    Wizard.AddCompilerPage(_T(""), _T("dmd;gdc;ldc"), true, true); // select compiler and configurations
     // nothing more needs to be done here
 }
 
-- 
1.7.2.2


From 3367d355dc95f3afb2fa43b3097879ee096e320e Mon Sep 17 00:00:00 2001
From: afb <afb@98b59c6a-2706-0410-b7d6-d2fa1a1880c9>
Date: Sat, 28 Aug 2010 13:50:09 +0000
Subject: [PATCH 4/4] - codecompletion: add D icon for D keywords

git-svn-id: svn://svn.berlios.de/codeblocks/trunk@6556 98b59c6a-2706-0410-b7d6-d2fa1a1880c9
---
 src/plugins/codecompletion/codecompletion.cpp |   39 ++++++++++++++++++++++++-
 1 files changed, 38 insertions(+), 1 deletions(-)

diff --git a/src/plugins/codecompletion/codecompletion.cpp b/src/plugins/codecompletion/codecompletion.cpp
index 4fe676b..dda8cd2 100644
--- a/src/plugins/codecompletion/codecompletion.cpp
+++ b/src/plugins/codecompletion/codecompletion.cpp
@@ -79,6 +79,36 @@ static const char * cpp_keyword_xpm[] = {
 "  .......       ",
 "                "};
 
+// bitmap for use as D keywords icon in code-completion list
+/* XPM */
+static const char *d_keyword_xpm[] = {
+/* width height num_colors chars_per_pixel */
+"    14    14      6            1",
+/* colors */
+"  c none",
+". c #fefefe",
+"# c #e43a3a",
+"a c #e40000",
+"b c #e48f8f",
+"c c #8f0000",
+/* pixels */
+"              ",
+"              ",
+"  .#aaaa#b.   ",
+"  baabb#aa#   ",
+"  ba#   baa#  ",
+"  ba#    bcab ",
+"  ba#     #a# ",
+"  ba#     bac ",
+"  ba#     ba# ",
+"  ba#     bc# ",
+"  ba#     #cb ",
+"  bcc    ac#  ",
+"  #aa###ac#   ",
+"  cccccc#b    "
+};
+
+
 // bitmap for other-than-C++ keywords
 // it's pretty nice actually :)
 /* XPM */
@@ -614,9 +644,16 @@ int CodeCompletion::CodeComplete()
                     wxString lastSearch = m_NativeParser.LastAIGlobalSearch().Lower();
                     int iidx = ilist->GetImageCount();
                     bool isC = ft == ftHeader || ft == ftSource;
-                    ed->GetControl()->RegisterImage(iidx, wxBitmap(isC ? cpp_keyword_xpm : unknown_keyword_xpm));
                     // theme keywords
                     HighlightLanguage lang = theme->GetLanguageForFilename(_T(".")+wxFileName(ed->GetFilename()).GetExt());
+                    wxString strLang = theme->GetLanguageName(lang);
+                    // if its sourcecode/header file and a known fileformat, show the corresponding icon
+                    if (isC && strLang==_T("C/C++"))
+                        ed->GetControl()->RegisterImage(iidx, wxBitmap(cpp_keyword_xpm));
+                    else if (isC && strLang==_T("D"))
+                        ed->GetControl()->RegisterImage(iidx, wxBitmap(d_keyword_xpm));
+                    else
+                        ed->GetControl()->RegisterImage(iidx, wxBitmap(unknown_keyword_xpm));
                     // the first two keyword sets are the primary and secondary keywords (for most lexers at least)
                     // but this is now configurable in global settings
                     for (int i = 0; i <= wxSCI_KEYWORDSET_MAX; ++i)
-- 
1.7.2.2