Mercurial > hg > index.cgi
diff lwasm/main.c @ 222:03f7192fcd20
Add --unicorns option for IDE integration
This version of unicorns adds RESOURCE: lines to the output which specify
files and macros discovered during the assembly process.
author | William Astle <lost@l-w.ca> |
---|---|
date | Sun, 15 Jul 2012 10:50:46 -0600 |
parents | afd50d6b4113 |
children | 3864d96ee8c7 |
line wrap: on
line diff
--- a/lwasm/main.c Sun Jul 15 10:27:43 2012 -0600 +++ b/lwasm/main.c Sun Jul 15 10:50:46 2012 -0600 @@ -32,6 +32,8 @@ #include "lwasm.h" #include "input.h" +extern void lwasm_do_unicorns(asmstate_t *as); + extern int parse_pragma_string(asmstate_t *as, char *str, int ignoreerr); /* command line option handling */ @@ -56,6 +58,7 @@ { "includedir", 'I', "PATH", 0, "Add entry to include path" }, { "define", 'D', "SYM[=VAL]", 0, "Automatically define SYM to be VAL (or 1)"}, { "preprocess", 'P', 0, 0, "Preprocess macros and conditionals and output revised source to stdout" }, + { "unicorns", 0x4242, 0, 0, "Add sooper sekrit sauce"}, { 0 } }; @@ -137,6 +140,10 @@ case 0x102: as -> flags |= FLAG_DEPEND | FLAG_DEPENDNOERR; break; + + case 0x4242: + as -> flags |= FLAG_UNICORNS; + break; case 'f': if (!strcasecmp(arg, "decb")) @@ -284,6 +291,7 @@ // stop processing immediately break; } + lwasm_do_unicorns(&asmstate); lwasm_show_errors(&asmstate); exit(1); } @@ -291,13 +299,16 @@ if (asmstate.flags & FLAG_DEPEND) { - // output dependencies (other than "includebin") - char *n; + if ((asmstate.flags & FLAG_UNICORNS) == 0) + { + // output dependencies (other than "includebin") + char *n; - while ((n = lw_stack_pop(asmstate.includelist))) - { - fprintf(stdout, "%s\n", n); - lw_free(n); + while ((n = lw_stack_pop(asmstate.includelist))) + { + fprintf(stdout, "%s\n", n); + lw_free(n); + } } } else @@ -307,8 +318,14 @@ } debug_message(&asmstate, 50, "Done assembly"); - - do_list(&asmstate); - + + if (asmstate.flags & FLAG_UNICORNS) + { + lwasm_do_unicorns(&asmstate); + } + else + { + do_list(&asmstate); + } exit(0); }