texinfo-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

branch master updated: * tp/Texinfo/Structuring.pm (import), * tp/Texinf


From: Gavin D. Smith
Subject: branch master updated: * tp/Texinfo/Structuring.pm (import), * tp/Texinfo/Transformations.pm (import): List overrided perl subroutines in a hash for more concise code.
Date: Sat, 04 Nov 2023 08:11:51 -0400

This is an automated email from the git hooks/post-receive script.

gavin pushed a commit to branch master
in repository texinfo.

The following commit(s) were added to refs/heads/master by this push:
     new b37c1a4e4e * tp/Texinfo/Structuring.pm (import), * 
tp/Texinfo/Transformations.pm (import): List overrided perl subroutines in a 
hash for more concise code.
b37c1a4e4e is described below

commit b37c1a4e4e05fd27ce163df273e4d8d5073445a4
Author: Gavin Smith <gavinsmith0123@gmail.com>
AuthorDate: Sat Nov 4 12:11:42 2023 +0000

    * tp/Texinfo/Structuring.pm (import),
    * tp/Texinfo/Transformations.pm (import):
    List overrided perl subroutines in a hash for more concise code.
---
 ChangeLog                     |   6 +++
 tp/Texinfo/Common.pm          |   3 +-
 tp/Texinfo/Structuring.pm     | 102 +++++++++++++++++-------------------------
 tp/Texinfo/Transformations.pm |  57 ++++++++++-------------
 4 files changed, 72 insertions(+), 96 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 8c54a6259a..a07c0769f4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2023-11-04  Gavin Smith <gavinsmith0123@gmail.com>
+
+       * tp/Texinfo/Structuring.pm (import),
+       * tp/Texinfo/Transformations.pm (import):
+       List overrided perl subroutines in a hash for more concise code.
+
 2023-11-04  Gavin Smith <gavinsmith0123@gmail.com>
 
        * tp/Texinfo/Common.pm (import): List overrided perl subroutines
diff --git a/tp/Texinfo/Common.pm b/tp/Texinfo/Common.pm
index 221b64aff3..80cb1874ef 100644
--- a/tp/Texinfo/Common.pm
+++ b/tp/Texinfo/Common.pm
@@ -98,8 +98,7 @@ our %XS_overrides = (
 our $module_loaded = 0;
 sub import {
   if (!$module_loaded) {
-    if (!defined $ENV{TEXINFO_XS_PARSER}
-        or $ENV{TEXINFO_XS_PARSER} eq '1') {
+    if (!defined $ENV{TEXINFO_XS_PARSER} or $ENV{TEXINFO_XS_PARSER} eq '1') {
       for my $sub (keys %XS_overrides) {
         Texinfo::XSLoader::override ($sub, $XS_overrides{$sub});
       }
diff --git a/tp/Texinfo/Structuring.pm b/tp/Texinfo/Structuring.pm
index 42c8df617c..d21c4b67de 100644
--- a/tp/Texinfo/Structuring.pm
+++ b/tp/Texinfo/Structuring.pm
@@ -82,71 +82,53 @@ use vars qw($VERSION @ISA @EXPORT_OK %EXPORT_TAGS);
 
 $VERSION = '7.1dev';
 
+our %XS_overrides = (
+  "Texinfo::Structuring::rebuild_document"
+    => "Texinfo::StructTransf::rebuild_document",
+  "Texinfo::Structuring::rebuild_tree"
+    => "Texinfo::StructTransf::rebuild_tree",
+  "Texinfo::Structuring::clear_document_errors"
+    => "Texinfo::StructTransf::clear_document_errors",
+  "Texinfo::Structuring::associate_internal_references"
+    => "Texinfo::StructTransf::associate_internal_references",
+  "Texinfo::Structuring::sectioning_structure"
+    => "Texinfo::StructTransf::sectioning_structure",
+  "Texinfo::Structuring::warn_non_empty_parts"
+    => "Texinfo::StructTransf::warn_non_empty_parts",
+  "Texinfo::Structuring::nodes_tree"
+    => "Texinfo::StructTransf::nodes_tree",
+  "Texinfo::Structuring::set_menus_node_directions"
+    => "Texinfo::StructTransf::set_menus_node_directions",
+  "Texinfo::Structuring::complete_node_tree_with_menus"
+    => "Texinfo::StructTransf::complete_node_tree_with_menus",
+  "Texinfo::Structuring::check_nodes_are_referenced"
+    => "Texinfo::StructTransf::check_nodes_are_referenced",
+  "Texinfo::Structuring::number_floats"
+    => "Texinfo::StructTransf::number_floats",
+  "Texinfo::Structuring::rebuild_output_units"
+    => "Texinfo::StructTransf::rebuild_output_units",
+  "Texinfo::Structuring::_XS_unsplit"
+    => "Texinfo::StructTransf::unsplit",
+
+  # Not useful for HTML as functions, as the calling functions are
+  # already overriden
+  # Could be readded when other converters than HTML are done in C
+  #  "Texinfo::Structuring::split_by_node"
+  #    => "Texinfo::StructTransf::split_by_node");
+  #  "Texinfo::Structuring::split_by_section"
+  #    => "Texinfo::StructTransf::split_by_section");
+  #  "Texinfo::Structuring::split_pages"
+  #    => "Texinfo::StructTransf::split_pages"
+);
+
 our $module_loaded = 0;
 sub import {
   if (!$module_loaded) {
     if (!defined $ENV{TEXINFO_XS_PARSER}
         or $ENV{TEXINFO_XS_PARSER} ne '0') {
-      Texinfo::XSLoader::override(
-        "Texinfo::Structuring::rebuild_document",
-        "Texinfo::StructTransf::rebuild_document");
-      Texinfo::XSLoader::override(
-        "Texinfo::Structuring::rebuild_tree",
-        "Texinfo::StructTransf::rebuild_tree");
-      Texinfo::XSLoader::override(
-        "Texinfo::Structuring::clear_document_errors",
-        "Texinfo::StructTransf::clear_document_errors");
-      Texinfo::XSLoader::override(
-        "Texinfo::Structuring::associate_internal_references",
-        "Texinfo::StructTransf::associate_internal_references"
-      );
-      Texinfo::XSLoader::override(
-        "Texinfo::Structuring::sectioning_structure",
-        "Texinfo::StructTransf::sectioning_structure"
-      );
-      Texinfo::XSLoader::override(
-        "Texinfo::Structuring::warn_non_empty_parts",
-        "Texinfo::StructTransf::warn_non_empty_parts"
-      );
-      Texinfo::XSLoader::override(
-        "Texinfo::Structuring::nodes_tree",
-        "Texinfo::StructTransf::nodes_tree"
-      );
-      Texinfo::XSLoader::override(
-        "Texinfo::Structuring::set_menus_node_directions",
-        "Texinfo::StructTransf::set_menus_node_directions"
-      );
-      Texinfo::XSLoader::override(
-        "Texinfo::Structuring::complete_node_tree_with_menus",
-        "Texinfo::StructTransf::complete_node_tree_with_menus"
-      );
-      Texinfo::XSLoader::override(
-        "Texinfo::Structuring::check_nodes_are_referenced",
-        "Texinfo::StructTransf::check_nodes_are_referenced"
-      );
-      Texinfo::XSLoader::override(
-        "Texinfo::Structuring::number_floats",
-        "Texinfo::StructTransf::number_floats"
-      );
-      Texinfo::XSLoader::override(
-        "Texinfo::Structuring::rebuild_output_units",
-        "Texinfo::StructTransf::rebuild_output_units");
-      Texinfo::XSLoader::override(
-        "Texinfo::Structuring::_XS_unsplit",
-        "Texinfo::StructTransf::unsplit");
-      # Not useful for HTML as functions, as the calling functions are
-      # already overriden
-      # Could be readded when other converters than HTML are done in C
-      #Texinfo::XSLoader::override(
-      #  "Texinfo::Structuring::split_by_node",
-      #  "Texinfo::StructTransf::split_by_node");
-      #Texinfo::XSLoader::override(
-      #  "Texinfo::Structuring::split_by_section",
-      #  "Texinfo::StructTransf::split_by_section");
-      #Texinfo::XSLoader::override(
-      #  "Texinfo::Structuring::split_pages",
-      #  "Texinfo::StructTransf::split_pages"
-      #);
+      for my $sub (keys %XS_overrides) {
+        Texinfo::XSLoader::override ($sub, $XS_overrides{$sub});
+      }
     }
     $module_loaded = 1;
   }
diff --git a/tp/Texinfo/Transformations.pm b/tp/Texinfo/Transformations.pm
index b2f7c41b7b..8bf237d2c8 100644
--- a/tp/Texinfo/Transformations.pm
+++ b/tp/Texinfo/Transformations.pm
@@ -51,43 +51,32 @@ reference_to_arg_in_tree
 
 $VERSION = '7.1dev';
 
+our %XS_overrides = (
+  "Texinfo::Transformations::fill_gaps_in_sectioning"
+    => "Texinfo::StructTransf::fill_gaps_in_sectioning",
+  "Texinfo::Transformations::reference_to_arg_in_tree"
+    => "Texinfo::StructTransf::reference_to_arg_in_tree",
+  "Texinfo::Transformations::complete_tree_nodes_menus"
+    => "Texinfo::StructTransf::complete_tree_nodes_menus",
+  "Texinfo::Transformations::complete_tree_nodes_missing_menu"
+    => "Texinfo::StructTransf::complete_tree_nodes_missing_menu",
+  "Texinfo::Transformations::regenerate_master_menu"
+    => "Texinfo::StructTransf::regenerate_master_menu",
+  "Texinfo::Transformations::insert_nodes_for_sectioning_commands"
+    => "Texinfo::StructTransf::insert_nodes_for_sectioning_commands",
+  "Texinfo::Transformations::protect_hashchar_at_line_beginning"
+    => "Texinfo::StructTransf::protect_hashchar_at_line_beginning",
+  "Texinfo::Transformations::protect_first_parenthesis_in_targets"
+    => "Texinfo::StructTransf::protect_first_parenthesis_in_targets",
+);
+
 our $module_loaded = 0;
 sub import {
   if (!$module_loaded) {
-    if (!defined $ENV{TEXINFO_XS_PARSER}
-        or $ENV{TEXINFO_XS_PARSER} eq '1') {
-      Texinfo::XSLoader::override(
-        "Texinfo::Transformations::fill_gaps_in_sectioning",
-        "Texinfo::StructTransf::fill_gaps_in_sectioning"
-      );
-      Texinfo::XSLoader::override(
-        "Texinfo::Transformations::reference_to_arg_in_tree",
-        "Texinfo::StructTransf::reference_to_arg_in_tree"
-      );
-      Texinfo::XSLoader::override(
-        "Texinfo::Transformations::complete_tree_nodes_menus",
-        "Texinfo::StructTransf::complete_tree_nodes_menus"
-      );
-      Texinfo::XSLoader::override(
-        "Texinfo::Transformations::complete_tree_nodes_missing_menu",
-        "Texinfo::StructTransf::complete_tree_nodes_missing_menu"
-      );
-      Texinfo::XSLoader::override(
-        "Texinfo::Transformations::regenerate_master_menu",
-        "Texinfo::StructTransf::regenerate_master_menu"
-      );
-      Texinfo::XSLoader::override(
-        "Texinfo::Transformations::insert_nodes_for_sectioning_commands",
-        "Texinfo::StructTransf::insert_nodes_for_sectioning_commands"
-      );
-      Texinfo::XSLoader::override(
-        "Texinfo::Transformations::protect_hashchar_at_line_beginning",
-        "Texinfo::StructTransf::protect_hashchar_at_line_beginning"
-      );
-      Texinfo::XSLoader::override(
-        "Texinfo::Transformations::protect_first_parenthesis_in_targets",
-        "Texinfo::StructTransf::protect_first_parenthesis_in_targets"
-      );
+    if (!defined $ENV{TEXINFO_XS_PARSER} or $ENV{TEXINFO_XS_PARSER} eq '1') {
+      for my $sub (keys %XS_overrides) {
+        Texinfo::XSLoader::override ($sub, $XS_overrides{$sub});
+      }
     }
     $module_loaded = 1;
   }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]