cvsuser 04/12/08 16:23:00
Modified: ops string.ops
Log:
[perl #32545] [PATCH] [TODO] remove Perl dependancy on split opcode
changes the split opcode to use an Array
instead of a PerlArray.
It also updates the documentation to note this.
Courtesy James deBoer <[EMAIL PROTECTED]>
Revision Changes Path
1.29 +3 -2 parrot/ops/string.ops
Index: string.ops
===================================================================
RCS file: /cvs/public/parrot/ops/string.ops,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- string.ops 28 Sep 2004 11:26:49 -0000 1.28
+++ string.ops 9 Dec 2004 00:23:00 -0000 1.29
@@ -561,7 +561,7 @@
=item B<split>(out PMC, in STR, in STR)
-Create a new PerlArray PMC $1 by splitting the string $3 with
+Create a new Array PMC $1 by splitting the string $3 with
regexp $2. Currently implemented only for the empty string $2.
=cut
@@ -589,7 +589,7 @@
}
op split(out PMC, in STR, in STR) :base_core {
- PMC *res = $1 = pmc_new(interpreter, enum_class_PerlArray);
+ PMC *res = $1 = pmc_new(interpreter, enum_class_Array);
STRING *r = $2;
STRING *s = $3;
int slen = string_length(interpreter, s);
@@ -599,6 +599,7 @@
goto NEXT();
if (string_length(interpreter, r))
internal_exception(1, "Unimplemented split by regex");
+ VTABLE_set_integer_native(interpreter, res, slen);
for (i = 0; i < slen; ++i) {
STRING *p = string_substr(interpreter, s, i, 1, NULL, 0);
/* TODO first set empty string, then replace */