comparison lwasm/main.c @ 224:3864d96ee8c7

Make unicorns notice referenced files better Fix bug related to includebin and also make unicorns notice all files opened through the input subsystem when generating the resource list.
author William Astle <lost@l-w.ca>
date Sun, 15 Jul 2012 20:50:18 -0600
parents 03f7192fcd20
children 7c2c2239ec9c
comparison
equal deleted inserted replaced
223:211fc8038b8d 224:3864d96ee8c7
56 { "6809", '9', 0, 0, "Set assembler to 6809 only mode" }, 56 { "6809", '9', 0, 0, "Set assembler to 6809 only mode" },
57 { "6309", '3', 0, 0, "Set assembler to 6309 mode (default)" }, 57 { "6309", '3', 0, 0, "Set assembler to 6309 mode (default)" },
58 { "includedir", 'I', "PATH", 0, "Add entry to include path" }, 58 { "includedir", 'I', "PATH", 0, "Add entry to include path" },
59 { "define", 'D', "SYM[=VAL]", 0, "Automatically define SYM to be VAL (or 1)"}, 59 { "define", 'D', "SYM[=VAL]", 0, "Automatically define SYM to be VAL (or 1)"},
60 { "preprocess", 'P', 0, 0, "Preprocess macros and conditionals and output revised source to stdout" }, 60 { "preprocess", 'P', 0, 0, "Preprocess macros and conditionals and output revised source to stdout" },
61 { "unicorns", 0x4242, 0, 0, "Add sooper sekrit sauce"}, 61 { "unicorns", 0x142, 0, 0, "Add sooper sekrit sauce"},
62 { 0 } 62 { 0 }
63 }; 63 };
64 64
65 65
66 static int parse_opts(int key, char *arg, void *state) 66 static int parse_opts(int key, char *arg, void *state)
139 139
140 case 0x102: 140 case 0x102:
141 as -> flags |= FLAG_DEPEND | FLAG_DEPENDNOERR; 141 as -> flags |= FLAG_DEPEND | FLAG_DEPENDNOERR;
142 break; 142 break;
143 143
144 case 0x4242: 144 case 0x142:
145 as -> flags |= FLAG_UNICORNS; 145 as -> flags |= FLAG_UNICORNS;
146 break; 146 break;
147 147
148 case 'f': 148 case 'f':
149 if (!strcasecmp(arg, "decb")) 149 if (!strcasecmp(arg, "decb"))
297 } 297 }
298 } 298 }
299 299
300 if (asmstate.flags & FLAG_DEPEND) 300 if (asmstate.flags & FLAG_DEPEND)
301 { 301 {
302 if ((asmstate.flags & FLAG_UNICORNS) == 0) 302 // output dependencies (other than "includebin")
303 { 303 char *n;
304 // output dependencies (other than "includebin") 304
305 char *n; 305 while ((n = lw_stack_pop(asmstate.includelist)))
306 306 {
307 while ((n = lw_stack_pop(asmstate.includelist))) 307 fprintf(stdout, "%s\n", n);
308 { 308 lw_free(n);
309 fprintf(stdout, "%s\n", n);
310 lw_free(n);
311 }
312 } 309 }
313 } 310 }
314 else 311 else
315 { 312 {
316 debug_message(&asmstate, 50, "Doing output"); 313 debug_message(&asmstate, 50, "Doing output");
319 316
320 debug_message(&asmstate, 50, "Done assembly"); 317 debug_message(&asmstate, 50, "Done assembly");
321 318
322 if (asmstate.flags & FLAG_UNICORNS) 319 if (asmstate.flags & FLAG_UNICORNS)
323 { 320 {
321 debug_message(&asmstate, 50, "Invoking unicorns");
324 lwasm_do_unicorns(&asmstate); 322 lwasm_do_unicorns(&asmstate);
325 } 323 }
326 else 324 else
327 { 325 {
328 do_list(&asmstate); 326 do_list(&asmstate);