flatten library hierarchy

This commit is contained in:
Yuichi Nishiwaki 2014-09-01 11:37:52 +09:00
parent a3a8b11d4b
commit fb28cd003e
12 changed files with 74 additions and 100 deletions

2
dict.c
View File

@ -157,7 +157,6 @@ pic_dict_dict_for_each(pic_state *pic)
void void
pic_init_dict(pic_state *pic) pic_init_dict(pic_state *pic)
{ {
pic_deflibrary (pic, "(picrin dictionary)") {
pic_defun(pic, "make-dictionary", pic_dict_dict); pic_defun(pic, "make-dictionary", pic_dict_dict);
pic_defun(pic, "dictionary?", pic_dict_dict_p); pic_defun(pic, "dictionary?", pic_dict_dict_p);
pic_defun(pic, "dictionary-ref", pic_dict_dict_ref); pic_defun(pic, "dictionary-ref", pic_dict_dict_ref);
@ -165,5 +164,4 @@ pic_init_dict(pic_state *pic)
pic_defun(pic, "dictionary-delete", pic_dict_dict_del); pic_defun(pic, "dictionary-delete", pic_dict_dict_del);
pic_defun(pic, "dictionary-size", pic_dict_dict_size); pic_defun(pic, "dictionary-size", pic_dict_dict_size);
pic_defun(pic, "dictionary-for-each", pic_dict_dict_for_each); pic_defun(pic, "dictionary-for-each", pic_dict_dict_for_each);
}
} }

4
init.c
View File

@ -38,7 +38,7 @@ pic_init_core(pic_state *pic)
pic_init_reader(pic); pic_init_reader(pic);
pic_deflibrary (pic, "(picrin base core)") { pic_deflibrary (pic, "(picrin base)") {
pic_define_syntactic_keyword(pic, pic->lib->env, pic->sDEFINE, pic->rDEFINE); pic_define_syntactic_keyword(pic, pic->lib->env, pic->sDEFINE, pic->rDEFINE);
pic_define_syntactic_keyword(pic, pic->lib->env, pic->sSETBANG, pic->rSETBANG); pic_define_syntactic_keyword(pic, pic->lib->env, pic->sSETBANG, pic->rSETBANG);
pic_define_syntactic_keyword(pic, pic->lib->env, pic->sQUOTE, pic->rQUOTE); pic_define_syntactic_keyword(pic, pic->lib->env, pic->sQUOTE, pic->rQUOTE);
@ -46,9 +46,7 @@ pic_init_core(pic_state *pic)
pic_define_syntactic_keyword(pic, pic->lib->env, pic->sIF, pic->rIF); pic_define_syntactic_keyword(pic, pic->lib->env, pic->sIF, pic->rIF);
pic_define_syntactic_keyword(pic, pic->lib->env, pic->sBEGIN, pic->rBEGIN); pic_define_syntactic_keyword(pic, pic->lib->env, pic->sBEGIN, pic->rBEGIN);
pic_define_syntactic_keyword(pic, pic->lib->env, pic->sDEFINE_SYNTAX, pic->rDEFINE_SYNTAX); pic_define_syntactic_keyword(pic, pic->lib->env, pic->sDEFINE_SYNTAX, pic->rDEFINE_SYNTAX);
}
pic_deflibrary (pic, "(scheme base)") {
pic_init_bool(pic); DONE; pic_init_bool(pic); DONE;
pic_init_pair(pic); DONE; pic_init_pair(pic); DONE;
pic_init_port(pic); DONE; pic_init_port(pic); DONE;

View File

@ -430,8 +430,6 @@ pic_macro_make_identifier(pic_state *pic)
void void
pic_init_macro(pic_state *pic) pic_init_macro(pic_state *pic)
{ {
pic_deflibrary (pic, "(picrin base macro)") {
pic_defun(pic, "identifier?", pic_macro_identifier_p); pic_defun(pic, "identifier?", pic_macro_identifier_p);
pic_defun(pic, "make-identifier", pic_macro_make_identifier); pic_defun(pic, "make-identifier", pic_macro_make_identifier);
}
} }

View File

@ -922,10 +922,10 @@ pic_init_number(pic_state *pic)
pic_defun(pic, "string->number", pic_number_string_to_number); pic_defun(pic, "string->number", pic_number_string_to_number);
pic_gc_arena_restore(pic, ai); pic_gc_arena_restore(pic, ai);
pic_deflibrary (pic, "(scheme inexact)") {
pic_defun(pic, "finite?", pic_number_finite_p); pic_defun(pic, "finite?", pic_number_finite_p);
pic_defun(pic, "infinite?", pic_number_infinite_p); pic_defun(pic, "infinite?", pic_number_infinite_p);
pic_defun(pic, "nan?", pic_number_nan_p); pic_defun(pic, "nan?", pic_number_nan_p);
pic_gc_arena_restore(pic, ai);
pic_defun(pic, "exp", pic_number_exp); pic_defun(pic, "exp", pic_number_exp);
pic_defun(pic, "log", pic_number_log); pic_defun(pic, "log", pic_number_log);
@ -935,7 +935,7 @@ pic_init_number(pic_state *pic)
pic_defun(pic, "acos", pic_number_acos); pic_defun(pic, "acos", pic_number_acos);
pic_defun(pic, "asin", pic_number_asin); pic_defun(pic, "asin", pic_number_asin);
pic_defun(pic, "atan", pic_number_atan); pic_defun(pic, "atan", pic_number_atan);
pic_gc_arena_restore(pic, ai);
pic_defun(pic, "sqrt", pic_number_sqrt); pic_defun(pic, "sqrt", pic_number_sqrt);
}
} }

4
pair.c
View File

@ -732,7 +732,6 @@ pic_pair_assoc(pic_state *pic)
void void
pic_init_pair(pic_state *pic) pic_init_pair(pic_state *pic)
{ {
pic_deflibrary (pic, "(picrin base list)") {
pic_defun(pic, "pair?", pic_pair_pair_p); pic_defun(pic, "pair?", pic_pair_pair_p);
pic_defun(pic, "cons", pic_pair_cons); pic_defun(pic, "cons", pic_pair_cons);
pic_defun(pic, "car", pic_pair_car); pic_defun(pic, "car", pic_pair_car);
@ -740,9 +739,7 @@ pic_init_pair(pic_state *pic)
pic_defun(pic, "set-car!", pic_pair_set_car); pic_defun(pic, "set-car!", pic_pair_set_car);
pic_defun(pic, "set-cdr!", pic_pair_set_cdr); pic_defun(pic, "set-cdr!", pic_pair_set_cdr);
pic_defun(pic, "null?", pic_pair_null_p); pic_defun(pic, "null?", pic_pair_null_p);
}
pic_deflibrary (pic, "(picrin list)") {
pic_defun(pic, "caar", pic_pair_caar); pic_defun(pic, "caar", pic_pair_caar);
pic_defun(pic, "cadr", pic_pair_cadr); pic_defun(pic, "cadr", pic_pair_cadr);
pic_defun(pic, "cdar", pic_pair_cdar); pic_defun(pic, "cdar", pic_pair_cdar);
@ -763,5 +760,4 @@ pic_init_pair(pic_state *pic)
pic_defun(pic, "assq", pic_pair_assq); pic_defun(pic, "assq", pic_pair_assq);
pic_defun(pic, "assv", pic_pair_assv); pic_defun(pic, "assv", pic_pair_assv);
pic_defun(pic, "assoc", pic_pair_assoc); pic_defun(pic, "assoc", pic_pair_assoc);
}
} }

2
port.c
View File

@ -696,11 +696,9 @@ pic_init_port(pic_state *pic)
STDOUT = port_new_stdport(pic, xstdout, PIC_PORT_OUT); STDOUT = port_new_stdport(pic, xstdout, PIC_PORT_OUT);
STDERR = port_new_stdport(pic, xstderr, PIC_PORT_OUT); STDERR = port_new_stdport(pic, xstderr, PIC_PORT_OUT);
pic_deflibrary (pic, "(picrin port)") {
pic_define(pic, "standard-input-port", pic_obj_value(STDIN)); pic_define(pic, "standard-input-port", pic_obj_value(STDIN));
pic_define(pic, "standard-output-port", pic_obj_value(STDOUT)); pic_define(pic, "standard-output-port", pic_obj_value(STDOUT));
pic_define(pic, "standard-error-port", pic_obj_value(STDERR)); pic_define(pic, "standard-error-port", pic_obj_value(STDERR));
}
pic_define(pic, "current-input-port", pic_obj_value(pic_var_new(pic, pic_obj_value(STDIN), NULL))); pic_define(pic, "current-input-port", pic_obj_value(pic_var_new(pic, pic_obj_value(STDIN), NULL)));
pic_define(pic, "current-output-port", pic_obj_value(pic_var_new(pic, pic_obj_value(STDOUT), NULL))); pic_define(pic, "current-output-port", pic_obj_value(pic_var_new(pic, pic_obj_value(STDOUT), NULL)));

2
proc.c
View File

@ -177,7 +177,5 @@ pic_init_proc(pic_state *pic)
pic_defun(pic, "map", pic_proc_map); pic_defun(pic, "map", pic_proc_map);
pic_defun(pic, "for-each", pic_proc_for_each); pic_defun(pic, "for-each", pic_proc_for_each);
pic_deflibrary (pic, "(picrin attribute)") {
pic_defun(pic, "attribute", pic_proc_attribute); pic_defun(pic, "attribute", pic_proc_attribute);
}
} }

2
read.c
View File

@ -970,7 +970,5 @@ pic_read_read(pic_state *pic)
void void
pic_init_read(pic_state *pic) pic_init_read(pic_state *pic)
{ {
pic_deflibrary (pic, "(scheme read)") {
pic_defun(pic, "read", pic_read_read); pic_defun(pic, "read", pic_read_read);
}
} }

View File

@ -105,11 +105,9 @@ pic_record_record_set(pic_state *pic)
void void
pic_init_record(pic_state *pic) pic_init_record(pic_state *pic)
{ {
pic_deflibrary (pic, "(picrin record)") {
pic_defun(pic, "make-record", pic_record_make_record); pic_defun(pic, "make-record", pic_record_make_record);
pic_defun(pic, "record?", pic_record_record_p); pic_defun(pic, "record?", pic_record_record_p);
pic_defun(pic, "record-type", pic_record_record_type); pic_defun(pic, "record-type", pic_record_record_type);
pic_defun(pic, "record-ref", pic_record_record_ref); pic_defun(pic, "record-ref", pic_record_record_ref);
pic_defun(pic, "record-set!", pic_record_record_set); pic_defun(pic, "record-set!", pic_record_record_set);
}
} }

View File

@ -155,13 +155,9 @@ pic_symbol_string_to_symbol(pic_state *pic)
void void
pic_init_symbol(pic_state *pic) pic_init_symbol(pic_state *pic)
{ {
pic_deflibrary (pic, "(picrin base symbol)") {
pic_defun(pic, "symbol?", pic_symbol_symbol_p); pic_defun(pic, "symbol?", pic_symbol_symbol_p);
pic_defun(pic, "symbol->string", pic_symbol_symbol_to_string); pic_defun(pic, "symbol->string", pic_symbol_symbol_to_string);
pic_defun(pic, "string->symbol", pic_symbol_string_to_symbol); pic_defun(pic, "string->symbol", pic_symbol_string_to_symbol);
}
pic_deflibrary (pic, "(picrin symbol)") {
pic_defun(pic, "symbol=?", pic_symbol_symbol_eq_p); pic_defun(pic, "symbol=?", pic_symbol_symbol_eq_p);
}
} }

2
var.c
View File

@ -124,11 +124,9 @@ pic_var_parameter_pop(pic_state *pic)
void void
pic_init_var(pic_state *pic) pic_init_var(pic_state *pic)
{ {
pic_deflibrary (pic, "(picrin parameter)") {
pic_defun(pic, "make-parameter", pic_var_make_parameter); pic_defun(pic, "make-parameter", pic_var_make_parameter);
pic_defun(pic, "parameter-ref", pic_var_parameter_ref); pic_defun(pic, "parameter-ref", pic_var_parameter_ref);
pic_defun(pic, "parameter-set!", pic_var_parameter_set); pic_defun(pic, "parameter-set!", pic_var_parameter_set);
pic_defun(pic, "parameter-push!", pic_var_parameter_push); pic_defun(pic, "parameter-push!", pic_var_parameter_push);
pic_defun(pic, "parameter-pop!", pic_var_parameter_pop); pic_defun(pic, "parameter-pop!", pic_var_parameter_pop);
}
} }

View File

@ -497,10 +497,8 @@ pic_write_display(pic_state *pic)
void void
pic_init_write(pic_state *pic) pic_init_write(pic_state *pic)
{ {
pic_deflibrary (pic, "(scheme write)") {
pic_defun(pic, "write", pic_write_write); pic_defun(pic, "write", pic_write_write);
pic_defun(pic, "write-simple", pic_write_write_simple); pic_defun(pic, "write-simple", pic_write_write_simple);
pic_defun(pic, "write-shared", pic_write_write_shared); pic_defun(pic, "write-shared", pic_write_write_shared);
pic_defun(pic, "display", pic_write_display); pic_defun(pic, "display", pic_write_display);
}
} }