cvsuser 03/10/08 05:58:26
Modified: . MANIFEST
classes key.pmc
Added: t/pmc key.t
Log:
add shift_pmc for key
Revision Changes Path
1.451 +1 -0 parrot/MANIFEST
Index: MANIFEST
===================================================================
RCS file: /cvs/public/parrot/MANIFEST,v
retrieving revision 1.450
retrieving revision 1.451
diff -u -w -r1.450 -r1.451
--- MANIFEST 7 Oct 2003 19:54:50 -0000 1.450
+++ MANIFEST 8 Oct 2003 12:58:13 -0000 1.451
@@ -2171,6 +2171,7 @@
t/pmc/intlist.t []
t/pmc/io.t []
t/pmc/iter.t []
+t/pmc/key.t []
t/pmc/managedstruct.t []
t/pmc/multiarray.t []
t/pmc/nci.t []
1.1 parrot/t/pmc/key.t
Index: key.t
===================================================================
#! perl -w
use Parrot::Test tests => 1;
use Test::More;
output_is(<<'CODE', <<'OUT', 'traverse key chain');
new P0, .Key
set P0, "1"
new P1, .Key
set P1, "2"
push P0, P1
new P2, .Key
set P2, "3"
push P1, P2
set P4, P0
l1:
defined I0, P0
unless I0, e1
print P0
shift P0, P0
branch l1
e1:
print "\n"
set P0, P4
l2:
defined I0, P0
unless I0, e2
print P0
shift P0, P0
branch l2
e2:
print "\n"
end
CODE
123
123
OUT
1.12 +8 -1 parrot/classes/key.pmc
Index: key.pmc
===================================================================
RCS file: /cvs/public/parrot/classes/key.pmc,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -w -r1.11 -r1.12
--- key.pmc 28 Aug 2003 13:17:01 -0000 1.11
+++ key.pmc 8 Oct 2003 12:58:26 -0000 1.12
@@ -1,6 +1,6 @@
/* key.pmc
* Copyright: 2001-2003 The Perl Foundation. All Rights Reserved.
- * CVS Info $Id: key.pmc,v 1.11 2003/08/28 13:17:01 leo Exp $
+ * CVS Info $Id: key.pmc,v 1.12 2003/10/08 12:58:26 leo Exp $
* Overview:
* These are the vtable functions for the default PMC class
* Data Structure and Algorithms:
@@ -106,6 +106,13 @@
void push_pmc (PMC * value) {
key_append(INTERP, SELF, value);
+ }
+
+ /* actually doesn't remove the entry but might be useful
+ * to traverse a key chain
+ */
+ PMC* shift_pmc() {
+ return key_next(INTERP, SELF);
}
}