summaryrefslogtreecommitdiff
path: root/dist/IO
diff options
context:
space:
mode:
authorKarl Williamson <public@khwilliamson.com>2014-03-04 16:13:36 -0700
committerKarl Williamson <public@khwilliamson.com>2014-03-04 16:40:51 -0700
commit6ed60307ec0bd14728ad72c8f6fb4c27112cbff6 (patch)
tree6e7060e19f68c73a21748d75cbd6658eb9439e1b /dist/IO
parent45479970582e5de29004c3c1ae1e0a4274843567 (diff)
downloadperl-6ed60307ec0bd14728ad72c8f6fb4c27112cbff6.tar.gz
dist/IO: Allow to be dual-lived
This dual-lived module has not been able to be compiled on releases earlier than 5.10.1 since, I believe, that release, and not outside of blead since commit 6f2d5cbc in the 5.19 series, both due to using macros that were not backported. This commit suitably defines the current missing macro when it isn't available.
Diffstat (limited to 'dist/IO')
-rw-r--r--dist/IO/IO.pm2
-rw-r--r--dist/IO/IO.xs25
2 files changed, 26 insertions, 1 deletions
diff --git a/dist/IO/IO.pm b/dist/IO/IO.pm
index 6edf83c4a4..ba89f0c8e6 100644
--- a/dist/IO/IO.pm
+++ b/dist/IO/IO.pm
@@ -7,7 +7,7 @@ use Carp;
use strict;
use warnings;
-our $VERSION = "1.30";
+our $VERSION = "1.31";
XSLoader::load 'IO', $VERSION;
sub import {
diff --git a/dist/IO/IO.xs b/dist/IO/IO.xs
index 360b067af2..9056cb648d 100644
--- a/dist/IO/IO.xs
+++ b/dist/IO/IO.xs
@@ -69,6 +69,31 @@ not_here(const char *s)
NORETURN_FUNCTION_END;
}
+#ifndef UVCHR_IS_INVARIANT /* For use with Perls without this macro */
+# if ('A' == 65)
+# define UVCHR_IS_INVARIANT(cp) ((cp) < 128)
+# elif (defined(NATIVE_IS_INVARIANT)) /* EBCDIC on old Perl */
+# define UVCHR_IS_INVARIANT(cp) ((cp) < 256 && NATIVE_IS_INVARIANT(cp))
+# elif defined(isASCII) /* EBCDIC on very old Perl */
+ /* In EBCDIC, the invariants are the code points corresponding to ASCII,
+ * plus all the controls. All but one EBCDIC control is below SPACE; it
+ * varies depending on the code page, determined by the ord of '^' */
+# define UVCHR_IS_INVARIANT(cp) (isASCII(cp) \
+ || (cp) < ' ' \
+ || (('^' == 106) /* POSIX-BC */ \
+ ? (cp) == 95 \
+ : (cp) == 0xFF)) /* 1047 or 037 */
+# else /* EBCDIC on very very old Perl */
+ /* This assumes isascii() is available, but that could be fixed by
+ * having the macro test for each printable ASCII char */
+# define UVCHR_IS_INVARIANT(cp) (isascii(cp) \
+ || (cp) < ' ' \
+ || (('^' == 106) /* POSIX-BC */ \
+ ? (cp) == 95 \
+ : (cp) == 0xFF)) /* 1047 or 037 */
+# endif
+#endif
+
#ifndef PerlIO
#define PerlIO_fileno(f) fileno(f)