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_i


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/XS/convert/convert_html.c (prepare_index_entries_targets), tp/Texinfo/XS/convert/converter.c (comma_index_subentries_tree, free_comma_index_subentries_tree): have comma_index_subentries_tree return an ELEMENT_LIST.
Date: Sun, 12 Nov 2023 13:33:47 -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 c92b326e86 * tp/Texinfo/XS/convert/convert_html.c 
(prepare_index_entries_targets), tp/Texinfo/XS/convert/converter.c 
(comma_index_subentries_tree, free_comma_index_subentries_tree): have 
comma_index_subentries_tree return an ELEMENT_LIST.
c92b326e86 is described below

commit c92b326e8644854a9da2a3cedb51cb346437f3e8
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sun Nov 12 19:33:41 2023 +0100

    * tp/Texinfo/XS/convert/convert_html.c
    (prepare_index_entries_targets), tp/Texinfo/XS/convert/converter.c
    (comma_index_subentries_tree, free_comma_index_subentries_tree): have
    comma_index_subentries_tree return an ELEMENT_LIST.
    
    * tp/Texinfo/XS/main/output_unit.c (split_by_node): set pending_parts
    to be an ELEMENT_LIST.
    
    * tp/Texinfo/XS/parsetexi/parser.c (rearrange_tree_beginning): use an
    ELEMENT_LIST for first_types.
---
 ChangeLog                            | 13 +++++++++++++
 tp/Texinfo/XS/convert/convert_html.c |  6 +++---
 tp/Texinfo/XS/convert/converter.c    | 20 ++++++++++----------
 tp/Texinfo/XS/convert/converter.h    |  6 +++---
 tp/Texinfo/XS/main/output_unit.c     | 22 +++++++++++-----------
 tp/Texinfo/XS/parsetexi/parser.c     | 20 +++++++++++++-------
 6 files changed, 53 insertions(+), 34 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index bfceb859cf..867040c922 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2023-11-12  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/XS/convert/convert_html.c
+       (prepare_index_entries_targets), tp/Texinfo/XS/convert/converter.c
+       (comma_index_subentries_tree, free_comma_index_subentries_tree): have
+       comma_index_subentries_tree return an ELEMENT_LIST.
+
+       * tp/Texinfo/XS/main/output_unit.c (split_by_node): set pending_parts
+       to be an ELEMENT_LIST.
+
+       * tp/Texinfo/XS/parsetexi/parser.c (rearrange_tree_beginning): use an
+       ELEMENT_LIST for first_types.
+
 2023-11-12  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/XS/main/convert_to_text.c (text_accents),
diff --git a/tp/Texinfo/XS/convert/convert_html.c 
b/tp/Texinfo/XS/convert/convert_html.c
index 789b2d1188..5200c54ef1 100644
--- a/tp/Texinfo/XS/convert/convert_html.c
+++ b/tp/Texinfo/XS/convert/convert_html.c
@@ -1274,7 +1274,7 @@ prepare_index_entries_targets (CONVERTER *self)
                   ELEMENT *seealso;
                   ELEMENT *entry_reference_content_element;
                   ELEMENT *normalize_index_element;
-                  ELEMENT *subentries_tree;
+                  ELEMENT_LIST *subentries_tree;
                   ELEMENT *target_element;
                   TEXT target_base;
                   char *normalized_index;
@@ -1306,10 +1306,10 @@ prepare_index_entries_targets (CONVERTER *self)
                    = comma_index_subentries_tree (main_entry_element, " ");
                   if (subentries_tree)
                     {
-                      insert_slice_into_contents (normalize_index_element,
+                      insert_list_slice_into_contents (normalize_index_element,
                                        
normalize_index_element->contents.number,
                                        subentries_tree, 0,
-                                       subentries_tree->contents.number);
+                                       subentries_tree->number);
                     }
                   normalized_index
                     = normalize_transliterate_texinfo (normalize_index_element,
diff --git a/tp/Texinfo/XS/convert/converter.c 
b/tp/Texinfo/XS/convert/converter.c
index 38f0982027..0a9badbf90 100644
--- a/tp/Texinfo/XS/convert/converter.c
+++ b/tp/Texinfo/XS/convert/converter.c
@@ -287,11 +287,11 @@ node_information_filename (CONVERTER *self, char 
*normalized,
   return filename;
 }
 
-ELEMENT *
+ELEMENT_LIST *
 comma_index_subentries_tree (ELEMENT *current_entry,
                              char *separator)
 {
-  ELEMENT *result = new_element (ET_NONE);
+  ELEMENT_LIST *result = new_list ();
   char *subentry_separator = separator;
   if (!separator)
     subentry_separator = ", ";
@@ -304,33 +304,33 @@ comma_index_subentries_tree (ELEMENT *current_entry,
           ELEMENT *separator = new_element (ET_NONE);
           text_append (&separator->text, subentry_separator);
           current_entry = subentry;
-          add_to_contents_as_array (result, separator);
-          add_to_contents_as_array (result, current_entry->args.list[0]);
+          add_to_element_list (result, separator);
+          add_to_element_list (result, current_entry->args.list[0]);
         }
       else
         break;
     }
-  if (result->contents.number > 0)
+  if (result->number > 0)
     return result;
   else
     {
-      destroy_element (result);
+      destroy_list (result);
       return 0;
     }
 }
 
 void
-free_comma_index_subentries_tree (ELEMENT *element)
+free_comma_index_subentries_tree (ELEMENT_LIST *element_list)
 {
   /* destroy separator elements */
   int i;
-  for (i = 0; i < element->contents.number; i++)
+  for (i = 0; i < element_list->number; i++)
     {
-      ELEMENT *content = element->contents.list[i];
+      ELEMENT *content = element_list->list[i];
       if (content->type == ET_NONE)
         destroy_element (content);
     }
-  destroy_element (element);
+  destroy_list (element_list);
 }
 
 /* to be freed by caller */
diff --git a/tp/Texinfo/XS/convert/converter.h 
b/tp/Texinfo/XS/convert/converter.h
index 1f46a4e3be..63064856aa 100644
--- a/tp/Texinfo/XS/convert/converter.h
+++ b/tp/Texinfo/XS/convert/converter.h
@@ -23,9 +23,9 @@ char *node_information_filename (CONVERTER *self, char 
*normalized,
 TARGET_FILENAME *normalized_sectioning_command_filename (CONVERTER *self,
                                                          ELEMENT *command);
 
-ELEMENT *comma_index_subentries_tree (ELEMENT *current_entry,
-                                      char *separator);
-void free_comma_index_subentries_tree (ELEMENT *element);
+ELEMENT_LIST *comma_index_subentries_tree (ELEMENT *current_entry,
+                                           char *separator);
+void free_comma_index_subentries_tree (ELEMENT_LIST *element);
 
 char *top_node_filename (CONVERTER *self, char *document_name);
 
diff --git a/tp/Texinfo/XS/main/output_unit.c b/tp/Texinfo/XS/main/output_unit.c
index 82842d7b60..ea2da313f6 100644
--- a/tp/Texinfo/XS/main/output_unit.c
+++ b/tp/Texinfo/XS/main/output_unit.c
@@ -141,7 +141,7 @@ split_by_node (ELEMENT *root)
   OUTPUT_UNIT_LIST *output_units
     = retrieve_output_units (output_units_descriptor);
   OUTPUT_UNIT *current = new_output_unit (OU_unit);
-  ELEMENT *pending_parts = new_element (ET_NONE);
+  ELEMENT_LIST *pending_parts = new_list ();
   int i;
 
   add_to_output_unit_list (output_units, current);
@@ -151,7 +151,7 @@ split_by_node (ELEMENT *root)
       ELEMENT *content = root->contents.list[i];
       if (content->cmd == CM_part)
         {
-          add_to_contents_as_array (pending_parts, content);
+          add_to_element_list (pending_parts, content);
           continue;
         }
       if (content->cmd == CM_node)
@@ -168,34 +168,34 @@ split_by_node (ELEMENT *root)
               add_to_output_unit_list (output_units, current);
             }
         }
-      if (pending_parts->contents.number > 0)
+      if (pending_parts->number > 0)
         {
           int j;
-          for (j = 0; j < pending_parts->contents.number; j++)
+          for (j = 0; j < pending_parts->number; j++)
             {
-              ELEMENT *part = pending_parts->contents.list[j];
+              ELEMENT *part = pending_parts->list[j];
               add_to_element_list (&current->unit_contents, part);
               part->associated_unit = current;
             }
-          pending_parts->contents.number = 0;
+          pending_parts->number = 0;
         }
       add_to_element_list (&current->unit_contents, content);
       content->associated_unit = current;
     }
 
-  if (pending_parts->contents.number > 0)
+  if (pending_parts->number > 0)
     {
       int j;
-      for (j = 0; j < pending_parts->contents.number; j++)
+      for (j = 0; j < pending_parts->number; j++)
         {
-          ELEMENT *part = pending_parts->contents.list[j];
+          ELEMENT *part = pending_parts->list[j];
           add_to_element_list (&current->unit_contents, part);
           part->associated_unit = current;
         }
-      pending_parts->contents.number = 0;
+      pending_parts->number = 0;
     }
 
-  destroy_element (pending_parts);
+  destroy_list (pending_parts);
 
   return output_units_descriptor;
 }
diff --git a/tp/Texinfo/XS/parsetexi/parser.c b/tp/Texinfo/XS/parsetexi/parser.c
index 80f2912adb..a2177b301e 100644
--- a/tp/Texinfo/XS/parsetexi/parser.c
+++ b/tp/Texinfo/XS/parsetexi/parser.c
@@ -457,7 +457,7 @@ rearrange_tree_beginning (ELEMENT *before_node_section)
 {
   ELEMENT *informational_preamble;
   /* temporary placeholder */
-  ELEMENT *first_types = new_element (ET_NONE);
+  ELEMENT_LIST *first_types = new_list ();
 
   /* Put everything before @setfilename in a special type.  This allows to
      ignore everything before @setfilename. */
@@ -489,7 +489,7 @@ rearrange_tree_beginning (ELEMENT *before_node_section)
           ELEMENT *next_content = before_node_section->contents.list[0];
           if (next_content->type == ET_preamble_before_beginning
               || next_content->type == ET_preamble_before_setfilename)
-            add_to_element_contents (first_types,
+            add_to_element_list (first_types,
                             remove_from_contents (before_node_section, 0));
           else if (next_content->type == ET_paragraph
                    || (next_content->cmd
@@ -503,13 +503,19 @@ rearrange_tree_beginning (ELEMENT *before_node_section)
             }
         }
     }
-  add_to_element_contents (first_types, informational_preamble);
-  while (first_types->contents.number > 0)
+  add_to_element_list (first_types, informational_preamble);
+  /* use insert_into_contents and not insert_list_slice_into_contents
+     to have parent set */
+  if (first_types->number > 0)
     {
-      ELEMENT *e = pop_element_from_contents (first_types);
-      insert_into_contents (before_node_section, e, 0);
+      int j;
+      for (j = first_types->number -1; j >= 0; j--)
+        {
+          ELEMENT *e = first_types->list[j];
+          insert_into_contents (before_node_section, e, 0);
+        }
     }
-  destroy_element (first_types);
+  destroy_list (first_types);
 }
 
 



reply via email to

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