texinfo-commits
[Top][All Lists]
Advanced

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

[no subject]


From: Patrice Dumas
Date: Wed, 22 Feb 2023 03:52:51 -0500 (EST)

branch: master
commit 4cc2571eb00bfd078b76dd3390d1584608f5f360
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Wed Feb 22 09:45:31 2023 +0100

    * tp/Texinfo/XS/Makefile.am (Parsetexi_la_SOURCES),
    tp/Texinfo/XS/parsetexi/debug.h, tp/Texinfo/XS/parsetexi/api.c,
    tp/Texinfo/XS/parsetexi/close.c,
    tp/Texinfo/XS/parsetexi/context_stack.c,
    tp/Texinfo/XS/parsetexi/debug.c, tp/Texinfo/XS/parsetexi/end_line.c,
    tp/Texinfo/XS/parsetexi/handle_commands.c,
    tp/Texinfo/XS/parsetexi/macro.c, tp/Texinfo/XS/parsetexi/menus.c,
    tp/Texinfo/XS/parsetexi/parser.c, tp/Texinfo/XS/parsetexi/parser.h,
    tp/Texinfo/XS/parsetexi/separator.c,
    tp/Texinfo/XS/parsetexi/source_marks.c,
    tp/Texinfo/XS/parsetexi/end_line.c, tp/Texinfo/XS/parsetexi/input.c:
    add a separate include fle for debug.c.  More include of header files
    when the code declared in these header files is directly used.
    
    * tp/Texinfo/XS/parsetexi/input.c (next_text): add a debug statement
    if a source mark was missed, more similar code as in the perl parser.
---
 ChangeLog                                 | 19 +++++++++++++++++++
 tp/Texinfo/XS/Makefile.am                 |  1 +
 tp/Texinfo/XS/parsetexi/api.c             |  3 +++
 tp/Texinfo/XS/parsetexi/close.c           |  1 +
 tp/Texinfo/XS/parsetexi/context_stack.c   |  5 ++++-
 tp/Texinfo/XS/parsetexi/debug.c           |  3 ++-
 tp/Texinfo/XS/parsetexi/debug.h           | 26 ++++++++++++++++++++++++++
 tp/Texinfo/XS/parsetexi/end_line.c        |  1 +
 tp/Texinfo/XS/parsetexi/handle_commands.c |  2 ++
 tp/Texinfo/XS/parsetexi/input.c           | 31 +++++++++++++++++++------------
 tp/Texinfo/XS/parsetexi/macro.c           |  2 ++
 tp/Texinfo/XS/parsetexi/menus.c           |  1 +
 tp/Texinfo/XS/parsetexi/parser.c          |  1 +
 tp/Texinfo/XS/parsetexi/parser.h          | 10 ++--------
 tp/Texinfo/XS/parsetexi/separator.c       |  1 +
 tp/Texinfo/XS/parsetexi/source_marks.c    |  3 ++-
 16 files changed, 87 insertions(+), 23 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 6f13ad9dea..101044c710 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,22 @@
+2023-02-22  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/XS/Makefile.am (Parsetexi_la_SOURCES),
+       tp/Texinfo/XS/parsetexi/debug.h, tp/Texinfo/XS/parsetexi/api.c,
+       tp/Texinfo/XS/parsetexi/close.c,
+       tp/Texinfo/XS/parsetexi/context_stack.c,
+       tp/Texinfo/XS/parsetexi/debug.c, tp/Texinfo/XS/parsetexi/end_line.c,
+       tp/Texinfo/XS/parsetexi/handle_commands.c,
+       tp/Texinfo/XS/parsetexi/macro.c, tp/Texinfo/XS/parsetexi/menus.c,
+       tp/Texinfo/XS/parsetexi/parser.c, tp/Texinfo/XS/parsetexi/parser.h,
+       tp/Texinfo/XS/parsetexi/separator.c,
+       tp/Texinfo/XS/parsetexi/source_marks.c,
+       tp/Texinfo/XS/parsetexi/end_line.c, tp/Texinfo/XS/parsetexi/input.c:
+       add a separate include fle for debug.c.  More include of header files
+       when the code declared in these header files is directly used.
+
+       * tp/Texinfo/XS/parsetexi/input.c (next_text): add a debug statement
+       if a source mark was missed, more similar code as in the perl parser.
+
 2023-02-21  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/ParserNonXS.pm (_process_remaining_on_line),
diff --git a/tp/Texinfo/XS/Makefile.am b/tp/Texinfo/XS/Makefile.am
index 43008b3314..2eb2df5a3b 100644
--- a/tp/Texinfo/XS/Makefile.am
+++ b/tp/Texinfo/XS/Makefile.am
@@ -120,6 +120,7 @@ Parsetexi_la_SOURCES= parsetexi/Parsetexi.c \
                      parsetexi/context_stack.c \
                      parsetexi/context_stack.h \
                      parsetexi/debug.c \
+                     parsetexi/debug.h \
                      parsetexi/convert.c \
                      parsetexi/convert.h \
                      parsetexi/end_line.c \
diff --git a/tp/Texinfo/XS/parsetexi/api.c b/tp/Texinfo/XS/parsetexi/api.c
index 8d102ad12d..3892087575 100644
--- a/tp/Texinfo/XS/parsetexi/api.c
+++ b/tp/Texinfo/XS/parsetexi/api.c
@@ -38,10 +38,13 @@
 #include <string.h>
 
 #include "parser.h"
+#include "debug.h"
+#include "tree.h"
 #include "input.h"
 #include "source_marks.h"
 #include "labels.h"
 #include "indices.h"
+#include "errors.h"
 #include "api.h"
 
 ELEMENT *Root;
diff --git a/tp/Texinfo/XS/parsetexi/close.c b/tp/Texinfo/XS/parsetexi/close.c
index 4f19dc4cd1..e877cfa4d9 100644
--- a/tp/Texinfo/XS/parsetexi/close.c
+++ b/tp/Texinfo/XS/parsetexi/close.c
@@ -19,6 +19,7 @@
 #include <string.h>
 
 #include "parser.h"
+#include "debug.h"
 #include "source_marks.h"
 
 /* Return CURRENT->parent.  The other arguments are used if an error message
diff --git a/tp/Texinfo/XS/parsetexi/context_stack.c 
b/tp/Texinfo/XS/parsetexi/context_stack.c
index d65951a24b..cfeb14abb3 100644
--- a/tp/Texinfo/XS/parsetexi/context_stack.c
+++ b/tp/Texinfo/XS/parsetexi/context_stack.c
@@ -16,7 +16,10 @@
 #include <config.h>
 #include <stdlib.h>
 
-#include "parser.h"
+#include "debug.h"
+#include "context_stack.h"
+#include "commands.h"
+#include "errors.h"
 
 static enum context *context_stack;
 static size_t top; /* One above last pushed context. */
diff --git a/tp/Texinfo/XS/parsetexi/debug.c b/tp/Texinfo/XS/parsetexi/debug.c
index e120f6a8f5..85acc0371d 100644
--- a/tp/Texinfo/XS/parsetexi/debug.c
+++ b/tp/Texinfo/XS/parsetexi/debug.c
@@ -18,7 +18,8 @@
 #include <stdio.h>
 #include <string.h>
 
-#include "parser.h"
+#include "debug.h"
+#include "commands.h"
 
 /* Whether to dump debugging output on stderr. */
 int debug_output = 0;
diff --git a/tp/Texinfo/XS/parsetexi/debug.h b/tp/Texinfo/XS/parsetexi/debug.h
new file mode 100644
index 0000000000..7b7664c2b5
--- /dev/null
+++ b/tp/Texinfo/XS/parsetexi/debug.h
@@ -0,0 +1,26 @@
+/* debug.h - declarations for debug.c */
+#ifndef DEBUG_H
+#define DEBUG_H
+/* Copyright 2023 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>. */
+
+#include "tree_types.h"
+
+void debug (char *s, ...);
+void debug_nonl (char *s, ...);
+extern int debug_output;
+void debug_print_element (ELEMENT *e, int print_parent);
+
+#endif
diff --git a/tp/Texinfo/XS/parsetexi/end_line.c 
b/tp/Texinfo/XS/parsetexi/end_line.c
index 2216da4f58..2b777dde66 100644
--- a/tp/Texinfo/XS/parsetexi/end_line.c
+++ b/tp/Texinfo/XS/parsetexi/end_line.c
@@ -20,6 +20,7 @@
 #include <ctype.h>
 
 #include "parser.h"
+#include "debug.h"
 #include "text.h"
 #include "input.h"
 #include "convert.h"
diff --git a/tp/Texinfo/XS/parsetexi/handle_commands.c 
b/tp/Texinfo/XS/parsetexi/handle_commands.c
index 875950c509..ca1bebe2cd 100644
--- a/tp/Texinfo/XS/parsetexi/handle_commands.c
+++ b/tp/Texinfo/XS/parsetexi/handle_commands.c
@@ -19,6 +19,8 @@
 #include <string.h>
 
 #include "parser.h"
+#include "debug.h"
+#include "tree.h"
 #include "input.h"
 #include "text.h"
 
diff --git a/tp/Texinfo/XS/parsetexi/input.c b/tp/Texinfo/XS/parsetexi/input.c
index d2afdaf1d4..b6b90e5f10 100644
--- a/tp/Texinfo/XS/parsetexi/input.c
+++ b/tp/Texinfo/XS/parsetexi/input.c
@@ -23,6 +23,7 @@
 #include <sys/stat.h>
 
 #include "errors.h"
+#include "debug.h"
 #include "input.h"
 #include "text.h"
 #include "commands.h"
@@ -522,22 +523,28 @@ next_text (ELEMENT *current)
             macro_expansion_nr--;
         }
 
-      if (input->input_source_mark && current)
+      if (input->input_source_mark)
         {
-          SOURCE_MARK *input_source_mark = input->input_source_mark;
-          SOURCE_MARK *end_include_source_mark;
-          if (input_source_mark->type == SM_type_delcomment)
-            end_include_source_mark = input_source_mark;
-          else
+          if (current)
             {
-              end_include_source_mark
-                = new_source_mark (input_source_mark->type);
-              end_include_source_mark->counter = input_source_mark->counter;
-              end_include_source_mark->status = SM_status_end;
+              SOURCE_MARK *input_source_mark = input->input_source_mark;
+              SOURCE_MARK *end_include_source_mark;
+              if (input_source_mark->type == SM_type_delcomment)
+                end_include_source_mark = input_source_mark;
+              else
+                {
+                  end_include_source_mark
+                    = new_source_mark (input_source_mark->type);
+                  end_include_source_mark->counter = 
input_source_mark->counter;
+                  end_include_source_mark->status = SM_status_end;
+                }
+              register_source_mark (current, end_include_source_mark);
             }
-          register_source_mark (current, end_include_source_mark);
-        }
+          else
+            debug ("INPUT MARK MISSED");
 
+          input->input_source_mark = 0;
+        }
       input_number--;
     }
   return 0;
diff --git a/tp/Texinfo/XS/parsetexi/macro.c b/tp/Texinfo/XS/parsetexi/macro.c
index bcba88e039..06ed26e826 100644
--- a/tp/Texinfo/XS/parsetexi/macro.c
+++ b/tp/Texinfo/XS/parsetexi/macro.c
@@ -19,11 +19,13 @@
 #include <ctype.h>
 
 #include "parser.h"
+#include "debug.h"
 #include "tree.h"
 #include "text.h"
 #include "input.h"
 #include "convert.h"
 #include "source_marks.h"
+#include "macro.h"
 
 static MACRO *macro_list;
 static size_t macro_number;
diff --git a/tp/Texinfo/XS/parsetexi/menus.c b/tp/Texinfo/XS/parsetexi/menus.c
index 54b32f444b..52c7f3eb1b 100644
--- a/tp/Texinfo/XS/parsetexi/menus.c
+++ b/tp/Texinfo/XS/parsetexi/menus.c
@@ -18,6 +18,7 @@
 #include <string.h>
 
 #include "parser.h"
+#include "debug.h"
 #include "input.h"
 #include "text.h"
 #include "convert.h"
diff --git a/tp/Texinfo/XS/parsetexi/parser.c b/tp/Texinfo/XS/parsetexi/parser.c
index 8bc86f3de8..ea741fba82 100644
--- a/tp/Texinfo/XS/parsetexi/parser.c
+++ b/tp/Texinfo/XS/parsetexi/parser.c
@@ -23,6 +23,7 @@
 #include "unistr.h"
 
 #include "parser.h"
+#include "debug.h"
 #include "text.h"
 #include "input.h"
 #include "source_marks.h"
diff --git a/tp/Texinfo/XS/parsetexi/parser.h b/tp/Texinfo/XS/parsetexi/parser.h
index 6b0a6d5205..dbda28372d 100644
--- a/tp/Texinfo/XS/parsetexi/parser.h
+++ b/tp/Texinfo/XS/parsetexi/parser.h
@@ -1,5 +1,5 @@
-/* parser.h - include many other header files.  type declarations.  
-   declarations for close.c, end_line.c, debug.c, separator.c, parser.c, 
+/* parser.h - include many other header files.  type declarations.
+   declarations for close.c, end_line.c, separator.c, parser.c,
    multitable.c, extra.c and menu.c. */
 
 #ifndef PARSER_H
@@ -144,12 +144,6 @@ extern FLOAT_RECORD *floats_list;
 extern size_t floats_number;
 extern size_t floats_space;
 
-/* In debug.c */
-void debug (char *s, ...);
-void debug_nonl (char *s, ...);
-extern int debug_output;
-void debug_print_element (ELEMENT *e, int print_parent);
-
 
 /* In separator.c */
 ELEMENT *handle_separator (ELEMENT *current, char separator,
diff --git a/tp/Texinfo/XS/parsetexi/separator.c 
b/tp/Texinfo/XS/parsetexi/separator.c
index 5544d8ee9d..5e84539887 100644
--- a/tp/Texinfo/XS/parsetexi/separator.c
+++ b/tp/Texinfo/XS/parsetexi/separator.c
@@ -19,6 +19,7 @@
 #include <stdio.h>
 
 #include "parser.h"
+#include "debug.h"
 #include "text.h"
 #include "convert.h"
 #include "input.h"
diff --git a/tp/Texinfo/XS/parsetexi/source_marks.c 
b/tp/Texinfo/XS/parsetexi/source_marks.c
index 4021761b37..67030ddc00 100644
--- a/tp/Texinfo/XS/parsetexi/source_marks.c
+++ b/tp/Texinfo/XS/parsetexi/source_marks.c
@@ -15,10 +15,11 @@
 
 #include <string.h>
 
+#include "parser.h"
+#include "debug.h"
 #include "source_marks.h"
 #include "tree.h"
 #include "errors.h"
-#include "parser.h"
 
 int include_counter = 0;
 int setfilename_counter = 0;



reply via email to

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