summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Prymmer <PPrymmer@factset.com>1999-07-01 12:31:24 -0700
committerGurusamy Sarathy <gsar@cpan.org>1999-07-18 05:22:36 +0000
commitda0838f1870c5338e6bf9ab745ef01fde1406476 (patch)
treecfa7932aec9307ac21bc6678ab177c24e421e007
parent9efbc0eb9ef0a7b1489f59143775f10b17cd372d (diff)
downloadperl-da0838f1870c5338e6bf9ab745ef01fde1406476.tar.gz
[ID 19990701.031] 4 ctl chars on EBCDIC not asciiish enough
Message-Id: <9907020231.AA16942@forte.com> p4raw-id: //depot/perl@3697
-rw-r--r--MANIFEST1
-rw-r--r--ebcdic.c8
-rwxr-xr-xt/op/chars.t74
-rwxr-xr-xt/op/ord.t2
4 files changed, 83 insertions, 2 deletions
diff --git a/MANIFEST b/MANIFEST
index 023b51f7b3..7634f8d649 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -1184,6 +1184,7 @@ t/op/assignwarn.t See if OP= operators warn correctly for undef targets
t/op/auto.t See if autoincrement et all work
t/op/avhv.t See if pseudo-hashes work
t/op/bop.t See if bitops work
+t/op/chars.t See if character escapes work
t/op/chop.t See if chop works
t/op/closure.t See if closures work
t/op/cmp.t See if the various string and numeric compare work
diff --git a/ebcdic.c b/ebcdic.c
index d74351078d..d86d50bd32 100644
--- a/ebcdic.c
+++ b/ebcdic.c
@@ -25,6 +25,14 @@ ebcdic_control(int ch)
} else { /* Want uncontrol */
if (ch == '\177' || ch == -1)
return('?');
+ else if (ch == '\157')
+ return('\177');
+ else if (ch == '\174')
+ return('\000');
+ else if (ch == '^') /* '\137' in 1047, '\260' in 819 */
+ return('\036');
+ else if (ch == '\155')
+ return('\037');
else if (0 < ch && ch < (sizeof(controllablechars) - 1))
return(controllablechars[ch+1]);
else
diff --git a/t/op/chars.t b/t/op/chars.t
new file mode 100755
index 0000000000..efdea027bb
--- /dev/null
+++ b/t/op/chars.t
@@ -0,0 +1,74 @@
+#!./perl
+
+print "1..33\n";
+
+# because of ebcdic.c these should be the same on asciiish
+# and ebcdic machines.
+# Peter Prymmer <pvhp@best.com>.
+
+my $c = "\c@";
+print +((ord($c) == 0) ? "" : "not "),"ok 1\n";
+$c = "\cA";
+print +((ord($c) == 1) ? "" : "not "),"ok 2\n";
+$c = "\cB";
+print +((ord($c) == 2) ? "" : "not "),"ok 3\n";
+$c = "\cC";
+print +((ord($c) == 3) ? "" : "not "),"ok 4\n";
+$c = "\cD";
+print +((ord($c) == 4) ? "" : "not "),"ok 5\n";
+$c = "\cE";
+print +((ord($c) == 5) ? "" : "not "),"ok 6\n";
+$c = "\cF";
+print +((ord($c) == 6) ? "" : "not "),"ok 7\n";
+$c = "\cG";
+print +((ord($c) == 7) ? "" : "not "),"ok 8\n";
+$c = "\cH";
+print +((ord($c) == 8) ? "" : "not "),"ok 9\n";
+$c = "\cI";
+print +((ord($c) == 9) ? "" : "not "),"ok 10\n";
+$c = "\cJ";
+print +((ord($c) == 10) ? "" : "not "),"ok 11\n";
+$c = "\cK";
+print +((ord($c) == 11) ? "" : "not "),"ok 12\n";
+$c = "\cL";
+print +((ord($c) == 12) ? "" : "not "),"ok 13\n";
+$c = "\cM";
+print +((ord($c) == 13) ? "" : "not "),"ok 14\n";
+$c = "\cN";
+print +((ord($c) == 14) ? "" : "not "),"ok 15\n";
+$c = "\cO";
+print +((ord($c) == 15) ? "" : "not "),"ok 16\n";
+$c = "\cP";
+print +((ord($c) == 16) ? "" : "not "),"ok 17\n";
+$c = "\cQ";
+print +((ord($c) == 17) ? "" : "not "),"ok 18\n";
+$c = "\cR";
+print +((ord($c) == 18) ? "" : "not "),"ok 19\n";
+$c = "\cS";
+print +((ord($c) == 19) ? "" : "not "),"ok 20\n";
+$c = "\cT";
+print +((ord($c) == 20) ? "" : "not "),"ok 21\n";
+$c = "\cU";
+print +((ord($c) == 21) ? "" : "not "),"ok 22\n";
+$c = "\cV";
+print +((ord($c) == 22) ? "" : "not "),"ok 23\n";
+$c = "\cW";
+print +((ord($c) == 23) ? "" : "not "),"ok 24\n";
+$c = "\cX";
+print +((ord($c) == 24) ? "" : "not "),"ok 25\n";
+$c = "\cY";
+print +((ord($c) == 25) ? "" : "not "),"ok 26\n";
+$c = "\cZ";
+print +((ord($c) == 26) ? "" : "not "),"ok 27\n";
+$c = "\c[";
+print +((ord($c) == 27) ? "" : "not "),"ok 28\n";
+$c = "\c\\";
+print +((ord($c) == 28) ? "" : "not "),"ok 29\n";
+$c = "\c]";
+print +((ord($c) == 29) ? "" : "not "),"ok 30\n";
+$c = "\c^";
+print +((ord($c) == 30) ? "" : "not "),"ok 31\n";
+$c = "\c_";
+print +((ord($c) == 31) ? "" : "not "),"ok 32\n";
+$c = "\c?";
+print +((ord($c) == 127) ? "" : "not "),"ok 33\n";
diff --git a/t/op/ord.t b/t/op/ord.t
index ba943f4e8c..bc6d924554 100755
--- a/t/op/ord.t
+++ b/t/op/ord.t
@@ -1,7 +1,5 @@
#!./perl
-# $RCSfile: ord.t,v $$Revision: 4.1 $$Date: 92/08/07 18:28:09 $
-
print "1..3\n";
# compile time evaluation