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, 28 Sep 2024 15:54:37 -0400 (EDT)

branch: master
commit ff6bdbe123e67f0122206d1826163c77d42e65a6
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sat Jun 1 10:49:46 2024 +0200

    * tp/Texinfo/XS/parsetexi/indices.c (enter_index_entry),
    tp/Texinfo/XS/structuring_transfo/transformations.c
    (relate_index_entries_to_table_items_in): set type as ET_other_text
    instead of ET_NONE.
    
    * tp/Texinfo/XS/main/build_perl_info.c (build_additional_info),
    tp/Texinfo/XS/main/debug.c (print_associate_info_debug),
    tp/Texinfo/XS/main/manipulate_tree.c (associate_info_references):
    always use text element with type ET_other_text in extra_misc_args.
    Use the type to determine if the element represents text or an
    integer.
---
 ChangeLog                                          | 14 ++++++++++
 tp/TODO                                            |  7 -----
 tp/Texinfo/XS/main/build_perl_info.c               | 30 ++++++++++++----------
 tp/Texinfo/XS/main/debug.c                         | 12 ++++++---
 tp/Texinfo/XS/main/manipulate_tree.c               | 20 ++++++++++-----
 tp/Texinfo/XS/parsetexi/indices.c                  |  5 ++--
 .../XS/structuring_transfo/transformations.c       |  2 +-
 7 files changed, 56 insertions(+), 34 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 55ef0e1c52..227e250125 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -11,6 +11,20 @@
 
        * NEWS, doc/info-stnd.texi (Custom Key Bindings): update.
 
+2024-05-31  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/XS/parsetexi/indices.c (enter_index_entry),
+       tp/Texinfo/XS/structuring_transfo/transformations.c
+       (relate_index_entries_to_table_items_in): set type as ET_other_text
+       instead of ET_NONE.
+
+       * tp/Texinfo/XS/main/build_perl_info.c (build_additional_info),
+       tp/Texinfo/XS/main/debug.c (print_associate_info_debug),
+       tp/Texinfo/XS/main/manipulate_tree.c (associate_info_references):
+       always use text element with type ET_other_text in extra_misc_args.
+       Use the type to determine if the element represents text or an
+       integer.
+
 2024-05-31  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/XS/main/debug.c (print_element_debug): text element never
diff --git a/tp/TODO b/tp/TODO
index 75dff2ea36..9e2a43c5c6 100644
--- a/tp/TODO
+++ b/tp/TODO
@@ -93,13 +93,6 @@ ELEMENT *elements[3]
     EXCEPTION: needed transient _copy and _counter in copy_tree_internal in 
extra
     EXCEPTION: info inserted for spaces in @def* for definition aliases
   
-type_data[->type].flags & TF_text
-main
-  build_perl_info.c
-    extra_misc_args contents.list[j]->text.end > 0
-  manipulate_tree.c
-    associate_info_references extra_misc_args
-
 
 valgrinf massif useful-heap approximate distribution in 2024
 valgrind --tool=massif perl -w texi2any.pl ../doc/texinfo.texi
diff --git a/tp/Texinfo/XS/main/build_perl_info.c 
b/tp/Texinfo/XS/main/build_perl_info.c
index 41ad4926e0..e2c44af7e8 100644
--- a/tp/Texinfo/XS/main/build_perl_info.c
+++ b/tp/Texinfo/XS/main/build_perl_info.c
@@ -396,23 +396,27 @@ build_additional_info (HV *extra, const ASSOCIATED_INFO 
*a,
               /* An array of strings or integers. */
               for (j = 0; j < f->contents.number; j++)
                 {
-                  const KEY_PAIR *k_integer;
-                  k_integer = lookup_extra (f->contents.list[j], "integer");
-                  if (k_integer)
+                  const ELEMENT *e = f->contents.list[j];
+                  if (e->type == ET_other_text)
                     {
-                      IV value = (IV) (intptr_t) k_integer->k.integer;
-                      av_store (av, j, newSViv (value));
-                    }
-                  else if (f->contents.list[j]->text.end > 0)
-                    {
-                      SV *sv = newSVpv_utf8 (f->contents.list[j]->text.text,
-                                             f->contents.list[j]->text.end);
-                      av_store (av, j, sv);
+                      if (e->text.end > 0)
+                        {
+                          SV *sv = newSVpv_utf8 (e->text.text, e->text.end);
+                          av_store (av, j, sv);
+                        }
+                      else
+                        /* Empty strings permitted. */
+                        av_store (av, j, newSVpv ("", 0));
                     }
                   else
                     {
-                      /* Empty strings permitted. */
-                      av_store (av, j, newSVpv ("", 0));
+                      const KEY_PAIR *k_integer;
+                      k_integer = lookup_extra (e, "integer");
+                      if (k_integer)
+                        {
+                          IV value = (IV) k_integer->k.integer;
+                          av_store (av, j, newSViv (value));
+                        }
                     }
                 }
               break;
diff --git a/tp/Texinfo/XS/main/debug.c b/tp/Texinfo/XS/main/debug.c
index 43d4ffca19..61461c29ea 100644
--- a/tp/Texinfo/XS/main/debug.c
+++ b/tp/Texinfo/XS/main/debug.c
@@ -160,11 +160,15 @@ print_associate_info_debug (const ASSOCIATED_INFO *info)
             text_append (&text, "array: ");
             for (j = 0; j < f->contents.number; j++)
               {
-                KEY_PAIR *k_integer = lookup_extra (f->contents.list[j], 
"integer");
-                if (k_integer)
-                  text_printf (&text, "%d|", k_integer->k.integer);
+                const ELEMENT *e = f->contents.list[j];
+                if (e->type == ET_other_text)
+                  text_printf (&text, "%s|", e->text.text);
                 else
-                  text_printf (&text, "%s|", f->contents.list[j]->text.text);
+                  {
+                    KEY_PAIR *k_integer = lookup_extra (e, "integer");
+                    if (k_integer)
+                      text_printf (&text, "%d|", k_integer->k.integer);
+                  }
               }
             break;
            }
diff --git a/tp/Texinfo/XS/main/manipulate_tree.c 
b/tp/Texinfo/XS/main/manipulate_tree.c
index 6ea0c26b75..0a53759be3 100644
--- a/tp/Texinfo/XS/main/manipulate_tree.c
+++ b/tp/Texinfo/XS/main/manipulate_tree.c
@@ -329,18 +329,24 @@ associate_info_references (ASSOCIATED_INFO *info, 
ASSOCIATED_INFO *new_info)
           k->k.element = new_extra_element;
           for (j = 0; j < f->contents.number; j++)
             {
-              ELEMENT *e = new_element (ET_NONE);
-              KEY_PAIR *k_integer = lookup_extra (f->contents.list[j], 
"integer");
-              if (k_integer)
+              const ELEMENT *e = f->contents.list[j];
+              ELEMENT *new_e;
+              if (e->type == ET_other_text)
                 {
-                  add_extra_integer (e, "integer", k_integer->k.integer);
+                  new_e = new_element (ET_other_text);
+                  if (e->text.end > 0)
+                    text_append_n (&new_e->text, e->text.text, e->text.end);
                 }
               else
                 {
-                  if (f->contents.list[j]->text.space > 0)
-                    text_append (&e->text, f->contents.list[j]->text.text);
+                  new_e = new_element (ET_NONE);
+                  KEY_PAIR *k_integer = lookup_extra (e, "integer");
+                  if (k_integer)
+                    {
+                      add_extra_integer (new_e, "integer", 
k_integer->k.integer);
+                    }
                 }
-              add_to_contents_as_array (new_extra_element, e);
+              add_to_contents_as_array (new_extra_element, new_e);
             }
           break;
           }
diff --git a/tp/Texinfo/XS/parsetexi/indices.c 
b/tp/Texinfo/XS/parsetexi/indices.c
index 51ec44be50..8110c13fd2 100644
--- a/tp/Texinfo/XS/parsetexi/indices.c
+++ b/tp/Texinfo/XS/parsetexi/indices.c
@@ -287,9 +287,10 @@ enter_index_entry (enum command_id index_type_cmd,
   /* index_entry is an array with two elements.  Use
      extra_misc_args to pass that information as an array */
   {
-    ELEMENT *index_entry = new_element (ET_NONE);
     /* element without type put in extra "misc_args" */
-    ELEMENT *e = new_element (ET_NONE);
+    ELEMENT *index_entry = new_element (ET_NONE);
+    /* index name put as text in extra "misc_args" */
+    ELEMENT *e = new_element (ET_other_text);
     text_append (&e->text, idx->name);
     add_to_element_contents (index_entry, e);
     e = new_element (ET_NONE);
diff --git a/tp/Texinfo/XS/structuring_transfo/transformations.c 
b/tp/Texinfo/XS/structuring_transfo/transformations.c
index 44c4db8c00..29714ba8c7 100644
--- a/tp/Texinfo/XS/structuring_transfo/transformations.c
+++ b/tp/Texinfo/XS/structuring_transfo/transformations.c
@@ -402,7 +402,7 @@ relate_index_entries_to_table_items_in (ELEMENT *table,
               if (item && entry_idx_info)
                 {
                   ELEMENT *index_entry_command = new_element (ET_NONE);
-                  ELEMENT *e = new_element (ET_NONE);
+                  ELEMENT *e = new_element (ET_other_text);
                  /*
                   This is better than overwriting 'entry_element', which
                   holds important information.



reply via email to

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