texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: * tp/Texinfo/Document.pm (%XS_structure_overrides


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/Document.pm (%XS_structure_overrides) (setup_indices_sort_strings, indices_sort_strings), tp/Texinfo/XS/main/DocumentXS.xs (setup_indices_sort_strings), tp/texi2any.pl: add setup_indices_sort_strings that does the same as indices_sort_strings but does not return anything, to avoid building Perl data in XS if not needed.
Date: Sat, 09 Mar 2024 18:05:08 -0500

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

pertusus pushed a commit to branch master
in repository texinfo.

The following commit(s) were added to refs/heads/master by this push:
     new bffe7ccd5b * tp/Texinfo/Document.pm (%XS_structure_overrides) 
(setup_indices_sort_strings, indices_sort_strings), 
tp/Texinfo/XS/main/DocumentXS.xs (setup_indices_sort_strings), tp/texi2any.pl: 
add setup_indices_sort_strings that does the same as indices_sort_strings but 
does not return anything, to avoid building Perl data in XS if not needed.
bffe7ccd5b is described below

commit bffe7ccd5b8d44f33b61677b41cdf2554e602180
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sun Mar 10 00:05:06 2024 +0100

    * tp/Texinfo/Document.pm (%XS_structure_overrides)
    (setup_indices_sort_strings, indices_sort_strings),
    tp/Texinfo/XS/main/DocumentXS.xs (setup_indices_sort_strings),
    tp/texi2any.pl: add setup_indices_sort_strings that does the same as
    indices_sort_strings but does not return anything, to avoid building
    Perl data in XS if not needed.
---
 ChangeLog                        |  9 +++++++++
 tp/Texinfo/Document.pm           | 14 +++++++++++++-
 tp/Texinfo/XS/main/DocumentXS.xs | 13 +++++++++++++
 tp/texi2any.pl                   |  3 ++-
 4 files changed, 37 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 83e3e47cbb..fe9eb0761f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2024-03-09  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/Document.pm (%XS_structure_overrides)
+       (setup_indices_sort_strings, indices_sort_strings),
+       tp/Texinfo/XS/main/DocumentXS.xs (setup_indices_sort_strings),
+       tp/texi2any.pl: add setup_indices_sort_strings that does the same as
+       indices_sort_strings but does not return anything, to avoid building
+       Perl data in XS if not needed.
+
 2024-03-09  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/XS/main/build_perl_info.c (element_to_perl_hash): store
diff --git a/tp/Texinfo/Document.pm b/tp/Texinfo/Document.pm
index 05d503ae87..46d3fda102 100644
--- a/tp/Texinfo/Document.pm
+++ b/tp/Texinfo/Document.pm
@@ -82,6 +82,8 @@ our %XS_structure_overrides = (
     => "Texinfo::DocumentXS::document_floats_information",
   "Texinfo::Document::internal_references_information"
     => "Texinfo::DocumentXS::document_internal_references_information",
+  "Texinfo::Document::setup_indices_sort_strings"
+    => "Texinfo::DocumentXS::setup_indices_sort_strings",
   "Texinfo::Document::indices_sort_strings"
     => "Texinfo::DocumentXS::indices_sort_strings",
 );
@@ -246,7 +248,7 @@ 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 setup_indices_sort_strings($$)
 {
   my $document = shift;
   my $customization_information = shift;
@@ -259,7 +261,17 @@ sub indices_sort_strings($$)
               $document->indices_information(), 0);
     $document->{'index_entries_sort_strings'} = $indices_sort_strings;
   }
+}
+
+# similar to setup_indices_sort_strings, but returns the sort strings too.
+# A different function such that Perl data is only built for that function
+# in the XS override.
+sub indices_sort_strings($$)
+{
+  my $document = shift;
+  my $customization_information = shift;
 
+  setup_indices_sort_strings($document, $customization_information);
   return $document->{'index_entries_sort_strings'};
 }
 
diff --git a/tp/Texinfo/XS/main/DocumentXS.xs b/tp/Texinfo/XS/main/DocumentXS.xs
index 76f61ddfee..7dfc1c114b 100644
--- a/tp/Texinfo/XS/main/DocumentXS.xs
+++ b/tp/Texinfo/XS/main/DocumentXS.xs
@@ -247,6 +247,19 @@ document_internal_references_information (SV *document_in)
 SV *
 document_labels_list (SV *document_in)
 
+# customization_information
+void
+setup_indices_sort_strings (SV *document_in, ...)
+    PROTOTYPE: $$
+    PREINIT:
+        DOCUMENT *document = 0;
+     CODE:
+        document = get_sv_document_document (document_in,
+                                             "setup_indices_sort_strings");
+        if (document)
+          document_indices_sort_strings (document, document->error_messages,
+                                         document->options);
+
 # customization_information
 SV *
 indices_sort_strings (SV *document_in, ...)
diff --git a/tp/texi2any.pl b/tp/texi2any.pl
index 448ae6e0d6..f8e46b73a7 100755
--- a/tp/texi2any.pl
+++ b/tp/texi2any.pl
@@ -1677,7 +1677,8 @@ while(@input_files) {
 
   # do it now to get error messages here
   if ($formats_table{$converted_format}->{'setup_index_entries_sort_strings'}) 
{
-    Texinfo::Document::indices_sort_strings($document, $main_configuration);
+    Texinfo::Document::setup_indices_sort_strings($document,
+                                                  $main_configuration);
   }
 
   Texinfo::Document::rebuild_document($document);



reply via email to

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