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.
173
2003/04/
01
18
:
11
:
09
nilsson Exp $
+
|| $Id: operators.c,v 1.
174
2003/04/
07
17
:
28
:
55
nilsson Exp $
*/ #include "global.h" #include <math.h>
-
RCSID("$Id: operators.c,v 1.
173
2003/04/
01
18
:
11
:
09
nilsson Exp $");
+
RCSID("$Id: operators.c,v 1.
174
2003/04/
07
17
:
28
:
55
nilsson 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:58:
pop_n_elems(args); \ push_int(i==args); \ } \ } /*! @decl int(0..1) `!=(mixed arg1, mixed arg2, mixed ... extras) *! *! Inequality operator. *! *! @returns
-
*! Returns
@tt{0@}
(zero) if all the arguments are equal, and
-
*!
@tt{1@}
otherwise.
+
*! Returns
@expr{0@}
(zero) if all the arguments are equal, and
+
*!
@expr{1@}
otherwise.
*! *! This is the inverse of @[`==()]. *! *! @seealso *! @[`==()] */ PMOD_EXPORT void f_ne(INT32 args) { f_eq(args); o_not(); } /*! @decl int(0..1) `==(mixed arg1, mixed arg2, mixed ... extras) *! *! Equality operator. *! *! @returns
-
*! Returns
@tt{1@}
if all the arguments are equal, and
-
*!
@tt{0@}
(zero) otherwise.
+
*! Returns
@expr{1@}
if all the arguments are equal, and
+
*!
@expr{0@}
(zero) otherwise.
*! *! @seealso *! @[`!=()] */ COMPARISON(f_eq,"`==", is_eq) /*! @decl int(0..1) `<(mixed arg1, mixed arg2, mixed ... extras) *! *! Less than operator. *! *! @returns
-
*! Returns
@tt{1@}
if the arguments are strictly increasing, and
-
*!
@tt{0@}
(zero) otherwise.
+
*! Returns
@expr{1@}
if the arguments are strictly increasing, and
+
*!
@expr{0@}
(zero) otherwise.
*! *! @seealso *! @[`<=()], @[`>()], @[`>=()] */ COMPARISON(f_lt,"`<" , is_lt) /*! @decl int(0..1) `<=(mixed arg1, mixed arg2, mixed ... extras) *! *! Less or equal operator. *! *! @returns
-
*! Returns
@tt{1@}
if the arguments are not strictly decreasing, and
-
*!
@tt{0@}
(zero) otherwise.
+
*! Returns
@expr{1@}
if the arguments are not strictly decreasing, and
+
*!
@expr{0@}
(zero) otherwise.
*! *! This is the inverse of @[`>()]. *! *! @seealso *! @[`<()], @[`>()], @[`>=()] */ COMPARISON(f_le,"`<=",!is_gt) /*! @decl int(0..1) `>(mixed arg1, mixed arg2, mixed ... extras) *! *! Greater than operator. *! *! @returns
-
*! Returns
@tt{1@}
if the arguments are strictly decreasing, and
-
*!
@tt{0@}
(zero) otherwise.
+
*! Returns
@expr{1@}
if the arguments are strictly decreasing, and
+
*!
@expr{0@}
(zero) otherwise.
*! *! @seealso *! @[`<()], @[`<=()], @[`>=()] */ COMPARISON(f_gt,"`>" , is_gt) /*! @decl int(0..1) `>=(mixed arg1, mixed arg2, mixed ... extras) *! *! Greater or equal operator. *! *! @returns
-
*! Returns
@tt{1@}
if the arguments are not strictly increasing, and
-
*!
@tt{0@}
(zero) otherwise.
+
*! Returns
@expr{1@}
if the arguments are not strictly increasing, and
+
*!
@expr{0@}
(zero) otherwise.
*! *! This is the inverse of @[`<()]. *! *! @seealso *! @[`<=()], @[`>()], @[`<()] */ COMPARISON(f_ge,"`>=",!is_lt) #define CALL_OPERATOR(OP, args) \
pike.git/src/operators.c:210:
*! @type multiset *! The multisets will be added. *! @endmixed *! *! Otherwise if there are more than 2 arguments the result will be: *! @expr{`+(`+(@[arg1], @[arg2]), @@@[extras])@} *! *! @note *! In Pike 7.0 and earlier the addition order was unspecified. *!
-
*! If @[arg1] is
@tt{UNDEFINED@}
it will behave as the empty
+
*! If @[arg1] is
@expr{UNDEFINED@}
it will behave as the empty
*! array/mapping/multiset if needed. This behaviour was new *! in Pike 7.0. *! *! @seealso *! @[`-()], @[lfun::`+()], @[lfun::``+()] */ PMOD_EXPORT void f_add(INT32 args) { INT_TYPE e,size; TYPE_FIELD types;
pike.git/src/operators.c:1072:
*! Negation/subtraction operator. *! *! @returns *! If there's only a single argument, that argument will be returned *! negated. If @[arg1] was an object, @expr{@[arg1]::`-()@} will be called *! without arguments. *! *! If there are more than two arguments the result will be: *! @expr{`-(`-(@[arg1], @[arg2]), @@@[extras])@}. *!
-
*! If @[arg1] is an object that overloads
@tt{`
-()@}, that function will
+
*! If @[arg1] is an object that overloads
@expr{`
-()@}, that function will
*! be called with @[arg2] as the single argument. *!
-
*! If @[arg2] is an object that overloads
@tt{``
-()@}, that function will
+
*! If @[arg2] is an object that overloads
@expr{``
-()@}, that function will
*! be called with @[arg1] as the single argument. *! *! Otherwise the result will be as follows: *! @mixed arg1 *! @type mapping *! @mixed arg2 *! @type array *! The result will be @[arg1] with all occurrances of *! @[arg2] removed. *! @type multiset|mapping
pike.git/src/operators.c:2917:
/*! @decl int(0..1) `!(object|function arg) *! @decl int(1..1) `!(int(0..0) arg) *! @decl int(0..0) `!(mixed arg) *! *! Negation operator. *! *! @returns *! If @[arg] is an object that implements @[lfun::`!()], that function *! will be called. *!
-
*! If @[arg] is
@tt{0@}
(zero), a destructed object, or a function in a
-
*! destructed object,
@tt{1@}
will be returned.
+
*! If @[arg] is
@expr{0@}
(zero), a destructed object, or a function in a
+
*! destructed object,
@expr{1@}
will be returned.
*!
-
*! Otherwise
@tt{0@}
(zero) will be returned.
+
*! Otherwise
@expr{0@}
(zero) will be returned.
*! *! @seealso *! @[`==()], @[`!=()], @[lfun::`!()] */ PMOD_EXPORT void f_not(INT32 args) { if(args != 1) { /* FIXME: Not appropriate with too many args. */ SIMPLE_TOO_FEW_ARGS_ERROR("`!", 1); }
pike.git/src/operators.c:3190:
*! The non-static (ie public) symbol named @[index] will be looked up *! in @[arg]. *! @type int *! The bignum function named @[index] will be looked up in @[arg]. *! @type array *! If @[index] is an int, index number @[index] of @[arg] will be *! returned. Otherwise an array of all elements in @[arg] indexed *! with @[index] will be returned. *! @type mapping *! If @[index] exists in @[arg] the corresponding value will be
-
*! returned. Otherwise
@tt{UNDEFINED@}
will be returned.
+
*! returned. Otherwise
@expr{UNDEFINED@}
will be returned.
*! @type multiset
-
*! If @[index] exists in @[arg],
@tt{1@}
will be returned.
-
*! Otherwise
@tt{UNDEFINED@}
will be returned.
+
*! If @[index] exists in @[arg],
@expr{1@}
will be returned.
+
*! Otherwise
@expr{UNDEFINED@}
will be returned.
*! @type string *! The character (int) at index @[index] in @[arg] will be returned. *! @type program *! The non-static (ie public) constant symbol @[index] will be *! looked up in @[arg]. *! @endmixed *! *! Otherwise if there are 3 arguments the result will be as follows: *! @mixed arg *! @type string
pike.git/src/operators.c:3262:
*! @type object *! The non-static (ie public) symbol named @[index] will be looked up *! in @[arg]. *! @type int *! The bignum function named @[index] will be looked up in @[arg]. *! @type array *! An array of all elements in @[arg] arrow indexed with @[index] *! will be returned. *! @type mapping *! If @[index] exists in @[arg] the corresponding value will be
-
*! returned. Otherwise
@tt{UNDEFINED@}
will be returned.
+
*! returned. Otherwise
@expr{UNDEFINED@}
will be returned.
*! @type multiset
-
*! If @[index] exists in @[arg],
@tt{1@}
will be returned.
-
*! Otherwise
@tt{UNDEFINED@}
will be returned.
+
*! If @[index] exists in @[arg],
@expr{1@}
will be returned.
+
*! Otherwise
@expr{UNDEFINED@}
will be returned.
*! @type program *! The non-static (ie public) constant symbol @[index] will be *! looked up in @[arg]. *! @endmixed *! *! @seealso *! @[`[]()], @[lfun::`->()], @[::`->()] */ PMOD_EXPORT void f_arrow(INT32 args) {
pike.git/src/operators.c:3310:
*! If @[arg] is an object that implements @[lfun::`[]=()], that function *! will be called with @[index] and @[val] as the arguments. *! *! @mixed arg *! @type object *! The non-static (ie public) variable named @[index] will be looked up *! in @[arg], and assigned @[val]. *! @type array|mapping *! Index @[index] in @[arg] will be assigned @[val]. *! @type multiset
-
*! If @[val] is
@tt{0@}
(zero), one occurrance of @[index] in
+
*! If @[val] is
@expr{0@}
(zero), one occurrance of @[index] in
*! @[arg] will be removed. Otherwise @[index] will be added *! to @[arg] if it is not already there. *! @endmixed *! *! @returns *! @[val] will be returned. *! *! @seealso *! @[`->=()], @[lfun::`[]=()] */
pike.git/src/operators.c:3359:
*! If @[arg] is an object that implements @[lfun::`->=()], that function *! will be called with @[index] and @[val] as the arguments. *! *! @mixed arg *! @type object *! The non-static (ie public) variable named @[index] will be looked up *! in @[arg], and assigned @[val]. *! @type array|mapping *! Index @[index] in @[arg] will be assigned @[val]. *! @type multiset
-
*! If @[val] is
@tt{0@}
(zero), one occurrance of @[index] in
+
*! If @[val] is
@expr{0@}
(zero), one occurrance of @[index] in
*! @[arg] will be removed. Otherwise @[index] will be added *! to @[arg] if it is not already there. *! @endmixed *! *! @returns *! @[val] will be returned. *! *! @seealso *! @[`[]=()], @[lfun::`->=()] */