static int showhashtab(void) { int tab; token_t e1; EiC_work_tab = tab = stand_tab; /* standard name space */ EiC_inittoken(&e1); switch(EiC_lexan()) { TYPESPEC: TYPEQUAL: retractlexan(); EiC_type_name(&e1); break; case ID: if(strcmp(EiC_LEXEM,"tags") == 0) tab = tag_tab; else if(strcmp(EiC_LEXEM,"builtin") == 0) e1.Type = EiC_addtype(t_builtin,0); else retractlexan(); break; default: retractlexan(); } if(e1.Type) { showtab(tab, 0,&e1,NULL,NULL); EiC_freetype(e1.Type); } else { showtab(tab,0,NULL,NULL,IsObject); showtab(tab,0,NULL,NULL,EiC_IsFunc); } return 1; }
symentry_t *EiC_add_builtinfunc(char *name, val_t(*vfunc) ()) { symentry_t *sym; sym = EiC_insertLUT(stand_tab, name, ID); EiC_freetype(sym->type); sym->level = 1; sym->val.vfunc = vfunc; sym->type = EiC_addtype(t_builtin,NULL); return sym; }
/*CUT lutInsert*/ symentry_t * EiC_insertLUT(char nspace,char *id,int type) { symentry_t *sym; auto int hashval; sym = (symentry_t *) xcalloc(1,sizeof(symentry_t)); if(sym == NULL) return(NULL); if( (sym->id = EiC_strsave(id)) == NULL) { xfree(sym); return(NULL); } sym->entry = _EnTrY_No++; hashval = hashsmc(sym->id,HSIZE); sym->next = EiC_HTAB[hashval]; EiC_HTAB[hashval] = sym; sym->nspace = nspace; sym->val.ival = -1; /* indicates unused */ sym->type = EiC_addtype(type,NULL); sym->fname = CurrentFileName(); return(sym); }