Mercurial > hg-old > index.cgi
diff lwasm/lwasm.h @ 342:7b4123dce741
Added basic symbol registration
author | lost@starbug |
---|---|
date | Wed, 24 Mar 2010 21:30:31 -0600 |
parents | 1a6fc6ebb31c |
children | 0215a0fbf61b |
line wrap: on
line diff
--- a/lwasm/lwasm.h Fri Mar 19 10:03:56 2010 +0000 +++ b/lwasm/lwasm.h Wed Mar 24 21:30:31 2010 -0600 @@ -69,11 +69,33 @@ lw_expr_t addr; // assembly address of the line int len; // the "size" this line occupies (address space wise) (-1 if unknown) int insn; // number of insn in insn table + int symset; // set if the line symbol was consumed by the instruction char *sym; // symbol, if any, on the line line_t *prev; line_t *next; }; +enum +{ + symbol_flag_set = 1, // symbol was used with "set" + symbol_flag_none = 0 // no flags +}; + +struct symtabe +{ + char *symbol; // the name of the symbol + int context; // symbol context (-1 for global) + int version; // version of the symbol (for "set") + int flags; // flags for the symbol + lw_expr_t value; // symbol value + struct symtabe *next; // next symbol in the table +}; + +typedef struct +{ + struct symtabe *head; // start of symbol table +} symtab_t; + typedef struct { int output_format; // output format @@ -84,6 +106,10 @@ line_t *line_head; // start of lines list line_t *line_tail; // tail of lines list + + int context; // the current "context" + + symtab_t symtab; // meta data for the symbol table char *list_file; // name of file to list to char *output_file; // output file name @@ -93,4 +119,11 @@ lw_stack_t file_dir; // stack of the "current file" dir } asmstate_t; +#ifndef ___symbol_c_seen___ + +extern struct symtabe *register_symbol(asmstate_t *as, char *sym, lw_expr_t value, int flags); +extern struct symtabe *lookup_symbol(asmstate_t *as, char *sym, int context, int version); + +#endif + #endif /* ___lwasm_h_seen___ */