Mercurial > hg-old > index.cgi
annotate lwasm/symbol.c @ 406:502fbc37ff4e
Symbol table is now sorted in lwasm
author | lost@l-w.ca |
---|---|
date | Fri, 23 Jul 2010 19:23:17 -0600 |
parents | 7bcc50e828ff |
children | cac204676434 |
rev | line source |
---|---|
342 | 1 /* |
2 symbol.c | |
3 | |
4 Copyright © 2010 William Astle | |
5 | |
6 This file is part of LWTOOLS. | |
7 | |
8 LWTOOLS is free software: you can redistribute it and/or modify it under the | |
9 terms of the GNU General Public License as published by the Free Software | |
10 Foundation, either version 3 of the License, or (at your option) any later | |
11 version. | |
12 | |
13 This program is distributed in the hope that it will be useful, but WITHOUT | |
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | |
16 more details. | |
17 | |
18 You should have received a copy of the GNU General Public License along with | |
19 this program. If not, see <http://www.gnu.org/licenses/>. | |
20 */ | |
21 | |
22 #include <config.h> | |
23 | |
390
027d7fbcdcfc
Basic symbol table output; needs work for non-constant symbols
lost@l-w.ca
parents:
389
diff
changeset
|
24 #include <stdio.h> |
342 | 25 #include <stdlib.h> |
26 #include <string.h> | |
27 | |
28 #include <lw_alloc.h> | |
29 #include <lw_expr.h> | |
370 | 30 #include <lw_string.h> |
342 | 31 |
32 #include "lwasm.h" | |
33 | |
406 | 34 struct symtabe *symbol_findprev(asmstate_t *as, struct symtabe *se) |
35 { | |
36 struct symtabe *se1, *se2; | |
37 int i; | |
38 | |
39 for (se2 = NULL, se1 = as -> symtab.head; se1; se1 = se1 -> next) | |
40 { | |
41 debug_message(as, 200, "Sorting; looking at symbol %s (%p) for %s", se1 -> symbol, se1, se -> symbol); | |
42 /* compare se with se1 */ | |
43 i = strcasecmp(se -> symbol, se1 -> symbol); | |
44 | |
45 /* if the symbol sorts before se1, we just need to return */ | |
46 if (i < 0) | |
47 return se2; | |
48 | |
49 if (i == 0) | |
50 { | |
51 /* symbol name matches; compare other things */ | |
52 | |
53 /*if next version is greater than this one, return */ | |
54 if (se -> version > se1 -> version) | |
55 return se2; | |
56 /* if next context is great than this one, return */ | |
57 if (se -> context > se1 -> context) | |
58 return se2; | |
59 | |
60 /* if section name is greater, return */ | |
61 /* if se has no section but se1 does, we go first */ | |
62 if (se -> section == NULL && se1 -> section != NULL) | |
63 return se2; | |
64 if (se -> section != NULL && se -> section != NULL) | |
65 { | |
66 /* compare section names and if se < se1, return */ | |
67 i = strcasecmp(se -> section -> name, se1 -> section -> name); | |
68 if (i < 0) | |
69 return se2; | |
70 } | |
71 } | |
72 | |
73 se2 = se1; | |
74 } | |
75 return se2; | |
76 } | |
77 | |
344
0215a0fbf61b
Added assembly error system and additional checks for symbol syntax
lost@starbug
parents:
342
diff
changeset
|
78 struct symtabe *register_symbol(asmstate_t *as, line_t *cl, char *sym, lw_expr_t val, int flags) |
342 | 79 { |
80 struct symtabe *se; | |
406 | 81 struct symtabe *sprev; |
342 | 82 int islocal = 0; |
83 int context = -1; | |
84 int version = -1; | |
344
0215a0fbf61b
Added assembly error system and additional checks for symbol syntax
lost@starbug
parents:
342
diff
changeset
|
85 char *cp; |
342 | 86 |
406 | 87 debug_message(as, 200, "Register symbol %s (%02X), %s", sym, flags, lw_expr_print(val)); |
88 | |
389
fbb7bfed8076
Added in structure support and fixed up some warts in the listing code (by adding more warts)
lost@l-w.ca
parents:
374
diff
changeset
|
89 if (!(flags & symbol_flag_nocheck)) |
344
0215a0fbf61b
Added assembly error system and additional checks for symbol syntax
lost@starbug
parents:
342
diff
changeset
|
90 { |
389
fbb7bfed8076
Added in structure support and fixed up some warts in the listing code (by adding more warts)
lost@l-w.ca
parents:
374
diff
changeset
|
91 if (*sym < 0x80 && !strchr(SSYMCHARS, *sym)) |
fbb7bfed8076
Added in structure support and fixed up some warts in the listing code (by adding more warts)
lost@l-w.ca
parents:
374
diff
changeset
|
92 { |
fbb7bfed8076
Added in structure support and fixed up some warts in the listing code (by adding more warts)
lost@l-w.ca
parents:
374
diff
changeset
|
93 lwasm_register_error(as, cl, "Bad symbol (%s)", sym); |
fbb7bfed8076
Added in structure support and fixed up some warts in the listing code (by adding more warts)
lost@l-w.ca
parents:
374
diff
changeset
|
94 return NULL; |
fbb7bfed8076
Added in structure support and fixed up some warts in the listing code (by adding more warts)
lost@l-w.ca
parents:
374
diff
changeset
|
95 } |
344
0215a0fbf61b
Added assembly error system and additional checks for symbol syntax
lost@starbug
parents:
342
diff
changeset
|
96 |
389
fbb7bfed8076
Added in structure support and fixed up some warts in the listing code (by adding more warts)
lost@l-w.ca
parents:
374
diff
changeset
|
97 if ((*sym == '$' || *sym == '@') && (sym[1] >= '0' && sym[1] <= '9')) |
fbb7bfed8076
Added in structure support and fixed up some warts in the listing code (by adding more warts)
lost@l-w.ca
parents:
374
diff
changeset
|
98 { |
fbb7bfed8076
Added in structure support and fixed up some warts in the listing code (by adding more warts)
lost@l-w.ca
parents:
374
diff
changeset
|
99 lwasm_register_error(as, cl, "Bad symbol (%s)", sym); |
fbb7bfed8076
Added in structure support and fixed up some warts in the listing code (by adding more warts)
lost@l-w.ca
parents:
374
diff
changeset
|
100 return NULL; |
fbb7bfed8076
Added in structure support and fixed up some warts in the listing code (by adding more warts)
lost@l-w.ca
parents:
374
diff
changeset
|
101 } |
344
0215a0fbf61b
Added assembly error system and additional checks for symbol syntax
lost@starbug
parents:
342
diff
changeset
|
102 } |
0215a0fbf61b
Added assembly error system and additional checks for symbol syntax
lost@starbug
parents:
342
diff
changeset
|
103 |
0215a0fbf61b
Added assembly error system and additional checks for symbol syntax
lost@starbug
parents:
342
diff
changeset
|
104 for (cp = sym; *cp; cp++) |
0215a0fbf61b
Added assembly error system and additional checks for symbol syntax
lost@starbug
parents:
342
diff
changeset
|
105 { |
0215a0fbf61b
Added assembly error system and additional checks for symbol syntax
lost@starbug
parents:
342
diff
changeset
|
106 if (*cp == '@' || *cp == '?') |
0215a0fbf61b
Added assembly error system and additional checks for symbol syntax
lost@starbug
parents:
342
diff
changeset
|
107 islocal = 1; |
360
7d91ab7ac7d6
Indexed stage 2; set line structure to track pragmas in effect for that line
lost@starbug
parents:
346
diff
changeset
|
108 if (*cp == '$' && !(CURPRAGMA(cl, PRAGMA_DOLLARNOTLOCAL))) |
344
0215a0fbf61b
Added assembly error system and additional checks for symbol syntax
lost@starbug
parents:
342
diff
changeset
|
109 islocal = 1; |
0215a0fbf61b
Added assembly error system and additional checks for symbol syntax
lost@starbug
parents:
342
diff
changeset
|
110 |
0215a0fbf61b
Added assembly error system and additional checks for symbol syntax
lost@starbug
parents:
342
diff
changeset
|
111 // bad symbol |
389
fbb7bfed8076
Added in structure support and fixed up some warts in the listing code (by adding more warts)
lost@l-w.ca
parents:
374
diff
changeset
|
112 if (!(flags & symbol_flag_nocheck) && *cp < 0x80 && !strchr(SYMCHARS, *cp)) |
344
0215a0fbf61b
Added assembly error system and additional checks for symbol syntax
lost@starbug
parents:
342
diff
changeset
|
113 { |
0215a0fbf61b
Added assembly error system and additional checks for symbol syntax
lost@starbug
parents:
342
diff
changeset
|
114 lwasm_register_error(as, cl, "Bad symbol (%s)", sym); |
0215a0fbf61b
Added assembly error system and additional checks for symbol syntax
lost@starbug
parents:
342
diff
changeset
|
115 return NULL; |
0215a0fbf61b
Added assembly error system and additional checks for symbol syntax
lost@starbug
parents:
342
diff
changeset
|
116 } |
0215a0fbf61b
Added assembly error system and additional checks for symbol syntax
lost@starbug
parents:
342
diff
changeset
|
117 } |
342 | 118 |
119 if (islocal) | |
363
d96c30e60ddf
Added pass2 and various supporting logic including symbol lookups
lost@starbug
parents:
360
diff
changeset
|
120 context = cl -> context; |
342 | 121 |
122 // first, look up symbol to see if it is already defined | |
123 for (se = as -> symtab.head; se; se = se -> next) | |
124 { | |
406 | 125 debug_message(as, 300, "Symbol add lookup: %p, %p", se, se -> next); |
342 | 126 if (!strcmp(sym, se -> symbol)) |
127 { | |
128 if (se -> context != context) | |
129 continue; | |
130 if ((flags & symbol_flag_set) && (se -> flags & symbol_flag_set)) | |
131 { | |
132 if (version < se -> version) | |
133 version = se -> version; | |
134 continue; | |
135 } | |
136 break; | |
137 } | |
138 } | |
389
fbb7bfed8076
Added in structure support and fixed up some warts in the listing code (by adding more warts)
lost@l-w.ca
parents:
374
diff
changeset
|
139 |
342 | 140 if (se) |
141 { | |
142 // multiply defined symbol | |
344
0215a0fbf61b
Added assembly error system and additional checks for symbol syntax
lost@starbug
parents:
342
diff
changeset
|
143 lwasm_register_error(as, cl, "Multiply defined symbol (%s)", sym); |
342 | 144 return NULL; |
145 } | |
146 | |
147 if (flags & symbol_flag_set) | |
148 { | |
149 version++; | |
150 } | |
151 | |
363
d96c30e60ddf
Added pass2 and various supporting logic including symbol lookups
lost@starbug
parents:
360
diff
changeset
|
152 // symplify the symbol expression - replaces "SET" symbols with |
d96c30e60ddf
Added pass2 and various supporting logic including symbol lookups
lost@starbug
parents:
360
diff
changeset
|
153 // symbol table entries |
d96c30e60ddf
Added pass2 and various supporting logic including symbol lookups
lost@starbug
parents:
360
diff
changeset
|
154 lwasm_reduce_expr(as, val); |
406 | 155 |
342 | 156 se = lw_alloc(sizeof(struct symtabe)); |
157 se -> context = context; | |
158 se -> version = version; | |
159 se -> flags = flags; | |
160 se -> value = lw_expr_copy(val); | |
370 | 161 se -> symbol = lw_strdup(sym); |
374 | 162 se -> section = cl -> csect; |
406 | 163 sprev = symbol_findprev(as, se); |
164 if (!sprev) | |
165 { | |
166 debug_message(as, 200, "Adding symbol at head of symbol table"); | |
167 se -> next = as -> symtab.head; | |
168 as -> symtab.head = se; | |
169 } | |
170 else | |
171 { | |
172 debug_message(as, 200, "Adding symbol in middle of symbol table"); | |
173 se -> next = sprev -> next; | |
174 sprev -> next = se; | |
175 } | |
342 | 176 return se; |
177 } | |
178 | |
363
d96c30e60ddf
Added pass2 and various supporting logic including symbol lookups
lost@starbug
parents:
360
diff
changeset
|
179 // for "SET" symbols, always returns the LAST definition of the |
d96c30e60ddf
Added pass2 and various supporting logic including symbol lookups
lost@starbug
parents:
360
diff
changeset
|
180 // symbol. This works because the lwasm_reduce_expr() call in |
d96c30e60ddf
Added pass2 and various supporting logic including symbol lookups
lost@starbug
parents:
360
diff
changeset
|
181 // register_symbol will ensure there are no lingering "var" references |
d96c30e60ddf
Added pass2 and various supporting logic including symbol lookups
lost@starbug
parents:
360
diff
changeset
|
182 // to the set symbol anywhere in the symbol table; they will all be |
d96c30e60ddf
Added pass2 and various supporting logic including symbol lookups
lost@starbug
parents:
360
diff
changeset
|
183 // converted to direct references |
d96c30e60ddf
Added pass2 and various supporting logic including symbol lookups
lost@starbug
parents:
360
diff
changeset
|
184 // NOTE: this means that for a forward reference to a SET symbol, |
d96c30e60ddf
Added pass2 and various supporting logic including symbol lookups
lost@starbug
parents:
360
diff
changeset
|
185 // the LAST definition will be the one used. |
d96c30e60ddf
Added pass2 and various supporting logic including symbol lookups
lost@starbug
parents:
360
diff
changeset
|
186 // This arrangement also ensures that any reference to the symbol |
d96c30e60ddf
Added pass2 and various supporting logic including symbol lookups
lost@starbug
parents:
360
diff
changeset
|
187 // itself inside a "set" definition will refer to the previous version |
d96c30e60ddf
Added pass2 and various supporting logic including symbol lookups
lost@starbug
parents:
360
diff
changeset
|
188 // of the symbol. |
d96c30e60ddf
Added pass2 and various supporting logic including symbol lookups
lost@starbug
parents:
360
diff
changeset
|
189 struct symtabe * lookup_symbol(asmstate_t *as, line_t *cl, char *sym) |
342 | 190 { |
363
d96c30e60ddf
Added pass2 and various supporting logic including symbol lookups
lost@starbug
parents:
360
diff
changeset
|
191 int local = 0; |
d96c30e60ddf
Added pass2 and various supporting logic including symbol lookups
lost@starbug
parents:
360
diff
changeset
|
192 struct symtabe *s, *s2; |
d96c30e60ddf
Added pass2 and various supporting logic including symbol lookups
lost@starbug
parents:
360
diff
changeset
|
193 |
d96c30e60ddf
Added pass2 and various supporting logic including symbol lookups
lost@starbug
parents:
360
diff
changeset
|
194 // check if this is a local symbol |
d96c30e60ddf
Added pass2 and various supporting logic including symbol lookups
lost@starbug
parents:
360
diff
changeset
|
195 if (strchr(sym, '@') || strchr(sym, '?')) |
d96c30e60ddf
Added pass2 and various supporting logic including symbol lookups
lost@starbug
parents:
360
diff
changeset
|
196 local = 1; |
d96c30e60ddf
Added pass2 and various supporting logic including symbol lookups
lost@starbug
parents:
360
diff
changeset
|
197 |
d96c30e60ddf
Added pass2 and various supporting logic including symbol lookups
lost@starbug
parents:
360
diff
changeset
|
198 if (cl && !CURPRAGMA(cl, PRAGMA_DOLLARNOTLOCAL) && strchr(sym, '$')) |
d96c30e60ddf
Added pass2 and various supporting logic including symbol lookups
lost@starbug
parents:
360
diff
changeset
|
199 local = 1; |
d96c30e60ddf
Added pass2 and various supporting logic including symbol lookups
lost@starbug
parents:
360
diff
changeset
|
200 if (!cl && !(as -> pragmas & PRAGMA_DOLLARNOTLOCAL) && strchr(sym, '$')) |
d96c30e60ddf
Added pass2 and various supporting logic including symbol lookups
lost@starbug
parents:
360
diff
changeset
|
201 local = 1; |
d96c30e60ddf
Added pass2 and various supporting logic including symbol lookups
lost@starbug
parents:
360
diff
changeset
|
202 |
d96c30e60ddf
Added pass2 and various supporting logic including symbol lookups
lost@starbug
parents:
360
diff
changeset
|
203 // cannot look up local symbol in global context!!!!! |
d96c30e60ddf
Added pass2 and various supporting logic including symbol lookups
lost@starbug
parents:
360
diff
changeset
|
204 if (!cl && local) |
d96c30e60ddf
Added pass2 and various supporting logic including symbol lookups
lost@starbug
parents:
360
diff
changeset
|
205 return NULL; |
d96c30e60ddf
Added pass2 and various supporting logic including symbol lookups
lost@starbug
parents:
360
diff
changeset
|
206 |
d96c30e60ddf
Added pass2 and various supporting logic including symbol lookups
lost@starbug
parents:
360
diff
changeset
|
207 for (s = as -> symtab.head, s2 = NULL; s; s = s -> next) |
d96c30e60ddf
Added pass2 and various supporting logic including symbol lookups
lost@starbug
parents:
360
diff
changeset
|
208 { |
d96c30e60ddf
Added pass2 and various supporting logic including symbol lookups
lost@starbug
parents:
360
diff
changeset
|
209 if (!strcmp(sym, s -> symbol)) |
d96c30e60ddf
Added pass2 and various supporting logic including symbol lookups
lost@starbug
parents:
360
diff
changeset
|
210 { |
d96c30e60ddf
Added pass2 and various supporting logic including symbol lookups
lost@starbug
parents:
360
diff
changeset
|
211 if (local && s -> context != cl -> context) |
d96c30e60ddf
Added pass2 and various supporting logic including symbol lookups
lost@starbug
parents:
360
diff
changeset
|
212 continue; |
d96c30e60ddf
Added pass2 and various supporting logic including symbol lookups
lost@starbug
parents:
360
diff
changeset
|
213 |
d96c30e60ddf
Added pass2 and various supporting logic including symbol lookups
lost@starbug
parents:
360
diff
changeset
|
214 if (s -> flags & symbol_flag_set) |
d96c30e60ddf
Added pass2 and various supporting logic including symbol lookups
lost@starbug
parents:
360
diff
changeset
|
215 { |
d96c30e60ddf
Added pass2 and various supporting logic including symbol lookups
lost@starbug
parents:
360
diff
changeset
|
216 // look for highest version of symbol |
d96c30e60ddf
Added pass2 and various supporting logic including symbol lookups
lost@starbug
parents:
360
diff
changeset
|
217 if (s -> version > s2 -> version) |
d96c30e60ddf
Added pass2 and various supporting logic including symbol lookups
lost@starbug
parents:
360
diff
changeset
|
218 s2 = s; |
d96c30e60ddf
Added pass2 and various supporting logic including symbol lookups
lost@starbug
parents:
360
diff
changeset
|
219 continue; |
d96c30e60ddf
Added pass2 and various supporting logic including symbol lookups
lost@starbug
parents:
360
diff
changeset
|
220 } |
d96c30e60ddf
Added pass2 and various supporting logic including symbol lookups
lost@starbug
parents:
360
diff
changeset
|
221 break; |
d96c30e60ddf
Added pass2 and various supporting logic including symbol lookups
lost@starbug
parents:
360
diff
changeset
|
222 } |
d96c30e60ddf
Added pass2 and various supporting logic including symbol lookups
lost@starbug
parents:
360
diff
changeset
|
223 } |
d96c30e60ddf
Added pass2 and various supporting logic including symbol lookups
lost@starbug
parents:
360
diff
changeset
|
224 if (!s && s2) |
d96c30e60ddf
Added pass2 and various supporting logic including symbol lookups
lost@starbug
parents:
360
diff
changeset
|
225 s = s2; |
d96c30e60ddf
Added pass2 and various supporting logic including symbol lookups
lost@starbug
parents:
360
diff
changeset
|
226 |
d96c30e60ddf
Added pass2 and various supporting logic including symbol lookups
lost@starbug
parents:
360
diff
changeset
|
227 return s; |
342 | 228 } |
390
027d7fbcdcfc
Basic symbol table output; needs work for non-constant symbols
lost@l-w.ca
parents:
389
diff
changeset
|
229 |
405 | 230 struct listinfo |
231 { | |
232 sectiontab_t *sect; | |
233 asmstate_t *as; | |
234 int complex; | |
235 }; | |
236 | |
237 int list_symbols_test(lw_expr_t e, void *p) | |
238 { | |
239 struct listinfo *li = p; | |
240 | |
241 if (li -> complex) | |
242 return 0; | |
243 | |
244 if (lw_expr_istype(e, lw_expr_type_special)) | |
245 { | |
246 if (lw_expr_specint(e) == lwasm_expr_secbase) | |
247 { | |
248 if (li -> sect) | |
249 { | |
250 li -> complex = 1; | |
251 } | |
252 else | |
253 { | |
254 li -> sect = lw_expr_specptr(e); | |
255 } | |
256 } | |
257 } | |
258 return 0; | |
259 } | |
260 | |
390
027d7fbcdcfc
Basic symbol table output; needs work for non-constant symbols
lost@l-w.ca
parents:
389
diff
changeset
|
261 void list_symbols(asmstate_t *as, FILE *of) |
027d7fbcdcfc
Basic symbol table output; needs work for non-constant symbols
lost@l-w.ca
parents:
389
diff
changeset
|
262 { |
027d7fbcdcfc
Basic symbol table output; needs work for non-constant symbols
lost@l-w.ca
parents:
389
diff
changeset
|
263 struct symtabe *s; |
405 | 264 lw_expr_t te; |
265 struct listinfo li; | |
266 | |
267 li.as = as; | |
268 | |
390
027d7fbcdcfc
Basic symbol table output; needs work for non-constant symbols
lost@l-w.ca
parents:
389
diff
changeset
|
269 fprintf(of, "\nSymbol Table:\n"); |
027d7fbcdcfc
Basic symbol table output; needs work for non-constant symbols
lost@l-w.ca
parents:
389
diff
changeset
|
270 |
027d7fbcdcfc
Basic symbol table output; needs work for non-constant symbols
lost@l-w.ca
parents:
389
diff
changeset
|
271 for (s = as -> symtab.head; s; s = s -> next) |
027d7fbcdcfc
Basic symbol table output; needs work for non-constant symbols
lost@l-w.ca
parents:
389
diff
changeset
|
272 { |
405 | 273 lwasm_reduce_expr(as, s -> value); |
390
027d7fbcdcfc
Basic symbol table output; needs work for non-constant symbols
lost@l-w.ca
parents:
389
diff
changeset
|
274 fputc('[', of); |
027d7fbcdcfc
Basic symbol table output; needs work for non-constant symbols
lost@l-w.ca
parents:
389
diff
changeset
|
275 if (s -> flags & symbol_flag_set) |
027d7fbcdcfc
Basic symbol table output; needs work for non-constant symbols
lost@l-w.ca
parents:
389
diff
changeset
|
276 fputc('S', of); |
027d7fbcdcfc
Basic symbol table output; needs work for non-constant symbols
lost@l-w.ca
parents:
389
diff
changeset
|
277 else |
027d7fbcdcfc
Basic symbol table output; needs work for non-constant symbols
lost@l-w.ca
parents:
389
diff
changeset
|
278 fputc(' ', of); |
405 | 279 if (as -> output_format == OUTPUT_OBJ) |
280 { | |
281 if (lw_expr_istype(s -> value, lw_expr_type_int)) | |
282 fputc('c', of); | |
283 else | |
284 fputc('s', of); | |
285 } | |
286 if (s -> context < 0) | |
390
027d7fbcdcfc
Basic symbol table output; needs work for non-constant symbols
lost@l-w.ca
parents:
389
diff
changeset
|
287 fputc('G', of); |
027d7fbcdcfc
Basic symbol table output; needs work for non-constant symbols
lost@l-w.ca
parents:
389
diff
changeset
|
288 else |
405 | 289 fputc('L', of); |
290 | |
390
027d7fbcdcfc
Basic symbol table output; needs work for non-constant symbols
lost@l-w.ca
parents:
389
diff
changeset
|
291 fputc(']', of); |
027d7fbcdcfc
Basic symbol table output; needs work for non-constant symbols
lost@l-w.ca
parents:
389
diff
changeset
|
292 fputc(' ', of); |
027d7fbcdcfc
Basic symbol table output; needs work for non-constant symbols
lost@l-w.ca
parents:
389
diff
changeset
|
293 fprintf(of, "%-32s ", s -> symbol); |
405 | 294 |
295 te = lw_expr_copy(s -> value); | |
296 li.complex = 0; | |
297 li.sect = NULL; | |
298 lw_expr_testterms(te, list_symbols_test, &li); | |
299 if (li.sect) | |
300 { | |
301 as -> exportcheck = 1; | |
302 as -> csect = li.sect; | |
303 lwasm_reduce_expr(as, te); | |
304 as -> exportcheck = 0; | |
305 } | |
306 | |
307 if (lw_expr_istype(te, lw_expr_type_int)) | |
308 { | |
309 fprintf(of, "%04X", lw_expr_intval(te)); | |
310 if (li.sect) | |
311 { | |
312 fprintf(of, " (%s)", li.sect -> name); | |
313 } | |
314 fprintf(of, "\n"); | |
315 } | |
390
027d7fbcdcfc
Basic symbol table output; needs work for non-constant symbols
lost@l-w.ca
parents:
389
diff
changeset
|
316 else |
405 | 317 { |
318 fprintf(of, "<<incomplete>>\n"); | |
319 // fprintf(of, "%s\n", lw_expr_print(s -> value)); | |
320 } | |
321 lw_expr_destroy(te); | |
390
027d7fbcdcfc
Basic symbol table output; needs work for non-constant symbols
lost@l-w.ca
parents:
389
diff
changeset
|
322 } |
027d7fbcdcfc
Basic symbol table output; needs work for non-constant symbols
lost@l-w.ca
parents:
389
diff
changeset
|
323 } |