Cross gcc Mailing List Archive

[Prev][Next][Index][Thread]

Converting C structures to assembler directives




I'm looking for a method of creating an assembler include file (i.e.
nothing more
complicated than an 'equate' directive) from C structure definitions. 

e.g. input file might be :

#define NO_OF_UNITS	20

typedef unsigned int	U32;
typedef unsigned short	U16;

struct MTYPE {
	U32 element1;
	U16 element2;
	U16 element3[NO_OF_UNITS];
	U32 element4
};


Then the output file would be some equivalent to :

MYTYPE_element1	equ	0
MYTYPE_element2	equ	4
MYTYPE_element3	equ	6
MYTYPE_element4	equ	46


In practice, I could probably get away with a more restricted input
format
- perhaps just #defines and structures containing only primitive types, 
but a more general tool would be useful.

Does anyone know how this could be done ? Free and commercial solutions
are almost equally OK, but it probably has to run under DOS and NT, not 
Unix only.

-adrian


Follow-Ups:

Home | Subject Index | Thread Index