NASM 0.94
[nasm/avx512.git] / outform.c
blob154c63f7ea1a3fd10c142e1e659e2c5a21f9d4ea
1 /* outform.c manages a list of output formats, and associates
2 * them with their relevant drivers. Also has a
3 * routine to find the correct driver given a name
4 * for it
6 * The Netwide Assembler is copyright (C) 1996 Simon Tatham and
7 * Julian Hall. All rights reserved. The software is
8 * redistributable under the licence given in the file "Licence"
9 * distributed in the NASM archive.
12 #include <stdio.h>
13 #include <string.h>
14 #include "outform.h"
16 static struct ofmt *drivers[MAX_OUTPUT_FORMATS];
17 static int ndrivers = 0;
19 struct ofmt *ofmt_find(char *name) /* find driver */
21 int i;
23 for (i=0; i<ndrivers; i++)
24 if (!strcmp(name,drivers[i]->shortname))
25 return drivers[i];
27 return NULL;
30 void ofmt_list(struct ofmt *deffmt)
32 int i;
33 for (i=0; i<ndrivers; i++)
34 fprintf(stderr," %c %-7s%s\n",
35 drivers[i] == deffmt ? '*' : ' ',
36 drivers[i]->shortname,
37 drivers[i]->fullname);
40 void ofmt_register (struct ofmt *info) {
41 drivers[ndrivers++] = info;