comparison lwasm/insn_rlist.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 362f8fb0695b
children 00fced888c5d
comparison
equal deleted inserted replaced
369:682524a1f32f 370:8764142b3192
36 while (**p && !isspace(**p)) 36 while (**p && !isspace(**p))
37 { 37 {
38 rn = lwasm_lookupreg2(regs, p); 38 rn = lwasm_lookupreg2(regs, p);
39 if (rn < 0) 39 if (rn < 0)
40 { 40 {
41 lwasm_register_error(as, l, "Bad register '%s'", *p); 41 lwasm_register_error2(as, l, E_REGISTER_BAD, "'%s'", *p);
42 return; 42 return;
43 } 43 }
44 if (**p && **p != ',' && !isspace(**p)) 44 if (**p && **p != ',' && !isspace(**p))
45 { 45 {
46 lwasm_register_error(as, l, "Bad operand"); 46 lwasm_register_error(as, l, E_OPERAND_BAD);
47 } 47 }
48 if (**p == ',') 48 if (**p == ',')
49 (*p)++; 49 (*p)++;
50 if (rn == 8) 50 if (rn == 8)
51 rn = 6; 51 rn = 6;
54 else 54 else
55 rn = 1 << rn; 55 rn = 1 << rn;
56 rb |= rn; 56 rb |= rn;
57 } 57 }
58 if (rb == 0) 58 if (rb == 0)
59 lwasm_register_error(as, l, "Bad operand"); 59 lwasm_register_error(as, l, E_OPERAND_BAD);
60 l -> len = OPLEN(instab[l -> insn].ops[0]) + 1; 60 l -> len = OPLEN(instab[l -> insn].ops[0]) + 1;
61 l -> pb = rb; 61 l -> pb = rb;
62 } 62 }
63 63
64 EMITFUNC(insn_emit_rlist) 64 EMITFUNC(insn_emit_rlist)