comparison lwasm/pragma.c @ 110:38c1537857ce

Pragma stack at parse stage now works
author lost@l-w.ca
date Sun, 07 Aug 2011 10:37:22 -0600
parents 9960e05cbe3a
children 344cfc25afec
comparison
equal deleted inserted replaced
109:6a919c3ca0e9 110:38c1537857ce
135 135
136 static int pragma_stack_compare(input_stack_entry *e, void *d) 136 static int pragma_stack_compare(input_stack_entry *e, void *d)
137 { 137 {
138 int flag = *((int *)d); 138 int flag = *((int *)d);
139 struct pragma_stack_entry *pse = (struct pragma_stack_entry *)e; 139 struct pragma_stack_entry *pse = (struct pragma_stack_entry *)e;
140 140
141 if (pse -> flag == flag) 141 if (pse -> flag == flag)
142 return 1; 142 return 1;
143 return 0; 143 return 0;
144 } 144 }
145 145
170 if (!strcasecmp(pp, set_pragmas[i].setstr) || !strcasecmp(pp, set_pragmas[i].resetstr)) 170 if (!strcasecmp(pp, set_pragmas[i].setstr) || !strcasecmp(pp, set_pragmas[i].resetstr))
171 { 171 {
172 pse = (struct pragma_stack_entry *)input_stack_pop(as, 0x42424242, pragma_stack_compare, (void *)&(set_pragmas[i].flag)); 172 pse = (struct pragma_stack_entry *)input_stack_pop(as, 0x42424242, pragma_stack_compare, (void *)&(set_pragmas[i].flag));
173 if (pse) 173 if (pse)
174 { 174 {
175 debug_message(as, 100, "Popped pragma string %s", pse->str);
175 parse_pragma_string(as, (char *)&(pse->str), 1); 176 parse_pragma_string(as, (char *)&(pse->str), 1);
176 lw_free(pse); 177 lw_free(pse);
177 } 178 }
178 if (set_pragmas[i].flag == PRAGMA_NOLIST) 179 if (set_pragmas[i].flag == PRAGMA_NOLIST)
179 l -> pragmas |= PRAGMA_NOLIST; 180 l -> pragmas |= PRAGMA_NOLIST;
225 } 226 }
226 pse = lw_alloc(sizeof(struct pragma_stack_entry) + strlen(t)); 227 pse = lw_alloc(sizeof(struct pragma_stack_entry) + strlen(t));
227 pse -> flag = set_pragmas[i].flag; 228 pse -> flag = set_pragmas[i].flag;
228 pse -> magic = 0x42424242; 229 pse -> magic = 0x42424242;
229 strcpy((char *)&(pse -> str), t); 230 strcpy((char *)&(pse -> str), t);
231 debug_message(as, 100, "Pushed pragma string %s", pse->str);
232
230 input_stack_push(as, (input_stack_entry *)pse); 233 input_stack_push(as, (input_stack_entry *)pse);
231 234
232 if (set_pragmas[i].flag == PRAGMA_NOLIST) 235 if (set_pragmas[i].flag == PRAGMA_NOLIST)
233 l -> pragmas |= PRAGMA_NOLIST; 236 l -> pragmas |= PRAGMA_NOLIST;
234 } 237 }