Mercurial > hg > index.cgi
changeset 442:61580fc48f98
Add option to omit file names from lwasm listings
Add --list-nofiles option to modify generated listing to omit the filename
specification.
author | William Astle <lost@l-w.ca> |
---|---|
date | Mon, 27 Nov 2017 22:52:17 -0700 |
parents | b138b4005125 |
children | 999ae00d0919 |
files | lwasm/list.c lwasm/lwasm.h lwasm/main.c |
diffstat | 3 files changed, 18 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- 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;
--- 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);
--- 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;