pike.git
/
src
/
operators.c
version
»
Context lines:
10
20
40
80
file
none
3
pike.git/src/operators.c:1:
/*\ ||| This file is part of Pike. For copyright information see COPYRIGHT. ||| Pike is distributed under GPL, LGPL and MPL. See the file COPYING ||| for more information. \*/ /**/ #include "global.h" #include <math.h>
-
RCSID("$Id: operators.c,v 1.
158
2002/08/
02
03
:
10
:
17
jhs
Exp $");
+
RCSID("$Id: operators.c,v 1.
159
2002/08/
15
14
:
49
:
24
marcus
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:355:
for (e=-args; e < 0; e++) { if (save_sp[e].type == T_STRING) break; *(sp++) = save_sp[e]; } /* Perform the addition. */ f_add(args+e); save_sp[--e] = *(--sp); #ifdef PIKE_DEBUG if (sp != save_sp) {
-
fatal("f_add(): Lost track of stack %p != %p\n", sp, save_sp);
+
Pike_
fatal("f_add(): Lost track of stack %p != %p\n", sp, save_sp);
} #endif /* PIKE_DEBUG */ /* Perform the rest of the addition. */ f_add(-e); #ifdef PIKE_DEBUG if (sp != save_sp + 1 + e) {
-
fatal("f_add(): Lost track of stack (2) %p != %p\n",
+
Pike_
fatal("f_add(): Lost track of stack (2) %p != %p\n",
sp, save_sp + 1 + e); } #endif /* PIKE_DEBUG */ /* Adjust the stack. */ save_sp[-args] = sp[-1]; sp = save_sp + 1 - args; return; } else { e = -args; }
pike.git/src/operators.c:638:
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 PIKE_DEBUG if(!first_arg || !second_arg)
-
fatal("Couldn't find argument!\n");
+
Pike_
fatal("Couldn't find argument!\n");
#endif if(node_is_false(*first_arg) && !node_may_overload(*second_arg,LFUN_EQ)) { ret=*second_arg; ADD_NODE_REF(*second_arg); return mkopernode("`!",ret,0); } if(node_is_false(*second_arg) && !node_may_overload(*first_arg,LFUN_EQ)) {
pike.git/src/operators.c:711:
static node *optimize_not(node *n) { node **first_arg, **more_args; if(count_args(CDR(n))==1) { first_arg=my_get_arg(&_CDR(n), 0); #ifdef PIKE_DEBUG if(!first_arg)
-
fatal("Couldn't find argument!\n");
+
Pike_
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; \ if(count_args(*more_args) > 2) return 0; \ ADD_NODE_REF(*more_args); \
pike.git/src/operators.c:774:
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 PIKE_DEBUG if(!first_arg || !second_arg)
-
fatal("Couldn't find argument!\n");
+
Pike_
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)) { ADD_NODE_REF2(CAR(n),
pike.git/src/operators.c:822:
} return 0; } static int generate_comparison(node *n) { if(count_args(CDR(n))==2) { if(do_docode(CDR(n),DO_NOT_COPY) != 2)
-
fatal("Count args was wrong in generate_comparison.\n");
+
Pike_
fatal("Count args was wrong in generate_comparison.\n");
if(CAR(n)->u.sval.u.efun->function == f_eq) emit0(F_EQ); else if(CAR(n)->u.sval.u.efun->function == f_ne) emit0(F_NE); else if(CAR(n)->u.sval.u.efun->function == f_lt) emit0(F_LT); else if(CAR(n)->u.sval.u.efun->function == f_le) emit0(F_LE); else if(CAR(n)->u.sval.u.efun->function == f_gt) emit0(F_GT); else if(CAR(n)->u.sval.u.efun->function == f_ge) emit0(F_GE); else
-
fatal("Couldn't generate comparison!\n");
+
Pike_
fatal("Couldn't generate comparison!\n");
return 1; } return 0; } static int float_promote(void) { if(sp[-2].type==T_INT && sp[-1].type==T_FLOAT) { sp[-2].u.float_number=(FLOAT_TYPE)sp[-2].u.integer;
pike.git/src/operators.c:3084:
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 PIKE_DEBUG if(from < 0 || (to-from+1) < 0)
-
fatal("Error in o_range.\n");
+
Pike_
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; } case T_ARRAY: {
pike.git/src/operators.c:3458:
} } } return NULL; } static int generate_sizeof(node *n) { if(count_args(CDR(n)) != 1) return 0; if(do_docode(CDR(n),DO_NOT_COPY) != 1)
-
fatal("Count args was wrong in sizeof().\n");
+
Pike_
fatal("Count args was wrong in sizeof().\n");
emit0(F_SIZEOF); return 1; } extern int generate_call_function(node *n); /*! @class string_assignment */ struct program *string_assignment_program;