summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2002-03-03 19:00:06 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2002-03-03 19:00:06 +0000
commit57aa3c4e03f4cbb463b4d524a054cc846d837648 (patch)
treee0ec2f1a272c8c987ab1885e420170cc20c012b7 /ext
parenta031eab299c8f24c0126bb6a37c6026a28a4548a (diff)
downloadperl-57aa3c4e03f4cbb463b4d524a054cc846d837648.tar.gz
EBCDIC: deparse \cX correctly.
p4raw-id: //depot/perl@14968
Diffstat (limited to 'ext')
-rw-r--r--ext/B/B/Deparse.pm38
1 files changed, 37 insertions, 1 deletions
diff --git a/ext/B/B/Deparse.pm b/ext/B/B/Deparse.pm
index ec84a50db4..14269ad14d 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;
}