#include #include #include #include "apl9.h" Symtab *globalsymtab; Symbol * getsym(Symtab *tab, Rune *name) { for(int i = 0; i < tab->nsyms; i++) if(runestrcmp(tab->syms[i]->name, name) == 0) return tab->syms[i]; tab->nsyms++; tab->syms = realloc(tab->syms, sizeof(Symbol *) * tab->nsyms); tab->syms[tab->nsyms-1] = malloc(sizeof(Symbol)); tab->syms[tab->nsyms-1]->name = runestrdup(name); tab->syms[tab->nsyms-1]->undefined = 1; return tab->syms[tab->nsyms-1]; } Symtab * newsymtab(void) { Symtab *tab = malloc(sizeof(Symtab)); tab->nsyms = 0; tab->syms = nil; return tab; }