Author Topic: XML based compilers  (Read 330967 times)

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Re: XML based compilers
« Reply #180 on: December 28, 2012, 06:23:10 am »
Some questions.
Here (compilerKeilC51.cpp):
Code
        wxRegKey key;   // defaults to HKCR
        key.SetName(wxT("HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Keil \265Vision3"));
        if (key.Exists() && key.Open(wxRegKey::Read)) // found; read it
            key.QueryValue(wxT("LastInstallDir"), m_MasterPath);
did you mean:
Code
        key.SetName(wxT("HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Keil\\265Vision3"));

Here (options_keilcx51.xml):
Code
    <if platform="windows">
        <Program name="LD"        value="LX51.exe"/>
        <Program name="LIB"       value="LIBX51.exe"/>
    </if>
    <else>
        <Program name="LD"        value="LX51"/>
        <Program name="LIB"       value="LIBX51"/>
    </else>
did you intend to have:
Code
    <if platform="windows">
        <Program name="CPP"       value="CX51.exe"/>
        <Program name="LD"        value="LX51.exe"/>
        <Program name="LIB"       value="LIBX51.exe"/>
    </if>
    <else>
        <Program name="CPP"       value="CX51"/>
        <Program name="LD"        value="LX51"/>
        <Program name="LIB"       value="LIBX51"/>
    </else>

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Re: XML based compilers
« Reply #181 on: December 28, 2012, 10:08:05 pm »
Attached is a modified version of your patch.  [[Edit: use the version in the later post.]]  There are some changes to formatting, removal of sections that appeared to have no purpose, and tweaks/fixes.  Could you please test and let me know if it still works as intended?

I don't think it ever has changed or become irrelevant. The SDCC manual
http://sdcc.sourceforge.net/doc/sdccman.pdf states on p.24 that the object file extension is .rel.

Looking at the sourceforge SVN source code of SDCC, it's slightly more complicated. AVR, DS390, HC08, MCS51, XA51 and Z80 ports use .rel as object extension, only the PIC14 and PIC16 backends use .o as object extension (see sdcc/src/*/main.c, the PORT structs). I'd consider the PIC backends as of the lesser stable/mature backends - so it seems strange to break the stable backends because of a few unstable ones...

So it seems the correct fix would be (apart from convincing SDCC developers to use the same extension for all backends) to select the object file extension based on which architecture switch was selected...
According to PM with user squalyl, PIC port produces *.o because it uses gpasm and gplink.  The easier solution would be to duplicate SDCC to create SDCC-PIC, however, I would prefer to instead detect the correct option.  Do you have a list of the specific flags that switch it to PIC (is it -mpic14 and -mpic16)?  (I plan to revert the default to *.rel.)

[attachment deleted by admin]
« Last Edit: December 29, 2012, 01:16:09 am by Alpha »

Offline tomjnx

  • Multiple posting newcomer
  • *
  • Posts: 34
Re: XML based compilers
« Reply #182 on: December 29, 2012, 12:20:16 am »
Thanks for your effort!

did you mean:
Code
        key.SetName(wxT("HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Keil\\265Vision3"));

Um, no, I meant the lowercase greek letter mu, µ. So the directory component should be "Keil µVision3" (µVision being the name of their IDE)

Here (options_keilcx51.xml):
Code
    <if platform="windows">
        <Program name="LD"        value="LX51.exe"/>
        <Program name="LIB"       value="LIBX51.exe"/>
    </if>
    <else>
        <Program name="LD"        value="LX51"/>
        <Program name="LIB"       value="LIBX51"/>
    </else>
did you intend to have:
Code
    <if platform="windows">
        <Program name="CPP"       value="CX51.exe"/>
        <Program name="LD"        value="LX51.exe"/>
        <Program name="LIB"       value="LIBX51.exe"/>
    </if>
    <else>
        <Program name="CPP"       value="CX51"/>
        <Program name="LD"        value="LX51"/>
        <Program name="LIB"       value="LIBX51"/>
    </else>

Yes. Thanks for the fix. On second thought, the conditional could be removed and only the windows version be retained, as keil doesn't offer their tools for anything other than windows, and apparently the have absolutely no plans to change this.

Offline tomjnx

  • Multiple posting newcomer
  • *
  • Posts: 34
Re: XML based compilers
« Reply #183 on: December 29, 2012, 12:26:31 am »
Attached is a modified version of your patch.  There are some changes to formatting, removal of sections that appeared to have no purpose, and tweaks/fixes.  Could you please test and let me know if it still works as intended?
I will do that, but it will most likely be after new year.

Do you have a list of the specific flags that switch it to PIC (is it -mpic14 and -mpic16)?  (I plan to revert the default to *.rel.)
Yes, exactly.

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Re: XML based compilers
« Reply #184 on: December 29, 2012, 01:14:50 am »
Um, no, I meant the lowercase greek letter mu, µ. So the directory component should be "Keil µVision3" (µVision being the name of their IDE)
Ah, okay.
I will do that, but it will most likely be after new year.
Sure; when you do, use the version attached here (it formats a little more, and reverts my change to mu).

Offline tomjnx

  • Multiple posting newcomer
  • *
  • Posts: 34
Re: XML based compilers
« Reply #185 on: January 04, 2013, 08:39:38 pm »
Sure; when you do, use the version attached here (it formats a little more, and reverts my change to mu).

I've now reviewed and tested this patch. It looks good. You've made some nice improvements!

The only thing I forgot: DBGconfig should be set to the empty string in options_keilc51.xml and options_iar8051.xml; axs_debugger is not yet merged.

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Re: XML based compilers
« Reply #186 on: January 04, 2013, 09:09:16 pm »
The only thing I forgot: DBGconfig should be set to the empty string in options_keilc51.xml and options_iar8051.xml; axs_debugger is not yet merged.
Okay.

Offline tomjnx

  • Multiple posting newcomer
  • *
  • Posts: 34
Re: XML based compilers
« Reply #187 on: January 06, 2013, 01:26:48 pm »
Thanks for merging!

Now that these compilers are in, I've posted a patch (#3400 on the berlios queue) to the scripted wizard MCS51 project generator to allow the user to choose IAR or Keil in addition to SDCC.

Offline darmar

  • Multiple posting newcomer
  • *
  • Posts: 68
Re: XML based compilers
« Reply #188 on: October 26, 2013, 01:41:10 pm »
I have had few problems with ‘xml based compilers’ when I have tried to port Intel Fortran compiler:

1) I can specify, that compiler will run only on ‘windows’, or on ‘linux’, or on ‘macosx’. But how to say ‘non-windows’? Or ‘linux and macosx’?

2) In an options file, I can specify, that one option ‘supersedes’ another. But some of Intel’s options are from two separate words (e.g. "-check bounds"). It seems, that C::B can’t handle such options in ‘supersedes’ list.  Have I missed something?

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Re: XML based compilers
« Reply #189 on: October 26, 2013, 11:21:43 pm »
Currently, the format does not support those options.  If you have a recommendation on how to extend the format, I will see what I can come up with (when I have time).  Or you could prepare a patch; I would be happy to review it.

Offline gd_on

  • Lives here!
  • ****
  • Posts: 799
Re: XML based compilers
« Reply #190 on: October 27, 2013, 06:21:08 pm »
Before the introduction of xml based compilers, it was possible to obtain localized strings for each compiler options. Now, with xml compilers, they only appear in english, even if I force the correct chain and it's translation to be in the .po (and .mo) file. May be the "name" parameter in the xml file should be treated somewhere with a _(...) and not with a _T(...) (or wxT(...)).
Is it possible to reintroduce this localization possibility?
Thanks

gd_on
Windows 11 64 bits (23H2), svn C::B (last version or almost!), wxWidgets 3.2.5 (tests with 3.3), Msys2 Compilers 14.1.0, 64 bits (seh, posix : gcc, g++ and gfortran in C:\msys64\mingw64) or 32 bits (dwarf2, posix  in C:\msys64\mingw32).

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Re: XML based compilers
« Reply #191 on: October 27, 2013, 07:34:44 pm »
Does this patch enable translation?
Code
Index: src/plugins/compilergcc/compilerXML.cpp
===================================================================
--- src/plugins/compilergcc/compilerXML.cpp (revision 9423)
+++ src/plugins/compilergcc/compilerXML.cpp (working copy)
@@ -15,7 +15,7 @@
 #include "compilerXML.h"
 
 CompilerXML::CompilerXML(const wxString& name, const wxString& ID, const wxString& file)
-    : Compiler(name, ID), m_fileName(file)
+    : Compiler(_(name), ID), m_fileName(file)
 {
     wxXmlDocument compiler;
     compiler.Load(m_fileName);

Offline gd_on

  • Lives here!
  • ****
  • Posts: 799
Re: XML based compilers
« Reply #192 on: October 28, 2013, 10:39:07 am »
I tried your patch but I obtain a compilation error :
Quote
||=== Build: Compiler in Code::Blocks wx2.8.x (compiler: GNU GCC Compiler) ===|
C:\Users\Gerard_2\Documents\CodeBlocks_SVN\CodeBlocks_src\src\plugins\compilergcc\compilerXML.cpp||In constructor 'CompilerXML::CompilerXML(const wxString&, const wxString&, const wxString&)':|
C:\wxWidgets-2.8.12\include\wx\wxchar.h|235|error: 'Lname' was not declared in this scope|
C:\wxWidgets-2.8.12\include\wx\cpp.h|17|note: in definition of macro 'wxCONCAT_HELPER'|
C:\wxWidgets-2.8.12\include\wx\intl.h|48|note: in expansion of macro 'wxT'|
C:\Users\Gerard_2\Documents\CodeBlocks_SVN\CodeBlocks_src\src\plugins\compilergcc\compilerXML.cpp|18|note: in expansion of macro '_'|
||=== Build failed: 1 error(s), 0 warning(s) (0 minute(s), 4 second(s)) ===|

error at line 235 in wchar.h :
Code
233 #if wxUSE_UNICODE
234      /* use wxCONCAT_HELPER so that x could be expanded if it's a macro */
235     #define wxT(x) wxCONCAT_HELPER(L, x)
236 #else /* !Unicode */
237     #define wxT(x) x
238 #endif /* Unicode/!Unicode */

maybe a missing header.

gd_on
Windows 11 64 bits (23H2), svn C::B (last version or almost!), wxWidgets 3.2.5 (tests with 3.3), Msys2 Compilers 14.1.0, 64 bits (seh, posix : gcc, g++ and gfortran in C:\msys64\mingw64) or 32 bits (dwarf2, posix  in C:\msys64\mingw32).

Offline osdt

  • Multiple posting newcomer
  • *
  • Posts: 63
Re: XML based compilers
« Reply #193 on: October 28, 2013, 12:43:28 pm »
I tried your patch but I obtain a compilation error :
Quote
...
C:\wxWidgets-2.8.12\include\wx\wxchar.h|235|error: 'Lname' was not declared in this scope|
...

The macro '_(name)' expands to 'Lname' for unicode builds. It's designed for quoted strings ("translate me") only.

@gd_on: do you really want to translate compiler names like 'GCC' ?

- osdt


Offline gd_on

  • Lives here!
  • ****
  • Posts: 799
Re: XML based compilers
« Reply #194 on: October 28, 2013, 12:52:28 pm »
Quote
do you really want to translate compiler names like 'GCC' ?
No, I don't.
I simply want to translate options as they appear in compiler options, and more precisely in window "Global compiler settings", Compiler settings, Compiler flags tabs.
For example:
the string: Produce debugging symbols (displayed as Produce debugging symbols [-g])
will become in french: Produire des symboles de débogage (displayed as Produire des symboles de débogage [-g])

gd_on
Windows 11 64 bits (23H2), svn C::B (last version or almost!), wxWidgets 3.2.5 (tests with 3.3), Msys2 Compilers 14.1.0, 64 bits (seh, posix : gcc, g++ and gfortran in C:\msys64\mingw64) or 32 bits (dwarf2, posix  in C:\msys64\mingw32).