[pygccxml-development] How to distinguish between enum and typedef enum.
Brought to you by:
mbaas,
roman_yakovenko
|
From: Gustavo C. <gjc...@gm...> - 2008-07-27 14:56:38
|
Hello. I am trying to scan the following definitions:
struct SomeStruct
{
int x;
float y;
};
enum SomeEnum {
SOME_FOO,
SOME_BAR
};
int hello_xpto (struct SomeStruct xto);
int hello_zbr (enum SomeEnum xto);
typedef struct {
int x;
float y;
} SomeStruct2;
typedef enum {
SOME2_FOO,
SOME2_BAR
} SomeEnum2;
int hello_xpto2 (SomeStruct2 xto);
int hello_zbr2 (SomeEnum2 xto);
The intent is to generate bindings for, in this case, a pure C library,
using pure C code. My issue here is how to distinguish between an enum
defined via a typedef (SomeEnum2) and an enum the old fashioned C way.
Because the type needs to generated differently in both cases. I have to
generate 'enum SomeEnum', because simply referencing 'SomeEnum' does not
compile with a C compiler. On the other hand, I cannot generate a type
string 'enum SomeEnum2', because SomeEnum2 is actually a typedef, not a
proper enum; it also does not compile. So always putting enum in front of
everything does not work.
Idem for 'struct SomeStruct' vs 'SomeStruct2'.
I have been experimenting for a while, but could not find any way to
distinguish between the two cases. Any idea?
Thanks in advance.
--
Gustavo J. A. M. Carneiro
INESC Porto, Telecommunications and Multimedia Unit
"The universe is always one step beyond logic." -- Frank Herbert
|