add pic_export and pic_export_as
This commit is contained in:
parent
0110370cc4
commit
01e60b5d8e
|
@ -127,6 +127,9 @@ void pic_in_library(pic_state *, pic_value);
|
||||||
struct pic_lib *pic_make_library(pic_state *, pic_value);
|
struct pic_lib *pic_make_library(pic_state *, pic_value);
|
||||||
struct pic_lib *pic_find_library(pic_state *, pic_value);
|
struct pic_lib *pic_find_library(pic_state *, pic_value);
|
||||||
|
|
||||||
|
void pic_export(pic_state *, pic_sym);
|
||||||
|
void pic_export_as(pic_state *, pic_sym, pic_sym);
|
||||||
|
|
||||||
void pic_abort(pic_state *, const char *);
|
void pic_abort(pic_state *, const char *);
|
||||||
void pic_raise(pic_state *, pic_value);
|
void pic_raise(pic_state *, pic_value);
|
||||||
void pic_error(pic_state *, const char *);
|
void pic_error(pic_state *, const char *);
|
||||||
|
|
14
src/macro.c
14
src/macro.c
|
@ -176,6 +176,18 @@ pic_identifier_p(pic_value obj)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
pic_export(pic_state *pic, pic_sym sym)
|
||||||
|
{
|
||||||
|
pic_export_as(pic, sym, sym);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
pic_export_as(pic_state *pic, pic_sym sym, pic_sym alias)
|
||||||
|
{
|
||||||
|
xh_put(pic->lib->exports, pic_symbol_name(pic, sym), (int)alias);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
pic_defsyntax(pic_state *pic, const char *name, struct pic_proc *macro, struct pic_senv *mac_env)
|
pic_defsyntax(pic_state *pic, const char *name, struct pic_proc *macro, struct pic_senv *mac_env)
|
||||||
{
|
{
|
||||||
|
@ -276,7 +288,7 @@ macroexpand(pic_state *pic, pic_value expr, struct pic_senv *senv)
|
||||||
if (pic_symbol_p(v)) {
|
if (pic_symbol_p(v)) {
|
||||||
ren = pic_sym(v);
|
ren = pic_sym(v);
|
||||||
}
|
}
|
||||||
xh_put(pic->lib->exports, pic_symbol_name(pic, orig), (int)ren);
|
pic_export_as(pic, orig, ren);
|
||||||
return pic_false_value();
|
return pic_false_value();
|
||||||
}
|
}
|
||||||
case PIC_STX_DEFSYNTAX: {
|
case PIC_STX_DEFSYNTAX: {
|
||||||
|
|
Loading…
Reference in New Issue