# New Ticket Created by Nick Wellnhofer # Please include the string: [perl #78652] # in the subject line of all future correspondence about this issue. # <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=78652 >
Here is a set of patches that fix some Parrot deprecations. They should be self-explanatory. Nick
>From 58b4567ad2ba261922f4f99ce6b18dfbcbe237f7 Mon Sep 17 00:00:00 2001 From: Nick Wellnhofer <wellnho...@aevum.de> Date: Fri, 10 Sep 2010 20:04:50 +0200 Subject: [PATCH 1/4] Don't use deprecated charset opcodes --- src/core/Str.pm | 12 ++++-------- 1 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/core/Str.pm b/src/core/Str.pm index d07e71a..d507752 100644 --- a/src/core/Str.pm +++ b/src/core/Str.pm @@ -20,23 +20,19 @@ augment class Str does Stringy { $S0 = $P0 $P1 = find_lex '$encoding' $S1 = $P1 - if $S1 == 'ascii' goto transcode_ascii - if $S1 == 'iso-88591-1' goto transcode_iso_8859_1 + if $S1 == 'ascii' goto transcode_ascii + if $S1 == 'iso-8859-1' goto transcode_iso_8859_1 # NOTE: There's an assumption here, that all strings coming in # from the rest of Rakudo are always in UTF-8 form. Don't # know if this assumption always holds; to be on the safe # side, we might transcode even to UTF-8. goto finished_transcoding transcode_ascii: - $I0 = find_charset 'ascii' - $S0 = trans_charset $S0, $I0 - $I0 = find_encoding 'fixed_8' + $I0 = find_encoding 'ascii' $S0 = trans_encoding $S0, $I0 goto finished_transcoding transcode_iso_8859_1: - $I0 = find_charset 'iso-8859-1' - $S0 = trans_charset $S0, $I0 - $I0 = find_encoding 'fixed_8' + $I0 = find_encoding 'iso-8859-1' $S0 = trans_encoding $S0, $I0 finished_transcoding: bytebuffer = new ['ByteBuffer'] -- 1.7.2.3
>From 24d11543e2564fb1083c1be7cfd0384c70cd87ec Mon Sep 17 00:00:00 2001 From: Nick Wellnhofer <wellnho...@aevum.de> Date: Sun, 3 Oct 2010 03:28:29 +0200 Subject: [PATCH 2/4] Replace string_ord with Parrot_str_indexed --- src/ops/perl6.ops | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/ops/perl6.ops b/src/ops/perl6.ops index 7c6f801..3b9cde4 100644 --- a/src/ops/perl6.ops +++ b/src/ops/perl6.ops @@ -233,7 +233,7 @@ inline op x_is_uprop(out INT, in STR, in STR, in INT) :base_core { goto NEXT(); } - ord = string_ord(interp, $3, $4); + ord = Parrot_str_indexed(interp, $3, $4); cstr = Parrot_str_to_cstring(interp, $2); /* try block tests */ -- 1.7.2.3
From bb2fa454b0b182787c79ab723ec296fe0c4ea2a9 Mon Sep 17 00:00:00 2001 From: Nick Wellnhofer <wellnho...@aevum.de> Date: Sun, 10 Oct 2010 02:31:45 +0200 Subject: [PATCH 3/4] Switch to utf8:"" PIR string literals --- src/Perl6/Compiler/Signature.pm | 4 ++-- src/builtins/Str.pir | 2 +- src/core/Buf.pm | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Perl6/Compiler/Signature.pm b/src/Perl6/Compiler/Signature.pm index 84771a5..4a294c2 100644 --- a/src/Perl6/Compiler/Signature.pm +++ b/src/Perl6/Compiler/Signature.pm @@ -306,13 +306,13 @@ method ast($low_level?) { my $names := $null_reg; if +@($_.names) { my $pir := " %r = root_new ['parrot'; 'ResizableStringArray']\n"; - for @($_.names) { $pir := $pir ~ ' push %r, unicode:"' ~ ~$_ ~ "\"\n"; } + for @($_.names) { $pir := $pir ~ ' push %r, utf8:"' ~ ~$_ ~ "\"\n"; } $names := PAST::Op.new( :inline($pir) ); } my $type_captures := $null_reg; if +@($_.type_captures) { my $pir := " %r = root_new ['parrot'; 'ResizableStringArray']\n"; - for @($_.type_captures) { $pir := $pir ~ ' push %r, unicode:"' ~ ~$_ ~ "\"\n"; } + for @($_.type_captures) { $pir := $pir ~ ' push %r, utf8:"' ~ ~$_ ~ "\"\n"; } $type_captures := PAST::Op.new( :inline($pir) ); } diff --git a/src/builtins/Str.pir b/src/builtins/Str.pir index 3a56ade..d7d9d41 100644 --- a/src/builtins/Str.pir +++ b/src/builtins/Str.pir @@ -93,7 +93,7 @@ Increment and Decrement Methods ## Note that in each cycle, the first character of the cycle is repeated ## at the end of the cycle (to indicate carries). -.const string RANGES = unicode:"01234567890ABCDEFGHIJKLMNOPQRSTUVWXYZAabcdefghijklmnopqrstuvwxyza\u0391\u0392\u0393\u0394\u0395\u0396\u0397\u0398\u0399\u039a\u039b\u039c\u039d\u039e\u039f\u03a0\u03a1\u03a3\u03a4\u03a5\u03a6\u03a7\u03a8\u03a9\u0391\u03b1\u03b2\u03b3\u03b4\u03b5\u03b6\u03b7\u03b8\u03b9\u03ba\u03bb\u03bc\u03bd\u03be\u03bf\u03c0\u03c1\u03c3\u03c4\u03c5\u03c6\u03c7\u03c8\u03c9\u03b1\u2160\u2161\u2162\u2163\u2164\u2165\u2166\u2167\u2168\u2169\u216a\u216b\u2160\u2170\u2171\u2172\u2173\u2174\u2175\u2176\u2177\u2178\u2179\u217a\u217b\u2170\u2460\u2461\u2462\u2463\u2464\u2465\u2466\u2467\u2468\u2469\u246a\u246b\u246c\u246d\u246e\u246f\u2470\u2471\u2472\u2473\u2460\u2474\u2475\u2476\u2477\u2478\u2479\u247a\u247b\u247c\u247d\u247e\u247f\u2480\u2481\u2482\u2483\u2484\u2485\u2486\u2487\u2474\u249c\u249d\u249e\u249f\u24a0\u24a1\u24a2\u24a3\u24a4\u24a5\u24a6\u24a7\u24a8\u24a9\u24aa\u24ab\u24ac\u24ad\u24ae\u24af\u24b0\u24b1\u24b2\u24b3\u24b4\u24b5\u249c\u2680\u2681\u2682\u2683\u2684\u2685\u2680" +.const string RANGES = utf8:"01234567890ABCDEFGHIJKLMNOPQRSTUVWXYZAabcdefghijklmnopqrstuvwxyza\u0391\u0392\u0393\u0394\u0395\u0396\u0397\u0398\u0399\u039a\u039b\u039c\u039d\u039e\u039f\u03a0\u03a1\u03a3\u03a4\u03a5\u03a6\u03a7\u03a8\u03a9\u0391\u03b1\u03b2\u03b3\u03b4\u03b5\u03b6\u03b7\u03b8\u03b9\u03ba\u03bb\u03bc\u03bd\u03be\u03bf\u03c0\u03c1\u03c3\u03c4\u03c5\u03c6\u03c7\u03c8\u03c9\u03b1\u2160\u2161\u2162\u2163\u2164\u2165\u2166\u2167\u2168\u2169\u216a\u216b\u2160\u2170\u2171\u2172\u2173\u2174\u2175\u2176\u2177\u2178\u2179\u217a\u217b\u2170\u2460\u2461\u2462\u2463\u2464\u2465\u2466\u2467\u2468\u2469\u246a\u246b\u246c\u246d\u246e\u246f\u2470\u2471\u2472\u2473\u2460\u2474\u2475\u2476\u2477\u2478\u2479\u247a\u247b\u247c\u247d\u247e\u247f\u2480\u2481\u2482\u2483\u2484\u2485\u2486\u2487\u2474\u249c\u249d\u249e\u249f\u24a0\u24a1\u24a2\u24a3\u24a4\u24a5\u24a6\u24a7\u24a8\u24a9\u24aa\u24ab\u24ac\u24ad\u24ae\u24af\u24b0\u24b1\u24b2\u24b3\u24b4\u24b5\u249c\u2680\u2681\u2682\u2683\u2684\u2685\u2680" .sub '!range_pos' :anon .param string str diff --git a/src/core/Buf.pm b/src/core/Buf.pm index 1ef45e3..3198f3d 100644 --- a/src/core/Buf.pm +++ b/src/core/Buf.pm @@ -25,7 +25,7 @@ role Buf[::T = Int] does Stringy does Positional { inc i goto loop done: - s = bb.'get_string_as'(utf8:unicode:" ") + s = bb.'get_string_as'(utf8:" ") %r = box s }; return $str; -- 1.7.2.3
>From cc9da103aa1afb372d92ba1f4b278cd005212dbb Mon Sep 17 00:00:00 2001 From: Nick Wellnhofer <wellnho...@aevum.de> Date: Mon, 18 Oct 2010 19:24:23 +0200 Subject: [PATCH 4/4] Use UTF-8 encoding in get_module_info --- src/Perl6/Module/Locator.pm | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/src/Perl6/Module/Locator.pm b/src/Perl6/Module/Locator.pm index 4757f25..ac3ce2b 100644 --- a/src/Perl6/Module/Locator.pm +++ b/src/Perl6/Module/Locator.pm @@ -46,6 +46,7 @@ method get_module_info($filename) { # Read in file and parse it. my $fh := pir::open__PSS($filename, 'r'); + $fh.encoding('utf8'); my $source := $fh.readall(); $fh.close(); my $actions := Perl6::Module::VersionDetectionActions.new(); -- 1.7.2.3