texinfo-commits
[Top][All Lists]
Advanced

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

[no subject]


From: Patrice Dumas
Date: Sat, 24 Feb 2024 07:00:21 -0500 (EST)

branch: master
commit 322a5478717c05b6207d852c2a647d1dfda67d1b
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sat Feb 24 12:33:27 2024 +0100

    * tp/Texinfo/XS/main/build_perl_info.c (build_additional_info),
    tp/Texinfo/XS/main/extra.c (add_extra_directions)
    (lookup_extra_directions), tp/Texinfo/XS/main/manipulate_tree.c
    (copy_associated_info, associate_info_references),
    tp/Texinfo/XS/main/tree.c (destroy_associated_info)
    (list_set_empty_contents): use ELEMENT_LIST for extra_directions.
    Update callers.
---
 ChangeLog                                       |  10 ++
 tp/Texinfo/XS/convert/convert_html.c            |  24 ++--
 tp/Texinfo/XS/main/build_perl_info.c            |   3 +-
 tp/Texinfo/XS/main/extra.c                      |  14 +--
 tp/Texinfo/XS/main/extra.h                      |   5 +-
 tp/Texinfo/XS/main/manipulate_tree.c            |  93 +++++++-------
 tp/Texinfo/XS/main/output_unit.c                |  56 +++++----
 tp/Texinfo/XS/main/tree.c                       |  19 ++-
 tp/Texinfo/XS/main/tree.h                       |   1 +
 tp/Texinfo/XS/structuring_transfo/structuring.c | 159 ++++++++++++------------
 10 files changed, 200 insertions(+), 184 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index cf5344b8f3..1325615a92 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2024-02-24  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/XS/main/build_perl_info.c (build_additional_info),
+       tp/Texinfo/XS/main/extra.c (add_extra_directions)
+       (lookup_extra_directions), tp/Texinfo/XS/main/manipulate_tree.c
+       (copy_associated_info, associate_info_references),
+       tp/Texinfo/XS/main/tree.c (destroy_associated_info)
+       (list_set_empty_contents): use ELEMENT_LIST for extra_directions.
+       Update callers.
+
 2024-02-23  Patrice Dumas  <pertusus@free.fr>
 
        Add const.
diff --git a/tp/Texinfo/XS/convert/convert_html.c 
b/tp/Texinfo/XS/convert/convert_html.c
index 614c2a3f79..52499de7d8 100644
--- a/tp/Texinfo/XS/convert/convert_html.c
+++ b/tp/Texinfo/XS/convert/convert_html.c
@@ -5085,15 +5085,15 @@ html_prepare_output_units_global_targets (CONVERTER 
*self,
                   if (!status && section_level <= 1)
                     break;
 
-                  const ELEMENT *up_section_directions
+                  const ELEMENT_LIST *up_section_directions
                     = lookup_extra_directions (root_command,
                                                "section_directions");
                   if (up_section_directions
-                      && up_section_directions->contents.list[D_up]
-                      && up_section_directions->contents.list[D_up]
+                      && up_section_directions->list[D_up]
+                      && up_section_directions->list[D_up]
                                      ->associated_unit)
                     {
-                      root_command = 
up_section_directions->contents.list[D_up];
+                      root_command = up_section_directions->list[D_up];
                       document_unit = root_command->associated_unit;
                     }
                   else
@@ -6206,16 +6206,16 @@ html_default_format_contents (CONVERTER *self, const 
enum command_id cmd,
             }
           else
             {
-              const ELEMENT *section_directions
+              const ELEMENT_LIST *section_directions
                = lookup_extra_directions (section, "section_directions");
               if (section_directions
-                  && section_directions->contents.list[D_next]
+                  && section_directions->list[D_next]
                   && section->cmd != CM_top)
                 {
                   text_append_n (&result, "</li>\n", 6);
                   if (section == top_section)
                     break;
-                  section = section_directions->contents.list[D_next];
+                  section = section_directions->list[D_next];
                 }
               else
                 {
@@ -6231,14 +6231,14 @@ html_default_format_contents (CONVERTER *self, const 
enum command_id cmd,
                       int section_level;
                       int i;
 
-                      const ELEMENT *section_directions
+                      const ELEMENT_LIST *section_directions
                         = lookup_extra_directions (section,
                                                    "section_directions");
                       if (!section_directions
-                          || !section_directions->contents.list[D_up])
+                          || !section_directions->list[D_up])
                         break;
 
-                      section = section_directions->contents.list[D_up];
+                      section = section_directions->list[D_up];
 
                       section_level = lookup_extra_integer (section,
                                                 "section_level", &status);
@@ -6258,10 +6258,10 @@ html_default_format_contents (CONVERTER *self, const 
enum command_id cmd,
                         = lookup_extra_directions (section,
                                                    "section_directions");
                       if (section_directions
-                          && section_directions->contents.list[D_next])
+                          && section_directions->list[D_next])
                         {
                           text_append_n (&result, "</li>\n", 6);
-                          section = section_directions->contents.list[D_next];
+                          section = section_directions->list[D_next];
                           break;
                         }
                     }
diff --git a/tp/Texinfo/XS/main/build_perl_info.c 
b/tp/Texinfo/XS/main/build_perl_info.c
index c2f7514ed0..f34957d4bd 100644
--- a/tp/Texinfo/XS/main/build_perl_info.c
+++ b/tp/Texinfo/XS/main/build_perl_info.c
@@ -315,8 +315,7 @@ build_additional_info (HV *extra, ASSOCIATED_INFO *a, int 
avoid_recursion,
               }
             case extra_directions:
               {
-              if (f)
-                STORE(build_perl_directions (&f->contents, avoid_recursion));
+              STORE(build_perl_directions (k->list, avoid_recursion));
               break;
               }
             case extra_string:
diff --git a/tp/Texinfo/XS/main/extra.c b/tp/Texinfo/XS/main/extra.c
index c2583ae2ea..226937e82c 100644
--- a/tp/Texinfo/XS/main/extra.c
+++ b/tp/Texinfo/XS/main/extra.c
@@ -120,15 +120,15 @@ add_extra_contents (ELEMENT *e, const char *key, 
ELEMENT_LIST *value)
    In other elements, in general, all the pointer elements are non
    NULL in contents for the first contents.number elements.
 */
-ELEMENT *
-add_extra_directions (ELEMENT *e, const char *key, ELEMENT *value)
+ELEMENT_LIST *
+add_extra_directions (ELEMENT *e, const char *key, ELEMENT_LIST *value)
 {
   if (!value)
-    value = new_element (ET_NONE);
-  element_set_empty_contents (value, directions_length);
+    value = new_list ();
+  list_set_empty_contents (value, directions_length);
   KEY_PAIR *k = get_associated_info_key (&e->extra_info, key,
                                          extra_directions);
-  k->element = value;
+  k->list = value;
   return value;
 }
 
@@ -293,7 +293,7 @@ lookup_extra_contents (const ELEMENT *e, const char *key)
   return k->list;
 }
 
-const ELEMENT *
+const ELEMENT_LIST *
 lookup_extra_directions (const ELEMENT *e, const char *key)
 {
   KEY_PAIR *k = lookup_extra (e, key);
@@ -307,7 +307,7 @@ lookup_extra_directions (const ELEMENT *e, const char *key)
       fatal (msg);
       free (msg);
     }
-  return k->element;
+  return k->list;
 }
 
 ELEMENT *
diff --git a/tp/Texinfo/XS/main/extra.h b/tp/Texinfo/XS/main/extra.h
index 5c5ed2598d..6aa1dabcbb 100644
--- a/tp/Texinfo/XS/main/extra.h
+++ b/tp/Texinfo/XS/main/extra.h
@@ -24,7 +24,8 @@ void add_extra_element_oot (ELEMENT *e, char *key, ELEMENT 
*value);
 ELEMENT_LIST *add_extra_contents (ELEMENT *e, const char *key,
                                   ELEMENT_LIST *value);
 void add_extra_container (ELEMENT *e, char *key, ELEMENT *value);
-ELEMENT *add_extra_directions (ELEMENT *e, const char *key, ELEMENT *value);
+ELEMENT_LIST *add_extra_directions (ELEMENT *e, const char *key,
+                                    ELEMENT_LIST *value);
 void add_extra_text (ELEMENT *e, char *key, ELEMENT *value);
 void add_extra_misc_args (ELEMENT *e, char *key, ELEMENT *value);
 void add_extra_string (ELEMENT *e, const char *key, char *value);
@@ -42,7 +43,7 @@ KEY_PAIR *lookup_info (const ELEMENT *e, const char *key);
 ELEMENT *lookup_extra_element (const ELEMENT *e, const char *key);
 ELEMENT *lookup_info_element (const ELEMENT *e, const char *key);
 ELEMENT_LIST *lookup_extra_contents (const ELEMENT *e, const char *key);
-const ELEMENT *lookup_extra_directions (const ELEMENT *e, const char *key);
+const ELEMENT_LIST *lookup_extra_directions (const ELEMENT *e, const char 
*key);
 int lookup_extra_integer (const ELEMENT *e, const char *key, int *ret);
 char *lookup_extra_string (const ELEMENT *e, const char *key);
 char *lookup_info_string (const ELEMENT *e, const char *key);
diff --git a/tp/Texinfo/XS/main/manipulate_tree.c 
b/tp/Texinfo/XS/main/manipulate_tree.c
index 8c3049dd6d..284e78990d 100644
--- a/tp/Texinfo/XS/main/manipulate_tree.c
+++ b/tp/Texinfo/XS/main/manipulate_tree.c
@@ -90,6 +90,7 @@ copy_associated_info (ASSOCIATED_INFO *info, ASSOCIATED_INFO* 
new_info)
           copy_tree_internal (f, 0);
           break;
         case extra_contents:
+        case extra_directions:
           {
           KEY_PAIR *k = get_associated_info_key (new_info, key, k_ref->type);
           new_extra_contents = new_list ();
@@ -97,20 +98,26 @@ copy_associated_info (ASSOCIATED_INFO *info, 
ASSOCIATED_INFO* new_info)
           for (j = 0; j < k_ref->list->number; j++)
             {
               ELEMENT *e = k_ref->list->list[j];
-              k_copy = lookup_extra_by_index (e, "_copy", -1);
-              if (k_copy)
-                add_to_element_list (new_extra_contents,
-                                     k_copy->element);
-              else
+              if (!e && info->info[i].type == extra_directions)
                 {
-                  increase_ref_counter (e);
                   add_to_element_list (new_extra_contents, 0);
                 }
-              copy_tree_internal (e, 0);
+              else
+                {
+                  k_copy = lookup_extra_by_index (e, "_copy", -1);
+                  if (k_copy)
+                    add_to_element_list (new_extra_contents,
+                                         k_copy->element);
+                  else
+                    {
+                      increase_ref_counter (e);
+                      add_to_element_list (new_extra_contents, 0);
+                    }
+                  copy_tree_internal (e, 0);
+                }
             }
           break;
           }
-        case extra_directions:
         case extra_container:
           {
           KEY_PAIR *k = get_associated_info_key (new_info, key, k_ref->type);
@@ -119,23 +126,16 @@ copy_associated_info (ASSOCIATED_INFO *info, 
ASSOCIATED_INFO* new_info)
           for (j = 0; j < f->contents.number; j++)
             {
               ELEMENT *e = f->contents.list[j];
-              if (!e && info->info[i].type == extra_directions)
-                {
-                  add_to_contents_as_array (new_extra_element, 0);
-                }
+              k_copy = lookup_extra_by_index (e, "_copy", -1);
+              if (k_copy)
+                add_to_contents_as_array (new_extra_element,
+                                          k_copy->element);
               else
                 {
-                  k_copy = lookup_extra_by_index (e, "_copy", -1);
-                  if (k_copy)
-                    add_to_contents_as_array (new_extra_element,
-                                              k_copy->element);
-                  else
-                    {
-                      increase_ref_counter (e);
-                      add_to_contents_as_array (new_extra_element, 0);
-                    }
-                  copy_tree_internal (e, 0);
+                  increase_ref_counter (e);
+                  add_to_contents_as_array (new_extra_element, 0);
                 }
+              copy_tree_internal (e, 0);
             }
             break;
           }
@@ -252,6 +252,7 @@ associate_info_references (ASSOCIATED_INFO *info, 
ASSOCIATED_INFO *new_info)
             break;
           }
         case extra_contents:
+        case extra_directions:
           {
             KEY_PAIR *k = lookup_associated_info (new_info, key);
             ELEMENT_LIST *new_extra_contents = k->list;
@@ -260,20 +261,24 @@ associate_info_references (ASSOCIATED_INFO *info, 
ASSOCIATED_INFO *new_info)
                 KEY_PAIR *k_copy;
                 ELEMENT *e = k_ref->list->list[j];
                 ELEMENT *new_e = new_extra_contents->list[j];
-                if (!new_e)
+                if (!e && info->info[i].type == extra_directions)
                   {
-                    ELEMENT *new_ref = get_copy_ref (e);
-                    new_extra_contents->list[j] = new_ref;
                   }
-
-                k_copy = lookup_extra_by_index (e, "_copy", -1);
-                if (k_copy)
-                  copy_extra_info (e, k_copy->element);
+                else
+                  {
+                    if (!new_e)
+                      {
+                        ELEMENT *new_ref = get_copy_ref (e);
+                        new_extra_contents->list[j] = new_ref;
+                      }
+                    k_copy = lookup_extra_by_index (e, "_copy", -1);
+                    if (k_copy)
+                      copy_extra_info (e, k_copy->element);
+                  }
               }
-              break;
-            }
+            break;
+          }
         case extra_container:
-        case extra_directions:
           {
             KEY_PAIR *k = lookup_associated_info (new_info, key);
             new_extra_element = k->element;
@@ -282,24 +287,18 @@ associate_info_references (ASSOCIATED_INFO *info, 
ASSOCIATED_INFO *new_info)
                 KEY_PAIR *k_copy;
                 ELEMENT *e = f->contents.list[j];
                 ELEMENT *new_e = new_extra_element->contents.list[j];
-                if (!e && info->info[i].type == extra_directions)
+                if (!new_e)
                   {
+                    ELEMENT *new_ref = get_copy_ref (e);
+                    new_extra_element->contents.list[j] = new_ref;
                   }
-                else
-                  {
-                    if (!new_e)
-                      {
-                        ELEMENT *new_ref = get_copy_ref (e);
-                        new_extra_element->contents.list[j] = new_ref;
-                      }
 
-                    k_copy = lookup_extra_by_index (e, "_copy", -1);
-                    if (k_copy)
-                      copy_extra_info (e, k_copy->element);
-                  }
-                }
-              break;
-            }
+                k_copy = lookup_extra_by_index (e, "_copy", -1);
+                if (k_copy)
+                  copy_extra_info (e, k_copy->element);
+              }
+            break;
+          }
         case extra_string:
           { /* A simple string. */
             char *value = k_ref->string;
diff --git a/tp/Texinfo/XS/main/output_unit.c b/tp/Texinfo/XS/main/output_unit.c
index d12f8e33ea..a3e6d42380 100644
--- a/tp/Texinfo/XS/main/output_unit.c
+++ b/tp/Texinfo/XS/main/output_unit.c
@@ -513,7 +513,7 @@ units_directions (OPTIONS *customization_information,
       OUTPUT_UNIT *output_unit = output_units->list[i];
       OUTPUT_UNIT **directions = output_unit->directions;
       ELEMENT *node = output_unit_node (output_unit);
-      const ELEMENT *node_directions;
+      const ELEMENT_LIST *node_directions;
       ELEMENT *section = output_unit_section (output_unit);
 
       directions[RUD_type_This] = output_unit;
@@ -535,7 +535,7 @@ units_directions (OPTIONS *customization_information,
             {
               for (d = 0; d < directions_length; d++)
                 {
-                  ELEMENT *node_direction = node_directions->contents.list[d];
+                  ELEMENT *node_direction = node_directions->list[d];
                   if (node_direction)
                     directions[node_unit_directions[d]]
                       = label_target_unit_element (node_direction);
@@ -563,19 +563,19 @@ units_directions (OPTIONS *customization_information,
                    = section_childs->list[0]->associated_unit;
                 }
               else if (node_directions
-                       && node_directions->contents.list[D_next])
+                       && node_directions->list[D_next])
                directions[RUD_type_NodeForward]
                  = label_target_unit_element (
-                         node_directions->contents.list[D_next]);
-              else if (node_directions && node_directions->contents.list[D_up])
+                         node_directions->list[D_next]);
+              else if (node_directions && node_directions->list[D_up])
                 {
-                  ELEMENT *up = node_directions->contents.list[D_up];
+                  ELEMENT *up = node_directions->list[D_up];
                   ELEMENT_LIST up_list;
                   memset (&up_list, 0, sizeof (ELEMENT_LIST));
                   add_to_element_list (&up_list, node);
                   while (1)
                     {
-                      const ELEMENT *up_node_directions;
+                      const ELEMENT_LIST *up_node_directions;
                       int i;
                       int in_up = 0;
                       for (i = 0; i < up_list.number; i++)
@@ -590,17 +590,17 @@ units_directions (OPTIONS *customization_information,
                       up_node_directions = lookup_extra_directions (up,
                                                    "node_directions");
                       if (up_node_directions
-                          && up_node_directions->contents.list[D_next])
+                          && up_node_directions->list[D_next])
                         {
                            directions[RUD_type_NodeForward]
                              = label_target_unit_element (
-                              up_node_directions->contents.list[D_next]);
+                              up_node_directions->list[D_next]);
                            break;
                         }
                       add_to_element_list (&up_list, up);
                       if (up_node_directions
-                          && up_node_directions->contents.list[D_up])
-                        up = up_node_directions->contents.list[D_up];
+                          && up_node_directions->list[D_up])
+                        up = up_node_directions->list[D_up];
                       else
                         break;
                     }
@@ -656,7 +656,8 @@ units_directions (OPTIONS *customization_information,
           int up_section_level;
           int status;
           enum directions d;
-          const ELEMENT *section_directions = lookup_extra_directions (section,
+          const ELEMENT_LIST *section_directions
+                        = lookup_extra_directions (section,
                                                    "section_directions");
           if (section_directions)
             {
@@ -670,13 +671,13 @@ units_directions (OPTIONS *customization_information,
                @part part
                @chapter chapter
              in that cas the direction is not set up */
-                  if (section_directions->contents.list[d]
-                      && section_directions->contents.list[d]->associated_unit
+                  if (section_directions->list[d]
+                      && section_directions->list[d]->associated_unit
                       && (!section->associated_unit
                           || section->associated_unit
-                     != section_directions->contents.list[d]->associated_unit))
+                     != section_directions->list[d]->associated_unit))
                   directions[section_unit_directions[d]]
-                    = section_directions->contents.list[d]->associated_unit;
+                    = section_directions->list[d]->associated_unit;
                 }
             }
 
@@ -687,12 +688,13 @@ units_directions (OPTIONS *customization_information,
               up_section_level
                 = lookup_extra_integer (up, "section_level", &status);
 
-              const ELEMENT *up_section_directions = lookup_extra_directions 
(up,
+              const ELEMENT_LIST *up_section_directions
+                        = lookup_extra_directions (up,
                                                    "section_directions");
               if (status >= 0 && up_section_level > 1
                   && up_section_directions
-                  && up_section_directions->contents.list[D_up])
-                up = up_section_directions->contents.list[D_up];
+                  && up_section_directions->list[D_up])
+                up = up_section_directions->list[D_up];
               else
                 break;
             }
@@ -707,21 +709,21 @@ units_directions (OPTIONS *customization_information,
             }
           else
             {
-              const ELEMENT *toplevel_directions
+              const ELEMENT_LIST *toplevel_directions
                = lookup_extra_directions (up, "toplevel_directions");
               if (toplevel_directions
-                  && toplevel_directions->contents.list[D_next])
+                  && toplevel_directions->list[D_next])
                 directions[RUD_type_FastForward]
-                  = 
toplevel_directions->contents.list[D_next]->associated_unit;
+                  = toplevel_directions->list[D_next]->associated_unit;
               else
                 {
-                  const ELEMENT *up_section_directions
+                  const ELEMENT_LIST *up_section_directions
                         = lookup_extra_directions (up,
                                                    "section_directions");
                   if (up_section_directions
-                      && up_section_directions->contents.list[D_next])
+                      && up_section_directions->list[D_next])
                     directions[RUD_type_FastForward]
-                      = up_section_directions->contents.list[D_next]
+                      = up_section_directions->list[D_next]
                                                      ->associated_unit;
                 }
             }
@@ -750,11 +752,11 @@ units_directions (OPTIONS *customization_information,
          Not done in the default case. */
       if (customization_information->USE_UP_NODE_FOR_ELEMENT_UP.integer > 0
           && !directions[RUD_type_Up] && node
-          && node_directions && node_directions->contents.list[D_up]
+          && node_directions && node_directions->list[D_up]
           && (!node_top || node != node_top))
         {
           OUTPUT_UNIT *up_node_unit_element
-           = label_target_unit_element (node_directions->contents.list[D_up]);
+           = label_target_unit_element (node_directions->list[D_up]);
           if (up_node_unit_element)
             directions[RUD_type_Up] = up_node_unit_element;
         }
diff --git a/tp/Texinfo/XS/main/tree.c b/tp/Texinfo/XS/main/tree.c
index 244b87d2ed..8662523681 100644
--- a/tp/Texinfo/XS/main/tree.c
+++ b/tp/Texinfo/XS/main/tree.c
@@ -148,10 +148,10 @@ destroy_associated_info (ASSOCIATED_INFO *a)
           destroy_element_and_children (a->info[i].element);
           break;
         case extra_contents:
+        case extra_directions:
           destroy_list (a->info[i].list);
           break;
         case extra_container:
-        case extra_directions:
           if (a->info[i].element)
             destroy_element (a->info[i].element);
           break;
@@ -375,19 +375,26 @@ insert_list_slice_into_contents (ELEMENT *to, int where, 
ELEMENT_LIST *from,
 
 /* ensure that there are n slots, and void them */
 void
-element_set_empty_contents (ELEMENT *parent, int n)
+list_set_empty_contents (ELEMENT_LIST *e_list, int n)
 {
   int i;
   if (n <= 0)
     return;
 
-  if (parent->contents.number < n)
+  if (e_list->number < n)
     {
-      reallocate_list_for (n - parent->contents.number, &parent->contents);
-      parent->contents.number = n;
+      reallocate_list_for (n - e_list->number, e_list);
+      e_list->number = n;
     }
   for (i = 0; i < n; i++)
-    parent->contents.list[i] = 0;
+    e_list->list[i] = 0;
+}
+
+
+void
+element_set_empty_contents (ELEMENT *parent, int n)
+{
+  list_set_empty_contents (&parent->contents, n);
 }
 
 ELEMENT *
diff --git a/tp/Texinfo/XS/main/tree.h b/tp/Texinfo/XS/main/tree.h
index 24415d8296..262b1b160b 100644
--- a/tp/Texinfo/XS/main/tree.h
+++ b/tp/Texinfo/XS/main/tree.h
@@ -26,6 +26,7 @@ void insert_list_slice_into_contents (ELEMENT *to, int idx, 
ELEMENT_LIST *from,
                                       int start, int end);
 void insert_list_slice_into_args (ELEMENT *to, int where, ELEMENT_LIST *from,
                                       int start, int end);
+void list_set_empty_contents (ELEMENT_LIST *e_list, int n);
 void element_set_empty_contents (ELEMENT *parent, int n);
 ELEMENT *remove_from_element_list (ELEMENT_LIST *list, int where);
 ELEMENT *remove_from_contents (ELEMENT *parent, int where);
diff --git a/tp/Texinfo/XS/structuring_transfo/structuring.c 
b/tp/Texinfo/XS/structuring_transfo/structuring.c
index 97ae9ff7cd..3f31d20640 100644
--- a/tp/Texinfo/XS/structuring_transfo/structuring.c
+++ b/tp/Texinfo/XS/structuring_transfo/structuring.c
@@ -129,7 +129,8 @@ sectioning_structure (DOCUMENT *document)
           if (prev_section_level < level)
           /* new command is below */
             {
-              ELEMENT *section_directions = new_element (ET_NONE);
+              const ELEMENT_LIST *section_directions
+                  = add_extra_directions (content, "section_directions", 0);
               ELEMENT_LIST *section_childs = new_list ();
               if (level - prev_section_level > 1)
                 {
@@ -141,9 +142,7 @@ sectioning_structure (DOCUMENT *document)
               add_to_element_list (section_childs, content);
               add_extra_contents (previous_section, "section_childs",
                                   section_childs);
-              add_extra_directions (content, "section_directions",
-                                    section_directions);
-              section_directions->contents.list[D_up] = previous_section;
+              section_directions->list[D_up] = previous_section;
                /*
                 if the up is unnumbered, the number information has to be kept,
                 to avoid reusing an already used number.
@@ -169,14 +168,14 @@ sectioning_structure (DOCUMENT *document)
               int up_level;
               while (1)
                 {
-                  const ELEMENT *up_section_directions
+                  const ELEMENT_LIST *up_section_directions
                     = lookup_extra_directions (up, "section_directions");
                   up_level = lookup_extra_integer (up, "section_level",
                                                    &status);
                   if (up_section_directions
-                      && up_section_directions->contents.list[D_up]
+                      && up_section_directions->list[D_up]
                       && up_level >= level)
-                    up = up_section_directions->contents.list[D_up];
+                    up = up_section_directions->list[D_up];
                   else
                     break;
                 }
@@ -238,24 +237,23 @@ sectioning_structure (DOCUMENT *document)
                 }
               else
                 {
-                  ELEMENT *section_directions = new_element (ET_NONE);
                   ELEMENT_LIST *up_section_childs
                     = lookup_extra_contents (up, "section_childs");
                   ELEMENT *prev
                     = up_section_childs->list[up_section_childs->number -1];
-                  const ELEMENT *prev_section_directions
+                  const ELEMENT_LIST *prev_section_directions
                     = lookup_extra_directions (prev, "section_directions");
-                  add_extra_directions (content, "section_directions",
-                                        section_directions);
+                  ELEMENT_LIST *section_directions
+                    = add_extra_directions (content, "section_directions", 0);
               /* do not set sec_root as up, but always put in section_childs */
                   if (up != sec_root)
-                    section_directions->contents.list[D_up] = up;
-                  section_directions->contents.list[D_prev] = prev;
+                    section_directions->list[D_up] = up;
+                  section_directions->list[D_prev] = prev;
 
                   if (!prev_section_directions)
                     prev_section_directions = add_extra_directions (prev,
                                                      "section_directions", 0);
-                  prev_section_directions->contents.list[D_next] = content;
+                  prev_section_directions->list[D_next] = content;
                   add_to_element_list (up_section_childs, content);
                 }
               if (!(command_other_flags (content) & CF_unnumbered))
@@ -355,13 +353,12 @@ sectioning_structure (DOCUMENT *document)
         {
           if (previous_toplevel || (section_top && section_top != content))
             {
-              ELEMENT *toplevel_directions = new_element (ET_NONE);
-              add_extra_directions (content, "toplevel_directions",
-                                    toplevel_directions);
+              const ELEMENT_LIST *toplevel_directions
+                = add_extra_directions (content, "toplevel_directions", 0);
 
               if (previous_toplevel)
                 {
-                  const ELEMENT *prev_toplvl_directions
+                  const ELEMENT_LIST *prev_toplvl_directions
                    = lookup_extra_directions (previous_toplevel,
                                               "toplevel_directions");
                   if (!prev_toplvl_directions)
@@ -369,12 +366,12 @@ sectioning_structure (DOCUMENT *document)
                       = add_extra_directions (previous_toplevel,
                                               "toplevel_directions", 0);
  
-                  prev_toplvl_directions->contents.list[D_next] = content;
-                  toplevel_directions->contents.list[D_prev] = 
previous_toplevel;
+                  prev_toplvl_directions->list[D_next] = content;
+                  toplevel_directions->list[D_prev] = previous_toplevel;
                 }
               if (section_top && content != section_top)
                 {
-                  toplevel_directions->contents.list[D_up] = section_top;
+                  toplevel_directions->list[D_up] = section_top;
                 }
             }
           previous_toplevel = content;
@@ -490,13 +487,13 @@ get_node_node_childs_from_sectioning (const ELEMENT *node)
           const ELEMENT *current = associated_section;
           while (1)
             {
-              const ELEMENT *section_directions
+              const ELEMENT_LIST *section_directions
                              = lookup_extra_directions (current,
                                                         "section_directions");
               if (section_directions
-                  && section_directions->contents.list[D_next])
+                  && section_directions->list[D_next])
                 {
-                  current = section_directions->contents.list[D_next];
+                  current = section_directions->list[D_next];
                   if (current->cmd == CM_part)
                     {
                       ELEMENT_LIST *section_childs
@@ -619,7 +616,7 @@ check_nodes_are_referenced (DOCUMENT *document)
       int status;
       const ELEMENT *node = nodes_list->list[i];
       int is_target = lookup_extra_integer (node, "is_target", &status);
-      const ELEMENT *node_directions = lookup_extra_directions (node,
+      const ELEMENT_LIST *node_directions = lookup_extra_directions (node,
                                                     "node_directions");
       const ELEMENT_LIST *menus = lookup_extra_contents (node, "menus");
 
@@ -632,9 +629,9 @@ check_nodes_are_referenced (DOCUMENT *document)
           int d;
           for (d = 0; d < directions_length; d++)
             {
-              if (node_directions->contents.list[d])
+              if (node_directions->list[d])
                 referenced_identifiers =
-                 register_referenced_node (node_directions->contents.list[d],
+                 register_referenced_node (node_directions->list[d],
                                            referenced_identifiers,
                                            &referenced_identifier_space,
                                            &referenced_identifier_number);
@@ -888,14 +885,14 @@ set_menus_node_directions (DOCUMENT *document)
                                                              normalized);
                                   if (menu_node)
                                     {
-                                      const ELEMENT *menu_directions
+                                      const ELEMENT_LIST *menu_directions
                                        = lookup_extra_directions (menu_node,
                                                           "menu_directions");
                                       if (!menu_directions)
                                         menu_directions
                                           = add_extra_directions (menu_node,
                                                            "menu_directions", 
0);
-                                      menu_directions->contents.list[D_up]
+                                      menu_directions->list[D_up]
                                         = node;
                                     }
                                 }
@@ -918,26 +915,26 @@ set_menus_node_directions (DOCUMENT *document)
                                                    "manual_content");
                           if (!manual_content)
                             {
-                              const ELEMENT *menu_directions
+                              const ELEMENT_LIST *menu_directions
                                 = lookup_extra_directions (menu_node,
                                                       "menu_directions");
                               if (!menu_directions)
                                 menu_directions
                                   = add_extra_directions (menu_node,
                                                       "menu_directions", 0);
-                              menu_directions->contents.list[D_prev]
+                              menu_directions->list[D_prev]
                                  = previous_node;
                             }
                           if (!prev_manual_content)
                             {
-                              const ELEMENT *menu_directions
+                              const ELEMENT_LIST *menu_directions
                                 = lookup_extra_directions (previous_node,
                                                        "menu_directions");
                               if (!menu_directions)
                                 menu_directions
                                   = add_extra_directions (previous_node,
                                                       "menu_directions", 0);
-                              menu_directions->contents.list[D_next]
+                              menu_directions->list[D_next]
                                  = menu_node;
                             }
                         }
@@ -993,11 +990,11 @@ section_direction_associated_node (const ELEMENT *section,
   for (i = 0; i < sizeof (direction_bases) / sizeof (direction_bases[0]);
        i++)
     {
-      const ELEMENT *directions
+      const ELEMENT_LIST *directions
         = lookup_extra_directions (section, direction_bases[i]);
-      if (directions && directions->contents.list[direction])
+      if (directions && directions->list[direction])
         {
-          ELEMENT *section_to = directions->contents.list[direction];
+          const ELEMENT *section_to = directions->list[direction];
           ELEMENT *associated_node = lookup_extra_element (section_to,
                                                        "associated_node");
           if ((strcmp (direction_bases[i], "toplevel_directions")
@@ -1034,13 +1031,13 @@ complete_node_tree_with_menus (DOCUMENT *document)
     {
       ELEMENT *node = nodes_list->list[i];
       char *normalized = lookup_extra_string (node, "normalized");
-      const ELEMENT *menu_directions = lookup_extra_directions (node,
+      const ELEMENT_LIST *menu_directions = lookup_extra_directions (node,
                                                       "menu_directions");
       int automatic_directions = (node->args.number <= 1);
 
       if (automatic_directions)
         {
-          const ELEMENT *node_directions = lookup_extra_directions (node,
+          const ELEMENT_LIST *node_directions = lookup_extra_directions (node,
                                                           "node_directions");
           if (strcmp (normalized, "Top"))
             {
@@ -1051,9 +1048,9 @@ complete_node_tree_with_menus (DOCUMENT *document)
               /* prev already defined for the node first Top node menu entry */
                   if (d == D_prev)
                     {
-                      if (node_directions && node_directions->contents.list[d])
+                      if (node_directions && node_directions->list[d])
                         {
-                          ELEMENT *prev = node_directions->contents.list[d];
+                          ELEMENT *prev = node_directions->list[d];
                           char *prev_normalized = lookup_extra_string (prev,
                                                                "normalized");
                           if (prev_normalized && !strcmp (normalized, "Top"))
@@ -1079,14 +1076,14 @@ complete_node_tree_with_menus (DOCUMENT *document)
                       if (direction_associated_node)
                         {
                           const ELEMENT_LIST *menus = 0;
-                          const ELEMENT *section_directions
+                          const ELEMENT_LIST *section_directions
                             = lookup_extra_directions (node_direction_section,
                                                        "section_directions");
                           if (section_directions
-                              && section_directions->contents.list[D_up])
+                              && section_directions->list[D_up])
                             {
                               const ELEMENT *up_sec
-                               = section_directions->contents.list[D_up];
+                               = section_directions->list[D_up];
                               const ELEMENT *up_node
                                     = lookup_extra_element (up_sec,
                                                             "associated_node");
@@ -1098,7 +1095,7 @@ complete_node_tree_with_menus (DOCUMENT *document)
                           if (menus
                               && menus->number > 0
                               && (!menu_directions
-                                  || !menu_directions->contents.list[d]))
+                                  || !menu_directions->list[d]))
                             {
                               char *node_texi
                                 = target_element_to_texi_label (node);
@@ -1121,12 +1118,12 @@ complete_node_tree_with_menus (DOCUMENT *document)
             commands but with explicit menus.
            */
                   if ((!node_directions
-                       || !node_directions->contents.list[d])
+                       || !node_directions->list[d])
                       && menu_directions
-                      && menu_directions->contents.list[d])
+                      && menu_directions->list[d])
                     {
                       ELEMENT *elt_menu_direction
-                       = menu_directions->contents.list[d];
+                       = menu_directions->list[d];
                       const ELEMENT *menu_direction_manual_content
                         = lookup_extra_element (elt_menu_direction,
                                                 "manual_content");
@@ -1154,14 +1151,14 @@ complete_node_tree_with_menus (DOCUMENT *document)
                           if (!node_directions)
                             node_directions = add_extra_directions (node,
                                                     "node_directions", 0);
-                          node_directions->contents.list[d]
+                          node_directions->list[d]
                              = elt_menu_direction;
                         }
                     }
                 }
             }
           else if (!node_directions
-                   || !node_directions->contents.list[D_next])
+                   || !node_directions->list[D_next])
             {
               /* use first menu entry if available as next for Top */
               ELEMENT *menu_child = first_menu_node(node, identifiers_target);
@@ -1173,20 +1170,20 @@ complete_node_tree_with_menus (DOCUMENT *document)
                     node_directions = add_extra_directions (node,
                                                   "node_directions", 0);
 
-                  node_directions->contents.list[D_next] = menu_child;
+                  node_directions->list[D_next] = menu_child;
                   const ELEMENT *menu_child_manual_content
                     = lookup_extra_element (menu_child, "manual_content");
                   if (!menu_child_manual_content)
                     {
-                      const ELEMENT *child_node_directions
+                      const ELEMENT_LIST *child_node_directions
                         = lookup_extra_directions (menu_child,
                                                    "node_directions");
                       if (!child_node_directions)
                         child_node_directions
                           = add_extra_directions (menu_child,
                                                    "node_directions", 0);
-                      if (!child_node_directions->contents.list[D_prev])
-                        child_node_directions->contents.list[D_prev] = node;
+                      if (!child_node_directions->list[D_prev])
+                        child_node_directions->list[D_prev] = node;
                     }
                 }
               else
@@ -1204,20 +1201,20 @@ complete_node_tree_with_menus (DOCUMENT *document)
                           if (!node_directions)
                             node_directions = add_extra_directions (node,
                                                       "node_directions", 0);
-                          node_directions->contents.list[D_next]
+                          node_directions->list[D_next]
                               = first_non_top_node;
                           int first_non_top_node_automatic
                             = (first_non_top_node->args.number <= 1);
                           if (first_non_top_node_automatic)
                             {
-                              const ELEMENT *non_top_node_directions
+                              const ELEMENT_LIST *non_top_node_directions
                                = lookup_extra_directions (first_non_top_node,
                                                         "node_directions");
                               if (!non_top_node_directions)
                                 non_top_node_directions
                                   = add_extra_directions (first_non_top_node,
                                                       "node_directions", 0);
-                              non_top_node_directions->contents.list[D_prev]
+                              non_top_node_directions->list[D_prev]
                                = node;
                             }
                           break;
@@ -1231,27 +1228,27 @@ complete_node_tree_with_menus (DOCUMENT *document)
            || options->CHECK_NORMAL_MENU_STRUCTURE.integer > 0)
           && strcmp (normalized, "Top"))
         {
-          const ELEMENT *node_directions = lookup_extra_directions (node,
+          const ELEMENT_LIST *node_directions = lookup_extra_directions (node,
                                                            "node_directions");
           if (node_directions && menu_directions)
             {
               int d;
               for (d = 0; d < directions_length; d++)
                 {
-                  if (node_directions->contents.list[d]
-                      && menu_directions->contents.list[d]
-                      && node_directions->contents.list[d]
-                           != menu_directions->contents.list[d])
+                  if (node_directions->list[d]
+                      && menu_directions->list[d]
+                      && node_directions->list[d]
+                           != menu_directions->list[d])
                     {
                       ELEMENT *menu_direction
-                       = menu_directions->contents.list[d];
+                       = menu_directions->list[d];
                       ELEMENT *menu_dir_manual_content
                        = lookup_extra_element (menu_direction, 
"manual_content");
                       if (!menu_dir_manual_content)
                         {
                           char *node_texi = target_element_to_texi_label 
(node);
                           char *dir_texi = target_element_to_texi_label
-                                            
(node_directions->contents.list[d]);
+                                            (node_directions->list[d]);
                           char *menu_dir_texi
                              = target_element_to_texi_label (menu_direction);
                           message_list_command_warn (error_messages, options,
@@ -1272,11 +1269,11 @@ complete_node_tree_with_menus (DOCUMENT *document)
       if ((!options)
           || options->CHECK_MISSING_MENU_ENTRY.integer > 0)
         {
-          const ELEMENT *node_directions = lookup_extra_directions (node,
+          const ELEMENT_LIST *node_directions = lookup_extra_directions (node,
                                                            "node_directions");
           const ELEMENT *up_node = 0;
-          if (node_directions && node_directions->contents.list[D_up])
-            up_node = node_directions->contents.list[D_up];
+          if (node_directions && node_directions->list[D_up])
+            up_node = node_directions->list[D_up];
           if (up_node)
             {
               int status;
@@ -1375,7 +1372,7 @@ nodes_tree (DOCUMENT *document)
         if (!top_node || node != top_node)
           {
             enum directions d;
-            const ELEMENT *node_directions = lookup_extra_directions (node,
+            const ELEMENT_LIST *node_directions = lookup_extra_directions 
(node,
                                                    "node_directions");
             for (d = 0; d < directions_length; d++)
               {
@@ -1384,9 +1381,9 @@ nodes_tree (DOCUMENT *document)
                 ELEMENT *direction_associated_node;
            /* prev already defined for the node first Top node menu entry */
                 if (d == D_prev && node_directions
-                    && node_directions->contents.list[d])
+                    && node_directions->list[d])
                   {
-                    ELEMENT *prev_element = node_directions->contents.list[d];
+                    ELEMENT *prev_element = node_directions->list[d];
                     char *prev_normalized
                       = lookup_extra_string (prev_element, "normalized");
                     if (prev_normalized)
@@ -1412,7 +1409,7 @@ nodes_tree (DOCUMENT *document)
                         if (!node_directions)
                           node_directions = add_extra_directions (node,
                                                       "node_directions", 0);
-                        node_directions->contents.list[d]
+                        node_directions->list[d]
                            = direction_associated_node;
                       }
                   }
@@ -1433,24 +1430,24 @@ nodes_tree (DOCUMENT *document)
                       = lookup_extra_element (first_sec, "associated_node");
                     if (top_node_section_child)
                       {
-                        const ELEMENT *top_directions
+                        const ELEMENT_LIST *top_directions
                          = lookup_extra_directions (node,
                                                     "node_directions");
                         if (!top_directions)
                           top_directions = add_extra_directions (node,
                                                       "node_directions", 0);
-                        top_directions->contents.list[D_next]
+                        top_directions->list[D_next]
                           = top_node_section_child;
                         if (top_node_section_child->args.number <= 1)
                           {
-                            const ELEMENT *top_section_child_directions
+                            const ELEMENT_LIST *top_section_child_directions
                              = lookup_extra_directions (top_node_section_child,
                                                          "node_directions");
                             if (!top_section_child_directions)
                               top_section_child_directions
                                 = add_extra_directions (top_node_section_child,
                                                       "node_directions", 0);
-                            top_section_child_directions->contents.list[D_prev]
+                            top_section_child_directions->list[D_prev]
                               = node;
                           }
                       }
@@ -1469,13 +1466,13 @@ nodes_tree (DOCUMENT *document)
                                                      "manual_content");
               if (manual_content)
                 {
-                  const ELEMENT *node_directions
+                  const ELEMENT_LIST *node_directions
                          = lookup_extra_directions (node,
                                                     "node_directions");
                   if (!node_directions)
                     node_directions = add_extra_directions (node,
                                                       "node_directions", 0);
-                  node_directions->contents.list[direction]
+                  node_directions->list[direction]
                       = direction_element;
                 }
               else
@@ -1489,13 +1486,13 @@ nodes_tree (DOCUMENT *document)
                                                   direction_normalized);
                       if (node_target)
                         {
-                          const ELEMENT *node_directions
+                          const ELEMENT_LIST *node_directions
                             = lookup_extra_directions (node,
                                                     "node_directions");
                           if (!node_directions)
                             node_directions = add_extra_directions (node,
                                                       "node_directions", 0);
-                          node_directions->contents.list[direction]
+                          node_directions->list[direction]
                             = node_target;
                           if ((!options)
                                || options->novalidate.integer <= 0)
@@ -1678,12 +1675,12 @@ number_floats (DOCUMENT *document)
             {
               while (1)
                 {
-                  const ELEMENT *section_directions
+                  const ELEMENT_LIST *section_directions
                     = lookup_extra_directions (up, "section_directions");
                   if (section_directions
-                      && section_directions->contents.list[D_up])
+                      && section_directions->list[D_up])
                     {
-                      ELEMENT *up_elt = 
section_directions->contents.list[D_up];
+                      ELEMENT *up_elt = section_directions->list[D_up];
                       if (up_elt->cmd
                           && command_structuring_level[up_elt->cmd] > 0)
                         {



reply via email to

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