2015-01-17 10:32:52 -05:00
|
|
|
/**
|
|
|
|
* See Copyright Notice in picrin.h
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "picrin.h"
|
|
|
|
|
|
|
|
void
|
|
|
|
pic_load(pic_state *pic, const char *filename)
|
|
|
|
{
|
|
|
|
struct pic_port *port;
|
|
|
|
|
2015-06-18 16:00:36 -04:00
|
|
|
port = pic_open_file(pic, filename, PIC_PORT_IN | PIC_PORT_TEXT);
|
2015-01-17 10:32:52 -05:00
|
|
|
|
|
|
|
pic_load_port(pic, port);
|
|
|
|
|
|
|
|
pic_close_port(pic, port);
|
|
|
|
}
|
|
|
|
|
|
|
|
static pic_value
|
|
|
|
pic_load_load(pic_state *pic)
|
|
|
|
{
|
|
|
|
pic_value envid;
|
|
|
|
char *fn;
|
|
|
|
|
|
|
|
pic_get_args(pic, "z|o", &fn, &envid);
|
|
|
|
|
|
|
|
pic_load(pic, fn);
|
|
|
|
|
2015-06-09 03:34:45 -04:00
|
|
|
return pic_undef_value();
|
2015-01-17 10:32:52 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
pic_init_load(pic_state *pic)
|
|
|
|
{
|
|
|
|
pic_deflibrary (pic, "(scheme load)") {
|
|
|
|
pic_defun(pic, "load", pic_load_load);
|
|
|
|
}
|
|
|
|
}
|