add gensym function
This commit is contained in:
parent
f32754c0f9
commit
ac136bbc2e
13
src/macro.c
13
src/macro.c
|
@ -637,6 +637,18 @@ pic_macro_include(pic_state *pic)
|
||||||
return body;
|
return body;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static pic_value
|
||||||
|
pic_macro_gensym(pic_state *pic)
|
||||||
|
{
|
||||||
|
static const char skel[] = ".g";
|
||||||
|
pic_sym uniq;
|
||||||
|
|
||||||
|
pic_get_args(pic, "");
|
||||||
|
|
||||||
|
uniq = pic_gensym(pic, pic_intern_cstr(pic, skel));
|
||||||
|
return pic_symbol_value(uniq);
|
||||||
|
}
|
||||||
|
|
||||||
static pic_value
|
static pic_value
|
||||||
pic_macro_make_sc(pic_state *pic)
|
pic_macro_make_sc(pic_state *pic)
|
||||||
{
|
{
|
||||||
|
@ -898,6 +910,7 @@ pic_init_macro(pic_state *pic)
|
||||||
xh_put_int(pic->lib->senv->name, pic->sDEFINE_MACRO, pic->sDEFINE_MACRO);
|
xh_put_int(pic->lib->senv->name, pic->sDEFINE_MACRO, pic->sDEFINE_MACRO);
|
||||||
pic_export(pic, pic->sDEFINE_MACRO);
|
pic_export(pic, pic->sDEFINE_MACRO);
|
||||||
|
|
||||||
|
pic_defun(pic, "gensym", pic_macro_gensym);
|
||||||
pic_defun(pic, "make-syntactic-closure", pic_macro_make_sc);
|
pic_defun(pic, "make-syntactic-closure", pic_macro_make_sc);
|
||||||
pic_defun(pic, "identifier?", pic_macro_identifier_p);
|
pic_defun(pic, "identifier?", pic_macro_identifier_p);
|
||||||
pic_defun(pic, "identifier=?", pic_macro_identifier_eq_p);
|
pic_defun(pic, "identifier=?", pic_macro_identifier_eq_p);
|
||||||
|
|
Loading…
Reference in New Issue