pike.git
/
src
/
operators.c
version
»
Context lines:
10
20
40
80
file
none
3
pike.git/src/operators.c:1097:
} } #define COMPARISON(ID,NAME,FUN) \ PMOD_EXPORT void ID(INT32 args) \ { \ int i; \ switch(args) \ { \ case 0: case 1: \
-
SIMPLE_
TOO
_
FEW
_ARGS_ERROR(NAME, 2); \
+
SIMPLE_
WRONG
_
NUM
_ARGS_ERROR(NAME, 2);
\
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:1463:
if (args == 1) return; types=0; for(e=-args;e<0;e++) types |= 1<<TYPEOF(sp[e]); switch(types) { default: if(!args) {
-
SIMPLE_
TOO
_
FEW
_ARGS_ERROR("`+", 1);
+
SIMPLE_
WRONG
_
NUM
_ARGS_ERROR("`+", 1);
}else{ if(types & BIT_OBJECT) { struct object *o; struct program *p; int i; if(TYPEOF(sp[-args]) == T_OBJECT && sp[-args].u.object->prog) { /* The first argument is an object. */
pike.git/src/operators.c:2459:
*! @note *! In Pike 7.0 and earlier the subtraction order was unspecified. *! *! @seealso *! @[`+()] */ PMOD_EXPORT void f_minus(INT32 args) { switch(args) {
-
case 0: SIMPLE_
TOO
_
FEW
_ARGS_ERROR("`-", 1);
+
case 0: SIMPLE_
WRONG
_
NUM
_ARGS_ERROR("`-", 1);
case 1: o_negate(); break; case 2: o_subtract(); break; default: { INT32 e; TYPE_FIELD types = 0; struct svalue *s=sp-args; for(e=-args;e<0;e++) types |= 1<<TYPEOF(sp[e]);
pike.git/src/operators.c:2842:
*! The function is not destructive on the arguments - the result is *! always a new instance. *! *! @seealso *! @[`|()], @[lfun::`&()], @[lfun::``&()] */ PMOD_EXPORT void f_and(INT32 args) { switch(args) {
-
case 0: SIMPLE_
TOO
_
FEW
_ARGS_ERROR("`&", 1);
+
case 0: SIMPLE_
WRONG
_
NUM
_ARGS_ERROR("`&", 1);
case 1: return; case 2: o_and(); return; default: if(TYPEOF(sp[-args]) == T_OBJECT) { CALL_OPERATOR(LFUN_AND, args); }else{ speedup(args, o_and); } }
pike.git/src/operators.c:3097:
*! The function is not destructive on the arguments - the result is *! always a new instance. *! *! @seealso *! @[`&()], @[lfun::`|()], @[lfun::``|()] */ PMOD_EXPORT void f_or(INT32 args) { switch(args) {
-
case 0: SIMPLE_
TOO
_
FEW
_ARGS_ERROR("`|", 1);
+
case 0: SIMPLE_
WRONG
_
NUM
_ARGS_ERROR("`|", 1);
case 1: return; case 2: o_or(); return; default: if(TYPEOF(sp[-args]) == T_OBJECT) { CALL_OPERATOR(LFUN_OR, args); } else { speedup(args, o_or); } }
pike.git/src/operators.c:3342:
*! The function is not destructive on the arguments - the result is *! always a new instance. *! *! @seealso *! @[`&()], @[`|()], @[lfun::`^()], @[lfun::``^()] */ PMOD_EXPORT void f_xor(INT32 args) { switch(args) {
-
case 0: SIMPLE_
TOO
_
FEW
_ARGS_ERROR("`^", 1);
+
case 0: SIMPLE_
WRONG
_
NUM
_ARGS_ERROR("`^", 1);
case 1: return; case 2: o_xor(); return; default: if(TYPEOF(sp[-args]) == T_OBJECT) { CALL_OPERATOR(LFUN_XOR, args); } else { speedup(args, o_xor); } }
pike.git/src/operators.c:3446:
*! If @[arg1] is a float and @[arg2] is a non-negative integer, *! @[arg1] will be multiplied by @expr{1<<@[arg2]@}. *! *! Otherwise @[arg1] will be shifted @[arg2] bits left. *! *! @seealso *! @[`>>()] */ PMOD_EXPORT void f_lsh(INT32 args) {
-
if(args != 2)
{
-
/* FIXME: Not appropriate if too many args. */
-
SIMPLE_
TOO
_
FEW
_ARGS_ERROR("`<<", 2);
-
}
+
if(args != 2)
+
SIMPLE_
WRONG
_
NUM
_ARGS_ERROR("`<<", 2);
o_lsh(); } static int generate_lsh(node *n) { struct compilation *c = THIS_COMPILATION; if(count_args(CDR(n))==2) { do_docode(CDR(n),DO_NOT_COPY_TOPLEVEL); emit0(F_LSH);
pike.git/src/operators.c:3534:
*! If @[arg1] is a float and @[arg2] is a non-negative integer, *! @[arg1] will be divided by @expr{1<<@[arg2]@}. *! *! Otherwise @[arg1] will be shifted @[arg2] bits right. *! *! @seealso *! @[`<<()] */ PMOD_EXPORT void f_rsh(INT32 args) {
-
if(args != 2)
{
-
/* FIXME: Not appropriate if too many args. */
-
SIMPLE_
TOO
_
FEW
_ARGS_ERROR("`>>", 2);
-
}
+
if(args != 2)
+
SIMPLE_
WRONG
_
NUM
_ARGS_ERROR("`>>", 2);
o_rsh(); } static int generate_rsh(node *n) { if(count_args(CDR(n))==2) { struct compilation *c = THIS_COMPILATION; do_docode(CDR(n),DO_NOT_COPY); emit0(F_RSH);
pike.git/src/operators.c:3802:
*! @note *! In Pike 7.0 and earlier the multiplication order was unspecified. *! *! @seealso *! @[`+()], @[`-()], @[`/()], @[lfun::`*()], @[lfun::``*()] */ PMOD_EXPORT void f_multiply(INT32 args) { switch(args) {
-
case 0: SIMPLE_
TOO
_
FEW
_ARGS_ERROR("`*", 1);
+
case 0: SIMPLE_
WRONG
_
NUM
_ARGS_ERROR("`*", 1);
case 1: return; case 2: o_multiply(); return; default: if(TYPEOF(sp[-args]) == T_OBJECT) { CALL_OPERATOR(LFUN_MULTIPLY, args); } else { INT32 i = -args, j = -1; /* Reverse the arguments */ while(i < j) {
pike.git/src/operators.c:4164:
*! zero is not special. This also means that / and % are compatible, so *! that a = b*(a/b) + a%b for all a and b. *! @seealso *! @[`%] */ PMOD_EXPORT void f_divide(INT32 args) { switch(args) { case 0:
-
case 1: SIMPLE_
TOO
_
FEW
_ARGS_ERROR("`/", 2);
+
case 1: SIMPLE_
WRONG
_
NUM
_ARGS_ERROR("`/", 2);
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:4380:
*! rather than returning 0, though. *! @item *! @expr{/@} and @expr{%@} are compatible, so that *! @expr{a == b*@[floor](a/b) + a%b@} for all @expr{a@} and @expr{b@}. *! @endol *! @seealso *! @[`/], @[floor()] */ PMOD_EXPORT void f_mod(INT32 args) {
-
if(args != 2)
{
-
/* FIXME: Not appropriate when too many args. */
-
SIMPLE_
TOO
_
FEW
_ARGS_ERROR("`%", 2);
-
}
+
if(args != 2)
+
SIMPLE_
WRONG
_
NUM
_ARGS_ERROR("`%", 2);
o_mod(); } static int generate_mod(node *n) { if(count_args(CDR(n))==2) { struct compilation *c = THIS_COMPILATION; do_docode(CDR(n),DO_NOT_COPY_TOPLEVEL); emit0(F_MOD);
pike.git/src/operators.c:4458:
*! Otherwise @expr{0@} (zero) will be returned. *! *! @note *! No float is considered false, not even @expr{0.0@}. *! *! @seealso *! @[`==()], @[`!=()], @[lfun::`!()] */ PMOD_EXPORT void f_not(INT32 args) {
-
if(args != 1)
{
-
/* FIXME: Not appropriate with too many args. */
-
SIMPLE_
TOO
_
FEW
_ARGS_ERROR("`!", 1);
-
}
+
if(args != 1)
+
SIMPLE_
WRONG
_
NUM
_ARGS_ERROR("`!", 1);
o_not(); } static int generate_not(node *n) { if(count_args(CDR(n))==1) { struct compilation *c = THIS_COMPILATION; do_docode(CDR(n),DO_NOT_COPY); emit0(F_NOT);
pike.git/src/operators.c:4579:
*! If @[arg] only contains characters in the range 0 - 255 (8-bit), *! a string containing the corresponding 8-bit inverses will be *! returned. *! @endmixed *! *! @seealso *! @[`!()], @[lfun::`~()] */ PMOD_EXPORT void f_compl(INT32 args) {
-
if(args != 1)
{
-
/* FIXME: Not appropriate with too many args. */
-
SIMPLE_
TOO
_
FEW
_ARGS_ERROR("`~", 1);
-
}
+
if(args != 1)
+
SIMPLE_
WRONG
_
NUM
_ARGS_ERROR("`~", 1);
o_compl(); } static int generate_compl(node *n) { if(count_args(CDR(n))==1) { struct compilation *c = THIS_COMPILATION; do_docode(CDR(n),DO_NOT_COPY); emit0(F_COMPL);