cvsuser 04/06/17 04:12:03
Modified: classes array.pmc key.pmc perlhash.pmc
ops set.ops
t/pmc iter.t
. vtable.tbl
Log:
slices 2 - slice vtable and opcode
Revision Changes Path
1.83 +18 -10 parrot/classes/array.pmc
Index: array.pmc
===================================================================
RCS file: /cvs/public/parrot/classes/array.pmc,v
retrieving revision 1.82
retrieving revision 1.83
diff -u -w -r1.82 -r1.83
--- array.pmc 23 Apr 2004 09:20:16 -0000 1.82
+++ array.pmc 17 Jun 2004 11:11:54 -0000 1.83
@@ -1,6 +1,6 @@
/*
Copyright: 2001-2003 The Perl Foundation. All Rights Reserved.
-$Id: array.pmc,v 1.82 2004/04/23 09:20:16 jrieks Exp $
+$Id: array.pmc,v 1.83 2004/06/17 11:11:54 leo Exp $
=head1 NAME
@@ -1116,6 +1116,10 @@
/*
+=item C<PMC* slice (PMC *key)>
+
+Return a new iterator for the slice PMC C<key>
+
=item C<PMC* nextkey_keyed (PMC* key, INTVAL what)>
Used by an iterator to get the next index after C<*key>.
@@ -1126,6 +1130,10 @@
*/
+ PMC* slice (PMC* key) {
+ return NULL;
+ }
+
PMC* nextkey_keyed (PMC* key, INTVAL what) {
PMC *ret = key;
1.20 +4 -4 parrot/classes/key.pmc
Index: key.pmc
===================================================================
RCS file: /cvs/public/parrot/classes/key.pmc,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -w -r1.19 -r1.20
--- key.pmc 22 Feb 2004 17:48:41 -0000 1.19
+++ key.pmc 17 Jun 2004 11:11:54 -0000 1.20
@@ -1,6 +1,6 @@
/*
Copyright: 2001-2003 The Perl Foundation. All Rights Reserved.
-$Id: key.pmc,v 1.19 2004/02/22 17:48:41 mikescott Exp $
+$Id: key.pmc,v 1.20 2004/06/17 11:11:54 leo Exp $
=head1 NAME
@@ -8,7 +8,7 @@
=head1 DESCRIPTION
-These are the vtable functions for the default PMC class.
+These are the vtable functions for the Key PMC class.
=head2 Methods
1.71 +19 -11 parrot/classes/perlhash.pmc
Index: perlhash.pmc
===================================================================
RCS file: /cvs/public/parrot/classes/perlhash.pmc,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -w -r1.70 -r1.71
--- perlhash.pmc 2 Apr 2004 08:19:01 -0000 1.70
+++ perlhash.pmc 17 Jun 2004 11:11:54 -0000 1.71
@@ -1,6 +1,6 @@
/*
Copyright: 2001-2003 The Perl Foundation. All Rights Reserved.
-$Id: perlhash.pmc,v 1.70 2004/04/02 08:19:01 leo Exp $
+$Id: perlhash.pmc,v 1.71 2004/06/17 11:11:54 leo Exp $
=head1 NAME
@@ -428,6 +428,10 @@
/*
+=item C<PMC* slice (PMC *key)>
+
+Return a new iterator for the slice PMC C<key>
+
=item C<PMC *get_pmc_keyed(PMC *key)>
Returns the PMC value for the element at C<*key>.
@@ -436,6 +440,10 @@
*/
+ PMC* slice (PMC* key) {
+ return NULL;
+ }
+
PMC* get_pmc_keyed (PMC* key) {
STRING* keystr = make_hash_key(INTERP, key);
HashBucket *b = hash_get_bucket(INTERP, (Hash*) PMC_struct_val(SELF),
1.17 +11 -0 parrot/ops/set.ops
Index: set.ops
===================================================================
RCS file: /cvs/public/parrot/ops/set.ops,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -w -r1.16 -r1.17
--- set.ops 20 Apr 2004 16:04:23 -0000 1.16
+++ set.ops 17 Jun 2004 11:11:57 -0000 1.17
@@ -504,6 +504,17 @@
goto NEXT();
}
+=item B<slice>(out PMC, in PMC, in KEY)
+
+Return a new Iterator PMC $1 for aggregate $2 and Slice PMC $3.
+
+=cut
+
+inline op slice (out PMC, in PMC, in KEY) :base_core {
+ $1 = $2->vtable->slice(interpreter, $2, $3);
+ goto NEXT();
+}
+
=item B<clone>(out PMC, in PMC)
1.14 +16 -2 parrot/t/pmc/iter.t
Index: iter.t
===================================================================
RCS file: /cvs/public/parrot/t/pmc/iter.t,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -w -r1.13 -r1.14
--- iter.t 16 Jun 2004 07:11:54 -0000 1.13
+++ iter.t 17 Jun 2004 11:12:00 -0000 1.14
@@ -1,6 +1,6 @@
#! perl -w
# Copyright: 2001-2003 The Perl Foundation. All Rights Reserved.
-# $Id: iter.t,v 1.13 2004/06/16 07:11:54 leo Exp $
+# $Id: iter.t,v 1.14 2004/06/17 11:12:00 leo Exp $
=head1 NAME
@@ -16,7 +16,7 @@
=cut
-use Parrot::Test tests => 12;
+use Parrot::Test tests => 13;
use Test::More qw(skip);
output_is(<<'CODE', <<'OUTPUT', "new iter");
@@ -539,3 +539,17 @@
2
OUTPUT
}
+
+output_is(<<'CODE', <<'OUTPUT', "slice syntax");
+ new P0, .PerlArray
+ slice P2, P0[2 .. 3, 4, 5 ..6]
+ slice P2, P0[10 ..]
+ slice P2, P0[.. 11]
+ slice P2, P0[I1..3]
+ new P1, .PerlHash
+ slice P2, P1["0","a".."b","c"]
+ print "ok\n"
+ end
+CODE
+ok
+OUTPUT
1.63 +2 -1 parrot/vtable.tbl
Index: vtable.tbl
===================================================================
RCS file: /cvs/public/parrot/vtable.tbl,v
retrieving revision 1.62
retrieving revision 1.63
diff -u -w -r1.62 -r1.63
--- vtable.tbl 18 May 2004 13:03:10 -0000 1.62
+++ vtable.tbl 17 Jun 2004 11:12:03 -0000 1.63
@@ -1,4 +1,4 @@
-# $Id: vtable.tbl,v 1.62 2004/05/18 13:03:10 leo Exp $
+# $Id: vtable.tbl,v 1.63 2004/06/17 11:12:03 leo Exp $
# [MAIN] #default section name
void init()
@@ -57,6 +57,7 @@
PMC* get_pmc_keyed(PMC* key)
PMC* get_pmc_keyed_int(INTVAL key)
PMC* get_pmc_keyed_str(STRING* key)
+PMC* slice(PMC* key)
void* get_pointer()
void* get_pointer_keyed(PMC* key)