Justin Heyes-Jones writes:
The problem I am looking at is that SDL uses un-named enums quite a lot. In addition it does arithmetic on them to create other enums... #define MAKE_MASK (n) (1<<n)
I can't find this.
I grep'ed for "enum", "MAKE_MASK" (0 hits) and "<<" (5 hits) in /usr/include/SDL/*.h and found:
o plenty of typedef enum { ... } SDL_audiostatus; which does not sound anonymous at all, even though its not enum <name> { ... };
o a single #define SDL_EVENTMASK(X) (1<<(X)) used by enum SDL_EventMasks, referring to enum SDL_Events
o and a single really anonymous one: enum { SDL_PRESSED = 0x01, SDL_RELEASED = 0x00 }; where SDL_PRESSED is reused via #define SDL_BUTTON(X) (SDL_PRESSED<<(X-1))
I'd say SDL_PRESSED is worth a defconstant.
Did I look at the wrong place or not understand anything at all?
[on a Ubuntu Breezy Debian i686 machine, with libsdl-1.2] BTW, does anybody know which package holds the gl* Manpages? I have the SDL_*.3.gz ones now, from package libsdl1.2-dev. Sadly, packages.debian.org (really valuable site) is down.
Regards, Jörg Höhle.
Hi
I should have made it clearer that my code there was just an example of the kind of thing SDL does. The actual one I was looking at was the event mask one in your grep results.
Sorry for the confusion.
Justin
On 1/25/06, Hoehle, Joerg-Cyril Joerg-Cyril.Hoehle@t-systems.com wrote:
Justin Heyes-Jones writes:
The problem I am looking at is that SDL uses un-named enums quite a lot. In addition it does arithmetic on them to create other enums... #define MAKE_MASK (n) (1<<n)
I can't find this.
I grep'ed for "enum", "MAKE_MASK" (0 hits) and "<<" (5 hits) in /usr/include/SDL/*.h and found:
o plenty of typedef enum { ... } SDL_audiostatus; which does not sound anonymous at all, even though its not enum <name> { ... };
o a single #define SDL_EVENTMASK(X) (1<<(X)) used by enum SDL_EventMasks, referring to enum SDL_Events
o and a single really anonymous one: enum { SDL_PRESSED = 0x01, SDL_RELEASED = 0x00 }; where SDL_PRESSED is reused via #define SDL_BUTTON(X) (SDL_PRESSED<<(X-1))
I'd say SDL_PRESSED is worth a defconstant.
Did I look at the wrong place or not understand anything at all?
[on a Ubuntu Breezy Debian i686 machine, with libsdl-1.2] BTW, does anybody know which package holds the gl* Manpages? I have the SDL_*.3.gz ones now, from package libsdl1.2-dev. Sadly, packages.debian.org (really valuable site) is down.
Regards, Jörg Höhle.
Jörg Höhle wrote:
o a single #define SDL_EVENTMASK(X) (1<<(X)) used by enum SDL_EventMasks, referring to enum SDL_Events
In SDL 1.2.9 from http://www.libsdl.org/release/SDL-1.2.9-win32.zip in SDL_events.h, where the SDL_EVENTMASK macro is used, the enum is an anonymous enum.
Luís Oliveira wrote:
I'm curious, can SWIG or Verrazano actually handle the enum that's defining those masks?
the Tcl mapping of SWIG calculates the numeric values and looks like it creates the Tcl equivalent of "defconstant". The current CFFI SWIG module outputs the C macro source code, but should be possible, too, with the right template files.