#include #include #include #include "word.h" #include "hash.h" #define MAXWORD 100 #define HASHSIZE 100 struct nlist *hashtab[HASHSIZE]; int main(void) { char word[MAXWORD]; char *name; while (getword(word, MAXWORD) != EOF) { if (!strcmp(word, "#define")) { getword(word, MAXWORD); name = strdup(word); getword(word, MAXWORD); install(hashtab, HASHSIZE, name, word); free(name); } else if (!strcmp(word, "#undef")) { getword(word, MAXWORD); undef(hashtab, HASHSIZE, word); } } phashtab(hashtab, HASHSIZE); hashfree(hashtab, HASHSIZE); return 0; }