annotate src/parse.c @ 72:9fa4f77dd119

Fixed tab handling in list code; also added address to second and later lines in byte listing for a particular line
author lost
date Tue, 06 Jan 2009 06:20:31 +0000
parents 90a5657d5408
children 918be0c02239
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
36
99e3b3310bac Added missing parse.c file to repository
lost
parents:
diff changeset
1 /*
99e3b3310bac Added missing parse.c file to repository
lost
parents:
diff changeset
2 parse.c
99e3b3310bac Added missing parse.c file to repository
lost
parents:
diff changeset
3 Copyright © 2008 William Astle
99e3b3310bac Added missing parse.c file to repository
lost
parents:
diff changeset
4
99e3b3310bac Added missing parse.c file to repository
lost
parents:
diff changeset
5 This file is part of LWASM.
99e3b3310bac Added missing parse.c file to repository
lost
parents:
diff changeset
6
99e3b3310bac Added missing parse.c file to repository
lost
parents:
diff changeset
7 LWASM is free software: you can redistribute it and/or modify it under the
99e3b3310bac Added missing parse.c file to repository
lost
parents:
diff changeset
8 terms of the GNU General Public License as published by the Free Software
99e3b3310bac Added missing parse.c file to repository
lost
parents:
diff changeset
9 Foundation, either version 3 of the License, or (at your option) any later
99e3b3310bac Added missing parse.c file to repository
lost
parents:
diff changeset
10 version.
99e3b3310bac Added missing parse.c file to repository
lost
parents:
diff changeset
11
99e3b3310bac Added missing parse.c file to repository
lost
parents:
diff changeset
12 This program is distributed in the hope that it will be useful, but WITHOUT
99e3b3310bac Added missing parse.c file to repository
lost
parents:
diff changeset
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
99e3b3310bac Added missing parse.c file to repository
lost
parents:
diff changeset
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
99e3b3310bac Added missing parse.c file to repository
lost
parents:
diff changeset
15 more details.
99e3b3310bac Added missing parse.c file to repository
lost
parents:
diff changeset
16
99e3b3310bac Added missing parse.c file to repository
lost
parents:
diff changeset
17 You should have received a copy of the GNU General Public License along with
99e3b3310bac Added missing parse.c file to repository
lost
parents:
diff changeset
18 this program. If not, see <http://www.gnu.org/licenses/>.
99e3b3310bac Added missing parse.c file to repository
lost
parents:
diff changeset
19 */
99e3b3310bac Added missing parse.c file to repository
lost
parents:
diff changeset
20
99e3b3310bac Added missing parse.c file to repository
lost
parents:
diff changeset
21 /*
99e3b3310bac Added missing parse.c file to repository
lost
parents:
diff changeset
22 Contains the general parser
99e3b3310bac Added missing parse.c file to repository
lost
parents:
diff changeset
23 */
99e3b3310bac Added missing parse.c file to repository
lost
parents:
diff changeset
24
99e3b3310bac Added missing parse.c file to repository
lost
parents:
diff changeset
25 #define __parse_c_seen__
99e3b3310bac Added missing parse.c file to repository
lost
parents:
diff changeset
26
99e3b3310bac Added missing parse.c file to repository
lost
parents:
diff changeset
27 #include <ctype.h>
99e3b3310bac Added missing parse.c file to repository
lost
parents:
diff changeset
28 #include <string.h>
99e3b3310bac Added missing parse.c file to repository
lost
parents:
diff changeset
29
99e3b3310bac Added missing parse.c file to repository
lost
parents:
diff changeset
30 #include "lwasm.h"
99e3b3310bac Added missing parse.c file to repository
lost
parents:
diff changeset
31 #include "instab.h"
99e3b3310bac Added missing parse.c file to repository
lost
parents:
diff changeset
32 #include "util.h"
99e3b3310bac Added missing parse.c file to repository
lost
parents:
diff changeset
33
99e3b3310bac Added missing parse.c file to repository
lost
parents:
diff changeset
34 // parse a line and despatch to the appropriate handlers for opcodes
99e3b3310bac Added missing parse.c file to repository
lost
parents:
diff changeset
35 int lwasm_parse_line(asmstate_t *as, lwasm_line_t *l)
99e3b3310bac Added missing parse.c file to repository
lost
parents:
diff changeset
36 {
99e3b3310bac Added missing parse.c file to repository
lost
parents:
diff changeset
37 char *p, *p2;
99e3b3310bac Added missing parse.c file to repository
lost
parents:
diff changeset
38 char *opc;
99e3b3310bac Added missing parse.c file to repository
lost
parents:
diff changeset
39 int opnum;
44
2330b88f9600 Added simple output listing
lost
parents: 38
diff changeset
40 char *sym = NULL;
66
aa9d9fedfdf4 Redid lwasm_parse_line() to correct overly complex logic flaws
lost
parents: 64
diff changeset
41
aa9d9fedfdf4 Redid lwasm_parse_line() to correct overly complex logic flaws
lost
parents: 64
diff changeset
42 // if this was a bad op first pass (or otherwise a no-process line)
aa9d9fedfdf4 Redid lwasm_parse_line() to correct overly complex logic flaws
lost
parents: 64
diff changeset
43 // ignore it
aa9d9fedfdf4 Redid lwasm_parse_line() to correct overly complex logic flaws
lost
parents: 64
diff changeset
44 if (l -> badop)
aa9d9fedfdf4 Redid lwasm_parse_line() to correct overly complex logic flaws
lost
parents: 64
diff changeset
45 return;
36
99e3b3310bac Added missing parse.c file to repository
lost
parents:
diff changeset
46
99e3b3310bac Added missing parse.c file to repository
lost
parents:
diff changeset
47 p = l -> text;
66
aa9d9fedfdf4 Redid lwasm_parse_line() to correct overly complex logic flaws
lost
parents: 64
diff changeset
48
aa9d9fedfdf4 Redid lwasm_parse_line() to correct overly complex logic flaws
lost
parents: 64
diff changeset
49 // blank lines are a no brainer
36
99e3b3310bac Added missing parse.c file to repository
lost
parents:
diff changeset
50 if (!*p)
37
538e15927776 Added symbol handling to expression subsystem; adpated instruction handlers to the new scheme; misc fixes
lost
parents: 36
diff changeset
51 {
66
aa9d9fedfdf4 Redid lwasm_parse_line() to correct overly complex logic flaws
lost
parents: 64
diff changeset
52 as -> context = lwasm_next_context(as);
36
99e3b3310bac Added missing parse.c file to repository
lost
parents:
diff changeset
53 return 0;
37
538e15927776 Added symbol handling to expression subsystem; adpated instruction handlers to the new scheme; misc fixes
lost
parents: 36
diff changeset
54 }
36
99e3b3310bac Added missing parse.c file to repository
lost
parents:
diff changeset
55
52
b9856da2674a Added file inclusion
lost
parents: 44
diff changeset
56 // for output generation later but only on pass 1
66
aa9d9fedfdf4 Redid lwasm_parse_line() to correct overly complex logic flaws
lost
parents: 64
diff changeset
57 // also used by some pseudo ops on pass 2
52
b9856da2674a Added file inclusion
lost
parents: 44
diff changeset
58 if (as -> passnum == 1)
b9856da2674a Added file inclusion
lost
parents: 44
diff changeset
59 l -> codeaddr = as -> addr;
44
2330b88f9600 Added simple output listing
lost
parents: 38
diff changeset
60
66
aa9d9fedfdf4 Redid lwasm_parse_line() to correct overly complex logic flaws
lost
parents: 64
diff changeset
61 // if it's a comment, return (this doesn't cause a context change)
aa9d9fedfdf4 Redid lwasm_parse_line() to correct overly complex logic flaws
lost
parents: 64
diff changeset
62 if (*p == '*' || *p == ';')
aa9d9fedfdf4 Redid lwasm_parse_line() to correct overly complex logic flaws
lost
parents: 64
diff changeset
63 return;
aa9d9fedfdf4 Redid lwasm_parse_line() to correct overly complex logic flaws
lost
parents: 64
diff changeset
64
aa9d9fedfdf4 Redid lwasm_parse_line() to correct overly complex logic flaws
lost
parents: 64
diff changeset
65 // if we start with a non-space character, it's a symbol
aa9d9fedfdf4 Redid lwasm_parse_line() to correct overly complex logic flaws
lost
parents: 64
diff changeset
66 if (!isspace(*p))
36
99e3b3310bac Added missing parse.c file to repository
lost
parents:
diff changeset
67 {
99e3b3310bac Added missing parse.c file to repository
lost
parents:
diff changeset
68 // we have a symbol specified here
66
aa9d9fedfdf4 Redid lwasm_parse_line() to correct overly complex logic flaws
lost
parents: 64
diff changeset
69 // parse it out and record it for later use
37
538e15927776 Added symbol handling to expression subsystem; adpated instruction handlers to the new scheme; misc fixes
lost
parents: 36
diff changeset
70 for (p2 = p; *p2 && !isspace(*p2); p2++)
538e15927776 Added symbol handling to expression subsystem; adpated instruction handlers to the new scheme; misc fixes
lost
parents: 36
diff changeset
71 /* do nothing */ ;
538e15927776 Added symbol handling to expression subsystem; adpated instruction handlers to the new scheme; misc fixes
lost
parents: 36
diff changeset
72
538e15927776 Added symbol handling to expression subsystem; adpated instruction handlers to the new scheme; misc fixes
lost
parents: 36
diff changeset
73 sym = lwasm_alloc((p2 - p) + 1);
538e15927776 Added symbol handling to expression subsystem; adpated instruction handlers to the new scheme; misc fixes
lost
parents: 36
diff changeset
74 sym[p2 - p] = '\0';
538e15927776 Added symbol handling to expression subsystem; adpated instruction handlers to the new scheme; misc fixes
lost
parents: 36
diff changeset
75 memcpy(sym, p, p2 - p);
538e15927776 Added symbol handling to expression subsystem; adpated instruction handlers to the new scheme; misc fixes
lost
parents: 36
diff changeset
76
44
2330b88f9600 Added simple output listing
lost
parents: 38
diff changeset
77 p = p2;
37
538e15927776 Added symbol handling to expression subsystem; adpated instruction handlers to the new scheme; misc fixes
lost
parents: 36
diff changeset
78 }
66
aa9d9fedfdf4 Redid lwasm_parse_line() to correct overly complex logic flaws
lost
parents: 64
diff changeset
79 l -> sym = sym;
36
99e3b3310bac Added missing parse.c file to repository
lost
parents:
diff changeset
80
66
aa9d9fedfdf4 Redid lwasm_parse_line() to correct overly complex logic flaws
lost
parents: 64
diff changeset
81 // now skip any whitespace to find the opcode
36
99e3b3310bac Added missing parse.c file to repository
lost
parents:
diff changeset
82 while (*p && isspace(*p))
99e3b3310bac Added missing parse.c file to repository
lost
parents:
diff changeset
83 p++;
99e3b3310bac Added missing parse.c file to repository
lost
parents:
diff changeset
84
66
aa9d9fedfdf4 Redid lwasm_parse_line() to correct overly complex logic flaws
lost
parents: 64
diff changeset
85 // is the line blank?
aa9d9fedfdf4 Redid lwasm_parse_line() to correct overly complex logic flaws
lost
parents: 64
diff changeset
86 if (!*p && !sym)
37
538e15927776 Added symbol handling to expression subsystem; adpated instruction handlers to the new scheme; misc fixes
lost
parents: 36
diff changeset
87 {
66
aa9d9fedfdf4 Redid lwasm_parse_line() to correct overly complex logic flaws
lost
parents: 64
diff changeset
88 // nothing but white space *is* a context break
aa9d9fedfdf4 Redid lwasm_parse_line() to correct overly complex logic flaws
lost
parents: 64
diff changeset
89 as -> context = lwasm_next_context(as);
aa9d9fedfdf4 Redid lwasm_parse_line() to correct overly complex logic flaws
lost
parents: 64
diff changeset
90 return;
37
538e15927776 Added symbol handling to expression subsystem; adpated instruction handlers to the new scheme; misc fixes
lost
parents: 36
diff changeset
91 }
36
99e3b3310bac Added missing parse.c file to repository
lost
parents:
diff changeset
92
99e3b3310bac Added missing parse.c file to repository
lost
parents:
diff changeset
93 // parse the opcode
99e3b3310bac Added missing parse.c file to repository
lost
parents:
diff changeset
94 for (p2 = p; *p2 && !isspace(*p2); p2++)
99e3b3310bac Added missing parse.c file to repository
lost
parents:
diff changeset
95 /* do nothing */ ;
99e3b3310bac Added missing parse.c file to repository
lost
parents:
diff changeset
96
99e3b3310bac Added missing parse.c file to repository
lost
parents:
diff changeset
97 opc = lwasm_alloc((p2 - p) + 1);
99e3b3310bac Added missing parse.c file to repository
lost
parents:
diff changeset
98 memcpy(opc, p, p2 - p);
99e3b3310bac Added missing parse.c file to repository
lost
parents:
diff changeset
99 opc[p2 - p] = '\0';
99e3b3310bac Added missing parse.c file to repository
lost
parents:
diff changeset
100
38
9bd584bb6296 Added debugging message infrastructure
lost
parents: 37
diff changeset
101 debug_message(2, "Found operation code: '%s'", opc);
9bd584bb6296 Added debugging message infrastructure
lost
parents: 37
diff changeset
102
36
99e3b3310bac Added missing parse.c file to repository
lost
parents:
diff changeset
103 // skip intervening whitespace if present
99e3b3310bac Added missing parse.c file to repository
lost
parents:
diff changeset
104 while (*p2 && isspace(*p2))
99e3b3310bac Added missing parse.c file to repository
lost
parents:
diff changeset
105 p2++;
99e3b3310bac Added missing parse.c file to repository
lost
parents:
diff changeset
106
99e3b3310bac Added missing parse.c file to repository
lost
parents:
diff changeset
107 // look up instruction in insn table
99e3b3310bac Added missing parse.c file to repository
lost
parents:
diff changeset
108 for (opnum = 0; instab[opnum].opcode; opnum++)
99e3b3310bac Added missing parse.c file to repository
lost
parents:
diff changeset
109 {
99e3b3310bac Added missing parse.c file to repository
lost
parents:
diff changeset
110 if (!strcasecmp(instab[opnum].opcode, opc))
99e3b3310bac Added missing parse.c file to repository
lost
parents:
diff changeset
111 break;
99e3b3310bac Added missing parse.c file to repository
lost
parents:
diff changeset
112 }
99e3b3310bac Added missing parse.c file to repository
lost
parents:
diff changeset
113
66
aa9d9fedfdf4 Redid lwasm_parse_line() to correct overly complex logic flaws
lost
parents: 64
diff changeset
114 // if we found no operation, check if we had a comment
aa9d9fedfdf4 Redid lwasm_parse_line() to correct overly complex logic flaws
lost
parents: 64
diff changeset
115 // the reason this check is here is to allow for "private"
aa9d9fedfdf4 Redid lwasm_parse_line() to correct overly complex logic flaws
lost
parents: 64
diff changeset
116 // operation codes like "*pragma" which will be ignored by
aa9d9fedfdf4 Redid lwasm_parse_line() to correct overly complex logic flaws
lost
parents: 64
diff changeset
117 // other assemblers
68
cef25b0088e6 Fixed some problems detected by valgrind and testing
lost
parents: 66
diff changeset
118 // also skip empty ops
66
aa9d9fedfdf4 Redid lwasm_parse_line() to correct overly complex logic flaws
lost
parents: 64
diff changeset
119 if (!(instab[opnum].opcode))
aa9d9fedfdf4 Redid lwasm_parse_line() to correct overly complex logic flaws
lost
parents: 64
diff changeset
120 {
68
cef25b0088e6 Fixed some problems detected by valgrind and testing
lost
parents: 66
diff changeset
121 if (*opc == '*' || *opc == ';' || !*opc)
66
aa9d9fedfdf4 Redid lwasm_parse_line() to correct overly complex logic flaws
lost
parents: 64
diff changeset
122 goto done_line;
aa9d9fedfdf4 Redid lwasm_parse_line() to correct overly complex logic flaws
lost
parents: 64
diff changeset
123 }
aa9d9fedfdf4 Redid lwasm_parse_line() to correct overly complex logic flaws
lost
parents: 64
diff changeset
124
aa9d9fedfdf4 Redid lwasm_parse_line() to correct overly complex logic flaws
lost
parents: 64
diff changeset
125 // now we have the opcode and the symbol, we can decide if we're
aa9d9fedfdf4 Redid lwasm_parse_line() to correct overly complex logic flaws
lost
parents: 64
diff changeset
126 // actually going to do anything with this line
aa9d9fedfdf4 Redid lwasm_parse_line() to correct overly complex logic flaws
lost
parents: 64
diff changeset
127
aa9d9fedfdf4 Redid lwasm_parse_line() to correct overly complex logic flaws
lost
parents: 64
diff changeset
128 // we will NOT call the function if any of the following are true:
aa9d9fedfdf4 Redid lwasm_parse_line() to correct overly complex logic flaws
lost
parents: 64
diff changeset
129
aa9d9fedfdf4 Redid lwasm_parse_line() to correct overly complex logic flaws
lost
parents: 64
diff changeset
130 // - we are skipping a condition and the operation code is not a conditional
aa9d9fedfdf4 Redid lwasm_parse_line() to correct overly complex logic flaws
lost
parents: 64
diff changeset
131 // - we are defining a macro and the operation code is not ENDM
aa9d9fedfdf4 Redid lwasm_parse_line() to correct overly complex logic flaws
lost
parents: 64
diff changeset
132
aa9d9fedfdf4 Redid lwasm_parse_line() to correct overly complex logic flaws
lost
parents: 64
diff changeset
133 // we will call the function in any other circumstance
aa9d9fedfdf4 Redid lwasm_parse_line() to correct overly complex logic flaws
lost
parents: 64
diff changeset
134
aa9d9fedfdf4 Redid lwasm_parse_line() to correct overly complex logic flaws
lost
parents: 64
diff changeset
135 // first condition above
57
035b95a3690f Added conditional assembly and macros
lost
parents: 52
diff changeset
136 if (as -> inmacro && instab[opnum].endm == 0)
035b95a3690f Added conditional assembly and macros
lost
parents: 52
diff changeset
137 {
035b95a3690f Added conditional assembly and macros
lost
parents: 52
diff changeset
138 add_macro_line(as, l -> text);
66
aa9d9fedfdf4 Redid lwasm_parse_line() to correct overly complex logic flaws
lost
parents: 64
diff changeset
139 goto done_line;
57
035b95a3690f Added conditional assembly and macros
lost
parents: 52
diff changeset
140 }
035b95a3690f Added conditional assembly and macros
lost
parents: 52
diff changeset
141
66
aa9d9fedfdf4 Redid lwasm_parse_line() to correct overly complex logic flaws
lost
parents: 64
diff changeset
142 // second condition above
aa9d9fedfdf4 Redid lwasm_parse_line() to correct overly complex logic flaws
lost
parents: 64
diff changeset
143 if (as -> skipcond && instab[opnum].iscond == 0)
aa9d9fedfdf4 Redid lwasm_parse_line() to correct overly complex logic flaws
lost
parents: 64
diff changeset
144 goto done_line;
aa9d9fedfdf4 Redid lwasm_parse_line() to correct overly complex logic flaws
lost
parents: 64
diff changeset
145
aa9d9fedfdf4 Redid lwasm_parse_line() to correct overly complex logic flaws
lost
parents: 64
diff changeset
146 // we've registered the symbol as needed
aa9d9fedfdf4 Redid lwasm_parse_line() to correct overly complex logic flaws
lost
parents: 64
diff changeset
147 // now we need to check for a macro call IFF we don't collide with
aa9d9fedfdf4 Redid lwasm_parse_line() to correct overly complex logic flaws
lost
parents: 64
diff changeset
148 // an operation code; otherwise, call the operation function
aa9d9fedfdf4 Redid lwasm_parse_line() to correct overly complex logic flaws
lost
parents: 64
diff changeset
149 if (instab[opnum].opcode)
36
99e3b3310bac Added missing parse.c file to repository
lost
parents:
diff changeset
150 {
66
aa9d9fedfdf4 Redid lwasm_parse_line() to correct overly complex logic flaws
lost
parents: 64
diff changeset
151 if (instab[opnum].fn)
aa9d9fedfdf4 Redid lwasm_parse_line() to correct overly complex logic flaws
lost
parents: 64
diff changeset
152 {
aa9d9fedfdf4 Redid lwasm_parse_line() to correct overly complex logic flaws
lost
parents: 64
diff changeset
153 (instab[opnum].fn)(as, l, &p2, opnum);
aa9d9fedfdf4 Redid lwasm_parse_line() to correct overly complex logic flaws
lost
parents: 64
diff changeset
154 }
aa9d9fedfdf4 Redid lwasm_parse_line() to correct overly complex logic flaws
lost
parents: 64
diff changeset
155 else
aa9d9fedfdf4 Redid lwasm_parse_line() to correct overly complex logic flaws
lost
parents: 64
diff changeset
156 {
aa9d9fedfdf4 Redid lwasm_parse_line() to correct overly complex logic flaws
lost
parents: 64
diff changeset
157 // carp about unimplemented operation
aa9d9fedfdf4 Redid lwasm_parse_line() to correct overly complex logic flaws
lost
parents: 64
diff changeset
158 register_error(as, l, 1, "Unimplemented operation code: %s", opc);
aa9d9fedfdf4 Redid lwasm_parse_line() to correct overly complex logic flaws
lost
parents: 64
diff changeset
159 }
36
99e3b3310bac Added missing parse.c file to repository
lost
parents:
diff changeset
160 }
66
aa9d9fedfdf4 Redid lwasm_parse_line() to correct overly complex logic flaws
lost
parents: 64
diff changeset
161 else
aa9d9fedfdf4 Redid lwasm_parse_line() to correct overly complex logic flaws
lost
parents: 64
diff changeset
162 {
aa9d9fedfdf4 Redid lwasm_parse_line() to correct overly complex logic flaws
lost
parents: 64
diff changeset
163 if (expand_macro(as, l, &p2, opc) == 0)
aa9d9fedfdf4 Redid lwasm_parse_line() to correct overly complex logic flaws
lost
parents: 64
diff changeset
164 goto done_line;
36
99e3b3310bac Added missing parse.c file to repository
lost
parents:
diff changeset
165
66
aa9d9fedfdf4 Redid lwasm_parse_line() to correct overly complex logic flaws
lost
parents: 64
diff changeset
166 // carp about an unknown operation code and note that fact for
aa9d9fedfdf4 Redid lwasm_parse_line() to correct overly complex logic flaws
lost
parents: 64
diff changeset
167 // pass 2 in case a macro appears later with the same name!
aa9d9fedfdf4 Redid lwasm_parse_line() to correct overly complex logic flaws
lost
parents: 64
diff changeset
168 register_error(as, l, 1, "Uknown operation code: %s", opc);
aa9d9fedfdf4 Redid lwasm_parse_line() to correct overly complex logic flaws
lost
parents: 64
diff changeset
169 l -> badop = 1;
aa9d9fedfdf4 Redid lwasm_parse_line() to correct overly complex logic flaws
lost
parents: 64
diff changeset
170 }
57
035b95a3690f Added conditional assembly and macros
lost
parents: 52
diff changeset
171
035b95a3690f Added conditional assembly and macros
lost
parents: 52
diff changeset
172 done_line:
68
cef25b0088e6 Fixed some problems detected by valgrind and testing
lost
parents: 66
diff changeset
173 if (!(as -> skipcond || as -> inmacro))
cef25b0088e6 Fixed some problems detected by valgrind and testing
lost
parents: 66
diff changeset
174 {
cef25b0088e6 Fixed some problems detected by valgrind and testing
lost
parents: 66
diff changeset
175 // register symbol if the operation didn't
cef25b0088e6 Fixed some problems detected by valgrind and testing
lost
parents: 66
diff changeset
176 if (sym && instab[opnum].setsym == 0)
cef25b0088e6 Fixed some problems detected by valgrind and testing
lost
parents: 66
diff changeset
177 {
cef25b0088e6 Fixed some problems detected by valgrind and testing
lost
parents: 66
diff changeset
178 if (as -> passnum == 1)
cef25b0088e6 Fixed some problems detected by valgrind and testing
lost
parents: 66
diff changeset
179 {
71
90a5657d5408 Fixed problem with symbols being registered with the address of the NEXT instruction
lost
parents: 68
diff changeset
180 debug_message(1, "Registering symbol '%s' at %04X", sym, l -> codeaddr);
90a5657d5408 Fixed problem with symbols being registered with the address of the NEXT instruction
lost
parents: 68
diff changeset
181 if (lwasm_register_symbol(as, l, sym, l -> codeaddr, SYMBOL_NORM) < 0)
68
cef25b0088e6 Fixed some problems detected by valgrind and testing
lost
parents: 66
diff changeset
182 l -> sym = NULL;
cef25b0088e6 Fixed some problems detected by valgrind and testing
lost
parents: 66
diff changeset
183 else
cef25b0088e6 Fixed some problems detected by valgrind and testing
lost
parents: 66
diff changeset
184 l -> addrset = 1;
cef25b0088e6 Fixed some problems detected by valgrind and testing
lost
parents: 66
diff changeset
185 }
cef25b0088e6 Fixed some problems detected by valgrind and testing
lost
parents: 66
diff changeset
186 }
cef25b0088e6 Fixed some problems detected by valgrind and testing
lost
parents: 66
diff changeset
187 }
cef25b0088e6 Fixed some problems detected by valgrind and testing
lost
parents: 66
diff changeset
188
36
99e3b3310bac Added missing parse.c file to repository
lost
parents:
diff changeset
189 lwasm_free(opc);
44
2330b88f9600 Added simple output listing
lost
parents: 38
diff changeset
190 if (sym)
2330b88f9600 Added simple output listing
lost
parents: 38
diff changeset
191 lwasm_free(sym);
36
99e3b3310bac Added missing parse.c file to repository
lost
parents:
diff changeset
192 }