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/build_perl_info.c (store_doc


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/XS/main/build_perl_info.c (store_document_texinfo_tree): rename store_texinfo_tree as store_document_texinfo_tree.
Date: Thu, 03 Oct 2024 10:15:48 -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 711589089d * tp/Texinfo/XS/main/build_perl_info.c 
(store_document_texinfo_tree): rename store_texinfo_tree as 
store_document_texinfo_tree.
711589089d is described below

commit 711589089d23e86a65701c546f1185c25c5d65c6
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Mon Aug 5 15:51:22 2024 +0200

    * tp/Texinfo/XS/main/build_perl_info.c (store_document_texinfo_tree):
    rename store_texinfo_tree as store_document_texinfo_tree.
    
    * tp/Texinfo/XS/convert/ConvertXS.xs (get_conf),
    tp/Texinfo/XS/main/DocumentXS.xs (document_get_conf),
    tp/Texinfo/XS/main/build_perl_info.c (build_sv_option_from_name)
    (latex_build_options_for_convert_to_latex_math): rename get_sv_conf as
    build_sv_option_from_name and separate converter and sorted options
    arguments.  Use in document_get_conf.
    
    * tp/Texinfo/XS/main/build_perl_info.c: add static keyword.
    
    * tp/Texinfo/XS/convert/converter_options.h,
    tp/Texinfo/XS/main/build_perl_info.h: remove unneeded functions
    declarations, reorder.
    
    Remove const, as buttons are modified when Perl data is built when
    needed.
---
 ChangeLog                                       |   21 +
 tp/Texinfo/XS/convert/ConvertXS.xs              |    5 +-
 tp/Texinfo/XS/convert/build_html_perl_state.c   |    2 +-
 tp/Texinfo/XS/convert/call_html_perl_function.c |    4 +-
 tp/Texinfo/XS/convert/call_html_perl_function.h |    4 +-
 tp/Texinfo/XS/convert/convert_html.c            |    8 +-
 tp/Texinfo/XS/convert/converter_options.h       |   12 -
 tp/Texinfo/XS/main/DocumentXS.xs                |   38 +-
 tp/Texinfo/XS/main/build_perl_info.c            | 1519 ++++++++++++-----------
 tp/Texinfo/XS/main/build_perl_info.h            |   46 +-
 10 files changed, 840 insertions(+), 819 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index f4348ff4ab..5a32b1337b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,24 @@
+2024-08-05  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/XS/main/build_perl_info.c (store_document_texinfo_tree):
+       rename store_texinfo_tree as store_document_texinfo_tree.
+
+       * tp/Texinfo/XS/convert/ConvertXS.xs (get_conf),
+       tp/Texinfo/XS/main/DocumentXS.xs (document_get_conf),
+       tp/Texinfo/XS/main/build_perl_info.c (build_sv_option_from_name)
+       (latex_build_options_for_convert_to_latex_math): rename get_sv_conf as
+       build_sv_option_from_name and separate converter and sorted options
+       arguments.  Use in document_get_conf.
+
+       * tp/Texinfo/XS/main/build_perl_info.c: add static keyword.
+
+       * tp/Texinfo/XS/convert/converter_options.h,
+       tp/Texinfo/XS/main/build_perl_info.h: remove unneeded functions
+       declarations, reorder.
+
+       Remove const, as buttons are modified when Perl data is built when
+       needed.
+
 2024-08-05  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/XS/convert/converter_options.c
diff --git a/tp/Texinfo/XS/convert/ConvertXS.xs 
b/tp/Texinfo/XS/convert/ConvertXS.xs
index aa0a534023..53a29eee66 100644
--- a/tp/Texinfo/XS/convert/ConvertXS.xs
+++ b/tp/Texinfo/XS/convert/ConvertXS.xs
@@ -166,8 +166,9 @@ get_conf (SV *converter_in, option_name)
          CONVERTER *self;
       CODE:
          self = get_sv_converter (converter_in, 0);
-         if (self)
-           RETVAL = get_sv_conf (self, option_name);
+         if (self && self->sorted_options)
+           RETVAL = build_sv_option_from_name (self->sorted_options, self,
+                                               option_name);
          else
            RETVAL = newSV (0);
     OUTPUT:
diff --git a/tp/Texinfo/XS/convert/build_html_perl_state.c 
b/tp/Texinfo/XS/convert/build_html_perl_state.c
index 0ca5754cb9..2a6e0d4879 100644
--- a/tp/Texinfo/XS/convert/build_html_perl_state.c
+++ b/tp/Texinfo/XS/convert/build_html_perl_state.c
@@ -435,7 +435,7 @@ html_pass_conversion_output_units (CONVERTER *converter, SV 
*converter_sv,
       if (document_sv)
         {
           HV *document_hv = (HV *) SvRV (*document_sv);
-          store_texinfo_tree (converter->document, document_hv);
+          store_document_texinfo_tree (converter->document, document_hv);
         }
 
       *output_units_sv = build_output_units_list
diff --git a/tp/Texinfo/XS/convert/call_html_perl_function.c 
b/tp/Texinfo/XS/convert/call_html_perl_function.c
index 93551cac90..26a35f7424 100644
--- a/tp/Texinfo/XS/convert/call_html_perl_function.c
+++ b/tp/Texinfo/XS/convert/call_html_perl_function.c
@@ -1297,7 +1297,7 @@ call_formatting_function_format_button (CONVERTER *self,
 char *
 call_formatting_function_format_navigation_panel (CONVERTER *self,
                          const FORMATTING_REFERENCE *formatting_reference,
-                                  const BUTTON_SPECIFICATION_LIST *buttons,
+                                  BUTTON_SPECIFICATION_LIST *buttons,
                                   const char *cmdname, const ELEMENT *element,
                                   int vertical)
 {
@@ -1357,7 +1357,7 @@ call_formatting_function_format_navigation_panel 
(CONVERTER *self,
 char *
 call_formatting_function_format_navigation_header (CONVERTER *self,
                          const FORMATTING_REFERENCE *formatting_reference,
-                                  const BUTTON_SPECIFICATION_LIST *buttons,
+                                  BUTTON_SPECIFICATION_LIST *buttons,
                                   const char *cmdname,
                                   const ELEMENT *element)
 {
diff --git a/tp/Texinfo/XS/convert/call_html_perl_function.h 
b/tp/Texinfo/XS/convert/call_html_perl_function.h
index 614b57e923..068cf8252c 100644
--- a/tp/Texinfo/XS/convert/call_html_perl_function.h
+++ b/tp/Texinfo/XS/convert/call_html_perl_function.h
@@ -83,12 +83,12 @@ FORMATTED_BUTTON_INFO 
*call_formatting_function_format_button (CONVERTER *self,
                                   const ELEMENT *element);
 char *call_formatting_function_format_navigation_panel (CONVERTER *self,
                          const FORMATTING_REFERENCE *formatting_reference,
-                                  const BUTTON_SPECIFICATION_LIST *buttons,
+                                  BUTTON_SPECIFICATION_LIST *buttons,
                                   const char *cmdname, const ELEMENT *element,
                                   int vertical);
 char *call_formatting_function_format_navigation_header (CONVERTER *self,
                          const FORMATTING_REFERENCE *formatting_reference,
-                                  const BUTTON_SPECIFICATION_LIST *buttons,
+                                  BUTTON_SPECIFICATION_LIST *buttons,
                                   const char *cmdname,
                                   const ELEMENT *element);
 char *call_formatting_function_format_heading_text (CONVERTER *self,
diff --git a/tp/Texinfo/XS/convert/convert_html.c 
b/tp/Texinfo/XS/convert/convert_html.c
index 69bcc1cc10..e6dec48477 100644
--- a/tp/Texinfo/XS/convert/convert_html.c
+++ b/tp/Texinfo/XS/convert/convert_html.c
@@ -8437,7 +8437,7 @@ html_default_format_navigation_panel (CONVERTER *self,
 
 void
 format_navigation_panel (CONVERTER *self,
-                         const BUTTON_SPECIFICATION_LIST *buttons,
+                         BUTTON_SPECIFICATION_LIST *buttons,
                          const char *cmdname, const ELEMENT *element,
                          int vertical, TEXT *result)
 {
@@ -8465,7 +8465,7 @@ static const STRING_LIST vertical_navigation_classes
 
 void
 html_default_format_navigation_header (CONVERTER *self,
-                          const BUTTON_SPECIFICATION_LIST *buttons,
+                          BUTTON_SPECIFICATION_LIST *buttons,
                           const char *cmdname,
                           const ELEMENT *element, TEXT *result)
 {
@@ -8503,7 +8503,7 @@ html_default_format_navigation_header (CONVERTER *self,
 
 void
 format_navigation_header (CONVERTER *self,
-                          const BUTTON_SPECIFICATION_LIST *buttons,
+                          BUTTON_SPECIFICATION_LIST *buttons,
                           const char *cmdname,
                           const ELEMENT *element, TEXT *result)
 {
@@ -8713,7 +8713,7 @@ html_default_format_element_footer (CONVERTER *self,
   int next_is_top = 0;
   int next_is_special = 0;
   int end_page = 0;
-  const BUTTON_SPECIFICATION_LIST *buttons = 0;
+  BUTTON_SPECIFICATION_LIST *buttons = 0;
 
   if (output_unit->tree_unit_directions[D_next]
           && unit_is_top_output_unit (self,
diff --git a/tp/Texinfo/XS/convert/converter_options.h 
b/tp/Texinfo/XS/convert/converter_options.h
index 60a53e89ac..633938a395 100644
--- a/tp/Texinfo/XS/convert/converter_options.h
+++ b/tp/Texinfo/XS/convert/converter_options.h
@@ -13,18 +13,6 @@ enum BUTTON_special_unit_directions {
     BSUD_D_Contents,
 };
 
-BUTTON_SPECIFICATION_LIST *new_basic_buttons (const CONVERTER *self,
-                   enum button_function_type function_type,
-                   int with_about);
-
-BUTTON_SPECIFICATION_LIST *new_link_buttons (const CONVERTER *self);
-BUTTON_SPECIFICATION_LIST *new_section_buttons (const CONVERTER *self);
-BUTTON_SPECIFICATION_LIST *new_section_footer_buttons (const CONVERTER *self);
-
-BUTTON_SPECIFICATION_LIST *new_directions_list_buttons_specifications (
-                                            const CONVERTER *self,
-                                            const int *directions);
-
 void html_converter_defaults (CONVERTER *self,
                               CONVERTER_INITIALIZATION_INFO *format_defaults);
 #endif
diff --git a/tp/Texinfo/XS/main/DocumentXS.xs b/tp/Texinfo/XS/main/DocumentXS.xs
index b01867e368..07cc283099 100644
--- a/tp/Texinfo/XS/main/DocumentXS.xs
+++ b/tp/Texinfo/XS/main/DocumentXS.xs
@@ -165,26 +165,20 @@ register_document_options (SV *document_in, SV 
*sv_options_in)
           }
 
 SV *
-document_get_conf (SV *document_in, conf)
-         const char *conf = (char *)SvPVbyte_nolen($arg);
-    PREINIT:
-        DOCUMENT *document = 0;
-     CODE:
-        document = get_sv_document_document (document_in,
-                                             "document_get_conf");
-        if (document && document->sorted_options)
-           {
-             OPTION *option
-               = find_option_string (document->sorted_options, conf);
-             if (option)
-               RETVAL = build_sv_option (option, 0);
-             else
-               RETVAL = newSV (0);
-           }
-        else
-           RETVAL = newSV (0);
-    OUTPUT:
-        RETVAL
+document_get_conf (SV *document_in, option_name)
+      const char *option_name = (char *)SvPVbyte_nolen($arg);
+ PREINIT:
+      DOCUMENT *document = 0;
+    CODE:
+      document = get_sv_document_document (document_in,
+                                           "document_get_conf");
+      if (document && document->sorted_options)
+        RETVAL = build_sv_option_from_name (document->sorted_options,
+                                            0, option_name);
+      else
+        RETVAL = newSV (0);
+  OUTPUT:
+      RETVAL
 
 void
 set_document_global_info (SV *document_in, char *key, SV *value_sv)
@@ -239,9 +233,7 @@ document_tree (SV *document_in, int handler_only=0)
           {
             DOCUMENT *document = get_sv_document_document (document_in, 0);
             if (document)
-              {
-                result_sv = store_texinfo_tree (document, document_hv);
-              }
+              result_sv = store_document_texinfo_tree (document, document_hv);
           }
 
         if (!result_sv)
diff --git a/tp/Texinfo/XS/main/build_perl_info.c 
b/tp/Texinfo/XS/main/build_perl_info.c
index d1adcec4d1..d92b6a4d6d 100644
--- a/tp/Texinfo/XS/main/build_perl_info.c
+++ b/tp/Texinfo/XS/main/build_perl_info.c
@@ -260,7 +260,7 @@ build_perl_const_element_array (const CONST_ELEMENT_LIST 
*e_l, int avoid_recursi
 }
 
 /* contents appears in other parts of the tree */
-void
+static void
 build_perl_container (ELEMENT *e, int avoid_recursion)
 {
   SV *sv;
@@ -1027,9 +1027,95 @@ build_texinfo_tree (ELEMENT *root, int avoid_recursion)
   return root->hv;
 }
 
+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;
+    }
+}
+
+
+
+/* build often used C data to Perl */
+
+AV *
+build_string_list (const STRING_LIST *strings_list, enum sv_string_type type)
+{
+  AV *av;
+  int i;
+
+  dTHX;
+
+  av = newAV ();
+
+  for (i = 0; i < strings_list->number; i++)
+    {
+      const char *value = strings_list->list[i];
+      if (!value)
+        av_push (av, newSV (0));
+      else if (type == svt_char)
+        av_push (av, newSVpv_utf8 (value, 0));
+      else
+        av_push (av, newSVpv_byte (value, 0));
+    }
+  return av;
+}
+
+AV *
+build_elements_list (const CONST_ELEMENT_LIST *list)
+{
+  AV *list_av;
+  SV *sv;
+  int i;
+
+  dTHX;
+
+  list_av = newAV ();
+
+  av_unshift (list_av, list->number);
+
+  for (i = 0; i < list->number; i++)
+    {
+      sv = newRV_inc (list->list[i]->hv);
+      av_store (list_av, i, sv);
+    }
+
+  return list_av;
+}
+
+/* currently unused */
+AV *
+build_integer_stack (const INTEGER_STACK *integer_stack)
+{
+  AV *av;
+  int i;
+
+  dTHX;
+
+  av = newAV ();
+
+  for (i = 0; i < integer_stack->top; i++)
+    {
+      int value = integer_stack->stack[i];
+      av_push (av, newSViv (value));
+    }
+  return av;
+}
+
+
+
+/* Build data registered in Texinfo document to Perl */
+
 /* Return array of target elements.  build_texinfo_tree must
    be called first. */
-AV *
+static AV *
 build_target_elements_list (const LABEL_LIST *labels_list)
 {
   AV *target_array;
@@ -1050,7 +1136,7 @@ build_target_elements_list (const LABEL_LIST *labels_list)
   return target_array;
 }
 
-HV *
+static HV *
 build_identifiers_target (const LABEL_LIST *identifiers_target)
 {
   HV* hv;
@@ -1073,7 +1159,7 @@ build_identifiers_target (const LABEL_LIST 
*identifiers_target)
   return hv;
 }
 
-AV *
+static AV *
 build_internal_xref_list (const ELEMENT_LIST *internal_xref_list)
 {
   AV *list_av;
@@ -1094,30 +1180,8 @@ build_internal_xref_list (const ELEMENT_LIST 
*internal_xref_list)
   return list_av;
 }
 
-AV *
-build_elements_list (const CONST_ELEMENT_LIST *list)
-{
-  AV *list_av;
-  SV *sv;
-  int i;
-
-  dTHX;
-
-  list_av = newAV ();
-
-  av_unshift (list_av, list->number);
-
-  for (i = 0; i < list->number; i++)
-    {
-      sv = newRV_inc (list->list[i]->hv);
-      av_store (list_av, i, sv);
-    }
-
-  return list_av;
-}
-
 /* Return hash for list of @float's that appeared in the file. */
-HV *
+static HV *
 build_float_types_list (const FLOAT_RECORD_LIST *floats)
 {
   HV *float_hash;
@@ -1221,7 +1285,7 @@ build_single_index_data (const INDEX *index)
 /* Return object to be used as $self->{'index_names'} in the perl code.
    build_texinfo_tree must be called before this so all the 'hv' fields
    are set on the elements in the tree. */
-HV *
+static HV *
 build_index_data (const INDEX_LIST *indices_info)
 {
   size_t i;
@@ -1242,34 +1306,9 @@ build_index_data (const INDEX_LIST *indices_info)
   return hv;
 }
 
-
-AV *
-build_string_list (const STRING_LIST *strings_list, enum sv_string_type type)
-{
-  AV *av;
-  int i;
-
-  dTHX;
-
-  av = newAV ();
-
-  for (i = 0; i < strings_list->number; i++)
-    {
-      const char *value = strings_list->list[i];
-      if (!value)
-        av_push (av, newSV (0));
-      else if (type == svt_char)
-        av_push (av, newSVpv_utf8 (value, 0));
-      else
-        av_push (av, newSVpv_byte (value, 0));
-    }
-  return av;
-}
-
-
 /* Return object to be used as 'info', retrievable with the
    'global_information' function. */
-HV *
+static HV *
 build_global_info (const GLOBAL_INFO *global_info_ref,
                    const GLOBAL_COMMANDS *global_commands_ref)
 {
@@ -1338,7 +1377,7 @@ build_global_info (const GLOBAL_INFO *global_info_ref,
 
 /* Return object to be used as 'commands_info', which holds references
    to tree elements. */
-HV *
+static HV *
 build_global_commands (const GLOBAL_COMMANDS *global_commands_ref)
 {
   HV *hv;
@@ -1433,6 +1472,8 @@ build_global_commands (const GLOBAL_COMMANDS 
*global_commands_ref)
 
 
 
+/* build error messages data to Perl, for Parser, Document and Converters */
+
 static void
 build_source_info_hash (const SOURCE_INFO source_info, HV *hv)
 {
@@ -1754,7 +1795,8 @@ fill_document_hv (HV *hv, size_t document_descriptor, int 
no_store)
 
   av_internal_xref = build_internal_xref_list (&document->internal_references);
 
-  hv_identifiers_target = build_identifiers_target 
(&document->identifiers_target);
+  hv_identifiers_target
+   = build_identifiers_target (&document->identifiers_target);
 
   av_labels_list = build_target_elements_list (&document->labels_list);
 
@@ -1884,7 +1926,7 @@ rebuild_document (SV *document_in, int no_store)
 }
 
 SV *
-store_texinfo_tree (DOCUMENT *document, HV *document_hv)
+store_document_texinfo_tree (DOCUMENT *document, HV *document_hv)
 {
   SV *result_sv = 0;
   const char *key = "tree";
@@ -1924,7 +1966,7 @@ funcname (SV *document_in) \
 \
   if (document && document->fieldname)\
     {\
-      store_texinfo_tree (document, document_hv);\
+      store_document_texinfo_tree (document, document_hv);\
       if (document->modified_information & flagname)\
         {\
           HVAV *result_av_hv = buildname (document->fieldname);\
@@ -1978,7 +2020,7 @@ funcname (SV *document_in) \
 \
   if (document)\
     {\
-      store_texinfo_tree (document, document_hv);\
+      store_document_texinfo_tree (document, document_hv);\
       if (document->modified_information & flagname)\
         {\
           HVAV *result_av_hv = buildname (&document->fieldname);\
@@ -2389,919 +2431,904 @@ output_units_list_to_perl_hash (const DOCUMENT 
*document,
 
 
 
-void
-pass_document_to_converter_sv (const CONVERTER *converter,
-                               SV *converter_sv, SV *document_in)
+/* Build indices information for Perl */
+
+static SV *
+find_idx_name_entry_number_sv (HV *indices_information_hv,
+                               const char* index_name, int entry_number,
+                               const char *message)
 {
-  HV *converter_hv;
+  SV **index_info_sv;
+  SV *index_entry_sv = 0;
 
   dTHX;
 
-  converter_hv = (HV *)SvRV (converter_sv);
-
-  if (document_in && SvOK (document_in))
+  index_info_sv = hv_fetch (indices_information_hv, index_name,
+                            strlen (index_name), 0);
+  if (!index_info_sv)
     {
-      SvREFCNT_inc (document_in);
-      hv_store (converter_hv, "document", strlen ("document"),
-                document_in, 0);
+      fprintf (stderr, "%s index %s not found\n", message, index_name);
     }
-  if (converter && converter->convert_text_options)
+  else
     {
-      SV *text_options_sv
-       = build_convert_text_options (converter->convert_text_options);
-      hv_store (converter_hv,
-                "convert_text_options", strlen("convert_text_options"),
-                text_options_sv, 0);
+      HV *index_info_hv = (HV *) SvRV (*index_info_sv);
+      SV **index_info_index_entries_sv = hv_fetch (index_info_hv,
+             "index_entries", strlen ("index_entries"), 0);
+
+      if (!index_info_index_entries_sv)
+        {
+          fprintf (stderr, "%s index %s 'index_entries' not found\n",
+                           message, index_name);
+        }
+      else
+        {
+          AV *index_info_entries_av
+              = (AV *) SvRV (*index_info_index_entries_sv);
+
+          SV **index_entry_info_sv = av_fetch (index_info_entries_av,
+                                             entry_number -1, 0);
+
+          if (!index_entry_info_sv)
+            {
+              fprintf (stderr, "%s: %d in %s not found\n", message,
+                       entry_number, index_name);
+            }
+          else
+            index_entry_sv = *index_entry_info_sv;
+        }
     }
+  return index_entry_sv;
 }
 
-/* build a Perl button data from pure C button structure.
-   This is a partial implementation.
-   This function can only be called for default buttons for now, so we do
-   not need to handle other types of buttons.  We could handle possibly
-   more: BST_string and BST_direction_info with
-     BIT_string, BIT_selected_direction_information_type and
-     BIT_href_direction_information_type.
-   Other need Perl info */
-SV *
-html_build_button (const CONVERTER *converter, BUTTON_SPECIFICATION *button,
-                   int *user_function_number)
+HV *
+build_indices_sort_strings (const INDICES_SORT_STRINGS *indices_sort_strings,
+                            HV *indices_information_hv)
 {
+  HV *indices_sort_strings_hv;
+  size_t i;
+
   dTHX;
 
-  *user_function_number = 0;
+  if (!indices_sort_strings)
+    return 0;
 
-  switch (button->type)
+  indices_sort_strings_hv = newHV ();
+
+  for (i = 0; i < indices_sort_strings->number; i++)
     {
-      const char *direction_name;
-      case BST_direction:
-        if (button->b.direction < 0)
-          direction_name = button->direction_string;
-        else
-          direction_name
-            = converter->direction_unit_direction_name[button->b.direction];
-        return newSVpv_utf8 (direction_name, 0);
-        break;
+      const INDEX_SORT_STRINGS *index_sort_strings
+         = &indices_sort_strings->indices[i];
+      const char *index_name = index_sort_strings->index->name;
 
-      case BST_direction_info:
+      if (index_sort_strings->entries_number > 0)
         {
-          BUTTON_SPECIFICATION_INFO *button_spec = button->b.button_info;
-          AV *button_spec_info_av;
+          size_t j;
+          AV *sort_string_entries_av = newAV ();
 
-          if (button_spec->direction < 0)
-            direction_name = button->direction_string;
-          else
-            direction_name
-            = converter->direction_unit_direction_name[button_spec->direction];
+          hv_store (indices_sort_strings_hv, index_name, strlen (index_name),
+                    newRV_noinc ((SV *)sort_string_entries_av), 0);
 
-          if (button_spec->type == BIT_function)
+          for (j = 0; j < index_sort_strings->entries_number; j++)
             {
-              /* contains a leading :: */
-              const char *sub_name = html_button_function_type_string[
-                                      button_spec->bi.button_function.type];
-              if (sub_name)
-                {
-                  char *cv_name;
-                  CV *button_function_cv;
-
-                  xasprintf (&cv_name, "Texinfo::Convert::HTML%s", sub_name);
-                  button_function_cv = get_cv (cv_name, 0);
-                  if (!button_function_cv)
-                    fprintf (stderr, "BUG: %s: not found\n", cv_name);
-
-                  free (cv_name);
+              const INDEX_ENTRY_SORT_STRING *index_entry_sort_string
+                = &index_sort_strings->sort_string_entries[j];
+              const INDEX_ENTRY *entry = index_entry_sort_string->entry;
+              const char *entry_index_name = entry->index_name;
+              int entry_number = entry->number;
+              char *message;
+              SV *index_entry_sv;
+              HV *index_entry_sort_string_hv;
+              AV *sort_string_subentries_av;
+              size_t k;
 
-                  button_spec_info_av = newAV ();
-                  av_push (button_spec_info_av,
-                           newSVpv_utf8 (direction_name, 0));
-              /* not sure that the _inc leads to the same number of references
-                 than with Pure perl defined buttons, but it is needed
-                 as tested  */
-                  av_push (button_spec_info_av,
-                           newRV_inc ((SV *) button_function_cv));
-                  return newRV_inc ((SV *) button_spec_info_av);
+              if (index_entry_sort_string->subentries_number <= 0)
+                {
+                  fprintf (stderr, "BUG: build_indices_sort_strings:"
+                   " %s: entry %zu: no subentries", index_name, j);
+                  continue;
                 }
-            }
-        }
-        break;
 
-      default:
-        break;
-    }
-  return newSV (0);
-}
-
-SV *
-html_build_buttons_specification (CONVERTER *converter,
-                                  BUTTON_SPECIFICATION_LIST *buttons)
-{
-  AV *buttons_av;
-  size_t i;
-
-  dTHX;
+              xasprintf (&message, "BUG: build_indices_sort_strings:"
+                                   " %s: entry %zu", index_name, j);
+              index_entry_sv
+                = find_idx_name_entry_number_sv (indices_information_hv,
+                                                 entry_index_name, 
entry_number,
+                                                 message);
+              free (message);
 
-  buttons_av = newAV ();
+              /* probably not possible, unless there is a bug */
+              if (!index_entry_sv)
+                continue;
 
-  buttons->av = buttons_av;
+              index_entry_sort_string_hv = newHV ();
+              av_push (sort_string_entries_av,
+                       newRV_noinc ((SV *) index_entry_sort_string_hv));
 
-  for (i = 0; i < buttons->number; i++)
-    {
-      int user_function_number;
-      BUTTON_SPECIFICATION *button = &buttons->list[i];
+              hv_store (index_entry_sort_string_hv, "index_name",
+                        strlen ("index_name"),
+                        newSVpv_utf8 (entry->index_name, 0), 0);
+              hv_store (index_entry_sort_string_hv, "number",
+                        strlen ("number"), newSViv (entry->number), 0);
 
-      SV *button_sv = html_build_button (converter, button,
-                                         &user_function_number);
-      buttons->BIT_user_function_number += user_function_number;
+              SvREFCNT_inc (index_entry_sv);
+              hv_store (index_entry_sort_string_hv, "entry",
+                        strlen ("entry"), index_entry_sv, 0);
 
-      converter->external_references_number += user_function_number;
+              sort_string_subentries_av = newAV ();
+              hv_store (index_entry_sort_string_hv, "sort_strings",
+                        strlen ("sort_strings"),
+                        newRV_noinc ((SV *) sort_string_subentries_av), 0);
 
-      button->sv = button_sv;
+              for (k = 0; k < index_entry_sort_string->subentries_number; k++)
+                {
+                  const INDEX_SUBENTRY_SORT_STRING *subentry_sort_string
+                    = &index_entry_sort_string->sort_string_subentries[k];
+                  HV *subentry_sort_string_hv = newHV ();
 
-      /* retain a reference in C */
-      SvREFCNT_inc (button->sv);
+                  av_push (sort_string_subentries_av,
+                           newRV_noinc ((SV *) subentry_sort_string_hv));
 
-      av_push (buttons_av, button_sv);
+                  hv_store (subentry_sort_string_hv, "sort_string",
+                            strlen ("sort_string"),
+                     newSVpv_utf8 (subentry_sort_string->sort_string, 0), 0);
+                  hv_store (subentry_sort_string_hv, "alpha",
+                            strlen ("alpha"),
+                            newSViv (subentry_sort_string->alpha), 0);
+                }
+            }
+        }
     }
-
-  /* add a refcount to retain one in C */
-  return newRV_inc ((SV *)buttons_av);
+  return indices_sort_strings_hv;
 }
 
-SV *
-html_build_direction_icons (const CONVERTER *converter,
-                            const DIRECTION_ICON_LIST *direction_icons)
+HV *
+build_sorted_indices_by_index (
+                      const INDEX_SORTED_BY_INDEX *index_entries_by_index,
+                      HV *indices_information_hv)
 {
-  HV *icons_hv;
-  int i;
+  HV *indices_hv;
+  const INDEX_SORTED_BY_INDEX *idx;
 
   dTHX;
 
-  if (!direction_icons)
-    return newSV (0);
-
-  if (!converter || !converter->direction_unit_direction_name)
-    return newSV (0);
+  if (!index_entries_by_index)
+    return 0;
 
-  icons_hv = newHV ();
+  indices_hv = newHV ();
 
-  for (i = 0; converter->direction_unit_direction_name[i]; i++)
+  for (idx = index_entries_by_index; idx->name; idx++)
     {
-      if (direction_icons->list[i])
+      AV *entries_av = newAV ();
+      size_t j;
+
+      hv_store (indices_hv, idx->name, strlen (idx->name),
+                newRV_noinc ((SV *)entries_av), 0);
+
+      for (j = 0; j < idx->entries_number; j++)
         {
-          const char *direction_name
-            = converter->direction_unit_direction_name[i];
-          hv_store (icons_hv, direction_name, strlen (direction_name),
-                    newSVpv_utf8 (direction_icons->list[i], 0), 0);
+          const INDEX_ENTRY *entry = idx->entries[j];
+          const char *index_name = entry->index_name;
+          int entry_number = entry->number;
+          char *message;
+          SV *index_entry_sv;
+
+          xasprintf (&message, "BUG: build_sorted_indices_by_index:"
+                               " %s: entry %zu", idx->name, j);
+          index_entry_sv
+            = find_idx_name_entry_number_sv (indices_information_hv,
+                                             index_name, entry_number,
+                                             message);
+          free (message);
+
+          if (index_entry_sv)
+            {
+              SvREFCNT_inc (index_entry_sv);
+              av_push (entries_av, index_entry_sv);
+            }
         }
     }
-  return newRV_noinc ((SV *)icons_hv);
+  return indices_hv;
 }
 
-SV *
-build_sv_option (const OPTION *option, CONVERTER *converter)
+HV *
+build_sorted_indices_by_letter (
+                      const INDEX_SORTED_BY_LETTER *index_entries_by_letter,
+                      HV *indices_information_hv)
 {
+  HV *indices_hv;
+  const INDEX_SORTED_BY_LETTER *idx;
+
   dTHX;
 
-  switch (option->type)
-    {
-      case GOT_integer:
-        if (option->o.integer == -1)
-          return newSV (0);
-        return newSViv (option->o.integer);
-        break;
+  if (!index_entries_by_letter)
+    return 0;
 
-      case GOT_char:
-        if (!option->o.string)
-          return newSV (0);
-        return newSVpv_utf8 (option->o.string, 0);
-        break;
+  indices_hv = newHV ();
 
-      case GOT_bytes:
-        if (!option->o.string)
-          return newSV (0);
-        return newSVpv_byte (option->o.string, 0);
-        break;
+  for (idx = index_entries_by_letter; idx->name; idx++)
+    {
+      AV *sorted_letters_av;
+      size_t i;
 
-      case GOT_bytes_string_list:
-        return newRV_noinc ((SV *) build_string_list(option->o.strlist,
-                            svt_byte));
-        break;
+      if (idx->letter_number <= 0)
+        continue;
 
-      case GOT_file_string_list:
-        return newRV_noinc ((SV *) build_string_list(option->o.strlist,
-                            svt_dir));
-        break;
+      sorted_letters_av = newAV ();
 
-      case GOT_char_string_list:
-        return newRV_noinc ((SV *) build_string_list(option->o.strlist,
-                            svt_char));
-        break;
+      hv_store (indices_hv, idx->name, strlen (idx->name),
+                newRV_noinc ((SV *)sorted_letters_av), 0);
 
-      case GOT_buttons:
-        if (option->o.buttons)
-          {
-            if (!option->o.buttons->av)
-              html_build_buttons_specification (converter, option->o.buttons);
-            return newRV_inc ((SV *) option->o.buttons->av);
-          }
-        break;
+      for (i = 0; i < idx->letter_number; i++)
+        {
+          size_t j;
+          HV *letter_hv = newHV ();
+          AV *entries_av = newAV ();
+          const LETTER_INDEX_ENTRIES *letter = &idx->letter_entries[i];
 
-      case GOT_icons:
-        return html_build_direction_icons (converter, option->o.icons);
-        break;
+          hv_store (letter_hv, "letter", strlen ("letter"),
+                    newSVpv_utf8 (letter->letter, 0), 0);
 
-      default:
-        break;
-    }
-  return newSV (0);
-}
+          hv_store (letter_hv, "entries", strlen ("entries"),
+                    newRV_noinc ((SV *)entries_av), 0);
 
-SV *
-get_sv_conf (CONVERTER *converter, const char *option_name)
-{
-  dTHX;
+          av_push (sorted_letters_av, newRV_noinc ((SV *)letter_hv));
 
-  if (converter->conf)
-    {
-      const OPTION *option
-        = find_option_string (converter->sorted_options, option_name);
-      if (option)
-        {
-          SV *result = build_sv_option (option, converter);
-          return result;
-       }
+          for (j = 0; j < letter->entries_number; j++)
+            {
+              const INDEX_ENTRY *entry = letter->entries[j];
+              const char *index_name = entry->index_name;
+              int entry_number = entry->number;
+              char *message;
+              SV *index_entry_sv;
+              xasprintf (&message, "BUG: build_sorted_indices_by_letter:"
+                                   " %s: %s: entry %zu", idx->name,
+                                   letter->letter, j);
+              index_entry_sv
+                = find_idx_name_entry_number_sv (indices_information_hv,
+                                                 index_name, entry_number,
+                                                 message);
+              free (message);
+
+              if (index_entry_sv)
+                {
+                  SvREFCNT_inc (index_entry_sv);
+                  av_push (entries_av, index_entry_sv);
+                }
+            }
+        }
     }
-  return newSV (0);
+  return indices_hv;
 }
+
 
-AV *
-build_integer_stack (const INTEGER_STACK *integer_stack)
+void
+pass_document_to_converter_sv (const CONVERTER *converter,
+                               SV *converter_sv, SV *document_in)
 {
-  AV *av;
-  int i;
+  HV *converter_hv;
 
   dTHX;
 
-  av = newAV ();
+  converter_hv = (HV *)SvRV (converter_sv);
 
-  for (i = 0; i < integer_stack->top; i++)
+  if (document_in && SvOK (document_in))
     {
-      int value = integer_stack->stack[i];
-      av_push (av, newSViv (value));
+      SvREFCNT_inc (document_in);
+      hv_store (converter_hv, "document", strlen ("document"),
+                document_in, 0);
     }
-  return av;
-}
-
-SV *
-build_filenames (const FILE_NAME_PATH_COUNTER_LIST *output_unit_files)
-{
-  int i;
-  HV *hv;
-
-  dTHX;
-
-  hv = newHV ();
-
-  if (output_unit_files)
+  if (converter && converter->convert_text_options)
     {
-      for (i = 0; i < output_unit_files->number; i++)
-        {
-          const FILE_NAME_PATH_COUNTER *output_unit_file
-            = &output_unit_files->list[i];
-          const char *normalized_filename
-             = output_unit_file->normalized_filename;
-          SV *normalized_filename_sv = newSVpv_utf8 (normalized_filename, 0);
-
-          hv_store_ent (hv, normalized_filename_sv,
-                    newSVpv_utf8 (output_unit_file->filename, 0), 0);
-        }
+      SV *text_options_sv
+       = build_convert_text_options (converter->convert_text_options);
+      hv_store (converter_hv,
+                "convert_text_options", strlen("convert_text_options"),
+                text_options_sv, 0);
     }
-
-  return newRV_noinc ((SV *) hv);
 }
 
-SV *
-build_file_counters (const FILE_NAME_PATH_COUNTER_LIST *output_unit_files)
-{
-  int i;
-  HV *hv;
-
-  dTHX;
-
-  hv = newHV ();
-
-  if (output_unit_files)
-    {
-      for (i = 0; i < output_unit_files->number; i++)
-        {
-          const FILE_NAME_PATH_COUNTER *output_unit_file
-            = &output_unit_files->list[i];
-          const char *filename = output_unit_file->filename;
-          SV *filename_sv = newSVpv_utf8 (filename, 0);
+
 
-          hv_store_ent (hv, filename_sv, newSViv (output_unit_file->counter), 
0);
-        }
-    }
+/* build customization options to Perl */
 
-  return newRV_noinc ((SV *) hv);
-}
-
-SV *
-build_out_filepaths (const FILE_NAME_PATH_COUNTER_LIST *output_unit_files)
+/* build a Perl button data from pure C button structure.
+   This is a partial implementation.
+   This function can only be called for default buttons for now, so we do
+   not need to handle other types of buttons.  We could handle possibly
+   more: BST_string and BST_direction_info with
+     BIT_string, BIT_selected_direction_information_type and
+     BIT_href_direction_information_type.
+   Other need Perl info */
+static SV *
+html_build_button (const CONVERTER *converter, BUTTON_SPECIFICATION *button,
+                   int *user_function_number)
 {
-  int i;
-  HV *hv;
-
   dTHX;
 
-  hv = newHV ();
+  *user_function_number = 0;
 
-  if (output_unit_files)
+  switch (button->type)
     {
-      for (i = 0; i < output_unit_files->number; i++)
-        {
-          const FILE_NAME_PATH_COUNTER *output_unit_file
-            = &output_unit_files->list[i];
-          const char *filename = output_unit_file->filename;
-          SV *filename_sv = newSVpv_utf8 (filename, 0);
+      const char *direction_name;
+      case BST_direction:
+        if (button->b.direction < 0)
+          direction_name = button->direction_string;
+        else
+          direction_name
+            = converter->direction_unit_direction_name[button->b.direction];
+        return newSVpv_utf8 (direction_name, 0);
+        break;
 
-          hv_store_ent (hv, filename_sv,
-                        newSVpv_utf8 (output_unit_file->filepath, 0), 0);
-        }
-    }
+      case BST_direction_info:
+        {
+          BUTTON_SPECIFICATION_INFO *button_spec = button->b.button_info;
+          AV *button_spec_info_av;
 
-  return newRV_noinc ((SV *) hv);
-}
+          if (button_spec->direction < 0)
+            direction_name = button->direction_string;
+          else
+            direction_name
+            = converter->direction_unit_direction_name[button_spec->direction];
 
-void
-pass_output_unit_files (SV *converter_sv,
-                        const FILE_NAME_PATH_COUNTER_LIST *output_unit_files)
-{
-  SV *filenames_sv;
-  SV *file_counters_sv;
-  SV *out_filepaths_sv;
+          if (button_spec->type == BIT_function)
+            {
+              /* contains a leading :: */
+              const char *sub_name = html_button_function_type_string[
+                                      button_spec->bi.button_function.type];
+              if (sub_name)
+                {
+                  char *cv_name;
+                  CV *button_function_cv;
 
-  dTHX;
+                  xasprintf (&cv_name, "Texinfo::Convert::HTML%s", sub_name);
+                  button_function_cv = get_cv (cv_name, 0);
+                  if (!button_function_cv)
+                    fprintf (stderr, "BUG: %s: not found\n", cv_name);
 
-  HV *converter_hv = (HV *) SvRV (converter_sv);
+                  free (cv_name);
 
-  filenames_sv = build_filenames (output_unit_files);
-  file_counters_sv = build_file_counters (output_unit_files);
-  out_filepaths_sv = build_out_filepaths (output_unit_files);
+                  button_spec_info_av = newAV ();
+                  av_push (button_spec_info_av,
+                           newSVpv_utf8 (direction_name, 0));
+              /* not sure that the _inc leads to the same number of references
+                 than with Pure perl defined buttons, but it is needed
+                 as tested  */
+                  av_push (button_spec_info_av,
+                           newRV_inc ((SV *) button_function_cv));
+                  return newRV_inc ((SV *) button_spec_info_av);
+                }
+            }
+        }
+        break;
 
-#define STORE(key) \
-  hv_store (converter_hv, #key, strlen (#key), key##_sv, 0); \
-  SvREFCNT_inc (key##_sv);
-  STORE(filenames);
-  STORE (file_counters);
-  STORE (out_filepaths);
-#undef STORE
+      default:
+        break;
+    }
+  return newSV (0);
 }
 
-/* Texinfo::Common output_files_information API */
-void
-build_output_files_unclosed_files (HV *hv,
-                 const OUTPUT_FILES_INFORMATION *output_files_information)
-{
-  SV **unclosed_files_sv;
-  HV *unclosed_files_hv;
-
-  const FILE_STREAM_LIST *unclosed_files;
-  int i;
+SV *
+html_build_buttons_specification (CONVERTER *converter,
+                                  BUTTON_SPECIFICATION_LIST *buttons)
+{
+  AV *buttons_av;
+  size_t i;
 
   dTHX;
 
-  unclosed_files_sv = hv_fetch (hv, "unclosed_files",
-                                strlen ("unclosed_files"), 0);
+  buttons_av = newAV ();
 
-  if (!unclosed_files_sv)
-    {
-      unclosed_files_hv = newHV ();
-      hv_store (hv, "unclosed_files", strlen ("unclosed_files"),
-                newRV_noinc ((SV *) unclosed_files_hv), 0);
-    }
-  else
-    {
-      unclosed_files_hv = (HV *)SvRV (*unclosed_files_sv);
-    }
+  buttons->av = buttons_av;
 
-  unclosed_files = &output_files_information->unclosed_files;
-  if (unclosed_files->number > 0)
+  for (i = 0; i < buttons->number; i++)
     {
-      for (i = 0; i < unclosed_files->number; i++)
-        {
-          const FILE_STREAM *file_stream = &unclosed_files->list[i];
-          const char *file_path = file_stream->file_path;
-      /* It is not possible to associate the unclosed stream to a SV.
-         It is possible to obtain a PerlIO from a FILE, as described in
-           https://perldoc.perl.org/perlapio
-         with
-           PerlIO *   PerlIO_importFILE  (FILE *stdio, const char *mode)
-         However, it is not possible to create an IO * SV from the PerlIO
-         or associate to an already existing IO *. An IO * SV is created by
-           IO *  newIO()
-         and it is possible to get the associated PerlIO, with
-           PerlIO *IoOFP(IO *io);
-         but not to set it.
+      int user_function_number;
+      BUTTON_SPECIFICATION *button = &buttons->list[i];
 
-         However, it is possible to pass a stream through the XS
-         interface.  Therefore here, the unclosed file name is registered,
-         the stream can then be passed to Perl through a call of
-         the XS interface Texinfo::Convert::ConvertXS::get_unclosed_stream.
+      SV *button_sv = html_build_button (converter, button,
+                                         &user_function_number);
+      buttons->BIT_user_function_number += user_function_number;
 
-         Register that there is an unclosed file from XS by associating
-         with undef; if from Perl, it would be associated with a file handle */
-          SV *file_path_sv = newSVpv_byte (file_path, 0);
-          hv_store_ent (unclosed_files_hv, file_path_sv, newSV (0), 0);
-        }
+      converter->external_references_number += user_function_number;
+
+      button->sv = button_sv;
+
+      /* retain a reference in C */
+      SvREFCNT_inc (button->sv);
+
+      av_push (buttons_av, button_sv);
     }
+
+  /* add a refcount to retain one in C */
+  return newRV_inc ((SV *)buttons_av);
 }
 
-/* input hv should be an output_files hv, in general setup by
- $converter->{'output_files'} = 
Texinfo::Convert::Utils::output_files_initialize(); */
-void
-build_output_files_opened_files (HV *hv,
-                    const OUTPUT_FILES_INFORMATION *output_files_information)
+SV *
+html_build_direction_icons (const CONVERTER *converter,
+                            const DIRECTION_ICON_LIST *direction_icons)
 {
-  SV **opened_files_sv;
-  HV *opened_files_hv;
-
-  const STRING_LIST *opened_files;
+  HV *icons_hv;
   int i;
 
   dTHX;
 
-  opened_files_sv = hv_fetch (hv, "opened_files", strlen ("opened_files"), 0);
+  if (!direction_icons)
+    return newSV (0);
 
-  if (!opened_files_sv)
-    {
-      opened_files_hv = newHV ();
-      hv_store (hv, "opened_files", strlen ("opened_files"),
-                newRV_noinc ((SV *) opened_files_hv), 0);
-    }
-  else
-    {
-      opened_files_hv = (HV *)SvRV (*opened_files_sv);
-    }
+  if (!converter || !converter->direction_unit_direction_name)
+    return newSV (0);
 
-  opened_files = &output_files_information->opened_files;
-  if (opened_files->number > 0)
+  icons_hv = newHV ();
+
+  for (i = 0; converter->direction_unit_direction_name[i]; i++)
     {
-      for (i = 0; i < opened_files->number; i++)
+      if (direction_icons->list[i])
         {
-          const char *file_path = opened_files->list[i];
-          SV *file_path_sv = newSVpv_byte (file_path, 0);
-          hv_store_ent (opened_files_hv, file_path_sv, newSViv (1), 0);
+          const char *direction_name
+            = converter->direction_unit_direction_name[i];
+          hv_store (icons_hv, direction_name, strlen (direction_name),
+                    newSVpv_utf8 (direction_icons->list[i], 0), 0);
         }
     }
+  return newRV_noinc ((SV *)icons_hv);
 }
 
-void
-build_output_files_information (SV *converter_sv,
-                   const OUTPUT_FILES_INFORMATION *output_files_information)
+static SV *
+build_sv_option (const OPTION *option, CONVERTER *converter)
 {
-  HV *hv;
-  SV **output_files_sv;
-  HV *output_files_hv;
-
   dTHX;
 
-  hv = (HV *) SvRV (converter_sv);
+  switch (option->type)
+    {
+      case GOT_integer:
+        if (option->o.integer == -1)
+          return newSV (0);
+        return newSViv (option->o.integer);
+        break;
 
-  output_files_sv = hv_fetch (hv, "output_files",
-                                strlen ("output_files"), 0);
+      case GOT_char:
+        if (!option->o.string)
+          return newSV (0);
+        return newSVpv_utf8 (option->o.string, 0);
+        break;
 
-  if (!output_files_sv)
-    {
-      output_files_hv = newHV ();
-      hv_store (hv, "output_files", strlen ("output_files"),
-                newRV_noinc ((SV *) output_files_hv), 0);
-    }
-  else
-    {
-      output_files_hv = (HV *)SvRV (*output_files_sv);
-    }
+      case GOT_bytes:
+        if (!option->o.string)
+          return newSV (0);
+        return newSVpv_byte (option->o.string, 0);
+        break;
 
-  build_output_files_opened_files (output_files_hv,
-                                   output_files_information);
-  build_output_files_unclosed_files (output_files_hv,
-                                     output_files_information);
-}
+      case GOT_bytes_string_list:
+        return newRV_noinc ((SV *) build_string_list(option->o.strlist,
+                            svt_byte));
+        break;
 
-HV *
-build_expanded_formats (const EXPANDED_FORMAT *expanded_formats)
-{
-  int i;
-  HV *expanded_hv;
+      case GOT_file_string_list:
+        return newRV_noinc ((SV *) build_string_list(option->o.strlist,
+                            svt_dir));
+        break;
 
-  dTHX;
+      case GOT_char_string_list:
+        return newRV_noinc ((SV *) build_string_list(option->o.strlist,
+                            svt_char));
+        break;
 
-  expanded_hv = newHV ();
-  for (i = 0; i < expanded_formats_number (); i++)
-    {
-      if (expanded_formats[i].expandedp)
-        {
-          const char *format = expanded_formats[i].format;
-          hv_store (expanded_hv, format, strlen (format),
-                    newSViv (1), 0);
-        }
+      case GOT_buttons:
+        if (option->o.buttons)
+          {
+            if (!option->o.buttons->av)
+              html_build_buttons_specification (converter, option->o.buttons);
+            return newRV_inc ((SV *) option->o.buttons->av);
+          }
+        break;
+
+      case GOT_icons:
+        return html_build_direction_icons (converter, option->o.icons);
+        break;
+
+      default:
+        break;
     }
-  return expanded_hv;
+  return newSV (0);
 }
 
-HV *
-build_translated_commands (const TRANSLATED_COMMAND *translated_commands)
+SV *
+build_sv_option_from_name (OPTION **sorted_options, CONVERTER *converter,
+                           const char *option_name)
 {
-  int i;
-  HV *translated_hv;
-
   dTHX;
 
-  translated_hv = newHV ();
-  for (i = 0; translated_commands[i].cmd; i++)
+  const OPTION *option
+   = find_option_string (sorted_options, option_name);
+
+  if (option)
     {
-      enum command_id cmd = translated_commands[i].cmd;
-      const char *translation = translated_commands[i].translation;
-      const char *command_name = builtin_command_name (cmd);
-      hv_store (translated_hv, command_name, strlen (command_name),
-                newSVpv_utf8 (translation, 0), 0);
+      SV *result = build_sv_option (option, converter);
+      return result;
     }
-  return translated_hv;
+  return newSV (0);
 }
 
-void
-pass_generic_converter_to_converter_sv (SV *converter_sv,
-                                        const CONVERTER *converter)
+
+/* API to access output file names associated with output units */ 
+
+static SV *
+build_filenames (const FILE_NAME_PATH_COUNTER_LIST *output_unit_files)
 {
-  HV *converter_hv;
-  HV *expanded_formats_hv;
-  HV *translated_commands_hv;
-  HV *output_files_hv;
-  HV *unclosed_files_hv;
-  HV *opened_files_hv;
+  int i;
+  HV *hv;
 
   dTHX;
 
-  converter_hv = (HV *)SvRV (converter_sv);
+  hv = newHV ();
 
-#define STORE(key, sv) hv_store (converter_hv, key, strlen (key), sv, 0);
-  /* $converter->{'output_files'}
-        = Texinfo::Convert::Utils::output_files_initialize(); */
-  output_files_hv = newHV ();
-  STORE("output_files", newRV_noinc ((SV *) output_files_hv));
+  if (output_unit_files)
+    {
+      for (i = 0; i < output_unit_files->number; i++)
+        {
+          const FILE_NAME_PATH_COUNTER *output_unit_file
+            = &output_unit_files->list[i];
+          const char *normalized_filename
+             = output_unit_file->normalized_filename;
+          SV *normalized_filename_sv = newSVpv_utf8 (normalized_filename, 0);
 
-  unclosed_files_hv = newHV ();
-  opened_files_hv = newHV ();
-  hv_store (output_files_hv, "unclosed_files", strlen ("unclosed_files"),
-            newRV_noinc ((SV *) unclosed_files_hv), 0);
-  hv_store (output_files_hv, "opened_files_hv",
-            strlen ("opened_files_hv"),
-            newRV_noinc ((SV *) opened_files_hv), 0);
+          hv_store_ent (hv, normalized_filename_sv,
+                    newSVpv_utf8 (output_unit_file->filename, 0), 0);
+        }
+    }
+
+  return newRV_noinc ((SV *) hv);
+}
+
+static SV *
+build_file_counters (const FILE_NAME_PATH_COUNTER_LIST *output_unit_files)
+{
+  int i;
+  HV *hv;
 
-  expanded_formats_hv
-    = build_expanded_formats (converter->expanded_formats);
-  STORE("expanded_formats", newRV_noinc ((SV *) expanded_formats_hv));
+  dTHX;
 
-  translated_commands_hv
-    = build_translated_commands (converter->translated_commands);
-  STORE("translated_commands", newRV_noinc ((SV *) translated_commands_hv));
+  hv = newHV ();
 
-  /* store converter_descriptor in perl converter */
-  STORE("converter_descriptor", newSViv ((IV)converter->converter_descriptor));
+  if (output_unit_files)
+    {
+      for (i = 0; i < output_unit_files->number; i++)
+        {
+          const FILE_NAME_PATH_COUNTER *output_unit_file
+            = &output_unit_files->list[i];
+          const char *filename = output_unit_file->filename;
+          SV *filename_sv = newSVpv_utf8 (filename, 0);
 
-#undef STORE
+          hv_store_ent (hv, filename_sv, newSViv (output_unit_file->counter), 
0);
+        }
+    }
+
+  return newRV_noinc ((SV *) hv);
 }
 
 SV *
-build_convert_text_options (TEXT_OPTIONS *text_options)
+build_out_filepaths (const FILE_NAME_PATH_COUNTER_LIST *output_unit_files)
 {
-  HV *text_options_hv;
-  HV *expanded_formats_hv;
+  int i;
+  HV *hv;
 
   dTHX;
 
-  text_options_hv = newHV ();
-
-#define STORE(key, sv) hv_store (text_options_hv, key, strlen (key), sv, 0)
-
-  if (text_options->ASCII_GLYPH)
-    STORE("ASCII_GLYPH", newSViv (1));
-
-  if (text_options->NUMBER_SECTIONS)
-    STORE("NUMBER_SECTIONS", newSViv (1));
+  hv = newHV ();
 
-  if (text_options->TEST)
-    STORE("TEST", newSViv (1));
+  if (output_unit_files)
+    {
+      for (i = 0; i < output_unit_files->number; i++)
+        {
+          const FILE_NAME_PATH_COUNTER *output_unit_file
+            = &output_unit_files->list[i];
+          const char *filename = output_unit_file->filename;
+          SV *filename_sv = newSVpv_utf8 (filename, 0);
 
-  if (text_options->sort_string)
-    STORE("sort_string", newSViv (1));
+          hv_store_ent (hv, filename_sv,
+                        newSVpv_utf8 (output_unit_file->filepath, 0), 0);
+        }
+    }
 
-  if (text_options->encoding)
-    STORE("enabled_encoding", newSVpv_utf8 (text_options->encoding, 0));
+  return newRV_noinc ((SV *) hv);
+}
 
-  if (text_options->set_case)
-    STORE("set_case", newSViv (text_options->set_case));
+void
+pass_output_unit_files (SV *converter_sv,
+                        const FILE_NAME_PATH_COUNTER_LIST *output_unit_files)
+{
+  SV *filenames_sv;
+  SV *file_counters_sv;
+  SV *out_filepaths_sv;
 
-  if (text_options->code_state)
-    STORE("_code_state", newSViv (text_options->code_state));
+  dTHX;
 
-  expanded_formats_hv = build_expanded_formats 
(text_options->expanded_formats);
-  STORE("expanded_formats", newRV_noinc ((SV *)expanded_formats_hv));
+  HV *converter_hv = (HV *) SvRV (converter_sv);
 
-  if (text_options->include_directories.number > 0)
-    {
-      AV *av = build_string_list (&text_options->include_directories, 
svt_byte);
-      STORE("INCLUDE_DIRECTORIES", newRV_noinc ((SV *) av));
-    }
+  filenames_sv = build_filenames (output_unit_files);
+  file_counters_sv = build_file_counters (output_unit_files);
+  out_filepaths_sv = build_out_filepaths (output_unit_files);
 
-  if (text_options->converter && text_options->converter->hv)
-    {
-      STORE("converter", newRV_inc ((SV *) text_options->converter->hv));
-    }
+#define STORE(key) \
+  hv_store (converter_hv, #key, strlen (#key), key##_sv, 0); \
+  SvREFCNT_inc (key##_sv);
+  STORE(filenames);
+  STORE (file_counters);
+  STORE (out_filepaths);
 #undef STORE
-
-  return newRV_noinc ((SV *)text_options_hv);
 }
 
-SV *
-find_idx_name_entry_number_sv (HV *indices_information_hv,
-                               const char* index_name, int entry_number,
-                               const char *message)
+
+
+/* Texinfo::Common output_files_information API */
+static void
+build_output_files_unclosed_files (HV *hv,
+                 const OUTPUT_FILES_INFORMATION *output_files_information)
 {
-  SV **index_info_sv;
-  SV *index_entry_sv = 0;
+  SV **unclosed_files_sv;
+  HV *unclosed_files_hv;
+
+  const FILE_STREAM_LIST *unclosed_files;
+  int i;
 
   dTHX;
 
-  index_info_sv = hv_fetch (indices_information_hv, index_name,
-                            strlen (index_name), 0);
-  if (!index_info_sv)
+  unclosed_files_sv = hv_fetch (hv, "unclosed_files",
+                                strlen ("unclosed_files"), 0);
+
+  if (!unclosed_files_sv)
     {
-      fprintf (stderr, "%s index %s not found\n", message, index_name);
+      unclosed_files_hv = newHV ();
+      hv_store (hv, "unclosed_files", strlen ("unclosed_files"),
+                newRV_noinc ((SV *) unclosed_files_hv), 0);
     }
   else
     {
-      HV *index_info_hv = (HV *) SvRV (*index_info_sv);
-      SV **index_info_index_entries_sv = hv_fetch (index_info_hv,
-             "index_entries", strlen ("index_entries"), 0);
+      unclosed_files_hv = (HV *)SvRV (*unclosed_files_sv);
+    }
 
-      if (!index_info_index_entries_sv)
-        {
-          fprintf (stderr, "%s index %s 'index_entries' not found\n",
-                           message, index_name);
-        }
-      else
+  unclosed_files = &output_files_information->unclosed_files;
+  if (unclosed_files->number > 0)
+    {
+      for (i = 0; i < unclosed_files->number; i++)
         {
-          AV *index_info_entries_av
-              = (AV *) SvRV (*index_info_index_entries_sv);
+          const FILE_STREAM *file_stream = &unclosed_files->list[i];
+          const char *file_path = file_stream->file_path;
+      /* It is not possible to associate the unclosed stream to a SV.
+         It is possible to obtain a PerlIO from a FILE, as described in
+           https://perldoc.perl.org/perlapio
+         with
+           PerlIO *   PerlIO_importFILE  (FILE *stdio, const char *mode)
+         However, it is not possible to create an IO * SV from the PerlIO
+         or associate to an already existing IO *. An IO * SV is created by
+           IO *  newIO()
+         and it is possible to get the associated PerlIO, with
+           PerlIO *IoOFP(IO *io);
+         but not to set it.
 
-          SV **index_entry_info_sv = av_fetch (index_info_entries_av,
-                                             entry_number -1, 0);
+         However, it is possible to pass a stream through the XS
+         interface.  Therefore here, the unclosed file name is registered,
+         the stream can then be passed to Perl through a call of
+         the XS interface Texinfo::Convert::ConvertXS::get_unclosed_stream.
 
-          if (!index_entry_info_sv)
-            {
-              fprintf (stderr, "%s: %d in %s not found\n", message,
-                       entry_number, index_name);
-            }
-          else
-            index_entry_sv = *index_entry_info_sv;
+         Register that there is an unclosed file from XS by associating
+         with undef; if from Perl, it would be associated with a file handle */
+          SV *file_path_sv = newSVpv_byte (file_path, 0);
+          hv_store_ent (unclosed_files_hv, file_path_sv, newSV (0), 0);
         }
     }
-  return index_entry_sv;
 }
 
-HV *
-build_indices_sort_strings (const INDICES_SORT_STRINGS *indices_sort_strings,
-                            HV *indices_information_hv)
+/* input hv should be an output_files hv, in general setup by
+ $converter->{'output_files'} = 
Texinfo::Convert::Utils::output_files_initialize(); */
+static void
+build_output_files_opened_files (HV *hv,
+                    const OUTPUT_FILES_INFORMATION *output_files_information)
 {
-  HV *indices_sort_strings_hv;
-  size_t i;
+  SV **opened_files_sv;
+  HV *opened_files_hv;
 
-  dTHX;
+  const STRING_LIST *opened_files;
+  int i;
 
-  if (!indices_sort_strings)
-    return 0;
+  dTHX;
 
-  indices_sort_strings_hv = newHV ();
+  opened_files_sv = hv_fetch (hv, "opened_files", strlen ("opened_files"), 0);
 
-  for (i = 0; i < indices_sort_strings->number; i++)
+  if (!opened_files_sv)
     {
-      const INDEX_SORT_STRINGS *index_sort_strings
-         = &indices_sort_strings->indices[i];
-      const char *index_name = index_sort_strings->index->name;
+      opened_files_hv = newHV ();
+      hv_store (hv, "opened_files", strlen ("opened_files"),
+                newRV_noinc ((SV *) opened_files_hv), 0);
+    }
+  else
+    {
+      opened_files_hv = (HV *)SvRV (*opened_files_sv);
+    }
 
-      if (index_sort_strings->entries_number > 0)
+  opened_files = &output_files_information->opened_files;
+  if (opened_files->number > 0)
+    {
+      for (i = 0; i < opened_files->number; i++)
         {
-          size_t j;
-          AV *sort_string_entries_av = newAV ();
-
-          hv_store (indices_sort_strings_hv, index_name, strlen (index_name),
-                    newRV_noinc ((SV *)sort_string_entries_av), 0);
-
-          for (j = 0; j < index_sort_strings->entries_number; j++)
-            {
-              const INDEX_ENTRY_SORT_STRING *index_entry_sort_string
-                = &index_sort_strings->sort_string_entries[j];
-              const INDEX_ENTRY *entry = index_entry_sort_string->entry;
-              const char *entry_index_name = entry->index_name;
-              int entry_number = entry->number;
-              char *message;
-              SV *index_entry_sv;
-              HV *index_entry_sort_string_hv;
-              AV *sort_string_subentries_av;
-              size_t k;
+          const char *file_path = opened_files->list[i];
+          SV *file_path_sv = newSVpv_byte (file_path, 0);
+          hv_store_ent (opened_files_hv, file_path_sv, newSViv (1), 0);
+        }
+    }
+}
 
-              if (index_entry_sort_string->subentries_number <= 0)
-                {
-                  fprintf (stderr, "BUG: build_indices_sort_strings:"
-                   " %s: entry %zu: no subentries", index_name, j);
-                  continue;
-                }
+void
+build_output_files_information (SV *converter_sv,
+                   const OUTPUT_FILES_INFORMATION *output_files_information)
+{
+  HV *hv;
+  SV **output_files_sv;
+  HV *output_files_hv;
 
-              xasprintf (&message, "BUG: build_indices_sort_strings:"
-                                   " %s: entry %zu", index_name, j);
-              index_entry_sv
-                = find_idx_name_entry_number_sv (indices_information_hv,
-                                                 entry_index_name, 
entry_number,
-                                                 message);
-              free (message);
+  dTHX;
 
-              /* probably not possible, unless there is a bug */
-              if (!index_entry_sv)
-                continue;
+  hv = (HV *) SvRV (converter_sv);
 
-              index_entry_sort_string_hv = newHV ();
-              av_push (sort_string_entries_av,
-                       newRV_noinc ((SV *) index_entry_sort_string_hv));
+  output_files_sv = hv_fetch (hv, "output_files",
+                                strlen ("output_files"), 0);
 
-              hv_store (index_entry_sort_string_hv, "index_name",
-                        strlen ("index_name"),
-                        newSVpv_utf8 (entry->index_name, 0), 0);
-              hv_store (index_entry_sort_string_hv, "number",
-                        strlen ("number"), newSViv (entry->number), 0);
+  if (!output_files_sv)
+    {
+      output_files_hv = newHV ();
+      hv_store (hv, "output_files", strlen ("output_files"),
+                newRV_noinc ((SV *) output_files_hv), 0);
+    }
+  else
+    {
+      output_files_hv = (HV *)SvRV (*output_files_sv);
+    }
 
-              SvREFCNT_inc (index_entry_sv);
-              hv_store (index_entry_sort_string_hv, "entry",
-                        strlen ("entry"), index_entry_sv, 0);
+  build_output_files_opened_files (output_files_hv,
+                                   output_files_information);
+  build_output_files_unclosed_files (output_files_hv,
+                                     output_files_information);
+}
 
-              sort_string_subentries_av = newAV ();
-              hv_store (index_entry_sort_string_hv, "sort_strings",
-                        strlen ("sort_strings"),
-                        newRV_noinc ((SV *) sort_string_subentries_av), 0);
+
 
-              for (k = 0; k < index_entry_sort_string->subentries_number; k++)
-                {
-                  const INDEX_SUBENTRY_SORT_STRING *subentry_sort_string
-                    = &index_entry_sort_string->sort_string_subentries[k];
-                  HV *subentry_sort_string_hv = newHV ();
+/* pass generic converter information to Perl */
 
-                  av_push (sort_string_subentries_av,
-                           newRV_noinc ((SV *) subentry_sort_string_hv));
+static HV *
+build_expanded_formats (const EXPANDED_FORMAT *expanded_formats)
+{
+  int i;
+  HV *expanded_hv;
 
-                  hv_store (subentry_sort_string_hv, "sort_string",
-                            strlen ("sort_string"),
-                     newSVpv_utf8 (subentry_sort_string->sort_string, 0), 0);
-                  hv_store (subentry_sort_string_hv, "alpha",
-                            strlen ("alpha"),
-                            newSViv (subentry_sort_string->alpha), 0);
-                }
-            }
+  dTHX;
+
+  expanded_hv = newHV ();
+  for (i = 0; i < expanded_formats_number (); i++)
+    {
+      if (expanded_formats[i].expandedp)
+        {
+          const char *format = expanded_formats[i].format;
+          hv_store (expanded_hv, format, strlen (format),
+                    newSViv (1), 0);
         }
     }
-  return indices_sort_strings_hv;
+  return expanded_hv;
 }
 
-HV *
-build_sorted_indices_by_index (
-                      const INDEX_SORTED_BY_INDEX *index_entries_by_index,
-                      HV *indices_information_hv)
+static HV *
+build_translated_commands (const TRANSLATED_COMMAND *translated_commands)
 {
-  HV *indices_hv;
-  const INDEX_SORTED_BY_INDEX *idx;
+  int i;
+  HV *translated_hv;
 
   dTHX;
 
-  if (!index_entries_by_index)
-    return 0;
+  translated_hv = newHV ();
+  for (i = 0; translated_commands[i].cmd; i++)
+    {
+      enum command_id cmd = translated_commands[i].cmd;
+      const char *translation = translated_commands[i].translation;
+      const char *command_name = builtin_command_name (cmd);
+      hv_store (translated_hv, command_name, strlen (command_name),
+                newSVpv_utf8 (translation, 0), 0);
+    }
+  return translated_hv;
+}
 
-  indices_hv = newHV ();
+void
+pass_generic_converter_to_converter_sv (SV *converter_sv,
+                                        const CONVERTER *converter)
+{
+  HV *converter_hv;
+  HV *expanded_formats_hv;
+  HV *translated_commands_hv;
+  HV *output_files_hv;
+  HV *unclosed_files_hv;
+  HV *opened_files_hv;
 
-  for (idx = index_entries_by_index; idx->name; idx++)
-    {
-      AV *entries_av = newAV ();
-      size_t j;
+  dTHX;
 
-      hv_store (indices_hv, idx->name, strlen (idx->name),
-                newRV_noinc ((SV *)entries_av), 0);
+  converter_hv = (HV *)SvRV (converter_sv);
 
-      for (j = 0; j < idx->entries_number; j++)
-        {
-          const INDEX_ENTRY *entry = idx->entries[j];
-          const char *index_name = entry->index_name;
-          int entry_number = entry->number;
-          char *message;
-          SV *index_entry_sv;
+#define STORE(key, sv) hv_store (converter_hv, key, strlen (key), sv, 0);
+  /* $converter->{'output_files'}
+        = Texinfo::Convert::Utils::output_files_initialize(); */
+  output_files_hv = newHV ();
+  STORE("output_files", newRV_noinc ((SV *) output_files_hv));
 
-          xasprintf (&message, "BUG: build_sorted_indices_by_index:"
-                               " %s: entry %zu", idx->name, j);
-          index_entry_sv
-            = find_idx_name_entry_number_sv (indices_information_hv,
-                                             index_name, entry_number,
-                                             message);
-          free (message);
+  unclosed_files_hv = newHV ();
+  opened_files_hv = newHV ();
+  hv_store (output_files_hv, "unclosed_files", strlen ("unclosed_files"),
+            newRV_noinc ((SV *) unclosed_files_hv), 0);
+  hv_store (output_files_hv, "opened_files_hv",
+            strlen ("opened_files_hv"),
+            newRV_noinc ((SV *) opened_files_hv), 0);
 
-          if (index_entry_sv)
-            {
-              SvREFCNT_inc (index_entry_sv);
-              av_push (entries_av, index_entry_sv);
-            }
-        }
-    }
-  return indices_hv;
+  expanded_formats_hv
+    = build_expanded_formats (converter->expanded_formats);
+  STORE("expanded_formats", newRV_noinc ((SV *) expanded_formats_hv));
+
+  translated_commands_hv
+    = build_translated_commands (converter->translated_commands);
+  STORE("translated_commands", newRV_noinc ((SV *) translated_commands_hv));
+
+  /* store converter_descriptor in perl converter */
+  STORE("converter_descriptor", newSViv ((IV)converter->converter_descriptor));
+
+#undef STORE
 }
 
-HV *
-build_sorted_indices_by_letter (
-                      const INDEX_SORTED_BY_LETTER *index_entries_by_letter,
-                      HV *indices_information_hv)
+
+
+SV *
+build_convert_text_options (TEXT_OPTIONS *text_options)
 {
-  HV *indices_hv;
-  const INDEX_SORTED_BY_LETTER *idx;
+  HV *text_options_hv;
+  HV *expanded_formats_hv;
 
   dTHX;
 
-  if (!index_entries_by_letter)
-    return 0;
-
-  indices_hv = newHV ();
+  text_options_hv = newHV ();
 
-  for (idx = index_entries_by_letter; idx->name; idx++)
-    {
-      AV *sorted_letters_av;
-      size_t i;
+#define STORE(key, sv) hv_store (text_options_hv, key, strlen (key), sv, 0)
 
-      if (idx->letter_number <= 0)
-        continue;
+  if (text_options->ASCII_GLYPH)
+    STORE("ASCII_GLYPH", newSViv (1));
 
-      sorted_letters_av = newAV ();
+  if (text_options->NUMBER_SECTIONS)
+    STORE("NUMBER_SECTIONS", newSViv (1));
 
-      hv_store (indices_hv, idx->name, strlen (idx->name),
-                newRV_noinc ((SV *)sorted_letters_av), 0);
+  if (text_options->TEST)
+    STORE("TEST", newSViv (1));
 
-      for (i = 0; i < idx->letter_number; i++)
-        {
-          size_t j;
-          HV *letter_hv = newHV ();
-          AV *entries_av = newAV ();
-          const LETTER_INDEX_ENTRIES *letter = &idx->letter_entries[i];
+  if (text_options->sort_string)
+    STORE("sort_string", newSViv (1));
 
-          hv_store (letter_hv, "letter", strlen ("letter"),
-                    newSVpv_utf8 (letter->letter, 0), 0);
+  if (text_options->encoding)
+    STORE("enabled_encoding", newSVpv_utf8 (text_options->encoding, 0));
 
-          hv_store (letter_hv, "entries", strlen ("entries"),
-                    newRV_noinc ((SV *)entries_av), 0);
+  if (text_options->set_case)
+    STORE("set_case", newSViv (text_options->set_case));
 
-          av_push (sorted_letters_av, newRV_noinc ((SV *)letter_hv));
+  if (text_options->code_state)
+    STORE("_code_state", newSViv (text_options->code_state));
 
-          for (j = 0; j < letter->entries_number; j++)
-            {
-              const INDEX_ENTRY *entry = letter->entries[j];
-              const char *index_name = entry->index_name;
-              int entry_number = entry->number;
-              char *message;
-              SV *index_entry_sv;
-              xasprintf (&message, "BUG: build_sorted_indices_by_letter:"
-                                   " %s: %s: entry %zu", idx->name,
-                                   letter->letter, j);
-              index_entry_sv
-                = find_idx_name_entry_number_sv (indices_information_hv,
-                                                 index_name, entry_number,
-                                                 message);
-              free (message);
+  expanded_formats_hv = build_expanded_formats 
(text_options->expanded_formats);
+  STORE("expanded_formats", newRV_noinc ((SV *)expanded_formats_hv));
 
-              if (index_entry_sv)
-                {
-                  SvREFCNT_inc (index_entry_sv);
-                  av_push (entries_av, index_entry_sv);
-                }
-            }
-        }
+  if (text_options->include_directories.number > 0)
+    {
+      AV *av = build_string_list (&text_options->include_directories, 
svt_byte);
+      STORE("INCLUDE_DIRECTORIES", newRV_noinc ((SV *) av));
     }
-  return indices_hv;
-}
 
-void
-build_tree_to_build (ELEMENT_LIST *tree_to_build)
-{
-  if (tree_to_build->number > 0)
+  if (text_options->converter && text_options->converter->hv)
     {
-      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;
+      STORE("converter", newRV_inc ((SV *) text_options->converter->hv));
     }
+#undef STORE
+
+  return newRV_noinc ((SV *)text_options_hv);
 }
 
 static const char *latex_math_options[] = {
@@ -3321,7 +3348,8 @@ latex_build_options_for_convert_to_latex_math (CONVERTER 
*converter)
   for (i = 0; latex_math_options[i]; i++)
     {
       const char *option_name = latex_math_options[i];
-      SV *option_sv = get_sv_conf (converter, option_name);
+      SV *option_sv = build_sv_option_from_name (converter->sorted_options,
+                                                 converter, option_name);
       SvREFCNT_inc (option_sv);
       hv_store (options_latex_math_hv, option_name,
                 strlen (option_name), option_sv, 0);
@@ -3329,3 +3357,4 @@ latex_build_options_for_convert_to_latex_math (CONVERTER 
*converter)
 
   return options_latex_math_hv;
 }
+
diff --git a/tp/Texinfo/XS/main/build_perl_info.h 
b/tp/Texinfo/XS/main/build_perl_info.h
index abe418454d..3c2b1b6734 100644
--- a/tp/Texinfo/XS/main/build_perl_info.h
+++ b/tp/Texinfo/XS/main/build_perl_info.h
@@ -23,8 +23,6 @@ char *perl_only_strndup (const char *s, size_t n);
 int init (int texinfo_uninstalled, SV *pkgdatadir_sv, SV *builddir_sv,
           SV *top_srcdir_sv);
 
-SV *build_sv_option (const OPTION *option, CONVERTER *converter);
-
 /* in call_perl_function.c, but declared here to avoid pulling in Perl
    headers in call_perl_function.h */
 /* does not exist as perl macro */
@@ -34,16 +32,22 @@ SV *newSVpv_utf8 (const char *str, STRLEN len);
 SV *newSVpv_byte (const char *str, STRLEN len);
 
 void element_to_perl_hash (ELEMENT *e, int avoid_recursion);
+HV *build_texinfo_tree (ELEMENT *root, int avoid_recursion);
+void build_tree_to_build (ELEMENT_LIST *tree_to_build);
+
+AV *build_string_list (const STRING_LIST *strings_list, enum sv_string_type);
+
+AV *build_errors (const ERROR_MESSAGE* error_list, size_t error_number);
+void pass_document_parser_errors_to_registrar (size_t document_descriptor,
+                                               SV *parser_sv);
+SV *pass_errors_to_registrar (const ERROR_MESSAGE_LIST *error_messages,
+                              SV *object_sv,
+                              SV **errors_warnings_out, SV **error_nrs_out);
 
 SV *build_document (size_t document_descriptor, int no_store);
 SV *get_document (size_t document_descriptor);
-void rebuild_document (SV *document_in, int no_store);
 
-HV *build_texinfo_tree (ELEMENT *root, int avoid_recursion);
-SV *store_texinfo_tree (DOCUMENT *document, HV *document_hv);
-AV *build_errors (const ERROR_MESSAGE* error_list, size_t error_number);
-HV *build_float_list (FLOAT_RECORD *floats_list, size_t floats_number);
-void build_global_info_tree_info (HV *hv, GLOBAL_INFO *global_info_ref);
+SV *store_document_texinfo_tree (DOCUMENT *document, HV *document_hv);
 
 SV *document_indices_information (SV *document_in);
 SV *document_global_commands_information (SV *document_in);
@@ -57,12 +61,6 @@ SV *document_labels_list (SV *document_in);
 
 SV *document_global_information (SV *document_in);
 
-void pass_document_parser_errors_to_registrar (size_t document_descriptor,
-                                               SV *parser_sv);
-SV *pass_errors_to_registrar (const ERROR_MESSAGE_LIST *error_messages,
-                              SV *object_sv,
-                              SV **errors_warnings_out, SV **error_nrs_out);
-
 SV *build_output_units_list (const DOCUMENT *document,
                              size_t output_units_descriptor);
 void rebuild_output_units_list (const DOCUMENT *document, SV *output_units_sv,
@@ -72,9 +70,6 @@ SV *setup_output_units_handler (const DOCUMENT *document,
 void output_units_list_to_perl_hash (const DOCUMENT *document,
                                      size_t output_units_descriptor);
 
-AV *build_integer_stack (const INTEGER_STACK *integer_stack);
-AV *build_string_list (const STRING_LIST *strings_list, enum sv_string_type);
-
 void pass_output_unit_files (SV *converter_sv,
                        const FILE_NAME_PATH_COUNTER_LIST *output_unit_files);
 
@@ -91,18 +86,15 @@ HV *build_sorted_indices_by_index (
                       const INDEX_SORTED_BY_INDEX *index_entries_by_index,
                       HV *indices_information_hv);
 
-SV *html_build_direction_icons (const CONVERTER *converter,
-                            const DIRECTION_ICON_LIST *direction_icons);
-SV *html_build_buttons_specification (CONVERTER *converter,
-                                  BUTTON_SPECIFICATION_LIST *buttons);
-
 void pass_document_to_converter_sv (const CONVERTER *converter,
                                     SV *converter_sv, SV *document_in);
 
-SV *get_sv_conf (CONVERTER *converter, const char *option_name);
-
-HV *build_expanded_formats (const EXPANDED_FORMAT *expanded_formats);
-HV *build_translated_commands (const TRANSLATED_COMMAND *translated_commands);
+SV *html_build_direction_icons (const CONVERTER *converter,
+                            const DIRECTION_ICON_LIST *direction_icons);
+SV *html_build_buttons_specification (CONVERTER *converter,
+                                      BUTTON_SPECIFICATION_LIST *buttons);
+SV * build_sv_option_from_name (OPTION **sorted_options, CONVERTER *converter,
+                                const char *option_name);
 
 void pass_generic_converter_to_converter_sv (SV *converter_sv,
                                              const CONVERTER *converter);
@@ -111,6 +103,4 @@ SV *build_convert_text_options (struct TEXT_OPTIONS 
*text_options);
 
 HV *latex_build_options_for_convert_to_latex_math (CONVERTER *converter);
 
-void build_tree_to_build (ELEMENT_LIST *tree_to_build);
-
 #endif



reply via email to

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