Mercurial > hg-old > index.cgi
comparison src/lwasm.h @ 77:a338d496350e
Checkpointing conversion to allow object target
author | lost |
---|---|
date | Fri, 09 Jan 2009 04:23:00 +0000 |
parents | 2fe5fd7d65a3 |
children | 121bf4a588ea |
comparison
equal
deleted
inserted
replaced
76:2fe5fd7d65a3 | 77:a338d496350e |
---|---|
60 char *mess; // the actual error message | 60 char *mess; // the actual error message |
61 lwasm_error_t *next; // ptr to next error | 61 lwasm_error_t *next; // ptr to next error |
62 }; | 62 }; |
63 | 63 |
64 // structure for keeping track of lines | 64 // structure for keeping track of lines |
65 // it also as space for 4 expressions which is enough for all known | |
66 // instructions and addressing modes | |
67 // on pass 1, the expressions are parsed, on pass 2 they are re-evaluated | |
68 // to determine constancy | |
65 typedef struct lwasm_line_s lwasm_line_t; | 69 typedef struct lwasm_line_s lwasm_line_t; |
66 struct lwasm_line_s { | 70 struct lwasm_line_s { |
67 char *text; // the actual text of the line | 71 char *text; // the actual text of the line |
68 int lineno; // line number within the file | 72 int lineno; // line number within the file |
69 char *filename; // file name reference | 73 char *filename; // file name reference |
82 int badop; // bad operation - ignore it | 86 int badop; // bad operation - ignore it |
83 | 87 |
84 // the following are used for obj format - for external references, inter-section | 88 // the following are used for obj format - for external references, inter-section |
85 // references, and intrasection relocations | 89 // references, and intrasection relocations |
86 int relocoff; // offset into insn where relocation value goes | 90 int relocoff; // offset into insn where relocation value goes |
87 // the incomplete reference expression | 91 lwasm_expr_stack_t *exprs[4]; // non-constant expression values |
88 lwasm_expr_stack_t *expr; | 92 int exprvals[4]; // constant expression values |
93 char *exprends[4]; // pointer to character after end of expression | |
89 }; | 94 }; |
90 | 95 |
91 // for keeping track of symbols | 96 // for keeping track of symbols |
92 #define SYMBOL_SET 1 // the symbol was used for "SET" | 97 #define SYMBOL_SET 1 // the symbol was used for "SET" |
93 #define SYMBOL_COMPLEX 2 // register symbol as a complex symbol (from l -> expr) | 98 #define SYMBOL_COMPLEX 2 // register symbol as a complex symbol (from l -> expr) |
173 #define EXPR_NOFLAG 0 | 178 #define EXPR_NOFLAG 0 |
174 #define EXPR_PASS1CONST 1 // no forward references on pass 1 | 179 #define EXPR_PASS1CONST 1 // no forward references on pass 1 |
175 #define EXPR_PASS2CONST 2 // no undefined references on pass 2 | 180 #define EXPR_PASS2CONST 2 // no undefined references on pass 2 |
176 #define EXPR_BYTE 4 // the result must fit within 8 bits | 181 #define EXPR_BYTE 4 // the result must fit within 8 bits |
177 #define EXPR_COMPLEX 8 // a non-constant result is permitted (stored in l -> expr) | 182 #define EXPR_COMPLEX 8 // a non-constant result is permitted (stored in l -> expr) |
183 #define EXPR_NOINTERSECT 16 // only allow intra-section values (pass 2) | |
178 | 184 |
179 __lwasm_E__ int lwasm_expr_result(asmstate_t *as, lwasm_line_t *l, char **inp, int flag, int *val); | 185 __lwasm_E__ int lwasm_expr_result(asmstate_t *as, lwasm_line_t *l, char **inp, int flag, int *val); |
186 __lwasm_E__ int lwasm_expr_result2(asmstate_t *as, lwasm_line_t *l, char **inp, int flag, int *val, int slot); | |
180 | 187 |
181 #undef __lwasm_E__ | 188 #undef __lwasm_E__ |
182 | 189 |
183 | 190 |
184 #ifndef __symbol_c_seen__ | 191 #ifndef __symbol_c_seen__ |