Mercurial > hg-old > index.cgi
comparison src/parse.c @ 63:d85ba47b1e8f
Moved symbol registration so symbols that are in skipped code do not get registered and so EQU/SET can do their own registration
author | lost |
---|---|
date | Mon, 05 Jan 2009 01:17:23 +0000 |
parents | 035b95a3690f |
children | aaddd47219b4 |
comparison
equal
deleted
inserted
replaced
62:da1337724ecd | 63:d85ba47b1e8f |
---|---|
64 sym[p2 - p] = '\0'; | 64 sym[p2 - p] = '\0'; |
65 memcpy(sym, p, p2 - p); | 65 memcpy(sym, p, p2 - p); |
66 | 66 |
67 p = p2; | 67 p = p2; |
68 | 68 |
69 if (as -> passnum == 1) | |
70 { | |
71 l -> sym = sym; | |
72 // have a symbol; now determine if it is valid and register it | |
73 // at the current address of the line | |
74 debug_message(1, "Registering symbol '%s' at %04X", sym, as -> addr); | |
75 if (lwasm_register_symbol(as, l, sym, as -> addr) < 0) | |
76 l -> sym = NULL; | |
77 } | |
78 } | 69 } |
79 else | 70 else |
80 { | 71 { |
81 while (*p && isspace(*p)) | 72 while (*p && isspace(*p)) |
82 p++; | 73 p++; |
130 { | 121 { |
131 if (expand_macro(as, l, &p2, opc) == 0) | 122 if (expand_macro(as, l, &p2, opc) == 0) |
132 goto done_line; | 123 goto done_line; |
133 } | 124 } |
134 | 125 |
126 // register symbol if needed | |
127 if (as -> skipcond == 0 && as -> inmacro == 0 && sym) | |
128 { | |
129 l -> sym = sym; | |
130 if (as -> passnum == 1 && !(instab[opnum].opcode && instab[opnum].setsym)) | |
131 { | |
132 // have a symbol; now determine if it is valid and register it | |
133 // at the current address of the line | |
134 debug_message(1, "Registering symbol '%s' at %04X", sym, as -> addr); | |
135 if (lwasm_register_symbol(as, l, sym, as -> addr) < 0) | |
136 l -> sym = NULL; | |
137 } | |
138 } | |
139 | |
135 if (!(instab[opnum].opcode) || !(instab[opnum].fn) && !(as -> skipcond || as -> inmacro)) | 140 if (!(instab[opnum].opcode) || !(instab[opnum].fn) && !(as -> skipcond || as -> inmacro)) |
136 { | 141 { |
137 // invalid operation code, throw error | 142 // invalid operation code, throw error |
138 register_error(as, l, 1, "Invalid operation code '%s'", opc); | 143 register_error(as, l, 1, "Invalid operation code '%s'", opc); |
139 if (sym) | 144 if (sym) |