texinfo-commits
[Top][All Lists]
Advanced

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

[no subject]


From: Patrice Dumas
Date: Sun, 29 Sep 2024 08:50:02 -0400 (EDT)

branch: master
commit 76032f20cbf8be16a802b90af4d820a6308f696b
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Wed Jun 26 16:04:03 2024 +0200

    * tp/Texinfo/XS/convert/convert_html.c (html_default_format_contents),
    tp/Texinfo/XS/main/extra.c (lookup_extra_element)
    (lookup_extra_element_oot), tp/Texinfo/XS/main/manipulate_indices.c
    (index_content_element), tp/Texinfo/XS/parsetexi/indices.c
    (complete_indices): add lookup_extra_element_oot and use it
    exclusively for extra_element_oot.  Modify lookup_extra_element to
    accept only extra_element and extra_container.
---
 ChangeLog                               | 10 ++++++++++
 tp/Texinfo/XS/convert/convert_html.c    |  2 +-
 tp/Texinfo/XS/main/extra.c              | 21 +++++++++++++++++++--
 tp/Texinfo/XS/main/extra.h              |  1 +
 tp/Texinfo/XS/main/manipulate_indices.c |  4 ++--
 tp/Texinfo/XS/parsetexi/indices.c       |  4 ++--
 6 files changed, 35 insertions(+), 7 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index c869229ee8..af580f72f1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2024-06-26  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/XS/convert/convert_html.c (html_default_format_contents),
+       tp/Texinfo/XS/main/extra.c (lookup_extra_element)
+       (lookup_extra_element_oot), tp/Texinfo/XS/main/manipulate_indices.c
+       (index_content_element), tp/Texinfo/XS/parsetexi/indices.c
+       (complete_indices): add lookup_extra_element_oot and use it
+       exclusively for extra_element_oot.  Modify lookup_extra_element to
+       accept only extra_element and extra_container.
+
 2024-06-26  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/ParserNonXS.pm (_end_line_def_line),
diff --git a/tp/Texinfo/XS/convert/convert_html.c 
b/tp/Texinfo/XS/convert/convert_html.c
index f4307fd745..3af62e3642 100644
--- a/tp/Texinfo/XS/convert/convert_html.c
+++ b/tp/Texinfo/XS/convert/convert_html.c
@@ -6362,7 +6362,7 @@ html_default_format_contents (CONVERTER *self, const enum 
command_id cmd,
       && self->document->sections_list->number > 0)
     {
       const ELEMENT *first = self->document->sections_list->list[0];
-      section_root = lookup_extra_element (first, AI_key_sectioning_root);
+      section_root = lookup_extra_element_oot (first, AI_key_sectioning_root);
       /* this should not happen with $sections_list as set from Structuring
          sectioning_structure, but could happen with another source.
          We consider that if sectioning_root is set as usual, all the
diff --git a/tp/Texinfo/XS/main/extra.c b/tp/Texinfo/XS/main/extra.c
index fb9a244179..22bcf26109 100644
--- a/tp/Texinfo/XS/main/extra.c
+++ b/tp/Texinfo/XS/main/extra.c
@@ -200,8 +200,25 @@ lookup_extra_element (const ELEMENT *e, enum ai_key_name 
key)
   k = lookup_associated_info (&e->e.c->extra_info, key);
   if (!k)
     return 0;
-  else if (k->type == extra_string || k->type == extra_integer
-           || k->type == extra_contents || k->type == extra_directions)
+  else if (k->type != extra_element && k->type != extra_container)
+    {
+      char *msg;
+      xasprintf (&msg, "Bad type for lookup_extra_element: %s: %d",
+                ai_key_names[key], k->type);
+      fatal (msg);
+      free (msg);
+    }
+  return k->k.element;
+}
+
+ELEMENT *
+lookup_extra_element_oot (const ELEMENT *e, enum ai_key_name key)
+{
+  const KEY_PAIR *k;
+  k = lookup_associated_info (&e->e.c->extra_info, key);
+  if (!k)
+    return 0;
+  else if (k->type != extra_element_oot)
     {
       char *msg;
       xasprintf (&msg, "Bad type for lookup_extra_element: %s: %d",
diff --git a/tp/Texinfo/XS/main/extra.h b/tp/Texinfo/XS/main/extra.h
index e1fadcbf40..5c832ec2c2 100644
--- a/tp/Texinfo/XS/main/extra.h
+++ b/tp/Texinfo/XS/main/extra.h
@@ -33,6 +33,7 @@ void add_extra_string_dup (ELEMENT *e, enum ai_key_name key, 
const char *value);
 void add_extra_integer (ELEMENT *e, enum ai_key_name key, int value);
 KEY_PAIR *lookup_extra (const ELEMENT *e, enum ai_key_name key);
 ELEMENT *lookup_extra_element (const ELEMENT *e, enum ai_key_name key);
+ELEMENT *lookup_extra_element_oot (const ELEMENT *e, enum ai_key_name key);
 ELEMENT_LIST *lookup_extra_contents (const ELEMENT *e, enum ai_key_name key);
 const STRING_LIST *lookup_extra_misc_args (const ELEMENT *e,
                                            enum ai_key_name key);
diff --git a/tp/Texinfo/XS/main/manipulate_indices.c 
b/tp/Texinfo/XS/main/manipulate_indices.c
index 34f61d80ce..d41ac2246a 100644
--- a/tp/Texinfo/XS/main/manipulate_indices.c
+++ b/tp/Texinfo/XS/main/manipulate_indices.c
@@ -190,12 +190,12 @@ index_content_element (const ELEMENT *element, int 
prefer_reference_element)
      if (prefer_reference_element)
        {
          ELEMENT *def_index_ref_element
-           = lookup_extra_element (element, AI_key_def_index_ref_element);
+           = lookup_extra_element_oot (element, AI_key_def_index_ref_element);
          if (def_index_ref_element)
            return def_index_ref_element;
        }
      def_index_element
-       = lookup_extra_element (element, AI_key_def_index_element);
+       = lookup_extra_element_oot (element, AI_key_def_index_element);
      return def_index_element;
    }
   else
diff --git a/tp/Texinfo/XS/parsetexi/indices.c 
b/tp/Texinfo/XS/parsetexi/indices.c
index 5051b19bdc..bcf164075d 100644
--- a/tp/Texinfo/XS/parsetexi/indices.c
+++ b/tp/Texinfo/XS/parsetexi/indices.c
@@ -399,8 +399,8 @@ complete_indices (DOCUMENT *document, int debug_level)
               def_cmdname = lookup_extra_string (main_entry_element,
                                                  AI_key_def_command);
 
-              idx_element = lookup_extra_element (main_entry_element,
-                                                  AI_key_def_index_element);
+              idx_element = lookup_extra_element_oot (main_entry_element,
+                                                      
AI_key_def_index_element);
               if (def_cmdname && !idx_element)
                 {
                   ELEMENT *name = 0;



reply via email to

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