From b4a0761eb3c724070a7b0eaa36e01f6bbe74df1f Mon Sep 17 00:00:00 2001 From: Yuichi Nishiwaki Date: Sat, 26 Jul 2014 14:10:17 +0900 Subject: [PATCH] publish ungensym --- docs/libs.rst | 1 + src/macro.c | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/docs/libs.rst b/docs/libs.rst index b87d7980..c0631b74 100644 --- a/docs/libs.rst +++ b/docs/libs.rst @@ -49,6 +49,7 @@ Utility functions and syntaces for macro definition. - define-macro - gensym +- ungensym - macroexpand - macroexpand-1 diff --git a/src/macro.c b/src/macro.c index 14b67d9c..9979db96 100644 --- a/src/macro.c +++ b/src/macro.c @@ -577,6 +577,16 @@ pic_macro_gensym(pic_state *pic) return pic_sym_value(uniq); } +static pic_value +pic_macro_ungensym(pic_state *pic) +{ + pic_sym sym; + + pic_get_args(pic, "m", &sym); + + return pic_sym_value(pic_ungensym(pic, sym)); +} + static pic_value pic_macro_macroexpand(pic_state *pic) { @@ -652,6 +662,7 @@ pic_init_macro(pic_state *pic) { pic_deflibrary ("(picrin macro)") { pic_defun(pic, "gensym", pic_macro_gensym); + pic_defun(pic, "ungensym", pic_macro_ungensym); pic_defun(pic, "macroexpand", pic_macro_macroexpand); pic_defun(pic, "macroexpand-1", pic_macro_macroexpand_1); pic_defun(pic, "identifier?", pic_macro_identifier_p);