[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[7631] Paragraph.pm export symbols
From: |
gavinsmith0123 |
Subject: |
[7631] Paragraph.pm export symbols |
Date: |
Sun, 15 Jan 2017 11:19:56 -0500 (EST) |
Revision: 7631
http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=7631
Author: gavin
Date: 2017-01-15 11:19:55 -0500 (Sun, 15 Jan 2017)
Log Message:
-----------
Paragraph.pm export symbols
Modified Paths:
--------------
trunk/ChangeLog
trunk/tp/Texinfo/Convert/Info.pm
trunk/tp/Texinfo/Convert/Paragraph.pm
trunk/tp/Texinfo/Convert/Plaintext.pm
trunk/tp/Texinfo/XSLoader.pm
trunk/tp/t/paragraph.t
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2017-01-14 22:37:18 UTC (rev 7630)
+++ trunk/ChangeLog 2017-01-15 16:19:55 UTC (rev 7631)
@@ -1,3 +1,16 @@
+2017-01-15 Gavin Smith <address@hidden>
+
+ * tp/Texinfo/Convert/Paragraph.pm (import): New function to
+ export symbols. Set it in the symbol table of the paragraph
+ formatting module.
+ * tp/Texinfo/XSLoader.pm (init): Return name of module that was
+ loaded as a string. Override module the same way regardless of
+ whether it is the XS or non-XS module that was loaded.
+ * tp/t/paragraph.t, tp/Texinfo/Convert/Plaintext.pm,
+ tp/Texinfo/Convert/Info.pm: Do not import symbols from
+ Texinfo::Convert::Paragraph explicitly.
+
+
2017-01-14 Gavin Smith <address@hidden>
* tp/Texinfo/Convert/Plaintext.pm (new_formatter): Call
Modified: trunk/tp/Texinfo/Convert/Info.pm
===================================================================
--- trunk/tp/Texinfo/Convert/Info.pm 2017-01-14 22:37:18 UTC (rev 7630)
+++ trunk/tp/Texinfo/Convert/Info.pm 2017-01-15 16:19:55 UTC (rev 7631)
@@ -1,6 +1,7 @@
# Info.pm: output tree as Info.
#
-# Copyright 2010, 2011, 2012, 2013, 2014, 2015 Free Software Foundation, Inc.
+# Copyright 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017
+# Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -27,17 +28,7 @@
use Texinfo::Convert::Paragraph;
-*add_text = \&Texinfo::Convert::Paragraph::add_text;
-*add_next = \&Texinfo::Convert::Paragraph::add_next;
-*set_space_protection = \&Texinfo::Convert::Paragraph::set_space_protection;
-*remove_end_sentence = \&Texinfo::Convert::Paragraph::remove_end_sentence;
-*allow_end_sentence = \&Texinfo::Convert::Paragraph::allow_end_sentence;
-*add_end_sentence = \&Texinfo::Convert::Paragraph::add_end_sentence;
-*end_line = \&Texinfo::Convert::Paragraph::end_line;
-*add_pending_word = \&Texinfo::Convert::Paragraph::add_pending_word;
-*get_pending = \&Texinfo::Convert::Paragraph::get_pending;
-
require Exporter;
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
@ISA = qw(Texinfo::Convert::Plaintext);
Modified: trunk/tp/Texinfo/Convert/Paragraph.pm
===================================================================
--- trunk/tp/Texinfo/Convert/Paragraph.pm 2017-01-14 22:37:18 UTC (rev
7630)
+++ trunk/tp/Texinfo/Convert/Paragraph.pm 2017-01-15 16:19:55 UTC (rev
7631)
@@ -24,6 +24,30 @@
use Texinfo::XSLoader;
+
+# Import symbols into the module that is using this one. We don't
+# use the Exporter module because its symbols are lost when we override
+# this module with Texinfo::XSLoader::init.
+sub import {
+ my @EXPORT = qw(
+ add_text
+ add_next
+ set_space_protection
+ remove_end_sentence
+ allow_end_sentence
+ add_end_sentence
+ end_line
+ add_pending_word
+ get_pending
+ );
+
+ my ($callpkg, $filename, $line) = caller(0);
+ for my $sym (@EXPORT) {
+ no strict 'refs';
+ *{"${callpkg}::$sym"} = \&{"Texinfo::Convert::Paragraph::${sym}"};
+ }
+}
+
BEGIN {
our $warning_message = undef;
our $fatal_message = undef;
@@ -39,7 +63,11 @@
if (!$a) {
$warning_message = "couldn't run 'locale -a': skipping check for a UTF-8
locale";
}
- Texinfo::XSLoader::init (
+
+ # Save reference to subroutine before we do anything.
+ my $import_fn = \&import;
+
+ my $package = Texinfo::XSLoader::init (
"Texinfo::Convert::Paragraph",
"Texinfo::Convert::XSParagraph::XSParagraph",
"Texinfo::Convert::ParagraphNonXS",
@@ -48,8 +76,12 @@
$warning_message,
$fatal_message
);
+
+ no strict 'refs';
+ *{"${package}::import"} = $import_fn;
}
+
# NB Don't add more functions down here, because this can cause an error
# with some versions of Perl, connected with any typeglob assignments done
# above. ("Can't call mro_method_changed_in() on anonymous symbol table").
Modified: trunk/tp/Texinfo/Convert/Plaintext.pm
===================================================================
--- trunk/tp/Texinfo/Convert/Plaintext.pm 2017-01-14 22:37:18 UTC (rev
7630)
+++ trunk/tp/Texinfo/Convert/Plaintext.pm 2017-01-15 16:19:55 UTC (rev
7631)
@@ -33,20 +33,8 @@
use Texinfo::Convert::Texinfo;
use Texinfo::Convert::Paragraph;
-*add_text = \&Texinfo::Convert::Paragraph::add_text;
-*add_next = \&Texinfo::Convert::Paragraph::add_next;
-*set_space_protection = \&Texinfo::Convert::Paragraph::set_space_protection;
-*remove_end_sentence = \&Texinfo::Convert::Paragraph::remove_end_sentence;
-*allow_end_sentence = \&Texinfo::Convert::Paragraph::allow_end_sentence;
-*add_end_sentence = \&Texinfo::Convert::Paragraph::add_end_sentence;
-*end_line = \&Texinfo::Convert::Paragraph::end_line;
-*add_pending_word = \&Texinfo::Convert::Paragraph::add_pending_word;
-*get_pending = \&Texinfo::Convert::Paragraph::get_pending;
-
use Texinfo::Convert::Text;
-use Carp qw(cluck);
-
require Exporter;
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
@ISA = qw(Exporter Texinfo::Convert::Converter);
Modified: trunk/tp/Texinfo/XSLoader.pm
===================================================================
--- trunk/tp/Texinfo/XSLoader.pm 2017-01-14 22:37:18 UTC (rev 7630)
+++ trunk/tp/Texinfo/XSLoader.pm 2017-01-15 16:19:55 UTC (rev 7631)
@@ -219,9 +219,10 @@
goto FALLBACK;
}
- *{"${full_module_name}::"} = *{"${module}::"};
+ *{"${full_module_name}::"} = \%{"${module}::"};
+
- return;
+ return $module;
FALLBACK:
if ($TEXINFO_XS eq 'required') {
@@ -239,6 +240,8 @@
eval "require $fallback_module";
*{"${full_module_name}::"} = \%{"${fallback_module}::"};
+
+ return $fallback_module;
} # end init
# Override subroutine $TARGET with $SOURCE.
Modified: trunk/tp/t/paragraph.t
===================================================================
--- trunk/tp/t/paragraph.t 2017-01-14 22:37:18 UTC (rev 7630)
+++ trunk/tp/t/paragraph.t 2017-01-15 16:19:55 UTC (rev 7631)
@@ -22,16 +22,6 @@
}; # end BEGIN
use Texinfo::Convert::Paragraph;
-
-*add_text = \&Texinfo::Convert::Paragraph::add_text;
-*add_next = \&Texinfo::Convert::Paragraph::add_next;
-*set_space_protection = \&Texinfo::Convert::Paragraph::set_space_protection;
-*remove_end_sentence = \&Texinfo::Convert::Paragraph::remove_end_sentence;
-*allow_end_sentence = \&Texinfo::Convert::Paragraph::allow_end_sentence;
-*add_end_sentence = \&Texinfo::Convert::Paragraph::add_end_sentence;
-*end_line = \&Texinfo::Convert::Paragraph::end_line;
-*add_pending_word = \&Texinfo::Convert::Paragraph::add_pending_word;
-
use Texinfo::Convert::Line;
use Texinfo::Convert::UnFilled;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [7631] Paragraph.pm export symbols,
gavinsmith0123 <=