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.
89
2000/04/12
11
:
14
:
50
mirar
Exp $");
+
RCSID("$Id: operators.c,v 1.
90
2000/04/12
16
:
55
:
56
grubba
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:21:
#include "docode.h" #include "constants.h" #include "peep.h" #include "lex.h" #include "program.h" #include "object.h" #include "pike_types.h" #include "module_support.h" #include "pike_macros.h" #include "bignum.h"
+
#include "builtin_functions.h"
#define OP_DIVISION_BY_ZERO_ERROR(FUNC) \ math_error(FUNC, sp-2, 2, 0, "Division by zero.\n") #define OP_MODULO_BY_ZERO_ERROR(FUNC) \ math_error(FUNC, sp-2, 2, 0, "Modulo by zero.\n") #define COMPARISON(ID,NAME,FUN) \ void ID(INT32 args) \ { \ int i; \
pike.git/src/operators.c:495:
return mkopernode(Y,tmp,0); \ } } while(0) TMP_OPT(f_eq, "`!="); TMP_OPT(f_ne, "`=="); TMP_OPT(f_lt, "`>="); TMP_OPT(f_gt, "`<="); TMP_OPT(f_le, "`>"); TMP_OPT(f_ge, "`<"); #undef TMP_OPT
+
if((more_args = is_call_to(*first_arg, f_search)) &&
+
(count_args(*more_args) == 2)) {
+
node *search_args = *more_args;
+
if ((search_args->token == F_ARG_LIST) &&
+
CAR(search_args) &&
+
(CAR(search_args)->type == string_type_string) &&
+
CDR(search_args) &&
+
(CDR(search_args)->type == string_type_string)) {
+
/* !search(string a, string b) => has_prefix(a, b) */
+
ADD_NODE_REF(*more_args);
+
return mkefuncallnode("has_prefix", search_args);
}
-
+
}
+
}
return 0; } static node *optimize_binary(node *n) { node **first_arg, **second_arg, *ret; if(count_args(CDR(n))==2) {