changeset 484:469a130e7029

Add option to suppress output file Add --no-output to suppress creation of the output file altogether. Useful when the assembler is used for other features without needing the assembled object.
author William Astle <lost@l-w.ca>
date Tue, 19 Mar 2019 14:45:53 -0600
parents 40c32a0af8c8
children bf24b8c856d1
files lwasm/lwasm.h lwasm/main.c
diffstat 2 files changed, 10 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/lwasm/lwasm.h	Tue Mar 19 14:37:56 2019 -0600
+++ b/lwasm/lwasm.h	Tue Mar 19 14:45:53 2019 -0600
@@ -73,8 +73,9 @@
 	FLAG_SYMBOLS = 0x004,
 	FLAG_DEPENDNOERR = 0x0008,
 	FLAG_UNICORNS = 0x0010,
-	FLAG_MAP = 0x0020,
-	FLAG_SYMBOLS_NOLOCALS = 0x0040,
+	FLAG_MAP = 0x0020,
+	FLAG_SYMBOLS_NOLOCALS = 0x0040,
+	FLAG_NOOUT = 0x80,
 	FLAG_NONE = 0
 };
 
--- a/lwasm/main.c	Tue Mar 19 14:37:56 2019 -0600
+++ b/lwasm/main.c	Tue Mar 19 14:45:53 2019 -0600
@@ -64,6 +64,7 @@
 	{ "preprocess",	'P',	0,			0,							"Preprocess macros and conditionals and output revised source to stdout" },
 	{ "unicorns",	0x142,	0,			0,							"Add sooper sekrit sauce"},
 	{ "6800compat",	0x200,	0,			0,							"Enable 6800 compatibility instructions, equivalent to --pragma=6800compat" },
+	{ "no-output",  0x105,  0,          0,                          "Inhibit creation of output file" },
 	{ 0 }
 };
 
@@ -103,6 +104,11 @@
 		if (as -> output_file)
 			lw_free(as -> output_file);
 		as -> output_file = lw_strdup(arg);
+		as -> flags &= ~FLAG_NOOUT;
+		break;
+
+	case 0x105:
+		as -> flags |= FLAG_NOOUT;
 		break;
 
 	case 'd':
@@ -371,7 +377,7 @@
 			lw_free(n);
 		}
 	}	
-	else
+	else if ((asmstate.flags & FLAG_NOOUT) == 0)
 	{
 		debug_message(&asmstate, 50, "Doing output");
 		do_output(&asmstate);