Mercurial > hg-old > index.cgi
annotate lwasm/macro.c @ 345:7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
author | lost@starbug |
---|---|
date | Thu, 25 Mar 2010 23:17:54 -0600 |
parents | old-trunk/lwasm/old/macro.c@eb230fa7d28e |
children | a82c55070624 |
rev | line source |
---|---|
339 | 1 /* |
2 macro.c | |
3 Copyright © 2008 William Astle | |
4 | |
5 This file is part of LWASM. | |
6 | |
7 LWASM is free software: you can redistribute it and/or modify it under the | |
8 terms of the GNU General Public License as published by the Free Software | |
9 Foundation, either version 3 of the License, or (at your option) any later | |
10 version. | |
11 | |
12 This program is distributed in the hope that it will be useful, but WITHOUT | |
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | |
15 more details. | |
16 | |
17 You should have received a copy of the GNU General Public License along with | |
18 this program. If not, see <http://www.gnu.org/licenses/>. | |
19 | |
20 Contains stuff associated with macro processing | |
21 */ | |
22 | |
23 #include <config.h> | |
24 | |
25 #include <ctype.h> | |
26 #include <stdlib.h> | |
27 #include <string.h> | |
345
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
28 #include <stdio.h> |
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
29 |
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
30 #include <lw_alloc.h> |
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
31 #include <lw_string.h> |
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
32 |
339 | 33 #include "lwasm.h" |
345
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
34 #include "input.h" |
339 | 35 #include "instab.h" |
36 | |
345
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
37 PARSEFUNC(pseudo_macro_parse) |
339 | 38 { |
39 macrotab_t *m; | |
345
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
40 |
339 | 41 if (as -> skipcond) |
42 { | |
43 as -> skipmacro = 1; | |
44 return; | |
45 } | |
345
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
46 |
339 | 47 if (as -> inmacro) |
48 { | |
345
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
49 lwasm_register_error(as, l, "Attempt to define a macro inside a macro"); |
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
50 return; |
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
51 } |
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
52 |
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
53 if (!(l -> sym)) |
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
54 { |
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
55 lwasm_register_error(as, l, "Missing macro name"); |
339 | 56 return; |
57 } | |
58 | |
59 for (m = as -> macros; m; m = m -> next) | |
60 { | |
61 if (!strcmp(m -> name, l -> sym)) | |
62 break; | |
63 } | |
64 if (m) | |
65 { | |
345
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
66 lwasm_register_error(as, l, "Duplicate macro definition"); |
339 | 67 return; |
68 } | |
69 | |
345
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
70 m = lw_alloc(sizeof(macrotab_t)); |
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
71 m -> name = lw_strdup(l -> sym); |
339 | 72 m -> next = as -> macros; |
73 m -> lines = NULL; | |
74 m -> numlines = 0; | |
75 as -> macros = m; | |
345
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
76 |
339 | 77 while (**p && !isspace(**p)) |
78 (*p)++; | |
345
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
79 |
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
80 as -> inmacro = 1; |
339 | 81 } |
82 | |
345
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
83 PARSEFUNC(pseudo_endm_parse) |
339 | 84 { |
85 if (as -> skipcond) | |
86 { | |
87 as -> skipmacro = 0; | |
88 return; | |
89 } | |
90 | |
91 if (!as -> inmacro) | |
92 { | |
345
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
93 lwasm_register_error(as, l, "ENDM without MACRO"); |
339 | 94 return; |
95 } | |
96 | |
97 as -> inmacro = 0; | |
98 | |
99 // a macro definition counts as a context break for local symbols | |
100 as -> context = lwasm_next_context(as); | |
101 } | |
102 | |
103 // the current macro will ALWAYS be the first one in the table | |
104 int add_macro_line(asmstate_t *as, char *optr) | |
105 { | |
106 if (!as -> inmacro) | |
107 return 0; | |
108 | |
345
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
109 as -> macros -> lines = lw_realloc(as -> macros -> lines, sizeof(char *) * (as -> macros -> numlines + 1)); |
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
110 as -> macros -> lines[as -> macros -> numlines] = lw_strdup(optr); |
339 | 111 as -> macros -> numlines += 1; |
112 return 1; | |
113 } | |
114 | |
115 void macro_add_to_buff(char **buff, int *loc, int *len, char c) | |
116 { | |
117 if (*loc == *len) | |
118 { | |
345
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
119 *buff = lw_realloc(*buff, *len + 32); |
339 | 120 *len += 32; |
121 } | |
122 (*buff)[(*loc)++] = c; | |
123 } | |
124 | |
125 // this is just like a regular operation function | |
126 /* | |
127 macro args are referenced by "\n" where 1 <= n <= 9 | |
128 or by "\{n}"; a \ can be included by writing \\ | |
129 a comma separates argument but one can be included with "\," | |
130 whitespace ends argument list but can be included with "\ " or the like | |
131 | |
132 */ | |
345
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
133 int expand_macro(asmstate_t *as, line_t *l, char **p, char *opc) |
339 | 134 { |
135 int lc; | |
345
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
136 line_t *cl, *nl; |
339 | 137 int oldcontext; |
138 macrotab_t *m; | |
139 | |
140 char **args = NULL; // macro arguments | |
141 int nargs = 0; // number of arguments | |
142 | |
143 char *p2, *p3; | |
144 | |
145 int bloc, blen; | |
146 char *linebuff; | |
147 | |
148 for (m = as -> macros; m; m = m -> next) | |
149 { | |
150 if (!strcmp(opc, m -> name)) | |
151 break; | |
152 } | |
153 // signal no macro expansion | |
154 if (!m) | |
155 return -1; | |
156 | |
157 // save current symbol context for after macro expansion | |
158 oldcontext = as -> context; | |
159 | |
160 cl = l; | |
161 | |
162 as -> context = lwasm_next_context(as); | |
163 | |
345
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
164 while (**p && !isspace(**p) && **p != ',') |
339 | 165 { |
345
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
166 p2 = *p; |
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
167 while (*p2 && !isspace(*p2) && *p2 != ',') |
339 | 168 { |
345
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
169 if (*p2 == '\\') |
339 | 170 { |
345
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
171 if (p2[1]) |
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
172 p2++; |
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
173 } |
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
174 p2++; |
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
175 } |
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
176 |
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
177 // have arg here |
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
178 args = lw_realloc(args, sizeof(char *) * (nargs + 1)); |
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
179 args[nargs] = lw_alloc(p2 - *p + 1); |
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
180 args[nargs][p2 - *p] = '\0'; |
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
181 memcpy(args[nargs], *p, p2 - *p); |
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
182 *p = p2; |
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
183 |
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
184 // now collapse out "\" characters |
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
185 for (p3 = p2 = args[nargs]; *p2; p2++, p3++) |
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
186 { |
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
187 if (*p2 == '\\' && p2[1]) |
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
188 { |
339 | 189 p2++; |
190 } | |
345
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
191 *p3 = *p2; |
339 | 192 } |
345
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
193 *p3 = '\0'; |
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
194 |
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
195 nargs++; |
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
196 if (**p == ',') |
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
197 (*p)++; |
339 | 198 } |
199 | |
345
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
200 |
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
201 // now create a string for the macro |
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
202 // and push it into the front of the input stack |
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
203 bloc = blen = 0; |
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
204 linebuff = NULL; |
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
205 |
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
206 for (lc = 0; lc < m -> numlines; lc++) |
339 | 207 { |
345
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
208 for (p2 = m -> lines[lc]; *p2; p2++) |
339 | 209 { |
345
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
210 if (*p2 == '\\' && isdigit(p2[1])) |
339 | 211 { |
345
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
212 int n; |
339 | 213 |
345
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
214 p2++; |
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
215 n = *p2 - '0'; |
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
216 if (n == 0) |
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
217 { |
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
218 for (p3 = m -> name; *p3; p3++) |
339 | 219 macro_add_to_buff(&linebuff, &bloc, &blen, *p3); |
220 continue; | |
221 } | |
345
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
222 if (n < 1 || n > nargs) |
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
223 continue; |
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
224 for (p3 = args[n - 1]; *p3; p3++) |
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
225 macro_add_to_buff(&linebuff, &bloc, &blen, *p3); |
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
226 continue; |
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
227 } |
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
228 else if (*p2 == '{') |
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
229 { |
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
230 int n = 0, n2; |
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
231 p2++; |
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
232 while (*p2 && isdigit(*p2)) |
339 | 233 { |
345
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
234 n2 = *p2 - '0'; |
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
235 if (n2 < 0 || n2 > 9) |
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
236 n2 = 0; |
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
237 n = n * 10 + n2; |
339 | 238 p2++; |
345
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
239 } |
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
240 if (*p2 == '}') |
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
241 p2++; |
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
242 |
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
243 if (n == 0) |
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
244 { |
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
245 for (p3 = m -> name; *p3; p3++) |
339 | 246 macro_add_to_buff(&linebuff, &bloc, &blen, *p3); |
247 continue; | |
248 } | |
345
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
249 if (n < 1 || n > nargs) |
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
250 continue; |
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
251 for (p3 = args[n - 1]; *p3; p3++) |
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
252 macro_add_to_buff(&linebuff, &bloc, &blen, *p3); |
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
253 continue; |
339 | 254 } |
345
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
255 else |
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
256 { |
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
257 macro_add_to_buff(&linebuff, &bloc, &blen, *p2); |
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
258 } |
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
259 } |
339 | 260 |
345
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
261 macro_add_to_buff(&linebuff, &bloc, &blen, '\n'); |
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
262 |
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
263 } |
339 | 264 |
345
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
265 { |
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
266 char ctcbuf[100]; |
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
267 char *p; |
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
268 snprintf(ctcbuf, 100, "\001\001SETCONTEXT %d\n", oldcontext); |
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
269 for (p = ctcbuf; *p; p++) |
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
270 macro_add_to_buff(&linebuff, &bloc, &blen, *p); |
339 | 271 } |
272 | |
345
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
273 // push the macro into the front of the stream |
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
274 input_openstring(as, opc, linebuff); |
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
275 |
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
276 lw_free(linebuff); |
339 | 277 |
278 // clean up | |
279 if (args) | |
280 { | |
281 while (nargs) | |
282 { | |
345
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
283 lw_free(args[--nargs]); |
339 | 284 } |
345
7416c3f9c321
Basic macro processor ported forward; added context break handling for local symbols
lost@starbug
parents:
339
diff
changeset
|
285 lw_free(args); |
339 | 286 } |
287 | |
288 // indicate a macro was expanded | |
289 return 0; | |
290 } |