changeset 73:4b37f17624a7

Added pragma directives
author lost
date Thu, 08 Jan 2009 01:18:09 +0000
parents 9fa4f77dd119
children c8c772ef5df9
files src/instab.c src/pragma.c
diffstat 2 files changed, 26 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- 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 }
 };
--- 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 <stdlib.h>
 #include <string.h>
 #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);
 }