[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
From: |
Patrice Dumas |
Date: |
Wed, 22 May 2024 15:43:25 -0400 (EDT) |
branch: master
commit a87234c63fa3eab1b65155b832259ca1e99544d4
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Wed May 22 10:32:12 2024 +0200
* tp/Texinfo/XS/Makefile.am (libtexinfo_la_SOURCES),
tp/Texinfo/XS/parsetexi/*.c, tp/Texinfo/XS/parsetexi/conf.c,
tp/Texinfo/XS/main/parser_conf.c (global_parser_conf)
(clear_parser_conf, clear_global_parser_conf),
tp/Texinfo/XS/main/parser_conf.h (PARSER_CONF): add main/parser_conf.c
and main/parser_conf.h with code from parsetexi/conf.c and
parsetexi/conf.h, with the PARSER_CONF structure and
clear_parser_conf. Rename global parser_conf variable as
global_parser_conf.
---
ChangeLog | 12 +++
tp/Texinfo/XS/Makefile.am | 2 +
tp/Texinfo/XS/main/parser_conf.c | 42 ++++++++++
.../XS/{parsetexi/conf.h => main/parser_conf.h} | 31 ++-----
tp/Texinfo/XS/parsetexi/api.c | 13 +--
tp/Texinfo/XS/parsetexi/commands.c | 4 +-
tp/Texinfo/XS/parsetexi/conf.c | 96 ++++++++++------------
tp/Texinfo/XS/parsetexi/conf.h | 28 -------
tp/Texinfo/XS/parsetexi/debug_parser.c | 15 ++--
tp/Texinfo/XS/parsetexi/end_line.c | 16 ++--
tp/Texinfo/XS/parsetexi/errors_parser.c | 6 +-
tp/Texinfo/XS/parsetexi/handle_commands.c | 8 +-
tp/Texinfo/XS/parsetexi/indices.c | 4 +-
tp/Texinfo/XS/parsetexi/input.c | 15 ++--
tp/Texinfo/XS/parsetexi/macro.c | 22 ++---
tp/Texinfo/XS/parsetexi/menus.c | 6 +-
tp/Texinfo/XS/parsetexi/parser.c | 20 ++---
17 files changed, 179 insertions(+), 161 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index dde30880dc..038edafd7d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2024-05-22 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/XS/Makefile.am (libtexinfo_la_SOURCES),
+ tp/Texinfo/XS/parsetexi/*.c, tp/Texinfo/XS/parsetexi/conf.c,
+ tp/Texinfo/XS/main/parser_conf.c (global_parser_conf)
+ (clear_parser_conf, clear_global_parser_conf),
+ tp/Texinfo/XS/main/parser_conf.h (PARSER_CONF): add main/parser_conf.c
+ and main/parser_conf.h with code from parsetexi/conf.c and
+ parsetexi/conf.h, with the PARSER_CONF structure and
+ clear_parser_conf. Rename global parser_conf variable as
+ global_parser_conf.
+
2024-05-21 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/Document.pm (errors), tp/Texinfo/ParserNonXS.pm (errors),
diff --git a/tp/Texinfo/XS/Makefile.am b/tp/Texinfo/XS/Makefile.am
index 3307cd1a41..2aaa8dca36 100644
--- a/tp/Texinfo/XS/Makefile.am
+++ b/tp/Texinfo/XS/Makefile.am
@@ -141,6 +141,8 @@ libtexinfo_la_SOURCES= \
main/command_stack.c \
main/command_stack.h \
main/cmd_structuring.c \
+ main/parser_conf.c \
+ main/parser_conf.h \
main/targets.c \
main/targets.h \
main/options_init_free.c \
diff --git a/tp/Texinfo/XS/main/parser_conf.c b/tp/Texinfo/XS/main/parser_conf.c
new file mode 100644
index 0000000000..6a6455a9fc
--- /dev/null
+++ b/tp/Texinfo/XS/main/parser_conf.c
@@ -0,0 +1,42 @@
+/* Copyright 2010-2024 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 <config.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "utils.h"
+#include "macro.h"
+#include "parser_conf.h"
+
+/* Configuration values. */
+PARSER_CONF global_parser_conf;
+
+void
+clear_parser_conf (PARSER_CONF *parser_conf)
+{
+ wipe_values (&parser_conf->values);
+ clear_strings_list (&parser_conf->include_directories);
+ free (parser_conf->documentlanguage);
+ free (parser_conf->input_file_name_encoding);
+ free (parser_conf->locale_encoding);
+}
+
+void
+clear_global_parser_conf (void)
+{
+ clear_parser_conf (&global_parser_conf);
+}
+
diff --git a/tp/Texinfo/XS/parsetexi/conf.h b/tp/Texinfo/XS/main/parser_conf.h
similarity index 52%
copy from tp/Texinfo/XS/parsetexi/conf.h
copy to tp/Texinfo/XS/main/parser_conf.h
index 345e247558..d17856489f 100644
--- a/tp/Texinfo/XS/parsetexi/conf.h
+++ b/tp/Texinfo/XS/main/parser_conf.h
@@ -1,6 +1,6 @@
-/* conf.h - declarations for conf.c */
-#ifndef CONF_H
-#define CONF_H
+/* parser_conf.h - declarations for parser_conf.c */
+#ifndef PARSER_CONF_H
+#define PARSER_CONF_H
/* Copyright 2010-2024 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
@@ -18,9 +18,6 @@
#include "document_types.h"
-/* TODO there is no reason to have the structure and extern included in
- codes only interested by the parser API, which only need the functions */
-
typedef struct PARSER_CONF {
int accept_internalvalue;
int cpp_line_directives;
@@ -42,26 +39,8 @@ typedef struct PARSER_CONF {
VALUE_LIST values;
} PARSER_CONF;
-extern PARSER_CONF parser_conf;
-
-/* part of parser public API */
-void parser_conf_set_show_menu (int i);
-void parser_conf_set_CPP_LINE_DIRECTIVES (int i);
-int parser_conf_set_DEBUG (int i);
-void parser_conf_set_IGNORE_SPACE_AFTER_BRACED_COMMAND_NAME (int i);
-void parser_conf_set_MAX_MACRO_CALL_NESTING (int i);
-int parser_conf_set_NO_INDEX (int i);
-int parser_conf_set_NO_USER_COMMANDS (int i);
-void parser_conf_clear_INCLUDE_DIRECTORIES (void);
-void parser_conf_add_include_directory (const char *filename);
-void parser_conf_clear_expanded_formats (void);
-void parser_conf_add_expanded_format (const char *format);
-void parser_conf_set_documentlanguage (const char *value);
-void parser_conf_set_DOC_ENCODING_FOR_INPUT_FILE_NAME (int i);
-void parser_conf_set_INPUT_FILE_NAME_ENCODING (const char *value);
-void parser_conf_set_LOCALE_ENCODING (const char *value);
-void parser_conf_set_accept_internalvalue (int value);
+extern PARSER_CONF global_parser_conf;
-void reset_parser_conf (void);
+void clear_global_parser_conf (void);
#endif
diff --git a/tp/Texinfo/XS/parsetexi/api.c b/tp/Texinfo/XS/parsetexi/api.c
index 93ee062b71..2022310386 100644
--- a/tp/Texinfo/XS/parsetexi/api.c
+++ b/tp/Texinfo/XS/parsetexi/api.c
@@ -43,6 +43,8 @@
#include "document.h"
/* for reset_conf */
#include "conf.h"
+/* for global_parser_conf */
+#include "parser_conf.h"
/* for init_index_commands */
#include "indices.h"
#include "api.h"
@@ -52,7 +54,7 @@ initialize_parsing (void)
{
parsed_document = new_document ();
- if (!parser_conf.no_index)
+ if (!global_parser_conf.no_index)
init_index_commands ();
wipe_user_commands ();
@@ -61,8 +63,9 @@ initialize_parsing (void)
init_values ();
free (global_documentlanguage);
- if (parser_conf.global_documentlanguage_fixed &&
parser_conf.documentlanguage)
- global_documentlanguage = strdup (parser_conf.documentlanguage);
+ if (global_parser_conf.global_documentlanguage_fixed
+ && global_parser_conf.documentlanguage)
+ global_documentlanguage = strdup (global_parser_conf.documentlanguage);
else
global_documentlanguage = 0;
@@ -212,12 +215,12 @@ parse_piece (const char *string, int line_nr)
void
parser_conf_reset_values (void)
{
- wipe_values (&parser_conf.values);
+ wipe_values (&global_parser_conf.values);
}
void
parser_conf_add_value (const char *name, const char *value)
{
- store_value (&parser_conf.values, name, value);
+ store_value (&global_parser_conf.values, name, value);
}
diff --git a/tp/Texinfo/XS/parsetexi/commands.c
b/tp/Texinfo/XS/parsetexi/commands.c
index 117a09b073..5429a873b5 100644
--- a/tp/Texinfo/XS/parsetexi/commands.c
+++ b/tp/Texinfo/XS/parsetexi/commands.c
@@ -24,6 +24,8 @@
/* for lookup_macro and unset_macro_record */
#include "macro.h"
#include "utils.h"
+/* for global_parser_conf */
+#include "parser_conf.h"
#include "commands.h"
COMMAND *user_defined_command_data = 0;
@@ -54,7 +56,7 @@ lookup_command (const char *cmdname)
/* txiinternalvalue is invalid if the corresponding parameter
* is not set */
- if (cmd == CM_txiinternalvalue && !parser_conf.accept_internalvalue)
+ if (cmd == CM_txiinternalvalue && !global_parser_conf.accept_internalvalue)
return 0;
return cmd;
diff --git a/tp/Texinfo/XS/parsetexi/conf.c b/tp/Texinfo/XS/parsetexi/conf.c
index fe6bc92e90..8a38c2b3a5 100644
--- a/tp/Texinfo/XS/parsetexi/conf.c
+++ b/tp/Texinfo/XS/parsetexi/conf.c
@@ -18,153 +18,147 @@
#include "utils.h"
#include "macro.h"
+#include "parser_conf.h"
#include "conf.h"
-/* Configuration values. */
-PARSER_CONF parser_conf;
-
void
parser_conf_set_show_menu (int i)
{
- parser_conf.show_menu = i;
+ global_parser_conf.show_menu = i;
}
void
parser_conf_set_CPP_LINE_DIRECTIVES (int i)
{
- parser_conf.cpp_line_directives = i;
+ global_parser_conf.cpp_line_directives = i;
}
void
parser_conf_set_IGNORE_SPACE_AFTER_BRACED_COMMAND_NAME (int i)
{
- parser_conf.ignore_space_after_braced_command_name = i;
+ global_parser_conf.ignore_space_after_braced_command_name = i;
}
void
parser_conf_set_MAX_MACRO_CALL_NESTING (int i)
{
- parser_conf.max_macro_call_nesting = i;
+ global_parser_conf.max_macro_call_nesting = i;
}
int
parser_conf_set_NO_INDEX (int i)
{
- int previous = parser_conf.no_index;
- parser_conf.no_index = i;
+ int previous = global_parser_conf.no_index;
+ global_parser_conf.no_index = i;
return previous;
}
int
parser_conf_set_NO_USER_COMMANDS (int i)
{
- int previous = parser_conf.no_user_commands;
- parser_conf.no_user_commands = i;
+ int previous = global_parser_conf.no_user_commands;
+ global_parser_conf.no_user_commands = i;
return previous;
}
int
parser_conf_set_DEBUG (int i)
{
- int previous = parser_conf.debug;
- parser_conf.debug = i;
+ int previous = global_parser_conf.debug;
+ global_parser_conf.debug = i;
return previous;
}
void
parser_conf_clear_INCLUDE_DIRECTORIES (void)
{
- clear_strings_list (&parser_conf.include_directories);
+ clear_strings_list (&global_parser_conf.include_directories);
}
void
parser_conf_add_include_directory (const char *filename)
{
- add_include_directory (filename, &parser_conf.include_directories);
+ add_include_directory (filename, &global_parser_conf.include_directories);
}
void
parser_conf_clear_expanded_formats (void)
{
- clear_expanded_formats (parser_conf.expanded_formats);
+ clear_expanded_formats (global_parser_conf.expanded_formats);
}
void
parser_conf_add_expanded_format (const char *format)
{
- add_expanded_format (parser_conf.expanded_formats, format);
+ add_expanded_format (global_parser_conf.expanded_formats, format);
}
void
parser_conf_set_documentlanguage (const char *value)
{
- free (parser_conf.documentlanguage);
- parser_conf.documentlanguage = value ? strdup (value) : 0;
- parser_conf.global_documentlanguage_fixed = 1;
+ free (global_parser_conf.documentlanguage);
+ global_parser_conf.documentlanguage = value ? strdup (value) : 0;
+ global_parser_conf.global_documentlanguage_fixed = 1;
}
void
parser_conf_set_DOC_ENCODING_FOR_INPUT_FILE_NAME (int i)
{
- parser_conf.doc_encoding_for_input_file_name = i;
+ global_parser_conf.doc_encoding_for_input_file_name = i;
}
void
parser_conf_set_INPUT_FILE_NAME_ENCODING (const char *value)
{
- free (parser_conf.input_file_name_encoding);
- parser_conf.input_file_name_encoding = value ? strdup (value) : 0;
+ free (global_parser_conf.input_file_name_encoding);
+ global_parser_conf.input_file_name_encoding = value ? strdup (value) : 0;
}
void
parser_conf_set_LOCALE_ENCODING (const char *value)
{
- free (parser_conf.locale_encoding);
- parser_conf.locale_encoding = value ? strdup (value) : 0;
+ free (global_parser_conf.locale_encoding);
+ global_parser_conf.locale_encoding = value ? strdup (value) : 0;
}
void
parser_conf_set_accept_internalvalue (int value)
{
- parser_conf.accept_internalvalue = value;
+ global_parser_conf.accept_internalvalue = value;
}
void
reset_parser_conf (void)
{
- wipe_values (&parser_conf.values);
- clear_strings_list (&parser_conf.include_directories);
- free (parser_conf.documentlanguage);
- free (parser_conf.input_file_name_encoding);
- free (parser_conf.locale_encoding);
-
- parser_conf.accept_internalvalue = 0;
- parser_conf.cpp_line_directives = 1;
- parser_conf.debug = 0;
- parser_conf.doc_encoding_for_input_file_name = 1;
- parser_conf.documentlanguage = 0;
- parser_conf.ignore_space_after_braced_command_name = 1;
- parser_conf.input_file_name_encoding = 0;
- parser_conf.locale_encoding = 0;
- parser_conf.max_macro_call_nesting = 100000;
- parser_conf.no_index = 0;
- parser_conf.no_user_commands = 0;
- parser_conf.show_menu = 1;
-
- parser_conf.global_documentlanguage_fixed = 0;
-
- memcpy (parser_conf.expanded_formats, default_expanded_formats,
- sizeof (parser_conf.expanded_formats));
+ clear_global_parser_conf ();
+
+ global_parser_conf.accept_internalvalue = 0;
+ global_parser_conf.cpp_line_directives = 1;
+ global_parser_conf.debug = 0;
+ global_parser_conf.doc_encoding_for_input_file_name = 1;
+ global_parser_conf.documentlanguage = 0;
+ global_parser_conf.ignore_space_after_braced_command_name = 1;
+ global_parser_conf.input_file_name_encoding = 0;
+ global_parser_conf.locale_encoding = 0;
+ global_parser_conf.max_macro_call_nesting = 100000;
+ global_parser_conf.no_index = 0;
+ global_parser_conf.no_user_commands = 0;
+ global_parser_conf.show_menu = 1;
+
+ global_parser_conf.global_documentlanguage_fixed = 0;
+
+ memcpy (global_parser_conf.expanded_formats, default_expanded_formats,
+ sizeof (global_parser_conf.expanded_formats));
/* It would have been cleaner to separate setting default values,
but it is not needed, as default_expanded_formats is already zeros,
so the call can be kept in comments
conf_clear_expanded_formats ();
*/
- add_include_directory (".", &parser_conf.include_directories);
+ add_include_directory (".", &global_parser_conf.include_directories);
/* special value always returned as 1 to mark that @ifcommandnotdefined
is implemented. Note that when called from the main program it is set
from Perl using the configuration passed to the parser */
- store_value (&parser_conf.values, "txicommandconditionals", "1");
+ store_value (&global_parser_conf.values, "txicommandconditionals", "1");
}
diff --git a/tp/Texinfo/XS/parsetexi/conf.h b/tp/Texinfo/XS/parsetexi/conf.h
index 345e247558..7ceeaa5d9c 100644
--- a/tp/Texinfo/XS/parsetexi/conf.h
+++ b/tp/Texinfo/XS/parsetexi/conf.h
@@ -16,34 +16,6 @@
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 "document_types.h"
-
-/* TODO there is no reason to have the structure and extern included in
- codes only interested by the parser API, which only need the functions */
-
-typedef struct PARSER_CONF {
- int accept_internalvalue;
- int cpp_line_directives;
- int doc_encoding_for_input_file_name;
- char *documentlanguage;
- int debug;
- char *input_file_name_encoding;
- int ignore_space_after_braced_command_name;
- STRING_LIST include_directories;
- char *locale_encoding;
- int max_macro_call_nesting;
- int no_index;
- int no_user_commands;
- int show_menu;
-
- int global_documentlanguage_fixed;
-
- EXPANDED_FORMAT expanded_formats[7];
- VALUE_LIST values;
-} PARSER_CONF;
-
-extern PARSER_CONF parser_conf;
-
/* part of parser public API */
void parser_conf_set_show_menu (int i);
void parser_conf_set_CPP_LINE_DIRECTIVES (int i);
diff --git a/tp/Texinfo/XS/parsetexi/debug_parser.c
b/tp/Texinfo/XS/parsetexi/debug_parser.c
index b2d6ae5c7f..3ac4ea20f9 100644
--- a/tp/Texinfo/XS/parsetexi/debug_parser.c
+++ b/tp/Texinfo/XS/parsetexi/debug_parser.c
@@ -22,17 +22,18 @@
#include "text.h"
#include "element_types.h"
#include "debug.h"
-#include "conf.h"
+/* for global_parser_conf */
+#include "parser_conf.h"
#include "debug_parser.h"
-/* debug functions used in parser, depending on parser_conf.debug */
+/* debug functions used in parser, depending on global_parser_conf.debug */
void
debug (const char *s, ...)
{
va_list v;
- if (!parser_conf.debug)
+ if (!global_parser_conf.debug)
return;
va_start (v, s);
vfprintf (stderr, s, v);
@@ -44,7 +45,7 @@ debug_nonl (const char *s, ...)
{
va_list v;
- if (!parser_conf.debug)
+ if (!global_parser_conf.debug)
return;
va_start (v, s);
vfprintf (stderr, s, v);
@@ -53,7 +54,7 @@ debug_nonl (const char *s, ...)
void
debug_print_element (const ELEMENT *e, int print_parent)
{
- if (parser_conf.debug)
+ if (global_parser_conf.debug)
{
char *result;
result = print_element_debug (e, print_parent);
@@ -65,7 +66,7 @@ debug_print_element (const ELEMENT *e, int print_parent)
void
debug_print_protected_string (const char *input_string)
{
- if (parser_conf.debug)
+ if (global_parser_conf.debug)
{
char *result = debug_protect_eol (input_string);
fputs (result, stderr);
@@ -129,7 +130,7 @@ print_element_debug_parser (const ELEMENT *e, int
print_parent)
void
debug_parser_print_element (const ELEMENT *e, int print_parent)
{
- if (parser_conf.debug)
+ if (global_parser_conf.debug)
{
char *result;
result = print_element_debug_parser (e, print_parent);
diff --git a/tp/Texinfo/XS/parsetexi/end_line.c
b/tp/Texinfo/XS/parsetexi/end_line.c
index 32b4ef51fa..d16ee73ab7 100644
--- a/tp/Texinfo/XS/parsetexi/end_line.c
+++ b/tp/Texinfo/XS/parsetexi/end_line.c
@@ -30,7 +30,6 @@
/* for isascii_alnum whitespace_chars read_flag_name
indices_info_index_by_name ultimate_index fatal */
#include "utils.h"
-#include "conf.h"
/* for parse_node_manual */
#include "manipulate_tree.h"
/* for parse_float_type add_to_float_record_list */
@@ -53,6 +52,8 @@
#include "convert_to_texinfo.h"
/* for convert_to_identifier */
#include "node_name_normalization.h"
+/* for global_parser_conf */
+#include "parser_conf.h"
static int
is_decimal_number (const char *string)
@@ -132,7 +133,7 @@ parse_line_command_args (ELEMENT *line_command)
{
case CM_alias:
{
- if (parser_conf.no_user_commands)
+ if (global_parser_conf.no_user_commands)
break;
/* @alias NEW = EXISTING */
char *new = 0, *existing = 0;
@@ -213,7 +214,7 @@ parse_line_command_args (ELEMENT *line_command)
}
case CM_definfoenclose:
{
- if (parser_conf.no_user_commands)
+ if (global_parser_conf.no_user_commands)
break;
/* @definfoenclose phoo,//,\\ */
@@ -336,7 +337,8 @@ parse_line_command_args (ELEMENT *line_command)
case CM_defindex:
case CM_defcodeindex:
{
- if (parser_conf.no_user_commands || parser_conf.no_index)
+ if (global_parser_conf.no_user_commands
+ || global_parser_conf.no_index)
break;
char *name = 0;
@@ -404,7 +406,7 @@ parse_line_command_args (ELEMENT *line_command)
if (*p)
goto synindex_invalid; /* More at end of line. */
- if (parser_conf.no_index)
+ if (global_parser_conf.no_index)
{
free (index_name_from);
free (index_name_to);
@@ -460,7 +462,7 @@ parse_line_command_args (ELEMENT *line_command)
arg = read_command_name (&p);
if (!arg || *p)
line_error ("bad argument to @printindex: %s", line);
- else if (parser_conf.no_index)
+ else if (global_parser_conf.no_index)
{}
else
{
@@ -1524,7 +1526,7 @@ end_line_misc_line (ELEMENT *current)
}
}
/* Set the document language unless it was set on the command line.
*/
- if (!parser_conf.global_documentlanguage_fixed)
+ if (!global_parser_conf.global_documentlanguage_fixed)
{
free (global_documentlanguage);
global_documentlanguage = strdup (text);
diff --git a/tp/Texinfo/XS/parsetexi/errors_parser.c
b/tp/Texinfo/XS/parsetexi/errors_parser.c
index c2b99c0bab..8c1b07bfbb 100644
--- a/tp/Texinfo/XS/parsetexi/errors_parser.c
+++ b/tp/Texinfo/XS/parsetexi/errors_parser.c
@@ -30,6 +30,8 @@
#include "document_types.h"
#include "parser.h"
#include "errors.h"
+/* for global_parser_conf */
+#include "parser_conf.h"
#include "errors_parser.h"
@@ -42,8 +44,8 @@ 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, parser_conf.debug, cmd_source_info,
- 0, format, v);
+ type, continuation, global_parser_conf.debug,
+ cmd_source_info, 0, format, v);
}
void
diff --git a/tp/Texinfo/XS/parsetexi/handle_commands.c
b/tp/Texinfo/XS/parsetexi/handle_commands.c
index 162c31403c..b3d80023a4 100644
--- a/tp/Texinfo/XS/parsetexi/handle_commands.c
+++ b/tp/Texinfo/XS/parsetexi/handle_commands.c
@@ -30,8 +30,8 @@
#include "counter.h"
#include "command_stack.h"
#include "context_stack.h"
-/* for conf */
-#include "conf.h"
+/* for global_parser_conf */
+#include "parser_conf.h"
/* lookup_infoenclose */
#include "macro.h"
#include "builtin_commands.h"
@@ -987,7 +987,7 @@ funexit:
int
parser_format_expanded_p (const char *format)
{
- return format_expanded_p (parser_conf.expanded_formats, format);
+ return format_expanded_p (global_parser_conf.expanded_formats, format);
}
/* A command name has been read that starts a multiline block, which should
@@ -1095,7 +1095,7 @@ handle_block_command (ELEMENT *current, const char
**line_inout,
if (current_node)
{
- if (cmd == CM_direntry && parser_conf.show_menu)
+ if (cmd == CM_direntry && global_parser_conf.show_menu)
{
line_warn ("@direntry after first node");
}
diff --git a/tp/Texinfo/XS/parsetexi/indices.c
b/tp/Texinfo/XS/parsetexi/indices.c
index f90e270bf5..c875daf2fd 100644
--- a/tp/Texinfo/XS/parsetexi/indices.c
+++ b/tp/Texinfo/XS/parsetexi/indices.c
@@ -38,6 +38,8 @@
/*
#include "convert_to_texinfo.h"
*/
+/* for global_parser_conf */
+#include "parser_conf.h"
#include "parser.h"
#include "indices.h"
@@ -244,7 +246,7 @@ enter_index_entry (enum command_id index_type_cmd,
const IGNORED_CHARS *ignored_chars_info
= &parsed_document->global_info.ignored_chars;
- if (parser_conf.no_index)
+ if (global_parser_conf.no_index)
return;
idx = index_of_command (index_type_cmd);
diff --git a/tp/Texinfo/XS/parsetexi/input.c b/tp/Texinfo/XS/parsetexi/input.c
index db10f197c3..8cd4c5553a 100644
--- a/tp/Texinfo/XS/parsetexi/input.c
+++ b/tp/Texinfo/XS/parsetexi/input.c
@@ -31,6 +31,8 @@
#include "text.h"
#include "commands.h"
#include "source_marks.h"
+/* for global_parser_conf */
+#include "parser_conf.h"
enum input_type { IN_file, IN_text };
@@ -178,12 +180,12 @@ encode_file_name (char *filename)
{
if (!reverse_iconv)
{
- if (parser_conf.input_file_name_encoding)
+ if (global_parser_conf.input_file_name_encoding)
{
reverse_iconv
- = iconv_open (parser_conf.input_file_name_encoding, "UTF-8");
+ = iconv_open (global_parser_conf.input_file_name_encoding,
"UTF-8");
}
- else if (parser_conf.doc_encoding_for_input_file_name)
+ else if (global_parser_conf.doc_encoding_for_input_file_name)
{
if (current_encoding_conversion
&& strcmp (parsed_document->global_info.input_encoding_name,
@@ -194,9 +196,9 @@ encode_file_name (char *filename)
reverse_iconv = iconv_open (conversion_encoding, "UTF-8");
}
}
- else if (parser_conf.locale_encoding)
+ else if (global_parser_conf.locale_encoding)
{
- reverse_iconv = iconv_open (parser_conf.locale_encoding, "UTF-8");
+ reverse_iconv = iconv_open (global_parser_conf.locale_encoding,
"UTF-8");
}
}
if (reverse_iconv && reverse_iconv != (iconv_t) -1)
@@ -542,7 +544,8 @@ top_file_index (void)
char *
parser_locate_include_file (const char *filename)
{
- return locate_include_file (filename, &parser_conf.include_directories);
+ return locate_include_file (filename,
+ &global_parser_conf.include_directories);
}
/* Try to open a file called FILENAME */
diff --git a/tp/Texinfo/XS/parsetexi/macro.c b/tp/Texinfo/XS/parsetexi/macro.c
index 56436cfb56..02cf77c1e9 100644
--- a/tp/Texinfo/XS/parsetexi/macro.c
+++ b/tp/Texinfo/XS/parsetexi/macro.c
@@ -35,6 +35,8 @@
#include "convert_to_texinfo.h"
#include "source_marks.h"
#include "extra.h"
+/* for global_parser_conf */
+#include "parser_conf.h"
#include "macro.h"
COUNTER count_toplevel_braces;
@@ -67,7 +69,7 @@ new_macro (const char *name, const ELEMENT *macro)
enum command_id new;
MACRO *m = 0;
- if (parser_conf.no_user_commands)
+ if (global_parser_conf.no_user_commands)
return;
/* Check for an existing definition first for us to overwrite. */
@@ -575,7 +577,7 @@ expand_linemacro_arguments (const ELEMENT *macro, const
char **line_inout,
if (cmd && (command_data(cmd).flags & CF_brace)
&& strchr (whitespace_chars, *pline)
&& ((command_flags(current) & CF_accent)
- || parser_conf.ignore_space_after_braced_command_name))
+ || global_parser_conf.ignore_space_after_braced_command_name))
{
int whitespaces_len = strspn (pline, whitespace_chars);
text_append_n (arg, pline, whitespaces_len);
@@ -846,13 +848,13 @@ handle_macro (ELEMENT *current, const char **line_inout,
enum command_id cmd)
}
}
- if (parser_conf.max_macro_call_nesting
- && macro_expansion_nr > parser_conf.max_macro_call_nesting)
+ if (global_parser_conf.max_macro_call_nesting
+ && macro_expansion_nr > global_parser_conf.max_macro_call_nesting)
{
line_warn (
"macro call nested too deeply "
"(set MAX_MACRO_CALL_NESTING to override; current value %d)",
- parser_conf.max_macro_call_nesting);
+ global_parser_conf.max_macro_call_nesting);
error = 1;
}
@@ -1029,15 +1031,15 @@ init_values (void)
wipe_values (&parser_values);
- if (parser_values.space < parser_conf.values.number)
+ if (parser_values.space < global_parser_conf.values.number)
{
- parser_values.space = parser_conf.values.number;
+ parser_values.space = global_parser_conf.values.number;
parser_values.list = realloc (parser_values.list,
parser_values.space * sizeof (VALUE));
}
- for (i = 0; i < parser_conf.values.number; i++)
- store_value (&parser_values, parser_conf.values.list[i].name,
- parser_conf.values.list[i].value);
+ for (i = 0; i < global_parser_conf.values.number; i++)
+ store_value (&parser_values, global_parser_conf.values.list[i].name,
+ global_parser_conf.values.list[i].value);
}
void
diff --git a/tp/Texinfo/XS/parsetexi/menus.c b/tp/Texinfo/XS/parsetexi/menus.c
index 078bfde810..d866a8a673 100644
--- a/tp/Texinfo/XS/parsetexi/menus.c
+++ b/tp/Texinfo/XS/parsetexi/menus.c
@@ -29,8 +29,8 @@
#include "manipulate_tree.h"
#include "input.h"
#include "text.h"
-/* for parser_conf */
-#include "conf.h"
+/* for global_parser_conf */
+#include "parser_conf.h"
#include "convert_to_texinfo.h"
#include "labels.h"
#include "source_marks.h"
@@ -66,7 +66,7 @@ register_extra_menu_entry_information (ELEMENT *current)
if (!parsed_entry_node->manual_content
&& !parsed_entry_node->node_content)
{
- if (parser_conf.show_menu)
+ if (global_parser_conf.show_menu)
line_error ("empty node name in menu entry");
}
else
diff --git a/tp/Texinfo/XS/parsetexi/parser.c b/tp/Texinfo/XS/parsetexi/parser.c
index c18bd7246b..81633b7418 100644
--- a/tp/Texinfo/XS/parsetexi/parser.c
+++ b/tp/Texinfo/XS/parsetexi/parser.c
@@ -37,8 +37,8 @@
#include "input.h"
#include "source_marks.h"
#include "extra.h"
-/* for parser_conf */
-#include "conf.h"
+/* for global_parser_conf */
+#include "parser_conf.h"
#include "command_stack.h"
/* for nesting_context */
#include "context_stack.h"
@@ -1772,7 +1772,7 @@ process_remaining_on_line (ELEMENT **current_inout, const
char **line_inout)
{
const char *remaining_line = line_after_command;
ELEMENT *spaces_element = 0;
- if (parser_conf.ignore_space_after_braced_command_name)
+ if (global_parser_conf.ignore_space_after_braced_command_name)
{
int whitespaces_len = strspn (remaining_line, whitespace_chars);
if (whitespaces_len > 0)
@@ -1802,14 +1802,14 @@ process_remaining_on_line (ELEMENT **current_inout,
const char **line_inout)
ELEMENT *sm_value_element;
remaining_line++; /* past '}' */
- if (parser_conf.max_macro_call_nesting
+ if (global_parser_conf.max_macro_call_nesting
&& value_expansion_nr
- >= parser_conf.max_macro_call_nesting)
+ >= global_parser_conf.max_macro_call_nesting)
{
line_warn (
"value call nested too deeply "
"(set MAX_MACRO_CALL_NESTING to override; current value
%d)",
- parser_conf.max_macro_call_nesting);
+ global_parser_conf.max_macro_call_nesting);
free (flag);
if (spaces_element)
destroy_element (spaces_element);
@@ -1942,7 +1942,7 @@ process_remaining_on_line (ELEMENT **current_inout, const
char **line_inout)
if (strchr (whitespace_chars, *line)
&& ((command_flags(current) & CF_accent)
- || parser_conf.ignore_space_after_braced_command_name))
+ || global_parser_conf.ignore_space_after_braced_command_name))
{
int whitespaces_len;
int additional_newline = 0;
@@ -2095,7 +2095,7 @@ process_remaining_on_line (ELEMENT **current_inout, const
char **line_inout)
const char *arg_start;
char *flag;
ELEMENT *spaces_element = 0;
- if (parser_conf.ignore_space_after_braced_command_name)
+ if (global_parser_conf.ignore_space_after_braced_command_name)
{
int whitespaces_len = strspn (line, whitespace_chars);
if (whitespaces_len > 0)
@@ -2436,7 +2436,7 @@ check_line_directive (const char *line)
int status = 0;
char *parsed_filename;
- if (!parser_conf.cpp_line_directives)
+ if (!global_parser_conf.cpp_line_directives)
return 0;
/* Check input is coming directly from a file. */
@@ -2624,7 +2624,7 @@ parse_texi (ELEMENT *root_elt, ELEMENT *current_elt)
parsed_document = 0;
forget_indices ();
- complete_indices (document, parser_conf.debug);
+ complete_indices (document, global_parser_conf.debug);
return document->descriptor;
}