texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: * tp/Texinfo/Convert/HTML.pm (%XS_conversion_over


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/Convert/HTML.pm (%XS_conversion_overrides) (_initialize_output_state, _initialize_XS_NonXS_output_state): add _initialize_XS_NonXS_output_state, which sets up the states that need to be set up both in perl and XS, and calls _initialize_output_state, now directly overriden, that sets up the states that only need to be setup if there is no XS.
Date: Thu, 14 Dec 2023 17:54:53 -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 ce7d9c5120 * tp/Texinfo/Convert/HTML.pm (%XS_conversion_overrides) 
(_initialize_output_state, _initialize_XS_NonXS_output_state): add 
_initialize_XS_NonXS_output_state, which sets up the states that need to be set 
up both in perl and XS, and calls _initialize_output_state, now directly 
overriden, that sets up the states that only need to be setup if there is no XS.
ce7d9c5120 is described below

commit ce7d9c5120e035d5d53a5919f167fd00c6292c43
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Thu Dec 14 23:54:47 2023 +0100

    * tp/Texinfo/Convert/HTML.pm (%XS_conversion_overrides)
    (_initialize_output_state, _initialize_XS_NonXS_output_state): add
    _initialize_XS_NonXS_output_state, which sets up the states that need
    to be set up both in perl and XS, and calls _initialize_output_state,
    now directly overriden, that sets up the states that only need to be
    setup if there is no XS.
---
 ChangeLog                            |  9 ++++++
 tp/Texinfo/Convert/HTML.pm           | 55 ++++++++++++++++++++----------------
 tp/Texinfo/XS/convert/convert_html.c |  3 --
 3 files changed, 39 insertions(+), 28 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index b93e0f4fe0..2c6b09cfc0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2023-12-14  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/Convert/HTML.pm (%XS_conversion_overrides)
+       (_initialize_output_state, _initialize_XS_NonXS_output_state): add
+       _initialize_XS_NonXS_output_state, which sets up the states that need
+       to be set up both in perl and XS, and calls _initialize_output_state,
+       now directly overriden, that sets up the states that only need to be
+       setup if there is no XS.
+
 2023-12-14  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/Convert/Converter.pm (%XS_overrides, reset_converter),
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index 8b7e4c025f..1f87cba437 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -114,7 +114,7 @@ my %XS_conversion_overrides = (
    => "Texinfo::Convert::ConvertXS::html_format_init",
   "Texinfo::Convert::HTML::_XS_html_converter_initialize"
    => "Texinfo::Convert::ConvertXS::html_converter_initialize_sv",
-  "Texinfo::Convert::HTML::_XS_initialize_output_state"
+  "Texinfo::Convert::HTML::_initialize_output_state"
    => "Texinfo::Convert::ConvertXS::html_initialize_output_state",
   "Texinfo::Convert::HTML::_finalize_output_state"
    => "Texinfo::Convert::ConvertXS::html_finalize_output_state",
@@ -11207,30 +11207,18 @@ sub _has_contents_or_shortcontents($)
   return 0;
 }
 
-sub _XS_initialize_output_state($$)
-{
-}
-
 # to be called before starting conversion.
 # NOTE not called directly by convert_tree, which means that convert_tree
 # needs to be called from a converter which would have had this function
 # called already.
+
+# This function initializes states that are initialized either in XS or in perl
 sub _initialize_output_state($$)
 {
   my $self = shift;
   my $context = shift;
 
-  # TODO override the whole function and add a C build_ function to setup
-  # the perl state similarly with what is done in that function.
-  _XS_initialize_output_state($self, $context.'C');
-
   $self->{'document_context'} = [];
-  $self->{'multiple_pass'} = [];
-
-  # for diverse API used in conversion
-  $self->{'shared_conversion_state'} = {};
-  $self->{'shared_conversion_state_integers'} = {};
-  $self->{'shared_conversion_accessed_integers'} = {};
 
   $self->{'associated_inline_content'} = {};
 
@@ -11241,6 +11229,31 @@ sub _initialize_output_state($$)
   $self->{'document_global_context_css'} = {};
   $self->{'page_css'} = {};
 
+  $self->{'seen_ids'} = {};
+
+  # other
+  $self->{'pending_footnotes'} = [];
+  $self->{'pending_closes'} = [];
+
+  $self->_new_document_context($context);
+}
+
+# This function initializes states that are initialized both in XS and
+# in perl.
+sub _initialize_XS_NonXS_output_state($$)
+{
+  my $self = shift;
+  my $context = shift;
+
+  $self->_initialize_output_state($context);
+
+  $self->{'multiple_pass'} = [];
+
+  # for diverse API used in conversion
+  $self->{'shared_conversion_state'} = {};
+  $self->{'shared_conversion_state_integers'} = {};
+  $self->{'shared_conversion_accessed_integers'} = {};
+
   # direction strings
   foreach my $string_type (keys(%default_translated_directions_strings)) {
     # those will be determined from translatable strings
@@ -11252,7 +11265,6 @@ sub _initialize_output_state($$)
   # used for diverse tree elements: nodes and sectioning commands, indices,
   # footnotes, special output units elements...
   $self->{'targets'} = {};
-  $self->{'seen_ids'} = {};
 
   # for global directions always set, and for directions to special elements,
   # only filled if special elements are actually used.
@@ -11261,19 +11273,12 @@ sub _initialize_output_state($$)
   # for footnotes
   $self->{'special_targets'} = {'footnote_location' => {}};
 
-  # other
-  $self->{'pending_footnotes'} = [];
-  # not used if conversion with XS
-  $self->{'pending_closes'} = [];
-
   # to avoid infinite recursions when a section refers to itself, possibly
   # indirectly
   $self->{'referred_command_stack'} = [];
 
   $self->{'check_htmlxref_already_warned'} = {}
     if ($self->get_conf('CHECK_HTMLXREF'));
-
-  $self->_new_document_context($context);
 }
 
 sub _finalize_output_state($)
@@ -11362,7 +11367,7 @@ sub convert($$)
   my $converter_info;
   my $root = $document->tree();
 
-  $self->_initialize_output_state('_convert');
+  $self->_initialize_XS_NonXS_output_state('_convert');
 
   # the presence of contents elements in the document is used in diverse
   # places, set it once for all here
@@ -11898,7 +11903,7 @@ sub output($$)
   # therefore set in converter_info early too (using the reference).
   $self->{'current_filename'} = undef;
 
-  $self->_initialize_output_state('_output');
+  $self->_initialize_XS_NonXS_output_state('_output');
 
   # no splitting when writing to the null device or to stdout or returning
   # a string
diff --git a/tp/Texinfo/XS/convert/convert_html.c 
b/tp/Texinfo/XS/convert/convert_html.c
index 3348b3dc0d..9f2bc8d848 100644
--- a/tp/Texinfo/XS/convert/convert_html.c
+++ b/tp/Texinfo/XS/convert/convert_html.c
@@ -8887,10 +8887,7 @@ html_initialize_output_state (CONVERTER *self, char 
*context)
   self->current_types_conversion_function = &self->type_conversion_function[0];
   self->current_format_protect_text = &html_default_format_protect_text;
 
-  /* FIXME now done through HTML _initialize_output_state, would need
-     to readd when the HTML function is overriden
   html_new_document_context (self, context, 0, 0);
-   */
 }
 
 void



reply via email to

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