[bugfix] pic_get_args supports 'e' specifier

This commit is contained in:
Yuichi Nishiwaki 2014-06-29 17:45:25 +09:00
parent 70ace29b7c
commit 01c657ddba
1 changed files with 19 additions and 1 deletions

View File

@ -51,6 +51,7 @@ pic_get_proc(pic_state *pic)
* l lambda object * l lambda object
* p port object * p port object
* d dictionary object * d dictionary object
* e error object
* *
* | optional operator * | optional operator
* * variable length operator * * variable length operator
@ -346,8 +347,25 @@ pic_get_args(pic_state *pic, const char *format, ...)
} }
break; break;
} }
case 'e': {
struct pic_error **e;
pic_value v;
e = va_arg(ap, struct pic_error **);
if (i < argc) {
v = GET_OPERAND(pic,i);
if (pic_error_p(v)) {
*e = pic_error_ptr(v);
}
else {
pic_error(pic, "pic_get_args, expected error");
}
i++;
}
break;
}
default: default:
pic_error(pic, "pic_get_args: invalid argument specifier given"); pic_errorf(pic, "pic_get_args: invalid argument specifier '%c' given", c);
} }
} }
if ('*' == c) { if ('*' == c) {