From 322bee0aac0f177127e4a33aff94a5fa2158a0f9 Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Sat, 10 Aug 2019 01:38:06 -0700 Subject: Additional listing options, improve help output, fix macro limits Additional listing options: -Ld to display counts in decimal -Lp to output a list file in every pass (to make sure one exists) Clean up the help output and make it comprehensive. The -hf and -y options are no longer necessary, although they are supported for backwards compatiblity. Fix macro-levels so it actually count descent levels; a new macro-tokens limit introduced for the actual token limit. Slightly simplify the limits code. Signed-off-by: H. Peter Anvin --- output/codeview.c | 2 +- output/outform.c | 35 ++++++++++++++++++++++++++--------- output/outform.h | 2 +- 3 files changed, 28 insertions(+), 11 deletions(-) (limited to 'output') diff --git a/output/codeview.c b/output/codeview.c index 870d573f..4dbc9b3a 100644 --- a/output/codeview.c +++ b/output/codeview.c @@ -59,7 +59,7 @@ static void cv8_output(int type, void *param); static void cv8_cleanup(void); const struct dfmt df_cv8 = { - "Codeview 8", /* .fullname */ + "Codeview 8+", /* .fullname */ "cv8", /* .shortname */ cv8_init, /* .init */ cv8_linenum, /* .linenum */ diff --git a/output/outform.c b/output/outform.c index d299d04a..3ab15d2a 100644 --- a/output/outform.c +++ b/output/outform.c @@ -43,6 +43,7 @@ #define BUILD_DRIVERS_ARRAY #include "outform.h" +#include "outlib.h" const struct ofmt *ofmt_find(const char *name, const struct ofmt_alias **ofmt_alias) @@ -90,29 +91,45 @@ void ofmt_list(const struct ofmt *deffmt, FILE * fp) /* primary targets first */ for (ofp = drivers; (of = *ofp); ofp++) { - fprintf(fp, " %c %-10s%s\n", - of == deffmt ? '*' : ' ', - of->shortname, of->fullname); + fprintf(fp, " %-20s %s%s\n", + of->shortname, + of->fullname, + of == deffmt ? " [default]" : ""); } /* lets walk through aliases then */ for (i = 0; i < ARRAY_SIZE(ofmt_aliases); i++) { if (!ofmt_aliases[i].shortname) continue; - fprintf(fp, " %-10s%s\n", + fprintf(fp, " %-20s %s\n", ofmt_aliases[i].shortname, ofmt_aliases[i].fullname); } } -void dfmt_list(const struct ofmt *ofmt, FILE *fp) +void dfmt_list(FILE *fp) { + const struct ofmt * const *ofp; + const struct ofmt *of; const struct dfmt * const *dfp; const struct dfmt *df; + char prefixbuf[32]; + const char *prefix; - for (dfp = ofmt->debug_formats; (df = *dfp); dfp++) { - fprintf(fp, " %c %-10s%s\n", - df == dfmt ? '*' : ' ', - df->shortname, df->fullname); + for (ofp = drivers; (of = *ofp); ofp++) { + if (of->debug_formats && of->debug_formats != null_debug_arr) { + snprintf(prefixbuf, sizeof prefixbuf, "%s:", + of->shortname); + prefix = prefixbuf; + + for (dfp = of->debug_formats; (df = *dfp); dfp++) { + if (df != &null_debug_form) + fprintf(fp, " %-10s %-9s %s%s\n", + prefix, + df->shortname, df->fullname, + df == of->default_dfmt ? " [default]" : ""); + prefix = ""; + } + } } } diff --git a/output/outform.h b/output/outform.h index 5d30d645..9d068dbf 100644 --- a/output/outform.h +++ b/output/outform.h @@ -373,7 +373,7 @@ static const struct ofmt_alias ofmt_aliases[] = { const struct ofmt *ofmt_find(const char *name, const struct ofmt_alias **ofmt_alias); const struct dfmt *dfmt_find(const struct ofmt *, const char *); void ofmt_list(const struct ofmt *, FILE *); -void dfmt_list(const struct ofmt *ofmt, FILE * fp); +void dfmt_list(FILE *); extern const struct dfmt null_debug_form; #endif /* NASM_OUTFORM_H */ -- cgit v1.2.1