pike.git
/
src
/
operators.c
version
»
Context lines:
10
20
40
80
file
none
3
pike.git/src/operators.c:1:
/*\ ||| This file a part of Pike, and is copyright by Fredrik Hubinette ||| Pike is distributed as GPL (General Public License) ||| See the files COPYING and DISCLAIMER for more information. \*/ #include <math.h> #include "global.h"
-
RCSID("$Id: operators.c,v 1.
29
1998/
03/
04
22
:
19
:
45
hubbe
Exp $");
+
RCSID("$Id: operators.c,v 1.
30
1998/
04
/
10
15
:
24
:
05
grubba
Exp $");
#include "interpret.h" #include "svalue.h" #include "multiset.h" #include "mapping.h" #include "array.h" #include "stralloc.h" #include "opcodes.h" #include "operators.h" #include "language.h" #include "pike_memory.h"
pike.git/src/operators.c:25:
#include "object.h" #include "pike_types.h" #define COMPARISON(ID,NAME,FUN) \ void ID(INT32 args) \ { \ int i; \ switch(args) \ { \ case 0: case 1: \
-
error
("Too few
arguments to %s\n
",
NAME
);
\
+
ERROR
(
NAME,
"Too few
arguments\n",
sp,
args
); \
case 2: \ i=FUN (sp-2,sp-1); \ pop_n_elems(2); \ push_int(i); \ break; \ default: \ for(i=1;i<args;i++) \ if(! ( FUN (sp-args+i-1, sp-args+i))) \ break; \ pop_n_elems(args); \
pike.git/src/operators.c:55:
COMPARISON(f_eq,"`==", is_eq) COMPARISON(f_lt,"`<" , is_lt) COMPARISON(f_le,"`<=",!is_gt) COMPARISON(f_gt,"`>" , is_gt) COMPARISON(f_ge,"`>=",!is_lt) #define CALL_OPERATOR(OP, args) \ if(!sp[-args].u.object->prog) \
-
error
("
Operator
%s called
in destructed object.\n",
lfun_names[OP]
); \
+
ERROR
(
lfun_names[OP],
"
Called
in destructed object.\n",
sp, args
); \
if(FIND_LFUN(sp[-args].u.object->prog,OP) == -1) \
-
error
("
No
operator
%s
in object.\n",
lfun_names[OP]
); \
+
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]; \ sp--; void f_add(INT32 args) { INT_TYPE e,size; TYPE_FIELD types; types=0; for(e=-args;e<0;e++) types|=1<<sp[e].type; switch(types) { default: if(!args) {
-
error
("Too few
arguments
to
`+(
)
\n")
;
+
ERROR
("
`+", "
Too few
arguments\n",
sp,
args
);
}else{ if(types & BIT_OBJECT) { if(sp[-args].type == T_OBJECT && sp[-args].u.object->prog && FIND_LFUN(sp[-args].u.object->prog,LFUN_ADD) != -1) { apply_lfun(sp[-args].u.object, LFUN_ADD, args-1); free_svalue(sp-2); sp[-2]=sp[-1];
pike.git/src/operators.c:123:
return; } } } } switch(sp[-args].type) { case T_PROGRAM: case T_FUNCTION:
-
error
("Bad argument
1
to
summation\n"
);
+
ERROR
("
`+", "
Bad argument
1\n",
sp,
args
);
}
-
error
("Incompatible
types
to
sum(
)
or +\n")
;
+
ERROR
("
`+", "
Incompatible
types\n",
sp,
args
);
return; /* compiler hint */ case BIT_STRING: { struct pike_string *r; char *buf; INT32 tmp; switch(args) {
pike.git/src/operators.c:429:
return 0; } void o_subtract(void) { if (sp[-2].type != sp[-1].type && !float_promote()) { if(call_lfun(LFUN_SUBTRACT, LFUN_RSUBTRACT)) return;
-
error
("Subtract on different types.\n");
+
ERROR
("
`-", "
Subtract on different types.\n"
, sp, 2
);
} switch(sp[-2].type) { case T_OBJECT: CALL_OPERATOR(LFUN_SUBTRACT,2); break; case T_ARRAY: {
pike.git/src/operators.c:492:
ret=string_replace(sp[-2].u.string,sp[-1].u.string,s); free_string(sp[-2].u.string); free_string(sp[-1].u.string); free_string(s); sp[-2].u.string=ret; sp--; return; } default:
-
error
("Bad argument 1
to subtraction
.\n");
+
ERROR
("
`-", "
Bad argument 1.\n"
, sp, 2
);
} } void f_minus(INT32 args) { switch(args) {
-
case 0:
error
("Too few arguments
to `-
\n");
+
case 0:
ERROR
("
`-", "
Too few arguments
.\n",
sp,
0
);
case 1: o_negate(); break; case 2: o_subtract(); break; default: { INT32 e; struct svalue *s=sp-args; push_svalue(s); for(e=1;e<args;e++) { push_svalue(s+e);
pike.git/src/operators.c:543:
return 0; } void o_and(void) { if(sp[-1].type != sp[-2].type) { if(call_lfun(LFUN_AND, LFUN_RAND)) return;
-
error
("Bitwise and on different types.\n");
+
ERROR
("
`&", "
Bitwise and on different types.\n"
, sp, 2
);
} switch(sp[-2].type) { case T_OBJECT: CALL_OPERATOR(LFUN_AND,2); break; case T_INT: sp--;
pike.git/src/operators.c:590:
push_array(a); return; } case T_STRING: { struct pike_string *s; INT32 len, i; len = sp[-2].u.string->len; if (len != sp[-1].u.string->len)
-
error
("Bitwise AND on strings of different lengths.\n");
+
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]; pop_n_elems(2); push_string(end_shared_string(s)); return; } default:
-
error
("Bitwise and on illegal type.\n");
+
ERROR
("
`&", "
Bitwise and on illegal type.\n"
, sp, 2
);
} } /* This function is used to speed up or/xor/and on * arrays multisets and mappings. This is done by * calling the operator for each pair of arguments * first, then recursively doing the same on the * results until only one value remains. */ static void speedup(INT32 args, void (*func)(void))
pike.git/src/operators.c:645:
default: while(--args > 0) func(); } } void f_and(INT32 args) { switch(args) {
-
case 0:
error
("Too few arguments
to `&
\n");
+
case 0:
ERROR
("
`&", "
Too few arguments
.\n",
sp,
0
);
case 1: return; case 2: o_and(); return; default: if(sp[-args].type == T_OBJECT) { CALL_OPERATOR(LFUN_AND, args); }else{ speedup(args, o_and); } }
pike.git/src/operators.c:683:
} } void o_or(void) { if(sp[-1].type != sp[-2].type) { if(call_lfun(LFUN_OR, LFUN_ROR)) return;
-
error
("Bitwise or on different types.\n");
+
ERROR
("
`|", "
Bitwise or on different types.\n"
, sp, 2
);
} switch(sp[-2].type) { case T_OBJECT: CALL_OPERATOR(LFUN_OR,2); break; case T_INT: sp--;
pike.git/src/operators.c:731:
return; } case T_STRING: { struct pike_string *s; INT32 len, i; len = sp[-2].u.string->len; if (len != sp[-1].u.string->len)
-
error
("Bitwise OR on strings of different lengths.\n");
+
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]; pop_n_elems(2); push_string(end_shared_string(s)); return; } default:
-
error
("Bitwise or on illegal type.\n");
+
ERROR
("
`|", "
Bitwise or on illegal type.\n"
, sp, 2
);
} } void f_or(INT32 args) { switch(args) {
-
case 0:
error
("Too few arguments
to `|
\n");
+
case 0:
ERRROR
("
`|", "
Too few arguments
.\n",
sp,
0
);
case 1: return; case 2: o_or(); return; default: if(sp[-args].type==T_OBJECT) { CALL_OPERATOR(LFUN_OR, args); } else { speedup(args, o_or); } }
pike.git/src/operators.c:787:
} } void o_xor(void) { if(sp[-1].type != sp[-2].type) { if(call_lfun(LFUN_XOR, LFUN_RXOR)) return;
-
error
("Bitwise
xor
on different types.\n");
+
ERROR
("
`^", "
Bitwise
XOR
on different types.\n"
, sp, 2
);
} switch(sp[-2].type) { case T_OBJECT: CALL_OPERATOR(LFUN_XOR,2); break; case T_INT: sp--;
pike.git/src/operators.c:835:
return; } case T_STRING: { struct pike_string *s; INT32 len, i; len = sp[-2].u.string->len; if (len != sp[-1].u.string->len)
-
error
("Bitwise XOR on strings of different lengths.\n");
+
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]; pop_n_elems(2); push_string(end_shared_string(s)); return; } default:
-
error
("Bitwise
xor
on illegal type.\n");
+
ERROR
("
`^", "
Bitwise
XOR
on illegal type.\n"
, sp, 2
);
} } void f_xor(INT32 args) { switch(args) {
-
case 0:
error
("Too few arguments
to `^
\n");
+
case 0:
ERROR
("
`^", "
Too few arguments
.\n",
sp,
0
);
case 1: return; case 2: o_xor(); return; default: if(sp[-args].type==T_OBJECT) { CALL_OPERATOR(LFUN_XOR, args); } else { speedup(args, o_xor); } }
pike.git/src/operators.c:892:
} void o_lsh(void) { if(sp[-1].type != T_INT || sp[-2].type != T_INT) { if(call_lfun(LFUN_LSH, LFUN_RLSH)) return; if(sp[-2].type != T_INT)
-
error
("Bad argument 1
to <<
\n");
-
error
("Bad argument 2
to <<
\n");
+
ERROR
("
`<<", "
Bad argument 1
.\n",
sp,
2
);
+
ERROR
("
`<<", "
Bad argument 2
.\n",
sp,
2
);
} sp--; sp[-1].u.integer = sp[-1].u.integer << sp->u.integer; } void f_lsh(INT32 args) { if(args != 2)
-
error
("Bad number of args
to `<<
\n");
+
ERROR
("
`<<", "
Bad number of args
.\n",
sp,
args
);
o_lsh(); } static int generate_lsh(node *n) { if(count_args(CDR(n))==2) { do_docode(CDR(n),DO_NOT_COPY); emit2(F_LSH); return 1;
pike.git/src/operators.c:924:
return 0; } void o_rsh(void) { if(sp[-2].type != T_INT || sp[-1].type != T_INT) { if(call_lfun(LFUN_RSH, LFUN_RRSH)) return; if(sp[-2].type != T_INT)
-
error
("Bad argument 1
to >>
\n");
-
error
("Bad argument 2
to >>
\n");
+
ERROR
("
`>>", "
Bad argument 1
.\n",
sp,
2
);
+
ERROR
("
`>>", "
Bad argument 2
.\n",
sp,
2
);
} sp--; sp[-1].u.integer = sp[-1].u.integer >> sp->u.integer; } void f_rsh(INT32 args) { if(args != 2)
-
error
("Bad number of args
to `>>
\n");
+
ERROR
("
`>>", "
Bad number of args
.\n",
sp,
args
);
o_rsh(); } static int generate_rsh(node *n) { if(count_args(CDR(n))==2) { do_docode(CDR(n),DO_NOT_COPY); emit2(F_RSH); return 1;
pike.git/src/operators.c:961:
void o_multiply(void) { switch(TWO_TYPES(sp[-2].type,sp[-1].type)) { case TWO_TYPES(T_ARRAY, T_INT): { struct array *ret; struct svalue *pos; INT32 e; if(sp[-1].u.integer < 0)
-
error
("Cannot multiply array by negative number.\n");
+
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) assign_svalues_no_free(pos, sp[-2].u.array->item, sp[-2].u.array->size, sp[-2].u.array->type_field); ret->type_field=sp[-2].u.array->type_field; pop_n_elems(2); push_array(ret); return; } case TWO_TYPES(T_STRING, T_INT): { struct pike_string *ret; char *pos; INT32 e; if(sp[-1].u.integer < 0)
-
error
("Cannot multiply string by negative number.\n");
+
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) MEMCPY(pos,sp[-2].u.string->str,sp[-2].u.string->len); pop_n_elems(2); push_string(end_shared_string(ret)); return; } case TWO_TYPES(T_ARRAY,T_STRING):
pike.git/src/operators.c:1037:
case TWO_TYPES(T_INT,T_INT): sp--; sp[-1].u.integer *= sp[0].u.integer; return; default: if(call_lfun(LFUN_MULTIPLY, LFUN_RMULTIPLY)) return;
-
error
("Bad arguments
to multiply
.\n");
+
ERROR
("
`*", "
Bad arguments.\n"
, sp, 2
);
} } void f_multiply(INT32 args) { switch(args) {
-
case 0:
error
("Too few arguments
to `*
\n");
+
case 0:
ERROR
("
`*", "
Too few arguments
.\n",
sp,
0
);
case 1: return; case 2: o_multiply(); return; default: if(sp[-args].type==T_OBJECT) { CALL_OPERATOR(LFUN_MULTIPLY, args); } else { while(--args > 0) o_multiply(); } }
pike.git/src/operators.c:1093:
switch(TWO_TYPES(sp[-2].type,sp[-1].type)) { case TWO_TYPES(T_STRING,T_INT): { struct array *a; char *pos=sp[-2].u.string->str; INT32 size,e,len; len=sp[-1].u.integer; if(!len)
-
error
("Division by zero.\n");
+
ERROR
("
`/", "
Division by zero.\n"
, sp, 2
);
if(len<0) { len=-len; size=sp[-2].u.string->len / len; pos+=sp[-2].u.string->len % len; }else{ size=sp[-2].u.string->len / len; } a=allocate_array(size);
pike.git/src/operators.c:1124:
} case TWO_TYPES(T_STRING,T_FLOAT): { struct array *a; INT32 last,pos,e,size; double len; len=sp[-1].u.float_number; if(len==0.0)
-
error
("Division by zero.\n");
+
ERROR
("
`/", "
Division by zero.\n"
, sp, 2
);
if(len<0) { len=-len; size=(INT32)ceil( ((double)sp[-2].u.string->len) / len); a=allocate_array(size); for(last=sp[-2].u.string->len,e=0;e<size-1;e++) { pos=sp[-2].u.string->len - (INT32)((e+1)*len);
pike.git/src/operators.c:1179:
} case TWO_TYPES(T_ARRAY, T_INT): { struct array *a; INT32 size,e,len,pos=0; len=sp[-1].u.integer; if(!len)
-
error
("Division by zero.\n");
+
ERROR
("
`/", "
Division by zero.\n"
, sp, 2
);
if(len<0) { len=-len; size=sp[-2].u.array->size / len; pos+=sp[-2].u.array->size % len; }else{ size=sp[-2].u.array->size / len; } a=allocate_array(size);
pike.git/src/operators.c:1212:
} case TWO_TYPES(T_ARRAY,T_FLOAT): { struct array *a; INT32 last,pos,e,size; double len; len=sp[-1].u.float_number; if(len==0.0)
-
error
("Division by zero.\n");
+
ERROR
("
`/", "
Division by zero.\n"
, sp, 2
);
if(len<0) { len=-len; size=(INT32)ceil( ((double)sp[-2].u.array->size) / len); a=allocate_array(size); for(last=sp[-2].u.array->size,e=0;e<size-1;e++) { pos=sp[-2].u.array->size - (INT32)((e+1)*len);
pike.git/src/operators.c:1258:
sp[-2].u.array->size); a->item[e].type=T_ARRAY; } a->type_field=BIT_ARRAY; pop_n_elems(2); push_array(a); return; } }
-
error
("Division on different types.\n");
+
ERROR
("
`/", "
Division on different types.\n"
, sp, 2
);
} switch(sp[-2].type) { case T_OBJECT: CALL_OPERATOR(LFUN_DIVIDE,2); break; case T_STRING: {
pike.git/src/operators.c:1289:
case T_ARRAY: { struct array *ret=explode_array(sp[-2].u.array, sp[-1].u.array); pop_n_elems(2); push_array(ret); return; } case T_FLOAT: if(sp[-1].u.float_number == 0.0)
-
error
("Division by zero.\n");
+
ERROR
("
`/", "
Division by zero.\n"
, sp, 2
);
sp--; sp[-1].u.float_number /= sp[0].u.float_number; return; case T_INT: { INT32 tmp; if (sp[-1].u.integer == 0)
-
error
("Division by zero\n");
+
ERROR
("
`/", "
Division by zero\n"
, sp, 2
);
sp--; tmp=sp[-1].u.integer/sp[0].u.integer; if((sp[-1].u.integer<0) != (sp[0].u.integer<0)) if(tmp*sp[0].u.integer!=sp[-1].u.integer) tmp--; sp[-1].u.integer=tmp; return; } default:
-
error
("Bad argument 1
to divide
.\n");
+
ERROR
("
`/", "
Bad argument 1.\n"
, sp, 2
);
} } void f_divide(INT32 args) { switch(args) { case 0:
-
case 1:
error
("Too few arguments to `/\n");
+
case 1:
ERROR
("
`/", "
Too few arguments to `/\n"
, sp, args
);
case 2: o_divide(); break; default: { INT32 e; struct svalue *s=sp-args; push_svalue(s); for(e=1;e<args;e++) { push_svalue(s+e); o_divide();
pike.git/src/operators.c:1364:
if(call_lfun(LFUN_MOD, LFUN_RMOD)) return; switch(TWO_TYPES(sp[-2].type,sp[-1].type)) { case TWO_TYPES(T_STRING,T_INT): { struct pike_string *s=sp[-2].u.string; INT32 tmp,base; if(!sp[-1].u.integer)
-
error
("Modulo by zero.\n");
+
ERROR
("
`%", "
Modulo by zero.\n"
, sp, 2
);
tmp=sp[-1].u.integer; if(tmp<0) { tmp=s->len % -tmp; base=0; }else{ tmp=s->len % tmp; base=s->len - tmp; }
pike.git/src/operators.c:1387:
push_string(s); return; } case TWO_TYPES(T_ARRAY,T_INT): { struct array *a=sp[-2].u.array; INT32 tmp,base; if(!sp[-1].u.integer)
-
error
("Modulo by zero.\n");
+
ERROR
("
`%", "
Modulo by zero.\n"
, sp, 2
);
tmp=sp[-1].u.integer; if(tmp<0) { tmp=a->size % -tmp; base=0; }else{ tmp=a->size % tmp; base=a->size - tmp; } a=slice_array(a,base,base+tmp); pop_n_elems(2); push_array(a); return; } }
-
error
("Modulo on different types.\n");
+
ERROR
("
`%", "
Modulo on different types.\n"
, sp, 2
);
} switch(sp[-2].type) { case T_OBJECT: CALL_OPERATOR(LFUN_MOD,2); break; case T_FLOAT: { FLOAT_TYPE foo; if(sp[-1].u.float_number == 0.0)
-
error
("Modulo by zero.\n");
+
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); sp[-1].u.float_number=foo; return; } case T_INT:
-
if (sp[-1].u.integer == 0)
error
("Modulo by zero.\n");
+
if (sp[-1].u.integer == 0)
ERROR
("
`%", "
Modulo by zero.\n"
, sp, 2
);
sp--; if(sp[-1].u.integer>=0) { if(sp[0].u.integer>=0) { sp[-1].u.integer %= sp[0].u.integer; }else{ sp[-1].u.integer=((sp[-1].u.integer+~sp[0].u.integer)%-sp[0].u.integer)-~sp[0].u.integer; } }else{ if(sp[0].u.integer>=0) { sp[-1].u.integer=sp[0].u.integer+~((~sp[-1].u.integer) % sp[0].u.integer); }else{ sp[-1].u.integer=-(-sp[-1].u.integer % -sp[0].u.integer); } } return; default:
-
error
("Bad argument 1
to modulo
.\n");
+
ERROR
("
`%", "
Bad argument 1.\n"
, sp, 2
);
} } void f_mod(INT32 args) { if(args != 2)
-
error
("Bad number of
args
to
`%%\n"
);
+
ERROR
("
`%", "
Bad number of
args\n",
sp,
args
);
o_mod(); } static int generate_mod(node *n) { if(count_args(CDR(n))==2) { do_docode(CDR(n),DO_NOT_COPY); emit2(F_MOD); return 1;
pike.git/src/operators.c:1499:
default: free_svalue(sp-1); sp[-1].type=T_INT; sp[-1].u.integer=0; } } void f_not(INT32 args) {
-
if(args != 1)
error
("Bad number of args
to `!
\n");
+
if(args != 1)
ERROR
("
`!", "
Bad number of args
.\n",
sp,
args
);
o_not(); } static int generate_not(node *n) { if(count_args(CDR(n))==1) { do_docode(CDR(n),DO_NOT_COPY); emit2(F_NOT); return 1;
pike.git/src/operators.c:1545:
len = sp[-1].u.string->len; s = begin_shared_string(len); for (i=0; i<len; i++) s->str[i] = ~ sp[-1].u.string->str[i]; pop_n_elems(1); push_string(end_shared_string(s)); break; } default:
-
error
("Bad argument
to ~
\n");
+
ERROR
("
`~", "
Bad argument
.\n",
sp,
1
);
} } void f_compl(INT32 args) {
-
if(args != 1)
error
("Bad number of args
to `~
\n");
+
if(args != 1)
ERROR
("
`~", "
Bad number of args
.\n",
sp,
args
);
o_compl(); } static int generate_compl(node *n) { if(count_args(CDR(n))==1) { do_docode(CDR(n),DO_NOT_COPY); emit2(F_COMPL); return 1;
pike.git/src/operators.c:1583:
case T_FLOAT: sp[-1].u.float_number=-sp[-1].u.float_number; return; case T_INT: sp[-1].u.integer = - sp[-1].u.integer; return; default:
-
error
("Bad argument to unary
minus\n
");
+
ERROR
("
`-", "
Bad argument to unary
minus.\n
"
, sp, 1
);
} } void o_range(void) { INT32 from,to; if(sp[-3].type==T_OBJECT) { CALL_OPERATOR(LFUN_INDEX, 3); return; } if(sp[-2].type != T_INT)
-
error
("Bad argument
1
to [ .. ]\n");
+
ERROR
("
`[]", "
Bad argument
2
to [ .. ]\n"
, sp, 3
);
if(sp[-1].type != T_INT)
-
error
("Bad argument
2
to [ .. ]\n");
+
ERROR
("
`[]", "
Bad argument
3
to [ .. ]\n"
, sp, 3
);
from=sp[-2].u.integer; if(from<0) from=0; to=sp[-1].u.integer; if(to<from-1) to=from-1; sp-=2; switch(sp[-1].type) { case T_STRING:
pike.git/src/operators.c:1649:
if(from>to+1) from=to+1; } a=slice_array(sp[-1].u.array,from,to+1); free_array(sp[-1].u.array); sp[-1].u.array=a; break; } default:
-
error
("[ .. ] on non-scalar type.\n");
+
ERROR
("
`
[
]",
"[
.. ] on non-scalar type.\n"
, sp, 3
);
} } void f_index(INT32 args) { switch(args) { case 0: case 1:
-
error
("Too few arguments
to `[]
\n");
+
ERROR
("
`[]", "
Too few arguments
.\n",
sp,
args
);
break; case 2: if(sp[-1].type==T_STRING) sp[-1].subtype=0; o_index(); break; case 3: o_range(); break; default:
-
error
("Too many arguments
to `[]
\n");
+
ERROR
("
`[]", "
Too many arguments
.\n",
sp,
args
);
} } void f_arrow(INT32 args) { switch(args) { case 0: case 1:
-
error
("Too few arguments
to `->
\n");
+
ERROR
("
`->", "
Too few arguments
.\n",
sp,
args
);
break; case 2: if(sp[-1].type==T_STRING) sp[-1].subtype=1; o_index(); break; default:
-
error
("Too many arguments
to `->
\n");
+
ERROR
("
`->", "
Too many arguments
.\n",
sp,
args
);
} } void f_sizeof(INT32 args) { INT32 tmp; if(args<1)
-
error
("Too few arguments
to
sizeof(
)
\n")
;
+
ERROR
("
sizeof", "
Too few arguments
.\n",
sp,
args
);
tmp=pike_sizeof(sp-args); pop_n_elems(args); push_int(tmp); } static int generate_sizeof(node *n) { node **arg;