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.
43
1998/
10
/
14
05
:
48
:
45
hubbe Exp $");
+
RCSID("$Id: operators.c,v 1.
44
1998/
11
/
22
11
:
03
:
06
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:332:
} static node *optimize_eq(node *n) { node **first_arg, **second_arg, *ret; if(count_args(CDR(n))==2) { first_arg=my_get_arg(&CDR(n), 0); second_arg=my_get_arg(&CDR(n), 1);
-
#ifdef DEBUG
+
#ifdef
PIKE_
DEBUG
if(!first_arg || !second_arg) fatal("Couldn't find argument!\n"); #endif if(node_is_false(*first_arg) && !node_may_overload(*second_arg,LFUN_EQ)) { ret=*second_arg; *second_arg=0; return mkopernode("`!",ret,0); }
pike.git/src/operators.c:361:
} static node *optimize_not(node *n) { node **first_arg, **more_args; int e; if(count_args(CDR(n))==1) { first_arg=my_get_arg(&CDR(n), 0);
-
#ifdef DEBUG
+
#ifdef
PIKE_
DEBUG
if(!first_arg) fatal("Couldn't find argument!\n"); #endif if(node_is_true(*first_arg)) return mkintnode(0); if(node_is_false(*first_arg)) return mkintnode(1); #define TMP_OPT(X,Y) do { \ if((more_args=is_call_to(*first_arg, X))) \ { \ node *tmp=*more_args; \
pike.git/src/operators.c:397:
static node *optimize_binary(node *n) { node **first_arg, **second_arg, *ret; if(count_args(CDR(n))==2) { first_arg=my_get_arg(&CDR(n), 0); second_arg=my_get_arg(&CDR(n), 1);
-
#ifdef DEBUG
+
#ifdef
PIKE_
DEBUG
if(!first_arg || !second_arg) fatal("Couldn't find argument!\n"); #endif if((*second_arg)->type == (*first_arg)->type && compile_type_to_runtime_type((*second_arg)->type) != T_MIXED) { if((*first_arg)->token == F_APPLY && CAR(*first_arg)->token == F_CONSTANT && is_eq(& CAR(*first_arg)->u.sval, & CAR(n)->u.sval))
pike.git/src/operators.c:544:
check_array_for_destruct(sp[-1].u.array); a = subtract_arrays(sp[-2].u.array, sp[-1].u.array); pop_n_elems(2); push_array(a); return; } case T_MAPPING: { struct mapping *m;
-
m=merge_mappings(sp[-2].u.mapping, sp[-1].u.mapping,OP_SUB);
+
m=merge_mappings(sp[-2].u.mapping, sp[-1].u.mapping,
PIKE_ARRAY_
OP_SUB);
pop_n_elems(2); push_mapping(m); return; } case T_MULTISET: { struct multiset *l;
-
l=merge_multisets(sp[-2].u.multiset, sp[-1].u.multiset, OP_SUB);
+
l=merge_multisets(sp[-2].u.multiset, sp[-1].u.multiset,
PIKE_ARRAY_
OP_SUB);
pop_n_elems(2); push_multiset(l); return; } case T_FLOAT: sp--; sp[-1].u.float_number -= sp[0].u.float_number; return;
pike.git/src/operators.c:651:
break; case T_INT: sp--; sp[-1].u.integer &= sp[0].u.integer; break; case T_MAPPING: { struct mapping *m;
-
m=merge_mappings(sp[-2].u.mapping, sp[-1].u.mapping, OP_AND);
+
m=merge_mappings(sp[-2].u.mapping, sp[-1].u.mapping,
PIKE_ARRAY_
OP_AND);
pop_n_elems(2); push_mapping(m); return; } case T_MULTISET: { struct multiset *l;
-
l=merge_multisets(sp[-2].u.multiset, sp[-1].u.multiset, OP_AND);
+
l=merge_multisets(sp[-2].u.multiset, sp[-1].u.multiset,
PIKE_ARRAY_
OP_AND);
pop_n_elems(2); push_multiset(l); return; } case T_ARRAY: { struct array *a; a=and_arrays(sp[-2].u.array, sp[-1].u.array); pop_n_elems(2);
pike.git/src/operators.c:832:
break; case T_INT: sp--; sp[-1].u.integer |= sp[0].u.integer; break; case T_MAPPING: { struct mapping *m;
-
m=merge_mappings(sp[-2].u.mapping, sp[-1].u.mapping, OP_OR);
+
m=merge_mappings(sp[-2].u.mapping, sp[-1].u.mapping,
PIKE_ARRAY_
OP_OR);
pop_n_elems(2); push_mapping(m); return; } case T_MULTISET: { struct multiset *l;
-
l=merge_multisets(sp[-2].u.multiset, sp[-1].u.multiset, OP_OR);
+
l=merge_multisets(sp[-2].u.multiset, sp[-1].u.multiset,
PIKE_ARRAY_
OP_OR);
pop_n_elems(2); push_multiset(l); return; } case T_ARRAY: { struct array *a;
-
a=merge_array_without_order(sp[-2].u.array, sp[-1].u.array, OP_OR);
+
a=merge_array_without_order(sp[-2].u.array, sp[-1].u.array,
PIKE_ARRAY_
OP_OR);
pop_n_elems(2); push_array(a); return; } STRING_BITOP(|,"OR") default: PIKE_ERROR("`|", "Bitwise or on illegal type.\n", sp, 2); }
pike.git/src/operators.c:922:
break; case T_INT: sp--; sp[-1].u.integer ^= sp[0].u.integer; break; case T_MAPPING: { struct mapping *m;
-
m=merge_mappings(sp[-2].u.mapping, sp[-1].u.mapping, OP_XOR);
+
m=merge_mappings(sp[-2].u.mapping, sp[-1].u.mapping,
PIKE_ARRAY_
OP_XOR);
pop_n_elems(2); push_mapping(m); return; } case T_MULTISET: { struct multiset *l;
-
l=merge_multisets(sp[-2].u.multiset, sp[-1].u.multiset, OP_XOR);
+
l=merge_multisets(sp[-2].u.multiset, sp[-1].u.multiset,
PIKE_ARRAY_
OP_XOR);
pop_n_elems(2); push_multiset(l); return; } case T_ARRAY: { struct array *a;
-
a=merge_array_without_order(sp[-2].u.array, sp[-1].u.array, OP_XOR);
+
a=merge_array_without_order(sp[-2].u.array, sp[-1].u.array,
PIKE_ARRAY_
OP_XOR);
pop_n_elems(2); push_array(a); return; } STRING_BITOP(^,"XOR") default: PIKE_ERROR("`^", "Bitwise XOR on illegal type.\n", sp, 2); }
pike.git/src/operators.c:1730:
case T_STRING: { struct pike_string *s; if(to>=sp[-1].u.string->len-1) { if(from==0) return; to=sp[-1].u.string->len-1; if(from>to+1) from=to+1; }
-
#ifdef DEBUG
+
#ifdef
PIKE_
DEBUG
if(from < 0 || (to-from+1) < 0) fatal("Error in o_range.\n"); #endif s=string_slice(sp[-1].u.string, from, to-from+1); free_string(sp[-1].u.string); sp[-1].u.string=s; break; }