[svn:parrot] r44759 - in branches/tt1015: src/pmc t/pmc
plobsing at svn.parrot.org
plobsing at svn.parrot.org
Mon Mar 8 18:34:24 UTC 2010
Author: plobsing
Date: Mon Mar 8 18:34:23 2010
New Revision: 44759
URL: https://trac.parrot.org/parrot/changeset/44759
Log:
add visit,freeze,thaw,thawfinish to ArrayIterator and modify a test to keep failing
apparently I haven't got the push/shift order quite right yet
Modified:
branches/tt1015/src/pmc/arrayiterator.pmc
branches/tt1015/t/pmc/iterator.t
Modified: branches/tt1015/src/pmc/arrayiterator.pmc
==============================================================================
--- branches/tt1015/src/pmc/arrayiterator.pmc Mon Mar 8 18:29:21 2010 (r44758)
+++ branches/tt1015/src/pmc/arrayiterator.pmc Mon Mar 8 18:34:23 2010 (r44759)
@@ -138,6 +138,55 @@
/*
+=item C<void visit(PMC *visit)>
+
+=item C<void freeze(PMC *visit)>
+
+=item C<void thaw(PMC *visit)>
+
+=item C<void thaw_finish(PMC *visit)>
+
+Used in serializing/deserializing.
+
+=cut
+
+*/
+
+ VTABLE void visit(PMC *visit) {
+ VISIT_PMC_ATTR(INTERP, visit, SELF, ArrayIterator, array);
+ }
+
+ VTABLE void freeze(PMC *visit) {
+ INTVAL pos, rev;
+
+ GET_ATTR_pos(INTERP, SELF, pos);
+ VTABLE_push_integer(INTERP, visit, pos);
+
+ GET_ATTR_reverse(INTERP, SELF, rev);
+ VTABLE_push_integer(INTERP, visit, rev);
+ }
+
+ VTABLE void thaw(PMC *visit) {
+ INTVAL pos, rev;
+
+ pos = VTABLE_shift_integer(INTERP, visit);
+ SET_ATTR_pos(INTERP, SELF, pos);
+
+ rev = VTABLE_shift_integer(INTERP, visit);
+ SET_ATTR_reverse(INTERP, SELF, rev);
+ }
+
+ VTABLE void thawfinish(PMC *visit) {
+ PMC *arr;
+ INTVAL len;
+
+ GET_ATTR_array(INTERP, SELF, arr);
+ len = VTABLE_elements(INTERP, arr);
+ SET_ATTR_length(INTERP, SELF, len);
+ }
+
+/*
+
=item C<INTVAL get_bool()>
Returns true if there is more elements to iterate over.
Modified: branches/tt1015/t/pmc/iterator.t
==============================================================================
--- branches/tt1015/t/pmc/iterator.t Mon Mar 8 18:29:21 2010 (r44758)
+++ branches/tt1015/t/pmc/iterator.t Mon Mar 8 18:34:23 2010 (r44759)
@@ -759,19 +759,19 @@
.local pmc ar, i1, i2
.local pmc temp
ar = new ['ResizableIntegerArray']
- push ar, 1
- push ar, 2
+ push ar, 10
+ push ar, 20
i1 = iter ar
shift temp, i1
- unless temp == 1 goto fail
+ unless temp == 10 goto fail
clone i2, i1
shift temp, i1
- unless temp == 2 goto fail
+ unless temp == 20 goto fail
shift temp, i2
- unless temp == 2 goto fail
+ unless temp == 20 goto fail
say "ok"
end
More information about the parrot-commits
mailing list