diff 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
line wrap: on
line diff
--- a/lwasm/insn_rlist.c	Mon Jun 22 18:38:30 2015 -0600
+++ b/lwasm/insn_rlist.c	Mon Jun 22 18:49:38 2015 -0600
@@ -38,12 +38,12 @@
 		rn = lwasm_lookupreg2(regs, p);
 		if (rn < 0)
 		{
-			lwasm_register_error(as, l, "Bad register '%s'", *p);
+			lwasm_register_error2(as, l, E_REGISTER_BAD, "'%s'", *p);
 			return;
 		}
 		if (**p && **p != ',' && !isspace(**p))
 		{
-			lwasm_register_error(as, l, "Bad operand");
+			lwasm_register_error(as, l, E_OPERAND_BAD);
 		}
 		if (**p == ',')
 			(*p)++;
@@ -56,7 +56,7 @@
 		rb |= rn;
 	}
 	if (rb == 0)
-		lwasm_register_error(as, l, "Bad operand");
+		lwasm_register_error(as, l, E_OPERAND_BAD);
 	l -> len = OPLEN(instab[l -> insn].ops[0]) + 1;
 	l -> pb = rb;
 }