Change 14451 by jhi@alpha on 2002/01/27 21:47:29
B::cstring() and B::Deparse EBCDIC fixes from Rafael Garcia-Suarez.
Affected files ...
.... //depot/perl/ext/B/B.xs#67 edit
.... //depot/perl/ext/B/B/Deparse.pm#105 edit
Differences ...
==== //depot/perl/ext/B/B.xs#67 (text) ====
Index: perl/ext/B/B.xs
--- perl/ext/B/B.xs.~1~ Sun Jan 27 15:00:06 2002
+++ perl/ext/B/B.xs Sun Jan 27 15:00:06 2002
@@ -251,7 +251,11 @@
sprintf(escbuff, "\\%03o", '?');
sv_catpv(sstr, escbuff);
}
- else if (*s >= ' ' && *s < 127) /* XXX not portable */
+#ifdef EBCDIC
+ else if (isPRINT(*s))
+#else
+ else if (*s >= ' ' && *s < 127)
+#endif /* EBCDIC */
sv_catpvn(sstr, s, 1);
else if (*s == '\n')
sv_catpv(sstr, "\\n");
@@ -292,7 +296,11 @@
sv_catpv(sstr, "\\'");
else if (*s == '\\')
sv_catpv(sstr, "\\\\");
- else if (*s >= ' ' && *s < 127) /* XXX not portable */
+#ifdef EBCDIC
+ else if (isPRINT(8s))
+#else
+ else if (*s >= ' ' && *s < 127)
+#endif /* EBCDIC */
sv_catpvn(sstr, s, 1);
else if (*s == '\n')
sv_catpv(sstr, "\\n");
==== //depot/perl/ext/B/B/Deparse.pm#105 (text) ====
Index: perl/ext/B/B/Deparse.pm
--- perl/ext/B/B/Deparse.pm.~1~ Sun Jan 27 15:00:06 2002
+++ perl/ext/B/B/Deparse.pm Sun Jan 27 15:00:06 2002
@@ -3074,7 +3074,7 @@
my($str) = @_;
# the insane complexity here is due to the behaviour of "\c\"
- $str =~ s/(^|[^\\]|\\c\\)(?<!\\c)\\(\\\\)*(?=[\0-\031\177-\377])/$1$2/g;
+ $str =~ s/(^|[^\\]|\\c\\)(?<!\\c)\\(\\\\)*(?=[^[:print:]])/$1$2/g;
return $str;
}
End of Patch.