pike.git
/
src
/
operators.c
version
»
Context lines:
10
20
40
80
file
none
3
pike.git/src/operators.c:2820:
int args = 2; SIMPLE_ARG_TYPE_ERROR("`|", 2, "type"); } type_stack_mark(); push_object_type(0, p->id); free_svalue(Pike_sp - 1); SET_SVAL(Pike_sp[-1], T_TYPE, 0, type, pop_unfinished_type()); } } else { int args = 2;
+
+
if ((TYPEOF(Pike_sp[-1]) == PIKE_T_INT) &&
+
(SUBTYPEOF(Pike_sp[-1]) == NUMBER_UNDEFINED)) {
+
if (TYPEOF(Pike_sp[-2]) == PIKE_T_MULTISET) {
+
struct multiset *l = copy_multiset(Pike_sp[-2].u.multiset);
+
pop_stack();
+
pop_stack();
+
push_multiset(l);
+
return;
+
}
+
} else if ((TYPEOF(Pike_sp[-2]) == PIKE_T_INT) &&
+
(SUBTYPEOF(Pike_sp[-2]) == NUMBER_UNDEFINED)) {
+
if (TYPEOF(Pike_sp[-1]) == PIKE_T_MULTISET) {
+
struct multiset *l = copy_multiset(Pike_sp[-1].u.multiset);
+
pop_stack();
+
pop_stack();
+
push_multiset(l);
+
return;
+
}
+
}
+
SIMPLE_ARG_TYPE_ERROR("`|", 2, get_name_of_type(TYPEOF(Pike_sp[-2]))); } } switch(TYPEOF(Pike_sp[-2])) { case T_OBJECT: if(!call_lfun(LFUN_OR,LFUN_ROR)) PIKE_ERROR("`|", "Bitwise or on objects without `| operator.\n", Pike_sp, 2); return;
pike.git/src/operators.c:2966:
*! returned. *! *! Otherwise, if @[arg2] is an object with an @[lfun::``|()], that *! function is called with @[arg1] as argument, and its result is *! returned. *! *! Otherwise the result depends on the argument types: *! @mixed arg1 *! @type int *! Bitwise or of @[arg1] and @[arg2].
+
*! @type zero
+
*! @[UNDEFINED] may be or:ed with multisets, behaving as if
+
*! it was an empty multiset.
*! @type string *! The result is a string where each character is the bitwise *! or of the characters in the same position in @[arg1] and *! @[arg2]. The arguments must be strings of the same length. *! @type array *! The result is an array with the elements in @[arg1] *! concatenated with those in @[arg2] that doesn't occur in *! @[arg1] (according to @[`>], @[`<], @[`==]). The order *! between the elements that come from the same argument is kept. *!
pike.git/src/operators.c:2987:
*! element in @[arg2], so if @[arg2] contains several elements *! that are equal to each other and are more than their *! counterparts in @[arg1], the rightmost remaining elements in *! @[arg2] are kept. *! @type mapping *! The result is like @[arg1] but extended with the entries *! from @[arg2]. If the same index (according to @[hash_value] *! and @[`==]) occur in both, the value from @[arg2] is used. *! @type multiset *! The result is like @[arg1] but extended with the entries in
-
*! @[arg2] that
doesn
't already occur in @[arg1] (according to
+
*! @[arg2] that
don
't already occur in @[arg1] (according to
*! @[`>], @[`<] and @[`==]). Subsequences with orderwise equal *! entries (i.e. where @[`<] returns false) are handled just *! like the array case above. *! @type type|program *! Type union of @[arg1] and @[arg2]. *! @endmixed *! The function is not destructive on the arguments - the result is *! always a new instance. *! *! @note *! If this operator is used with arrays or multisets containing objects *! which implement @[lfun::`==()] but @b{not@} @[lfun::`>()] and *! @[lfun::`<()], the result will be undefined. *!
-
+
*! The treatment of @[UNDEFINED] with multisets was new in Pike 8.1.
+
*!
*! @seealso *! @[`&()], @[lfun::`|()], @[lfun::``|()] */ PMOD_EXPORT void f_or(INT32 args) { switch(args) { case 0: SIMPLE_WRONG_NUM_ARGS_ERROR("`|", 1); case 1: return; case 2: o_or(); return;