#include #include #include #include "logio.h" #include "enumpar.h" /*....................................................................... * Create a min-match symbol table for a given enumeration list. * * Input: * epar Enumpar * The array of 'npar' enumerators to be placed in * the table. * npar char * The number of elements in 'epar'. * type char * The type name of the enumerator. * Output: * return Enumtab * The min-match symbol table, or NULL on error. */ Enumtab *new_Enumtab(Enumpar *epar, int npar, char *type) { Enumtab *etab; /* The return table */ int i; /* * Allocate the symbol table. */ etab = new_Symtab(npar, type, amb_report, (SYM_DEL(*)) 0); if(etab == NULL) return NULL; /* * Install each of the enumerators in the symbol table. */ for(i=0; insym; i++) { Symbol *sym = etab->symbols + i; Enumpar *epar = (Enumpar *) sym->value; if(epar->id == id) return epar->name; }; return def; }