Mercurial > hg-old > index.cgi
comparison src/pseudo.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 |
---|---|
352 l -> symaddr = as -> addr; | 352 l -> symaddr = as -> addr; |
353 } | 353 } |
354 | 354 |
355 OPFUNC(pseudo_equ) | 355 OPFUNC(pseudo_equ) |
356 { | 356 { |
357 lwasm_expr_stack_t *s; | |
358 int rval; | 357 int rval; |
359 | 358 |
360 // equ is not needed to be processed on pass 2 | 359 // equ is not needed to be processed on pass 2 |
361 if (as -> passnum != 1) | 360 if (as -> passnum != 1) |
362 return; | 361 return; |
365 { | 364 { |
366 register_error(as, l, 1, "No symbol specified"); | 365 register_error(as, l, 1, "No symbol specified"); |
367 return; | 366 return; |
368 } | 367 } |
369 | 368 |
370 s = lwasm_evaluate_expr(as, l, *p, NULL); | 369 if (lwasm_expr_result(as, l, p, EXPR_PASS1CONST, &rval) < 0) |
371 | |
372 if (!s) | |
373 { | |
374 register_error(as, l, 1, "Bad expression"); | |
375 rval = 0; | 370 rval = 0; |
376 } | 371 |
377 else | |
378 { | |
379 if (!lwasm_expr_is_constant(s)) | |
380 register_error(as, l, 1, "Invalid incomplete reference (pass 1)"); | |
381 rval = lwasm_expr_get_value(s); | |
382 lwasm_expr_stack_free(s); | |
383 } | |
384 l -> symaddr = rval & 0xFFFF; | 372 l -> symaddr = rval & 0xFFFF; |
385 l -> addrset = 2; | 373 l -> addrset = 2; |
386 if (strchr(l -> sym, '@') || strchr(l -> sym, '?')) | 374 |
387 lwasm_set_symbol(as, l -> sym, as -> context, l -> symaddr); | 375 lwasm_register_symbol(as, l, l -> sym, rval); |
388 else | 376 } |
389 lwasm_set_symbol(as, l -> sym, -1, l -> symaddr); | 377 |
390 } | 378 OPFUNC(pseudo_set) |
379 { | |
380 } | |
381 | |
391 /* | 382 /* |
392 void pseudo_set(asmstate_t *as, sourceline_t *cl, char **optr) | 383 void pseudo_set(asmstate_t *as, sourceline_t *cl, char **optr) |
393 { | 384 { |
394 int rval, v1; | 385 int rval, v1; |
395 | 386 |