changeset 81:428068681cbf

Added nolist pragma to suppress listing output of non-code generating lines
author Lost Wizard (lost@starbug3)
date Wed, 25 May 2011 19:13:33 -0600
parents 585cd68253f0
children adf4ce03a6a3
files lwasm/list.c lwasm/lwasm.h lwasm/pragma.c
diffstat 3 files changed, 14 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/lwasm/list.c	Wed May 18 20:09:33 2011 -0600
+++ b/lwasm/list.c	Wed May 25 19:13:33 2011 -0600
@@ -58,6 +58,11 @@
 	for (cl = as -> line_head; cl; cl = nl)
 	{
 		nl = cl -> next;
+		if (CURPRAGMA(cl, PRAGMA_NOLIST))
+		{
+			if (cl -> outputl <= 0)
+				continue;
+		}
 		if (cl -> noexpand_start)
 		{
 			obytelen = 0;
--- a/lwasm/lwasm.h	Wed May 18 20:09:33 2011 -0600
+++ b/lwasm/lwasm.h	Wed May 25 19:13:33 2011 -0600
@@ -78,7 +78,8 @@
 	PRAGMA_CESCAPES = 0x0008,			// allow C style escapes in fcc, fcs, fcn, etc.
 	PRAGMA_IMPORTUNDEFEXPORT = 0x0010,	// imports symbol if undefined upon export
 	PRAGMA_PCASPCR = 0x0020,			// treats ,PC as ,PCR instead of constant offset
-	PRAGMA_SHADOW = 0x0040				// allow macros to shadow builtin operations
+	PRAGMA_SHADOW = 0x0040,				// allow macros to shadow builtin operations
+	PRAGMA_NOLIST = 0x0080				// don't show line in listing
 };
 
 
@@ -185,6 +186,7 @@
 {
 	symbol_flag_set = 1,				// symbol was used with "set"
 	symbol_flag_nocheck = 2,			// do not check symbol characters
+	symbol_flag_nolist = 4,				// no not show symbol in symbol table
 	symbol_flag_none = 0				// no flags
 };
 
--- a/lwasm/pragma.c	Wed May 18 20:09:33 2011 -0600
+++ b/lwasm/pragma.c	Wed May 25 19:13:33 2011 -0600
@@ -43,6 +43,7 @@
 	{ "importundefexport", PRAGMA_IMPORTUNDEFEXPORT },
 	{ "pcaspcr", PRAGMA_PCASPCR },
 	{ "shadow", PRAGMA_SHADOW },
+	{ "nolist", PRAGMA_NOLIST },
 	{ 0, 0 }
 };
 
@@ -55,6 +56,7 @@
 	{ "noimportundefexport", PRAGMA_IMPORTUNDEFEXPORT },
 	{ "nopcaspcr", PRAGMA_PCASPCR },
 	{ "noshadow", PRAGMA_SHADOW },
+	{ "list", PRAGMA_NOLIST },
 	{ 0, 0 }
 };
 
@@ -113,6 +115,8 @@
 	{
 		lwasm_register_error(as, l, "Unrecognized pragma string");
 	}
+	if (as -> pragmas & PRAGMA_NOLIST)
+		l -> pragmas |= PRAGMA_NOLIST;
 	lw_free(ps);
 }
 
@@ -130,5 +134,7 @@
 	
 	// *pragma must NEVER throw an error
 	parse_pragma_string(as, ps, 1);
+	if (as -> pragmas & PRAGMA_NOLIST)
+		l -> pragmas |= PRAGMA_NOLIST;
 	lw_free(ps);
 }