comparison lwasm/insn_logicmem.c @ 370:8764142b3192

Convert internal error/warning handling framework to a new unified system Replace the ad hoc error and warning handling with a new system that codifies the errors with specific codes. This makes it possible in the future for error numbers to be used for testing and other purposes. It also makes sure the error strings themselves are consistent. Thanks to Erik G <erik@6809.org> for the patch.
author William Astle <lost@l-w.ca>
date Mon, 22 Jun 2015 18:49:38 -0600
parents b78b2f1e011e
children 8e25147c2aa8
comparison
equal deleted inserted replaced
369:682524a1f32f 370:8764142b3192
43 (*p)++; 43 (*p)++;
44 44
45 s = lwasm_parse_expr(as, p); 45 s = lwasm_parse_expr(as, p);
46 if (!s) 46 if (!s)
47 { 47 {
48 lwasm_register_error(as, l, "Bad operand"); 48 lwasm_register_error(as, l, E_OPERAND_BAD);
49 return; 49 return;
50 } 50 }
51 51
52 lwasm_save_expr(l, 100, s); 52 lwasm_save_expr(l, 100, s);
53 if (**p != ',' && **p != ';') 53 if (**p != ',' && **p != ';')
54 { 54 {
55 lwasm_register_error(as, l, "Bad operand"); 55 lwasm_register_error(as, l, E_OPERAND_BAD);
56 return; 56 return;
57 } 57 }
58 58
59 (*p)++; 59 (*p)++;
60 60
76 int v; 76 int v;
77 77
78 e = lwasm_fetch_expr(l, 100); 78 e = lwasm_fetch_expr(l, 100);
79 if (!lw_expr_istype(e, lw_expr_type_int)) 79 if (!lw_expr_istype(e, lw_expr_type_int))
80 { 80 {
81 lwasm_register_error(as, l, "Immediate byte must be fully resolved"); 81 lwasm_register_error(as, l, E_IMMEDIATE_UNRESOLVED);
82 return; 82 return;
83 } 83 }
84 84
85 v = lw_expr_intval(e); 85 v = lw_expr_intval(e);
86 /* if (v < -128 || v > 255) 86 /* if (v < -128 || v > 255)
87 { 87 {
88 fprintf(stderr, "BYTE: %d\n", v); 88 fprintf(stderr, "BYTE: %d\n", v);
89 lwasm_register_error(as, l, "Byte overflow"); 89 lwasm_register_error(as, l, E_BYTE_OVERFLOW);
90 return; 90 return;
91 } 91 }
92 */ 92 */
93 insn_emit_gen_aux(as, l, v & 0xff); 93 insn_emit_gen_aux(as, l, v & 0xff);
94 } 94 }