Mercurial > hg-old > index.cgi
diff src/lwasm.h @ 57:035b95a3690f
Added conditional assembly and macros
author | lost |
---|---|
date | Mon, 05 Jan 2009 00:01:21 +0000 |
parents | 8e32696380f3 |
children | b1d81800bc91 |
line wrap: on
line diff
--- a/src/lwasm.h Sun Jan 04 21:43:05 2009 +0000 +++ b/src/lwasm.h Mon Jan 05 00:01:21 2009 +0000 @@ -31,6 +31,16 @@ #define OUTPUT_OBJ 2 // proprietary object file format #define OUTPUT_RAWREL 3 // raw bytes where ORG causes a SEEK in the file +// structure for tracking macros +typedef struct macrotab_s macrotab_t; +struct macrotab_s +{ + char *name; + char **lines; + int numlines; + macrotab_t *next; +}; + // structure for tracking errors typedef struct lwasm_error_s lwasm_error_t; struct lwasm_error_s @@ -85,6 +95,8 @@ lwasm_symbol_ent_t *symhead; // first entry in symbol table lwasm_symbol_ent_t *symtail; // last entry in symbol table + + macrotab_t *macros; // macro table const char *infile; // input file const char *outfile; // output file @@ -94,6 +106,13 @@ int filelistlen; // number of files in the list int endseen; // set to true if "end" has been seen + int skipcond; // skipping a condition? + int skipcount; // how many? + int skipmacro; // skipping a macro? + int inmacro; // are we currently in a macro? + int macroex; // current depth of macro expansion + int nextcontext; // next context number + int skiplines; // number of lines to skip } asmstate_t; #define PRAGMA_NOINDEX0TONONE 1 @@ -117,6 +136,9 @@ __lwasm_E__ lwasm_expr_stack_t *lwasm_evaluate_expr(asmstate_t *as, lwasm_line_t *l, const char *inp, const char **outp); +// return next context number and update it +__lwasm_E__ int lwasm_next_context(asmstate_t *as); + // also throw an error on expression eval failure // return 0 on ok, -1 on error #define EXPR_NOFLAG 0