add pic_receive
This commit is contained in:
parent
19db4bb6b2
commit
116a65cdee
|
@ -54,6 +54,7 @@ pic_value pic_callcc(pic_state *, struct pic_proc *);
|
|||
pic_value pic_values(pic_state *, size_t, ...);
|
||||
pic_value pic_values_by_array(pic_state *, size_t, pic_value *);
|
||||
pic_value pic_values_by_list(pic_state *, pic_value);
|
||||
size_t pic_receive(pic_state *, size_t, pic_value *);
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
|
|
15
src/cont.c
15
src/cont.c
|
@ -218,6 +218,21 @@ pic_values_by_list(pic_state *pic, pic_value list)
|
|||
return pic_nil_p(list) ? pic_none_value() : pic->ci->fp[0];
|
||||
}
|
||||
|
||||
size_t
|
||||
pic_receive(pic_state *pic, size_t n, pic_value *argv)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
for (i = 0; ; ++i) {
|
||||
if (pic_undef_p(pic->ci->fp[i]))
|
||||
break;
|
||||
if (i < n) {
|
||||
argv[i] = pic->ci->fp[i];
|
||||
}
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
static pic_value
|
||||
pic_cont_callcc(pic_state *pic)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue