texinfo-commits
[Top][All Lists]
Advanced

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

[no subject]


From: Gavin D. Smith
Date: Sun, 25 Feb 2024 07:36:00 -0500 (EST)

branch: master
commit af8680e8cd1d973f063783a9ff47073f7b4d0761
Author: Gavin Smith <gavinsmith0123@gmail.com>
AuthorDate: Sun Feb 25 12:18:57 2024 +0000

    Remove separate error registrar arguments
    
    * tp/Texinfo/Document.pm, tp/Texinfo/XS/main/DocumentXS.xs
    (indices_sort_strings):
    * tp/Texinfo/Structuring.pm,
    tp/Texinfo/XS/structuring_transfo/StructuringTransfoXS.xs
    (check_nodes_are_referenced, set_menus_node_directions)
    (complete_node_tree_with_menus, nodes_tree):
    Remove separate Texinfo::Report 'registrar' arguments, and access
    errors through 'registrar' key on Texinfo::Document arguments.
---
 ChangeLog                                          | 13 +++++++
 tp/Texinfo/Document.pm                             | 13 ++++---
 tp/Texinfo/Structuring.pm                          | 41 ++++++++++------------
 tp/Texinfo/XS/main/DocumentXS.xs                   |  8 ++---
 .../XS/structuring_transfo/StructuringTransfoXS.xs |  8 ++---
 tp/t/test_sort.t                                   |  6 ++--
 tp/t/test_utils.pl                                 | 15 ++++----
 tp/texi2any.pl                                     | 16 ++++-----
 8 files changed, 60 insertions(+), 60 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 5b30a83965..994adf1c31 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2024-02-25  Gavin Smith <gavinsmith0123@gmail.com>
+
+       Remove separate error registrar arguments
+
+       * tp/Texinfo/Document.pm, tp/Texinfo/XS/main/DocumentXS.xs
+       (indices_sort_strings):
+       * tp/Texinfo/Structuring.pm,
+       tp/Texinfo/XS/structuring_transfo/StructuringTransfoXS.xs
+       (check_nodes_are_referenced, set_menus_node_directions)
+       (complete_node_tree_with_menus, nodes_tree):
+       Remove separate Texinfo::Report 'registrar' arguments, and access
+       errors through 'registrar' key on Texinfo::Document arguments.
+
 2024-02-25  Gavin Smith <gavinsmith0123@gmail.com>
 
        Remove separate error registrar argument
diff --git a/tp/Texinfo/Document.pm b/tp/Texinfo/Document.pm
index 9af9a93088..16c18f764c 100644
--- a/tp/Texinfo/Document.pm
+++ b/tp/Texinfo/Document.pm
@@ -212,19 +212,18 @@ sub merged_indices($)
 # In general, it is not needed to call that function directly,
 # as it is called by Texinfo::Indices::sort_indices_by_*.  It may
 # be called in advance, however, if errors need to be collected early.
-sub indices_sort_strings($$$;$)
+sub indices_sort_strings($$;$)
 {
   my $document = shift;
-  my $registrar = shift;
   my $customization_information = shift;
   my $prefer_reference_element = shift;
 
   if (!$document->{'index_entries_sort_strings'}) {
     my $indices_sort_strings
-      = Texinfo::Indices::setup_index_entries_sort_strings($registrar,
-             $customization_information, $document->merged_indices(),
-                          $document->indices_information(),
-                           $prefer_reference_element);
+      = Texinfo::Indices::setup_index_entries_sort_strings
+             ($document->{'registrar'}, $customization_information,
+              $document->merged_indices(), $document->indices_information(),
+              $prefer_reference_element);
     $document->{'index_entries_sort_strings'} = $indices_sort_strings;
   }
 
@@ -608,7 +607,7 @@ to the same document with @-commands that refer to node, 
anchors or floats.
 =item $nodes_list = nodes_list($document)
 
 Returns an array reference containing the document nodes.  In general set to
-the nodes list returned by L<Texinfo::Structuring 
nodes_tree|Texinfo::Structuring/$nodes_list = nodes_tree($document, $registrar, 
$customization_information)>,
+the nodes list returned by L<Texinfo::Structuring 
nodes_tree|Texinfo::Structuring/$nodes_list = nodes_tree($document, 
$customization_information)>,
 by a call to L<register_document_nodes_list|/register_document_nodes_list 
($document, $nodes_list)>.
 
 =item $sections_list = sections_list($document)
diff --git a/tp/Texinfo/Structuring.pm b/tp/Texinfo/Structuring.pm
index fe0534b4af..e0f1b80918 100644
--- a/tp/Texinfo/Structuring.pm
+++ b/tp/Texinfo/Structuring.pm
@@ -558,9 +558,9 @@ 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, $registrar, $customization_information) = @_;
+  my ($document, $customization_information) = @_;
 
   my $nodes_list = $document->nodes_list();
   my $identifier_target = $document->labels_information();
@@ -625,7 +625,7 @@ sub check_nodes_are_referenced($$$)
     # it is normal that a redundant node is not referenced
     if ($node->{'extra'}->{'is_target'}
         and not exists($referenced_nodes{$node})) {
-      $registrar->line_warn($customization_information,
+      $document->{'registrar'}->line_warn($customization_information,
                             sprintf(__("node `%s' unreferenced"),
                                     target_element_to_texi_label($node)),
                             $node->{'source_info'});
@@ -668,15 +668,15 @@ sub _first_menu_node($$)
 }
 
 # set menu_directions
-sub set_menus_node_directions($$$)
+sub set_menus_node_directions($$)
 {
   my $document = shift;
-  my $registrar = shift;
   my $customization_information = shift;
 
   my $global_commands = $document->global_commands_information();
   my $nodes_list = $document->nodes_list();
   my $identifier_target = $document->labels_information();
+  my $registrar = $document->{'registrar'};
 
   return undef unless ($nodes_list and scalar(@{$nodes_list}));
 
@@ -803,14 +803,14 @@ 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 $registrar = shift;
   my $customization_information = shift;
 
   my $nodes_list = $document->nodes_list();
   my $identifier_target = $document->labels_information();
+  my $registrar = $document->{'registrar'};
 
   return unless ($nodes_list and @{$nodes_list});
 
@@ -1016,10 +1016,9 @@ 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 $registrar = shift;
   my $customization_information = shift;
 
   my $root = $document->tree();
@@ -1132,7 +1131,7 @@ sub nodes_tree($$$)
                 and !Texinfo::Convert::Texinfo::check_node_same_texinfo_code(
                                  $node_target,
                                  
$direction_element->{'extra'}->{'node_content'})) {
-              $registrar->line_warn($customization_information,
+              $document->{'registrar'}->line_warn($customization_information,
                 sprintf(
              __("%s pointer `%s' (for node `%s') different from %s name `%s'"),
                   $direction_texts{$direction},
@@ -1144,7 +1143,7 @@ sub nodes_tree($$$)
             }
           } else {
             if (!$customization_information->get_conf('novalidate')) {
-              $registrar->line_error($customization_information,
+              $document->{'registrar'}->line_error($customization_information,
                    sprintf(__("%s reference to nonexistent `%s'"),
                       $direction_texts{$direction},
                       link_element_to_texi($direction_element)),
@@ -2246,11 +2245,11 @@ Texinfo::Structuring - information on Texinfo::Document 
tree
   my $sections_list = sectioning_structure($tree, $registrar, $config);
   my $identifier_target = $document->labels_information();
   my $global_commands = $document->global_commands_information();
-  my $nodes_list = nodes_tree($document, $registrar, $config);
-  set_menus_node_directions($document, $registrar, $config);
-  complete_node_tree_with_menus($document, $registrar, $config);
+  my $nodes_list = nodes_tree($document, $config);
+  set_menus_node_directions($document, $config);
+  complete_node_tree_with_menus($document, $config);
   my $refs = $document->internal_references_information();
-  check_nodes_are_referenced($document, $registrar, $config);
+  check_nodes_are_referenced($document, $config);
   associate_internal_references($document, $config);
   number_floats($document->floats_information());
   my $output_units;
@@ -2322,21 +2321,19 @@ 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, $registrar, 
$customization_information)
+=item check_nodes_are_referenced($document, $customization_information)
 X<C<check_nodes_are_referenced>>
 
 Check that all the nodes are referenced (in menu, @*ref or node direction).
-Register errors in I<$registrar>.
 
 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, $registrar, 
$customization_information)
+=item complete_node_tree_with_menus($document, $customization_information)
 X<C<complete_node_tree_with_menus>>
 
 Complete nodes directions with menu directions.  Check consistency
 of menus, sectionning and nodes direction structures.
-Register errors in I<$registrar>.
 
 =item units_directions($customization_information, $identifier_target, 
$output_units)
 X<C<units_directions>>
@@ -2452,7 +2449,7 @@ 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, $registrar, 
$customization_information)
+=item $nodes_list = nodes_tree($document, $customization_information)
 X<C<nodes_tree>>
 
 Goes through nodes in I<$document> tree and set directions.  Returns the
@@ -2527,10 +2524,10 @@ 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, $registrar, 
$customization_information);
+=item set_menus_node_directions($document, $customization_information);
 X<C<set_menus_node_directions>>
 
-Goes through menu and set directions.  Register errors in I<$registrar>.
+Goes through menu and set directions.
 
 This functions sets, in the C<extra> node element hash reference:
 
diff --git a/tp/Texinfo/XS/main/DocumentXS.xs b/tp/Texinfo/XS/main/DocumentXS.xs
index 8f6a19e852..9443a0c0db 100644
--- a/tp/Texinfo/XS/main/DocumentXS.xs
+++ b/tp/Texinfo/XS/main/DocumentXS.xs
@@ -153,10 +153,10 @@ set_document_global_info (SV *document_in, char *key, SV 
*value_sv)
               }
           }
 
-# registrar, main_configuration, prefer_reference_element
+# main_configuration, prefer_reference_element
 SV *
 indices_sort_strings (SV *document_in, ...)
-    PROTOTYPE: $$$;$
+    PROTOTYPE: $$;$
     PREINIT:
         DOCUMENT *document = 0;
         const INDICES_SORT_STRINGS *indices_sort_strings = 0;
@@ -166,8 +166,8 @@ indices_sort_strings (SV *document_in, ...)
      CODE:
         document = get_sv_document_document (document_in,
                                              "indices_sort_strings");
-        if (items > 3 && SvOK(ST(3)))
-          prefer_reference_element = SvIV (ST(3));
+        if (items > 2 && SvOK(ST(2)))
+          prefer_reference_element = SvIV (ST(2));
         if (document)
           indices_sort_strings
            = document_indices_sort_strings (document, document->error_messages,
diff --git a/tp/Texinfo/XS/structuring_transfo/StructuringTransfoXS.xs 
b/tp/Texinfo/XS/structuring_transfo/StructuringTransfoXS.xs
index 8cd45cd2d6..c0c2b3d640 100644
--- a/tp/Texinfo/XS/structuring_transfo/StructuringTransfoXS.xs
+++ b/tp/Texinfo/XS/structuring_transfo/StructuringTransfoXS.xs
@@ -181,7 +181,7 @@ warn_non_empty_parts (SV *document_in, ...)
 
 void
 set_menus_node_directions (SV *document_in, ...)
-  PROTOTYPE: $$$
+  PROTOTYPE: $$
     PREINIT:
         DOCUMENT *document = 0;
     CODE:
@@ -192,7 +192,7 @@ set_menus_node_directions (SV *document_in, ...)
 
 void
 complete_node_tree_with_menus (SV *document_in, ...)
-  PROTOTYPE: $$$
+  PROTOTYPE: $$
     PREINIT:
         DOCUMENT *document = 0;
     CODE:
@@ -203,7 +203,7 @@ complete_node_tree_with_menus (SV *document_in, ...)
 
 void
 check_nodes_are_referenced (SV *document_in, ...)
-  PROTOTYPE: $$$
+  PROTOTYPE: $$
     PREINIT:
         DOCUMENT *document = 0;
     CODE:
@@ -291,7 +291,7 @@ insert_nodes_for_sectioning_commands (SV *document_in, ...)
 # value for a return status, if it becomes needed.
 void
 nodes_tree (SV *document_in, ...)
-   PROTOTYPE: $$$
+   PROTOTYPE: $$
     PREINIT:
         DOCUMENT *document = 0;
     CODE:
diff --git a/tp/t/test_sort.t b/tp/t/test_sort.t
index 0cb2cb26c9..d2a4f6409c 100644
--- a/tp/t/test_sort.t
+++ b/tp/t/test_sort.t
@@ -50,8 +50,7 @@ my $main_configuration = Texinfo::MainConfig::new({});
 # Texinfo::Document::indices_sort_strings is more natural, but we want
 # to test direct call of Texinfo::Indices::setup_index_entries_sort_strings.
 # my $indices_sort_strings
-#   = Texinfo::Document::indices_sort_strings($document, $registrar,
-#                                            $main_configuration);
+#   = Texinfo::Document::indices_sort_strings($document, $main_configuration);
 my $indices_information = $document->indices_information();
 my $index_entries = $document->merged_indices();
 $main_configuration->{'document_descriptor'}
@@ -138,8 +137,7 @@ $document = $parser->parse_texi_text('@node Top
 
 $registrar = $parser->registered_errors();
 $indices_sort_strings
-  = Texinfo::Document::indices_sort_strings($document, $registrar,
-                                            $main_configuration);
+  = Texinfo::Document::indices_sort_strings($document, $main_configuration);
 $index_entries_sort_strings
   = Texinfo::Indices::format_index_entries_sort_strings($indices_sort_strings);
 
diff --git a/tp/t/test_utils.pl b/tp/t/test_utils.pl
index e3f40a80f4..7e068ae9da 100644
--- a/tp/t/test_utils.pl
+++ b/tp/t/test_utils.pl
@@ -1100,21 +1100,20 @@ sub test($$)
   }
 
   my $nodes_tree_nodes_list
-          = Texinfo::Structuring::nodes_tree($document, $registrar,
-                                             $main_configuration);
+          = Texinfo::Structuring::nodes_tree($document, $main_configuration);
 
   Texinfo::Document::register_document_nodes_list($document,
                                                   $nodes_tree_nodes_list);
 
-  Texinfo::Structuring::set_menus_node_directions($document, $registrar,
+  Texinfo::Structuring::set_menus_node_directions($document,
                                                   $main_configuration);
 
   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, $registrar,
+    Texinfo::Structuring::complete_node_tree_with_menus($document,
                                                         $main_configuration);
 
-    Texinfo::Structuring::check_nodes_are_referenced($document, $registrar,
+    Texinfo::Structuring::check_nodes_are_referenced($document,
                                                      $main_configuration);
   }
 
@@ -1136,8 +1135,7 @@ sub test($$)
   # If $XS_structuring is set, the Perl structure cannot be
   # built yet from XS as the document index information have not
   # been rebuilt yet, but it is not needed at that point.
-  Texinfo::Document::indices_sort_strings($document, $registrar,
-                                          $main_configuration);
+  Texinfo::Document::indices_sort_strings($document, $main_configuration);
 
   # could be in a if !$XS_structuring, but the function should not be
   # overriden already in that case
@@ -1171,8 +1169,7 @@ sub test($$)
     }
 
     my $indices_sort_strings
-      = Texinfo::Document::indices_sort_strings($document, $registrar,
-                                                $main_configuration);
+      = Texinfo::Document::indices_sort_strings($document, 
$main_configuration);
 
     $index_entries_sort_strings
      = Texinfo::Indices::format_index_entries_sort_strings(
diff --git a/tp/texi2any.pl b/tp/texi2any.pl
index 1452cb805b..bb809ad511 100755
--- a/tp/texi2any.pl
+++ b/tp/texi2any.pl
@@ -1666,11 +1666,9 @@ while(@input_files) {
   }
 
   if ($formats_table{$converted_format}->{'nodes_tree'}) {
-    my $nodes_list
-        = Texinfo::Structuring::nodes_tree($document, $registrar,
-                                            $main_configuration);
-    Texinfo::Document::register_document_nodes_list($document,
-                                                    $nodes_list);
+    my $nodes_list = Texinfo::Structuring::nodes_tree($document,
+                                                      $main_configuration);
+    Texinfo::Document::register_document_nodes_list($document, $nodes_list);
 
     # With this condition, menu is the default for 'FORMAT_MENU'.
     # However, this can only happen if
@@ -1682,14 +1680,13 @@ 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, $registrar,
+      Texinfo::Structuring::set_menus_node_directions($document,
                                                       $main_configuration);
 
       Texinfo::Structuring::complete_node_tree_with_menus($document,
-                                                          $registrar,
                                                           $main_configuration);
 
-      Texinfo::Structuring::check_nodes_are_referenced($document, $registrar,
+      Texinfo::Structuring::check_nodes_are_referenced($document,
                                                        $main_configuration);
     }
   }
@@ -1698,8 +1695,7 @@ while(@input_files) {
   }
 
   if ($formats_table{$converted_format}->{'setup_index_entries_sort_strings'}) 
{
-    Texinfo::Document::indices_sort_strings($document, $registrar,
-                                            $main_configuration);
+    Texinfo::Document::indices_sort_strings($document, $main_configuration);
   }
 
   Texinfo::Document::rebuild_document($document);



reply via email to

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