diff lwasm/list.c @ 442:61580fc48f98

Add option to omit file names from lwasm listings Add --list-nofiles option to modify generated listing to omit the filename specification.
author William Astle <lost@l-w.ca>
date Mon, 27 Nov 2017 22:52:17 -0700
parents 1ebb5a0b2874
children 83a124428f44
line wrap: on
line diff
--- a/lwasm/list.c	Mon Nov 27 22:35:53 2017 -0700
+++ b/lwasm/list.c	Mon Nov 27 22:52:17 2017 -0700
@@ -200,12 +200,19 @@
 		#define max_linespec_len 17
 
 		// trim "include:" if it appears
-		linespec = cl -> linespec;
-		if ((strlen(linespec) > 8) && (linespec[7] == ':')) linespec += 8;
-		while (*linespec == ' ') linespec++;
+		if (as -> listnofile)
+		{
+			fprintf(of, "%05d ", cl->lineno);
+		}
+		else
+		{
+			linespec = cl -> linespec;
+			if ((strlen(linespec) > 8) && (linespec[7] == ':')) linespec += 8;
+			while (*linespec == ' ') linespec++;
 
-		fprintf(of, "(%*.*s):%05d ", max_linespec_len, max_linespec_len, linespec, cl->lineno);
-
+			fprintf(of, "(%*.*s):%05d ", max_linespec_len, max_linespec_len, linespec, cl->lineno);
+		}
+		
 		if (CURPRAGMA(cl, PRAGMA_CC))
 		{
 			as->cycle_total = 0;