pic_load_port -> pic_load
This commit is contained in:
parent
71d1d4837d
commit
5c2cbb9e55
|
@ -4,27 +4,20 @@
|
||||||
|
|
||||||
#include "picrin.h"
|
#include "picrin.h"
|
||||||
|
|
||||||
void
|
|
||||||
pic_load(pic_state *pic, const char *filename)
|
|
||||||
{
|
|
||||||
struct pic_port *port;
|
|
||||||
|
|
||||||
port = pic_open_file(pic, filename, PIC_PORT_IN | PIC_PORT_TEXT);
|
|
||||||
|
|
||||||
pic_load_port(pic, port);
|
|
||||||
|
|
||||||
pic_close_port(pic, port);
|
|
||||||
}
|
|
||||||
|
|
||||||
static pic_value
|
static pic_value
|
||||||
pic_load_load(pic_state *pic)
|
pic_load_load(pic_state *pic)
|
||||||
{
|
{
|
||||||
pic_value envid;
|
pic_value envid;
|
||||||
char *fn;
|
char *fn;
|
||||||
|
struct pic_port *port;
|
||||||
|
|
||||||
pic_get_args(pic, "z|o", &fn, &envid);
|
pic_get_args(pic, "z|o", &fn, &envid);
|
||||||
|
|
||||||
pic_load(pic, fn);
|
port = pic_open_file(pic, fn, PIC_PORT_IN | PIC_PORT_TEXT);
|
||||||
|
|
||||||
|
pic_load(pic, port);
|
||||||
|
|
||||||
|
pic_close_port(pic, port);
|
||||||
|
|
||||||
return pic_undef_value();
|
return pic_undef_value();
|
||||||
}
|
}
|
||||||
|
|
|
@ -179,7 +179,7 @@ const char *pic_symbol_name(pic_state *, pic_sym *);
|
||||||
pic_value pic_read(pic_state *, struct pic_port *);
|
pic_value pic_read(pic_state *, struct pic_port *);
|
||||||
pic_value pic_read_cstr(pic_state *, const char *);
|
pic_value pic_read_cstr(pic_state *, const char *);
|
||||||
|
|
||||||
void pic_load_port(pic_state *, struct pic_port *);
|
void pic_load(pic_state *, struct pic_port *);
|
||||||
void pic_load_cstr(pic_state *, const char *);
|
void pic_load_cstr(pic_state *, const char *);
|
||||||
|
|
||||||
void pic_define(pic_state *, const char *, pic_value);
|
void pic_define(pic_state *, const char *, pic_value);
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
#include "picrin.h"
|
#include "picrin.h"
|
||||||
|
|
||||||
void
|
void
|
||||||
pic_load_port(pic_state *pic, struct pic_port *port)
|
pic_load(pic_state *pic, struct pic_port *port)
|
||||||
{
|
{
|
||||||
pic_value form;
|
pic_value form;
|
||||||
size_t ai = pic_gc_arena_preserve(pic);
|
size_t ai = pic_gc_arena_preserve(pic);
|
||||||
|
@ -23,7 +23,7 @@ pic_load_cstr(pic_state *pic, const char *src)
|
||||||
struct pic_port *port = pic_open_input_string(pic, src);
|
struct pic_port *port = pic_open_input_string(pic, src);
|
||||||
|
|
||||||
pic_try {
|
pic_try {
|
||||||
pic_load_port(pic, port);
|
pic_load(pic, port);
|
||||||
}
|
}
|
||||||
pic_catch {
|
pic_catch {
|
||||||
pic_close_port(pic, port);
|
pic_close_port(pic, port);
|
||||||
|
|
Loading…
Reference in New Issue