Mercurial > hg-old > index.cgi
comparison lwasm/pass1.c @ 370:6b33faa21a0a
Debugging output and bugfixing pass 0
author | lost@starbug |
---|---|
date | Tue, 20 Apr 2010 21:59:58 -0600 |
parents | d96c30e60ddf |
children | 90de73ba0cac |
comparison
equal
deleted
inserted
replaced
369:898a41f7eb59 | 370:6b33faa21a0a |
---|---|
177 /* do nothing */ ; | 177 /* do nothing */ ; |
178 | 178 |
179 for (tok = p1; *p1 && !isspace(*p1); p1++) | 179 for (tok = p1; *p1 && !isspace(*p1); p1++) |
180 /* do nothing */ ; | 180 /* do nothing */ ; |
181 } | 181 } |
182 | 182 if (sym) |
183 cl -> sym = sym; | 183 cl -> sym = lw_strdup(sym); |
184 cl -> symset = 0; | 184 cl -> symset = 0; |
185 | 185 |
186 // tok points to the opcode for the line or NUL if none | 186 // tok points to the opcode for the line or NUL if none |
187 if (*tok) | 187 if (*tok) |
188 { | 188 { |
189 // look up operation code | 189 // look up operation code |
190 sym = lw_strndup(tok, p1 - tok); | 190 sym = lw_strndup(tok, p1 - tok); |
191 for (; *p1 && isspace(p1); p1++) | 191 for (; *p1 && isspace(*p1); p1++) |
192 /* do nothing */ ; | 192 /* do nothing */ ; |
193 | 193 |
194 for (opnum = 0; instab[opnum].opcode; opnum++) | 194 for (opnum = 0; instab[opnum].opcode; opnum++) |
195 { | 195 { |
196 if (!strcasecmp(instab[opnum].opcode, sym)) | 196 if (!strcasecmp(instab[opnum].opcode, sym)) |
250 | 250 |
251 if (!as -> skipcond && !as -> inmacro) | 251 if (!as -> skipcond && !as -> inmacro) |
252 { | 252 { |
253 if (cl -> sym && cl -> symset == 0) | 253 if (cl -> sym && cl -> symset == 0) |
254 { | 254 { |
255 printf("Register symbol %s:", sym); | 255 printf("Register symbol %s:", cl -> sym); |
256 lw_expr_print(cl -> addr); | 256 lw_expr_print(cl -> addr, stderr); |
257 printf("\n"); | 257 printf("\n"); |
258 | 258 |
259 // register symbol at line address | 259 // register symbol at line address |
260 if (!register_symbol(as, cl, cl -> sym, cl -> addr, symbol_flag_none)) | 260 if (!register_symbol(as, cl, cl -> sym, cl -> addr, symbol_flag_none)) |
261 { | 261 { |
262 // symbol error | 262 // symbol error |
263 lwasm_register_error(as, cl, "Bad symbol '%s'", cl -> sym); | 263 // lwasm_register_error(as, cl, "Bad symbol '%s'", cl -> sym); |
264 } | 264 } |
265 } | 265 } |
266 | 266 |
267 lw_expr_print(cl -> addr); | 267 lw_expr_print(cl -> addr, stderr); |
268 printf("\n"); | 268 printf("\n"); |
269 } | 269 } |
270 | 270 |
271 nextline: | 271 nextline: |
272 lw_free(line); | 272 lw_free(line); |