remove pic_error
This commit is contained in:
parent
1b36b5d2ff
commit
33efb3e950
8
blob.c
8
blob.c
|
@ -64,7 +64,7 @@ pic_blob_bytevector(pic_state *pic)
|
|||
pic_assert_type(pic, argv[i], int);
|
||||
|
||||
if (pic_int(argv[i]) < 0 || pic_int(argv[i]) > 255) {
|
||||
pic_error(pic, "byte out of range");
|
||||
pic_errorf(pic, "byte out of range");
|
||||
}
|
||||
|
||||
*data++ = pic_int(argv[i]);
|
||||
|
@ -82,7 +82,7 @@ pic_blob_make_bytevector(pic_state *pic)
|
|||
pic_get_args(pic, "i|i", &k, &b);
|
||||
|
||||
if (b < 0 || b > 255)
|
||||
pic_error(pic, "byte out of range");
|
||||
pic_errorf(pic, "byte out of range");
|
||||
|
||||
blob = pic_make_blob(pic, k);
|
||||
for (i = 0; i < k; ++i) {
|
||||
|
@ -122,7 +122,7 @@ pic_blob_bytevector_u8_set(pic_state *pic)
|
|||
pic_get_args(pic, "bii", &bv, &k, &v);
|
||||
|
||||
if (v < 0 || v > 255)
|
||||
pic_error(pic, "byte out of range");
|
||||
pic_errorf(pic, "byte out of range");
|
||||
|
||||
bv->data[k] = v;
|
||||
return pic_none_value();
|
||||
|
@ -227,7 +227,7 @@ pic_blob_list_to_bytevector(pic_state *pic)
|
|||
pic_assert_type(pic, e, int);
|
||||
|
||||
if (pic_int(e) < 0 || pic_int(e) > 255)
|
||||
pic_error(pic, "byte out of range");
|
||||
pic_errorf(pic, "byte out of range");
|
||||
|
||||
*data++ = pic_int(e);
|
||||
}
|
||||
|
|
2
char.c
2
char.c
|
@ -53,7 +53,7 @@ pic_char_integer_to_char(pic_state *pic)
|
|||
if (pic_char_p(argv[i])) \
|
||||
d = pic_char(argv[i]); \
|
||||
else \
|
||||
pic_error(pic, #op ": char required"); \
|
||||
pic_errorf(pic, #op ": char required"); \
|
||||
\
|
||||
if (! (c op d)) \
|
||||
return pic_false_value(); \
|
||||
|
|
24
codegen.c
24
codegen.c
|
@ -425,7 +425,7 @@ analyze_lambda(analyze_state *state, pic_value obj)
|
|||
pic_value formals, body_exprs;
|
||||
|
||||
if (pic_length(pic, obj) < 2) {
|
||||
pic_error(pic, "syntax error");
|
||||
pic_errorf(pic, "syntax error");
|
||||
}
|
||||
|
||||
formals = pic_list_ref(pic, obj, 1);
|
||||
|
@ -450,12 +450,12 @@ analyze_define(analyze_state *state, pic_value obj)
|
|||
pic_sym sym;
|
||||
|
||||
if (pic_length(pic, obj) != 3) {
|
||||
pic_error(pic, "syntax error");
|
||||
pic_errorf(pic, "syntax error");
|
||||
}
|
||||
|
||||
var = pic_list_ref(pic, obj, 1);
|
||||
if (! pic_sym_p(var)) {
|
||||
pic_error(pic, "syntax error");
|
||||
pic_errorf(pic, "syntax error");
|
||||
} else {
|
||||
sym = pic_sym(var);
|
||||
}
|
||||
|
@ -472,7 +472,7 @@ analyze_define(analyze_state *state, pic_value obj)
|
|||
val = analyze_defer(state, pic_sym_value(sym), formals, body_exprs);
|
||||
} else {
|
||||
if (pic_length(pic, obj) != 3) {
|
||||
pic_error(pic, "syntax error");
|
||||
pic_errorf(pic, "syntax error");
|
||||
}
|
||||
val = analyze(state, pic_list_ref(pic, obj, 2), false);
|
||||
}
|
||||
|
@ -489,7 +489,7 @@ analyze_if(analyze_state *state, pic_value obj, bool tailpos)
|
|||
if_false = pic_none_value();
|
||||
switch (pic_length(pic, obj)) {
|
||||
default:
|
||||
pic_error(pic, "syntax error");
|
||||
pic_errorf(pic, "syntax error");
|
||||
break;
|
||||
case 4:
|
||||
if_false = pic_list_ref(pic, obj, 3);
|
||||
|
@ -539,12 +539,12 @@ analyze_set(analyze_state *state, pic_value obj)
|
|||
pic_value var, val;
|
||||
|
||||
if (pic_length(pic, obj) != 3) {
|
||||
pic_error(pic, "syntax error");
|
||||
pic_errorf(pic, "syntax error");
|
||||
}
|
||||
|
||||
var = pic_list_ref(pic, obj, 1);
|
||||
if (! pic_sym_p(var)) {
|
||||
pic_error(pic, "syntax error");
|
||||
pic_errorf(pic, "syntax error");
|
||||
}
|
||||
|
||||
val = pic_list_ref(pic, obj, 2);
|
||||
|
@ -561,14 +561,14 @@ analyze_quote(analyze_state *state, pic_value obj)
|
|||
pic_state *pic = state->pic;
|
||||
|
||||
if (pic_length(pic, obj) != 2) {
|
||||
pic_error(pic, "syntax error");
|
||||
pic_errorf(pic, "syntax error");
|
||||
}
|
||||
return pic_list2(pic, pic_sym_value(pic->sQUOTE), pic_list_ref(pic, obj, 1));
|
||||
}
|
||||
|
||||
#define ARGC_ASSERT_GE(n) do { \
|
||||
if (pic_length(pic, obj) < (n) + 1) { \
|
||||
pic_error(pic, "wrong number of arguments"); \
|
||||
pic_errorf(pic, "wrong number of arguments"); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
|
@ -699,7 +699,7 @@ analyze_call_with_values(analyze_state *state, pic_value obj, bool tailpos)
|
|||
pic_sym call;
|
||||
|
||||
if (pic_length(pic, obj) != 3) {
|
||||
pic_error(pic, "wrong number of arguments");
|
||||
pic_errorf(pic, "wrong number of arguments");
|
||||
}
|
||||
|
||||
if (! tailpos) {
|
||||
|
@ -714,7 +714,7 @@ analyze_call_with_values(analyze_state *state, pic_value obj, bool tailpos)
|
|||
|
||||
#define ARGC_ASSERT(n) do { \
|
||||
if (pic_length(pic, obj) != (n) + 1) { \
|
||||
pic_error(pic, "wrong number of arguments"); \
|
||||
pic_errorf(pic, "wrong number of arguments"); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
|
@ -1413,7 +1413,7 @@ codegen(codegen_state *state, pic_value obj)
|
|||
cxt->clen++;
|
||||
return;
|
||||
}
|
||||
pic_error(pic, "codegen: unknown AST type");
|
||||
pic_errorf(pic, "codegen: unknown AST type");
|
||||
}
|
||||
|
||||
static struct pic_irep *
|
||||
|
|
|
@ -209,10 +209,6 @@ pic_str *pic_get_backtrace(pic_state *);
|
|||
void pic_print_backtrace(pic_state *, struct pic_error *);
|
||||
|
||||
/* obsoleted */
|
||||
noreturn static inline void pic_error(pic_state *pic, const char *msg)
|
||||
{
|
||||
pic_errorf(pic, msg);
|
||||
}
|
||||
static inline void pic_warn(pic_state *pic, const char *msg)
|
||||
{
|
||||
pic_warnf(pic, msg);
|
||||
|
|
14
macro.c
14
macro.c
|
@ -161,7 +161,7 @@ macroexpand_lambda(pic_state *pic, pic_value expr, struct pic_senv *senv)
|
|||
pic_value a;
|
||||
|
||||
if (pic_length(pic, expr) < 2) {
|
||||
pic_error(pic, "syntax error");
|
||||
pic_errorf(pic, "syntax error");
|
||||
}
|
||||
|
||||
in = pic_make_senv(pic, senv);
|
||||
|
@ -170,7 +170,7 @@ macroexpand_lambda(pic_state *pic, pic_value expr, struct pic_senv *senv)
|
|||
pic_value v = pic_car(pic, a);
|
||||
|
||||
if (! pic_sym_p(v)) {
|
||||
pic_error(pic, "syntax error");
|
||||
pic_errorf(pic, "syntax error");
|
||||
}
|
||||
pic_add_rename(pic, in, pic_sym(v));
|
||||
}
|
||||
|
@ -178,7 +178,7 @@ macroexpand_lambda(pic_state *pic, pic_value expr, struct pic_senv *senv)
|
|||
pic_add_rename(pic, in, pic_sym(a));
|
||||
}
|
||||
else if (! pic_nil_p(a)) {
|
||||
pic_error(pic, "syntax error");
|
||||
pic_errorf(pic, "syntax error");
|
||||
}
|
||||
|
||||
formal = macroexpand_list(pic, pic_cadr(pic, expr), in);
|
||||
|
@ -203,12 +203,12 @@ macroexpand_define(pic_state *pic, pic_value expr, struct pic_senv *senv)
|
|||
}
|
||||
|
||||
if (pic_length(pic, expr) != 3) {
|
||||
pic_error(pic, "syntax error");
|
||||
pic_errorf(pic, "syntax error");
|
||||
}
|
||||
|
||||
var = pic_cadr(pic, expr);
|
||||
if (! pic_sym_p(var)) {
|
||||
pic_error(pic, "binding to non-symbol object");
|
||||
pic_errorf(pic, "binding to non-symbol object");
|
||||
}
|
||||
sym = pic_sym(var);
|
||||
if (! pic_find_rename(pic, senv, sym, &rename)) {
|
||||
|
@ -226,12 +226,12 @@ macroexpand_defsyntax(pic_state *pic, pic_value expr, struct pic_senv *senv)
|
|||
pic_sym sym, rename;
|
||||
|
||||
if (pic_length(pic, expr) != 3) {
|
||||
pic_error(pic, "syntax error");
|
||||
pic_errorf(pic, "syntax error");
|
||||
}
|
||||
|
||||
var = pic_cadr(pic, expr);
|
||||
if (! pic_sym_p(var)) {
|
||||
pic_error(pic, "binding to non-symbol object");
|
||||
pic_errorf(pic, "binding to non-symbol object");
|
||||
}
|
||||
sym = pic_sym(var);
|
||||
if (! pic_find_rename(pic, senv, sym, &rename)) {
|
||||
|
|
6
number.c
6
number.c
|
@ -179,7 +179,7 @@ pic_number_nan_p(pic_state *pic)
|
|||
else if (pic_int_p(argv[i])) \
|
||||
g = pic_int(argv[i]); \
|
||||
else \
|
||||
pic_error(pic, #op ": number required"); \
|
||||
pic_errorf(pic, #op ": number required"); \
|
||||
\
|
||||
if (! (f op g)) \
|
||||
return pic_false_value(); \
|
||||
|
@ -216,7 +216,7 @@ DEFINE_ARITH_CMP(>=, ge)
|
|||
f op##= pic_float(argv[i]); \
|
||||
} \
|
||||
else { \
|
||||
pic_error(pic, #op ": number required"); \
|
||||
pic_errorf(pic, #op ": number required"); \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
|
@ -252,7 +252,7 @@ DEFINE_ARITH_OP(*, mul, 1)
|
|||
f op##= pic_float(argv[i]); \
|
||||
} \
|
||||
else { \
|
||||
pic_error(pic, #op ": number required"); \
|
||||
pic_errorf(pic, #op ": number required"); \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
|
|
8
pair.c
8
pair.c
|
@ -51,7 +51,7 @@ pic_set_car(pic_state *pic, pic_value obj, pic_value val)
|
|||
struct pic_pair *pair;
|
||||
|
||||
if (! pic_pair_p(obj)) {
|
||||
pic_error(pic, "pair required");
|
||||
pic_errorf(pic, "pair required");
|
||||
}
|
||||
pair = pic_pair_ptr(obj);
|
||||
|
||||
|
@ -64,7 +64,7 @@ pic_set_cdr(pic_state *pic, pic_value obj, pic_value val)
|
|||
struct pic_pair *pair;
|
||||
|
||||
if (! pic_pair_p(obj)) {
|
||||
pic_error(pic, "pair required");
|
||||
pic_errorf(pic, "pair required");
|
||||
}
|
||||
pair = pic_pair_ptr(obj);
|
||||
|
||||
|
@ -520,7 +520,7 @@ pic_pair_set_car(pic_state *pic)
|
|||
pic_get_args(pic, "oo", &v, &w);
|
||||
|
||||
if (! pic_pair_p(v))
|
||||
pic_error(pic, "pair expected");
|
||||
pic_errorf(pic, "pair expected");
|
||||
|
||||
pic_pair_ptr(v)->car = w;
|
||||
return pic_none_value();
|
||||
|
@ -534,7 +534,7 @@ pic_pair_set_cdr(pic_state *pic)
|
|||
pic_get_args(pic, "oo", &v, &w);
|
||||
|
||||
if (! pic_pair_p(v))
|
||||
pic_error(pic, "pair expected");
|
||||
pic_errorf(pic, "pair expected");
|
||||
|
||||
pic_pair_ptr(v)->cdr = w;
|
||||
return pic_none_value();
|
||||
|
|
18
port.c
18
port.c
|
@ -107,7 +107,7 @@ void
|
|||
pic_close_port(pic_state *pic, struct pic_port *port)
|
||||
{
|
||||
if (xfclose(port->file) == EOF) {
|
||||
pic_error(pic, "close-port: failure");
|
||||
pic_errorf(pic, "close-port: failure");
|
||||
}
|
||||
port->status = PIC_PORT_CLOSE;
|
||||
}
|
||||
|
@ -247,25 +247,25 @@ pic_port_close_port(pic_state *pic)
|
|||
if ((port->flags & (flgs)) != (flgs)) { \
|
||||
switch (flgs) { \
|
||||
case PIC_PORT_IN: \
|
||||
pic_error(pic, caller ": expected output port"); \
|
||||
pic_errorf(pic, caller ": expected output port"); \
|
||||
case PIC_PORT_OUT: \
|
||||
pic_error(pic, caller ": expected input port"); \
|
||||
pic_errorf(pic, caller ": expected input port"); \
|
||||
case PIC_PORT_IN | PIC_PORT_TEXT: \
|
||||
pic_error(pic, caller ": expected input/textual port"); \
|
||||
pic_errorf(pic, caller ": expected input/textual port"); \
|
||||
case PIC_PORT_IN | PIC_PORT_BINARY: \
|
||||
pic_error(pic, caller ": expected input/binary port"); \
|
||||
pic_errorf(pic, caller ": expected input/binary port"); \
|
||||
case PIC_PORT_OUT | PIC_PORT_TEXT: \
|
||||
pic_error(pic, caller ": expected output/textual port"); \
|
||||
pic_errorf(pic, caller ": expected output/textual port"); \
|
||||
case PIC_PORT_OUT | PIC_PORT_BINARY: \
|
||||
pic_error(pic, caller ": expected output/binary port"); \
|
||||
pic_errorf(pic, caller ": expected output/binary port"); \
|
||||
} \
|
||||
} \
|
||||
if (port->status != stat) { \
|
||||
switch (stat) { \
|
||||
case PIC_PORT_OPEN: \
|
||||
pic_error(pic, caller ": expected open port"); \
|
||||
pic_errorf(pic, caller ": expected open port"); \
|
||||
case PIC_PORT_CLOSE: \
|
||||
pic_error(pic, caller ": expected close port"); \
|
||||
pic_errorf(pic, caller ": expected close port"); \
|
||||
} \
|
||||
} \
|
||||
} while (0)
|
||||
|
|
2
proc.c
2
proc.c
|
@ -91,7 +91,7 @@ pic_proc_apply(pic_state *pic)
|
|||
pic_get_args(pic, "l*", &proc, &argc, &args);
|
||||
|
||||
if (argc == 0) {
|
||||
pic_error(pic, "apply: wrong number of arguments");
|
||||
pic_errorf(pic, "apply: wrong number of arguments");
|
||||
}
|
||||
|
||||
arg_list = args[--argc];
|
||||
|
|
2
string.c
2
string.c
|
@ -404,7 +404,7 @@ pic_str_string_append(pic_state *pic)
|
|||
str = pic_make_str(pic, NULL, 0);
|
||||
for (i = 0; i < argc; ++i) {
|
||||
if (! pic_str_p(argv[i])) {
|
||||
pic_error(pic, "type error");
|
||||
pic_errorf(pic, "type error");
|
||||
}
|
||||
str = pic_strcat(pic, str, pic_str_ptr(argv[i]));
|
||||
}
|
||||
|
|
4
symbol.c
4
symbol.c
|
@ -132,7 +132,7 @@ pic_symbol_symbol_to_string(pic_state *pic)
|
|||
pic_get_args(pic, "o", &v);
|
||||
|
||||
if (! pic_sym_p(v)) {
|
||||
pic_error(pic, "symbol->string: expected symbol");
|
||||
pic_errorf(pic, "symbol->string: expected symbol");
|
||||
}
|
||||
|
||||
return pic_obj_value(pic_make_str_cstr(pic, pic_symbol_name(pic, pic_sym(v))));
|
||||
|
@ -146,7 +146,7 @@ pic_symbol_string_to_symbol(pic_state *pic)
|
|||
pic_get_args(pic, "o", &v);
|
||||
|
||||
if (! pic_str_p(v)) {
|
||||
pic_error(pic, "string->symbol: expected string");
|
||||
pic_errorf(pic, "string->symbol: expected string");
|
||||
}
|
||||
|
||||
return pic_symbol_value(pic_intern_cstr(pic, pic_str_cstr(pic_str_ptr(v))));
|
||||
|
|
4
vector.c
4
vector.c
|
@ -105,7 +105,7 @@ pic_vec_vector_ref(pic_state *pic)
|
|||
pic_get_args(pic, "vi", &v, &k);
|
||||
|
||||
if (k < 0 || v->len <= (size_t)k) {
|
||||
pic_error(pic, "vector-ref: index out of range");
|
||||
pic_errorf(pic, "vector-ref: index out of range");
|
||||
}
|
||||
return v->data[k];
|
||||
}
|
||||
|
@ -120,7 +120,7 @@ pic_vec_vector_set(pic_state *pic)
|
|||
pic_get_args(pic, "vio", &v, &k, &o);
|
||||
|
||||
if (k < 0 || v->len <= (size_t)k) {
|
||||
pic_error(pic, "vector-set!: index out of range");
|
||||
pic_errorf(pic, "vector-set!: index out of range");
|
||||
}
|
||||
v->data[k] = o;
|
||||
return pic_none_value();
|
||||
|
|
24
vm.c
24
vm.c
|
@ -29,7 +29,7 @@ pic_get_proc(pic_state *pic)
|
|||
pic_value v = GET_OPERAND(pic,0);
|
||||
|
||||
if (! pic_proc_p(v)) {
|
||||
pic_error(pic, "fatal error");
|
||||
pic_errorf(pic, "fatal error");
|
||||
}
|
||||
return pic_proc_ptr(v);
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ pic_get_args(pic_state *pic, const char *format, ...)
|
|||
switch (c) {
|
||||
default:
|
||||
if (argc <= i && ! opt) {
|
||||
pic_error(pic, "wrong number of arguments");
|
||||
pic_errorf(pic, "wrong number of arguments");
|
||||
}
|
||||
break;
|
||||
case '|':
|
||||
|
@ -375,7 +375,7 @@ pic_get_args(pic_state *pic, const char *format, ...)
|
|||
*e = pic_error_ptr(v);
|
||||
}
|
||||
else {
|
||||
pic_error(pic, "pic_get_args, expected error");
|
||||
pic_errorf(pic, "pic_get_args, expected error");
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
@ -398,7 +398,7 @@ pic_get_args(pic_state *pic, const char *format, ...)
|
|||
}
|
||||
}
|
||||
else if (argc > i) {
|
||||
pic_error(pic, "wrong number of arguments");
|
||||
pic_errorf(pic, "wrong number of arguments");
|
||||
}
|
||||
va_end(ap);
|
||||
return i - 1;
|
||||
|
@ -675,7 +675,7 @@ pic_apply(pic_state *pic, struct pic_proc *proc, pic_value argv)
|
|||
#endif
|
||||
|
||||
if (! pic_list_p(argv)) {
|
||||
pic_error(pic, "argv must be a proper list");
|
||||
pic_errorf(pic, "argv must be a proper list");
|
||||
}
|
||||
|
||||
argc = pic_length(pic, argv) + 1;
|
||||
|
@ -728,11 +728,11 @@ pic_apply(pic_state *pic, struct pic_proc *proc, pic_value argv)
|
|||
|
||||
self = pic->ci->fp[0];
|
||||
if (! pic_proc_p(self)) {
|
||||
pic_error(pic, "logic flaw");
|
||||
pic_errorf(pic, "logic flaw");
|
||||
}
|
||||
irep = pic_proc_ptr(self)->u.irep;
|
||||
if (! pic_proc_irep_p(pic_proc_ptr(self))) {
|
||||
pic_error(pic, "logic flaw");
|
||||
pic_errorf(pic, "logic flaw");
|
||||
}
|
||||
PUSH(irep->pool[c.u.i]);
|
||||
NEXT;
|
||||
|
@ -950,11 +950,11 @@ pic_apply(pic_state *pic, struct pic_proc *proc, pic_value argv)
|
|||
|
||||
self = pic->ci->fp[0];
|
||||
if (! pic_proc_p(self)) {
|
||||
pic_error(pic, "logic flaw");
|
||||
pic_errorf(pic, "logic flaw");
|
||||
}
|
||||
irep = pic_proc_ptr(self)->u.irep;
|
||||
if (! pic_proc_irep_p(pic_proc_ptr(self))) {
|
||||
pic_error(pic, "logic flaw");
|
||||
pic_errorf(pic, "logic flaw");
|
||||
}
|
||||
|
||||
if (pic->ci->env == NULL) {
|
||||
|
@ -1017,7 +1017,7 @@ pic_apply(pic_state *pic, struct pic_proc *proc, pic_value argv)
|
|||
PUSH(pic_float_value(pic_float(a) op pic_int(b))); \
|
||||
} \
|
||||
else { \
|
||||
pic_error(pic, #op " got non-number operands"); \
|
||||
pic_errorf(pic, #op " got non-number operands"); \
|
||||
} \
|
||||
NEXT; \
|
||||
}
|
||||
|
@ -1037,7 +1037,7 @@ pic_apply(pic_state *pic, struct pic_proc *proc, pic_value argv)
|
|||
PUSH(pic_float_value(-pic_float(n)));
|
||||
}
|
||||
else {
|
||||
pic_error(pic, "unary - got a non-number operand");
|
||||
pic_errorf(pic, "unary - got a non-number operand");
|
||||
}
|
||||
NEXT;
|
||||
}
|
||||
|
@ -1060,7 +1060,7 @@ pic_apply(pic_state *pic, struct pic_proc *proc, pic_value argv)
|
|||
PUSH(pic_bool_value(pic_float(a) op pic_int(b))); \
|
||||
} \
|
||||
else { \
|
||||
pic_error(pic, #op " got non-number operands"); \
|
||||
pic_errorf(pic, #op " got non-number operands"); \
|
||||
} \
|
||||
NEXT; \
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue