diff --git a/src/array.c b/src/array.c index b5773e23e388da2137af562c95baf959fcb416c7..1f08c876b1817a1c2606d319018c1a33d154411e 100644 --- a/src/array.c +++ b/src/array.c @@ -19,7 +19,7 @@ #include "gc.h" #include "main.h" -RCSID("$Id: array.c,v 1.31 1998/03/28 15:40:19 grubba Exp $"); +RCSID("$Id: array.c,v 1.32 1998/04/17 05:08:00 hubbe Exp $"); struct array empty_array= { @@ -46,7 +46,7 @@ struct array *low_allocate_array(INT32 size,INT32 extra_space) if(size == 0) { - empty_array.refs++; + add_ref(&empty_array); return &empty_array; } @@ -113,7 +113,7 @@ void really_free_array(struct array *v) if(d_flag > 1) array_check_type_field(v); #endif - v->refs++; + add_ref(v); free_svalues(ITEM(v), v->size, v->type_field); v->refs--; array_free_no_free(v); @@ -147,7 +147,7 @@ void array_index(struct svalue *s,struct array *v,INT32 index) fatal("Illegal index in low level index routine.\n"); #endif - v->refs++; + add_ref(v); assign_svalue(s, ITEM(v) + index); free_array(v); } @@ -202,7 +202,7 @@ void array_set_index(struct array *v,INT32 index, struct svalue *s) fatal("Illegal index in low level array set routine.\n"); #endif - v->refs++; + add_ref(v); check_destructed(s); v->type_field = (v->type_field & ~BIT_UNFINISHED) | 1 << s->type; @@ -437,7 +437,7 @@ struct array *slice_array(struct array *v,INT32 start,INT32 end) if(start==0 && v->refs==1) /* Can we use the same array? */ { - v->refs++; + add_ref(v); return array_shrink(v,end); } @@ -1143,7 +1143,7 @@ struct array *subtract_arrays(struct array *a, struct array *b) }else{ if(a->refs == 1) { - a->refs++; + add_ref(a); return a; } return slice_array(a,0,a->size); @@ -1413,7 +1413,7 @@ struct array *copy_array_recursively(struct array *a,struct processing *p) if(p->pointer_a == (void *)a) { ret=(struct array *)p->pointer_b; - ret->refs++; + add_ref(ret); return ret; } } @@ -1568,7 +1568,7 @@ void gc_free_all_unreferenced_arrays(void) { if(gc_do_free(a)) { - a->refs++; + add_ref(a); free_svalues(ITEM(a), a->size, a->type_field); a->size=0; @@ -1625,10 +1625,10 @@ void zap_all_arrays(void) #if defined(DEBUG) && defined(DEBUG_MALLOC) if(verbose_debug_exit && a!=&empty_array) - debug_dump_array(a); + describe(a); #endif - a->refs++; + add_ref(a); free_svalues(ITEM(a), a->size, a->type_field); a->size=0; @@ -1662,7 +1662,7 @@ struct array *explode_array(struct array *a, struct array *b) q=start=0; push_array(a); /* Save us from destructive slice_arrays */ - a->refs++; + add_ref(a); if(b->size) { for(e=0;e<=a->size - b->size;e++) diff --git a/src/array.h b/src/array.h index 0d41526708380e00031af6773e2a7001519a583b..a8e9ad4e2995acf6360122280a85f9f48fa95735 100644 --- a/src/array.h +++ b/src/array.h @@ -5,7 +5,7 @@ \*/ /* - * $Id: array.h,v 1.12 1998/03/28 15:40:00 grubba Exp $ + * $Id: array.h,v 1.13 1998/04/17 05:08:00 hubbe Exp $ */ #ifndef ARRAY_H #define ARRAY_H @@ -33,7 +33,11 @@ struct array extern struct array empty_array; +#if defined(DEBUG_MALLOC) && defined(DEBUG) +#define ITEM(X) (((struct array *)(debug_malloc_pass((X))))->item) +#else #define ITEM(X) ((X)->item) +#endif /* These are arguments for the function 'merge' which merges two sorted * set stored in arrays in the way you specify diff --git a/src/builtin_functions.c b/src/builtin_functions.c index 3c973e316b958332f2dfd61e15766eb00a51e06d..b55450f28238811ca2ae6a46e978ed34404a8b96 100644 --- a/src/builtin_functions.c +++ b/src/builtin_functions.c @@ -4,7 +4,7 @@ ||| See the files COPYING and DISCLAIMER for more information. \*/ #include "global.h" -RCSID("$Id: builtin_functions.c,v 1.99 1998/04/16 21:30:08 hubbe Exp $"); +RCSID("$Id: builtin_functions.c,v 1.100 1998/04/17 05:08:01 hubbe Exp $"); #include "interpret.h" #include "svalue.h" #include "pike_macros.h" @@ -52,7 +52,7 @@ void f_equal(INT32 args) { int i; if(args != 2) - ERROR("equal", "Bad number of arguments.\n", sp, args); + PIKE_ERROR("equal", "Bad number of arguments.\n", sp, args); i=is_equal(sp-2,sp-1); pop_n_elems(args); @@ -83,18 +83,18 @@ void f_hash(INT32 args) { INT32 i; if(!args) - ERROR("hash", "Too few arguments.\n", sp, 0); + PIKE_ERROR("hash", "Too few arguments.\n", sp, 0); if(sp[-args].type != T_STRING) - ERROR("hash", "Bad argument 1.\n", sp, args); + PIKE_ERROR("hash", "Bad argument 1.\n", sp, args); i=hashstr((unsigned char *)sp[-args].u.string->str,100); if(args > 1) { if(sp[1-args].type != T_INT) - ERROR("hash", "Bad argument 2.\n", sp, args); + PIKE_ERROR("hash", "Bad argument 2.\n", sp, args); if(!sp[1-args].u.integer) - ERROR("hash", "Modulo by zero.\n", sp, args); + PIKE_ERROR("hash", "Modulo by zero.\n", sp, args); i%=(unsigned INT32)sp[1-args].u.integer; } @@ -105,7 +105,7 @@ void f_hash(INT32 args) void f_copy_value(INT32 args) { if(!args) - ERROR("copy_value", "Too few arguments.\n", sp, 0); + PIKE_ERROR("copy_value", "Too few arguments.\n", sp, 0); pop_n_elems(args-1); copy_svalues_recursively_no_free(sp,sp-1,1,0); @@ -117,9 +117,9 @@ void f_ctime(INT32 args) { time_t i; if(!args) - ERROR("ctime", "Too few arguments.\n", sp, args); + PIKE_ERROR("ctime", "Too few arguments.\n", sp, args); if(sp[-args].type != T_INT) - ERROR("ctime", "Bad argument 1.\n", sp, args); + PIKE_ERROR("ctime", "Bad argument 1.\n", sp, args); i=(time_t)sp[-args].u.integer; pop_n_elems(args); push_string(make_shared_string(ctime(&i))); @@ -130,9 +130,9 @@ void f_lower_case(INT32 args) INT32 i; struct pike_string *ret; if(!args) - ERROR("lower_case", "Too few arguments.\n", sp, 0); + PIKE_ERROR("lower_case", "Too few arguments.\n", sp, 0); if(sp[-args].type != T_STRING) - ERROR("lower_case", "Bad argument 1.\n", sp, args); + PIKE_ERROR("lower_case", "Bad argument 1.\n", sp, args); ret=begin_shared_string(sp[-args].u.string->len); MEMCPY(ret->str, sp[-args].u.string->str,sp[-args].u.string->len); @@ -150,9 +150,9 @@ void f_upper_case(INT32 args) INT32 i; struct pike_string *ret; if(!args) - ERROR("upper_case", "Too few arguments.\n", sp, 0); + PIKE_ERROR("upper_case", "Too few arguments.\n", sp, 0); if(sp[-args].type != T_STRING) - ERROR("upper_case", "Bad argument 1.\n", sp, args); + PIKE_ERROR("upper_case", "Bad argument 1.\n", sp, args); ret=begin_shared_string(sp[-args].u.string->len); MEMCPY(ret->str, sp[-args].u.string->str,sp[-args].u.string->len); @@ -168,9 +168,9 @@ void f_upper_case(INT32 args) void f_random(INT32 args) { if(!args) - ERROR("random", "Too few arguments.\n", sp, 0); + PIKE_ERROR("random", "Too few arguments.\n", sp, 0); if(sp[-args].type != T_INT) - ERROR("random", "Bad argument 1.\n", sp, args); + PIKE_ERROR("random", "Bad argument 1.\n", sp, args); if(sp[-args].u.integer <= 0) { @@ -184,9 +184,9 @@ void f_random(INT32 args) void f_random_seed(INT32 args) { if(!args) - ERROR("random_seed", "Too few arguments.\n", sp, 0); + PIKE_ERROR("random_seed", "Too few arguments.\n", sp, 0); if(sp[-args].type != T_INT) - ERROR("random_seed", "Bad argument 1.\n", sp, args); + PIKE_ERROR("random_seed", "Bad argument 1.\n", sp, args); my_srand(sp[-args].u.integer); pop_n_elems(args); @@ -203,7 +203,7 @@ void f_search(INT32 args) INT32 start; if(args < 2) - ERROR("search", "Too few arguments.\n", sp, args); + PIKE_ERROR("search", "Too few arguments.\n", sp, args); switch(sp[-args].type) { @@ -212,22 +212,22 @@ void f_search(INT32 args) char *ptr; INT32 len; if(sp[1-args].type != T_STRING) - ERROR("search", "Bad argument 2.\n", sp, args); + PIKE_ERROR("search", "Bad argument 2.\n", sp, args); start=0; if(args > 2) { if(sp[2-args].type!=T_INT) - ERROR("search", "Bad argument 3.\n", sp, args); + PIKE_ERROR("search", "Bad argument 3.\n", sp, args); start=sp[2-args].u.integer; if(start<0) - ERROR("search", "Start must be greater or equal to zero.\n", sp, args); + PIKE_ERROR("search", "Start must be greater or equal to zero.\n", sp, args); } len=sp[-args].u.string->len - start; if(len<0) - ERROR("search", "Start must not be greater than the length of the string.\n", sp, args); + PIKE_ERROR("search", "Start must not be greater than the length of the string.\n", sp, args); if(len>0 && (ptr=my_memmem(sp[1-args].u.string->str, sp[1-args].u.string->len, @@ -248,7 +248,7 @@ void f_search(INT32 args) if(args > 2) { if(sp[2-args].type!=T_INT) - ERROR("search", "Bad argument 3.\n", sp, args); + PIKE_ERROR("search", "Bad argument 3.\n", sp, args); start=sp[2-args].u.integer; } @@ -268,7 +268,7 @@ void f_search(INT32 args) return; default: - ERROR("search", "Bad argument 1.\n", sp, args); + PIKE_ERROR("search", "Bad argument 1.\n", sp, args); } } @@ -349,10 +349,10 @@ void f_backtrace(INT32 args) void f_add_constant(INT32 args) { if(args<1) - ERROR("add_constant", "Too few arguments.\n", sp, args); + PIKE_ERROR("add_constant", "Too few arguments.\n", sp, args); if(sp[-args].type!=T_STRING) - ERROR("add_constant", "Bad argument 1.\n", sp, args); + PIKE_ERROR("add_constant", "Bad argument 1.\n", sp, args); if(args>1) { @@ -497,10 +497,10 @@ void f_combine_path(INT32 args) struct pike_string *ret; if(args<1) - ERROR("combine_path", "Too few arguments.\n", sp, args); + PIKE_ERROR("combine_path", "Too few arguments.\n", sp, args); if(sp[-args].type != T_STRING) - ERROR("combine_path", "Bad argument 1.\n", sp, args); + PIKE_ERROR("combine_path", "Bad argument 1.\n", sp, args); path=sp[-args].u.string->str; @@ -528,9 +528,9 @@ void f_combine_path(INT32 args) void f_function_object(INT32 args) { if(args < 1) - ERROR("function_object", "Too few arguments.\n", sp, args); + PIKE_ERROR("function_object", "Too few arguments.\n", sp, args); if(sp[-args].type != T_FUNCTION) - ERROR("function_object", "Bad argument 1.\n", sp, args); + PIKE_ERROR("function_object", "Bad argument 1.\n", sp, args); if(sp[-args].subtype == FUNCTION_BUILTIN) { @@ -546,9 +546,9 @@ void f_function_name(INT32 args) { struct pike_string *s; if(args < 1) - ERROR("function_name", "Too few arguments.\n", sp, args); + PIKE_ERROR("function_name", "Too few arguments.\n", sp, args); if(sp[-args].type != T_FUNCTION) - ERROR("function_name", "Bad argument 1.\n", sp, args); + PIKE_ERROR("function_name", "Bad argument 1.\n", sp, args); if(sp[-args].subtype == FUNCTION_BUILTIN) { @@ -556,7 +556,7 @@ void f_function_name(INT32 args) push_int(0); }else{ if(!sp[-args].u.object->prog) - ERROR("function_name", "Destructed object.\n", sp, args); + PIKE_ERROR("function_name", "Destructed object.\n", sp, args); copy_shared_string(s,ID_FROM_INT(sp[-args].u.object->prog, sp[-args].subtype)->name); @@ -571,7 +571,7 @@ void f_function_name(INT32 args) void f_zero_type(INT32 args) { if(args < 1) - ERROR("zero_type", "Too few arguments.\n", sp, args); + PIKE_ERROR("zero_type", "Too few arguments.\n", sp, args); if(sp[-args].type != T_INT) { pop_n_elems(args); @@ -602,15 +602,15 @@ void f_allocate(INT32 args) struct array *a; if(args < 1) - ERROR("allocate", "Too few arguments.\n", sp, args); + PIKE_ERROR("allocate", "Too few arguments.\n", sp, args); if(sp[-args].type!=T_INT) - ERROR("allocate", "Bad argument 1.\n", sp, args); + PIKE_ERROR("allocate", "Bad argument 1.\n", sp, args); size=sp[-args].u.integer; if(size < 0) - ERROR("allocate", "Can't allocate array of negative size.\n", sp, args); + PIKE_ERROR("allocate", "Can't allocate array of negative size.\n", sp, args); a=allocate_array(size); if(args>1) { @@ -629,7 +629,7 @@ void f_rusage(INT32 args) pop_n_elems(args); rus=low_rusage(); if(!rus) - ERROR("rusage", "System rusage information not available.\n", sp, args); + PIKE_ERROR("rusage", "System rusage information not available.\n", sp, args); v=allocate_array_no_init(29,0); for(e=0;e<29;e++) @@ -661,7 +661,7 @@ void f_this_object(INT32 args) void f_throw(INT32 args) { if(args < 1) - ERROR("throw", "Too few arguments.\n", sp, args); + PIKE_ERROR("throw", "Too few arguments.\n", sp, args); assign_svalue(&throw_value,sp-args); pop_n_elems(args); throw_severity=0; @@ -671,10 +671,10 @@ void f_throw(INT32 args) void f_exit(INT32 args) { if(args < 1) - ERROR("exit", "Too few arguments.\n", sp, args); + PIKE_ERROR("exit", "Too few arguments.\n", sp, args); if(sp[-args].type != T_INT) - ERROR("exit", "Bad argument 1.\n", sp, args); + PIKE_ERROR("exit", "Bad argument 1.\n", sp, args); assign_svalue(&throw_value, sp-args); throw_severity=THROW_EXIT; @@ -684,10 +684,10 @@ void f_exit(INT32 args) void f__exit(INT32 args) { if(args < 1) - ERROR("_exit", "Too few arguments.\n", sp, args); + PIKE_ERROR("_exit", "Too few arguments.\n", sp, args); if(sp[-args].type != T_INT) - ERROR("_exit", "Bad argument 1.\n", sp, args); + PIKE_ERROR("_exit", "Bad argument 1.\n", sp, args); exit(sp[-1].u.integer); } @@ -708,10 +708,10 @@ void f_crypt(INT32 args) "cbhisjKlm4k65p7qrJfLMNQOPxwzyAaBDFgnoWXYCZ0123tvdHueEGISRTUV89./"; if(args < 1) - ERROR("crypt", "Too few arguments.\n", sp, args); + PIKE_ERROR("crypt", "Too few arguments.\n", sp, args); if(sp[-args].type != T_STRING) - ERROR("crypt", "Bad argument 1.\n", sp, args); + PIKE_ERROR("crypt", "Bad argument 1.\n", sp, args); if(args>1) @@ -760,12 +760,12 @@ void f_destruct(INT32 args) if(args) { if(sp[-args].type != T_OBJECT) - ERROR("destruct", "Bad arguments 1.\n", sp, args); + PIKE_ERROR("destruct", "Bad arguments 1.\n", sp, args); o=sp[-args].u.object; }else{ if(!fp) - ERROR("destruct", "Destruct called without argument from callback function.\n", sp, args); + PIKE_ERROR("destruct", "Destruct called without argument from callback function.\n", sp, args); o=fp->current_object; } @@ -778,7 +778,7 @@ void f_indices(INT32 args) INT32 size; struct array *a; if(args < 1) - ERROR("indices", "Too few arguments.\n", sp, args); + PIKE_ERROR("indices", "Too few arguments.\n", sp, args); switch(sp[-args].type) { @@ -812,7 +812,7 @@ void f_indices(INT32 args) break; default: - ERROR("indices", "Bad argument 1.\n", sp, args); + PIKE_ERROR("indices", "Bad argument 1.\n", sp, args); return; /* make apcc happy */ } pop_n_elems(args); @@ -824,7 +824,7 @@ void f_values(INT32 args) INT32 size; struct array *a; if(args < 1) - ERROR("values", "Too few arguments.\n", sp, args); + PIKE_ERROR("values", "Too few arguments.\n", sp, args); switch(sp[-args].type) { @@ -863,7 +863,7 @@ void f_values(INT32 args) break; default: - ERROR("values", "Bad argument 1.\n", sp, args); + PIKE_ERROR("values", "Bad argument 1.\n", sp, args); return; /* make apcc happy */ } pop_n_elems(args); @@ -878,7 +878,7 @@ void f_next_object(INT32 args) o=first_object; }else{ if(sp[-args].type != T_OBJECT) - ERROR("next_object", "Bad argument 1.\n", sp, args); + PIKE_ERROR("next_object", "Bad argument 1.\n", sp, args); o=sp[-args].u.object->next; } pop_n_elems(args); @@ -893,7 +893,7 @@ void f_next_object(INT32 args) void f_object_program(INT32 args) { if(args < 1) - ERROR("object_program", "Too few arguments.\n", sp, args); + PIKE_ERROR("object_program", "Too few arguments.\n", sp, args); if(sp[-args].type == T_OBJECT) { @@ -927,7 +927,7 @@ void f_object_program(INT32 args) void f_reverse(INT32 args) { if(args < 1) - ERROR("reverse", "Too few arguments.\n", sp, args); + PIKE_ERROR("reverse", "Too few arguments.\n", sp, args); switch(sp[-args].type) { @@ -968,7 +968,7 @@ void f_reverse(INT32 args) } default: - ERROR("reverse", "Bad argument 1.\n", sp, args); + PIKE_ERROR("reverse", "Bad argument 1.\n", sp, args); } } @@ -1079,7 +1079,7 @@ static struct pike_string * replace_many(struct pike_string *str, void f_replace(INT32 args) { if(args < 3) - ERROR("replace", "Too few arguments.\n", sp, args); + PIKE_ERROR("replace", "Too few arguments.\n", sp, args); switch(sp[-args].type) { @@ -1103,11 +1103,11 @@ void f_replace(INT32 args) switch(sp[1-args].type) { default: - ERROR("replace", "Bad argument 2.\n", sp, args); + PIKE_ERROR("replace", "Bad argument 2.\n", sp, args); case T_STRING: if(sp[2-args].type != T_STRING) - ERROR("replace", "Bad argument 3.\n", sp, args); + PIKE_ERROR("replace", "Bad argument 3.\n", sp, args); s=string_replace(sp[-args].u.string, sp[1-args].u.string, @@ -1116,7 +1116,7 @@ void f_replace(INT32 args) case T_ARRAY: if(sp[2-args].type != T_ARRAY) - ERROR("replace", "Bad argument 3.\n", sp, args); + PIKE_ERROR("replace", "Bad argument 3.\n", sp, args); s=replace_many(sp[-args].u.string, sp[1-args].u.array, @@ -1129,7 +1129,7 @@ void f_replace(INT32 args) } default: - ERROR("replace", "Bad argument 1.\n", sp, args); + PIKE_ERROR("replace", "Bad argument 1.\n", sp, args); } } @@ -1138,10 +1138,10 @@ void f_compile(INT32 args) struct program *p; if(args < 1) - ERROR("compile", "Too few arguments.\n", sp, args); + PIKE_ERROR("compile", "Too few arguments.\n", sp, args); if(sp[-args].type != T_STRING) - ERROR("compile", "Bad argument 1.\n", sp, args); + PIKE_ERROR("compile", "Bad argument 1.\n", sp, args); p=compile(sp[-args].u.string); pop_n_elems(args); @@ -1154,7 +1154,7 @@ void f_mkmapping(INT32 args) struct array *a,*b; get_all_args("mkmapping",args,"%a%a",&a,&b); if(a->size != b->size) - ERROR("mkmapping", "mkmapping called on arrays of different sizes\n", + PIKE_ERROR("mkmapping", "mkmapping called on arrays of different sizes\n", sp, args); m=mkmapping(sp[-args].u.array, sp[1-args].u.array); @@ -1164,7 +1164,7 @@ void f_mkmapping(INT32 args) void f_objectp(INT32 args) { - if(args<1) ERROR("objectp", "Too few arguments.\n", sp, args); + if(args<1) PIKE_ERROR("objectp", "Too few arguments.\n", sp, args); if(sp[-args].type != T_OBJECT || !sp[-args].u.object->prog) { pop_n_elems(args); @@ -1177,7 +1177,7 @@ void f_objectp(INT32 args) void f_functionp(INT32 args) { - if(args<1) ERROR("functionp", "Too few arguments.\n", sp, args); + if(args<1) PIKE_ERROR("functionp", "Too few arguments.\n", sp, args); if(sp[-args].type != T_FUNCTION || (sp[-args].subtype != FUNCTION_BUILTIN && !sp[-args].u.object->prog)) { @@ -1195,7 +1195,7 @@ void f_sleep(INT32 args) int ms; if(!args) - ERROR("sleep", "Too few arguments.\n", sp, args); + PIKE_ERROR("sleep", "Too few arguments.\n", sp, args); switch(sp[-args].type) { case T_INT: @@ -1205,7 +1205,7 @@ void f_sleep(INT32 args) ms = (int)(sp[-args].u.float_number * 1000.0); break; default: - ERROR("sleep", "Bad argument 1.\n", sp, args); + PIKE_ERROR("sleep", "Bad argument 1.\n", sp, args); break; } @@ -1218,7 +1218,7 @@ void f_sleep(INT32 args) INT32 a,b; if(!args) - ERROR("sleep", "Too few arguments.\n", sp, args); + PIKE_ERROR("sleep", "Too few arguments.\n", sp, args); GETTIMEOFDAY(&t1); @@ -1239,7 +1239,7 @@ void f_sleep(INT32 args) } default: - ERROR("sleep", "Bad argument 1.\n", sp, args); + PIKE_ERROR("sleep", "Bad argument 1.\n", sp, args); } my_add_timeval(&t1, &t2); @@ -1283,7 +1283,7 @@ void f_gc(INT32 args) void ID(INT32 args) \ { \ int t; \ - if(args<1) ERROR(NAME, "Too few arguments.\n", sp, args); \ + if(args<1) PIKE_ERROR(NAME, "Too few arguments.\n", sp, args); \ t=sp[-args].type == TYPE; \ pop_n_elems(args); \ push_int(t); \ @@ -1293,7 +1293,7 @@ void ID(INT32 args) \ void f_programp(INT32 args) { if(args<1) - ERROR("programp", "Too few arguments.\n", sp, args); + PIKE_ERROR("programp", "Too few arguments.\n", sp, args); switch(sp[-args].type) { case T_PROGRAM: @@ -1355,10 +1355,10 @@ void f_rows(INT32 args) struct array *a,*tmp; if(args < 2) - ERROR("rows", "Too few arguments.\n", sp, args); + PIKE_ERROR("rows", "Too few arguments.\n", sp, args); if(sp[1-args].type!=T_ARRAY) - ERROR("rows", "Bad argument 1.\n", sp, args); + PIKE_ERROR("rows", "Bad argument 1.\n", sp, args); tmp=sp[1-args].u.array; push_array(a=allocate_array(tmp->size)); @@ -1378,10 +1378,10 @@ void f_column(INT32 args) DECLARE_CYCLIC(); if(args < 2) - ERROR("column", "Too few arguments.\n", sp, args); + PIKE_ERROR("column", "Too few arguments.\n", sp, args); if(sp[-args].type!=T_ARRAY) - ERROR("column", "Bad argument 1.\n", sp, args); + PIKE_ERROR("column", "Bad argument 1.\n", sp, args); tmp=sp[-args].u.array; if((a=(struct array *)BEGIN_CYCLIC(tmp,0))) @@ -1443,7 +1443,7 @@ void f_localtime(INT32 args) struct tm *tm; time_t t; if (args<1 || sp[-1].type!=T_INT) - ERROR("localtime", "Bad argument to localtime", sp, args); + PIKE_ERROR("localtime", "Bad argument to localtime", sp, args); t=sp[-1].u.integer; tm=localtime(&t); @@ -1495,7 +1495,7 @@ static void f_mktime (INT32 args) struct svalue * r; int retval; if (args<1) - ERROR("mktime", "Too few arguments.\n", sp, args); + PIKE_ERROR("mktime", "Too few arguments.\n", sp, args); if(args == 1) { @@ -1549,7 +1549,7 @@ static void f_mktime (INT32 args) #endif if (retval == -1) - ERROR("mktime", "Cannot convert.\n", sp, args); + PIKE_ERROR("mktime", "Cannot convert.\n", sp, args); pop_n_elems(args); push_int(retval); } @@ -1595,13 +1595,13 @@ void f_glob(INT32 args) struct pike_string *glob; if(args < 2) - ERROR("glob", "Too few arguments.\n", sp, args); + PIKE_ERROR("glob", "Too few arguments.\n", sp, args); if(args > 2) pop_n_elems(args-2); args=2; if (sp[-args].type!=T_STRING) - ERROR("glob", "Bad argument 2.\n", sp, args); + PIKE_ERROR("glob", "Bad argument 2.\n", sp, args); glob=sp[-args].u.string; @@ -1622,7 +1622,7 @@ void f_glob(INT32 args) for(i=0;i<a->size;i++) { if(ITEM(a)[i].type != T_STRING) - ERROR("glob", "Bad argument 2.\n", sp, args); + PIKE_ERROR("glob", "Bad argument 2.\n", sp, args); if(does_match(ITEM(a)[i].u.string->str, ITEM(a)[i].u.string->len, @@ -1643,7 +1643,7 @@ void f_glob(INT32 args) break; default: - ERROR("glob", "Bad argument 2.\n", sp, args); + PIKE_ERROR("glob", "Bad argument 2.\n", sp, args); } } @@ -1739,7 +1739,7 @@ static void f_longest_ordered_sequence(INT32 args) /* THREADS_DISALLOW(); */ if (!a) { - ERROR("Array.longest_ordered_sequence", "Out of memory", sp, args); + PIKE_ERROR("Array.longest_ordered_sequence", "Out of memory", sp, args); } pop_n_elems(args); @@ -2212,11 +2212,11 @@ void f_diff(INT32 args) struct array *diff; if (args<2) - ERROR("diff", "Too few arguments.\n", sp, args); + PIKE_ERROR("diff", "Too few arguments.\n", sp, args); if (sp[-args].type!=T_ARRAY || sp[1-args].type!=T_ARRAY) - ERROR("diff", "Bad arguments.\n", sp, args); + PIKE_ERROR("diff", "Bad arguments.\n", sp, args); cmptbl=diff_compare_table(sp[-args].u.array,sp[1-args].u.array); push_array(cmptbl); @@ -2234,11 +2234,11 @@ void f_diff_compare_table(INT32 args) struct array *cmptbl; if (args<2) - ERROR("diff_compare_table", "Too few arguments.\n", sp, args); + PIKE_ERROR("diff_compare_table", "Too few arguments.\n", sp, args); if (sp[-args].type!=T_ARRAY || sp[1-args].type!=T_ARRAY) - ERROR("diff_compare_table", "Bad arguments.\n", sp, args); + PIKE_ERROR("diff_compare_table", "Bad arguments.\n", sp, args); cmptbl=diff_compare_table(sp[-args].u.array,sp[1-args].u.array); @@ -2253,11 +2253,11 @@ void f_diff_longest_sequence(INT32 args) struct array *diff; if (args<2) - ERROR("diff_longest_sequence", "Too few arguments.\n", sp, args); + PIKE_ERROR("diff_longest_sequence", "Too few arguments.\n", sp, args); if (sp[-args].type!=T_ARRAY || sp[1-args].type!=T_ARRAY) - ERROR("diff_longest_sequence", "Bad arguments.\n", sp, args); + PIKE_ERROR("diff_longest_sequence", "Bad arguments.\n", sp, args); cmptbl=diff_compare_table(sp[-args].u.array,sp[1-args].u.array); push_array(cmptbl); @@ -2343,7 +2343,7 @@ void f__next(INT32 args) { struct svalue tmp; if(!args) - ERROR("_next", "Too few arguments.\n", sp, args); + PIKE_ERROR("_next", "Too few arguments.\n", sp, args); pop_n_elems(args-1); tmp=sp[-1]; @@ -2356,7 +2356,7 @@ void f__next(INT32 args) case T_PROGRAM: tmp.u.program=tmp.u.program->next; break; case T_STRING: tmp.u.string=tmp.u.string->next; break; default: - ERROR("_next", "Bad argument 1.\n", sp, args); + PIKE_ERROR("_next", "Bad argument 1.\n", sp, args); } if(tmp.u.refs) { @@ -2371,7 +2371,7 @@ void f__prev(INT32 args) { struct svalue tmp; if(!args) - ERROR("_prev", "Too few arguments.\n", sp, args); + PIKE_ERROR("_prev", "Too few arguments.\n", sp, args); pop_n_elems(args-1); tmp=sp[-1]; @@ -2383,7 +2383,7 @@ void f__prev(INT32 args) case T_MULTISET:tmp.u.multiset=tmp.u.multiset->prev; break; case T_PROGRAM: tmp.u.program=tmp.u.program->prev; break; default: - ERROR("_prev", "Bad argument 1.\n", sp, args); + PIKE_ERROR("_prev", "Bad argument 1.\n", sp, args); } if(tmp.u.refs) { @@ -2397,9 +2397,9 @@ void f__prev(INT32 args) void f__refs(INT32 args) { INT32 i; - if(!args) ERROR("_refs", "Too few arguments.\n", sp, args); + if(!args) PIKE_ERROR("_refs", "Too few arguments.\n", sp, args); if(sp[-args].type > MAX_REF_TYPE) - ERROR("refs", "Bad argument 1.\n", sp, args); + PIKE_ERROR("refs", "Bad argument 1.\n", sp, args); i=sp[-args].u.refs[0]; pop_n_elems(args); @@ -2409,11 +2409,11 @@ void f__refs(INT32 args) void f_replace_master(INT32 args) { if(!args) - ERROR("replace_master", "Too few arguments.\n", sp, 0); + PIKE_ERROR("replace_master", "Too few arguments.\n", sp, 0); if(sp[-args].type != T_OBJECT) - ERROR("replace_master", "Bad argument 1.\n", sp, args); + PIKE_ERROR("replace_master", "Bad argument 1.\n", sp, args); if(!sp[-args].u.object->prog) - ERROR("replace_master", "Called with destructed object.\n", sp, args); + PIKE_ERROR("replace_master", "Called with destructed object.\n", sp, args); free_object(master_object); master_object=sp[-args].u.object; @@ -2470,10 +2470,10 @@ static void f_get_prof_info(INT32 args) int i; if (!args) { - ERROR("get_profiling_info", "Too few arguments.\n", sp, args); + PIKE_ERROR("get_profiling_info", "Too few arguments.\n", sp, args); } prog = program_from_svalue(sp-args); - if(!prog) ERROR("get_profiling_info", "Bad argument 1.\n", sp, args); + if(!prog) PIKE_ERROR("get_profiling_info", "Bad argument 1.\n", sp, args); add_ref(prog); @@ -2509,7 +2509,7 @@ void f_object_variablep(INT32 args) get_all_args("variablep",args,"%o%S",&o, &s); if(!o->prog) - ERROR("variablep", "Called on destructed object.\n", sp, args); + PIKE_ERROR("variablep", "Called on destructed object.\n", sp, args); ret=find_shared_string_identifier(s,o->prog); if(ret!=-1) diff --git a/src/error.h b/src/error.h index 9aa2225d07f09a460248fc847969504674a015d1..3eefbc00365c6930999667cbdb8082a981889e79 100644 --- a/src/error.h +++ b/src/error.h @@ -5,7 +5,7 @@ \*/ /* - * $Id: error.h,v 1.17 1998/04/13 14:19:41 grubba Exp $ + * $Id: error.h,v 1.18 1998/04/17 05:08:01 hubbe Exp $ */ #ifndef ERROR_H #define ERROR_H @@ -83,9 +83,9 @@ extern int throw_severity; /* Works, but probably not interresting for most people * /grubba 1998-04-11 */ -#define ERROR(NAME, TEXT, SP, ARGS) new_error(NAME, TEXT, SP, ARGS, __FILE__, __LINE__); +#define PIKE_ERROR(NAME, TEXT, SP, ARGS) new_error(NAME, TEXT, SP, ARGS, __FILE__, __LINE__); #else -#define ERROR(NAME, TEXT, SP, ARGS) new_error(NAME, TEXT, SP, ARGS, NULL, 0); +#define PIKE_ERROR(NAME, TEXT, SP, ARGS) new_error(NAME, TEXT, SP, ARGS, NULL, 0); #endif /* DEBUG */ /* Prototypes begin here */ diff --git a/src/interpret.c b/src/interpret.c index 9cd579c64ab0fccd55677cf49cbfe66d38a20594..c7d4dd90882615fe451553a6346487d536923530 100644 --- a/src/interpret.c +++ b/src/interpret.c @@ -4,7 +4,7 @@ ||| See the files COPYING and DISCLAIMER for more information. \*/ #include "global.h" -RCSID("$Id: interpret.c,v 1.78 1998/04/16 21:32:01 hubbe Exp $"); +RCSID("$Id: interpret.c,v 1.79 1998/04/17 05:08:02 hubbe Exp $"); #include "interpret.h" #include "object.h" #include "program.h" @@ -1283,7 +1283,7 @@ static int eval_instruction(unsigned char *pc) CASE(F_FOREACH) /* array, lvalue , i */ { if(sp[-4].type != T_ARRAY) - ERROR("foreach", "Bad argument 1.\n", sp-3, 1); + PIKE_ERROR("foreach", "Bad argument 1.\n", sp-3, 1); if(sp[-1].u.integer < sp[-4].u.array->size) { fast_check_threads_etc(10); @@ -1424,7 +1424,7 @@ static int eval_instruction(unsigned char *pc) CASE(F_PUSH_ARRAY); if(sp[-1].type!=T_ARRAY) - ERROR("@", "Bad argument.\n", sp, 1); + PIKE_ERROR("@", "Bad argument.\n", sp, 1); sp--; push_array_items(sp->u.array); break; @@ -1543,7 +1543,7 @@ static int eval_instruction(unsigned char *pc) { INT32 args=sp - *--mark_sp; if(!args) - ERROR("`()", "Too few arguments.\n", sp, 0); + PIKE_ERROR("`()", "Too few arguments.\n", sp, 0); switch(sp[-args].type) { case T_INT: @@ -1551,7 +1551,7 @@ static int eval_instruction(unsigned char *pc) case T_FLOAT: case T_MAPPING: case T_MULTISET: - ERROR("`()", "Attempt to call a non-function value.\n", sp, args); + PIKE_ERROR("`()", "Attempt to call a non-function value.\n", sp, args); } return args; } @@ -1631,7 +1631,7 @@ void mega_apply(enum apply_type type, INT32 args, void *arg1, void *arg2) case APPLY_STACK: apply_stack: if(!args) - ERROR("`()", "Too few arguments.\n", sp, 0); + PIKE_ERROR("`()", "Too few arguments.\n", sp, 0); args--; if(sp-save_sp-args > (args<<2) + 32) { @@ -1651,7 +1651,7 @@ void mega_apply(enum apply_type type, INT32 args, void *arg1, void *arg2) { case T_INT: if (!s->u.integer) { - ERROR("0", "Attempt to call the NULL-value\n", sp, args); + PIKE_ERROR("0", "Attempt to call the NULL-value\n", sp, args); } else { error("Attempt to call the value %d\n", s->u.integer); } @@ -1726,7 +1726,7 @@ void mega_apply(enum apply_type type, INT32 args, void *arg1, void *arg2) fatal("Apply lfun on illegal value!\n"); #endif if(!o->prog) - ERROR("destructed object", "Apply on destructed object.\n", sp, args); + PIKE_ERROR("destructed object", "Apply on destructed object.\n", sp, args); fun=FIND_LFUN(o->prog,fun); goto apply_low; @@ -1759,7 +1759,7 @@ void mega_apply(enum apply_type type, INT32 args, void *arg1, void *arg2) p=o->prog; if(!p) - ERROR("destructed object->function", + PIKE_ERROR("destructed object->function", "Cannot call functions in destructed objects.\n", sp, args); #ifdef DEBUG if(fun>=(int)p->num_identifier_references) @@ -1806,7 +1806,7 @@ void mega_apply(enum apply_type type, INT32 args, void *arg1, void *arg2) fp = &new_frame; if(function->func.offset == -1) - ERROR(function->name->str, "Calling undefined function.\n", sp, args); + PIKE_ERROR(function->name->str, "Calling undefined function.\n", sp, args); tailrecurse=-1; switch(function->identifier_flags & (IDENTIFIER_FUNCTION | IDENTIFIER_CONSTANT)) @@ -2073,7 +2073,7 @@ void apply_lfun(struct object *o, int fun, int args) fatal("Apply lfun on illegal value!\n"); #endif if(!o->prog) - ERROR("destructed object", "Apply on destructed object.\n", sp, args); + PIKE_ERROR("destructed object", "Apply on destructed object.\n", sp, args); apply_low(o, (int)FIND_LFUN(o->prog,fun), args); } diff --git a/src/operators.c b/src/operators.c index 1051759a7da18d5bfd1c701eb2c8c423725ad1c8..b553b4dbf53d6c756467dc7eb5a7464502e0f638 100644 --- a/src/operators.c +++ b/src/operators.c @@ -5,7 +5,7 @@ \*/ #include <math.h> #include "global.h" -RCSID("$Id: operators.c,v 1.31 1998/04/10 17:41:22 grubba Exp $"); +RCSID("$Id: operators.c,v 1.32 1998/04/17 05:08:02 hubbe Exp $"); #include "interpret.h" #include "svalue.h" #include "multiset.h" @@ -32,7 +32,7 @@ void ID(INT32 args) \ switch(args) \ { \ case 0: case 1: \ - ERROR(NAME, "Too few arguments\n", sp, args); \ + PIKE_ERROR(NAME, "Too few arguments\n", sp, args); \ case 2: \ i=FUN (sp-2,sp-1); \ pop_n_elems(2); \ @@ -62,9 +62,9 @@ COMPARISON(f_ge,"`>=",!is_lt) #define CALL_OPERATOR(OP, args) \ if(!sp[-args].u.object->prog) \ - ERROR(lfun_names[OP], "Called in destructed object.\n", sp, args); \ + PIKE_ERROR(lfun_names[OP], "Called in destructed object.\n", sp, args); \ if(FIND_LFUN(sp[-args].u.object->prog,OP) == -1) \ - ERROR(lfun_names[OP], "Operator not in object.\n", sp, args); \ + PIKE_ERROR(lfun_names[OP], "Operator not in object.\n", sp, args); \ apply_lfun(sp[-args].u.object, OP, args-1); \ free_svalue(sp-2); \ sp[-2]=sp[-1]; \ @@ -84,7 +84,7 @@ void f_add(INT32 args) default: if(!args) { - ERROR("`+", "Too few arguments\n", sp, args); + PIKE_ERROR("`+", "Too few arguments\n", sp, args); }else{ if(types & BIT_OBJECT) { @@ -130,9 +130,9 @@ void f_add(INT32 args) { case T_PROGRAM: case T_FUNCTION: - ERROR("`+", "Bad argument 1\n", sp, args); + PIKE_ERROR("`+", "Bad argument 1\n", sp, args); } - ERROR("`+", "Incompatible types\n", sp, args); + PIKE_ERROR("`+", "Incompatible types\n", sp, args); return; /* compiler hint */ case BIT_STRING: @@ -436,7 +436,7 @@ void o_subtract(void) { if(call_lfun(LFUN_SUBTRACT, LFUN_RSUBTRACT)) return; - ERROR("`-", "Subtract on different types.\n", sp, 2); + PIKE_ERROR("`-", "Subtract on different types.\n", sp, 2); } switch(sp[-2].type) @@ -499,7 +499,7 @@ void o_subtract(void) } default: - ERROR("`-", "Bad argument 1.\n", sp, 2); + PIKE_ERROR("`-", "Bad argument 1.\n", sp, 2); } } @@ -507,7 +507,7 @@ void f_minus(INT32 args) { switch(args) { - case 0: ERROR("`-", "Too few arguments.\n", sp, 0); + case 0: PIKE_ERROR("`-", "Too few arguments.\n", sp, 0); case 1: o_negate(); break; case 2: o_subtract(); break; default: @@ -550,7 +550,7 @@ void o_and(void) if(call_lfun(LFUN_AND, LFUN_RAND)) return; - ERROR("`&", "Bitwise and on different types.\n", sp, 2); + PIKE_ERROR("`&", "Bitwise and on different types.\n", sp, 2); } switch(sp[-2].type) @@ -597,7 +597,7 @@ void o_and(void) len = sp[-2].u.string->len; if (len != sp[-1].u.string->len) - ERROR("`&", "Bitwise AND on strings of different lengths.\n", sp, 2); + PIKE_ERROR("`&", "Bitwise AND on strings of different lengths.\n", sp, 2); s = begin_shared_string(len); for (i=0; i<len; i++) s->str[i] = sp[-2].u.string->str[i] & sp[-1].u.string->str[i]; @@ -606,7 +606,7 @@ void o_and(void) return; } default: - ERROR("`&", "Bitwise and on illegal type.\n", sp, 2); + PIKE_ERROR("`&", "Bitwise and on illegal type.\n", sp, 2); } } @@ -652,7 +652,7 @@ void f_and(INT32 args) { switch(args) { - case 0: ERROR("`&", "Too few arguments.\n", sp, 0); + case 0: PIKE_ERROR("`&", "Too few arguments.\n", sp, 0); case 1: return; case 2: o_and(); return; default: @@ -690,7 +690,7 @@ void o_or(void) if(call_lfun(LFUN_OR, LFUN_ROR)) return; - ERROR("`|", "Bitwise or on different types.\n", sp, 2); + PIKE_ERROR("`|", "Bitwise or on different types.\n", sp, 2); } switch(sp[-2].type) @@ -738,7 +738,7 @@ void o_or(void) len = sp[-2].u.string->len; if (len != sp[-1].u.string->len) - ERROR("`|", "Bitwise OR on strings of different lengths.\n", sp, 2); + PIKE_ERROR("`|", "Bitwise OR on strings of different lengths.\n", sp, 2); s = begin_shared_string(len); for (i=0; i<len; i++) s->str[i] = sp[-2].u.string->str[i] | sp[-1].u.string->str[i]; @@ -748,7 +748,7 @@ void o_or(void) } default: - ERROR("`|", "Bitwise or on illegal type.\n", sp, 2); + PIKE_ERROR("`|", "Bitwise or on illegal type.\n", sp, 2); } } @@ -756,7 +756,7 @@ void f_or(INT32 args) { switch(args) { - case 0: ERROR("`|", "Too few arguments.\n", sp, 0); + case 0: PIKE_ERROR("`|", "Too few arguments.\n", sp, 0); case 1: return; case 2: o_or(); return; default: @@ -794,7 +794,7 @@ void o_xor(void) { if(call_lfun(LFUN_XOR, LFUN_RXOR)) return; - ERROR("`^", "Bitwise XOR on different types.\n", sp, 2); + PIKE_ERROR("`^", "Bitwise XOR on different types.\n", sp, 2); } switch(sp[-2].type) @@ -842,7 +842,7 @@ void o_xor(void) len = sp[-2].u.string->len; if (len != sp[-1].u.string->len) - ERROR("`^", "Bitwise XOR on strings of different lengths.\n", sp, 2); + PIKE_ERROR("`^", "Bitwise XOR on strings of different lengths.\n", sp, 2); s = begin_shared_string(len); for (i=0; i<len; i++) s->str[i] = sp[-2].u.string->str[i] ^ sp[-1].u.string->str[i]; @@ -852,7 +852,7 @@ void o_xor(void) } default: - ERROR("`^", "Bitwise XOR on illegal type.\n", sp, 2); + PIKE_ERROR("`^", "Bitwise XOR on illegal type.\n", sp, 2); } } @@ -860,7 +860,7 @@ void f_xor(INT32 args) { switch(args) { - case 0: ERROR("`^", "Too few arguments.\n", sp, 0); + case 0: PIKE_ERROR("`^", "Too few arguments.\n", sp, 0); case 1: return; case 2: o_xor(); return; default: @@ -899,8 +899,8 @@ void o_lsh(void) return; if(sp[-2].type != T_INT) - ERROR("`<<", "Bad argument 1.\n", sp, 2); - ERROR("`<<", "Bad argument 2.\n", sp, 2); + PIKE_ERROR("`<<", "Bad argument 1.\n", sp, 2); + PIKE_ERROR("`<<", "Bad argument 2.\n", sp, 2); } sp--; sp[-1].u.integer = sp[-1].u.integer << sp->u.integer; @@ -909,7 +909,7 @@ void o_lsh(void) void f_lsh(INT32 args) { if(args != 2) - ERROR("`<<", "Bad number of args.\n", sp, args); + PIKE_ERROR("`<<", "Bad number of args.\n", sp, args); o_lsh(); } @@ -931,8 +931,8 @@ void o_rsh(void) if(call_lfun(LFUN_RSH, LFUN_RRSH)) return; if(sp[-2].type != T_INT) - ERROR("`>>", "Bad argument 1.\n", sp, 2); - ERROR("`>>", "Bad argument 2.\n", sp, 2); + PIKE_ERROR("`>>", "Bad argument 1.\n", sp, 2); + PIKE_ERROR("`>>", "Bad argument 2.\n", sp, 2); } sp--; sp[-1].u.integer = sp[-1].u.integer >> sp->u.integer; @@ -941,7 +941,7 @@ void o_rsh(void) void f_rsh(INT32 args) { if(args != 2) - ERROR("`>>", "Bad number of args.\n", sp, args); + PIKE_ERROR("`>>", "Bad number of args.\n", sp, args); o_rsh(); } @@ -968,7 +968,7 @@ void o_multiply(void) struct svalue *pos; INT32 e; if(sp[-1].u.integer < 0) - ERROR("`*", "Cannot multiply array by negative number.\n", sp, 2); + PIKE_ERROR("`*", "Cannot multiply array by negative number.\n", sp, 2); ret=allocate_array(sp[-2].u.array->size * sp[-1].u.integer); pos=ret->item; for(e=0;e<sp[-1].u.integer;e++,pos+=sp[-2].u.array->size) @@ -987,7 +987,7 @@ void o_multiply(void) char *pos; INT32 e; if(sp[-1].u.integer < 0) - ERROR("`*", "Cannot multiply string by negative number.\n", sp, 2); + PIKE_ERROR("`*", "Cannot multiply string by negative number.\n", sp, 2); ret=begin_shared_string(sp[-2].u.string->len * sp[-1].u.integer); pos=ret->str; for(e=0;e<sp[-1].u.integer;e++,pos+=sp[-2].u.string->len) @@ -1044,7 +1044,7 @@ void o_multiply(void) if(call_lfun(LFUN_MULTIPLY, LFUN_RMULTIPLY)) return; - ERROR("`*", "Bad arguments.\n", sp, 2); + PIKE_ERROR("`*", "Bad arguments.\n", sp, 2); } } @@ -1052,7 +1052,7 @@ void f_multiply(INT32 args) { switch(args) { - case 0: ERROR("`*", "Too few arguments.\n", sp, 0); + case 0: PIKE_ERROR("`*", "Too few arguments.\n", sp, 0); case 1: return; case 2: o_multiply(); return; default: @@ -1100,7 +1100,7 @@ void o_divide(void) len=sp[-1].u.integer; if(!len) - ERROR("`/", "Division by zero.\n", sp, 2); + PIKE_ERROR("`/", "Division by zero.\n", sp, 2); if(len<0) { @@ -1131,7 +1131,7 @@ void o_divide(void) len=sp[-1].u.float_number; if(len==0.0) - ERROR("`/", "Division by zero.\n", sp, 2); + PIKE_ERROR("`/", "Division by zero.\n", sp, 2); if(len<0) { @@ -1186,7 +1186,7 @@ void o_divide(void) len=sp[-1].u.integer; if(!len) - ERROR("`/", "Division by zero.\n", sp, 2); + PIKE_ERROR("`/", "Division by zero.\n", sp, 2); if(len<0) { @@ -1219,7 +1219,7 @@ void o_divide(void) len=sp[-1].u.float_number; if(len==0.0) - ERROR("`/", "Division by zero.\n", sp, 2); + PIKE_ERROR("`/", "Division by zero.\n", sp, 2); if(len<0) { @@ -1265,7 +1265,7 @@ void o_divide(void) } } - ERROR("`/", "Division on different types.\n", sp, 2); + PIKE_ERROR("`/", "Division on different types.\n", sp, 2); } switch(sp[-2].type) @@ -1296,7 +1296,7 @@ void o_divide(void) case T_FLOAT: if(sp[-1].u.float_number == 0.0) - ERROR("`/", "Division by zero.\n", sp, 2); + PIKE_ERROR("`/", "Division by zero.\n", sp, 2); sp--; sp[-1].u.float_number /= sp[0].u.float_number; return; @@ -1305,7 +1305,7 @@ void o_divide(void) { INT32 tmp; if (sp[-1].u.integer == 0) - ERROR("`/", "Division by zero\n", sp, 2); + PIKE_ERROR("`/", "Division by zero\n", sp, 2); sp--; tmp=sp[-1].u.integer/sp[0].u.integer; @@ -1319,7 +1319,7 @@ void o_divide(void) } default: - ERROR("`/", "Bad argument 1.\n", sp, 2); + PIKE_ERROR("`/", "Bad argument 1.\n", sp, 2); } } @@ -1328,7 +1328,7 @@ void f_divide(INT32 args) switch(args) { case 0: - case 1: ERROR("`/", "Too few arguments to `/\n", sp, args); + case 1: PIKE_ERROR("`/", "Too few arguments to `/\n", sp, args); case 2: o_divide(); break; default: { @@ -1371,7 +1371,7 @@ void o_mod(void) struct pike_string *s=sp[-2].u.string; INT32 tmp,base; if(!sp[-1].u.integer) - ERROR("`%", "Modulo by zero.\n", sp, 2); + PIKE_ERROR("`%", "Modulo by zero.\n", sp, 2); tmp=sp[-1].u.integer; if(tmp<0) @@ -1394,7 +1394,7 @@ void o_mod(void) struct array *a=sp[-2].u.array; INT32 tmp,base; if(!sp[-1].u.integer) - ERROR("`%", "Modulo by zero.\n", sp, 2); + PIKE_ERROR("`%", "Modulo by zero.\n", sp, 2); tmp=sp[-1].u.integer; if(tmp<0) @@ -1413,7 +1413,7 @@ void o_mod(void) } } - ERROR("`%", "Modulo on different types.\n", sp, 2); + PIKE_ERROR("`%", "Modulo on different types.\n", sp, 2); } switch(sp[-2].type) @@ -1426,7 +1426,7 @@ void o_mod(void) { FLOAT_TYPE foo; if(sp[-1].u.float_number == 0.0) - ERROR("`%", "Modulo by zero.\n", sp, 2); + PIKE_ERROR("`%", "Modulo by zero.\n", sp, 2); sp--; foo=sp[-1].u.float_number / sp[0].u.float_number; foo=sp[-1].u.float_number - sp[0].u.float_number * floor(foo); @@ -1434,7 +1434,7 @@ void o_mod(void) return; } case T_INT: - if (sp[-1].u.integer == 0) ERROR("`%", "Modulo by zero.\n", sp, 2); + if (sp[-1].u.integer == 0) PIKE_ERROR("`%", "Modulo by zero.\n", sp, 2); sp--; if(sp[-1].u.integer>=0) { @@ -1455,14 +1455,14 @@ void o_mod(void) return; default: - ERROR("`%", "Bad argument 1.\n", sp, 2); + PIKE_ERROR("`%", "Bad argument 1.\n", sp, 2); } } void f_mod(INT32 args) { if(args != 2) - ERROR("`%", "Bad number of args\n", sp, args); + PIKE_ERROR("`%", "Bad number of args\n", sp, args); o_mod(); } @@ -1506,7 +1506,7 @@ void o_not(void) void f_not(INT32 args) { - if(args != 1) ERROR("`!", "Bad number of args.\n", sp, args); + if(args != 1) PIKE_ERROR("`!", "Bad number of args.\n", sp, args); o_not(); } @@ -1552,13 +1552,13 @@ void o_compl(void) } default: - ERROR("`~", "Bad argument.\n", sp, 1); + PIKE_ERROR("`~", "Bad argument.\n", sp, 1); } } void f_compl(INT32 args) { - if(args != 1) ERROR("`~", "Bad number of args.\n", sp, args); + if(args != 1) PIKE_ERROR("`~", "Bad number of args.\n", sp, args); o_compl(); } @@ -1590,7 +1590,7 @@ void o_negate(void) return; default: - ERROR("`-", "Bad argument to unary minus.\n", sp, 1); + PIKE_ERROR("`-", "Bad argument to unary minus.\n", sp, 1); } } @@ -1605,10 +1605,10 @@ void o_range(void) } if(sp[-2].type != T_INT) - ERROR("`[]", "Bad argument 2 to [ .. ]\n", sp, 3); + PIKE_ERROR("`[]", "Bad argument 2 to [ .. ]\n", sp, 3); if(sp[-1].type != T_INT) - ERROR("`[]", "Bad argument 3 to [ .. ]\n", sp, 3); + PIKE_ERROR("`[]", "Bad argument 3 to [ .. ]\n", sp, 3); from=sp[-2].u.integer; if(from<0) from=0; @@ -1656,7 +1656,7 @@ void o_range(void) } default: - ERROR("`[]", "[ .. ] on non-scalar type.\n", sp, 3); + PIKE_ERROR("`[]", "[ .. ] on non-scalar type.\n", sp, 3); } } @@ -1666,7 +1666,7 @@ void f_index(INT32 args) { case 0: case 1: - ERROR("`[]", "Too few arguments.\n", sp, args); + PIKE_ERROR("`[]", "Too few arguments.\n", sp, args); break; case 2: if(sp[-1].type==T_STRING) sp[-1].subtype=0; @@ -1676,7 +1676,7 @@ void f_index(INT32 args) o_range(); break; default: - ERROR("`[]", "Too many arguments.\n", sp, args); + PIKE_ERROR("`[]", "Too many arguments.\n", sp, args); } } @@ -1686,7 +1686,7 @@ void f_arrow(INT32 args) { case 0: case 1: - ERROR("`->", "Too few arguments.\n", sp, args); + PIKE_ERROR("`->", "Too few arguments.\n", sp, args); break; case 2: if(sp[-1].type==T_STRING) @@ -1694,7 +1694,7 @@ void f_arrow(INT32 args) o_index(); break; default: - ERROR("`->", "Too many arguments.\n", sp, args); + PIKE_ERROR("`->", "Too many arguments.\n", sp, args); } } @@ -1702,7 +1702,7 @@ void f_sizeof(INT32 args) { INT32 tmp; if(args<1) - ERROR("sizeof", "Too few arguments.\n", sp, args); + PIKE_ERROR("sizeof", "Too few arguments.\n", sp, args); tmp=pike_sizeof(sp-args);