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_comm


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/XS/convert/convert_html.c (html_command_root_element_command): rename command_root_element_command as html_command_root_element_command.
Date: Sun, 24 Dec 2023 16:54:29 -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 60ae68df28 * tp/Texinfo/XS/convert/convert_html.c 
(html_command_root_element_command): rename command_root_element_command as 
html_command_root_element_command.
60ae68df28 is described below

commit 60ae68df2881eb6af7b07b737be594bdd77c3d00
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sun Dec 24 22:54:25 2023 +0100

    * tp/Texinfo/XS/convert/convert_html.c
    (html_command_root_element_command): rename
    command_root_element_command as html_command_root_element_command.
    
    * tp/Texinfo/Convert/HTML.pm (_internal_command_href, command_href),
    tp/Texinfo/XS/convert/convert_html.c (html_command_href)
    (html_internal_command_href): remove source_command argument, it is not
    used.
    
    * tp/Texinfo/Convert/HTML.pm (from_element_direction),
    tp/Texinfo/XS/convert/convert_html.c (from_element_direction): do not
    access targets state directly for the target, but through command_id
    for target type and command_text.
    
    * tp/Texinfo/XS/convert/ConvertXS.xs (html_command_id)
    tp/Texinfo/XS/convert/get_html_perl_info.c
    (element_converter_from_sv): add element_converter_from_sv to get both
    the converter and element in C based on perl input.
    
    * tp/Texinfo/XS/convert/build_html_perl_state.c (build_tree_to_build),
    tp/Texinfo/XS/convert/call_html_perl_function.c: move
    build_tree_to_build to build_html_perl_state.c.
    
    * tp/Texinfo/XS/convert/convert_html.c (html_command_node),
    tp/Texinfo/XS/main/converter_types.h (HTML_TARGET): add.
    
    * tp/Texinfo/Convert/HTML.pm (%XS_conversion_overrides),
    tp/Texinfo/XS/convert/ConvertXS.xs (html_command_contents_target)
    (html_footnote_location_target, html_command_filename)
    (html_command_root_element_command, html_command_node)
    (html_internal_command_href, html_command_contents_href)
    (html_footnote_location_href, html_internal_command_tree)
    (html_internal_command_text):
    
    * tp/Texinfo/XS/convert/ConvertXS.xs (html_prepare_conversion_units),
    tp/Texinfo/Convert/HTML.pm (_initialize_XS_NonXS_output_state)
    (_initialize_output_state),
    tp/Texinfo/XS/convert/build_html_perl_state.c
    (build_html_translated_names, build_html_formatting_state),
    tp/Texinfo/XS/convert/convert_html.c (html_get_target)
    (html_reset_converter, html_check_transfer_state_finalization)
    (html_free_converter, html_translate_names),
    tp/Texinfo/XS/main/converter_types.h (CONVERTER): remove functions and
    code used to pass targets state information to perl, as now all the
    accesses are through overriden functions, such that perl targets state
    needs not to be set.  Remove add_html_element_target,
    build_html_element_targets, pass_html_element_targets,
    build_html_special_targets, pass_html_special_targets.  Remove also
    register_added_target_number and HTML_ADDED_TARGET_LIST.  Also remove
    build_html_seen_ids and pass_html_seen_ids that are unused too.
---
 ChangeLog                                       |  53 ++++
 tp/Texinfo/Convert/HTML.pm                      |  66 +++--
 tp/Texinfo/XS/convert/ConvertXS.xs              | 306 ++++++++++++++++++++++--
 tp/Texinfo/XS/convert/build_html_perl_state.c   | 208 ++--------------
 tp/Texinfo/XS/convert/build_html_perl_state.h   |   8 +-
 tp/Texinfo/XS/convert/call_html_perl_function.c |  14 --
 tp/Texinfo/XS/convert/convert_html.c            | 211 ++++++++--------
 tp/Texinfo/XS/convert/convert_html.h            |  22 ++
 tp/Texinfo/XS/convert/get_html_perl_info.c      |  19 ++
 tp/Texinfo/XS/convert/get_html_perl_info.h      |   3 +
 tp/Texinfo/XS/main/converter_types.h            |  17 +-
 tp/Texinfo/XS/main/get_perl_info.c              |   4 +-
 tp/Texinfo/XS/main/get_perl_info.h              |   4 +-
 tp/Texinfo/XS/main/translations.c               |   9 +-
 tp/Texinfo/XS/main/utils.h                      |   4 +-
 15 files changed, 564 insertions(+), 384 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index bb817de547..45967b3438 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,56 @@
+2023-12-24  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/XS/convert/convert_html.c
+       (html_command_root_element_command): rename
+       command_root_element_command as html_command_root_element_command.
+
+       * tp/Texinfo/Convert/HTML.pm (_internal_command_href, command_href),
+       tp/Texinfo/XS/convert/convert_html.c (html_command_href)
+       (html_internal_command_href): remove source_command argument, it is not
+       used.
+
+       * tp/Texinfo/Convert/HTML.pm (from_element_direction),
+       tp/Texinfo/XS/convert/convert_html.c (from_element_direction): do not
+       access targets state directly for the target, but through command_id
+       for target type and command_text.
+
+       * tp/Texinfo/XS/convert/ConvertXS.xs (html_command_id)
+       tp/Texinfo/XS/convert/get_html_perl_info.c
+       (element_converter_from_sv): add element_converter_from_sv to get both
+       the converter and element in C based on perl input.
+
+       * tp/Texinfo/XS/convert/build_html_perl_state.c (build_tree_to_build),
+       tp/Texinfo/XS/convert/call_html_perl_function.c: move
+       build_tree_to_build to build_html_perl_state.c.
+
+       * tp/Texinfo/XS/convert/convert_html.c (html_command_node),
+       tp/Texinfo/XS/main/converter_types.h (HTML_TARGET): add.
+
+       * tp/Texinfo/Convert/HTML.pm (%XS_conversion_overrides),
+       tp/Texinfo/XS/convert/ConvertXS.xs (html_command_contents_target)
+       (html_footnote_location_target, html_command_filename)
+       (html_command_root_element_command, html_command_node)
+       (html_internal_command_href, html_command_contents_href)
+       (html_footnote_location_href, html_internal_command_tree)
+       (html_internal_command_text):
+
+       * tp/Texinfo/XS/convert/ConvertXS.xs (html_prepare_conversion_units),
+       tp/Texinfo/Convert/HTML.pm (_initialize_XS_NonXS_output_state)
+       (_initialize_output_state),
+       tp/Texinfo/XS/convert/build_html_perl_state.c
+       (build_html_translated_names, build_html_formatting_state),
+       tp/Texinfo/XS/convert/convert_html.c (html_get_target)
+       (html_reset_converter, html_check_transfer_state_finalization)
+       (html_free_converter, html_translate_names),
+       tp/Texinfo/XS/main/converter_types.h (CONVERTER): remove functions and
+       code used to pass targets state information to perl, as now all the
+       accesses are through overriden functions, such that perl targets state
+       needs not to be set.  Remove add_html_element_target,
+       build_html_element_targets, pass_html_element_targets,
+       build_html_special_targets, pass_html_special_targets.  Remove also
+       register_added_target_number and HTML_ADDED_TARGET_LIST.  Also remove
+       build_html_seen_ids and pass_html_seen_ids that are unused too. 
+
 2023-12-24  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/XS/convert/convert_html.c
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index 1f884d733d..bc67c87376 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -128,10 +128,28 @@ my %XS_conversion_overrides = (
   "Texinfo::Convert::HTML::_id_is_registered"
    => "Texinfo::Convert::ConvertXS::html_id_is_registered",
 
-#  "Texinfo::Convert::HTML::_get_target"
-#   => "Texinfo::Convert::ConvertXS::html_get_target",
-#  "Texinfo::Convert::HTML::command_id"
-#   => "Texinfo::Convert::ConvertXS::html_command_id",
+  "Texinfo::Convert::HTML::_get_target"
+   => "Texinfo::Convert::ConvertXS::html_get_target",
+  "Texinfo::Convert::HTML::command_id"
+   => "Texinfo::Convert::ConvertXS::html_command_id",
+  "Texinfo::Convert::HTML::command_contents_target"
+   => "Texinfo::Convert::ConvertXS::html_command_contents_target",
+  "Texinfo::Convert::HTML::footnote_location_target"
+   => "Texinfo::Convert::ConvertXS::html_footnote_location_target",
+  "Texinfo::Convert::HTML::command_filename"
+   => "Texinfo::Convert::ConvertXS::html_command_filename",
+  "Texinfo::Convert::HTML::command_root_element_command"
+   => "Texinfo::Convert::ConvertXS::html_command_root_element_command",
+  "Texinfo::Convert::HTML::command_node"
+   => "Texinfo::Convert::ConvertXS::html_command_node",
+  "Texinfo::Convert::HTML::_internal_command_href"
+   => "Texinfo::Convert::ConvertXS::html_internal_command_href",
+  "Texinfo::Convert::HTML::command_contents_href"
+   => "Texinfo::Convert::ConvertXS::html_command_contents_href",
+  "Texinfo::Convert::HTML::_internal_command_tree"
+   => "Texinfo::Convert::ConvertXS::html_internal_command_tree",
+  "Texinfo::Convert::HTML::_internal_command_text"
+   => "Texinfo::Convert::ConvertXS::html_internal_command_text",
 
   "Texinfo::Convert::HTML::_open_command_update_context"
    => "Texinfo::Convert::ConvertXS::html_open_command_update_context",
@@ -1019,13 +1037,11 @@ sub command_node($$)
   return undef;
 }
 
-sub _internal_command_href($$;$$$)
+sub _internal_command_href($$;$$)
 {
   my $self = shift;
   my $command = shift;
   my $source_filename = shift;
-  # for messages only
-  my $source_command = shift;
   # to specify explicitly the target
   my $specified_target = shift;
 
@@ -1107,7 +1123,7 @@ sub command_href($$;$$$)
   }
 
   return _internal_command_href($self, $command, $source_filename,
-                                $source_command, $specified_target);
+                                $specified_target);
 }
 
 my %contents_command_special_unit_variety = (
@@ -1559,7 +1575,6 @@ sub from_element_direction($$$;$$$)
 
   my $target_unit;
   my $command;
-  my $target;
 
   $source_unit = $self->{'current_output_unit'} if (!defined($source_unit));
   $source_filename = $self->{'current_filename'} if 
(!defined($source_filename));
@@ -1628,7 +1643,6 @@ sub from_element_direction($$$;$$$)
                                       ->{'extra'}->{'associated_node'};
         }
       }
-      $target = $self->{'targets'}->{$command} if ($command);
       $type = 'text';
     } elsif ($type eq 'section') {
       if ($target_unit->{'unit_command'}) {
@@ -1641,7 +1655,6 @@ sub from_element_direction($$$;$$$)
                                         ->{'extra'}->{'associated_section'};
         }
       }
-      $target = $self->{'targets'}->{$command} if ($command);
       $type = 'text_nonumber';
     } else {
       $command = $target_unit->{'unit_command'};
@@ -1651,18 +1664,19 @@ sub from_element_direction($$$;$$$)
         } else {
           return undef;
         }
+      } elsif ($type eq 'target') {
+        if (defined($command)) {
+          return $self->command_id($command);
+        } else {
+          return undef;
+        }
       }
-      $target = $self->{'targets'}->{$command} if ($command);
     }
   } else {
     return undef;
   }
 
-  if ($target and exists($target->{$type})) {
-    return $target->{$type};
-  } elsif ($type eq 'target') {
-    return undef;
-  } elsif ($command) {
+  if ($command) {
     #print STDERR "FROM_ELEMENT_DIRECTION $type $direction\n"
     #  if ($self->get_conf('DEBUG'));
     return $self->command_text($command, $type);
@@ -11328,6 +11342,15 @@ sub _initialize_output_state($$)
   $self->{'document_global_context_css'} = {};
   $self->{'page_css'} = {};
 
+  # targets
+
+  # used for diverse tree elements: nodes and sectioning commands, indices,
+  # footnotes, special output units elements...
+  $self->{'targets'} = {};
+
+  # for footnotes
+  $self->{'special_targets'} = {'footnote_location' => {}};
+
   $self->{'seen_ids'} = {};
 
   # other
@@ -11366,18 +11389,11 @@ sub _initialize_XS_NonXS_output_state($$)
     $self->{'directions_strings'}->{$string_type} = {};
   };
 
-  # targets and directions
-
-  # used for diverse tree elements: nodes and sectioning commands, indices,
-  # footnotes, special output units elements...
-  $self->{'targets'} = {};
+  # directions
 
   # for global directions always set, and for directions to special elements,
   # only filled if special elements are actually used.
   $self->{'global_units_directions'} = {};
-
-  # for footnotes
-  $self->{'special_targets'} = {'footnote_location' => {}};
 }
 
 sub _finalize_output_state($)
diff --git a/tp/Texinfo/XS/convert/ConvertXS.xs 
b/tp/Texinfo/XS/convert/ConvertXS.xs
index c7481f8e92..9af1180525 100644
--- a/tp/Texinfo/XS/convert/ConvertXS.xs
+++ b/tp/Texinfo/XS/convert/ConvertXS.xs
@@ -791,6 +791,9 @@ html_get_file_information (SV *converter_in, key, ...)
          PUSHs(sv_2mortal(found_sv));
          PUSHs(sv_2mortal(result_sv));
 
+# Note that the target information returned is partial, no tree in particular,
+# but it is not an issue as this override is called only in a specific case
+# directly, in general it is only called through the *command* functions below.
 SV *
 html_get_target (SV *converter_in, SV *element_sv)
      PREINIT:
@@ -827,28 +830,300 @@ html_command_id (SV *converter_in, SV *element_sv)
      PREINIT:
          CONVERTER *self;
          char *id = 0;
+         ELEMENT *element;
      CODE:
-         self = get_sv_converter (converter_in,
-                                  "html_command_id");
-         if (self)
+         element = element_converter_from_sv (converter_in, element_sv,
+                                              "html_command_id", &self);
+         if (element)
+           id = html_command_id (self, element);
+
+         if (id)
+           RETVAL = newSVpv_utf8 (id, 0);
+         else
+           RETVAL = newSV (0);
+    OUTPUT:
+         RETVAL
+
+SV *
+html_command_contents_target (SV *converter_in, SV *element_sv, cmdname)
+         char *cmdname = (char *)SvPVutf8_nolen($arg);
+     PREINIT:
+         CONVERTER *self;
+         char *id = 0;
+         ELEMENT *element;
+     CODE:
+         element = element_converter_from_sv (converter_in, element_sv,
+                                              "html_command_contents_target",
+                                              &self);
+         if (element)
            {
-             int output_units_descriptor
-               = get_output_units_descriptor_converter_sv (converter_in);
-             ELEMENT *element;
-             element = find_element_from_sv (self, element_sv,
-                                             output_units_descriptor);
-             if (element)
-               id = html_command_id (self, element);
+             enum command_id cmd = lookup_builtin_command (cmdname);
+             id = html_command_contents_target (self, element, cmd);
            }
+
          if (id)
+           RETVAL = newSVpv_utf8 (id, 0);
+         else
+           RETVAL = newSV (0);
+    OUTPUT:
+         RETVAL
+
+SV *
+html_footnote_location_target (SV *converter_in, SV *element_sv)
+     PREINIT:
+         CONVERTER *self;
+         char *id = 0;
+         ELEMENT *element;
+     CODE:
+         element = element_converter_from_sv (converter_in, element_sv,
+                                              "html_footnote_location_target",
+                                              &self);
+         if (element)
+           id = html_footnote_location_target (self, element);
+
+         if (id)
+           RETVAL = newSVpv_utf8 (id, 0);
+         else
+           RETVAL = newSV (0);
+    OUTPUT:
+         RETVAL
+
+SV *
+html_command_filename (SV *converter_in, SV *element_sv)
+     PREINIT:
+         CONVERTER *self;
+         char *filename = 0;
+         ELEMENT *element;
+     CODE:
+         element = element_converter_from_sv (converter_in, element_sv,
+                                              "html_command_filename",
+                                              &self);
+         if (element)
+           {
+             FILE_NUMBER_NAME *file_number_name
+               = html_command_filename (self, element);
+             if (file_number_name)
+               {
+                 filename = file_number_name->filename;
+               }
+           }
+
+         if (filename)
+           RETVAL = newSVpv_utf8 (filename, 0);
+         else
+           RETVAL = newSV (0);
+    OUTPUT:
+         RETVAL
+
+SV *
+html_command_root_element_command (SV *converter_in, SV *element_sv)
+     PREINIT:
+         CONVERTER *self;
+         const ELEMENT *root_element_command = 0;
+         ELEMENT *element;
+     CODE:
+         element = element_converter_from_sv (converter_in, element_sv,
+                                     "html_command_root_element_command",
+                                              &self);
+         if (element)
+           {
+             root_element_command
+               = html_command_root_element_command (self, element);
+           }
+
+         if (root_element_command)
+           RETVAL = newRV_inc ((SV *) root_element_command->hv);
+         else
+           RETVAL = newSV (0);
+    OUTPUT:
+         RETVAL
+
+SV *
+html_command_node (SV *converter_in, SV *element_sv)
+     PREINIT:
+         CONVERTER *self;
+         const ELEMENT *node_element = 0;
+         ELEMENT *element;
+     CODE:
+         element = element_converter_from_sv (converter_in, element_sv,
+                                              "html_command_node", &self);
+         if (element)
+           node_element = html_command_node (self, element);
+
+         if (node_element)
+           RETVAL = newRV_inc ((SV *) node_element->hv);
+         else
+           RETVAL = newSV (0);
+    OUTPUT:
+         RETVAL
+
+SV *
+html_internal_command_href (SV *converter_in, SV *element_sv, SV 
*source_filename_sv=0, SV *specified_target_sv=0)
+     PREINIT:
+         CONVERTER *self;
+         char *href = 0;
+         ELEMENT *element;
+     CODE:
+         element = element_converter_from_sv (converter_in, element_sv,
+                                         "html_internal_command_href", &self);
+
+         if (element)
+           {
+             char *source_filename = 0;
+             char *specified_target = 0;
+             if (source_filename_sv && SvOK (source_filename_sv))
+               source_filename = SvPVutf8_nolen(source_filename_sv);
+             if (specified_target_sv && SvOK (specified_target_sv))
+               specified_target = SvPVutf8_nolen(specified_target_sv);
+             href = html_internal_command_href (self, element, source_filename,
+                                                specified_target);
+           }
+
+         if (href)
+           {
+             RETVAL = newSVpv_utf8 (href, 0);
+             free (href);
+           }
+         else
+           RETVAL = newSV (0);
+    OUTPUT:
+         RETVAL
+
+SV *
+html_command_contents_href (SV *converter_in, SV *element_sv, cmdname, SV 
*source_filename_sv=0)
+         char *cmdname = (char *)SvPVutf8_nolen($arg);
+     PREINIT:
+         CONVERTER *self;
+         char *href = 0;
+         ELEMENT *element;
+     CODE:
+         element = element_converter_from_sv (converter_in, element_sv,
+                                         "html_command_contents_href", &self);
+
+         if (element)
+           {
+             enum command_id cmd = lookup_builtin_command (cmdname);
+             char *source_filename = 0;
+             if (source_filename_sv && SvOK (source_filename_sv))
+               source_filename = SvPVutf8_nolen(source_filename_sv);
+             href = html_command_contents_href (self, element, cmd,
+                                                source_filename);
+           }
+
+         if (href)
+           {
+             RETVAL = newSVpv_utf8 (href, 0);
+             free (href);
+           }
+         else
+           RETVAL = newSV (0);
+    OUTPUT:
+         RETVAL
+
+SV *
+html_footnote_location_href (SV *converter_in, SV *element_sv, SV 
*source_filename_sv=0, SV *specified_target_sv=0, SV *target_filename_sv=0)
+     PREINIT:
+         CONVERTER *self;
+         char *href = 0;
+         ELEMENT *element;
+     CODE:
+         element = element_converter_from_sv (converter_in, element_sv,
+                                         "html_footnote_location_href", &self);
+         if (element)
+           {
+             char *source_filename = 0;
+             char *specified_target = 0;
+             char *target_filename_in = 0;
+             if (source_filename_sv && SvOK(source_filename_sv))
+               source_filename = SvPVutf8_nolen (source_filename_sv);
+             if (specified_target_sv && SvOK(specified_target_sv))
+               specified_target = SvPVutf8_nolen (specified_target_sv);
+             if (target_filename_sv && SvOK(target_filename_sv))
+               target_filename_in = SvPVutf8_nolen (target_filename_sv);
+
+             href = html_footnote_location_href (self, element, 
source_filename,
+                                                 specified_target, 
target_filename_in);
+           }
+
+         if (href)
+           RETVAL = newSVpv_utf8 (href, 0);
+         else
+           RETVAL = newSV (0);
+    OUTPUT:
+         RETVAL
+
+SV *
+html_internal_command_tree (SV *converter_in, SV *element_sv, SV* no_number_sv)
+     PREINIT:
+         CONVERTER *self;
+         ELEMENT *command_tree = 0;
+         ELEMENT *element;
+     CODE:
+         element = element_converter_from_sv (converter_in, element_sv,
+                                         "html_internal_command_tree", &self);
+         if (element)
+           {
+             int no_number = 0;
+             TREE_ADDED_ELEMENTS *tree;
+
+             if (SvOK (no_number_sv))
+               no_number = SvIV (no_number_sv);
+
+             tree = html_internal_command_tree (self, element, no_number);
+             build_tree_to_build (&self->tree_to_build);
+
+             if (tree)
+               command_tree = tree->tree;
+           }
+
+         if (command_tree)
+           RETVAL = newRV_inc ((SV *) command_tree->hv);
+         else
+           RETVAL = newSV (0);
+    OUTPUT:
+         RETVAL
+
+SV *
+html_internal_command_text (SV *converter_in, SV *element_sv, char *type)
+     PREINIT:
+         CONVERTER *self;
+         char *text = 0;
+         ELEMENT *element;
+     CODE:
+         element = element_converter_from_sv (converter_in, element_sv,
+                                         "html_internal_command_text", &self);
+         if (element)
            {
-             RETVAL = newSVpv_utf8 (id, 0);
+             int j;
+             enum html_text_type text_type = 0;
+             for (j = 0; j < HTT_section +1; j++)
+               {
+                 if (!strcmp (html_command_text_type_name[j], type))
+                   {
+                     text_type = j;
+                     break;
+                   }
+               }
+             text
+               = html_internal_command_text (self, element, text_type);
+             if (self->modified_state)
+               {
+                 build_html_formatting_state (self, self->modified_state);
+                 self->modified_state = 0;
+               }
+           }
+
+         if (text)
+           {
+             RETVAL = newSVpv_utf8 (text, 0);
+             free (text);
            }
          else
            RETVAL = newSV (0);
     OUTPUT:
          RETVAL
 
+
 void
 html_register_opened_section_level (SV *converter_in, int level, close_string)
          char *close_string = (char *)SvPVutf8_nolen($arg);
@@ -1306,10 +1581,6 @@ html_prepare_conversion_units (SV *converter_in, ...)
               output_units_descriptor, special_units_descriptor,
               associated_special_units_descriptor);
 
-         pass_html_element_targets (converter_in, &self->html_targets);
-         pass_html_special_targets (converter_in, self->html_special_targets);
-         pass_html_seen_ids (converter_in, &self->seen_ids);
-
          pass_converter_errors (&self->error_messages, self->hv);
 
          EXTEND(SP, 3);
@@ -1421,13 +1692,16 @@ html_translate_names (SV *converter_in)
          self = get_sv_converter (converter_in, "html_translate_names");
 
          html_translate_names (self);
-
+         /*
+         build_html_translated_names ((HV *)SvRV (converter_in), self);
+          */
          if (self->modified_state)
            {
              build_html_formatting_state (self, self->modified_state);
              self->modified_state = 0;
            }
 
+
 void
 html_prepare_simpletitle (SV *converter_in)
   PREINIT:
diff --git a/tp/Texinfo/XS/convert/build_html_perl_state.c 
b/tp/Texinfo/XS/convert/build_html_perl_state.c
index 2ccade9406..94fa7d587a 100644
--- a/tp/Texinfo/XS/convert/build_html_perl_state.c
+++ b/tp/Texinfo/XS/convert/build_html_perl_state.c
@@ -97,144 +97,6 @@ build_html_target (HTML_TARGET *html_target)
   return html_target_hv;
 }
 
-static void
-add_html_element_target (HV *hv, HTML_TARGET *html_target)
-{
-  SV *html_target_sv;
-  HV *html_target_hv;
-  SV *element_sv;
-
-  dTHX;
-
-  html_target_hv = build_html_target (html_target);
-
-  if (!html_target->element->hv)
-    {
-      fprintf (stderr, "BUG: No hv for target '%s'\n", html_target->target);
-      fatal ("No hv for target");
-    }
-
-  element_sv = newRV_inc ((SV *) html_target->element->hv);
-  html_target_sv = newRV_noinc ((SV *) html_target_hv);
-  hv_store_ent (hv, element_sv, html_target_sv, 0);
-}
-
-/* this function is used to set the initial targets information. */
-/* Dynamical changes are done in other functions, build_html_translated_names
-   .... */
-void
-build_html_element_targets (HV *hv, HTML_TARGET_LIST *html_targets)
-{
-  int i;
-
-  dTHX;
-
-  if (!html_targets || html_targets->number <= 0)
-    return;
-
-  for (i = 0; i < html_targets->number; i++)
-    {
-      HTML_TARGET *html_target = &html_targets->list[i];
-      add_html_element_target (hv, html_target);
-    }
-}
-
-void
-pass_html_element_targets (SV *converter_sv, HTML_TARGET_LIST *html_targets)
-{
-  HV *targets_hv;
-  HV *hv;
-
-  dTHX;
-
-  hv = (HV *) SvRV (converter_sv);
-
-  targets_hv = newHV ();
-  build_html_element_targets (targets_hv, html_targets);
-
-  hv_store (hv, "targets", strlen ("targets"),
-            newRV_noinc ((SV *) targets_hv), 0);
-}
-
-HV *
-build_html_special_targets (HTML_TARGET_LIST *html_special_targets)
-{
-  HV *hv;
-  HV *html_special_target_hv;
-
-  dTHX;
-
-  hv = newHV ();
-
-  /* could be generalized if needed */
-
-  HTML_TARGET_LIST *html_special_target
-    = &html_special_targets[ST_footnote_location];
-  html_special_target_hv = newHV ();
-  build_html_element_targets (html_special_target_hv, html_special_target);
-
-  hv_store (hv, "footnote_location", strlen ("footnote_location"),
-            newRV_noinc ((SV *) html_special_target_hv), 0);
-
-  return hv;
-}
-
-void
-pass_html_special_targets (SV *converter_sv,
-                          HTML_TARGET_LIST *html_special_targets)
-{
-  HV *special_targets_hv;
-  HV *hv;
-
-  dTHX;
-
-  hv = (HV *) SvRV (converter_sv);
-
-  special_targets_hv = build_html_special_targets (html_special_targets);
-
-  hv_store (hv, "special_targets", strlen ("special_targets"),
-            newRV_noinc ((SV *) special_targets_hv), 0);
-}
-
-HV *
-build_html_seen_ids (STRING_LIST *seen_ids)
-{
-  HV *hv;
-  int i;
-
-  dTHX;
-
-  hv = newHV ();
-
-  if (seen_ids && seen_ids->number > 0)
-    {
-      for (i = 0; i < seen_ids->number; i++)
-        {
-          char *target = seen_ids->list[i];
-          SV *target_sv = newSVpv_utf8 (target, 0);
-          hv_store_ent (hv, target_sv, newSViv (1), 0);
-        }
-    }
-
-  return hv;
-}
-
-void
-pass_html_seen_ids (SV *converter_sv, STRING_LIST *seen_ids)
-{
-  HV *seen_ids_hv;
-  HV *hv;
-
-  dTHX;
-
-  hv = (HV *) SvRV (converter_sv);
-
-  seen_ids_hv = build_html_seen_ids (seen_ids);
-
-  hv_store (hv, "seen_ids", strlen ("seen_ids"),
-            newRV_noinc ((SV *) seen_ids_hv), 0);
-}
-
 SV *
 build_html_files_source_info (FILE_SOURCE_INFO_LIST *files_source_info)
 {
@@ -401,7 +263,6 @@ build_html_translated_names (HV *hv, CONVERTER *converter)
   HV *directions_strings_hv;
   SV **special_unit_info_sv;
   HV *special_unit_info_hv;
-  SV **targets_sv;
   SV **no_arg_commands_formatting_sv;
   HV *direction_string_hv;
 
@@ -435,41 +296,6 @@ build_html_translated_names (HV *hv, CONVERTER *converter)
       free (key);
     }
 
-  /* remove some info that will be redone on demand */
-  if (converter->reset_target_commands.number > 0)
-    {
-      int j;
-      HV *targets_hv;
-      FETCH(targets);
-      targets_hv = (HV *) SvRV (*targets_sv);
-
-      for (j = 0; j < converter->reset_target_commands.number; j++)
-        {
-          ELEMENT *command = converter->reset_target_commands.list[j];
-          SV *command_sv = newRV_noinc ((SV *) command->hv);
-          HE *target_he = hv_fetch_ent (targets_hv, command_sv, 0, 0);
-          if (!target_he)
-            {
-              char *element_str = print_element_debug (command, 0);
-              fprintf (stderr, "BUG: cannot retrieve target %d %s\n",
-                       j, element_str);
-              free (element_str);
-            }
-          else
-            {
-              SV *target_sv = HeVAL (target_he);
-              HV *target_hv = (HV *) SvRV (target_sv);
-              if (hv_exists (target_hv, "text", strlen ("text")))
-                hv_delete (target_hv, "text", strlen ("text"), G_DISCARD);
-              if (hv_exists (target_hv, "string", strlen ("string")))
-                hv_delete (target_hv, "string", strlen ("string"), G_DISCARD);
-              if (hv_exists (target_hv, "tree", strlen ("tree")))
-                hv_delete (target_hv, "tree", strlen ("tree"), G_DISCARD);
-            }
-        }
-      converter->reset_target_commands.number = 0;
-    }
-
   /* pass all the information for each context for translated commands */
   if (converter->no_arg_formatted_cmd_translated.number)
     {
@@ -755,25 +581,6 @@ build_html_formatting_state (CONVERTER *converter, 
unsigned long flags)
         }
     }
 
-  if (converter->added_targets.number)
-    {
-      SV **targets_sv;
-      HV *targets_hv;
-
-      FETCH(targets);
-      targets_hv = (HV *) SvRV (*targets_sv);
-
-      int j;
-      for (j = 0; j < converter->added_targets.number; j++)
-        {
-          size_t target_number = converter->added_targets.list[j];
-          HTML_TARGET *html_target
-            = &converter->html_targets.list[target_number -1];;
-          add_html_element_target (targets_hv, html_target);
-        }
-      converter->added_targets.number = 0;
-    }
-
   if (flags & HMSF_shared_conversion_state_integer)
     {
       int j;
@@ -947,3 +754,18 @@ build_simpletitle (CONVERTER *converter, HV *converter_hv)
             strlen ("simpletitle_command_name"),
             newSVpv (builtin_command_name (converter->simpletitle_cmd), 0), 0);
 }
+
+void
+build_tree_to_build (ELEMENT_LIST *tree_to_build)
+{
+  if (tree_to_build->number > 0)
+    {
+      int i;
+      for (i = 0; i < tree_to_build->number; i++)
+        {
+          build_texinfo_tree (tree_to_build->list[i], 1);
+        }
+      tree_to_build->number = 0;
+    }
+}
+
diff --git a/tp/Texinfo/XS/convert/build_html_perl_state.h 
b/tp/Texinfo/XS/convert/build_html_perl_state.h
index b3f8f4b0d9..0ffe66e65c 100644
--- a/tp/Texinfo/XS/convert/build_html_perl_state.h
+++ b/tp/Texinfo/XS/convert/build_html_perl_state.h
@@ -13,11 +13,7 @@
 #include "translations.h"
 
 HV *build_html_target (HTML_TARGET *html_target);
-void pass_html_element_targets (SV *converter_sv,
-                                HTML_TARGET_LIST *html_targets);
-void pass_html_special_targets (SV *converter_sv,
-                                HTML_TARGET_LIST *html_special_targets);
-void pass_html_seen_ids (SV *converter_sv, STRING_LIST *seen_ids);
+void build_html_translated_names (HV *hv, CONVERTER *converter);
 
 void pass_converter_errors (ERROR_MESSAGE_LIST *error_messages,
                             HV *converter_hv);
@@ -39,4 +35,6 @@ void build_pending_footnotes (AV *av, 
HTML_PENDING_FOOTNOTE_STACK *stack);
 
 void build_simpletitle (CONVERTER *converter, HV *converter_hv);
 
+void build_tree_to_build (ELEMENT_LIST *tree_to_build);
+
 #endif
diff --git a/tp/Texinfo/XS/convert/call_html_perl_function.c 
b/tp/Texinfo/XS/convert/call_html_perl_function.c
index 249a574b4b..8c6657a553 100644
--- a/tp/Texinfo/XS/convert/call_html_perl_function.c
+++ b/tp/Texinfo/XS/convert/call_html_perl_function.c
@@ -41,20 +41,6 @@
 #include "build_html_perl_state.h"
 #include "call_html_perl_function.h"
 
-static void
-build_tree_to_build (ELEMENT_LIST *tree_to_build)
-{
-  if (tree_to_build->number > 0)
-    {
-      int i;
-      for (i = 0; i < tree_to_build->number; i++)
-        {
-          build_texinfo_tree (tree_to_build->list[i], 1);
-        }
-      tree_to_build->number = 0;
-    }
-}
-
 /* in general we get information from perl by overriding functions setting
    that information, but for shared_conversion the reference obtained
    through a function call may be modified afterwards, so it is better to
diff --git a/tp/Texinfo/XS/convert/convert_html.c 
b/tp/Texinfo/XS/convert/convert_html.c
index 1115689973..cd3128c841 100644
--- a/tp/Texinfo/XS/convert/convert_html.c
+++ b/tp/Texinfo/XS/convert/convert_html.c
@@ -2852,19 +2852,6 @@ direction_string (CONVERTER *self, int direction,
   return self->directions_strings[string_type][direction][context];
 }
 
-static void
-register_added_target_number (HTML_ADDED_TARGET_LIST *added_targets,
-                              size_t target_number)
-{
-  if (added_targets->number == added_targets->space)
-    {
-      added_targets->list = realloc (added_targets->list,
-                   sizeof (size_t) * (added_targets->space += 5));
-    }
-  added_targets->list[added_targets->number] = target_number;
-  added_targets->number++;
-}
-
 /* note that the returned pointer may be invalidated if the targets list
    is reallocated.  Callers should make sure that the html target is
    used before a reallocation is possible */
@@ -2885,16 +2872,12 @@ html_get_target (CONVERTER *self, const ELEMENT 
*element)
 
       target_number = find_element_target_number (&self->html_targets, 
element);
       result = &self->html_targets.list[target_number -1];
-
-      /* register the number and not the target, as the list may be
-         reallocated before the modified state is passed to perl */
-      register_added_target_number (&self->added_targets, target_number);
-      self->modified_state |= HMSF_added_target;
     }
   return result;
 }
 
-char *html_command_id (CONVERTER *self, const ELEMENT *command)
+char *
+html_command_id (CONVERTER *self, const ELEMENT *command)
 {
   HTML_TARGET *target_info = html_get_target (self, command);
   if (target_info)
@@ -3319,8 +3302,8 @@ html_command_filename (CONVERTER *self, const ELEMENT 
*command)
   return 0;
 }
 
-ELEMENT *
-command_root_element_command (CONVERTER *self, const ELEMENT *command)
+const ELEMENT *
+html_command_root_element_command (CONVERTER *self, const ELEMENT *command)
 {
   HTML_TARGET *target_info;
 
@@ -3355,12 +3338,51 @@ command_root_element_command (CONVERTER *self, const 
ELEMENT *command)
   return 0;
 }
 
+const ELEMENT *
+html_command_node (CONVERTER *self, const ELEMENT *command)
+{
+  HTML_TARGET *target_info;
+
+  target_info = html_get_target (self, command);
+  if (target_info)
+    {
+      if (!target_info->node_command_set)
+        {
+         /* this finds a special element for footnote command if
+            such an element exists */
+          ROOT_AND_UNIT *root_unit
+            = html_get_tree_root_element (self, command, 1);
+          if (root_unit)
+            {
+              if (root_unit->root)
+                {
+                  const ELEMENT *root_command = root_unit->root;
+                  if (root_command && root_command->cmd == CM_node)
+                    target_info->node_command = root_command;
+                  else
+                    {
+                      const ELEMENT *associated_node
+                     = lookup_extra_element (root_command, "associated_node");
+                      if (associated_node)
+                        target_info->node_command = associated_node;
+                    }
+                }
+              free (root_unit);
+            }
+          target_info->node_command_set = 1;
+        }
+      return target_info->node_command;
+    }
+  return 0;
+}
+
 /* return value to be freed */
+/* SPECIFIED_TARGET can be used to specify explicitly the target.
+ */
 char *
 html_internal_command_href (CONVERTER *self, const ELEMENT *command,
-                         const char *source_filename,
-                         const ELEMENT *source_command, /* for messages only */
-            const char *specified_target) /* to specify explicitly the target 
*/
+                            const char *source_filename,
+                            const char *specified_target)
 {
   HTML_TARGET *target_info;
   TEXT href;
@@ -3419,8 +3441,8 @@ html_internal_command_href (CONVERTER *self, const 
ELEMENT *command,
       if (!filename_from
           || strcmp (target_filename->filename, filename_from))
         {
-          ELEMENT *command_root_element
-             = command_root_element_command (self, command);
+          const ELEMENT *command_root_element
+             = html_command_root_element_command (self, command);
           text_append (&href, target_filename->filename);
      /* omit target if the command is an element command, there is only
         one element in file and there is a file in the href */
@@ -3464,12 +3486,16 @@ html_internal_command_href (CONVERTER *self, const 
ELEMENT *command,
   return href.text;
 }
 
-/* Return string for linking to $COMMAND with <a href> */
 /* return value to be freed */
-char *html_command_href (CONVERTER *self, const ELEMENT *command,
-                         const char *source_filename,
-                         const ELEMENT *source_command, /* for messages only */
-            const char *specified_target) /* to specify explicitly the target 
*/
+/* Return string for linking to $COMMAND with <a href>.
+   SOURCE_COMMAND is for messages only.
+   SPECIFIED_TARGET can be set to specify explicitly the target
+ */
+char *
+html_command_href (CONVERTER *self, const ELEMENT *command,
+                   const char *source_filename,
+                   const ELEMENT *source_command,
+                   const char *specified_target)
 {
   ELEMENT *manual_content = lookup_extra_element (command,
                                                   "manual_content");
@@ -3479,7 +3505,7 @@ char *html_command_href (CONVERTER *self, const ELEMENT 
*command,
     }
 
   return html_internal_command_href (self, command, source_filename,
-                                     source_command, specified_target);
+                                     specified_target);
 }
 
 char *
@@ -3583,11 +3609,15 @@ html_command_contents_href (CONVERTER *self, const 
ELEMENT *command,
   return 0;
 }
 
+/*
+ SPECIFIED_TARGET can be set to specify explicitly the target.
+ TARGET_FILENAME_IN can be set to specify explicitly the file.
+ */
 char *
 html_footnote_location_href (CONVERTER *self, const ELEMENT *command,
-                         const char *source_filename,
-            const char *specified_target, /* specify explicitly the target */
-            const char *target_filename_in) /* to specify explicitly the file 
*/
+                             const char *source_filename,
+                             const char *specified_target,
+                             const char *target_filename_in)
 {
   TEXT href;
   const char *filename_from;
@@ -3998,7 +4028,6 @@ from_element_direction (CONVERTER *self, int direction,
   const char *filename_from;
   const OUTPUT_UNIT *target_unit = 0;
   ELEMENT *command = 0;
-  HTML_TARGET *target = 0;
 
   if (!source_unit)
     source_unit = self->current_output_unit;
@@ -4066,11 +4095,6 @@ from_element_direction (CONVERTER *self, int direction,
                     command = associated_node;
                 }
             }
-          if (command)
-            {
-              target
-                = find_element_target (&self->html_targets, command);
-            }
           type = HTT_text;
         }
       else if (type == HTT_section)
@@ -4088,11 +4112,6 @@ from_element_direction (CONVERTER *self, int direction,
                     command = associated_section;
                 }
             }
-          if (command)
-            {
-              target
-                = find_element_target (&self->html_targets, command);
-            }
           type = HTT_text_nonumber;
         }
       else
@@ -4106,28 +4125,19 @@ from_element_direction (CONVERTER *self, int direction,
               else
                 return 0;
             }
-
-          if (command)
+          else if (type == HTT_target)
             {
-              target
-                = find_element_target (&self->html_targets, command);
+              if (command)
+                return html_command_id (self, command);
+              else
+                return 0;
             }
         }
     }
   else
     return 0;
 
-  if (type == HTT_target)
-    {
-      if (target && target->target)
-        return (strdup (target->target));
-      else
-        return 0;
-    }
-
-  if (target && target->command_text[type])
-    return strdup (target->command_text[type]);
-  else if (command)
+  if (command)
     return html_command_text (self, command, type);
 
   /*
@@ -8767,7 +8777,7 @@ convert_xref_commands (CONVERTER *self, const enum 
command_id cmd,
      /* This is the node if USE_NODES, otherwise this may be the sectioning
         command (if the sectioning command is really associated to the node) */
       const ELEMENT *target_root
-             = command_root_element_command (self, target_node);
+             = html_command_root_element_command (self, target_node);
       const ELEMENT *associated_section = lookup_extra_element (target_node,
                                                        "associated_section");
       reference_element = new_element (ET__converted);
@@ -10954,6 +10964,36 @@ html_converter_initialize (CONVERTER *self)
              &self->css_string_types_conversion[i]);
     }
 
+  for (i = 0; i < BUILTIN_CMD_NUMBER; i++)
+    {
+      register_command_conversion_function (
+           &self->command_conversion_function[i],
+           i, &self->commands_conversion[i]);
+      register_command_open_function (
+           &self->command_open_function[i],
+           i, &self->commands_open[i]);
+      register_command_conversion_function (
+            &self->css_string_command_conversion_function[i], i,
+             &self->css_string_commands_conversion[i]);
+    }
+
+  for (i = 0; i < OU_special_unit+1; i++)
+    {
+      register_output_unit_conversion_function
+                                  (&self->output_unit_conversion_function[i],
+                                        i, &self->output_units_conversion[i]);
+    }
+
+  self->special_unit_body_formatting = (SPECIAL_UNIT_BODY_FORMATTING *)
+   malloc (nr_special_units * sizeof (SPECIAL_UNIT_BODY_FORMATTING));
+
+  for (i = 0; i < nr_special_units; i++)
+    {
+      register_special_unit_body_formatting_function
+                                  (&self->special_unit_body_formatting[i],
+          self->special_unit_varieties.list[i], &self->special_unit_body[i]);
+    }
+
   for (i = 0; types_internal_conversion_table[i].type_conversion; i++)
     {
       enum element_type type = types_internal_conversion_table[i].type;
@@ -10991,19 +11031,6 @@ html_converter_initialize (CONVERTER *self)
         }
     }
 
-  for (i = 0; i < BUILTIN_CMD_NUMBER; i++)
-    {
-      register_command_conversion_function (
-           &self->command_conversion_function[i],
-           i, &self->commands_conversion[i]);
-      register_command_open_function (
-           &self->command_open_function[i],
-           i, &self->commands_open[i]);
-      register_command_conversion_function (
-            &self->css_string_command_conversion_function[i], i,
-             &self->css_string_commands_conversion[i]);
-    }
-
   for (i = 0; commands_internal_conversion_table[i].command_conversion; i++)
     {
       enum command_id cmd = commands_internal_conversion_table[i].cmd;
@@ -11092,13 +11119,6 @@ html_converter_initialize (CONVERTER *self)
         }
     }
 
-  for (i = 0; i < OU_special_unit+1; i++)
-    {
-      register_output_unit_conversion_function
-                                  (&self->output_unit_conversion_function[i],
-                                        i, &self->output_units_conversion[i]);
-    }
-
   for (i = 0;
      output_units_internal_conversion_table[i].output_unit_conversion; i++)
     {
@@ -11115,16 +11135,6 @@ html_converter_initialize (CONVERTER *self)
         }
     }
 
-  self->special_unit_body_formatting = (SPECIAL_UNIT_BODY_FORMATTING *)
-   malloc (nr_special_units * sizeof (SPECIAL_UNIT_BODY_FORMATTING));
-
-  for (i = 0; i < nr_special_units; i++)
-    {
-      register_special_unit_body_formatting_function
-                                  (&self->special_unit_body_formatting[i],
-          self->special_unit_varieties.list[i], &self->special_unit_body[i]);
-    }
-
   qsort (self->htmlxref.list, self->htmlxref.number,
          sizeof (HTMLXREF_MANUAL), compare_htmlxref_manual);
 }
@@ -11304,8 +11314,6 @@ html_reset_converter (CONVERTER *self)
 
   free (self->shared_conversion_state.footnote_id_numbers);
 
-  self->added_targets.number = 0;
-
   free (self->special_units_direction_name);
   self->special_units_direction_name = 0;
   free (self->output_unit_file_indices);
@@ -11436,9 +11444,6 @@ html_check_transfer_state_finalization (CONVERTER *self)
       if (self->no_arg_formatted_cmd_translated.number)
         fprintf (stderr, "BUG: no_arg_formatted_cmd_translated: %zu\n",
                          self->no_arg_formatted_cmd_translated.number);
-      if (self->reset_target_commands.number)
-        fprintf (stderr, "BUG: reset_target_commands: %zu\n",
-                         self->reset_target_commands.number);
     }
 }
 
@@ -11479,8 +11484,6 @@ html_free_converter (CONVERTER *self)
       free (self->html_special_targets[i].list);
     }
 
-  free (self->added_targets.list);
-
   free_strings_list (&self->check_htmlxref_already_warned);
 
   for (i = 0; i < SUIT_type_heading+1; i++)
@@ -11598,7 +11601,6 @@ html_free_converter (CONVERTER *self)
   free_strings_list (&self->shared_conversion_state.key_strings);
 
   free (self->no_arg_formatted_cmd_translated.list);
-  free (self->reset_target_commands.list);
 
   free (self->referred_command_stack.stack);
 
@@ -11768,10 +11770,6 @@ html_translate_names (CONVERTER *self)
 
   /* delete the tree and formatted results for special elements
      such that they are redone with the new tree when needed. */
-  /* if reset_target_commands was still set, we will fill with the
-     same elements again, but it is not a big deal as we need to go
-     through the loop anyway and the memory will be reused */
-  self->reset_target_commands.number = 0;
   for (j = 0; j < special_unit_varieties->number; j++)
     {
       char *special_unit_variety = special_unit_varieties->list[j];
@@ -11798,9 +11796,6 @@ html_translate_names (CONVERTER *self)
                        target_info->command_text[HTT_string] = 0;
                        free (target_info->command_text[HTT_text]);
                        target_info->command_text[HTT_text] = 0;
-                       /* gather elements to pass information to perl */
-                       add_to_element_list (&self->reset_target_commands,
-                                            command);
                      }
                  }
              }
@@ -12219,7 +12214,7 @@ convert_to_html_internal (CONVERTER *self, const 
ELEMENT *element,
       char *contexts_str = debug_print_html_contexts (self);
       text_init (&debug_str);
       text_printf (&debug_str, "XS|ELEMENT(%s) %s, ->", explanation,
-                                                       contexts_str);
+                                                        contexts_str);
       free (contexts_str);
       if (command_name)
         text_printf (&debug_str, " cmd: %s,", command_name);
diff --git a/tp/Texinfo/XS/convert/convert_html.h 
b/tp/Texinfo/XS/convert/convert_html.h
index 88b50eb73d..c0a13aed38 100644
--- a/tp/Texinfo/XS/convert/convert_html.h
+++ b/tp/Texinfo/XS/convert/convert_html.h
@@ -87,6 +87,28 @@ int html_special_unit_variety_direction_index (CONVERTER 
*self,
 
 HTML_TARGET *html_get_target (CONVERTER *self, const ELEMENT *element);
 char *html_command_id (CONVERTER *self, const ELEMENT *command);
+char *html_command_contents_target (CONVERTER *self, const ELEMENT *command,
+                                    enum command_id contents_or_shortcontents);
+char *html_footnote_location_target (CONVERTER *self, const ELEMENT *command);
+FILE_NUMBER_NAME *html_command_filename (CONVERTER *self,
+                                         const ELEMENT *command);
+const ELEMENT *html_command_root_element_command (CONVERTER *self,
+                                            const ELEMENT *command);
+const ELEMENT *html_command_node (CONVERTER *self, const ELEMENT *command);
+char *html_internal_command_href (CONVERTER *self, const ELEMENT *command,
+                            const char *source_filename,
+                            const char *specified_target);
+char *html_command_contents_href (CONVERTER *self, const ELEMENT *command,
+                            enum command_id contents_or_shortcontents,
+                            const char *source_filename);
+char *html_footnote_location_href (CONVERTER *self, const ELEMENT *command,
+                             const char *source_filename,
+                             const char *specified_target,
+                             const char *target_filename_in);
+TREE_ADDED_ELEMENTS *html_internal_command_tree (CONVERTER *self,
+                            const ELEMENT *command, int no_number);
+char *html_internal_command_text (CONVERTER *self, const ELEMENT *command,
+                                  const enum html_text_type type);
 
 void html_register_opened_section_level (CONVERTER *self, int level,
                                          const char *close_string);
diff --git a/tp/Texinfo/XS/convert/get_html_perl_info.c 
b/tp/Texinfo/XS/convert/get_html_perl_info.c
index 3b6eb0fe24..733ff0e829 100644
--- a/tp/Texinfo/XS/convert/get_html_perl_info.c
+++ b/tp/Texinfo/XS/convert/get_html_perl_info.c
@@ -1381,3 +1381,22 @@ get_output_units_descriptor_converter_sv (SV 
*converter_in)
 
   return output_units_descriptor;
 }
+
+/* find converter and element */
+ELEMENT *
+element_converter_from_sv (SV *converter_in, SV *element_sv,
+                           const char *warn_string, CONVERTER **converter_out)
+{
+  int output_units_descriptor;
+
+  *converter_out = get_sv_converter (converter_in, warn_string);
+
+  if (!*converter_out)
+    return 0;
+
+  output_units_descriptor
+    = get_output_units_descriptor_converter_sv (converter_in);
+
+  return find_element_from_sv (*converter_out, element_sv,
+                               output_units_descriptor);
+}
diff --git a/tp/Texinfo/XS/convert/get_html_perl_info.h 
b/tp/Texinfo/XS/convert/get_html_perl_info.h
index ee3b67a9a4..284ec08a74 100644
--- a/tp/Texinfo/XS/convert/get_html_perl_info.h
+++ b/tp/Texinfo/XS/convert/get_html_perl_info.h
@@ -23,4 +23,7 @@ void html_converter_prepare_output_sv (SV *converter_sv, 
CONVERTER *converter);
 
 ELEMENT *find_element_from_sv (CONVERTER *converter, SV *element_sv,
                                int output_units_descriptor);
+
+ELEMENT *element_converter_from_sv (SV *converter_in, SV *element_sv,
+                       const char *warn_string, CONVERTER **converter_out);
 #endif
diff --git a/tp/Texinfo/XS/main/converter_types.h 
b/tp/Texinfo/XS/main/converter_types.h
index f658c01001..0e6ec827bc 100644
--- a/tp/Texinfo/XS/main/converter_types.h
+++ b/tp/Texinfo/XS/main/converter_types.h
@@ -269,11 +269,10 @@ typedef struct HTML_TARGET {
     TREE_ADDED_ELEMENTS tree_nonumber;
     FILE_NUMBER_NAME file_number_name;
     int filename_set;
-    ELEMENT *root_element_command;
+    const ELEMENT *root_element_command;
     int root_element_command_set;
-    /*
-    ELEMENT *node_command;
-    */
+    const ELEMENT *node_command;
+    int node_command_set;
 } HTML_TARGET;
 
 typedef struct HTML_TARGET_LIST {
@@ -483,12 +482,6 @@ typedef struct STRING_WITH_LEN {
     size_t len;
 } STRING_WITH_LEN;
 
-typedef struct HTML_ADDED_TARGET_LIST {
-    size_t space;
-    size_t number;
-    size_t *list;
-} HTML_ADDED_TARGET_LIST;
-
 typedef struct CSS_SELECTOR_STYLE {
     char *selector;
     char *style;
@@ -759,10 +752,6 @@ typedef struct CONVERTER {
                                before calling perl functions on it */
     COMMAND_ID_LIST no_arg_formatted_cmd_translated; /* list of commands that
                          were translated and need to be passed back to perl */
-    ELEMENT_LIST reset_target_commands; /* element targets that should have
-                                           their texts reset after language
-                                           change */
-    HTML_ADDED_TARGET_LIST added_targets; /* target numbers of added targets */
     STRING_LIST shared_conversion_state_integer; /* modified */
     /* next 4 allow to switch from normal HTML formatting to css strings
        formatting */
diff --git a/tp/Texinfo/XS/main/get_perl_info.c 
b/tp/Texinfo/XS/main/get_perl_info.c
index 0a4b19d93d..7a2504400c 100644
--- a/tp/Texinfo/XS/main/get_perl_info.c
+++ b/tp/Texinfo/XS/main/get_perl_info.c
@@ -334,7 +334,7 @@ get_expanded_formats (HV *hv, EXPANDED_FORMAT 
**expanded_formats)
 }
 
 CONVERTER *
-get_sv_converter (SV *sv_in, char *warn_string)
+get_sv_converter (SV *sv_in, const char *warn_string)
 {
   int converter_descriptor = 0;
   CONVERTER *converter = 0;
@@ -525,7 +525,7 @@ recopy_converter_conf_sv (HV *hv, CONVERTER *converter,
 
 /* initialize an XS converter from a perl converter right before conversion */
 CONVERTER *
-set_output_converter_sv (SV *sv_in, char *warn_string)
+set_output_converter_sv (SV *sv_in, const char *warn_string)
 {
   HV *hv_in;
   CONVERTER *converter = 0;
diff --git a/tp/Texinfo/XS/main/get_perl_info.h 
b/tp/Texinfo/XS/main/get_perl_info.h
index 5750a25798..cb72e37d2d 100644
--- a/tp/Texinfo/XS/main/get_perl_info.h
+++ b/tp/Texinfo/XS/main/get_perl_info.h
@@ -38,8 +38,8 @@ void recopy_converter_conf_sv (HV *hv, CONVERTER *converter,
                                OPTIONS **conf, const char *conf_key);
 void set_conf (CONVERTER *converter, const char *conf, SV *value);
 
-CONVERTER *set_output_converter_sv (SV *sv_in, char *warn_string);
-CONVERTER *get_sv_converter (SV *sv_in, char *warn_string);
+CONVERTER *set_output_converter_sv (SV *sv_in, const char *warn_string);
+CONVERTER *get_sv_converter (SV *sv_in, const char *warn_string);
 
 int converter_initialize (SV *converter_sv);
 
diff --git a/tp/Texinfo/XS/main/translations.c 
b/tp/Texinfo/XS/main/translations.c
index 0fc142687a..8f5448263f 100644
--- a/tp/Texinfo/XS/main/translations.c
+++ b/tp/Texinfo/XS/main/translations.c
@@ -513,7 +513,7 @@ replace_convert_substrings (OPTIONS *options, char 
*translated_string,
   debug ("IN TR PARSER '%s'", texinfo_line);
    */
   if (options && options->DEBUG > 0)
-    fprintf (stderr, "IN TR PARSER '%s'", texinfo_line);
+    fprintf (stderr, "XS|IN TR PARSER '%s'\n", texinfo_line);
 
   document = retrieve_document (document_descriptor);
   if (document->error_messages->number > 0)
@@ -540,10 +540,15 @@ replace_convert_substrings (OPTIONS *options, char 
*translated_string,
 /*
   {
     char *result_texi = convert_to_texinfo (document->tree);
-    debug("XS|RESULT GDT %d: '%s'\n", document_descriptor, result_texi);
+    if (options && options->DEBUG > 0)
+      fprintf (stderr, "XS|RESULT GDT %d: '%s'\n", document_descriptor,
+               result_texi);
     free (result_texi);
   }
 */
+   /*
+    debug("XS|RESULT GDT %d: '%s'\n", document_descriptor, result_texi);
+    */
 
   return document_descriptor;
 }
diff --git a/tp/Texinfo/XS/main/utils.h b/tp/Texinfo/XS/main/utils.h
index 13ccede215..cad189a4a1 100644
--- a/tp/Texinfo/XS/main/utils.h
+++ b/tp/Texinfo/XS/main/utils.h
@@ -138,9 +138,7 @@ enum command_location {
 #define HMSF_translations            0x4000
 /*
 #define HMSF_            0x8000
- */
-#define HMSF_added_target            0x00010000
-/*
+#define HMSF_            0x00010000
 #define HMSF_  0x00020000
  */
 



reply via email to

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