Menu

#104 Constants are not up to date

confirmed
open
nobody
None
4
2015-11-27
2015-11-27
No

Note: this is more of a maintenance/design problem than a bug.

wxWidgets contains a lot of constants that must be copied in wxHaskell; they are created with #define or enum. There are several problems keeping synchronized:
1. There are many constants in wxWidgets (currently, wxcore contains a list of 2756 constants)
2. They might be changed at every release
3. Their values might depend on build settings, OS or compiler

Is it possible to automate this?
Consider the following enum:

      enum blah
      {
        wxFIRST   =  0,
      #ifdef _X_
        wxSECOND,
      #endif
        wxTHIRD,
        wxEND
      };

This should be translated to the following Haskell code:

        -- Enum blah from file wxWidgets/......
        wxFIRST :: Int
        wxFIRST =  0

      #ifdef _X_
        wxSECOND :: Int
        wxSECOND = 1

        wxTHIRD :: Int
        wxTHIRD = 2

        wxEND :: Int
        wxEND = 3
      #else
        wxTHIRD :: Int
        wxTHIRD = 1

        wxEND :: Int
        wxEND = 2
      #endif

_X_ is a macro that might indicate which compiler is used, in which OS it is compiled, or be a build setting; the macro definitions, available during wxWidgets build, will not all be available during wxHaskell build.

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.