diff lwasm/list.c @ 446:194787ce2a77 3.0

Adjusted listings to convert tabs to spaces; assume 8 space tabs
author lost@l-w.ca
date Thu, 04 Nov 2010 22:40:57 -0600
parents 4bcb763bddde
children
line wrap: on
line diff
--- a/lwasm/list.c	Sat Oct 30 15:22:55 2010 -0600
+++ b/lwasm/list.c	Thu Nov 04 22:40:57 2010 -0600
@@ -40,7 +40,7 @@
 	line_t *cl;
 	FILE *of;
 	int i;
-	
+	char *tc;
 	if (!(as -> flags & FLAG_LIST))
 		return;
 
@@ -116,9 +116,35 @@
 			}
 			fprintf(of, " ");
 		}
-		/* the 34.34 below is deliberately chosen so that the start of the line text is at
+		/* the 32.32 below is deliberately chosen so that the start of the line text is at
 		   a multiple of 8 from the start of the list line */
-		fprintf(of, "(%34.34s):%05d %s\n", cl -> linespec, cl -> lineno, cl -> ltext);
+		fprintf(of, "(%32.32s):%05d ", cl -> linespec, cl -> lineno);
+		i = 0;
+		for (tc = cl -> ltext; *tc; tc++)
+		{
+			if ((*tc) == '\t')
+			{
+				if (i % 8 == 0)
+				{
+					i += 8;
+					fprintf(of, "        ");
+				}
+				else
+				{
+					while (i % 8)
+					{
+						fprintf(of, " ");
+						i++;
+					}
+				}
+			}
+			else
+			{
+				fprintf(of, "%c", *tc);
+				i++;
+			}
+		}
+		fprintf(of, "\n");
 		if (cl -> outputl > 8)
 		{
 			for (i = 8; i < cl -> outputl; i++)