Mercurial > hg-old > index.cgi
diff lwasm/lwasm.h @ 254:c7a41b4c89b3 2.x
Added struct support to LWASM
author | lost |
---|---|
date | Sat, 19 Dec 2009 06:38:43 +0000 |
parents | f9f01a499525 |
children | e27279180a73 |
line wrap: on
line diff
--- a/lwasm/lwasm.h Wed Dec 09 03:59:26 2009 +0000 +++ b/lwasm/lwasm.h Sat Dec 19 06:38:43 2009 +0000 @@ -78,6 +78,26 @@ macrotab_t *next; }; +// structure for tracking structs +struct struct_sym_e; + +typedef struct structtab_s structtab_t; +struct structtab_s +{ + char *name; + int size; + struct struct_sym_e *fields; + structtab_t *next; +}; + +struct struct_sym_e +{ + char *name; + int size; + structtab_t *substruct; + struct struct_sym_e *next; +}; + // structure for tracking errors typedef struct lwasm_error_s lwasm_error_t; struct lwasm_error_s @@ -131,6 +151,7 @@ #define SYMBOL_NORM 0 // no flags #define SYMBOL_EXTERN 8 // the symbol is an external reference #define SYMBOL_GLOBAL 16 // force global if non-complex symbol +#define SYMBOL_NOCHECK 32 // don't check characters for validity typedef struct lwasm_symbol_ent_s lwasm_symbol_ent_t; struct lwasm_symbol_ent_s { @@ -162,6 +183,8 @@ lwasm_symbol_ent_t *symtail; // last entry in symbol table macrotab_t *macros; // macro table + structtab_t *structs; // structure table + structtab_t *cstruct; // address within the current structure def const char *infile; // input file const char *outfile; // output file @@ -178,6 +201,7 @@ int macroex; // current depth of macro expansion int nextcontext; // next context number int skiplines; // number of lines to skip + int instruct; // are we currently in a structure def? // items used only for the "object" target sectiontab_t *sections; // pointer to section table