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:35:55 -0500 (EST)

branch: master
commit 34db59f1470bc1c79d5b6ecd9e0eaa47e49da03a
Author: Gavin Smith <gavinsmith0123@gmail.com>
AuthorDate: Sun Feb 25 10:47:17 2024 +0000

    Remove separate error registrar argument
    
    * tp/Texinfo/Transformations.pm
    (insert_nodes_for_sectioning_commands, _new_node),
    * tp/Texinfo/XS/structuring_transfo/StructuringTransfoXS.xs
    (insert_nodes_for_sectioning_commands),
    * tp/Texinfo/Document.pm (_existing_label_error)
    (_add_element_to_identifiers_target, register_label_element):
    Remove "registrar" argument and access errors through 'registrar'
    key on Texinfo::Document argument.
---
 ChangeLog                                          | 13 +++++++++++++
 tp/Texinfo/Document.pm                             | 22 +++++++++-------------
 tp/Texinfo/Transformations.pm                      | 17 ++++++++---------
 .../XS/structuring_transfo/StructuringTransfoXS.xs |  2 +-
 tp/t/automatic_nodes.t                             |  4 ++--
 5 files changed, 33 insertions(+), 25 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index ae191f6501..54d1b1a957 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2024-02-25  Gavin Smith <gavinsmith0123@gmail.com>
+
+       Remove separate error registrar argument
+
+       * tp/Texinfo/Transformations.pm
+       (insert_nodes_for_sectioning_commands, _new_node),
+       * tp/Texinfo/XS/structuring_transfo/StructuringTransfoXS.xs
+       (insert_nodes_for_sectioning_commands),
+       * tp/Texinfo/Document.pm (_existing_label_error)
+       (_add_element_to_identifiers_target, register_label_element):
+       Remove "registrar" argument and access errors through 'registrar'
+       key on Texinfo::Document argument.
+
 2024-02-24  Patrice Dumas  <pertusus@free.fr>
 
        Add const.  Replace some int by size_t.
diff --git a/tp/Texinfo/Document.pm b/tp/Texinfo/Document.pm
index fe2e7ce91a..9af9a93088 100644
--- a/tp/Texinfo/Document.pm
+++ b/tp/Texinfo/Document.pm
@@ -304,13 +304,14 @@ sub document_descriptor($)
   return $self->{'document_descriptor'};
 }
 
-sub _existing_label_error($$;$$)
+sub _existing_label_error($$;$)
 {
   my $self = shift;
   my $element = shift;
-  my $registrar = shift;
   my $customization_information = shift;
 
+  my $registrar = $self->{'registrar'};
+
   if ($element->{'extra'}
       and defined($element->{'extra'}->{'normalized'})) {
     my $normalized = $element->{'extra'}->{'normalized'};
@@ -331,11 +332,10 @@ sub _existing_label_error($$;$$)
   }
 }
 
-sub _add_element_to_identifiers_target($$;$$)
+sub _add_element_to_identifiers_target($$;$)
 {
   my $self = shift;
   my $element = shift;
-  my $registrar = shift;
   my $customization_information = shift;
 
   if ($element->{'extra'}
@@ -365,8 +365,7 @@ sub set_labels_identifiers_target($$$)
   $self->{'identifiers_target'} = {};
   if (defined $self->{'labels_list'}) {
     foreach my $element (@{$self->{'labels_list'}}) {
-      my $retval = _add_element_to_identifiers_target($self,
-                                         $element, $registrar,
+      my $retval = _add_element_to_identifiers_target($self, $element,
                                          $customization_information);
       if (!$retval and $element->{'extra'}
           and defined($element->{'extra'}->{'normalized'})) {
@@ -380,25 +379,22 @@ sub set_labels_identifiers_target($$$)
      = sort {$a->{'extra'}->{'normalized'} cmp $b->{'extra'}->{'normalized'}}
         @elements_with_error;
     foreach my $element (@sorted) {
-      _existing_label_error($self, $element, $registrar,
-                            $customization_information);
+      _existing_label_error($self, $element, $customization_information);
     }
   }
 }
 
 # TODO document when stabilized
-sub register_label_element($$;$$)
+sub register_label_element($$;$)
 {
   my $self = shift;
   my $element = shift;
-  my $registrar = shift;
   my $customization_information = shift;
 
-  my $retval = _add_element_to_identifiers_target($self, $element, $registrar,
+  my $retval = _add_element_to_identifiers_target($self, $element,
                                          $customization_information);
   if (!$retval) {
-    _existing_label_error($self, $element, $registrar,
-                                         $customization_information);
+    _existing_label_error($self, $element, $customization_information);
   }
   # FIXME do not push at the end but have the caller give an information
   # on the element it should be after or before in the list?
diff --git a/tp/Texinfo/Transformations.pm b/tp/Texinfo/Transformations.pm
index 67c5b3e2cf..0fd3b1cc30 100644
--- a/tp/Texinfo/Transformations.pm
+++ b/tp/Texinfo/Transformations.pm
@@ -281,14 +281,14 @@ sub reference_to_arg_in_tree($)
 
 # prepare and add a new node as a possible cross reference targets
 # modifies $document
-# $REGISTRAR and $CUSTOMIZATION_INFORMATION are used for error
-# reporting, but they may not be useful, as the code checks that
-# the new node target label does not exist already.
-sub _new_node($$;$$)
+
+# $CUSTOMIZATION_INFORMATION is used for error reporting, but it may
+# not be useful, as the code checks that the new node target label does
+# not exist already.
+sub _new_node($$;$)
 {
   my $node_tree = shift;
   my $document = shift;
-  my $registrar = shift;
   my $customization_information = shift;
 
   if ($XS_structuring and $Texinfo::StructTransfXS::XS_package) {
@@ -388,7 +388,7 @@ sub _new_node($$;$$)
   }
   $node->{'extra'}->{'normalized'} = $normalized;
 
-  Texinfo::Document::register_label_element($document, $node, $registrar,
+  Texinfo::Document::register_label_element($document, $node,
                                             $customization_information);
 
   return $node;
@@ -432,10 +432,9 @@ sub _reassociate_to_node($$$)
   return undef;
 }
 
-sub insert_nodes_for_sectioning_commands($;$$)
+sub insert_nodes_for_sectioning_commands($;$)
 {
   my $document = shift;
-  my $registrar = shift;
   my $customization_information = shift;
 
   my $root = $document->tree();
@@ -457,7 +456,7 @@ sub insert_nodes_for_sectioning_commands($;$$)
         $new_node_tree
            = Texinfo::Common::copy_contentsNonXS($content->{'args'}->[0]);
       }
-      my $new_node = _new_node($new_node_tree, $document, $registrar,
+      my $new_node = _new_node($new_node_tree, $document,
                                $customization_information);
       if (defined($new_node)) {
         # insert before $content
diff --git a/tp/Texinfo/XS/structuring_transfo/StructuringTransfoXS.xs 
b/tp/Texinfo/XS/structuring_transfo/StructuringTransfoXS.xs
index 0beb2585dc..73cc08cc39 100644
--- a/tp/Texinfo/XS/structuring_transfo/StructuringTransfoXS.xs
+++ b/tp/Texinfo/XS/structuring_transfo/StructuringTransfoXS.xs
@@ -273,7 +273,7 @@ regenerate_master_menu (SV *document_in, SV 
*customization_information, SV *use_
 # The perl function returns the list of added nodes.
 void
 insert_nodes_for_sectioning_commands (SV *document_in, ...)
-   PROTOTYPE: $;$$
+   PROTOTYPE: $;$
     PREINIT:
         DOCUMENT *document = 0;
     CODE:
diff --git a/tp/t/automatic_nodes.t b/tp/t/automatic_nodes.t
index 6cd99043dc..de9df85582 100644
--- a/tp/t/automatic_nodes.t
+++ b/tp/t/automatic_nodes.t
@@ -176,7 +176,7 @@ $registrar = $parser->registered_errors();
 Texinfo::Structuring::associate_internal_references($document, $registrar,
                                                     $parser);
 Texinfo::Transformations::insert_nodes_for_sectioning_commands($document,
-                                                          $registrar, $parser);
+                                                          $parser);
 Texinfo::Document::rebuild_document($document);
 $tree = $document->tree();
 my $result = Texinfo::Convert::Texinfo::convert_to_texinfo($tree);
@@ -199,7 +199,7 @@ $registrar = $parser->registered_errors();
 Texinfo::Structuring::associate_internal_references($document, $registrar,
                                                     $parser);
 Texinfo::Transformations::insert_nodes_for_sectioning_commands($document,
-                                                          $registrar, $parser);
+                                                          $parser);
 
 Texinfo::Document::rebuild_document($document);
 



reply via email to

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