int main(int argc, char *argv[]) { if (argc == 2) { if (!(dstfile = fopen(argv[1], "w"))){ perror("Could not open output file"); exit(1); } } else { dstfile = stdout; } // yydebug = 1; ht = create_hashtab(20); // Use 20 bins if (yyparse() != 0) printf("Compilation error."); }
/*============================= * create_table_impl -- Create table * All tables are created in this function * returns addref'd table *===========================*/ static TABLE create_table_impl (enum TB_VALTYPE valtype, DELFUNC delfunc) { TABLE tab = (TABLE) stdalloc(sizeof(*tab)); tab->vtable = &vtable_for_table; tab->refcnt = 1; tab->valtype = valtype; if (getlloptstr("rbtree", 0)) tab->rbtree = RbTreeCreate(tab, rbcompare, rbdestroy); else tab->hashtab = create_hashtab(); tab->destroyfunc = delfunc; return tab; }