Mercurial > hg > index.cgi
changeset 14:5ecdc4dae84d
Brought forward patch to make tabs in listings always display as 8 spaces wide by converting tabs to spaces
author | lost@l-w.ca |
---|---|
date | Sat, 22 Jan 2011 16:19:48 -0700 |
parents | c80e5a063967 |
children | ed5cbe83cbd3 |
files | lwasm/list.c |
diffstat | 1 files changed, 31 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- 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++)