texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: * tp/Texinfo/XS/main/call_perl_function.c (call_c


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/XS/main/call_perl_function.c (call_common_set_output_perl_encoding): add a call to Texinfo::Common::set_output_perl_encoding to be able to set OUTPUT_PERL_ENCODING from C.
Date: Tue, 01 Oct 2024 12:22:23 -0400

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 7d300d30aa * tp/Texinfo/XS/main/call_perl_function.c 
(call_common_set_output_perl_encoding): add a call to 
Texinfo::Common::set_output_perl_encoding to be able to set 
OUTPUT_PERL_ENCODING from C.
7d300d30aa is described below

commit 7d300d30aa1a1cb910501ae3bf0713026a39acd2
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Thu Jul 25 00:01:10 2024 +0200

    * tp/Texinfo/XS/main/call_perl_function.c
    (call_common_set_output_perl_encoding): add a call to
    Texinfo::Common::set_output_perl_encoding to be able to set
    OUTPUT_PERL_ENCODING from C.
    
    * tp/Texinfo/XS/convert/build_html_perl_state.c
    (html_pass_conversion_initialization): call
    call_common_set_output_perl_encoding if
    converter->external_references_number > 0.
    
    * tp/Texinfo/Common.pm (output_files_open_out): remove call to
    set_output_perl_encoding.
---
 ChangeLog                                     | 15 ++++++++++++++
 tp/Texinfo/Common.pm                          |  8 --------
 tp/Texinfo/Convert/HTML.pm                    |  3 ++-
 tp/Texinfo/XS/convert/ConvertXS.xs            |  1 -
 tp/Texinfo/XS/convert/build_html_perl_state.c |  4 ++++
 tp/Texinfo/XS/main/call_perl_function.c       | 29 +++++++++++++++++++++++++++
 tp/Texinfo/XS/main/call_perl_function.h       |  2 ++
 7 files changed, 52 insertions(+), 10 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 12b430aedd..898a60b037 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,21 @@
        (call_formatting_function_format_single_footnote): check and reset
        flags in build_html_formatting_state.
 
+2024-07-24  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/XS/main/call_perl_function.c
+       (call_common_set_output_perl_encoding): add a call to
+       Texinfo::Common::set_output_perl_encoding to be able to set
+       OUTPUT_PERL_ENCODING from C.
+
+       * tp/Texinfo/XS/convert/build_html_perl_state.c
+       (html_pass_conversion_initialization): call
+       call_common_set_output_perl_encoding if
+       converter->external_references_number > 0.
+
+       * tp/Texinfo/Common.pm (output_files_open_out): remove call to
+       set_output_perl_encoding.
+
 2024-07-24  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/XS/convert/convert_html.c
diff --git a/tp/Texinfo/Common.pm b/tp/Texinfo/Common.pm
index 8c031c052b..e98cf0d835 100644
--- a/tp/Texinfo/Common.pm
+++ b/tp/Texinfo/Common.pm
@@ -1071,14 +1071,6 @@ sub output_files_open_out($$$;$$)
   } elsif (defined(
              $customization_information->get_conf('OUTPUT_PERL_ENCODING'))) {
     $encoding = $customization_information->get_conf('OUTPUT_PERL_ENCODING');
-  } else {
-    # if XS is used, OUTPUT_PERL_ENCODING is not set when initializing the
-    # conversion, try to set it here
-    set_output_perl_encoding($customization_information);
-    if (defined(
-          $customization_information->get_conf('OUTPUT_PERL_ENCODING'))) {
-      $encoding = $customization_information->get_conf('OUTPUT_PERL_ENCODING');
-    }
   }
 
   if ($file_path eq '-') {
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index 97810034e9..7aab179858 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -12580,6 +12580,7 @@ sub _prepare_simpletitle($)
   }
 }
 
+# Common to output and convert, run after the first handler in output.
 sub _init_conversion_after_setup_handler($)
 {
   my $self = shift;
@@ -12630,7 +12631,6 @@ sub convert($$)
   # are set and present in the buttons, as is the case in the default
   # buttons.  For example in converters_tests/ref_in_sectioning
   # or converters_tests/sections_and_printindex.
-  # Output units lists are rebuilt in the XS code.
   $self->_prepare_output_units_global_targets($output_units,
                                               $special_units,
                                               $associated_special_units);
@@ -13514,6 +13514,7 @@ sub _setup_output($)
           $document_name];
 }
 
+# return 0 on failure, 1 on success.
 sub _finish_output($$$$)
 {
   my $self = shift;
diff --git a/tp/Texinfo/XS/convert/ConvertXS.xs 
b/tp/Texinfo/XS/convert/ConvertXS.xs
index e98542115d..644aa46711 100644
--- a/tp/Texinfo/XS/convert/ConvertXS.xs
+++ b/tp/Texinfo/XS/convert/ConvertXS.xs
@@ -833,7 +833,6 @@ html_convert (SV *converter_in, SV *document_in)
            are set and present in the buttons, as is the case in the default
            buttons.  For example in converters_tests/ref_in_sectioning
            or converters_tests/sections_and_printindex.
-           Output units lists are rebuilt in the XS code.
          */
         html_prepare_output_units_global_targets (self);
 
diff --git a/tp/Texinfo/XS/convert/build_html_perl_state.c 
b/tp/Texinfo/XS/convert/build_html_perl_state.c
index 7a0285ee58..3b69a49262 100644
--- a/tp/Texinfo/XS/convert/build_html_perl_state.c
+++ b/tp/Texinfo/XS/convert/build_html_perl_state.c
@@ -41,6 +41,8 @@
 #include "convert_to_texinfo.h"
 #include "output_unit.h"
 #include "command_stack.h"
+/* for call_common_set_output_perl_encoding */
+#include "call_perl_function.h"
 /* also for perl_only_* wrappers */
 #include "build_perl_info.h"
 /* for NAMED_STRING_ELEMENT_LIST */
@@ -267,6 +269,8 @@ html_pass_conversion_initialization (CONVERTER *converter,
         {
           html_pass_converter_initialization_state (converter, converter_hv,
                                                     document_in);
+
+          call_common_set_output_perl_encoding (converter);
         }
     }
 }
diff --git a/tp/Texinfo/XS/main/call_perl_function.c 
b/tp/Texinfo/XS/main/call_perl_function.c
index e8db138b57..6f7c9fe55e 100644
--- a/tp/Texinfo/XS/main/call_perl_function.c
+++ b/tp/Texinfo/XS/main/call_perl_function.c
@@ -50,6 +50,35 @@ newSVpv_utf8 (const char *str, STRLEN len)
   return sv;
 }
 
+void
+call_common_set_output_perl_encoding (const CONVERTER *self)
+{
+  int count;
+
+  dTHX;
+
+  dSP;
+
+  ENTER;
+  SAVETMPS;
+
+  PUSHMARK(SP);
+  EXTEND(SP, 1);
+
+  PUSHs(sv_2mortal (newRV_inc (self->hv)));
+  PUTBACK;
+
+  count = call_pv (
+    "Texinfo::Common::set_output_perl_encoding",
+    G_DISCARD);
+
+  if (count != 0)
+    croak ("set_output_perl_encoding should return 0 item\n");
+
+  FREETMPS;
+  LEAVE;
+}
+
 char *
 call_nodenamenormalization_unicode_to_transliterate (const char *text)
 {
diff --git a/tp/Texinfo/XS/main/call_perl_function.h 
b/tp/Texinfo/XS/main/call_perl_function.h
index 9204adb3b6..7fc450a4fd 100644
--- a/tp/Texinfo/XS/main/call_perl_function.h
+++ b/tp/Texinfo/XS/main/call_perl_function.h
@@ -6,6 +6,8 @@
 #include "document_types.h"
 #include "converter_types.h"
 
+void call_common_set_output_perl_encoding (const CONVERTER *self);
+
 char *call_nodenamenormalization_unicode_to_transliterate (const char *text);
 
 const void *call_setup_collator (int use_unicode_collation,



reply via email to

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