Mercurial > hg > index.cgi
diff lwasm/os9.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 | 244f1227f2b5 |
children | 928c033c0cd0 |
line wrap: on
line diff
--- a/lwasm/os9.c Mon Jun 22 18:38:30 2015 -0600 +++ b/lwasm/os9.c Mon Jun 22 18:49:38 2015 -0600 @@ -38,7 +38,7 @@ if (as -> output_format != OUTPUT_OS9 && as -> output_format != OUTPUT_OBJ) { - lwasm_register_error(as, l, "os9 directive only valid for OS9 target"); + lwasm_register_error2(as, l, E_DIRECTIVE_OS9_ONLY, "%s", "os9"); return; } @@ -46,7 +46,7 @@ e = lwasm_parse_expr(as, p); if (!e) { - lwasm_register_error(as, l, "Bad operand"); + lwasm_register_error(as, l, E_OPERAND_BAD); return; } lwasm_save_expr(l, 0, e); @@ -70,14 +70,14 @@ if (as -> output_format != OUTPUT_OS9) { - lwasm_register_error(as, l, "mod directive only valid for OS9 target"); + lwasm_register_error2(as, l, E_DIRECTIVE_OS9_ONLY, "%s", "mod"); skip_operand(p); return; } if (as -> inmod) { - lwasm_register_error(as, l, "Already in a module!"); + lwasm_register_error(as, l, E_MODULE_IN); skip_operand(p); return; } @@ -88,7 +88,7 @@ e = lwasm_parse_expr(as, p); if (!e) { - lwasm_register_error(as, l, "Bad operand"); + lwasm_register_error(as, l, E_OPERAND_BAD); return; } @@ -96,7 +96,7 @@ if (**p != ',') { - lwasm_register_error(as, l, "Bad operand"); + lwasm_register_error(as, l, E_OPERAND_BAD); return; } (*p)++; @@ -105,7 +105,7 @@ e = lwasm_parse_expr(as, p); if (!e) { - lwasm_register_error(as, l, "Bad operand"); + lwasm_register_error(as, l, E_OPERAND_BAD); return; } lwasm_save_expr(l, 5, e); @@ -173,13 +173,13 @@ skip_operand(p); if (as -> output_format != OUTPUT_OS9) { - lwasm_register_error(as, l, "emod directive only valid for OS9 target"); + lwasm_register_error2(as, l, E_DIRECTIVE_OS9_ONLY, "%s", "emod"); return; } if (!(as -> inmod)) { - lwasm_register_error(as, l, "not in a module!"); + lwasm_register_error(as, l, E_MODULE_NOTIN); return; }