# HG changeset patch # User William Astle # Date 1511848337 25200 # Node ID 61580fc48f9800c1abfbfbb020482c24e6341e5e # Parent b138b4005125aa7baa07841087e63e26f65468fb Add option to omit file names from lwasm listings Add --list-nofiles option to modify generated listing to omit the filename specification. diff -r b138b4005125 -r 61580fc48f98 lwasm/list.c --- a/lwasm/list.c Mon Nov 27 22:35:53 2017 -0700 +++ b/lwasm/list.c Mon Nov 27 22:52:17 2017 -0700 @@ -200,12 +200,19 @@ #define max_linespec_len 17 // trim "include:" if it appears - linespec = cl -> linespec; - if ((strlen(linespec) > 8) && (linespec[7] == ':')) linespec += 8; - while (*linespec == ' ') linespec++; + if (as -> listnofile) + { + fprintf(of, "%05d ", cl->lineno); + } + else + { + linespec = cl -> linespec; + if ((strlen(linespec) > 8) && (linespec[7] == ':')) linespec += 8; + while (*linespec == ' ') linespec++; - fprintf(of, "(%*.*s):%05d ", max_linespec_len, max_linespec_len, linespec, cl->lineno); - + fprintf(of, "(%*.*s):%05d ", max_linespec_len, max_linespec_len, linespec, cl->lineno); + } + if (CURPRAGMA(cl, PRAGMA_CC)) { as->cycle_total = 0; diff -r b138b4005125 -r 61580fc48f98 lwasm/lwasm.h --- a/lwasm/lwasm.h Mon Nov 27 22:35:53 2017 -0700 +++ b/lwasm/lwasm.h Mon Nov 27 22:52:17 2017 -0700 @@ -424,6 +424,7 @@ int preprocess; // set if we are prepocessing int fileerr; // flags error opening file int exprwidth; // the bit width of the expression being evaluated + int listnofile; // nonzero to suppress printing file name in listings }; struct symtabe *register_symbol(asmstate_t *as, line_t *cl, char *sym, lw_expr_t value, int flags); diff -r b138b4005125 -r 61580fc48f98 lwasm/main.c --- a/lwasm/main.c Mon Nov 27 22:35:53 2017 -0700 +++ b/lwasm/main.c Mon Nov 27 22:52:17 2017 -0700 @@ -46,6 +46,7 @@ { "debug", 'd', "LEVEL", lw_cmdline_opt_optional, "Set debug mode"}, { "format", 'f', "TYPE", 0, "Select output format: decb, basic, raw, obj, os9"}, { "list", 'l', "FILE", lw_cmdline_opt_optional, "Generate list [to FILE]"}, + { "list-nofiles", 0x104, 0, 0, "Omit file names in list output"}, { "symbols", 's', 0, lw_cmdline_opt_optional, "Generate symbol list in listing, no effect without --list"}, { "symbols-nolocals", 0x103, 0, lw_cmdline_opt_optional, "Same as --symbols but with local labels ignored"}, { "tabs", 't', "WIDTH", 0, "Set tab spacing in listing (0=don't expand tabs)" }, @@ -148,6 +149,10 @@ as -> flags |= FLAG_SYMBOLS | FLAG_SYMBOLS_NOLOCALS; break; + case 0x104: + as -> listnofile = 1; + break; + case 'b': as -> output_format = OUTPUT_DECB; break;