Mercurial > hg-old > index.cgi
diff src/lwasm.c @ 98:81fc353d4d69
Cleaned up old lwasm_expr_result() function and unused EXPR_* flags
author | lost |
---|---|
date | Sat, 17 Jan 2009 07:12:05 +0000 |
parents | 83ba34ed11b3 |
children | f59c0916753d |
line wrap: on
line diff
--- a/src/lwasm.c Sat Jan 17 07:09:15 2009 +0000 +++ b/src/lwasm.c Sat Jan 17 07:12:05 2009 +0000 @@ -315,82 +315,6 @@ Evaluate an expression according to the flag value. Return 0 if a constant result was obtained, 1 if an incomplete result was obtained, and -1 if an error was flagged. -Symbol resolution will be modified for the object target as follows: -- a symbol which is not defined within a section will evaluate as a constant -- a symbol which is defined within the same section will evaluate as a constant -- a symbol defined in another section will remain unresolved -- external references will also remain unresolved - -EXPR_PASS2PASS will cause the result from pass 1 along with the offset to -the end of the expression to be stored in the line data. There can only be -one such expression per source line. In this case, the expression is parsed -and evaluated on pass 1 but the intermediate representation is re-evaluated -on pass 2. -*/ -/* -int lwasm_expr_result(asmstate_t *as, lwasm_line_t *l, char **inp, int flag, int *val) -{ - lwasm_expr_stack_t *s; - const char *ep; - int rval; - - s = lwasm_evaluate_expr(as, l, *inp, &ep); - if (!s) - { - register_error(as, l, 1, "Bad expression"); - *val = 0; - return -1; - } - *inp = (char *)ep; - - if (flag & EXPR_PASS1CONST && as -> passnum == 1 && !lwasm_expr_result_ckconst(as, s)) - { - register_error(as, l, 1, "Undefined reference (pass 1)"); - *val = 0; - lwasm_expr_stack_free(s); - return -1; - } - if (flag & EXPR_PASS2CONST && as -> passnum == 2 && !lwasm_expr_result_ckconst(as, s)) - { - register_error(as, l, 2, "Undefined reference (pass 2)"); - *val = 0; - lwasm_expr_stack_free(s); - return -1; - } - if (flag & EXPR_NOINTERSECT && !lwasm_expr_is_constant(s)) - { - register_error(as, l, 2, "Invalid inter-section reference"); - } - *val = lwasm_expr_get_value(s); - if (l -> expr) - { - lwasm_expr_stack_free(l -> expr); - l -> expr = NULL; - } - if (lwasm_is_constant(s)) - { - // fully resolved value here - lwasm_expr_stack_free(s); - } - else - { - // incomplete reference here - l -> expr = s; - } - - if (flag & EXPR_BYTE && as -> passnum == 2 && (*val < -128 || *val > 255)) - { - register_error(as, l, 2, "Byte overflow"); - *val &= 0xff; - return -1; - } - if (flag & EXPR_BYTE) - { - *val &= 0xff; - } - - return 0; -} */ int lwasm_expr_result2(asmstate_t *as, lwasm_line_t *l, char **inp, int flag, int *val, int slot) {