add pic_ungensym

This commit is contained in:
Yuichi Nishiwaki
2014-07-26 14:04:34 +09:00
parent 6966cdfa31
commit 5ba0c56308
2 changed files with 17 additions and 0 deletions
+16
View File
@@ -61,6 +61,22 @@ pic_gensym(pic_state *pic, pic_sym base)
return uniq;
}
pic_sym
pic_ungensym(pic_state *pic, pic_sym base)
{
const char *name, *occr;
if (pic_interned_p(pic, base)) {
return base;
}
name = pic_symbol_name(pic, base);
if ((occr = strrchr(name, '@')) == NULL) {
pic_abort(pic, "logic flaw");
}
return pic_intern(pic, name, occr - name);
}
bool
pic_interned_p(pic_state *pic, pic_sym sym)
{