improve pic_get_args error message
This commit is contained in:
parent
9e7b4da56c
commit
b68813823f
34
src/vm.c
34
src/vm.c
|
@ -115,7 +115,7 @@ pic_get_args(pic_state *pic, const char *format, ...)
|
||||||
*f = pic_int(v);
|
*f = pic_int(v);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
pic_error(pic, "pic_get_args: expected float or int");
|
pic_errorf(pic, "pic_get_args: expected float or int, but got ~s", v);
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
@ -141,7 +141,7 @@ pic_get_args(pic_state *pic, const char *format, ...)
|
||||||
*e = true;
|
*e = true;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
pic_error(pic, "pic_get_args: expected float or int");
|
pic_errorf(pic, "pic_get_args: expected float or int, but got ~s", v);
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
@ -167,7 +167,7 @@ pic_get_args(pic_state *pic, const char *format, ...)
|
||||||
*e = true;
|
*e = true;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
pic_error(pic, "pic_get_args: expected float or int");
|
pic_errorf(pic, "pic_get_args: expected float or int, but got ~s", v);
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
@ -189,7 +189,7 @@ pic_get_args(pic_state *pic, const char *format, ...)
|
||||||
*k = pic_int(v);
|
*k = pic_int(v);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
pic_error(pic, "pic_get_args: expected int");
|
pic_errorf(pic, "pic_get_args: expected int, but got ~s", v);
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
@ -206,23 +206,23 @@ pic_get_args(pic_state *pic, const char *format, ...)
|
||||||
*str = pic_str_ptr(v);
|
*str = pic_str_ptr(v);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
pic_error(pic, "pic_get_args: expected string");
|
pic_errorf(pic, "pic_get_args: expected string, but got ~s", v);
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'z': {
|
case 'z': {
|
||||||
pic_value str;
|
|
||||||
const char **cstr;
|
const char **cstr;
|
||||||
|
pic_value v;
|
||||||
|
|
||||||
cstr = va_arg(ap, const char **);
|
cstr = va_arg(ap, const char **);
|
||||||
if (i < argc) {
|
if (i < argc) {
|
||||||
str = GET_OPERAND(pic,i);
|
v = GET_OPERAND(pic,i);
|
||||||
if (! pic_str_p(str)) {
|
if (! pic_str_p(v)) {
|
||||||
pic_error(pic, "pic_get_args: expected string");
|
pic_errorf(pic, "pic_get_args: expected string, but got ~s", v);
|
||||||
}
|
}
|
||||||
*cstr = pic_str_cstr(pic_str_ptr(str));
|
*cstr = pic_str_cstr(pic_str_ptr(v));
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -238,7 +238,7 @@ pic_get_args(pic_state *pic, const char *format, ...)
|
||||||
*m = pic_sym(v);
|
*m = pic_sym(v);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
pic_error(pic, "pic_get_args: expected symbol");
|
pic_errorf(pic, "pic_get_args: expected symbol, but got ~s", v);
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
@ -255,7 +255,7 @@ pic_get_args(pic_state *pic, const char *format, ...)
|
||||||
*vec = pic_vec_ptr(v);
|
*vec = pic_vec_ptr(v);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
pic_error(pic, "pic_get_args: expected vector");
|
pic_errorf(pic, "pic_get_args: expected vector, but got ~s", v);
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
@ -272,7 +272,7 @@ pic_get_args(pic_state *pic, const char *format, ...)
|
||||||
*b = pic_blob_ptr(v);
|
*b = pic_blob_ptr(v);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
pic_error(pic, "pic_get_args: expected bytevector");
|
pic_errorf(pic, "pic_get_args: expected bytevector, but got ~s", v);
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
@ -289,7 +289,7 @@ pic_get_args(pic_state *pic, const char *format, ...)
|
||||||
*c = pic_char(v);
|
*c = pic_char(v);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
pic_error(pic, "pic_get_args: expected char");
|
pic_errorf(pic, "pic_get_args: expected char, but got ~s", v);
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
@ -306,7 +306,7 @@ pic_get_args(pic_state *pic, const char *format, ...)
|
||||||
*l = pic_proc_ptr(v);
|
*l = pic_proc_ptr(v);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
pic_error(pic, "pic_get_args, expected procedure");
|
pic_errorf(pic, "pic_get_args, expected procedure, but got ~s", v);
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
@ -323,7 +323,7 @@ pic_get_args(pic_state *pic, const char *format, ...)
|
||||||
*p = pic_port_ptr(v);
|
*p = pic_port_ptr(v);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
pic_error(pic, "pic_get_args, expected port");
|
pic_errorf(pic, "pic_get_args, expected port, but got ~s", v);
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
@ -340,7 +340,7 @@ pic_get_args(pic_state *pic, const char *format, ...)
|
||||||
*d = pic_dict_ptr(v);
|
*d = pic_dict_ptr(v);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
pic_error(pic, "pic_get_args, expected dictionary");
|
pic_errorf(pic, "pic_get_args, expected dictionary, but got ~s", v);
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue