# HG changeset patch # User lost@l-w.ca # Date 1295738388 25200 # Node ID 5ecdc4dae84d0a7c646801a63e70e3e52887c1b7 # Parent c80e5a0639674c1fd4bb7d9f47b21240085041e5 Brought forward patch to make tabs in listings always display as 8 spaces wide by converting tabs to spaces diff -r c80e5a063967 -r 5ecdc4dae84d lwasm/list.c --- a/lwasm/list.c Sat Jan 22 16:15:32 2011 -0700 +++ b/lwasm/list.c Sat Jan 22 16:19:48 2011 -0700 @@ -38,7 +38,9 @@ line_t *cl; FILE *of; int i; - + + char *tc; + if (!(as -> flags & FLAG_LIST)) return; @@ -114,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) + { + fputc(' ', of); + i++; + } + } + } + else + { + fputc(*tc, of); + i++; + } + } + fputc('\n', of); if (cl -> outputl > 8) { for (i = 8; i < cl -> outputl; i++)