texinfo-commits
[Top][All Lists]
Advanced

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

[no subject]


From: Patrice Dumas
Date: Mon, 8 Apr 2024 15:45:49 -0400 (EDT)

branch: master
commit 9f6e153f70392d10c7fa14ea0e7288643caea10d
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Mon Apr 8 21:15:24 2024 +0200

    * tp/Texinfo/Structuring.pm (warn_non_empty_parts)
    (check_nodes_are_referenced, set_menus_node_directions)
    (complete_node_tree_with_menus, nodes_tree): use $document argument to
    get customization options, remove $main_configuration argument.
    Update callers and XS interfaces.
---
 ChangeLog                                          |  8 ++++
 tp/Texinfo/Structuring.pm                          | 46 +++++++++++-----------
 .../XS/structuring_transfo/StructuringTransfoXS.xs | 15 +++----
 tp/t/test_utils.pl                                 | 15 +++----
 tp/texi2any.pl                                     | 16 +++-----
 5 files changed, 49 insertions(+), 51 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 949e7675d8..ee67babf1f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2024-04-08  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/Structuring.pm (warn_non_empty_parts)
+       (check_nodes_are_referenced, set_menus_node_directions)
+       (complete_node_tree_with_menus, nodes_tree): use $document argument to
+       get customization options, remove $main_configuration argument.
+       Update callers and XS interfaces.
+
 2024-04-08  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/Document.pm (get_conf): add to use in pure Perl for the
diff --git a/tp/Texinfo/Structuring.pm b/tp/Texinfo/Structuring.pm
index b2ace7f21d..c080f18dc0 100644
--- a/tp/Texinfo/Structuring.pm
+++ b/tp/Texinfo/Structuring.pm
@@ -388,10 +388,11 @@ sub _print_sectioning_tree($)
   return $result;
 }
 
-sub warn_non_empty_parts($$)
+sub warn_non_empty_parts($)
 {
   my $document = shift;
-  my $customization_information = shift;
+
+  my $customization_information = $document;
 
   my $global_commands = $document->global_commands_information();
   my $registrar = $document->registrar();
@@ -551,10 +552,11 @@ sub get_node_node_childs_from_sectioning
 
 # In general should be called only after complete_node_tree_with_menus
 # to try to generate menus automatically before checking.
-sub check_nodes_are_referenced($$)
+sub check_nodes_are_referenced($)
 {
-  my ($document, $customization_information) = @_;
+  my $document = shift;
 
+  my $customization_information = $document;
   my $nodes_list = $document->nodes_list();
   my $identifier_target = $document->labels_information();
   my $refs = $document->internal_references_information();
@@ -662,11 +664,11 @@ sub _first_menu_node($$)
 }
 
 # set menu_directions
-sub set_menus_node_directions($$)
+sub set_menus_node_directions($)
 {
   my $document = shift;
-  my $customization_information = shift;
 
+  my $customization_information = $document;
   my $global_commands = $document->global_commands_information();
   my $nodes_list = $document->nodes_list();
   my $identifier_target = $document->labels_information();
@@ -797,11 +799,11 @@ sub _section_direction_associated_node($$)
 # complete automatic directions with menus (and first node
 # for Top node).
 # Checks on structure related to menus.
-sub complete_node_tree_with_menus($$)
+sub complete_node_tree_with_menus($)
 {
   my $document = shift;
-  my $customization_information = shift;
 
+  my $customization_information = $document;
   my $nodes_list = $document->nodes_list();
   my $identifier_target = $document->labels_information();
   my $registrar = $document->registrar();
@@ -1010,11 +1012,11 @@ sub complete_node_tree_with_menus($$)
 }
 
 # set node directions based on sectioning and @node explicit directions
-sub nodes_tree($$)
+sub nodes_tree($)
 {
   my $document = shift;
-  my $customization_information = shift;
 
+  my $customization_information = $document;
   my $root = $document->tree();
   my $identifier_target = $document->labels_information();
   my $registrar = $document->registrar();
@@ -2254,11 +2256,11 @@ Texinfo::Structuring - information on Texinfo::Document 
tree
   my $sections_list = sectioning_structure($document);
   my $identifier_target = $document->labels_information();
   my $global_commands = $document->global_commands_information();
-  my $nodes_list = nodes_tree($document, $config);
-  set_menus_node_directions($document, $config);
-  complete_node_tree_with_menus($document, $config);
+  my $nodes_list = nodes_tree($document);
+  set_menus_node_directions($document);
+  complete_node_tree_with_menus($document);
   my $refs = $document->internal_references_information();
-  check_nodes_are_referenced($document, $config);
+  check_nodes_are_referenced($document);
   associate_internal_references($document);
   number_floats($document->floats_information());
   my $output_units;
@@ -2330,7 +2332,7 @@ Set the I<normalized> key in the C<extra> hash of 
C<menu_entry_node> container
 for menu entries and in the first argument C<extra> hash for internal
 references C<@ref> and similar @-commands.
 
-=item check_nodes_are_referenced($document, $customization_information)
+=item check_nodes_are_referenced($document)
 X<C<check_nodes_are_referenced>>
 
 Check that all the nodes are referenced (in menu, @*ref or node direction).
@@ -2338,7 +2340,7 @@ Check that all the nodes are referenced (in menu, @*ref 
or node direction).
 Should be called after C<complete_node_tree_with_menus> in order to
 have the autogenerated menus available.
 
-=item complete_node_tree_with_menus($document, $customization_information)
+=item complete_node_tree_with_menus($document)
 X<C<complete_node_tree_with_menus>>
 
 Complete nodes directions with menu directions.  Check consistency
@@ -2458,11 +2460,11 @@ Returns the texinfo tree corresponding to a single menu 
entry pointing to
 I<$node>.  If I<$use_sections> is set, use the section name for the menu
 entry name.  Returns C<undef> if the node argument is missing.
 
-=item $nodes_list = nodes_tree($document, $customization_information)
+=item $nodes_list = nodes_tree($document)
 X<C<nodes_tree>>
 
 Goes through nodes in I<$document> tree and set directions.  Returns the
-list of nodes.  Register errors in I<$registrar>.
+list of nodes.
 
 This functions sets, in the C<extra> node element hash:
 
@@ -2533,7 +2535,7 @@ This element is associated to the C<extra> 
I<sectioning_root> key of the first
 section element of the sections list.  It is also at the top of the tree when
 following the I<up> I<section_directions>.
 
-=item set_menus_node_directions($document, $customization_information);
+=item set_menus_node_directions($document);
 X<C<set_menus_node_directions>>
 
 Goes through menu and set directions.
@@ -2605,11 +2607,11 @@ No splitting, only one page is returned, holding all 
the output units.
 
 =back
 
-=item warn_non_empty_parts($document, $registrar, $customization_information)
+=item warn_non_empty_parts($document)
 X<C<warn_non_empty_parts>>
 
-Register a warning in I<$registrar> for each C<@part> in global commands
-information of I<$document> that is not empty.
+Register a warning in for each C<@part> in global commands information of
+I<$document> that is not empty.
 
 =back
 
diff --git a/tp/Texinfo/XS/structuring_transfo/StructuringTransfoXS.xs 
b/tp/Texinfo/XS/structuring_transfo/StructuringTransfoXS.xs
index 1f337f1393..8e1e0338d9 100644
--- a/tp/Texinfo/XS/structuring_transfo/StructuringTransfoXS.xs
+++ b/tp/Texinfo/XS/structuring_transfo/StructuringTransfoXS.xs
@@ -181,8 +181,7 @@ sectioning_structure (SV *document_in)
           }
 
 void
-warn_non_empty_parts (SV *document_in, ...)
-   PROTOTYPE: $$
+warn_non_empty_parts (SV *document_in)
     PREINIT:
         DOCUMENT *document = 0;
     CODE:
@@ -192,8 +191,7 @@ warn_non_empty_parts (SV *document_in, ...)
           warn_non_empty_parts (document);
 
 void
-set_menus_node_directions (SV *document_in, ...)
-  PROTOTYPE: $$
+set_menus_node_directions (SV *document_in)
     PREINIT:
         DOCUMENT *document = 0;
     CODE:
@@ -203,8 +201,7 @@ set_menus_node_directions (SV *document_in, ...)
           set_menus_node_directions (document);
 
 void
-complete_node_tree_with_menus (SV *document_in, ...)
-  PROTOTYPE: $$
+complete_node_tree_with_menus (SV *document_in)
     PREINIT:
         DOCUMENT *document = 0;
     CODE:
@@ -214,8 +211,7 @@ complete_node_tree_with_menus (SV *document_in, ...)
           complete_node_tree_with_menus (document);
 
 void
-check_nodes_are_referenced (SV *document_in, ...)
-  PROTOTYPE: $$
+check_nodes_are_referenced (SV *document_in)
     PREINIT:
         DOCUMENT *document = 0;
     CODE:
@@ -305,8 +301,7 @@ insert_nodes_for_sectioning_commands (SV *document_in, ...)
 # to register in the document.  It is better to reserve the return
 # value for a return status, if it becomes needed.
 void
-nodes_tree (SV *document_in, ...)
-   PROTOTYPE: $$
+nodes_tree (SV *document_in)
     PREINIT:
         DOCUMENT *document = 0;
     CODE:
diff --git a/tp/t/test_utils.pl b/tp/t/test_utils.pl
index f5f1c13132..c774f6795d 100644
--- a/tp/t/test_utils.pl
+++ b/tp/t/test_utils.pl
@@ -1106,7 +1106,7 @@ sub test($$)
     Texinfo::Document::register_document_sections_list($document,
                                                        $sections_list);
   }
-  Texinfo::Structuring::warn_non_empty_parts($document, $main_configuration);
+  Texinfo::Structuring::warn_non_empty_parts($document);
 
   if ($tree_transformations{'complete_tree_nodes_menus'}) {
     Texinfo::Transformations::complete_tree_nodes_menus($tree);
@@ -1117,25 +1117,22 @@ sub test($$)
 
   if ($tree_transformations{'regenerate_master_menu'}) {
     Texinfo::Transformations::regenerate_master_menu($document,
-                                                     $main_configuration);
+                                                     $document);
   }
 
   my $nodes_tree_nodes_list
-          = Texinfo::Structuring::nodes_tree($document, $main_configuration);
+          = Texinfo::Structuring::nodes_tree($document);
 
   Texinfo::Document::register_document_nodes_list($document,
                                                   $nodes_tree_nodes_list);
 
-  Texinfo::Structuring::set_menus_node_directions($document,
-                                                  $main_configuration);
+  Texinfo::Structuring::set_menus_node_directions($document);
 
   if (not defined($main_configuration->get_conf('FORMAT_MENU'))
       or $main_configuration->get_conf('FORMAT_MENU') eq 'menu') {
-    Texinfo::Structuring::complete_node_tree_with_menus($document,
-                                                        $main_configuration);
+    Texinfo::Structuring::complete_node_tree_with_menus($document);
 
-    Texinfo::Structuring::check_nodes_are_referenced($document,
-                                                     $main_configuration);
+    Texinfo::Structuring::check_nodes_are_referenced($document);
   }
 
   Texinfo::Structuring::number_floats($document);
diff --git a/tp/texi2any.pl b/tp/texi2any.pl
index 1603251d48..2b4bd12e97 100755
--- a/tp/texi2any.pl
+++ b/tp/texi2any.pl
@@ -1636,7 +1636,7 @@ while(@input_files) {
   }
 
   if (!$formats_table{$converted_format}->{'no_warn_non_empty_parts'}) {
-    Texinfo::Structuring::warn_non_empty_parts($document, $main_configuration);
+    Texinfo::Structuring::warn_non_empty_parts($document);
   }
 
   if ($tree_transformations{'complete_tree_nodes_menus'}) {
@@ -1648,12 +1648,11 @@ while(@input_files) {
 
   if ($tree_transformations{'regenerate_master_menu'}) {
     Texinfo::Transformations::regenerate_master_menu($document,
-                                                     $main_configuration);
+                                                     $document);
   }
 
   if ($formats_table{$converted_format}->{'nodes_tree'}) {
-    my $nodes_list = Texinfo::Structuring::nodes_tree($document,
-                                                      $main_configuration);
+    my $nodes_list = Texinfo::Structuring::nodes_tree($document);
     Texinfo::Document::register_document_nodes_list($document, $nodes_list);
 
     # With this condition, menu is the default for 'FORMAT_MENU'.
@@ -1666,14 +1665,11 @@ while(@input_files) {
     # is never used.
     if (not defined(get_conf('FORMAT_MENU'))
         or get_conf('FORMAT_MENU') eq 'menu') {
-      Texinfo::Structuring::set_menus_node_directions($document,
-                                                      $main_configuration);
+      Texinfo::Structuring::set_menus_node_directions($document);
 
-      Texinfo::Structuring::complete_node_tree_with_menus($document,
-                                                          $main_configuration);
+      Texinfo::Structuring::complete_node_tree_with_menus($document);
 
-      Texinfo::Structuring::check_nodes_are_referenced($document,
-                                                       $main_configuration);
+      Texinfo::Structuring::check_nodes_are_referenced($document);
     }
   }
   if ($formats_table{$converted_format}->{'floats'}) {



reply via email to

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