2015-01-17 10:32:52 -05:00
|
|
|
/**
|
|
|
|
* See Copyright Notice in picrin.h
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "picrin.h"
|
|
|
|
|
|
|
|
static pic_value
|
|
|
|
pic_load_load(pic_state *pic)
|
|
|
|
{
|
|
|
|
pic_value envid;
|
|
|
|
char *fn;
|
2015-07-12 19:20:07 -04:00
|
|
|
struct pic_port *port;
|
2015-01-17 10:32:52 -05:00
|
|
|
|
|
|
|
pic_get_args(pic, "z|o", &fn, &envid);
|
|
|
|
|
2016-02-18 13:03:29 -05:00
|
|
|
port = pic_open_file(pic, fn, PIC_PORT_IN);
|
2015-07-12 19:20:07 -04:00
|
|
|
|
|
|
|
pic_load(pic, port);
|
|
|
|
|
|
|
|
pic_close_port(pic, port);
|
2015-01-17 10:32:52 -05:00
|
|
|
|
2016-02-18 06:15:42 -05:00
|
|
|
return pic_undef_value(pic);
|
2015-01-17 10:32:52 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
pic_init_load(pic_state *pic)
|
|
|
|
{
|
2016-02-18 03:39:32 -05:00
|
|
|
pic_deflibrary(pic, "scheme.load");
|
2016-02-14 23:20:26 -05:00
|
|
|
|
|
|
|
pic_defun(pic, "load", pic_load_load);
|
2015-01-17 10:32:52 -05:00
|
|
|
}
|