[svn:parrot] r39854 - in trunk: src/string t/op
NotFound at svn.parrot.org
NotFound at svn.parrot.org
Wed Jul 1 13:50:15 UTC 2009
Author: NotFound
Date: Wed Jul 1 13:50:14 2009
New Revision: 39854
URL: https://trac.parrot.org/parrot/changeset/39854
Log:
[core] respect HLL mappings in split, TT #794
Modified:
trunk/src/string/api.c
trunk/t/op/string.t
Modified: trunk/src/string/api.c
==============================================================================
--- trunk/src/string/api.c Wed Jul 1 12:30:43 2009 (r39853)
+++ trunk/src/string/api.c Wed Jul 1 13:50:14 2009 (r39854)
@@ -3340,8 +3340,8 @@
=item C<PMC* Parrot_str_split(PARROT_INTERP, STRING *delim, STRING *str)>
Splits the string C<str> at the delimiter C<delim>, returning a
-C<ResizableStringArray> of results. Returns PMCNULL if the string or the
-delimiter is NULL.
+C<ResizableStringArray>, or his mapped type in the current HLL,
+of results. Returns PMCNULL if the string or the delimiter is NULL.
=cut
@@ -3361,7 +3361,7 @@
if (STRING_IS_NULL(delim) || STRING_IS_NULL(str))
return PMCNULL;
- res = pmc_new(interp, enum_class_ResizableStringArray);
+ res = pmc_new(interp, Parrot_get_ctx_HLL_type(interp, enum_class_ResizableStringArray));
slen = Parrot_str_byte_length(interp, str);
if (!slen)
Modified: trunk/t/op/string.t
==============================================================================
--- trunk/t/op/string.t Wed Jul 1 12:30:43 2009 (r39853)
+++ trunk/t/op/string.t Wed Jul 1 13:50:14 2009 (r39854)
@@ -7,7 +7,7 @@
use lib qw( . lib ../lib ../../lib );
use Test::More;
-use Parrot::Test tests => 165;
+use Parrot::Test tests => 166;
use Parrot::Config;
=head1 NAME
@@ -2639,6 +2639,41 @@
OUTPUT
+pir_output_is( <<'CODE', <<'OUTPUT', 'split HLL mapped' );
+.HLL 'foohll'
+.sub main
+ .local pmc RSA, fooRSA
+ RSA = get_class ['ResizableStringArray']
+ fooRSA = subclass ['ResizableStringArray'], 'fooRSA'
+ .local pmc interp
+ interp = getinterp
+ interp.'hll_map'(RSA, fooRSA)
+ .local pmc a
+ split a, "a", "afooabara"
+ .local string t
+ t = typeof a
+ say t
+ .local int n, i
+ n = a
+ say n
+ i = 0
+loop:
+ .local string s
+ s = a[i]
+ say s
+ inc i
+ if i != n goto loop
+.end
+CODE
+fooRSA
+5
+
+foo
+b
+r
+
+OUTPUT
+
pasm_output_is( <<'CODE', <<'OUTPUT', 'join' );
_main:
new P0, 'ResizablePMCArray'
More information about the parrot-commits
mailing list