Permalink
Browse files

add missing fixedintegerarray.freeze and .thaw

make testr succeeds now

git-svn-id: https://svn.parrot.org/parrot/trunk@8494 d31e2699-5ff4-0310-a27c-f18f2fbe73fe
  • Loading branch information...
1 parent 4987b1f commit 6287ae3cd18c1c47937887ea22ceaa8fff7054bd Leopold Toetsch committed Jul 3, 2005
Showing with 58 additions and 0 deletions.
  1. +58 −0 classes/fixedintegerarray.pmc
@@ -517,6 +517,64 @@ C<value>.
DYNSELF.set_pmc_keyed_int(k, value);
}
+/*
+
+=item C<void visit(visit_info *info)>
+
+This is used by freeze/thaw to visit the contents of the array.
+
+C<*info> is the visit info, (see F<include/parrot/pmc_freeze.h>).
+
+=item C<void freeze(visit_info *info)>
+
+Used to archive the array.
+
+=item C<void thaw(visit_info *info)>
+
+Used to unarchive the array.
+
+=cut
+
+*/
+
+ void visit(visit_info *info) {
+ SUPER(info);
+ }
+
+ void freeze(visit_info *info) {
+ IMAGE_IO *io = info->image_io;
+ INTVAL i, n;
+ INTVAL *ar;
+
+ SUPER(info);
+ n = VTABLE_elements(INTERP, SELF);
+ io->vtable->push_integer(INTERP, io, n);
+ ar = (INTVAL *)PMC_data(SELF);
+ for (i = 0; i < n; ++i) {
+ io->vtable->push_integer(INTERP, io, ar[i]);
+ }
+ }
+
+ void thaw(visit_info *info) {
+ IMAGE_IO *io = info->image_io;
+ INTVAL i, n;
+ INTVAL *ar;
+
+ if (info->extra_flags == EXTRA_IS_NULL) {
+ PMC_int_val(SELF) = 0;
+ PMC_data(SELF) = NULL;
+ n = io->vtable->shift_integer(INTERP, io);
+ if (!n)
+ return;
+ DYNSELF.set_integer_native(n);
+ ar = (INTVAL *)PMC_data(SELF);
+ for (i = 0; i < n; ++i) {
+ ar[i] = io->vtable->shift_integer(INTERP, io);
+ }
+ }
+ else
+ SUPER(info);
+ }
}
/*

0 comments on commit 6287ae3

Please sign in to comment.