change deflibrary API
This commit is contained in:
parent
13e1d7a487
commit
e680b4a6bb
|
@ -182,7 +182,7 @@ pic_regexp_regexp_replace(pic_state *pic)
|
|||
void
|
||||
pic_init_regexp(pic_state *pic)
|
||||
{
|
||||
pic_deflibrary ("(picrin regexp)") {
|
||||
pic_deflibrary (pic, "(picrin regexp)") {
|
||||
pic_defun(pic, "regexp", pic_regexp_regexp);
|
||||
pic_defun(pic, "regexp?", pic_regexp_regexp_p);
|
||||
pic_defun(pic, "regexp-match", pic_regexp_regexp_match);
|
||||
|
|
|
@ -183,9 +183,9 @@ void pic_in_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);
|
||||
|
||||
#define pic_deflibrary(spec) \
|
||||
pic_deflibrary_helper__(GENSYM(i), GENSYM(prev_lib), spec)
|
||||
#define pic_deflibrary_helper__(i, prev_lib, spec) \
|
||||
#define pic_deflibrary(pic, spec) \
|
||||
pic_deflibrary_helper__(pic, GENSYM(i), GENSYM(prev_lib), spec)
|
||||
#define pic_deflibrary_helper__(pic, i, prev_lib, spec) \
|
||||
for (int i = 0; ! i; ) \
|
||||
for (struct pic_lib *prev_lib; ! i; ) \
|
||||
for ((prev_lib = pic->lib), pic_make_library(pic, pic_read_cstr(pic, spec)), pic_in_library(pic, pic_read_cstr(pic, spec)); ! i++; pic->lib = prev_lib)
|
||||
|
|
|
@ -163,7 +163,7 @@ pic_dict_dict_for_each(pic_state *pic)
|
|||
void
|
||||
pic_init_dict(pic_state *pic)
|
||||
{
|
||||
pic_deflibrary ("(picrin dictionary)") {
|
||||
pic_deflibrary (pic, "(picrin dictionary)") {
|
||||
pic_defun(pic, "make-dictionary", pic_dict_dict);
|
||||
pic_defun(pic, "dictionary?", pic_dict_dict_p);
|
||||
pic_defun(pic, "dictionary-has?", pic_dict_dict_has_p);
|
||||
|
|
|
@ -33,7 +33,7 @@ pic_eval_eval(pic_state *pic)
|
|||
void
|
||||
pic_init_eval(pic_state *pic)
|
||||
{
|
||||
pic_deflibrary ("(scheme eval)") {
|
||||
pic_deflibrary (pic, "(scheme eval)") {
|
||||
pic_defun(pic, "eval", pic_eval_eval);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -101,7 +101,7 @@ pic_file_delete(pic_state *pic)
|
|||
void
|
||||
pic_init_file(pic_state *pic)
|
||||
{
|
||||
pic_deflibrary ("(scheme file)") {
|
||||
pic_deflibrary (pic, "(scheme file)") {
|
||||
pic_defun(pic, "open-input-file", pic_file_open_input_file);
|
||||
pic_defun(pic, "open-input-binary-file", pic_file_open_input_binary_file);
|
||||
pic_defun(pic, "open-output-file", pic_file_open_output_file);
|
||||
|
|
|
@ -60,7 +60,7 @@ pic_init_core(pic_state *pic)
|
|||
{
|
||||
size_t ai = pic_gc_arena_preserve(pic);
|
||||
|
||||
pic_deflibrary ("(scheme base)") {
|
||||
pic_deflibrary (pic, "(scheme base)") {
|
||||
|
||||
/* load core syntaces */
|
||||
pic->lib->env = pic_null_syntactic_environment(pic);
|
||||
|
|
|
@ -81,7 +81,7 @@ pic_load_load(pic_state *pic)
|
|||
void
|
||||
pic_init_load(pic_state *pic)
|
||||
{
|
||||
pic_deflibrary ("(scheme load)") {
|
||||
pic_deflibrary (pic, "(scheme load)") {
|
||||
pic_defun(pic, "load", pic_load_load);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -612,7 +612,7 @@ pic_macro_make_identifier(pic_state *pic)
|
|||
void
|
||||
pic_init_macro(pic_state *pic)
|
||||
{
|
||||
pic_deflibrary ("(picrin macro)") {
|
||||
pic_deflibrary (pic, "(picrin macro)") {
|
||||
pic_defun(pic, "gensym", pic_macro_gensym);
|
||||
pic_defun(pic, "ungensym", pic_macro_ungensym);
|
||||
pic_defun(pic, "macroexpand", pic_macro_macroexpand);
|
||||
|
|
|
@ -866,7 +866,7 @@ pic_init_number(pic_state *pic)
|
|||
pic_defun(pic, "string->number", pic_number_string_to_number);
|
||||
pic_gc_arena_restore(pic, ai);
|
||||
|
||||
pic_deflibrary ("(scheme inexact)") {
|
||||
pic_deflibrary (pic, "(scheme inexact)") {
|
||||
pic_defun(pic, "finite?", pic_number_finite_p);
|
||||
pic_defun(pic, "infinite?", pic_number_infinite_p);
|
||||
pic_defun(pic, "nan?", pic_number_nan_p);
|
||||
|
|
|
@ -695,7 +695,7 @@ pic_init_port(pic_state *pic)
|
|||
STDOUT = port_new_stdport(pic, xstdout, PIC_PORT_OUT);
|
||||
STDERR = port_new_stdport(pic, xstderr, PIC_PORT_OUT);
|
||||
|
||||
pic_deflibrary ("(picrin port)") {
|
||||
pic_deflibrary (pic, "(picrin port)") {
|
||||
pic_define(pic, "standard-input-port", pic_obj_value(STDIN));
|
||||
pic_define(pic, "standard-output-port", pic_obj_value(STDOUT));
|
||||
pic_define(pic, "standard-error-port", pic_obj_value(STDERR));
|
||||
|
|
|
@ -177,7 +177,7 @@ pic_init_proc(pic_state *pic)
|
|||
pic_defun(pic, "map", pic_proc_map);
|
||||
pic_defun(pic, "for-each", pic_proc_for_each);
|
||||
|
||||
pic_deflibrary ("(picrin attribute)") {
|
||||
pic_deflibrary (pic, "(picrin attribute)") {
|
||||
pic_defun(pic, "attribute", pic_proc_attribute);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -799,7 +799,7 @@ pic_read_read(pic_state *pic)
|
|||
void
|
||||
pic_init_read(pic_state *pic)
|
||||
{
|
||||
pic_deflibrary ("(scheme read)") {
|
||||
pic_deflibrary (pic, "(scheme read)") {
|
||||
pic_defun(pic, "read", pic_read_read);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -126,7 +126,7 @@ pic_system_getenvs(pic_state *pic)
|
|||
void
|
||||
pic_init_system(pic_state *pic)
|
||||
{
|
||||
pic_deflibrary ("(scheme process-context)") {
|
||||
pic_deflibrary (pic, "(scheme process-context)") {
|
||||
pic_defun(pic, "command-line", pic_system_cmdline);
|
||||
pic_defun(pic, "exit", pic_system_exit);
|
||||
pic_defun(pic, "emergency-exit", pic_system_emergency_exit);
|
||||
|
|
|
@ -41,7 +41,7 @@ pic_jiffies_per_second(pic_state *pic)
|
|||
void
|
||||
pic_init_time(pic_state *pic)
|
||||
{
|
||||
pic_deflibrary ("(scheme time)") {
|
||||
pic_deflibrary (pic, "(scheme time)") {
|
||||
pic_defun(pic, "current-second", pic_current_second);
|
||||
pic_defun(pic, "current-jiffy", pic_current_jiffy);
|
||||
pic_defun(pic, "jiffies-per-second", pic_jiffies_per_second);
|
||||
|
|
|
@ -124,7 +124,7 @@ pic_var_parameter_pop(pic_state *pic)
|
|||
void
|
||||
pic_init_var(pic_state *pic)
|
||||
{
|
||||
pic_deflibrary ("(picrin parameter)") {
|
||||
pic_deflibrary (pic, "(picrin parameter)") {
|
||||
pic_defun(pic, "make-parameter", pic_var_make_parameter);
|
||||
pic_defun(pic, "parameter-ref", pic_var_parameter_ref);
|
||||
pic_defun(pic, "parameter-set!", pic_var_parameter_set);
|
||||
|
|
|
@ -458,7 +458,7 @@ pic_write_display(pic_state *pic)
|
|||
void
|
||||
pic_init_write(pic_state *pic)
|
||||
{
|
||||
pic_deflibrary ("(scheme write)") {
|
||||
pic_deflibrary (pic, "(scheme write)") {
|
||||
pic_defun(pic, "write", pic_write_write);
|
||||
pic_defun(pic, "write-simple", pic_write_write_simple);
|
||||
pic_defun(pic, "write-shared", pic_write_write_shared);
|
||||
|
|
Loading…
Reference in New Issue