[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
From: |
Patrice Dumas |
Date: |
Tue, 14 May 2024 07:46:29 -0400 (EDT) |
branch: master
commit adc957107468cb6826062e26023b4fe2a3652d8a
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Tue May 14 09:56:10 2024 +0200
* tp/Texinfo/XS/parsetexi/api.c (parser_set_debug),
tp/Texinfo/XS/parsetexi/debug_parser.c (set_debug_output): return the
previous value.
* tp/Texinfo/XS/main/translations.c (replace_convert_substrings):
reset better the configuration. Call reset_parser_except_conf and not
reset_parser.
* tp/t/test_tree_copy.t: remove useless use.
---
ChangeLog | 12 ++++++++++++
tp/TODO | 7 +++++++
tp/Texinfo/XS/main/translations.c | 7 +++++--
tp/Texinfo/XS/parsetexi/api.c | 4 ++--
tp/Texinfo/XS/parsetexi/api.h | 2 +-
tp/Texinfo/XS/parsetexi/debug_parser.c | 4 +++-
tp/Texinfo/XS/parsetexi/debug_parser.h | 2 +-
tp/t/test_tree_copy.t | 3 +--
8 files changed, 32 insertions(+), 9 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index ffefbe8a84..04c193b6c7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2024-05-14 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/XS/parsetexi/api.c (parser_set_debug),
+ tp/Texinfo/XS/parsetexi/debug_parser.c (set_debug_output): return the
+ previous value.
+
+ * tp/Texinfo/XS/main/translations.c (replace_convert_substrings):
+ reset better the configuration. Call reset_parser_except_conf and not
+ reset_parser.
+
+ * tp/t/test_tree_copy.t: remove useless use.
+
2024-05-13 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/XS/parsetexi/api.c (reset_parser_except_conf),
diff --git a/tp/TODO b/tp/TODO
index d637abfcaf..11ba6097b9 100644
--- a/tp/TODO
+++ b/tp/TODO
@@ -57,6 +57,13 @@ Document *XS_EXTERNAL_FORMATTING *XS_EXTERNAL_CONVERSION?
Delayed bugs/features
=====================
+call after/in pass_document_parser_errors_to_registrar?
+clear_document_parser_errors (document_descriptor);
+
+Parser API is inconsistent between Perl and XS. The Perl API allows
+reuse of parser and parallel use of parsers, which is not really
+possible with XS.
+
Gavin idea to use see/See for cross references in --plaintext output.
More generally, the plaintext ref_commands formatting code
could be completly different from the Info code, which is the current
diff --git a/tp/Texinfo/XS/main/translations.c
b/tp/Texinfo/XS/main/translations.c
index c29e94d0a1..24ebcc5934 100644
--- a/tp/Texinfo/XS/main/translations.c
+++ b/tp/Texinfo/XS/main/translations.c
@@ -431,6 +431,7 @@ replace_convert_substrings (char *translated_string,
char *texinfo_line;
int document_descriptor;
int parser_debug_level = 0;
+ int previous_debug_level;
DOCUMENT *document;
if (replaced_substrings)
@@ -466,8 +467,8 @@ replace_convert_substrings (char *translated_string,
if (debug_level > 0)
parser_debug_level = debug_level - 1;
- reset_parser (parser_debug_level);
- parser_set_debug (parser_debug_level);
+ previous_debug_level = parser_set_debug (parser_debug_level);
+ reset_parser_except_conf ();
/*
accept @txiinternalvalue as a valid Texinfo command, used to mark
@@ -495,6 +496,8 @@ replace_convert_substrings (char *translated_string,
clear_document_parser_errors (document_descriptor);
parser_set_accept_internalvalue (0);
+ parser_set_restricted (0);
+ parser_set_debug (previous_debug_level);
if (replaced_substrings)
{
diff --git a/tp/Texinfo/XS/parsetexi/api.c b/tp/Texinfo/XS/parsetexi/api.c
index 0b120d3cf6..9cde97af71 100644
--- a/tp/Texinfo/XS/parsetexi/api.c
+++ b/tp/Texinfo/XS/parsetexi/api.c
@@ -215,10 +215,10 @@ parse_piece (const char *string, int line_nr)
}
/* for debugging */
-void
+int
parser_set_debug (int value)
{
- set_debug_output (value);
+ return set_debug_output (value);
}
void
diff --git a/tp/Texinfo/XS/parsetexi/api.h b/tp/Texinfo/XS/parsetexi/api.h
index 43d22227f1..30d82b68af 100644
--- a/tp/Texinfo/XS/parsetexi/api.h
+++ b/tp/Texinfo/XS/parsetexi/api.h
@@ -12,7 +12,7 @@ int parse_text (const char *, int line_nr);
void reset_parser (int debug_output);
void reset_parser_except_conf (void);
-void parser_set_debug (int value);
+int parser_set_debug (int value);
void parser_store_value (const char *name, const char *value);
void parser_add_include_directory (const char *filename);
void parser_add_expanded_format (const char *format);
diff --git a/tp/Texinfo/XS/parsetexi/debug_parser.c
b/tp/Texinfo/XS/parsetexi/debug_parser.c
index f28088dcab..4388306caf 100644
--- a/tp/Texinfo/XS/parsetexi/debug_parser.c
+++ b/tp/Texinfo/XS/parsetexi/debug_parser.c
@@ -27,10 +27,12 @@
/* Whether to dump debugging output on stderr. */
int debug_output = 0;
-void
+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 */
diff --git a/tp/Texinfo/XS/parsetexi/debug_parser.h
b/tp/Texinfo/XS/parsetexi/debug_parser.h
index eac8d81773..03df20e99b 100644
--- a/tp/Texinfo/XS/parsetexi/debug_parser.h
+++ b/tp/Texinfo/XS/parsetexi/debug_parser.h
@@ -8,7 +8,7 @@ extern int debug_output;
void debug (char *s, ...);
void debug_nonl (char *s, ...);
-void set_debug_output (int value);
+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/t/test_tree_copy.t b/tp/t/test_tree_copy.t
index cc15c6fc38..7f21032119 100644
--- a/tp/t/test_tree_copy.t
+++ b/tp/t/test_tree_copy.t
@@ -12,10 +12,8 @@ use Data::Dumper;
use File::Spec;
#use Text::Diff;
-use Texinfo::Common;
use Texinfo::Parser;
use Texinfo::Convert::Texinfo;
-use Texinfo::Document;
use Texinfo::ManipulateTree;
use Texinfo::Structuring;
@@ -27,6 +25,7 @@ if (defined($srcdir)) {
}
my $debug = 0;
+#my $debug = 1;
my $with_XS = ((not defined($ENV{TEXINFO_XS})
or $ENV{TEXINFO_XS} ne 'omit')