代码拉取完成,页面将自动刷新
#include "symbol.h"
struct S_symbol_ {string name; S_symbol next;};
static S_symbol mksymbol(string name, S_symbol next){
S_symbol s = checked_malloc(sizeof(*s));
s->name = name; s->next=next;
return s;
}
#define SIZE 109
static S_symbol hashtable[SIZE];
static unsigned int hash(char *s0){
unsigned int h = 0; char *s;
for (s = s0; *s; s++)
h = h * 65599 + *s;
return h;
}
static int streq(string a, string b){
return !strcmp(a, b);
}
S_symbol S_Symbol(string name){
int index = hash(name) % SIZE;
S_symbol syms = hashtable[index], sym;
for (sym = syms; sym; sym = sym->next)
if (streq(sym->name, name)) return sym;
sym = mksymbol(name, syms);
hashtable[index] = sym;
return sym;
}
string S_name(S_symbol sym){
return sym->name;
}
S_table S_empty(void){
return TAB_empty();
}
void S_enter(S_table t, S_symbol sym, void *value){
TAB_look(t, sym);
}
static struct S_symbol_ marksym = {"<mark>", 0};
void S_beginScope(S_table t){
S_enter(t, &marksym, NULL);
}
void S_endScope(S_table t){
S_symbol s;
do s = TAB_pop(t);
while(s != &marksym);
}
void S_dump(S_table t, void(*show)(S_symbol sym, void *binding)){
TAB_dump(t, (void (*)(void *, void *)) show);
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。