annotate old-trunk/lwasm/old/symbol.c @ 377:55ed7d06b136

Fixed intersection internal references in object target
author lost@starbug
date Mon, 26 Apr 2010 18:37:06 -0600
parents eb230fa7d28e
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
339
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1 /*
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
2 symbol.c
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
3 Copyright © 2009 William Astle
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
4
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
5 This file is part of LWASM.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
6
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
7 LWASM is free software: you can redistribute it and/or modify it under the
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
8 terms of the GNU General Public License as published by the Free Software
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
9 Foundation, either version 3 of the License, or (at your option) any later
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
10 version.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
11
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
12 This program is distributed in the hope that it will be useful, but WITHOUT
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
15 more details.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
16
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
17 You should have received a copy of the GNU General Public License along with
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
18 this program. If not, see <http://www.gnu.org/licenses/>.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
19 */
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
20
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
21 /*
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
22 for handling the symbol table
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
23 */
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
24
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
25 #define __symbol_c_seen__
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
26 #include <config.h>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
27 #include <string.h>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
28
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
29 #include "lwasm.h"
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
30 #include "util.h"
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
31 #include "expr.h"
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
32
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
33 /*
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
34 Note that this function may accept symbols that the expression evaluator doesn't
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
35 recognize because the expression evaluator must avoid all ambiguity in order
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
36 to achieve predictable results. The checks here are simply a fuzz check.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
37 */
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
38
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
39 /*
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
40 NOTE: complex symbols always take their value from slot 0 on the expression placeholders
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
41 for a line!
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
42 */
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
43 int lwasm_register_symbol(asmstate_t *as, lwasm_line_t *l, char *sym, int val, int flags)
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
44 {
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
45 lwasm_symbol_ent_t *se, *se2;
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
46 char *p;
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
47
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
48 int scontext = -1;
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
49
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
50 // if the symbol is constant, fall back to simple registration!
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
51 if (flags & SYMBOL_COMPLEX)
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
52 {
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
53 if (l -> exprs[0] == NULL)
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
54 {
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
55 val = l -> exprvals[0];
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
56 flags &= ~SYMBOL_COMPLEX;
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
57 }
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
58 }
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
59
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
60 // first check if the symbol is valid
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
61 // the following characters are allowed in a symbol:
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
62 // [a-zA-Z0-9._$?@] and any byte value larger than 0x7F
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
63 // although symbols should be restricted to the 7 bit range
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
64 // symbols must start with [a-zA-Z._]
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
65 if (!strchr(sym, '$'))
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
66 {
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
67 if (!strchr("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz._@?", *sym))
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
68 {
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
69 register_error(as, l, 1, "Bad symbol: %s", sym);
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
70 return -1;
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
71 }
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
72
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
73 if (*sym == '@' && isdigit(sym[1]))
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
74 {
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
75 register_error(as, l, 1, "Bad symbol: %s", sym);
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
76 return -1;
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
77 }
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
78 }
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
79
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
80 for (p = sym; *p; p++)
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
81 {
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
82 if (!strchr("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz._$?@0123456789", *sym))
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
83 {
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
84 register_error(as, l, 1, "Bad symbol: %s", sym);
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
85 return -1;
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
86 }
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
87 // flag local symbols while we're at it...
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
88 if (*p == '?' || *p == '@' || (*p == '$' && !(as -> pragmas & PRAGMA_DOLLARNOTLOCAL)))
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
89 scontext = as -> context;
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
90 }
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
91
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
92 debug_message(3, "lwasm_register_symbol(): registering '%s' (%d) at %04X; flags=%d", sym, scontext, val, flags);
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
93
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
94 // now look it for to see if it is a duplicate
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
95 se = lwasm_find_symbol(as, sym, scontext);
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
96 if (se)
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
97 {
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
98 if (flags & SYMBOL_FORCE && as -> passnum != 2)
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
99 {
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
100 register_error(as, l, 1, "Multiply defined symbol: %s", sym);
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
101 return -1;
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
102 }
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
103 if (!(flags & SYMBOL_SET) || (flags & SYMBOL_SET && !(se -> flags & SYMBOL_SET)))
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
104 {
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
105 register_error(as, l, 1, "Mulitply defined symbol: %s", sym);
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
106 return -1;
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
107 }
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
108 }
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
109 if (se)
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
110 {
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
111 se -> value = val;
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
112 if (flags & SYMBOL_COMPLEX)
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
113 {
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
114 se -> expr = l -> exprs[0];
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
115 }
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
116 else
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
117 {
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
118 se -> expr = NULL;
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
119 }
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
120 return;
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
121 }
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
122
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
123 // if not a duplicate, register it with the value
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
124 se = lwasm_alloc(sizeof(lwasm_symbol_ent_t));
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
125 if (as -> symhead)
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
126 {
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
127 se -> prev = NULL;
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
128 se -> next = as -> symhead;
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
129 as -> symhead -> prev = se;
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
130 as -> symhead = se;
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
131 }
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
132 else
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
133 {
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
134 se -> next = NULL;
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
135 se -> prev = NULL;
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
136 as -> symhead = se;
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
137 as -> symtail = se;
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
138 }
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
139 se -> value = val;
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
140 if (flags & SYMBOL_COMPLEX)
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
141 se -> expr = l -> exprs[0];
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
142 se -> sym = lwasm_strdup(sym);
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
143 se -> context = scontext;
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
144
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
145 if (!(flags & SYMBOL_EXTERN) && ((flags & SYMBOL_COMPLEX) || !(flags & SYMBOL_GLOBAL)))
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
146 se -> sect = as -> csect;
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
147 else
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
148 se -> sect = NULL;
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
149
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
150 se -> expr = NULL;
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
151 se -> flags = flags;
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
152 se -> externalname = NULL;
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
153
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
154 return 0;
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
155 }
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
156
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
157 lwasm_symbol_ent_t *lwasm_find_symbol(asmstate_t *as, char *sym, int scontext)
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
158 {
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
159 lwasm_symbol_ent_t *se;
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
160 static int st = 0;
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
161
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
162 for (se = as -> symhead; se; se = se -> next)
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
163 {
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
164 if (scontext == se -> context && !strcmp(sym, se -> sym))
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
165 {
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
166 return se;
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
167 }
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
168 }
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
169 if (as -> passnum == 2 && st == 0 && scontext == -1 && as -> outformat == OUTPUT_OBJ && as -> pragmas & PRAGMA_UNDEFEXTERN)
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
170 {
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
171 // we want undefined symbols to be considered external
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
172 // we didn't find it on a lookup so register it as external
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
173 // but we only do so when looking up in global context
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
174 st = 1;
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
175 if (lwasm_register_symbol(as, NULL, sym, 0, SYMBOL_EXTERN))
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
176 {
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
177 st = 0;
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
178 return NULL;
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
179 }
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
180 st = 0;
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
181
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
182 // find the newly registered symbol and return it
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
183 for (se = as -> symhead; se; se = se -> next)
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
184 {
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
185 if (scontext == se -> context && !strcmp(sym, se -> sym))
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
186 {
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
187 return se;
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
188 }
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
189 }
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
190 }
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
191
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
192 return NULL;
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
193 }
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
194
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
195 // reset the value of a symbol - should not be used normally
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
196 // it is intended for use by such operations as EQU
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
197 // returns -1 if the symbol is not registered
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
198 int lwasm_set_symbol(asmstate_t *as, char *sym, int scontext, int val)
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
199 {
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
200 lwasm_symbol_ent_t *se;
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
201
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
202 se = lwasm_find_symbol(as, sym, scontext);
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
203 if (!se)
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
204 return -1;
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
205
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
206 se -> value = val;
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
207 return 0;
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
208 }
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
209
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
210 void lwasm_list_symbols(asmstate_t *as, FILE *lf)
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
211 {
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
212 lwasm_symbol_ent_t *se;
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
213
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
214 for (se = as -> symhead; se; se = se -> next)
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
215 {
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
216 if (se -> expr)
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
217 {
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
218 fprintf(lf, "<incompl>");
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
219 }
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
220 else if (se -> value > 0xffff || se -> value < -0x8000)
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
221 {
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
222 fprintf(lf, "%08X ", se -> value);
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
223 }
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
224 else
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
225 {
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
226 fprintf(lf, " %04X ", se -> value);
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
227 }
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
228 if (se -> context < 0)
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
229 fputc('G', lf);
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
230 else
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
231 fputc('L', lf);
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
232
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
233 if (se -> flags & SYMBOL_SET)
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
234 fputc('S', lf);
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
235 else if (se -> flags & SYMBOL_EXTERN)
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
236 fputc('E', lf);
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
237 else
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
238 fputc(' ', lf);
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
239
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
240 fprintf(lf, " %s", se -> sym);
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
241
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
242 if (se -> context >= 0)
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
243 fprintf(lf, " (%d)", se -> context);
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
244
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
245 if (se -> sect)
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
246 {
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
247 fprintf(lf, " [%s]", se -> sect -> name);
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
248 }
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
249
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
250 fputc('\n', lf);
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
251 }
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
252 }