texinfo-commits
[Top][All Lists]
Advanced

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

[no subject]


From: Patrice Dumas
Date: Sun, 3 Mar 2024 14:33:48 -0500 (EST)

branch: master
commit 6b3d6f3020719f691492584f32b297ba666b5c24
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sun Mar 3 20:33:29 2024 +0100

    * tp/Texinfo/Structuring.pm (sectioning_structure),
    tp/Texinfo/XS/structuring_transfo/StructuringTransfoXS.xs
    (sectioning_structure): use a document in argument, to avoid the
    possibility to use the parser error registrar.  Update callers.
    
    * tp/t/test_utils.pl (test): call
    Texinfo::Document::sorted_indices_by_index instead of
    Texinfo::Indices::sort_indices_by_index, in particular to use the
    document errors registrar more simply.
---
 ChangeLog                                          | 12 +++++++++++
 tp/Texinfo/Structuring.pm                          | 23 +++++++++++-----------
 .../XS/structuring_transfo/StructuringTransfoXS.xs |  7 ++++---
 tp/t/automatic_menus.t                             |  2 +-
 tp/t/convert_to_text.t                             |  2 +-
 tp/t/test_tree_copy.t                              |  2 +-
 tp/t/test_utils.pl                                 |  6 +++---
 tp/texi2any.pl                                     |  2 +-
 8 files changed, 35 insertions(+), 21 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 79add020e0..65f3f62281 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2024-03-03  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/Structuring.pm (sectioning_structure),
+       tp/Texinfo/XS/structuring_transfo/StructuringTransfoXS.xs
+       (sectioning_structure): use a document in argument, to avoid the
+       possibility to use the parser error registrar.  Update callers.
+
+       * tp/t/test_utils.pl (test): call
+       Texinfo::Document::sorted_indices_by_index instead of
+       Texinfo::Indices::sort_indices_by_index, in particular to use the
+       document errors registrar more simply.
+
 2024-03-03  Patrice Dumas  <pertusus@free.fr>
 
        Separate Parser and Document errors and registrars
diff --git a/tp/Texinfo/Structuring.pm b/tp/Texinfo/Structuring.pm
index e0f1b80918..b952ecd9ab 100644
--- a/tp/Texinfo/Structuring.pm
+++ b/tp/Texinfo/Structuring.pm
@@ -163,12 +163,14 @@ my %unnumbered_commands = 
%Texinfo::Commands::unnumbered_commands;
 # 'section_childs'
 # 'section_directions'
 # 'toplevel_directions'
-sub sectioning_structure($$$)
+sub sectioning_structure($$)
 {
-  my $root = shift;
-  my $registrar = shift;
+  my $document = shift;
   my $customization_information = shift;
 
+  my $root = $document->tree();
+  my $registrar = $document->{'registrar'};
+
   my $sec_root;
   my $previous_section;
   my $previous_toplevel;
@@ -2239,10 +2241,9 @@ Texinfo::Structuring - information on Texinfo::Document 
tree
     units_directions units_file_directions);
 
   # $document is a parsed Texinfo::Document document, $tree is the
-  # associated Texinfo document tree.  $parser is a Texinfo::Parser
-  # object. $config is an object implementing the get_conf() method.
-  my $registrar = $parser->registered_errors();
-  my $sections_list = sectioning_structure($tree, $registrar, $config);
+  # associated Texinfo document tree. $config is an object implementing
+  # the get_conf() method.
+  my $sections_list = sectioning_structure($document, $config);
   my $identifier_target = $document->labels_information();
   my $global_commands = $document->global_commands_information();
   my $nodes_list = nodes_tree($document, $config);
@@ -2480,12 +2481,12 @@ Return the sectioning command name corresponding to the 
sectioning
 element I<$element>, adjusted in order to take into account raised
 and lowered sections, when needed.
 
-=item $sections_list = sectioning_structure($tree, $registrar, 
$customization_information)
+=item $sections_list = sectioning_structure($document, 
$customization_information)
 X<C<sectioning_structure>>
 
-This function goes through the tree and gather information on the document
-structure for sectioning commands.  It returns a reference on the sections
-elements list.  Errors are registered in I<$registrar>.
+This function goes through the parsed document tree and gather information
+on the document structure for sectioning commands.  It returns a reference
+on the sections elements list.
 
 It sets section elements C<extra> hash values:
 
diff --git a/tp/Texinfo/XS/structuring_transfo/StructuringTransfoXS.xs 
b/tp/Texinfo/XS/structuring_transfo/StructuringTransfoXS.xs
index 3373cd73cd..a0efd637c1 100644
--- a/tp/Texinfo/XS/structuring_transfo/StructuringTransfoXS.xs
+++ b/tp/Texinfo/XS/structuring_transfo/StructuringTransfoXS.xs
@@ -160,12 +160,13 @@ associate_internal_references (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
-sectioning_structure (SV *tree_in, ...)
-    PROTOTYPE: $$$
+sectioning_structure (SV *document_in, ...)
+    PROTOTYPE: $$
     PREINIT:
         DOCUMENT *document = 0;
      CODE:
-        document = get_sv_tree_document (tree_in, "sectioning_structure");
+        document = get_sv_document_document (document_in,
+                                             "sectioning_structure");
         if (document)
           {
             ELEMENT_LIST *sections_list = sectioning_structure (document);
diff --git a/tp/t/automatic_menus.t b/tp/t/automatic_menus.t
index 918cea2408..eb352e5ac5 100644
--- a/tp/t/automatic_menus.t
+++ b/tp/t/automatic_menus.t
@@ -31,7 +31,7 @@ sub test($$$;$$)
   my $registrar = $parser->registered_errors();
   Texinfo::Structuring::associate_internal_references($document, $parser);
 
-  Texinfo::Structuring::sectioning_structure($tree, $registrar, $parser);
+  Texinfo::Structuring::sectioning_structure($document, $parser);
   if ($complete_missing_menus) {
     Texinfo::Transformations::complete_tree_nodes_missing_menu($tree, undef,
                                                                $use_sections);
diff --git a/tp/t/convert_to_text.t b/tp/t/convert_to_text.t
index 61b59b3063..d38b44ba53 100644
--- a/tp/t/convert_to_text.t
+++ b/tp/t/convert_to_text.t
@@ -76,7 +76,7 @@ my $registrar = $parser->registered_errors();
 my $main_configuration = Texinfo::MainConfig::new();
 # Setup sectioning commands numbers
 my $sections_list
-            = Texinfo::Structuring::sectioning_structure($tree, $registrar,
+            = Texinfo::Structuring::sectioning_structure($document,
                                                        $main_configuration);
 if ($sections_list) {
   Texinfo::Document::register_document_sections_list($document,
diff --git a/tp/t/test_tree_copy.t b/tp/t/test_tree_copy.t
index 72cc68298c..33d84fe46a 100644
--- a/tp/t/test_tree_copy.t
+++ b/tp/t/test_tree_copy.t
@@ -148,7 +148,7 @@ my $texi_copy = 
Texinfo::Convert::Texinfo::convert_to_texinfo($copy);
 is ($texi_copy, $texi_tree, "tree and copy to texi match");
 
 # set sectioning structure and redo a copy
-Texinfo::Structuring::sectioning_structure($tree, $test_registrar,
+Texinfo::Structuring::sectioning_structure($document,
                                            $test_parser);
 
 $tree = Texinfo::Document::rebuild_tree($tree);
diff --git a/tp/t/test_utils.pl b/tp/t/test_utils.pl
index 9d37284c6c..260bebbf7e 100644
--- a/tp/t/test_utils.pl
+++ b/tp/t/test_utils.pl
@@ -1080,7 +1080,7 @@ sub test($$)
   Texinfo::Structuring::associate_internal_references($document,
                                                       $main_configuration);
   my $sections_list
-        = Texinfo::Structuring::sectioning_structure($tree, $registrar,
+        = Texinfo::Structuring::sectioning_structure($document,
                                                    $main_configuration);
   if ($sections_list) {
     Texinfo::Document::register_document_sections_list($document,
@@ -1178,8 +1178,8 @@ sub test($$)
                                                      $indices_sort_strings);
 
     $sorted_index_entries
-      = Texinfo::Indices::sort_indices_by_index($document, $registrar,
-                                                $main_configuration,
+      = Texinfo::Document::sorted_indices_by_index($document,
+                                          $main_configuration,
                                  $use_unicode_collation, $locale_lang);
     $indices_sorted_sort_strings = {};
     foreach my $index_name (keys(%$sorted_index_entries)) {
diff --git a/tp/texi2any.pl b/tp/texi2any.pl
index 3700e37d4b..f361026a6b 100755
--- a/tp/texi2any.pl
+++ b/tp/texi2any.pl
@@ -1626,7 +1626,7 @@ while(@input_files) {
   # and useful in converters.
   # every format needs the sectioning structure
   my $sections_list
-            = Texinfo::Structuring::sectioning_structure($tree, $registrar,
+            = Texinfo::Structuring::sectioning_structure($document,
                                                        $main_configuration);
   if ($sections_list) {
     Texinfo::Document::register_document_sections_list($document,



reply via email to

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