PERL CVS PARROT 43 CVS COMMIT PARROT RUNTIME PARROT LIBRARY DATA ESCAPE IMC
Date: 1 Mar 2005 13:01:07 -0000

Subject: cvs commit: parrot/runtime/parrot/library/Data Escape.imc
From: jrieks@no-spam (Jens Rieks)

cvsuser 05/03/01 05:01:07

Modified: runtime/parrot/library/Data Escape.imc Log:
fixed escaping of binary data Revision Changes Path 1.5 +13 -7 parrot/runtime/parrot/library/Data/Escape.imc Index: Escape.imc ===================================================================
RCS file: /cvs/public/parrot/runtime/parrot/library/Data/Escape.imc,v retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- Escape.imc 21 Nov 2004 20:38:39 -0000 1.4
+++ Escape.imc 1 Mar 2005 13:01:07 -0000 1.5
@@no-spam -35,7 +35,7 @@no-spam =over 4
-=item C<string>
+=item C<str>
The string to escape.
@@no-spam -54,7 +54,7 @@no-spam .sub String .param string str .param string char - .param string ret + .local string ret .local int i .local int j .local int c @@no-spam -69,7 +69,7 @@no-spam ord c, tmp if c > 40 goto gt40
- if c > 30 goto gt30
+ if c > 31 goto gt31
if c > 0 goto n00
set tmp, "\\0"
@@no-spam -94,7 +94,15 @@no-spam branch DONE n13:
-gt30: # ascii codes greater than 30 below + # encode the value as an octal number + tmp = "\\"
+ $P0 = new .PerlArray + push $P0, c + $S0 = sprintf "%o", $P0
+ concat tmp, $S0
+ branch DONE + +gt31: # ascii codes greater than 31 below # "
ne char, '"', n34
@@no-spam -121,9 +129,7 @@no-spam inc i branch LOOP END:
- .pcc_begin_return - .return ret - .pcc_end_return + .return(ret)
.end =back