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 "global.h" #include <math.h>
-
RCSID("$Id: operators.c,v 1.
45
1999/02/
01
02
:
41
:
41
hubbe Exp $");
+
RCSID("$Id: operators.c,v 1.
46
1999/02/
10
01:
29
:
07
hubbe 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:83:
switch(types) { default: if(!args) { PIKE_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)
+
if(sp[-args].type == T_OBJECT && sp[-args].u.object->prog)
{
-
+
if(sp[-args].u.object->refs==1 &&
+
FIND_LFUN(sp[-args].u.object->prog,LFUN_ADD_EQ) != -1)
+
{
+
apply_lfun(sp[-args].u.object, LFUN_ADD_EQ, args-1);
+
pop_stack();
+
return;
+
}
+
if(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]; sp--; return; }
-
+
}
for(e=1;e<args;e++) { if(sp[e-args].type == T_OBJECT && sp[e-args].u.object->prog && FIND_LFUN(sp[e-args].u.object->prog,LFUN_RADD) != -1) { struct svalue *tmp=sp+e-args; check_stack(e); assign_svalues_no_free(sp, sp-args, e, -1); sp+=e;
pike.git/src/operators.c:275:
}else{ sum+=(FLOAT_TYPE)sp[e].u.integer; } } sp-=args-1; sp[-1].type=T_FLOAT; sp[-1].u.float_number=sum; break; }
+
case BIT_ARRAY|BIT_INT:
+
{
+
if(IS_UNDEFINED(sp-args))
+
{
+
int e;
+
struct array *a;
+
+
for(e=1;e<args;e++)
+
if(sp[e-args].type != T_ARRAY)
+
error("`+: trying to add integers and arrays.\n");
+
+
a=add_arrays(sp-args+1,args-1);
+
pop_n_elems(args);
+
push_array(a);
+
return;
+
}
+
error("`+: trying to add integers and arrays.\n");
+
}
+
case BIT_ARRAY: { struct array *a; a=add_arrays(sp-args,args); pop_n_elems(args); push_array(a); break; } case BIT_MAPPING: