[svn:parrot] r39272 - trunk/compilers/pct/src/PCT

pmichaud at svn.parrot.org pmichaud at svn.parrot.org
Sat May 30 15:39:18 UTC 2009


Author: pmichaud
Date: Sat May 30 15:39:18 2009
New Revision: 39272
URL: https://trac.parrot.org/parrot/changeset/39272

Log:
[pct]:  Update transcode option to HLLCompiler
* Allow multiple transcoding attempts
* Allow changing encoding as well as charset

Modified:
   trunk/compilers/pct/src/PCT/HLLCompiler.pir

Modified: trunk/compilers/pct/src/PCT/HLLCompiler.pir
==============================================================================
--- trunk/compilers/pct/src/PCT/HLLCompiler.pir	Sat May 30 14:46:18 2009	(r39271)
+++ trunk/compilers/pct/src/PCT/HLLCompiler.pir	Sat May 30 15:39:18 2009	(r39272)
@@ -326,13 +326,31 @@
     .local string tcode
     tcode = adverbs['transcode']
     unless tcode goto transcode_done
-    push_eh transcode_skip
+    .local pmc tcode_it
+    $P0 = split ' ', tcode
+    tcode_it = iter $P0
+  tcode_loop:
+    unless tcode_it goto transcode_done
+    tcode = shift tcode_it
+    push_eh tcode_enc
     $I0 = find_charset tcode
     $S0 = source
     $S0 = trans_charset $S0, $I0
     assign source, $S0
-  transcode_skip:
     pop_eh
+    goto transcode_done
+  tcode_enc:
+    pop_eh
+    push_eh tcode_fail
+    $I0 = find_encoding tcode
+    $S0 = source
+    $S0 = trans_encoding $S0, $I0
+    assign source, $S0
+    pop_eh
+    goto transcode_done
+  tcode_fail:
+    pop_eh
+    goto tcode_loop
   transcode_done:
 
     .local string target


More information about the parrot-commits mailing list