diff options
author | H. Peter Anvin <hpa@zytor.com> | 2002-04-30 20:53:55 +0000 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2002-04-30 20:53:55 +0000 |
commit | eba20a73f2b3396f617747e789e35a679eb09606 (patch) | |
tree | 2a1b5e2652e39022a1d6ff7a36a630041edad1b6 /outform.c | |
parent | 87bc61964cf5d2cc2e322883d6f927a43fb53af3 (diff) | |
download | nasm-eba20a73f2b3396f617747e789e35a679eb09606.tar.gz |
NASM 0.98p3nasm-0.98p3
Diffstat (limited to 'outform.c')
-rw-r--r-- | outform.c | 37 |
1 files changed, 33 insertions, 4 deletions
@@ -11,9 +11,10 @@ #include <stdio.h> #include <string.h> + +#define BUILD_DRIVERS_ARRAY #include "outform.h" -static struct ofmt *drivers[MAX_OUTPUT_FORMATS]; static int ndrivers = 0; struct ofmt *ofmt_find(char *name) /* find driver */ @@ -26,17 +27,45 @@ struct ofmt *ofmt_find(char *name) /* find driver */ return NULL; } +struct dfmt *dfmt_find(struct ofmt *ofmt, char *name) /* find driver */ +{ + struct dfmt **dfmt = ofmt->debug_formats; + while (*dfmt) { + if (!strcmp(name, (*dfmt)->shortname)) + return (*dfmt); + dfmt++; + } + return NULL; +} void ofmt_list(struct ofmt *deffmt, FILE *fp) { int i; for (i=0; i<ndrivers; i++) - fprintf(fp, " %c %-7s%s\n", + fprintf(fp, " %c %-10s%s\n", drivers[i] == deffmt ? '*' : ' ', drivers[i]->shortname, drivers[i]->fullname); } +void dfmt_list(struct ofmt *ofmt, FILE *fp) +{ + struct dfmt ** drivers = ofmt->debug_formats; + while (*drivers) { + fprintf(fp, " %c %-10s%s\n", + drivers[0] == ofmt->current_dfmt ? '*' : ' ', + drivers[0]->shortname, + drivers[0]->fullname); + drivers++; + } +} +struct ofmt *ofmt_register (efunc error) { + for (ndrivers=0; drivers[ndrivers] != NULL; ndrivers++); + + if (ndrivers==0) + { + error(ERR_PANIC | ERR_NOFILE, + "No output drivers given at compile time"); + } -void ofmt_register (struct ofmt *info) { - drivers[ndrivers++] = info; + return (&OF_DEFAULT); } |