Mercurial > hg-old > index.cgi
comparison 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 |
comparison
equal
deleted
inserted
replaced
445:7899511b2102 | 446:194787ce2a77 |
---|---|
38 void do_list(asmstate_t *as) | 38 void do_list(asmstate_t *as) |
39 { | 39 { |
40 line_t *cl; | 40 line_t *cl; |
41 FILE *of; | 41 FILE *of; |
42 int i; | 42 int i; |
43 | 43 char *tc; |
44 if (!(as -> flags & FLAG_LIST)) | 44 if (!(as -> flags & FLAG_LIST)) |
45 return; | 45 return; |
46 | 46 |
47 if (as -> list_file) | 47 if (as -> list_file) |
48 of = fopen(as -> list_file, "w"); | 48 of = fopen(as -> list_file, "w"); |
114 { | 114 { |
115 fprintf(of, " "); | 115 fprintf(of, " "); |
116 } | 116 } |
117 fprintf(of, " "); | 117 fprintf(of, " "); |
118 } | 118 } |
119 /* 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 |
120 a multiple of 8 from the start of the list line */ | 120 a multiple of 8 from the start of the list line */ |
121 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 fprintf(of, " "); | |
137 i++; | |
138 } | |
139 } | |
140 } | |
141 else | |
142 { | |
143 fprintf(of, "%c", *tc); | |
144 i++; | |
145 } | |
146 } | |
147 fprintf(of, "\n"); | |
122 if (cl -> outputl > 8) | 148 if (cl -> outputl > 8) |
123 { | 149 { |
124 for (i = 8; i < cl -> outputl; i++) | 150 for (i = 8; i < cl -> outputl; i++) |
125 { | 151 { |
126 if (i % 8 == 0) | 152 if (i % 8 == 0) |