picrin/init.c

91 lines
2.7 KiB
C
Raw Normal View History

2014-08-25 00:38:09 -04:00
/**
* See Copyright Notice in picrin.h
*/
#include "picrin.h"
#include "picrin/pair.h"
#include "picrin/lib.h"
#include "picrin/macro.h"
#include "picrin/error.h"
2014-09-09 12:41:10 -04:00
void
pic_add_feature(pic_state *pic, const char *feature)
{
pic_push(pic, pic_sym_value(pic_intern_cstr(pic, feature)), pic->features);
}
2014-08-25 00:38:09 -04:00
void pic_init_bool(pic_state *);
void pic_init_pair(pic_state *);
void pic_init_port(pic_state *);
void pic_init_number(pic_state *);
void pic_init_time(pic_state *);
void pic_init_system(pic_state *);
void pic_init_file(pic_state *);
2014-08-25 00:38:09 -04:00
void pic_init_proc(pic_state *);
void pic_init_symbol(pic_state *);
void pic_init_vector(pic_state *);
void pic_init_blob(pic_state *);
void pic_init_cont(pic_state *);
void pic_init_char(pic_state *);
void pic_init_error(pic_state *);
void pic_init_str(pic_state *);
void pic_init_macro(pic_state *);
void pic_init_var(pic_state *);
void pic_init_load(pic_state *);
2014-08-25 00:38:09 -04:00
void pic_init_write(pic_state *);
void pic_init_read(pic_state *);
void pic_init_dict(pic_state *);
void pic_init_record(pic_state *);
void pic_init_eval(pic_state *);
2014-08-25 00:38:09 -04:00
void pic_init_lib(pic_state *);
#define DONE pic_gc_arena_restore(pic, ai);
2014-09-08 10:31:04 -04:00
extern const char pic_boot[];
2014-08-25 00:38:09 -04:00
void
pic_init_core(pic_state *pic)
{
size_t ai = pic_gc_arena_preserve(pic);
2014-09-09 12:41:10 -04:00
pic_add_feature(pic, "picrin");
pic_add_feature(pic, "ieee-float");
2014-08-31 22:37:52 -04:00
pic_deflibrary (pic, "(picrin base)") {
2014-08-25 00:38:09 -04:00
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->sQUOTE, pic->rQUOTE);
pic_define_syntactic_keyword(pic, pic->lib->env, pic->sLAMBDA, pic->rLAMBDA);
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->sDEFINE_SYNTAX, pic->rDEFINE_SYNTAX);
pic_init_bool(pic); DONE;
pic_init_pair(pic); DONE;
pic_init_port(pic); DONE;
pic_init_number(pic); DONE;
pic_init_time(pic); DONE;
pic_init_system(pic); DONE;
pic_init_file(pic); DONE;
2014-08-25 00:38:09 -04:00
pic_init_proc(pic); DONE;
pic_init_symbol(pic); DONE;
pic_init_vector(pic); DONE;
pic_init_blob(pic); DONE;
pic_init_cont(pic); DONE;
pic_init_char(pic); DONE;
pic_init_error(pic); DONE;
pic_init_str(pic); DONE;
pic_init_macro(pic); DONE;
pic_init_var(pic); DONE;
pic_init_load(pic); DONE;
2014-08-25 00:38:09 -04:00
pic_init_write(pic); DONE;
pic_init_read(pic); DONE;
pic_init_dict(pic); DONE;
pic_init_record(pic); DONE;
pic_init_eval(pic); DONE;
2014-08-25 00:38:09 -04:00
pic_init_lib(pic); DONE;
2014-09-08 10:31:04 -04:00
pic_load_cstr(pic, pic_boot);
2014-08-25 00:38:09 -04:00
}
}