Mercurial > hg > index.cgi
comparison lwasm/list.c @ 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 | 2c24602be78f |
children | 31adb7c09b4e |
comparison
equal
deleted
inserted
replaced
13:c80e5a063967 | 14:5ecdc4dae84d |
---|---|
36 void do_list(asmstate_t *as) | 36 void do_list(asmstate_t *as) |
37 { | 37 { |
38 line_t *cl; | 38 line_t *cl; |
39 FILE *of; | 39 FILE *of; |
40 int i; | 40 int i; |
41 | 41 |
42 char *tc; | |
43 | |
42 if (!(as -> flags & FLAG_LIST)) | 44 if (!(as -> flags & FLAG_LIST)) |
43 return; | 45 return; |
44 | 46 |
45 if (as -> list_file) | 47 if (as -> list_file) |
46 of = fopen(as -> list_file, "w"); | 48 of = fopen(as -> list_file, "w"); |
112 { | 114 { |
113 fprintf(of, " "); | 115 fprintf(of, " "); |
114 } | 116 } |
115 fprintf(of, " "); | 117 fprintf(of, " "); |
116 } | 118 } |
117 /* the 34.34 below is deliberately chosen so that the start of the line text is at | 119 /* the 32.32 below is deliberately chosen so that the start of the line text is at |
118 a multiple of 8 from the start of the list line */ | 120 a multiple of 8 from the start of the list line */ |
119 fprintf(of, "(%34.34s):%05d %s\n", cl -> linespec, cl -> lineno, cl -> ltext); | 121 fprintf(of, "(%32.32s):%05d ", cl -> linespec, cl -> lineno); |
122 i = 0; | |
123 for (tc = cl -> ltext; *tc; tc++) | |
124 { | |
125 if ((*tc) == '\t') | |
126 { | |
127 if (i % 8 == 0) | |
128 { | |
129 i += 8; | |
130 fprintf(of, " "); | |
131 } | |
132 else | |
133 { | |
134 while (i % 8) | |
135 { | |
136 fputc(' ', of); | |
137 i++; | |
138 } | |
139 } | |
140 } | |
141 else | |
142 { | |
143 fputc(*tc, of); | |
144 i++; | |
145 } | |
146 } | |
147 fputc('\n', of); | |
120 if (cl -> outputl > 8) | 148 if (cl -> outputl > 8) |
121 { | 149 { |
122 for (i = 8; i < cl -> outputl; i++) | 150 for (i = 8; i < cl -> outputl; i++) |
123 { | 151 { |
124 if (i % 8 == 0) | 152 if (i % 8 == 0) |