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 (prepare_s


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/XS/convert/convert_html.c (prepare_special_units) (set_root_commands_targets_node_files), tp/Texinfo/XS/main/build_perl_info.c (build_elements_list) (build_document), tp/Texinfo/XS/main/converter_types.h (DOCUMENT), tp/Texinfo/XS/main/document.c (register_document_nodes_list) (register_document_sections_list) (destroy_document_information_except_tree), tp/Texinfo/XS/structuring_transfo/StructuringTransfo.xs (sectioning_structure, nodes_tree), tp/Texinfo/XS/structuring_transfo/ [...]
Date: Sun, 12 Nov 2023 11:30:07 -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 3ebe54bd8b * tp/Texinfo/XS/convert/convert_html.c 
(prepare_special_units) (set_root_commands_targets_node_files), 
tp/Texinfo/XS/main/build_perl_info.c (build_elements_list) (build_document), 
tp/Texinfo/XS/main/converter_types.h (DOCUMENT), tp/Texinfo/XS/main/document.c 
(register_document_nodes_list) (register_document_sections_list) 
(destroy_document_information_except_tree), 
tp/Texinfo/XS/structuring_transfo/StructuringTransfo.xs (sectioning_structure, 
nodes_tree), tp/Texinfo/XS [...]
3ebe54bd8b is described below

commit 3ebe54bd8b91576779ae84ab08eff59e3fc78393
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sun Nov 12 17:30:00 2023 +0100

    * tp/Texinfo/XS/convert/convert_html.c (prepare_special_units)
    (set_root_commands_targets_node_files),
    tp/Texinfo/XS/main/build_perl_info.c (build_elements_list)
    (build_document), tp/Texinfo/XS/main/converter_types.h (DOCUMENT),
    tp/Texinfo/XS/main/document.c (register_document_nodes_list)
    (register_document_sections_list)
    (destroy_document_information_except_tree),
    tp/Texinfo/XS/structuring_transfo/StructuringTransfo.xs
    (sectioning_structure, nodes_tree),
    tp/Texinfo/XS/structuring_transfo/structuring.c (sectioning_structure)
    (nodes_tree, check_nodes_are_referenced, set_menus_node_directions)
    (complete_node_tree_with_menus): use ELEMENT_LIST for nodes_list and
    sections_list.
    
    * tp/Texinfo/XS/structuring_transfo/StructuringTransfo.xs
    (fill_gaps_in_sectioning),
    tp/Texinfo/XS/structuring_transfo/structuring.c
    (get_node_node_childs_from_sectioning, new_complete_node_menu)
    (print_down_menus, new_master_menu),
    tp/Texinfo/XS/structuring_transfo/transformations.c
    (fill_gaps_in_sectioning, insert_nodes_for_sectioning_commands)
    (complete_node_menu, get_non_automatic_nodes_with_sections)
    (complete_tree_nodes_menus, complete_tree_nodes_missing_menu): use
    ELEMENT_LIST for fill_gaps_in_sectioning,
    get_node_node_childs_from_sectioning, print_down_menus and
    get_non_automatic_nodes_with_sections.
    
    * tp/Texinfo/XS/structuring_transfo/transformations.c
    (reassociate_to_node, insert_nodes_for_sectioning_commands): use
    ELEMENT_LIST for new_previous.
---
 ChangeLog                                          |  33 +++++
 tp/Texinfo/XS/convert/convert_html.c               |  11 +-
 tp/Texinfo/XS/main/build_perl_info.c               |  12 +-
 tp/Texinfo/XS/main/converter_types.h               |   4 +-
 tp/Texinfo/XS/main/document.c                      |   9 +-
 tp/Texinfo/XS/main/document.h                      |   5 +-
 tp/Texinfo/XS/main/tree.h                          |   2 +
 .../XS/structuring_transfo/StructuringTransfo.xs   |  12 +-
 tp/Texinfo/XS/structuring_transfo/structuring.c    | 133 ++++++++++-----------
 tp/Texinfo/XS/structuring_transfo/structuring.h    |   6 +-
 .../XS/structuring_transfo/transformations.c       | 119 +++++++++---------
 .../XS/structuring_transfo/transformations.h       |   4 +-
 12 files changed, 194 insertions(+), 156 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 9a832aa374..a91b79d5e9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,36 @@
+2023-11-12  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/XS/convert/convert_html.c (prepare_special_units)
+       (set_root_commands_targets_node_files),
+       tp/Texinfo/XS/main/build_perl_info.c (build_elements_list)
+       (build_document), tp/Texinfo/XS/main/converter_types.h (DOCUMENT),
+       tp/Texinfo/XS/main/document.c (register_document_nodes_list)
+       (register_document_sections_list)
+       (destroy_document_information_except_tree),
+       tp/Texinfo/XS/structuring_transfo/StructuringTransfo.xs
+       (sectioning_structure, nodes_tree),
+       tp/Texinfo/XS/structuring_transfo/structuring.c (sectioning_structure)
+       (nodes_tree, check_nodes_are_referenced, set_menus_node_directions)
+       (complete_node_tree_with_menus): use ELEMENT_LIST for nodes_list and
+       sections_list.
+
+       * tp/Texinfo/XS/structuring_transfo/StructuringTransfo.xs
+       (fill_gaps_in_sectioning),
+       tp/Texinfo/XS/structuring_transfo/structuring.c
+       (get_node_node_childs_from_sectioning, new_complete_node_menu)
+       (print_down_menus, new_master_menu),
+       tp/Texinfo/XS/structuring_transfo/transformations.c
+       (fill_gaps_in_sectioning, insert_nodes_for_sectioning_commands)
+       (complete_node_menu, get_non_automatic_nodes_with_sections)
+       (complete_tree_nodes_menus, complete_tree_nodes_missing_menu): use
+       ELEMENT_LIST for fill_gaps_in_sectioning,
+       get_node_node_childs_from_sectioning, print_down_menus and
+       get_non_automatic_nodes_with_sections.
+
+       * tp/Texinfo/XS/structuring_transfo/transformations.c
+       (reassociate_to_node, insert_nodes_for_sectioning_commands): use
+       ELEMENT_LIST for new_previous.
+
 2023-11-12  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/XS/main/tree.c (new_list, destroy_list),
diff --git a/tp/Texinfo/XS/convert/convert_html.c 
b/tp/Texinfo/XS/convert/convert_html.c
index 3abce38efe..789b2d1188 100644
--- a/tp/Texinfo/XS/convert/convert_html.c
+++ b/tp/Texinfo/XS/convert/convert_html.c
@@ -520,7 +520,7 @@ prepare_special_units (CONVERTER *self, int 
output_units_descriptor,
      = associated_special_units_descriptor;
 
   if (self->document->sections_list
-      && self->document->sections_list->contents.number > 0)
+      && self->document->sections_list->number > 0)
     {
       enum command_id contents_cmds[2] = {CM_shortcontents, CM_contents};
       int i;
@@ -1205,13 +1205,14 @@ set_root_commands_targets_node_files (CONVERTER *self)
         }
     }
 
-  if (self->document->sections_list)
+  if (self->document->sections_list
+      && self->document->sections_list->number >= 0)
     {
-      ELEMENT *sections_list = self->document->sections_list;
+      ELEMENT_LIST *sections_list = self->document->sections_list;
       int i;
-      for (i = 0; i < sections_list->contents.number; i++)
+      for (i = 0; i < sections_list->number; i++)
         {
-          ELEMENT *root_element = sections_list->contents.list[i];
+          ELEMENT *root_element = sections_list->list[i];
           new_sectioning_command_target (self, root_element);
         }
     }
diff --git a/tp/Texinfo/XS/main/build_perl_info.c 
b/tp/Texinfo/XS/main/build_perl_info.c
index 9df83186be..d3e8be3f45 100644
--- a/tp/Texinfo/XS/main/build_perl_info.c
+++ b/tp/Texinfo/XS/main/build_perl_info.c
@@ -701,7 +701,7 @@ build_internal_xref_list (ELEMENT **internal_xref_list,
 }
 
 AV *
-build_elements_contents_list (ELEMENT *element)
+build_elements_list (ELEMENT_LIST *list)
 {
   AV *list_av;
   SV *sv;
@@ -711,11 +711,11 @@ build_elements_contents_list (ELEMENT *element)
 
   list_av = newAV ();
 
-  av_unshift (list_av, element->contents.number);
+  av_unshift (list_av, list->number);
 
-  for (i = 0; i < element->contents.number; i++)
+  for (i = 0; i < list->number; i++)
     {
-      sv = newRV_inc (element->contents.list[i]->hv);
+      sv = newRV_inc (list->list[i]->hv);
       av_store (list_av, i, sv);
     }
 
@@ -1192,10 +1192,10 @@ build_document (size_t document_descriptor, int 
no_store)
                                document->error_messages->number);
 
   if (document->nodes_list)
-    av_nodes_list = build_elements_contents_list (document->nodes_list);
+    av_nodes_list = build_elements_list (document->nodes_list);
 
   if (document->sections_list)
-    av_sections_list = build_elements_contents_list (document->sections_list);
+    av_sections_list = build_elements_list (document->sections_list);
 
 #define STORE(key, value) hv_store (hv, key, strlen (key), newRV_inc ((SV *) 
value), 0)
 
diff --git a/tp/Texinfo/XS/main/converter_types.h 
b/tp/Texinfo/XS/main/converter_types.h
index 587e54a179..3ef2e6ff12 100644
--- a/tp/Texinfo/XS/main/converter_types.h
+++ b/tp/Texinfo/XS/main/converter_types.h
@@ -206,8 +206,8 @@ typedef struct DOCUMENT {
     GLOBAL_INFO *global_info;
     GLOBAL_COMMANDS *global_commands;
     STRING_LIST *small_strings;
-    ELEMENT *nodes_list; /* nodes in contents of this element */
-    ELEMENT *sections_list; /* sections in contents of this element */
+    ELEMENT_LIST *nodes_list;
+    ELEMENT_LIST *sections_list;
     ERROR_MESSAGE_LIST *error_messages;
     OPTIONS *options; /* for options used in structuring */
 } DOCUMENT;
diff --git a/tp/Texinfo/XS/main/document.c b/tp/Texinfo/XS/main/document.c
index ad320371ba..74aca3a651 100644
--- a/tp/Texinfo/XS/main/document.c
+++ b/tp/Texinfo/XS/main/document.c
@@ -110,13 +110,14 @@ register_document (ELEMENT *root, INDEX **index_names,
 }
 
 void
-register_document_nodes_list (DOCUMENT *document, ELEMENT *nodes_list)
+register_document_nodes_list (DOCUMENT *document, ELEMENT_LIST *nodes_list)
 {
   document->nodes_list = nodes_list;
 }
 
 void
-register_document_sections_list (DOCUMENT *document, ELEMENT *sections_list)
+register_document_sections_list (DOCUMENT *document,
+                                 ELEMENT_LIST *sections_list)
 {
   document->sections_list = sections_list;
 }
@@ -149,9 +150,9 @@ destroy_document_information_except_tree (DOCUMENT 
*document)
       wipe_error_message_list (document->error_messages);
       free (document->error_messages);
       if (document->nodes_list)
-        destroy_element (document->nodes_list);
+        destroy_list (document->nodes_list);
       if (document->sections_list)
-        destroy_element (document->sections_list);
+        destroy_list (document->sections_list);
       if (document->options)
         {
           free_options (document->options);
diff --git a/tp/Texinfo/XS/main/document.h b/tp/Texinfo/XS/main/document.h
index 50813cb9e5..6c758e5c62 100644
--- a/tp/Texinfo/XS/main/document.h
+++ b/tp/Texinfo/XS/main/document.h
@@ -26,9 +26,10 @@ size_t register_document (ELEMENT *root, INDEX **index_names,
                           GLOBAL_COMMANDS *global_commands,
                           STRING_LIST *small_strings,
                           ERROR_MESSAGE_LIST *error_messages);
-void register_document_nodes_list (DOCUMENT *document, ELEMENT *nodes_list);
+void register_document_nodes_list (DOCUMENT *document,
+                                   ELEMENT_LIST *nodes_list);
 void register_document_sections_list (DOCUMENT *document,
-                                      ELEMENT *sections_list);
+                                      ELEMENT_LIST *sections_list);
 void register_document_options (DOCUMENT *document, OPTIONS *options);
 void remove_document_descriptor (int document_descriptor);
 TREE_AND_STRINGS *unregister_document_descriptor_tree (int 
document_descriptor);
diff --git a/tp/Texinfo/XS/main/tree.h b/tp/Texinfo/XS/main/tree.h
index ea4f6710a3..0c3a93edec 100644
--- a/tp/Texinfo/XS/main/tree.h
+++ b/tp/Texinfo/XS/main/tree.h
@@ -17,6 +17,8 @@ void insert_into_element_list (ELEMENT_LIST *list, ELEMENT 
*e, int where);
 void insert_into_contents (ELEMENT *parent, ELEMENT *e, int where);
 void insert_into_args (ELEMENT *parent, ELEMENT *e, int where);
 ELEMENT *remove_element_from_list (ELEMENT_LIST *list, ELEMENT *e);
+void insert_list_slice_into_list (ELEMENT_LIST *to, int where,
+                                  ELEMENT_LIST *from, int start, int end);
 void insert_slice_into_contents (ELEMENT *to, int idx, ELEMENT *from,
                                  int start, int end);
 void insert_list_slice_into_contents (ELEMENT *to, int idx, ELEMENT_LIST *from,
diff --git a/tp/Texinfo/XS/structuring_transfo/StructuringTransfo.xs 
b/tp/Texinfo/XS/structuring_transfo/StructuringTransfo.xs
index 79431c64e2..538e277fd1 100644
--- a/tp/Texinfo/XS/structuring_transfo/StructuringTransfo.xs
+++ b/tp/Texinfo/XS/structuring_transfo/StructuringTransfo.xs
@@ -176,7 +176,7 @@ set_document_options (SV *sv_options_in, SV *document_in)
 void
 fill_gaps_in_sectioning (SV *tree_in)
     PREINIT:
-        ELEMENT *added_sections;
+        ELEMENT_LIST *added_sections;
         DOCUMENT *document;
      CODE:
         document = get_sv_tree_document (tree_in, "fill_gaps_in_sectioning");
@@ -185,7 +185,7 @@ fill_gaps_in_sectioning (SV *tree_in)
             added_sections = fill_gaps_in_sectioning (document->tree);
             /* cannot easily be used as it does not match with perl tree.
                Also the return would not be usable as error status */
-            destroy_element (added_sections);
+            destroy_list (added_sections);
           }
 
 SV *
@@ -279,7 +279,7 @@ sectioning_structure (SV *tree_in, ...)
         document = get_sv_tree_document (tree_in, 0);
         if (document)
           {
-            ELEMENT *sections_list = sectioning_structure (document);
+            ELEMENT_LIST *sections_list = sectioning_structure (document);
             register_document_sections_list (document, sections_list);
           }
 
@@ -396,9 +396,9 @@ insert_nodes_for_sectioning_commands (SV *document_in, ...)
                                "insert_nodes_for_sectioning_commands");
         if (document)
           {
-            ELEMENT *added_nodes
+            ELEMENT_LIST *added_nodes
               = insert_nodes_for_sectioning_commands (document);
-            destroy_element (added_nodes);
+            destroy_list (added_nodes);
           }
 
 # The perl function returns a list of nodes, but it is only used
@@ -413,7 +413,7 @@ nodes_tree (SV *document_in, ...)
         document = get_sv_document_document (document_in, "nodes_tree");
         if (document)
           {
-            ELEMENT *nodes_list = nodes_tree (document);
+            ELEMENT_LIST *nodes_list = nodes_tree (document);
             register_document_nodes_list (document, nodes_list);
           }
 
diff --git a/tp/Texinfo/XS/structuring_transfo/structuring.c 
b/tp/Texinfo/XS/structuring_transfo/structuring.c
index c39e68eeda..a718b2d231 100644
--- a/tp/Texinfo/XS/structuring_transfo/structuring.c
+++ b/tp/Texinfo/XS/structuring_transfo/structuring.c
@@ -75,7 +75,7 @@ new_block_command (ELEMENT *element, enum command_id cmd)
   add_to_element_contents (element, end);
 }
 
-ELEMENT *
+ELEMENT_LIST *
 sectioning_structure (DOCUMENT *document)
 {
   ELEMENT *root = document->tree;
@@ -87,7 +87,7 @@ sectioning_structure (DOCUMENT *document)
   int in_appendix = 0;
   /* lowest level with a number.  This is the lowest level above 0. */
   int number_top_level = 0;
-  ELEMENT *sections_list = new_element (ET_NONE);;
+  ELEMENT_LIST *sections_list = new_list ();
   ELEMENT *section_top = 0;
   int i;
 
@@ -106,7 +106,7 @@ sectioning_structure (DOCUMENT *document)
           || content->cmd == CM_bye)
         continue;
 
-      add_to_contents_as_array (sections_list, content);
+      add_to_element_list (sections_list, content);
 
       if (content->cmd == CM_top && !section_top)
         section_top = content;
@@ -382,9 +382,9 @@ sectioning_structure (DOCUMENT *document)
         }
     }
 
-  if (sections_list->contents.number == 0)
+  if (sections_list->number == 0)
     {
-      destroy_element (sections_list);
+      destroy_list (sections_list);
       return 0;
     }
   return sections_list;
@@ -446,10 +446,10 @@ check_menu_entry (DOCUMENT *document, enum command_id cmd,
     }
 }
 
-ELEMENT *
+ELEMENT_LIST *
 get_node_node_childs_from_sectioning (ELEMENT *node)
 {
-  ELEMENT *node_childs = new_element (ET_NONE);
+  ELEMENT_LIST *node_childs = new_list ();
 
   ELEMENT *associated_section = lookup_extra_element (node, 
"associated_section");
   if (associated_section)
@@ -465,7 +465,7 @@ get_node_node_childs_from_sectioning (ELEMENT *node)
               ELEMENT *associated_node = lookup_extra_element (child,
                                                              
"associated_node");
               if (associated_node)
-                add_to_contents_as_array (node_childs, associated_node);
+                add_to_element_list (node_childs, associated_node);
             }
         }
        /* Special case for @top.  Gather all the children of the @part 
following
@@ -495,8 +495,8 @@ get_node_node_childs_from_sectioning (ELEMENT *node)
                                    = lookup_extra_element (child,
                                                            "associated_node");
                               if (associated_node)
-                                add_to_contents_as_array (node_childs,
-                                                          associated_node);
+                                add_to_element_list (node_childs,
+                                                     associated_node);
                             }
                         }
                     }
@@ -509,7 +509,7 @@ get_node_node_childs_from_sectioning (ELEMENT *node)
                     not below @top
                        */
                       if (associated_node)
-                        add_to_contents_as_array (node_childs, 
associated_node);
+                        add_to_element_list (node_childs, associated_node);
                     }
                 }
               else
@@ -562,7 +562,7 @@ compare_strings (const void *a, const void *b)
 void
 check_nodes_are_referenced (DOCUMENT *document)
 {
-  ELEMENT *nodes_list = document->nodes_list;
+  ELEMENT_LIST *nodes_list = document->nodes_list;
   LABEL_LIST *identifiers_target = document->identifiers_target;
   ELEMENT_LIST *refs = document->internal_references;
   ERROR_MESSAGE_LIST *error_messages = document->error_messages;
@@ -576,10 +576,10 @@ check_nodes_are_referenced (DOCUMENT *document)
 
   ELEMENT *top_node;
 
-  if (!nodes_list || nodes_list->contents.number <= 0)
+  if (!nodes_list || nodes_list->number <= 0)
     return;
 
-  referenced_identifier_space = nodes_list->contents.number * 2;
+  referenced_identifier_space = nodes_list->number * 2;
   referenced_identifiers
     = malloc (referenced_identifier_space * sizeof (char *));
 
@@ -587,7 +587,7 @@ check_nodes_are_referenced (DOCUMENT *document)
                                      "Top");
   if (!top_node)
     {
-      top_node = nodes_list->contents.list[0];
+      top_node = nodes_list->list[0];
       char *normalized = lookup_extra_string (top_node, "normalized");
       if (normalized)
         referenced_identifiers[0] = normalized;
@@ -597,10 +597,10 @@ check_nodes_are_referenced (DOCUMENT *document)
   else
     referenced_identifiers[0] = "Top";
 
-  for (i = 0; i < nodes_list->contents.number; i++)
+  for (i = 0; i < nodes_list->number; i++)
     {
       int status;
-      ELEMENT *node = nodes_list->contents.list[i];
+      ELEMENT *node = nodes_list->list[i];
       int is_target = lookup_extra_integer (node, "is_target", &status);
       ELEMENT *node_directions = lookup_extra_element (node,
                                                     "node_directions");
@@ -657,19 +657,19 @@ check_nodes_are_referenced (DOCUMENT *document)
           int automatic_directions = (node->args.number <= 1);
           if (automatic_directions)
             {
-              ELEMENT *node_childs
+              ELEMENT_LIST *node_childs
                 = get_node_node_childs_from_sectioning (node);
               int j;
-              for (j = 0; j < node_childs->contents.number; j++)
+              for (j = 0; j < node_childs->number; j++)
                 {
                   referenced_identifiers =
-                   register_referenced_node (node_childs->contents.list[j],
+                   register_referenced_node (node_childs->list[j],
                                              referenced_identifiers,
                                              &referenced_identifier_space,
                                              &referenced_identifier_number);
 
                 }
-              destroy_element (node_childs);
+              destroy_list (node_childs);
             }
         }
     }
@@ -756,10 +756,10 @@ check_nodes_are_referenced (DOCUMENT *document)
      }
    */
 
-  for (i = 0; i < nodes_list->contents.number; i++)
+  for (i = 0; i < nodes_list->number; i++)
     {
       int status;
-      ELEMENT *node = nodes_list->contents.list[i];
+      ELEMENT *node = nodes_list->list[i];
       int is_target = lookup_extra_integer (node, "is_target", &status);
 
       if (is_target)
@@ -793,7 +793,7 @@ void
 set_menus_node_directions (DOCUMENT *document)
 {
   GLOBAL_COMMANDS *global_commands = document->global_commands;
-  ELEMENT *nodes_list = document->nodes_list;
+  ELEMENT_LIST *nodes_list = document->nodes_list;
   LABEL_LIST *identifiers_target = document->identifiers_target;
   ERROR_MESSAGE_LIST *error_messages = document->error_messages;
   OPTIONS *options = document->options;
@@ -801,7 +801,7 @@ set_menus_node_directions (DOCUMENT *document)
   int check_menu_entries = 1;
   int i;
 
-  if (!nodes_list || nodes_list->contents.number <= 0)
+  if (!nodes_list || nodes_list->number <= 0)
     return;
 
   if (options && (options->novalidate > 0
@@ -817,10 +817,10 @@ set_menus_node_directions (DOCUMENT *document)
   differently; at least, there are no error messages for them.
    */
 
-  for (i = 0; i < nodes_list->contents.number; i++)
+  for (i = 0; i < nodes_list->number; i++)
     {
       int j;
-      ELEMENT *node = nodes_list->contents.list[i];
+      ELEMENT *node = nodes_list->list[i];
       ELEMENT *menus = lookup_extra_element (node, "menus");
 
       if (!menus)
@@ -987,21 +987,21 @@ section_direction_associated_node (ELEMENT *section, enum 
directions direction)
 void
 complete_node_tree_with_menus (DOCUMENT *document)
 {
-  ELEMENT *nodes_list = document->nodes_list;
+  ELEMENT_LIST *nodes_list = document->nodes_list;
   LABEL_LIST *identifiers_target = document->identifiers_target;
   ERROR_MESSAGE_LIST *error_messages = document->error_messages;
   OPTIONS *options = document->options;
 
   int i;
 
-  if (!nodes_list || nodes_list->contents.number <= 0)
+  if (!nodes_list || nodes_list->number <= 0)
     return;
 
   /* Go through all the nodes */
 
-  for (i = 0; i < nodes_list->contents.number; i++)
+  for (i = 0; i < nodes_list->number; i++)
     {
-      ELEMENT *node = nodes_list->contents.list[i];
+      ELEMENT *node = nodes_list->list[i];
       char *normalized = lookup_extra_string (node, "normalized");
       ELEMENT *menu_directions = lookup_extra_element (node,
                                                       "menu_directions");
@@ -1150,10 +1150,10 @@ complete_node_tree_with_menus (DOCUMENT *document)
                 {
                   /* use the first non top node as next for Top */
                   int j;
-                  for (j = 0; j < nodes_list->contents.number; j++)
+                  for (j = 0; j < nodes_list->number; j++)
                     {
                       ELEMENT *first_non_top_node
-                        = nodes_list->contents.list[j];
+                        = nodes_list->list[j];
                       if (first_non_top_node != node)
                         {
                           node_directions = lookup_extra_directions (node,
@@ -1283,7 +1283,7 @@ complete_node_tree_with_menus (DOCUMENT *document)
 }
 
 /* set node directions based on sectioning and @node explicit directions */
-ELEMENT *
+ELEMENT_LIST *
 nodes_tree (DOCUMENT *document)
 {
   LABEL_LIST *identifiers_target = document->identifiers_target;
@@ -1292,7 +1292,7 @@ nodes_tree (DOCUMENT *document)
   OPTIONS *options = document->options;
 
   ELEMENT *top_node = 0;
-  ELEMENT *nodes_list = new_element (ET_NONE);
+  ELEMENT_LIST *nodes_list = new_list ();
 
   int i;
 
@@ -1311,7 +1311,7 @@ nodes_tree (DOCUMENT *document)
       if (!normalized)
         continue;
 
-      add_to_contents_as_array (nodes_list, node);
+      add_to_element_list (nodes_list, node);
       is_target = lookup_extra_integer (node, "is_target", &status);
       if (is_target && !strcmp (normalized, "Top"))
         top_node = node;
@@ -1767,14 +1767,14 @@ new_node_menu_entry (ELEMENT *node, int use_sections)
 ELEMENT *
 new_complete_node_menu (ELEMENT *node, int use_sections)
 {
-  ELEMENT *node_childs = get_node_node_childs_from_sectioning (node);
+  ELEMENT_LIST *node_childs = get_node_node_childs_from_sectioning (node);
   ELEMENT *section;
   ELEMENT *new_menu;
   int i;
 
-  if (node_childs->contents.number <= 0)
+  if (node_childs->number <= 0)
     {
-      destroy_element (node_childs);
+      destroy_list (node_childs);
       return 0;
     }
 
@@ -1785,30 +1785,30 @@ new_complete_node_menu (ELEMENT *node, int use_sections)
   new_menu = new_element (ET_NONE);
   new_menu->parent = section;
 
-  for (i = 0; i < node_childs->contents.number; i++)
+  for (i = 0; i < node_childs->number; i++)
     {
-      ELEMENT *child = node_childs->contents.list[i];
+      ELEMENT *child = node_childs->list[i];
       ELEMENT *entry = new_node_menu_entry (child, use_sections);
       if (entry)
         {
           add_to_element_contents (new_menu, entry);
         }
     }
-  destroy_element (node_childs);
+  destroy_list (node_childs);
 
   new_block_command (new_menu, CM_menu);
 
   return (new_menu);
 }
 
-ELEMENT *
+ELEMENT_LIST *
 print_down_menus(ELEMENT *node, LABEL_LIST *identifiers_target,
                  int use_sections)
 {
-  ELEMENT *master_menu_contents = new_element (ET_NONE);
+  ELEMENT_LIST *master_menu_contents = new_list ();
   ELEMENT *menus;
   ELEMENT *node_menus = lookup_extra_element (node, "menus");
-  ELEMENT *node_children;
+  ELEMENT_LIST *node_children;
   int i;
 
   if (node_menus && node_menus->contents.number > 0)
@@ -1826,7 +1826,7 @@ print_down_menus(ELEMENT *node, LABEL_LIST 
*identifiers_target,
         return master_menu_contents;
     }
 
-  node_children = new_element (ET_NONE);
+  node_children = new_list ();
 
   for (i = 0; i < menus->contents.number; i++)
     {
@@ -1839,17 +1839,17 @@ print_down_menus(ELEMENT *node, LABEL_LIST 
*identifiers_target,
             {
               ELEMENT *entry_copy = copy_tree (entry);
               ELEMENT *node;
-              add_to_contents_as_array (master_menu_contents, entry_copy);
+              add_to_element_list (master_menu_contents, entry_copy);
               /* gather node children to recursively print their menus */
               node = normalized_entry_associated_internal_node (entry,
                                                         identifiers_target);
               if (node)
-                add_to_contents_as_array (node_children, node);
+                add_to_element_list (node_children, node);
             }
         }
     }
 
-  if (master_menu_contents->contents.number > 0)
+  if (master_menu_contents->number > 0)
     {
       ELEMENT *node_name_element;
       ELEMENT *node_title_copy;
@@ -1883,24 +1883,23 @@ print_down_menus(ELEMENT *node, LABEL_LIST 
*identifiers_target,
       add_to_element_contents (preformatted, empty_line_first_after);
       add_to_element_contents (preformatted, empty_line_second_after);
 
-      insert_into_contents (master_menu_contents, menu_comment, 0);
-      menu_comment->parent = 0;
+      insert_into_element_list (master_menu_contents, menu_comment, 0);
 
       /* now recurse in the children */
-      for (i = 0; i < node_children->contents.number; i++)
+      for (i = 0; i < node_children->number; i++)
         {
-          ELEMENT *child = node_children->contents.list[i];
-          ELEMENT *child_menu_content
+          ELEMENT *child = node_children->list[i];
+          ELEMENT_LIST *child_menu_content
            = print_down_menus (child, identifiers_target, use_sections);
-          insert_slice_into_contents (master_menu_contents,
-                                      master_menu_contents->contents.number,
-                                      child_menu_content, 0,
-                                      child_menu_content->contents.number);
-          destroy_element (child_menu_content);
+          insert_list_slice_into_list (master_menu_contents,
+                                       master_menu_contents->number,
+                                       child_menu_content, 0,
+                                       child_menu_content->number);
+          destroy_list (child_menu_content);
         }
     }
 
-  destroy_element (node_children);
+  destroy_list (node_children);
 
   if (!node_menus)
     destroy_element (menus);
@@ -1933,18 +1932,18 @@ new_master_menu (OPTIONS *options, LABEL_LIST 
*identifiers_target,
                                                   identifiers_target);
                   if (menu_node)
                     {
-                      ELEMENT *down_menus = print_down_menus(menu_node,
-                                       identifiers_target, use_sections);
+                      ELEMENT_LIST *down_menus = print_down_menus(menu_node,
+                                          identifiers_target, use_sections);
                       if (down_menus)
                         {
                           int k;
-                          for (k = 0; k < down_menus->contents.number; k++)
-                            down_menus->contents.list[k]->parent = master_menu;
-                          insert_slice_into_contents (master_menu,
+                          for (k = 0; k < down_menus->number; k++)
+                            down_menus->list[k]->parent = master_menu;
+                          insert_list_slice_into_contents (master_menu,
                                                  master_menu->contents.number,
                                                  down_menus, 0,
-                                                 down_menus->contents.number);
-                          destroy_element (down_menus);
+                                                 down_menus->number);
+                          destroy_list (down_menus);
                         }
                     }
                 }
diff --git a/tp/Texinfo/XS/structuring_transfo/structuring.h 
b/tp/Texinfo/XS/structuring_transfo/structuring.h
index df618d0625..c329de92dc 100644
--- a/tp/Texinfo/XS/structuring_transfo/structuring.h
+++ b/tp/Texinfo/XS/structuring_transfo/structuring.h
@@ -7,9 +7,9 @@
 #include "converter_types.h"
 
 void associate_internal_references (DOCUMENT *document);
-ELEMENT *sectioning_structure (DOCUMENT *document);
-ELEMENT *nodes_tree (DOCUMENT *document);
-ELEMENT *get_node_node_childs_from_sectioning (ELEMENT *node);
+ELEMENT_LIST *sectioning_structure (DOCUMENT *document);
+ELEMENT_LIST *nodes_tree (DOCUMENT *document);
+ELEMENT_LIST *get_node_node_childs_from_sectioning (ELEMENT *node);
 char *normalized_menu_entry_internal_node (ELEMENT *entry);
 void warn_non_empty_parts (DOCUMENT *document);
 void set_menus_node_directions (DOCUMENT *document);
diff --git a/tp/Texinfo/XS/structuring_transfo/transformations.c 
b/tp/Texinfo/XS/structuring_transfo/transformations.c
index 6829fb31f7..70d7764af5 100644
--- a/tp/Texinfo/XS/structuring_transfo/transformations.c
+++ b/tp/Texinfo/XS/structuring_transfo/transformations.c
@@ -280,10 +280,10 @@ correct_level (ELEMENT *section, ELEMENT *parent, int 
modifier)
     }
 }
 
-ELEMENT *
+ELEMENT_LIST *
 fill_gaps_in_sectioning (ELEMENT *root)
 {
-  ELEMENT *added_sections = new_element (ET_NONE);
+  ELEMENT_LIST *added_sections = new_list ();
   int idx_current_section = -1;
   int idx_next_section = -1;
   size_t idx = 0;
@@ -320,7 +320,7 @@ fill_gaps_in_sectioning (ELEMENT *root)
 
       if (next_section_level - current_section_level > 1)
         {
-          ELEMENT *new_sections = new_element (ET_NONE);
+          ELEMENT_LIST *new_sections = new_list ();
           correct_level (next_section, current_section, 1);
           while (next_section_level - current_section_level > 1)
             {
@@ -353,19 +353,19 @@ fill_gaps_in_sectioning (ELEMENT *root)
               text_append (&empty_line->text, "\n");
               add_to_element_contents (new_section, empty_line);
 
-              add_to_contents_as_array (new_sections, new_section);
+              add_to_element_list (new_sections, new_section);
             }
-          insert_slice_into_contents (root, idx_current_section+1,
+          insert_list_slice_into_contents (root, idx_current_section+1,
+                                          new_sections, 0,
+                                          new_sections->number);
+          idx_next_section += new_sections->number;
+          insert_list_slice_into_list (added_sections,
+                                      added_sections->number,
                                       new_sections, 0,
-                                      new_sections->contents.number);
-          idx_next_section += new_sections->contents.number;
-          insert_slice_into_contents (added_sections,
-                                      added_sections->contents.number,
-                                      new_sections, 0,
-                                      new_sections->contents.number);
-          correct_level (next_section, last_contents_child (new_sections),
-                         -1);
-          destroy_element (new_sections);
+                                      new_sections->number);
+          correct_level (next_section,
+                         new_sections->list[new_sections->number -1], -1);
+          destroy_list (new_sections);
         }
       idx_current_section = idx_next_section;
 
@@ -738,9 +738,9 @@ new_node (ELEMENT *node_tree, DOCUMENT *document)
 ELEMENT_LIST *
 reassociate_to_node (const char *type, ELEMENT *current, void *argument)
 {
-  ELEMENT *new_previous = (ELEMENT *) argument;
-  ELEMENT *added_node = new_previous->contents.list[0];
-  ELEMENT *previous_node = new_previous->contents.list[1];
+  ELEMENT_LIST *new_previous = (ELEMENT_LIST *) argument;
+  ELEMENT *added_node = new_previous->list[0];
+  ELEMENT *previous_node = new_previous->list[1];
 
   if (current->cmd == CM_menu)
     {
@@ -808,11 +808,11 @@ reassociate_to_node (const char *type, ELEMENT *current, 
void *argument)
 
 /* in perl registrar and configuration, but they are not useful,
    see comment before new_node */
-ELEMENT *
+ELEMENT_LIST *
 insert_nodes_for_sectioning_commands (DOCUMENT *document)
 {
   ELEMENT *root = document->tree;
-  ELEMENT *added_nodes = new_element (ET_NONE);
+  ELEMENT_LIST *added_nodes = new_list ();
   int idx;
   ELEMENT *previous_node = 0;
 
@@ -845,20 +845,20 @@ insert_nodes_for_sectioning_commands (DOCUMENT *document)
               destroy_element (new_node_tree);
               if (added_node)
                 {
-                  ELEMENT *new_previous = new_element (ET_NONE);
+                  ELEMENT_LIST *new_previous = new_list ();
                   insert_into_contents (root, added_node, idx);
                   idx++;
-                  add_to_contents_as_array (added_nodes, added_node);
+                  add_to_element_list (added_nodes, added_node);
                   add_extra_element (added_node, "associated_section",
                                      content);
                   add_extra_element (content, "associated_node", added_node);
                   added_node->parent = content->parent;
                   /* reassociate index entries and menus */
-                  add_to_contents_as_array (new_previous, added_node);
-                  add_to_contents_as_array (new_previous, previous_node);
+                  add_to_element_list (new_previous, added_node);
+                  add_to_element_list (new_previous, previous_node);
                   modify_tree (content, &reassociate_to_node,
                                (void *)new_previous);
-                  destroy_element (new_previous);
+                  destroy_list (new_previous);
                 }
             }
         }
@@ -969,15 +969,15 @@ typedef struct EXISTING_ENTRY {
 void
 complete_node_menu (ELEMENT *node, int use_sections)
 {
-  ELEMENT *node_childs = get_node_node_childs_from_sectioning (node);
+  ELEMENT_LIST *node_childs = get_node_node_childs_from_sectioning (node);
 
-  if (node_childs->contents.number)
+  if (node_childs->number)
     {
       int existing_entries_nr = 0;
       int existing_entries_space = 5;
       EXISTING_ENTRY *existing_entries = 0;
 
-      ELEMENT *pending = new_element (ET_NONE);
+      ELEMENT_LIST *pending = new_list ();
       ELEMENT *current_menu = 0;
 
       int i;
@@ -1018,9 +1018,9 @@ complete_node_menu (ELEMENT *node, int use_sections)
             }
         }
 
-      for (i = 0; i < node_childs->contents.number; i++)
+      for (i = 0; i < node_childs->number; i++)
         {
-          ELEMENT *node_entry = node_childs->contents.list[i];
+          ELEMENT *node_entry = node_childs->list[i];
           KEY_PAIR *k_normalized = lookup_extra (node_entry, "normalized");
           if (k_normalized && k_normalized->value)
             {
@@ -1039,19 +1039,19 @@ complete_node_menu (ELEMENT *node, int use_sections)
                 }
               if (entry)
                 {
-                  if (pending->contents.number)
+                  if (pending->number)
                     {
                       int k;
                       for (j = 0; j < current_menu->contents.number; j++)
                       if (current_menu->contents.list[j] == entry)
                         break;
-                      insert_slice_into_contents (current_menu, j,
-                                                  pending, 0,
-                                                  pending->contents.number);
-                      for (k = 0; k < pending->contents.number; k++)
-                        pending->contents.list[k]->parent = current_menu;
+                      insert_list_slice_into_contents (current_menu, j,
+                                                       pending, 0,
+                                                       pending->number);
+                      for (k = 0; k < pending->number; k++)
+                        pending->list[k]->parent = current_menu;
 
-                      pending->contents.number = 0;
+                      pending->number = 0;
                     }
                 }
               else
@@ -1062,19 +1062,22 @@ complete_node_menu (ELEMENT *node, int use_sections)
               we try, in general, to be silent in the transformations.
               */
                   if (entry)
-                    add_to_contents_as_array (pending, entry);
+                    add_to_element_list (pending, entry);
                 }
             }
         }
 
-      if (pending->contents.number)
+      if (pending->number)
         {
           int j;
           if (!current_menu)
             {
               ELEMENT *section = lookup_extra_element (node,
                                                        "associated_section");
-              current_menu = pending;
+              current_menu = new_element (ET_NONE);
+              insert_list_slice_into_contents (current_menu, 0,
+                                               pending, 0,
+                                               pending->number);
               current_menu->parent = section;
               new_block_command (current_menu, CM_menu);
               prepend_new_menu_in_node_section (node, section,
@@ -1087,28 +1090,26 @@ complete_node_menu (ELEMENT *node, int use_sections)
 
               if (last_menu_content->cmd != CM_end)
                 offset_at_end = 0;
-              insert_slice_into_contents (current_menu,
+              insert_list_slice_into_contents (current_menu,
                                 current_menu->contents.number + offset_at_end,
-                                        pending, 0, pending->contents.number);
+                                        pending, 0, pending->number);
             }
-          for (j = 0; j < pending->contents.number; j++)
-            pending->contents.list[j]->parent = current_menu;
+          for (j = 0; j < pending->number; j++)
+            pending->list[j]->parent = current_menu;
 
-          if (current_menu != pending)
-            destroy_element (pending);
         }
-      else
-        destroy_element (pending);
+
+      destroy_list (pending);
 
       free (existing_entries);
     }
-  destroy_element (node_childs);
+  destroy_list (node_childs);
 }
 
-static ELEMENT *
+static ELEMENT_LIST *
 get_non_automatic_nodes_with_sections (ELEMENT *root)
 {
-  ELEMENT *non_automatic_nodes = new_element (ET_NONE);
+  ELEMENT_LIST *non_automatic_nodes = new_list ();
   int i;
 
   for (i = 0; i < root->contents.number; i++)
@@ -1120,7 +1121,7 @@ get_non_automatic_nodes_with_sections (ELEMENT *root)
           ELEMENT *associated_section
             = lookup_extra_element (content, "associated_section");
           if (associated_section)
-            add_to_contents_as_array (non_automatic_nodes, content);
+            add_to_element_list (non_automatic_nodes, content);
         }
     }
   return non_automatic_nodes;
@@ -1130,26 +1131,26 @@ get_non_automatic_nodes_with_sections (ELEMENT *root)
 void
 complete_tree_nodes_menus (ELEMENT *root, int use_sections)
 {
-  ELEMENT *non_automatic_nodes
+  ELEMENT_LIST *non_automatic_nodes
      = get_non_automatic_nodes_with_sections (root);
   int i;
-  for (i = 0; i < non_automatic_nodes->contents.number; i++)
+  for (i = 0; i < non_automatic_nodes->number; i++)
     {
-      ELEMENT *node = non_automatic_nodes->contents.list[i];
+      ELEMENT *node = non_automatic_nodes->list[i];
       complete_node_menu (node, use_sections);
     }
-  destroy_element (non_automatic_nodes);
+  destroy_list (non_automatic_nodes);
 }
 
 void
 complete_tree_nodes_missing_menu (ELEMENT *root, int use_sections)
 {
-  ELEMENT *non_automatic_nodes
+  ELEMENT_LIST *non_automatic_nodes
      = get_non_automatic_nodes_with_sections (root);
   int i;
-  for (i = 0; i < non_automatic_nodes->contents.number; i++)
+  for (i = 0; i < non_automatic_nodes->number; i++)
     {
-      ELEMENT *node = non_automatic_nodes->contents.list[i];
+      ELEMENT *node = non_automatic_nodes->list[i];
       ELEMENT *menus = lookup_extra_element (node, "menus");
       if (!(menus && menus->contents.number > 0))
         {
@@ -1159,7 +1160,7 @@ complete_tree_nodes_missing_menu (ELEMENT *root, int 
use_sections)
             prepend_new_menu_in_node_section (node, section, current_menu);
         }
     }
-  destroy_element (non_automatic_nodes);
+  destroy_list (non_automatic_nodes);
 }
 
 /* NOTE in perl there is a customization_information argument:
diff --git a/tp/Texinfo/XS/structuring_transfo/transformations.h 
b/tp/Texinfo/XS/structuring_transfo/transformations.h
index bf2bff58ea..e2424f79ae 100644
--- a/tp/Texinfo/XS/structuring_transfo/transformations.h
+++ b/tp/Texinfo/XS/structuring_transfo/transformations.h
@@ -5,7 +5,7 @@
 #include "tree_types.h"
 #include "converter_types.h"
 
-ELEMENT *fill_gaps_in_sectioning (ELEMENT *root);
+ELEMENT_LIST *fill_gaps_in_sectioning (ELEMENT *root);
 void relate_index_entries_to_table_items_in_tree (ELEMENT *tree,
                                     INDEX **indices_information);
 void move_index_entries_after_items_in_tree (ELEMENT *tree);
@@ -16,7 +16,7 @@ ELEMENT *protect_node_after_label_in_tree (ELEMENT *tree);
 void complete_tree_nodes_menus (ELEMENT *root, int use_sections);
 void complete_tree_nodes_missing_menu (ELEMENT *root, int use_sections);
 int regenerate_master_menu (DOCUMENT *document, int use_sections);
-ELEMENT *insert_nodes_for_sectioning_commands (DOCUMENT *document);
+ELEMENT_LIST *insert_nodes_for_sectioning_commands (DOCUMENT *document);
 ELEMENT *protect_hashchar_at_line_beginning (DOCUMENT *document);
 void protect_first_parenthesis_in_targets (ELEMENT *tree);
 



reply via email to

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