From: Jarkko Hietaniemi Date: Sun, 3 Mar 2002 19:00:06 +0000 (+0000) Subject: EBCDIC: deparse \cX correctly. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=57aa3c4e03f4cbb463b4d524a054cc846d837648;p=p5sagit%2Fp5-mst-13.2.git EBCDIC: deparse \cX correctly. p4raw-id: //depot/perl@14968 --- diff --git a/ext/B/B/Deparse.pm b/ext/B/B/Deparse.pm index ec84a50..14269ad 100644 --- a/ext/B/B/Deparse.pm +++ b/ext/B/B/Deparse.pm @@ -3043,6 +3043,41 @@ sub re_uninterp_extended { } } +my %unctrl = # portable to to EBCDIC + ( + "\c@" => '\c@', # unused + "\cA" => '\cA', + "\cB" => '\cB', + "\cC" => '\cC', + "\cD" => '\cD', + "\cE" => '\cE', + "\cF" => '\cF', + "\cG" => '\cG', + "\cH" => '\cH', + "\cI" => '\cI', + "\cJ" => '\cJ', + "\cK" => '\cK', + "\cL" => '\cL', + "\cM" => '\cM', + "\cN" => '\cN', + "\cO" => '\cO', + "\cP" => '\cP', + "\cQ" => '\cQ', + "\cR" => '\cR', + "\cS" => '\cS', + "\cT" => '\cT', + "\cU" => '\cU', + "\cV" => '\cV', + "\cW" => '\cW', + "\cX" => '\cX', + "\cY" => '\cY', + "\cZ" => '\cZ', + "\c[" => '\c[', # unused + "\c\\" => '\c\\', # unused + "\c]" => '\c]', # unused + "\c_" => '\c_', # unused + ); + # character escapes, but not delimiters that might need to be escaped sub escape_str { # ASCII, UTF8 my($str) = @_; @@ -3054,7 +3089,8 @@ sub escape_str { # ASCII, UTF8 $str =~ s/\e/\\e/g; $str =~ s/\f/\\f/g; $str =~ s/\r/\\r/g; - $str =~ s/([\cA-\cZ])/sprintf("\\c%c", ord('@') + ord($1))/ge; + # The funny gaps are for the benefit of EBCDIC. + $str =~ s/([\cA-\cI\cJ-\cR\cS-\cZ])/$unctrl{$1}/ge; $str =~ s/([[:^print:]])/sprintf("\\%03o", ord($1))/ge; return $str; }