picrin/contrib/20.r7rs/src/load.c

32 lines
483 B
C
Raw Normal View History

/**
* 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;
pic_get_args(pic, "z|o", &fn, &envid);
2015-07-12 19:20:07 -04:00
port = pic_open_file(pic, fn, PIC_PORT_IN | PIC_PORT_TEXT);
pic_load(pic, port);
pic_close_port(pic, port);
2015-06-09 03:34:45 -04:00
return pic_undef_value();
}
void
pic_init_load(pic_state *pic)
{
pic_deflibrary(pic, "(scheme load)");
pic_defun(pic, "load", pic_load_load);
}