pike.git/
src/
builtin.cmod
Branch:
Tag:
Non-build tags
All tags
No tags
2019-11-18
2019-11-18 17:38:04 by Henrik Grubbström (Grubba) <grubba@grubba.org>
935f8c39b9a78242179ddeaa1550544a2d8d88fc (
30
lines) (+
27
/-
3
)
[
Show
|
Annotate
]
Branch:
master
ADT.List: Added _equal().
5889:
* o Copy segment * o Detach segment (requires new iterator implementation) * o Iterator copy
-
* o _equal() for iterators
and lists
.
-
* o _
values(), _
search(), cast()
-
* o _
sizeof()?, _
indices()??
+
* o _equal() for iterators.
+
* o _search(), cast()
+
* o _indices()??
* o Support for reverse(), filter() and map(). * o Initialization from array. * o Support for Pike.count_memory.
6658:
} /*! @endclass */
+
+
PIKEFUN int(1bit) _equal(mixed other)
+
{
+
struct List_struct *other_list;
+
struct pike_list_node *n1, *n2;
+
if ((TYPEOF(*other) != PIKE_T_OBJECT) ||
+
!(other_list = get_storage(other->u.object, List_program)) ||
+
(THIS->num_elems != other_list->num_elems)) {
+
push_int(0);
+
return;
}
-
+
n1 = THIS->head;
+
n2 = other_list->head;
+
while (n1->next && n2->next) {
+
if (!is_equal(&n1->val, &n2->val)) {
+
push_int(0);
+
return;
+
}
+
n1 = n1->next;
+
n2 = n2->next;
+
}
+
push_int(1);
+
}
+
}
/*! @endclass */