texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: * tp/Texinfo/XS/parsetexi/parser.c (parse_texi):


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/XS/parsetexi/parser.c (parse_texi): set a document variable to keep track of the parsed document when the global variable is overwritten.
Date: Sat, 18 May 2024 16:30:44 -0400

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 5ae05b3fa8 * tp/Texinfo/XS/parsetexi/parser.c (parse_texi): set a 
document variable to keep track of the parsed document when the global variable 
is overwritten.
5ae05b3fa8 is described below

commit 5ae05b3fa89a594a10c7c32e2efccb30395084da
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sat May 18 22:30:46 2024 +0200

    * tp/Texinfo/XS/parsetexi/parser.c (parse_texi): set a document
    variable to keep track of the parsed document when the global variable
    is overwritten.
    
    * tp/Texinfo/XS/parsetexi/indices.c (complete_indices),
    tp/Texinfo/XS/parsetexi/parser.c (parse_texi): use a DOCUMENT in
    complete_indices call.
---
 ChangeLog                         | 10 ++++++++++
 tp/Texinfo/XS/main/tree.c         |  2 +-
 tp/Texinfo/XS/parsetexi/api.c     |  4 ++--
 tp/Texinfo/XS/parsetexi/indices.c |  4 +---
 tp/Texinfo/XS/parsetexi/indices.h |  3 ++-
 tp/Texinfo/XS/parsetexi/parser.c  | 22 ++++++++++------------
 6 files changed, 26 insertions(+), 19 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 7e0c723d1c..b44f9626b8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2024-05-18  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/XS/parsetexi/parser.c (parse_texi): set a document
+       variable to keep track of the parsed document when the global variable
+       is overwritten.
+
+       * tp/Texinfo/XS/parsetexi/indices.c (complete_indices),
+       tp/Texinfo/XS/parsetexi/parser.c (parse_texi): use a DOCUMENT in
+       complete_indices call.
+
 2024-05-18  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/XS/main/document.c (new_document)
diff --git a/tp/Texinfo/XS/main/tree.c b/tp/Texinfo/XS/main/tree.c
index 1cfddc129c..624ae1697c 100644
--- a/tp/Texinfo/XS/main/tree.c
+++ b/tp/Texinfo/XS/main/tree.c
@@ -23,7 +23,7 @@
  be allocated on the heap and be available in the parser.  It could
  also be passed to the parsed document but it seems complicated to
  make it available to alloc_element outside of the parser (more
- precisely after a call to store_document), in code related to
+ precisely after parse_texi has returned), in code related to
  tree modification and conversion.
 
  If obstack is used again, in addition to the obvious changes,
diff --git a/tp/Texinfo/XS/parsetexi/api.c b/tp/Texinfo/XS/parsetexi/api.c
index 71eeb83589..3b256f8927 100644
--- a/tp/Texinfo/XS/parsetexi/api.c
+++ b/tp/Texinfo/XS/parsetexi/api.c
@@ -45,12 +45,12 @@
 #include "conf.h"
 #include "api.h"
 
-/* When reset_parser_except_conf is called in parse_*, store_document will
+/* When reset_parser_except_conf is called in parse_*, parse_texi will
    be called afterwards.
    When reset_parser_except_conf is called by reset_parser in parser
    initialization, however, there will be a call to parse_* afterwards
    leading to calling reset_parser_except_conf again without a call to
-   store_document inbetween.
+   parse_texi inbetween.
  */
 void
 reset_parser_except_conf (void)
diff --git a/tp/Texinfo/XS/parsetexi/indices.c 
b/tp/Texinfo/XS/parsetexi/indices.c
index b572c3f31b..fee42cb115 100644
--- a/tp/Texinfo/XS/parsetexi/indices.c
+++ b/tp/Texinfo/XS/parsetexi/indices.c
@@ -368,13 +368,11 @@ resolve_indices_merged_in (const INDEX_LIST *indices_info)
    Done in a separate function and not inside the main parser loop because
    it requires parsing Texinfo code in gdt_tree too */
 void
-complete_indices (int document_descriptor, int debug_level)
+complete_indices (DOCUMENT *document, int debug_level)
 {
-  DOCUMENT *document;
   INDEX_LIST *indices;
   size_t i;
 
-  document = retrieve_document (document_descriptor);
   indices = &document->indices_info;
 
   for (i = 0; i < indices->number; i++)
diff --git a/tp/Texinfo/XS/parsetexi/indices.h 
b/tp/Texinfo/XS/parsetexi/indices.h
index 58175932dd..c4215939ec 100644
--- a/tp/Texinfo/XS/parsetexi/indices.h
+++ b/tp/Texinfo/XS/parsetexi/indices.h
@@ -3,6 +3,7 @@
 #define INDICES_H
 
 #include "tree_types.h"
+#include "document_types.h"
 
 void init_index_commands (void);
 
@@ -15,6 +16,6 @@ void set_non_ignored_space_in_index_before_command (ELEMENT 
*content);
 void forget_indices (void);
 
 void resolve_indices_merged_in (const INDEX_LIST *indices_info);
-void complete_indices (int document_descriptor, int debug_level);
+void complete_indices (DOCUMENT *document, int debug_level);
 
 #endif
diff --git a/tp/Texinfo/XS/parsetexi/parser.c b/tp/Texinfo/XS/parsetexi/parser.c
index 3ecf7f7b40..3af7f51d9b 100644
--- a/tp/Texinfo/XS/parsetexi/parser.c
+++ b/tp/Texinfo/XS/parsetexi/parser.c
@@ -2504,10 +2504,10 @@ int
 parse_texi (ELEMENT *root_elt, ELEMENT *current_elt)
 {
   ELEMENT *current = current_elt;
-  int document_descriptor;
   static char *allocated_line;
   char *line;
   int status;
+  DOCUMENT *document = parsed_document;
 
   /* done here and not in reset_parser_except_conf as usually done
      as restricted is set after reset_parser_except_conf and before
@@ -2660,22 +2660,20 @@ parse_texi (ELEMENT *root_elt, ELEMENT *current_elt)
 
   /* update merged_in.  Only needed for merging happening after first
      index merge */
-  resolve_indices_merged_in (&parsed_document->indices_info);
-
-  set_labels_identifiers_target (&parsed_document->labels_list,
-                                 &parsed_document->identifiers_target);
-
-  parsed_document->tree = current;
+  resolve_indices_merged_in (&document->indices_info);
 
-  float_list_to_listoffloats_list (&parsed_document->floats,
-                                   &parsed_document->listoffloats);
+  set_labels_identifiers_target (&document->labels_list,
+                                 &document->identifiers_target);
 
-  document_descriptor = parsed_document->descriptor;
+  document->tree = current;
 
-  complete_indices (document_descriptor, debug_output);
+  float_list_to_listoffloats_list (&document->floats,
+                                   &document->listoffloats);
 
   parsed_document = 0;
   forget_indices ();
 
-  return document_descriptor;
+  complete_indices (document, debug_output);
+
+  return document->descriptor;
 }



reply via email to

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