# HG changeset patch # User lost # Date 1231377489 0 # Node ID 4b37f17624a7b097ddc7ac242cbababfb474c7bf # Parent 9fa4f77dd119476168908b7b5a22f5c0d10b2ee6 Added pragma directives diff -r 9fa4f77dd119 -r 4b37f17624a7 src/instab.c --- a/src/instab.c Tue Jan 06 06:20:31 2009 +0000 +++ b/src/instab.c Thu Jan 08 01:18:09 2009 +0000 @@ -71,6 +71,10 @@ extern OPFUNC(pseudo_endm); extern OPFUNC(pseudo_setdp); extern OPFUNC(pseudo_set); +extern OPFUNC(pseudo_section); +extern OPFUNC(pseudo_endsection); +extern OPFUNC(pseudo_pragma); +extern OPFUNC(pseudo_starpragma); instab_t instab[] = { @@ -359,6 +363,16 @@ { "setdp", { -1, -1, -1, -1}, pseudo_setdp }, { "set", { -1, -1, -1, -1}, pseudo_set, 0, 0, 1 }, + { "section", { -1, -1, -1, -1}, pseudo_section }, + { "sect", { -1, -1, -1, -1}, pseudo_section }, + { "ends", { -1, -1, -1, -1}, pseudo_endsection }, + { "endsect", { -1, -1, -1, -1}, pseudo_endsection }, + { "endsection", { -1, -1, -1, -1}, pseudo_endsection }, + + { "pragma", { -1, -1, -1, -1}, pseudo_pragma }, + { "*pragma", { -1, -1, -1, -1}, pseudo_starpragma }, + + /* flag end of table */ { NULL, { -0x1, -0x1, -0x1, -0x1 }, insn_inh } }; diff -r 9fa4f77dd119 -r 4b37f17624a7 src/pragma.c --- a/src/pragma.c Tue Jan 06 06:20:31 2009 +0000 +++ b/src/pragma.c Thu Jan 08 01:18:09 2009 +0000 @@ -25,6 +25,7 @@ #include #include #include "lwasm.h" +#include "instab.h" /* A pragma is a means of controlling code generation. @@ -55,7 +56,7 @@ which may be very useful. */ -void pseudo_pragma_real(asmstate_t *as, sourceline_t *cl, char **optr, int error) +void pseudo_pragma_real(asmstate_t *as, lwasm_line_t *cl, char **optr, int error) { char pragma[128]; int c = 0; @@ -72,7 +73,9 @@ if (c == 0 || (**optr && !isspace(**optr))) { if (error) - errorp1(ERR_PRAGMA); + { + register_error(as, cl, 1, "Unrecognized pragma"); + } return; } pragma[c] = 0; @@ -87,16 +90,18 @@ else { if (error) - errorp1(ERR_PRAGMA); + { + register_error(as, cl, 1, "Unrecognized pragma"); + } } } -void pseudo_pragma(asmstate_t *as, sourceline_t *cl, char **optr) +OPFUNC(pseudo_pragma) { - pseudo_pragma_real(as, cl, optr, 1); + pseudo_pragma_real(as, l, p, 1); } -void pseudo_starpragma(asmstate_t *as, sourceline_t *cl, char **optr) +OPFUNC(pseudo_starpragma) { - pseudo_pragma_real(as, cl, optr, 0); + pseudo_pragma_real(as, l, p, 0); }