struct pic_cont -> struct cont
This commit is contained in:
parent
b3e9794385
commit
e93536bf9a
|
@ -5,7 +5,7 @@
|
||||||
struct fullcont {
|
struct fullcont {
|
||||||
jmp_buf jmp;
|
jmp_buf jmp;
|
||||||
|
|
||||||
struct pic_cont *prev_jmp;
|
struct cont *prev_jmp;
|
||||||
|
|
||||||
struct checkpoint *cp;
|
struct checkpoint *cp;
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
#include "picrin/private/object.h"
|
#include "picrin/private/object.h"
|
||||||
#include "picrin/private/state.h"
|
#include "picrin/private/state.h"
|
||||||
|
|
||||||
struct pic_cont {
|
struct cont {
|
||||||
PIC_JMPBUF *jmp;
|
PIC_JMPBUF *jmp;
|
||||||
|
|
||||||
int id;
|
int id;
|
||||||
|
@ -20,13 +20,13 @@ struct pic_cont {
|
||||||
int retc;
|
int retc;
|
||||||
pic_value *retv;
|
pic_value *retv;
|
||||||
|
|
||||||
struct pic_cont *prev;
|
struct cont *prev;
|
||||||
};
|
};
|
||||||
|
|
||||||
static const pic_data_type cont_type = { "pic_cont", NULL, NULL };
|
static const pic_data_type cont_type = { "cont", NULL, NULL };
|
||||||
|
|
||||||
void
|
void
|
||||||
pic_save_point(pic_state *pic, struct pic_cont *cont, PIC_JMPBUF *jmp)
|
pic_save_point(pic_state *pic, struct cont *cont, PIC_JMPBUF *jmp)
|
||||||
{
|
{
|
||||||
cont->jmp = jmp;
|
cont->jmp = jmp;
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ pic_save_point(pic_state *pic, struct pic_cont *cont, PIC_JMPBUF *jmp)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
pic_load_point(pic_state *pic, struct pic_cont *cont)
|
pic_load_point(pic_state *pic, struct cont *cont)
|
||||||
{
|
{
|
||||||
pic_wind(pic, pic->cp, cont->cp);
|
pic_wind(pic, pic->cp, cont->cp);
|
||||||
|
|
||||||
|
@ -110,7 +110,7 @@ cont_call(pic_state *pic)
|
||||||
int argc;
|
int argc;
|
||||||
pic_value *argv;
|
pic_value *argv;
|
||||||
int id;
|
int id;
|
||||||
struct pic_cont *cc, *cont;
|
struct cont *cc, *cont;
|
||||||
|
|
||||||
pic_get_args(pic, "*", &argc, &argv);
|
pic_get_args(pic, "*", &argc, &argv);
|
||||||
|
|
||||||
|
@ -139,22 +139,22 @@ cont_call(pic_state *pic)
|
||||||
}
|
}
|
||||||
|
|
||||||
pic_value
|
pic_value
|
||||||
pic_make_cont(pic_state *pic, struct pic_cont *cont)
|
pic_make_cont(pic_state *pic, struct cont *cont)
|
||||||
{
|
{
|
||||||
return pic_lambda(pic, cont_call, 1, pic_data_value(pic, cont, &cont_type));
|
return pic_lambda(pic, cont_call, 1, pic_data_value(pic, cont, &cont_type));
|
||||||
}
|
}
|
||||||
|
|
||||||
struct pic_cont *
|
struct cont *
|
||||||
pic_alloca_cont(pic_state *pic)
|
pic_alloca_cont(pic_state *pic)
|
||||||
{
|
{
|
||||||
return pic_alloca(pic, sizeof(struct pic_cont));
|
return pic_alloca(pic, sizeof(struct cont));
|
||||||
}
|
}
|
||||||
|
|
||||||
static pic_value
|
static pic_value
|
||||||
pic_callcc(pic_state *pic, pic_value proc)
|
pic_callcc(pic_state *pic, pic_value proc)
|
||||||
{
|
{
|
||||||
PIC_JMPBUF jmp;
|
PIC_JMPBUF jmp;
|
||||||
struct pic_cont *cont = pic_alloca_cont(pic);
|
struct cont *cont = pic_alloca_cont(pic);
|
||||||
|
|
||||||
if (PIC_SETJMP(pic, jmp)) {
|
if (PIC_SETJMP(pic, jmp)) {
|
||||||
return pic_valuesk(pic, cont->retc, cont->retv);
|
return pic_valuesk(pic, cont->retc, cont->retv);
|
||||||
|
|
|
@ -69,7 +69,7 @@ dynamic_set(pic_state *pic)
|
||||||
pic_value
|
pic_value
|
||||||
pic_start_try(pic_state *pic, PIC_JMPBUF *jmp)
|
pic_start_try(pic_state *pic, PIC_JMPBUF *jmp)
|
||||||
{
|
{
|
||||||
struct pic_cont *cont;
|
struct cont *cont;
|
||||||
pic_value handler;
|
pic_value handler;
|
||||||
pic_value var, old_val, new_val;
|
pic_value var, old_val, new_val;
|
||||||
pic_value in, out;
|
pic_value in, out;
|
||||||
|
|
|
@ -188,9 +188,9 @@ void pic_rope_decref(pic_state *, struct rope *);
|
||||||
#define pic_func_p(pic, proc) (pic_type(pic, proc) == PIC_TYPE_FUNC)
|
#define pic_func_p(pic, proc) (pic_type(pic, proc) == PIC_TYPE_FUNC)
|
||||||
#define pic_irep_p(pic, proc) (pic_type(pic, proc) == PIC_TYPE_IREP)
|
#define pic_irep_p(pic, proc) (pic_type(pic, proc) == PIC_TYPE_IREP)
|
||||||
|
|
||||||
struct pic_cont *pic_alloca_cont(pic_state *);
|
struct cont *pic_alloca_cont(pic_state *);
|
||||||
pic_value pic_make_cont(pic_state *, struct pic_cont *);
|
pic_value pic_make_cont(pic_state *, struct cont *);
|
||||||
void pic_save_point(pic_state *, struct pic_cont *, PIC_JMPBUF *);
|
void pic_save_point(pic_state *, struct cont *, PIC_JMPBUF *);
|
||||||
void pic_exit_point(pic_state *);
|
void pic_exit_point(pic_state *);
|
||||||
void pic_wind(pic_state *, struct checkpoint *, struct checkpoint *);
|
void pic_wind(pic_state *, struct checkpoint *, struct checkpoint *);
|
||||||
pic_value pic_dynamic_wind(pic_state *, pic_value in, pic_value thunk, pic_value out);
|
pic_value pic_dynamic_wind(pic_state *, pic_value in, pic_value thunk, pic_value out);
|
||||||
|
|
|
@ -40,7 +40,7 @@ struct pic_state {
|
||||||
void *userdata;
|
void *userdata;
|
||||||
|
|
||||||
struct checkpoint *cp;
|
struct checkpoint *cp;
|
||||||
struct pic_cont *cc;
|
struct cont *cc;
|
||||||
int ccnt;
|
int ccnt;
|
||||||
|
|
||||||
pic_value *sp;
|
pic_value *sp;
|
||||||
|
|
Loading…
Reference in New Issue