add identifier-variable and identifier-environment

This commit is contained in:
Yuichi Nishiwaki 2015-06-10 16:08:38 +09:00
parent 181d120f09
commit 25c0eb125e
2 changed files with 34 additions and 4 deletions

View File

@ -490,6 +490,30 @@ pic_macro_make_identifier(pic_state *pic)
return pic_obj_value(pic_make_id(pic, var, pic_env_ptr(env)));
}
static pic_value
pic_macro_identifier_variable(pic_state *pic)
{
pic_value id;
pic_get_args(pic, "o", &id);
pic_assert_type(pic, id, id);
return pic_id_ptr(id)->var;
}
static pic_value
pic_macro_identifier_environment(pic_state *pic)
{
pic_value id;
pic_get_args(pic, "o", &id);
pic_assert_type(pic, id, id);
return pic_obj_value(pic_id_ptr(id)->env);
}
static pic_value
pic_macro_variable_p(pic_state *pic)
{
@ -526,8 +550,10 @@ pic_macro_variable_eq_p(pic_state *pic)
void
pic_init_macro(pic_state *pic)
{
pic_defun(pic, "identifier?", pic_macro_identifier_p);
pic_defun(pic, "make-identifier", pic_macro_make_identifier);
pic_defun(pic, "identifier?", pic_macro_identifier_p);
pic_defun(pic, "identifier-variable", pic_macro_identifier_variable);
pic_defun(pic, "identifier-environment", pic_macro_identifier_environment);
pic_defun(pic, "variable?", pic_macro_variable_p);
pic_defun(pic, "variable=?", pic_macro_variable_eq_p);

View File

@ -239,9 +239,13 @@
(export make-parameter
parameterize)
(export identifier?
identifier=?
make-identifier)
(export make-identifier
identifier?
identifier-variable
identifier-environment
variable?
variable=?)
(export call-with-current-continuation
call/cc