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.
-
|| $Id: operators.c,v 1.
200
2004/11/
26
14
:
17
:
04
nilsson
Exp $
+
|| $Id: operators.c,v 1.
201
2004/11/
27
22
:
48
:
11
mast
Exp $
*/ #include "global.h" #include <math.h> #include "interpret.h" #include "svalue.h" #include "multiset.h" #include "mapping.h" #include "array.h" #include "stralloc.h"
pike.git/src/operators.c:1004:
/*! @decl int(0..1) `<=(mixed arg1, mixed arg2, mixed ... extras) *! *! Less than or equal test. *! *! Every expression with the @expr{<=@} operator becomes a call to *! this function, i.e. @expr{a<=b@} is the same as *! @expr{predef::`<=(a,b)@}. *! *! @returns
-
*! Returns @expr{1@} if the
arguments
are
not strictly decreasing
,
and
-
*!
@expr{0@} (zero)
otherwise.
+
*! Returns @expr{1@} if the
test
is
successful
,
@expr{0@}
+
*! otherwise.
*!
-
*!
This
is the inverse of @[`>()].
+
*!
@note
+
*!
For total orders, e.g. integers, this
is the inverse of @[`>()].
*! *! @seealso *! @[`<()], @[`>()], @[`>=()] */
-
COMPARISON(f_le,"`<=",
!
is_
gt
)
+
COMPARISON(f_le,"`<=",is_
le
)
/*! @decl int(0..1) `>(mixed arg1, mixed arg2, mixed ... extras) *! *! Greater than test. *! *! Every expression with the @expr{>@} operator becomes a call to *! this function, i.e. @expr{a>b@} is the same as *! @expr{predef::`>(a,b)@}. *! *! @returns
pike.git/src/operators.c:1040:
/*! @decl int(0..1) `>=(mixed arg1, mixed arg2, mixed ... extras) *! *! Greater than or equal test. *! *! Every expression with the @expr{>=@} operator becomes a call to *! this function, i.e. @expr{a>=b@} is the same as *! @expr{predef::`>=(a,b)@}. *! *! @returns
-
*! Returns @expr{1@} if the
arguments
are
not strictly increasing
,
and
-
*!
@expr{0@} (zero)
otherwise.
+
*! Returns @expr{1@} if the
test
is
successful
,
@expr{0@}
+
*! otherwise.
*!
-
*!
This
is the inverse of @[`<()].
+
*!
@note
+
*!
For total orders, e.g. integers, this
is the inverse of @[`<()].
*! *! @seealso *! @[`<=()], @[`>()], @[`<()] */
-
COMPARISON(f_ge,"`>=",
!
is_
lt
)
+
COMPARISON(f_ge,"`>=",is_
ge
)
#define CALL_OPERATOR(OP, args) do { \ struct object *o_ = sp[-args].u.object; \ int i; \ if(!o_->prog) \ bad_arg_error(lfun_names[OP], sp-args, args, 1, "object", sp-args, \ "Called in destructed object.\n"); \ if((i = FIND_LFUN(o_->prog,OP)) == -1) \ bad_arg_error(lfun_names[OP], sp-args, args, 1, "object", sp-args, \
pike.git/src/operators.c:1712:
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); \ return mkopernode(Y,tmp,0); \ } } while(0) TMP_OPT(f_eq, "`!="); TMP_OPT(f_ne, "`==");
+
#if 0
+
/* The following only work on total orders. We can't assume that. */
TMP_OPT(f_lt, "`>="); TMP_OPT(f_gt, "`<="); TMP_OPT(f_le, "`>"); TMP_OPT(f_ge, "`<");
-
+
#endif
#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) */