comparison 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
comparison
equal deleted inserted replaced
253:c537a3a723fc 254:c7a41b4c89b3
74 { 74 {
75 char *name; 75 char *name;
76 char **lines; 76 char **lines;
77 int numlines; 77 int numlines;
78 macrotab_t *next; 78 macrotab_t *next;
79 };
80
81 // structure for tracking structs
82 struct struct_sym_e;
83
84 typedef struct structtab_s structtab_t;
85 struct structtab_s
86 {
87 char *name;
88 int size;
89 struct struct_sym_e *fields;
90 structtab_t *next;
91 };
92
93 struct struct_sym_e
94 {
95 char *name;
96 int size;
97 structtab_t *substruct;
98 struct struct_sym_e *next;
79 }; 99 };
80 100
81 // structure for tracking errors 101 // structure for tracking errors
82 typedef struct lwasm_error_s lwasm_error_t; 102 typedef struct lwasm_error_s lwasm_error_t;
83 struct lwasm_error_s 103 struct lwasm_error_s
129 #define SYMBOL_COMPLEX 2 // register symbol as a complex symbol (from l -> expr) 149 #define SYMBOL_COMPLEX 2 // register symbol as a complex symbol (from l -> expr)
130 #define SYMBOL_FORCE 4 // force resetting the symbol value if it already exists on pass 2 150 #define SYMBOL_FORCE 4 // force resetting the symbol value if it already exists on pass 2
131 #define SYMBOL_NORM 0 // no flags 151 #define SYMBOL_NORM 0 // no flags
132 #define SYMBOL_EXTERN 8 // the symbol is an external reference 152 #define SYMBOL_EXTERN 8 // the symbol is an external reference
133 #define SYMBOL_GLOBAL 16 // force global if non-complex symbol 153 #define SYMBOL_GLOBAL 16 // force global if non-complex symbol
154 #define SYMBOL_NOCHECK 32 // don't check characters for validity
134 typedef struct lwasm_symbol_ent_s lwasm_symbol_ent_t; 155 typedef struct lwasm_symbol_ent_s lwasm_symbol_ent_t;
135 struct lwasm_symbol_ent_s 156 struct lwasm_symbol_ent_s
136 { 157 {
137 char *sym; // the symbol 158 char *sym; // the symbol
138 int context; // the context number of the symbol (-1 for global) 159 int context; // the context number of the symbol (-1 for global)
160 181
161 lwasm_symbol_ent_t *symhead; // first entry in symbol table 182 lwasm_symbol_ent_t *symhead; // first entry in symbol table
162 lwasm_symbol_ent_t *symtail; // last entry in symbol table 183 lwasm_symbol_ent_t *symtail; // last entry in symbol table
163 184
164 macrotab_t *macros; // macro table 185 macrotab_t *macros; // macro table
186 structtab_t *structs; // structure table
187 structtab_t *cstruct; // address within the current structure def
165 188
166 const char *infile; // input file 189 const char *infile; // input file
167 const char *outfile; // output file 190 const char *outfile; // output file
168 const char *listfile; // output listing file 191 const char *listfile; // output listing file
169 int outformat; // output format type 192 int outformat; // output format type
176 int skipmacro; // skipping a macro? 199 int skipmacro; // skipping a macro?
177 int inmacro; // are we currently in a macro? 200 int inmacro; // are we currently in a macro?
178 int macroex; // current depth of macro expansion 201 int macroex; // current depth of macro expansion
179 int nextcontext; // next context number 202 int nextcontext; // next context number
180 int skiplines; // number of lines to skip 203 int skiplines; // number of lines to skip
204 int instruct; // are we currently in a structure def?
181 205
182 // items used only for the "object" target 206 // items used only for the "object" target
183 sectiontab_t *sections; // pointer to section table 207 sectiontab_t *sections; // pointer to section table
184 sectiontab_t *csect; // current section - NULL if not in one 208 sectiontab_t *csect; // current section - NULL if not in one
185 209