[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[7545] move UTF-8 check into Paragraph.pm
From: |
gavinsmith0123 |
Subject: |
[7545] move UTF-8 check into Paragraph.pm |
Date: |
Sat, 10 Dec 2016 16:42:03 +0000 (UTC) |
Revision: 7545
http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=7545
Author: gavin
Date: 2016-12-10 16:42:02 +0000 (Sat, 10 Dec 2016)
Log Message:
-----------
move UTF-8 check into Paragraph.pm
Modified Paths:
--------------
trunk/ChangeLog
trunk/tp/Texinfo/Convert/Paragraph.pm
trunk/tp/Texinfo/XSLoader.pm
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2016-12-10 16:02:55 UTC (rev 7544)
+++ trunk/ChangeLog 2016-12-10 16:42:02 UTC (rev 7545)
@@ -1,5 +1,12 @@
2016-12-11 Gavin Smith <address@hidden>
+ * tp/Texinfo/XSLoader.pm,
+ * tp/Texinfo/Convert/Paragraph.pm: Move check for UTF-8 locale
+ into Paragraph.pm, and allow it to pass strings into XSLoader.pm
+ to print messages for debugging purposes.
+
+2016-12-11 Gavin Smith <address@hidden>
+
* tp/Texinfo/XSLoader.pm: New file.
* tp/Texinfo/Convert/Paragraph.pm: Move all the code into
XSLoader.pm. This is intended to allow the code for loading XS
Modified: trunk/tp/Texinfo/Convert/Paragraph.pm
===================================================================
--- trunk/tp/Texinfo/Convert/Paragraph.pm 2016-12-10 16:02:55 UTC (rev
7544)
+++ trunk/tp/Texinfo/Convert/Paragraph.pm 2016-12-10 16:42:02 UTC (rev
7545)
@@ -25,12 +25,28 @@
use Texinfo::XSLoader;
BEGIN {
+ our $warning_message = undef;
+ our $fatal_message = undef;
+ # Check for a UTF-8 locale. Skip the check if the 'locale' command doesn't
+ # work.
+ our $a;
+ if ($^O ne 'MSWin32') {
+ $a = `locale -a 2>/dev/null`;
+ }
+ if ($a and $a !~ /UTF-8/ and $a !~ /utf8/) {
+ $fatal_message = "couldn't find a UTF-8 locale";
+ }
+ if (!$a) {
+ $warning_message = "couldn't run 'locale -a': skipping check for a UTF-8
locale";
+ }
Texinfo::XSLoader::init (
"Texinfo::Convert::Paragraph",
"Texinfo::Convert::XSParagraph::XSParagraph",
"Texinfo::Convert::ParagraphNonXS",
"Paragraph",
- 1
+ 1,
+ $warning_message,
+ $fatal_message
);
}
Modified: trunk/tp/Texinfo/XSLoader.pm
===================================================================
--- trunk/tp/Texinfo/XSLoader.pm 2016-12-10 16:02:55 UTC (rev 7544)
+++ trunk/tp/Texinfo/XSLoader.pm 2016-12-10 16:42:02 UTC (rev 7545)
@@ -25,6 +25,8 @@
our $VERSION = '6.2';
+our $disable_XS;
+
# For verbose information about what's being done
sub _debug($) {
if ($TEXINFO_XS eq 'debug') {
@@ -66,16 +68,20 @@
# The value used for the .xs file compilation is set in configure.ac.
# Both should correspond, but it should be manually changed here to make
# sure that a changed interface has not been missed.
- $interface_version
+ $interface_version,
+ $warning_message,
+ $fatal_message
) = @_;
# Possible values for TEXINFO_XS environment variable:
#
# TEXINFO_XS=omit # don't try loading xs at all
- # TEXINFO_XS=default # try xs, libtool and then perl paths, silent
fallback
+ # TEXINFO_XS=default # try xs, libtool and then perl paths,
+ # # silent fallback
# TEXINFO_XS=libtool # try xs, libtool only, silent fallback
# TEXINFO_XS=standalone # try xs, perl paths only, silent fallback
- # TEXINFO_XS=warn # try xs, libtool and then perl paths, warn on
failure
+ # TEXINFO_XS=warn # try xs, libtool and then perl paths, warn
+ # # on failure
# TEXINFO_XS=required # abort if not loadable, no fallback
# TEXINFO_XS=debug # voluminuous debugging
#
@@ -91,27 +97,20 @@
goto FALLBACK;
}
- our $disable_XS;
if ($disable_XS) {
_fatal "use of XS modules was disabled when Texinfo was built";
goto FALLBACK;
}
-
- # Check for a UTF-8 locale. Skip the check if the 'locale' command doesn't
- # work.
- my $a;
- if ($^O ne 'MSWin32') {
- $a = `locale -a 2>/dev/null`;
+
+ if ($warning_message) {
+ _debug $warning_message;
}
- if ($a and $a !~ /UTF-8/ and $a !~ /utf8/) {
- _fatal "couldn't find a UTF-8 locale";
+
+ if ($fatal_message) {
+ _fatal $fatal_message;
goto FALLBACK;
}
- if (!$a) {
- _debug "couldn't run 'locale -a': skipping check for a UTF-8 locale";
- }
-
my ($libtool_dir, $libtool_archive);
if ($TEXINFO_XS ne 'standalone') {
($libtool_dir, $libtool_archive) = _find_file("XS$module_name.la");
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [7545] move UTF-8 check into Paragraph.pm,
gavinsmith0123 <=