pic_get_args supports port object

This commit is contained in:
Yuichi Nishiwaki 2014-01-13 00:48:00 +09:00
parent 6b808354c0
commit 322021e5d5
1 changed files with 19 additions and 0 deletions

View File

@ -7,6 +7,7 @@
#include "picrin.h"
#include "picrin/pair.h"
#include "picrin/proc.h"
#include "picrin/port.h"
#include "picrin/irep.h"
#include "picrin/blob.h"
#include "picrin/var.h"
@ -276,6 +277,24 @@ pic_get_args(pic_state *pic, const char *format, ...)
}
break;
}
case 'p':
{
struct pic_port **p;
pic_value v;
p = va_arg(ap, struct pic_port **);
if (i < argc) {
v = GET_OPERAND(pic,i);
if (pic_port_p(v)) {
*p = pic_port_ptr(v);
}
else {
pic_error(pic, "pic_get_args, expected port");
}
i++;
}
break;
}
default:
{
pic_error(pic, "pic_get_args: invalid argument specifier given");