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.
8
1997/02/
13
02
:
38
:
58
nisse
Exp $");
+
RCSID("$Id: operators.c,v 1.
9
1997/02/
19
05
:
04
:
19
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 "memory.h"
pike.git/src/operators.c:827:
struct pike_string *ret; ret=implode(sp[-2].u.array,sp[-1].u.string); free_string(sp[-1].u.string); free_array(sp[-2].u.array); sp[-2].type=T_STRING; sp[-2].u.string=ret; sp--; return; }
+
case TWO_TYPES(T_ARRAY,T_ARRAY):
+
{
+
struct array *ret;
+
ret=implode_array(sp[-2].u.array, sp[-1].u.array);
+
pop_n_elems(2);
+
push_array(ret);
+
break;
+
}
+
case TWO_TYPES(T_FLOAT,T_FLOAT): sp--; sp[-1].u.float_number *= sp[0].u.float_number; return; case TWO_TYPES(T_FLOAT,T_INT): sp--; sp[-1].u.float_number *= (FLOAT_TYPE)sp[0].u.integer; return;
pike.git/src/operators.c:920:
struct array *ret; ret=explode(sp[-2].u.string,sp[-1].u.string); free_string(sp[-2].u.string); free_string(sp[-1].u.string); sp[-2].type=T_ARRAY; sp[-2].u.array=ret; sp--; return; }
+
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"); sp--; sp[-1].u.float_number /= sp[0].u.float_number; return; case T_INT: if (sp[-1].u.integer == 0) error("Division by zero\n");
pike.git/src/operators.c:1245:
add_efun2("`|",f_or,LOG_TYPE,OPT_TRY_OPTIMIZE,optimize_binary,generate_or); add_efun2("`^",f_xor,LOG_TYPE,OPT_TRY_OPTIMIZE,optimize_binary,generate_xor); #define SHIFT_TYPE "function(object,mixed:mixed)|function(int,int:int)" add_efun2("`<<",f_lsh,SHIFT_TYPE,OPT_TRY_OPTIMIZE,0,generate_lsh); add_efun2("`>>",f_rsh,SHIFT_TYPE,OPT_TRY_OPTIMIZE,0,generate_rsh);
-
add_efun2("`*",f_multiply,"function(object,mixed...:mixed)|function(int...:int)|!function(int...:mixed)&function(float|int...:float)|function(string*,string:string)",OPT_TRY_OPTIMIZE,optimize_binary,generate_multiply);
+
add_efun2("`*",f_multiply,"function(
array(array),array:array)|function(
object,mixed...:mixed)|function(int...:int)|!function(int...:mixed)&function(float|int...:float)|function(string*,string:string)",OPT_TRY_OPTIMIZE,optimize_binary,generate_multiply);
-
add_efun2("`/",f_divide,"function(object,mixed:mixed)|function(int,int:int)|function(float|int,float:float)|function(float,int:float)|function(string,string:string*)",OPT_TRY_OPTIMIZE,0,generate_divide);
+
add_efun2("`/",f_divide,"function(
array,array:array(array))|function(
object,mixed:mixed)|function(int,int:int)|function(float|int,float:float)|function(float,int:float)|function(string,string:string*)",OPT_TRY_OPTIMIZE,0,generate_divide);
add_efun2("`%",f_mod,"function(object,mixed:mixed)|function(int,int:int)|!function(int,int:mixed)&function(int|float,int|float:float)",OPT_TRY_OPTIMIZE,0,generate_mod); add_efun2("`~",f_compl,"function(object:mixed)|function(int:int)|function(float:float)|function(string:string)",OPT_TRY_OPTIMIZE,0,generate_compl); add_efun2("sizeof", f_sizeof, "function(string|multiset|array|mapping|object:int)",0,0,generate_sizeof); }