pic_get_args can parse '*'
This commit is contained in:
parent
c57f1bfbe1
commit
a68b470e06
19
src/vm.c
19
src/vm.c
|
@ -40,12 +40,17 @@ pic_get_args(pic_state *pic, const char *format, ...)
|
|||
break;
|
||||
case '|':
|
||||
break;
|
||||
case '*':
|
||||
break;
|
||||
}
|
||||
|
||||
/* in order to run out of all arguments passed to this function
|
||||
(i.e. do va_arg for each argument), optional argument existence
|
||||
check is done in every case closure */
|
||||
|
||||
if (c == '*')
|
||||
break;
|
||||
|
||||
switch (c) {
|
||||
case '|':
|
||||
opt = true;
|
||||
|
@ -240,7 +245,19 @@ pic_get_args(pic_state *pic, const char *format, ...)
|
|||
}
|
||||
}
|
||||
}
|
||||
if (argc > i) {
|
||||
if ('*' == c) {
|
||||
int *n;
|
||||
pic_value **argv;
|
||||
|
||||
n = va_arg(ap, int *);
|
||||
argv = va_arg(ap, pic_value **);
|
||||
if (i <= argc) {
|
||||
*n = argc - i;
|
||||
*argv = &GET_OPERAND(pic, i);
|
||||
i = argc;
|
||||
}
|
||||
}
|
||||
else if (argc > i) {
|
||||
pic_error(pic, "wrong number of arguments");
|
||||
}
|
||||
va_end(ap);
|
||||
|
|
Loading…
Reference in New Issue