texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: * tp/Texinfo/XS/convert/convert_html.c (html_conv


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/XS/convert/convert_html.c (html_convert_tree): rename convert_tree as html_convert_tree.
Date: Mon, 30 Oct 2023 11:30:27 -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 6d441ed2f0 * tp/Texinfo/XS/convert/convert_html.c (html_convert_tree): 
rename convert_tree as html_convert_tree.
6d441ed2f0 is described below

commit 6d441ed2f0ffe9c37d9f72269243941053d10e86
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Mon Oct 30 16:30:17 2023 +0100

    * tp/Texinfo/XS/convert/convert_html.c (html_convert_tree): rename
    convert_tree as html_convert_tree.
    
    * tp/Texinfo/Convert/HTML.pm (_XS_html_convert_tree),
    tp/Texinfo/XS/convert/ConvertXS.xs (html_convert_tree):
    immplementation of html_convert_tree XS interface, not used as
    convert_tree is not called on trees registered in XS.
---
 ChangeLog                            | 10 ++++++++++
 tp/Texinfo/Convert/HTML.pm           | 13 +++++++++++++
 tp/Texinfo/XS/convert/ConvertXS.xs   | 28 ++++++++++++++++++++++++++++
 tp/Texinfo/XS/convert/convert_html.c | 15 ++++++++-------
 tp/Texinfo/XS/convert/convert_html.h |  1 +
 5 files changed, 60 insertions(+), 7 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 2f5891f09b..6315e93ceb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2023-10-30  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/XS/convert/convert_html.c (html_convert_tree): rename
+       convert_tree as html_convert_tree.
+
+       * tp/Texinfo/Convert/HTML.pm (_XS_html_convert_tree),
+       tp/Texinfo/XS/convert/ConvertXS.xs (html_convert_tree):
+       immplementation of html_convert_tree XS interface, not used as
+       convert_tree is not called on trees registered in XS.
+
 2023-10-30  Patrice Dumas  <pertusus@free.fr>
 
        * tp/texi2any.pl: do not rebuild the perl document/tree before calling
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index 2573c62a41..688fd65e58 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -127,6 +127,9 @@ sub import {
       Texinfo::XSLoader::override(
       "Texinfo::Convert::HTML::_XS_html_convert_convert",
       "Texinfo::Convert::ConvertXS::html_convert_convert");
+      #Texinfo::XSLoader::override(
+      #"Texinfo::Convert::HTML::_XS_html_convert_tree",
+      #"Texinfo::Convert::ConvertXS::html_convert_tree");
     }
 
     $module_loaded = 1;
@@ -8434,6 +8437,11 @@ sub converter_initialize($)
   return $self;
 }
 
+sub _XS_html_convert_tree($$;$)
+{
+  return undef;
+}
+
 # the entry point for _convert
 sub convert_tree($$;$)
 {
@@ -8441,6 +8449,11 @@ sub convert_tree($$;$)
   my $tree = shift;
   my $explanation = shift;
 
+  # No XS, convert_tree is not called on trees registered in XS
+  #my $XS_result = _XS_html_convert_tree($self, $tree,
+  #     (defined($explanation) ? Encode::encode('UTf-8', $explanation) : ''));
+  #return $XS_result if (defined($XS_result));
+
   # when formatting accents, goes through xml_accent without
   # explanation, as explanation is not in the standard API, but
   # otherwise the coverage of explanations should be pretty good
diff --git a/tp/Texinfo/XS/convert/ConvertXS.xs 
b/tp/Texinfo/XS/convert/ConvertXS.xs
index 70dd40c03d..6adaef7361 100644
--- a/tp/Texinfo/XS/convert/ConvertXS.xs
+++ b/tp/Texinfo/XS/convert/ConvertXS.xs
@@ -370,3 +370,31 @@ html_convert_convert (SV *converter_in, SV *tree_in, SV 
*output_units_in, SV *sp
     OUTPUT:
         RETVAL
 
+# currently not used, convert_tree is not called on trees registered in XS
+SV *
+html_convert_tree (SV *converter_in, SV *tree_in, explanation)
+        char *explanation = (char *)SvPVbyte_nolen($arg);
+  PROTOTYPE: $$;$
+  PREINIT:
+        CONVERTER *self = 0;
+        DOCUMENT *document = 0;
+        SV *result_sv = 0;
+     CODE:
+        self = get_sv_converter (converter_in, 0);
+        if (self)
+          {
+            document = get_sv_tree_document (tree_in, 0);
+            if (document)
+              {
+                char *result = html_convert_tree(self, document->tree,
+                                                 explanation);
+                result_sv = newSVpv_utf8 (result, 0);
+                free (result);
+              }
+          }
+        if (result_sv)
+          RETVAL = result_sv;
+        else
+          RETVAL = newSV (0);
+    OUTPUT:
+        RETVAL
diff --git a/tp/Texinfo/XS/convert/convert_html.c 
b/tp/Texinfo/XS/convert/convert_html.c
index 17bf26457e..f79c9da0e5 100644
--- a/tp/Texinfo/XS/convert/convert_html.c
+++ b/tp/Texinfo/XS/convert/convert_html.c
@@ -2287,7 +2287,7 @@ html_initialize_output_state (CONVERTER *self)
 }
 
 char *
-convert_tree (CONVERTER *self, ELEMENT *tree, char *explanation)
+html_convert_tree (CONVERTER *self, ELEMENT *tree, char *explanation)
 {
   TEXT result;
   text_init (&result);
@@ -2333,7 +2333,7 @@ convert_tree_new_formatting_context (CONVERTER *self, 
ELEMENT *tree,
                                            multiple_pass_str);
 
   xasprintf (&explanation, "new_fmt_ctx %s", context_string_str.text);
-  result = convert_tree (self, tree, explanation);
+  result = html_convert_tree (self, tree, explanation);
 
   free (explanation);
   free (context_string_str.text);
@@ -2418,7 +2418,8 @@ reset_unset_no_arg_commands_formatting_context (CONVERTER 
*self,
           char *explanation;
           xasprintf (&explanation, "no arg %s translated",
                      builtin_command_data[cmd].cmdname);
-          translation_result = convert_tree (self, translated_tree, 
explanation);
+          translation_result = html_convert_tree (self, translated_tree,
+                                                  explanation);
           free (explanation);
         }
       else if (reset_context == HCC_type_preformatted)
@@ -2444,8 +2445,8 @@ reset_unset_no_arg_commands_formatting_context (CONVERTER 
*self,
 
           xasprintf (&explanation, "no arg %s translated",
                      builtin_command_data[cmd].cmdname);
-          translation_result = convert_tree (self, translated_tree,
-                                             explanation);
+          translation_result = html_convert_tree (self, translated_tree,
+                                                  explanation);
           free (explanation);
           pop_command_or_type (&top_document_ctx->composition_context);
           pop_string_stack (&top_document_ctx->preformatted_classes);
@@ -2465,8 +2466,8 @@ reset_unset_no_arg_commands_formatting_context (CONVERTER 
*self,
           top_document_ctx->string_ctx++;
 
           self->modified_state |= HMSF_document_context;
-          translation_result = convert_tree (self, translated_tree,
-                                             context_name);
+          translation_result = html_convert_tree (self, translated_tree,
+                                                  context_name);
           free (context_name);
           html_pop_document_context (self);
           self->modified_state |= HMSF_document_context;
diff --git a/tp/Texinfo/XS/convert/convert_html.h 
b/tp/Texinfo/XS/convert/convert_html.h
index cbdc916b5d..b02b2a8789 100644
--- a/tp/Texinfo/XS/convert/convert_html.h
+++ b/tp/Texinfo/XS/convert/convert_html.h
@@ -37,5 +37,6 @@ void html_convert_init (CONVERTER *self);
 char *html_convert_convert (CONVERTER *self, ELEMENT *root,
                             int output_units_descriptor,
                             int special_units_descriptor);
+char *html_convert_tree (CONVERTER *self, ELEMENT *tree, char *explanation);
 
 #endif



reply via email to

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