Change 11371 by jhi@alpha on 2001/07/14 09:18:09
Subject: patch to add DEL to [:cntrl:]
From: Jeffrey Friedl <[EMAIL PROTECTED]>
Date: Fri, 13 Jul 2001 23:25:12 -0700 (PDT)
Message-Id: <[EMAIL PROTECTED]>
Affected files ...
... //depot/perl/handy.h#47 edit
... //depot/perl/pod/perlre.pod#64 edit
... //depot/perl/regcomp.c#220 edit
... //depot/perl/t/op/pat.t#107 edit
Differences ...
==== //depot/perl/handy.h#47 (text) ====
Index: perl/handy.h
--- perl/handy.h.~1~ Sat Jul 14 03:30:05 2001
+++ perl/handy.h Sat Jul 14 03:30:05 2001
@@ -341,7 +341,7 @@
# define isLOWER(c) ((c) >= 'a' && (c) <= 'z')
# define isALNUMC(c) (isALPHA(c) || isDIGIT(c))
# define isASCII(c) ((c) <= 127)
-# define isCNTRL(c) ((c) < ' ')
+# define isCNTRL(c) ((c) < ' ' || (c) == 127)
# define isGRAPH(c) (isALNUM(c) || isPUNCT(c))
# define isPRINT(c) (((c) > 32 && (c) < 127) || (c) == ' ')
# define isPUNCT(c) (((c) >= 33 && (c) <= 47) || ((c) >= 58 && (c) <= 64) || ((c)
>= 91 && (c) <= 96) || ((c) >= 123 && (c) <= 126))
==== //depot/perl/pod/perlre.pod#64 (text) ====
Index: perl/pod/perlre.pod
--- perl/pod/perlre.pod.~1~ Sat Jul 14 03:30:05 2001
+++ perl/pod/perlre.pod Sat Jul 14 03:30:05 2001
@@ -260,7 +260,8 @@
such but instead control the terminal somehow: for example newline and
backspace are control characters. All characters with ord() less than
32 are most often classified as control characters (assuming ASCII,
-the ISO Latin character sets, and Unicode).
+the ISO Latin character sets, and Unicode), as is the character with
+the ord() value of 127 (C<DEL>).
=item graph
==== //depot/perl/regcomp.c#220 (text) ====
Index: perl/regcomp.c
--- perl/regcomp.c.~1~ Sat Jul 14 03:30:05 2001
+++ perl/regcomp.c Sat Jul 14 03:30:05 2001
@@ -4351,7 +4351,7 @@
STATIC void
S_put_byte(pTHX_ SV *sv, int c)
{
- if (isCNTRL(c) || c == 127 || c == 255 || !isPRINT(c))
+ if (isCNTRL(c) || c == 255 || !isPRINT(c))
Perl_sv_catpvf(aTHX_ sv, "\\%o", c);
else if (c == '-' || c == ']' || c == '\\' || c == '^')
Perl_sv_catpvf(aTHX_ sv, "\\%c", c);
==== //depot/perl/t/op/pat.t#107 (xtext) ====
Index: perl/t/op/pat.t
--- perl/t/op/pat.t.~1~ Sat Jul 14 03:30:05 2001
+++ perl/t/op/pat.t Sat Jul 14 03:30:05 2001
@@ -6,7 +6,7 @@
$| = 1;
-print "1..672\n";
+print "1..674\n";
BEGIN {
chdir 't' if -d 't';
@@ -1929,3 +1929,17 @@
print "ok 672\n";
+##
+## Test [:cntrl:]...
+##
+## Should probably put in tests for all the POSIX stuff, but not sure how to
+## guarantee a specific locale......
+##
+$AllBytes = join('', map { chr($_) } 0..255);
+($x = $AllBytes) =~ s/[[:cntrl:]]//g;
+if ($x ne join('', map { chr($_) } 0x20..0x7E, 0x80..0xFF)) { print "not " };
+print "ok 673\n";
+
+($x = $AllBytes) =~ s/[^[:cntrl:]]//g;
+if ($x ne join('', map { chr($_) } 0..0x1F, 0x7F)) { print "not " };
+print "ok 674\n";
End of Patch.