texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: Replace debug_output by conf.debug


From: Patrice Dumas
Subject: branch master updated: Replace debug_output by conf.debug
Date: Sun, 19 May 2024 17:04:39 -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 da0bd6823b Replace debug_output by conf.debug
da0bd6823b is described below

commit da0bd6823b384a3eee62ca24ab42cc43d6c47be5
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sun May 19 23:04:41 2024 +0200

    Replace debug_output by conf.debug
    
    * tp/Texinfo/XS/main/translations.c (replace_convert_substrings),
    tp/Texinfo/XS/parsetexi/Parsetexi.pm (parser),
    tp/Texinfo/XS/parsetexi/Parsetexi.xs (conf_set_DEBUG),
    tp/Texinfo/XS/parsetexi/api.c, tp/Texinfo/XS/parsetexi/conf.c
    (conf_set_DEBUG, reset_conf), tp/Texinfo/XS/parsetexi/conf.h (CONF),
    tp/Texinfo/XS/parsetexi/debug_parser.c,
    tp/Texinfo/XS/parsetexi/errors_parser.c (line_error_internal),
    tp/Texinfo/XS/parsetexi/parser.c (complete_indices): add debug field
    in CONF, add conf_set_DEBUG function to set it, and replace
    debug_output by conf.debug.  Remove set_debug_output and
    parser_set_debug.
---
 ChangeLog                               | 16 ++++++++++++++++
 tp/Texinfo/XS/main/translations.c       |  5 ++---
 tp/Texinfo/XS/parsetexi/Parsetexi.pm    |  2 +-
 tp/Texinfo/XS/parsetexi/Parsetexi.xs    |  4 ++--
 tp/Texinfo/XS/parsetexi/api.c           |  7 -------
 tp/Texinfo/XS/parsetexi/api.h           |  1 -
 tp/Texinfo/XS/parsetexi/conf.c          | 11 ++++++++++-
 tp/Texinfo/XS/parsetexi/conf.h          |  5 ++++-
 tp/Texinfo/XS/parsetexi/debug_parser.c  | 24 +++++++-----------------
 tp/Texinfo/XS/parsetexi/debug_parser.h  |  3 ---
 tp/Texinfo/XS/parsetexi/errors_parser.c |  4 +---
 tp/Texinfo/XS/parsetexi/parser.c        |  2 +-
 12 files changed, 44 insertions(+), 40 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index a62dcf4e07..96aeec0324 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2024-05-19  Patrice Dumas  <pertusus@free.fr>
+
+       Replace debug_output by conf.debug
+
+       * tp/Texinfo/XS/main/translations.c (replace_convert_substrings),
+       tp/Texinfo/XS/parsetexi/Parsetexi.pm (parser),
+       tp/Texinfo/XS/parsetexi/Parsetexi.xs (conf_set_DEBUG),
+       tp/Texinfo/XS/parsetexi/api.c, tp/Texinfo/XS/parsetexi/conf.c
+       (conf_set_DEBUG, reset_conf), tp/Texinfo/XS/parsetexi/conf.h (CONF),
+       tp/Texinfo/XS/parsetexi/debug_parser.c,
+       tp/Texinfo/XS/parsetexi/errors_parser.c (line_error_internal),
+       tp/Texinfo/XS/parsetexi/parser.c (complete_indices): add debug field
+       in CONF, add conf_set_DEBUG function to set it, and replace
+       debug_output by conf.debug.  Remove set_debug_output and
+       parser_set_debug.
+
 2024-05-19  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/XS/parsetexi/api.c (initialize_parsing): rename
diff --git a/tp/Texinfo/XS/main/translations.c 
b/tp/Texinfo/XS/main/translations.c
index 8a8489462f..ca6ca9da5c 100644
--- a/tp/Texinfo/XS/main/translations.c
+++ b/tp/Texinfo/XS/main/translations.c
@@ -34,7 +34,6 @@
 #include "text.h"
 #include "utils.h"
 #include "tree.h"
-#include "errors_parser.h"
 #include "debug.h"
 #include "conf.h"
 #include "api.h"
@@ -470,7 +469,7 @@ replace_convert_substrings (char *translated_string,
   if (debug_level > 0)
     parser_debug_level = debug_level - 1;
 
-  previous_debug_level = parser_set_debug (parser_debug_level);
+  previous_debug_level = conf_set_DEBUG (parser_debug_level);
 
   /*
    accept @txiinternalvalue as a valid Texinfo command, used to mark
@@ -501,7 +500,7 @@ replace_convert_substrings (char *translated_string,
   parser_set_accept_internalvalue (0);
   conf_set_NO_INDEX (previous_no_index);
   conf_set_NO_USER_COMMANDS (previous_no_user_commands);
-  parser_set_debug (previous_debug_level);
+  conf_set_DEBUG (previous_debug_level);
 
   if (replaced_substrings)
     {
diff --git a/tp/Texinfo/XS/parsetexi/Parsetexi.pm 
b/tp/Texinfo/XS/parsetexi/Parsetexi.pm
index 5aac434ef0..dedf794b34 100644
--- a/tp/Texinfo/XS/parsetexi/Parsetexi.pm
+++ b/tp/Texinfo/XS/parsetexi/Parsetexi.pm
@@ -93,7 +93,7 @@ sub parser (;$$)
   $debug = $parser->{'DEBUG'} if ($parser->{'DEBUG'});
   reset_parser($debug);
   # (re)set debug in any case, assuming that undef DEBUG is no debug
-  parser_set_debug($debug);
+  conf_set_DEBUG($debug);
 
   if (defined($conf)) {
     foreach my $key (keys(%$conf)) {
diff --git a/tp/Texinfo/XS/parsetexi/Parsetexi.xs 
b/tp/Texinfo/XS/parsetexi/Parsetexi.xs
index 50bae2b384..36a00b97a1 100644
--- a/tp/Texinfo/XS/parsetexi/Parsetexi.xs
+++ b/tp/Texinfo/XS/parsetexi/Parsetexi.xs
@@ -172,8 +172,8 @@ void
 parser_set_documentlanguage_override (value)
      char *value = (char *)SvPVutf8_nolen ($arg);
 
-void
-parser_set_debug (int i)
+int
+conf_set_DEBUG (int i)
 
 void
 parser_set_accept_internalvalue (int value)
diff --git a/tp/Texinfo/XS/parsetexi/api.c b/tp/Texinfo/XS/parsetexi/api.c
index adff06d5e4..787c3d5a0f 100644
--- a/tp/Texinfo/XS/parsetexi/api.c
+++ b/tp/Texinfo/XS/parsetexi/api.c
@@ -211,13 +211,6 @@ parse_piece (const char *string, int line_nr)
   return document_descriptor;
 }
 
-/* for debugging */
-int
-parser_set_debug (int value)
-{
-  return set_debug_output (value);
-}
-
 void
 parser_set_documentlanguage_override (const char *value)
 {
diff --git a/tp/Texinfo/XS/parsetexi/api.h b/tp/Texinfo/XS/parsetexi/api.h
index b495bc956b..f1cf1e537b 100644
--- a/tp/Texinfo/XS/parsetexi/api.h
+++ b/tp/Texinfo/XS/parsetexi/api.h
@@ -11,7 +11,6 @@ int parse_string (const char *, int line_nr);
 int parse_text (const char *, int line_nr);
 void reset_parser (int debug_output);
 
-int parser_set_debug (int value);
 void parser_reset_values_conf (void);
 void parser_store_value (const char *name, const char *value);
 void parser_add_include_directory (const char *filename);
diff --git a/tp/Texinfo/XS/parsetexi/conf.c b/tp/Texinfo/XS/parsetexi/conf.c
index 00312d492d..d526304e46 100644
--- a/tp/Texinfo/XS/parsetexi/conf.c
+++ b/tp/Texinfo/XS/parsetexi/conf.c
@@ -63,17 +63,26 @@ conf_set_NO_USER_COMMANDS (int i)
   return previous;
 }
 
+int
+conf_set_DEBUG (int i)
+{
+  int previous = conf.debug;
+  conf.debug = i;
+  return previous;
+}
+
 void
 reset_conf (void)
 {
   wipe_values (&conf.values);
 
-  conf.show_menu = 1;
   conf.cpp_line_directives = 1;
+  conf.debug = 1;
   conf.ignore_space_after_braced_command_name = 1;
   conf.max_macro_call_nesting = 100000;
   conf.no_index = 0;
   conf.no_user_commands = 0;
+  conf.show_menu = 1;
 
   /* special value always returned as 1 to mark that @ifcommandnotdefined
      is implemented.  Note that when called from the main program it is set
diff --git a/tp/Texinfo/XS/parsetexi/conf.h b/tp/Texinfo/XS/parsetexi/conf.h
index 57cfe2c1e7..6652d31216 100644
--- a/tp/Texinfo/XS/parsetexi/conf.h
+++ b/tp/Texinfo/XS/parsetexi/conf.h
@@ -19,12 +19,14 @@
 #include "document_types.h"
 
 typedef struct CONF {
-    int show_menu;
     int cpp_line_directives;
+    int debug;
     int ignore_space_after_braced_command_name;
     int max_macro_call_nesting;
     int no_index;
     int no_user_commands;
+    int show_menu;
+
     VALUE_LIST values;
 } CONF;
 
@@ -33,6 +35,7 @@ extern CONF conf;
 /* part of public API */
 void conf_set_show_menu (int i);
 void conf_set_CPP_LINE_DIRECTIVES (int i);
+int conf_set_DEBUG (int i);
 void conf_set_IGNORE_SPACE_AFTER_BRACED_COMMAND_NAME (int i);
 void conf_set_MAX_MACRO_CALL_NESTING (int i);
 int conf_set_NO_INDEX (int i);
diff --git a/tp/Texinfo/XS/parsetexi/debug_parser.c 
b/tp/Texinfo/XS/parsetexi/debug_parser.c
index 4388306caf..72d588ea41 100644
--- a/tp/Texinfo/XS/parsetexi/debug_parser.c
+++ b/tp/Texinfo/XS/parsetexi/debug_parser.c
@@ -22,27 +22,17 @@
 #include "text.h"
 #include "element_types.h"
 #include "debug.h"
+#include "conf.h"
 #include "debug_parser.h"
 
-/* Whether to dump debugging output on stderr. */
-int debug_output = 0;
-
-int
-set_debug_output (int value)
-{
-  int previous_debug_output = debug_output;
-  debug_output = value;
-  return previous_debug_output;
-}
-
-/* debug functions used in parser, depending on debug_output */
+/* debug functions used in parser, depending on conf.debug */
 
 void
 debug (char *s, ...)
 {
   va_list v;
 
-  if (!debug_output)
+  if (!conf.debug)
     return;
   va_start (v, s);
   vfprintf (stderr, s, v);
@@ -54,7 +44,7 @@ debug_nonl (char *s, ...)
 {
   va_list v;
 
-  if (!debug_output)
+  if (!conf.debug)
     return;
   va_start (v, s);
   vfprintf (stderr, s, v);
@@ -63,7 +53,7 @@ debug_nonl (char *s, ...)
 void
 debug_print_element (const ELEMENT *e, int print_parent)
 {
-  if (debug_output)
+  if (conf.debug)
     {
       char *result;
       result = print_element_debug (e, print_parent);
@@ -75,7 +65,7 @@ debug_print_element (const ELEMENT *e, int print_parent)
 void
 debug_print_protected_string (char *input_string)
 {
-  if (debug_output)
+  if (conf.debug)
     {
       int allocated = 0;
       char *result = debug_protect_eol (input_string, &allocated);
@@ -143,7 +133,7 @@ print_element_debug_parser (ELEMENT *e, int print_parent)
 void
 debug_parser_print_element (ELEMENT *e, int print_parent)
 {
-  if (debug_output)
+  if (conf.debug)
     {
       char *result;
       result = print_element_debug_parser (e, print_parent);
diff --git a/tp/Texinfo/XS/parsetexi/debug_parser.h 
b/tp/Texinfo/XS/parsetexi/debug_parser.h
index 03df20e99b..7e8673c939 100644
--- a/tp/Texinfo/XS/parsetexi/debug_parser.h
+++ b/tp/Texinfo/XS/parsetexi/debug_parser.h
@@ -4,11 +4,8 @@
 
 #include "tree_types.h"
 
-extern int debug_output;
-
 void debug (char *s, ...);
 void debug_nonl (char *s, ...);
-int set_debug_output (int value);
 void debug_print_element (const ELEMENT *e, int print_parent);
 void debug_print_protected_string (char *input_string);
 
diff --git a/tp/Texinfo/XS/parsetexi/errors_parser.c 
b/tp/Texinfo/XS/parsetexi/errors_parser.c
index 96d44af5e8..0f81b69ef8 100644
--- a/tp/Texinfo/XS/parsetexi/errors_parser.c
+++ b/tp/Texinfo/XS/parsetexi/errors_parser.c
@@ -29,8 +29,6 @@
 #include "tree_types.h"
 #include "document_types.h"
 #include "parser.h"
-/* for debug_output */
-#include "debug_parser.h"
 #include "errors.h"
 #include "errors_parser.h"
 
@@ -44,7 +42,7 @@ line_error_internal (enum error_type type, int continuation,
                      const char *format, va_list v)
 {
   vmessage_list_line_error (&parsed_document->parser_error_messages,
-                      type, continuation, debug_output, cmd_source_info,
+                      type, continuation, conf.debug, cmd_source_info,
                       0, format, v);
 }
 
diff --git a/tp/Texinfo/XS/parsetexi/parser.c b/tp/Texinfo/XS/parsetexi/parser.c
index 3a8cec3bd2..08edc5af9d 100644
--- a/tp/Texinfo/XS/parsetexi/parser.c
+++ b/tp/Texinfo/XS/parsetexi/parser.c
@@ -2667,7 +2667,7 @@ parse_texi (ELEMENT *root_elt, ELEMENT *current_elt)
   parsed_document = 0;
   forget_indices ();
 
-  complete_indices (document, debug_output);
+  complete_indices (document, conf.debug);
 
   return document->descriptor;
 }



reply via email to

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