Mercurial > hg > index.cgi
comparison lwasm/list.c @ 390:1ebb5a0b2874
Add option to specify tab width in listing
There is much insistence that generating the asm listing should absolutely
not ever in the entire expanse of space and time expand tabs. lwasm,
however, does so, and it does so for a reason. That reason is that there are
enough users that have enough trouble even understanding what a tab is that
it was simpler to just expand them.
That said, having a means to actually specify the tab width is pretty much
required if you're going to do that, and having a way to disable such
expansion is also a good idea.
Thanks to Erik G <erik@6809.org> for the base patch to handle this.
author | William Astle <lost@l-w.ca> |
---|---|
date | Mon, 13 Jul 2015 21:52:43 -0600 |
parents | 35d4213e6657 |
children | 61580fc48f98 |
comparison
equal
deleted
inserted
replaced
389:2d9b7ae6c329 | 390:1ebb5a0b2874 |
---|---|
252 { | 252 { |
253 fprintf(of, " "); | 253 fprintf(of, " "); |
254 } | 254 } |
255 } | 255 } |
256 | 256 |
257 i = 0; | 257 if (as -> tabwidth == 0) |
258 for (tc = cl -> ltext; *tc; tc++) | 258 { |
259 { | 259 fputs(cl -> ltext, of); |
260 if ((*tc) == '\t') | 260 } |
261 { | 261 else |
262 if (i % 8 == 0) | 262 { |
263 { | 263 i = 0; |
264 i += 8; | 264 for (tc = cl -> ltext; *tc; tc++) |
265 fprintf(of, " "); | 265 { |
266 } | 266 if ((*tc) == '\t') |
267 else | 267 { |
268 { | 268 if (i % as -> tabwidth == 0) |
269 while (i % 8) | |
270 { | 269 { |
271 fputc(' ', of); | 270 fputc(' ', of); |
272 i++; | 271 i++; |
273 } | 272 } |
274 } | 273 while (i % as -> tabwidth) |
275 } | 274 { |
276 else | 275 fputc(' ', of); |
277 { | 276 i++; |
278 fputc(*tc, of); | 277 } |
279 i++; | 278 } |
279 else | |
280 { | |
281 fputc(*tc, of); | |
282 i++; | |
283 } | |
280 } | 284 } |
281 } | 285 } |
282 fputc('\n', of); | 286 fputc('\n', of); |
287 | |
283 if (obytelen > 8) | 288 if (obytelen > 8) |
284 { | 289 { |
285 for (i = 8; i < obytelen; i++) | 290 for (i = 8; i < obytelen; i++) |
286 { | 291 { |
287 if (i % 8 == 0) | 292 if (i % 8 == 0) |