[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/XS/main/ConfigXS.xs (texinfo_set_fro
From: |
Patrice Dumas |
Subject: |
branch master updated: * tp/Texinfo/XS/main/ConfigXS.xs (texinfo_set_from_init_file), tp/Texinfo/XS/main/txi_config.c (warn_obsolete_options) (texinfo_find_init_file_option_name, GNUT_set_from_init_file): warn for obsolete options and ignore. This is different from Perl where values and option names may be mapped. |
Date: |
Wed, 25 Dec 2024 03:45:03 -0500 |
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 d8b1e5fbac * tp/Texinfo/XS/main/ConfigXS.xs
(texinfo_set_from_init_file), tp/Texinfo/XS/main/txi_config.c
(warn_obsolete_options) (texinfo_find_init_file_option_name,
GNUT_set_from_init_file): warn for obsolete options and ignore. This is
different from Perl where values and option names may be mapped.
d8b1e5fbac is described below
commit d8b1e5fbac51d109dcde3a5ce8975b7e97628e48
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Wed Dec 25 09:44:58 2024 +0100
* tp/Texinfo/XS/main/ConfigXS.xs (texinfo_set_from_init_file),
tp/Texinfo/XS/main/txi_config.c (warn_obsolete_options)
(texinfo_find_init_file_option_name, GNUT_set_from_init_file):
warn for obsolete options and ignore. This is different from Perl
where values and option names may be mapped.
---
ChangeLog | 8 +++++
tp/Texinfo/Config.pm | 3 ++
tp/Texinfo/XS/main/ConfigXS.xs | 3 --
tp/Texinfo/XS/main/txi_config.c | 72 ++++++++++++++++++++++-------------------
tp/Texinfo/XS/texi2any.c | 1 +
5 files changed, 51 insertions(+), 36 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 02dea8351e..fb2a660401 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2024-12-25 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/XS/main/ConfigXS.xs (texinfo_set_from_init_file),
+ tp/Texinfo/XS/main/txi_config.c (warn_obsolete_options)
+ (texinfo_find_init_file_option_name, GNUT_set_from_init_file):
+ warn for obsolete options and ignore. This is different from Perl
+ where values and option names may be mapped.
+
2024-12-25 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/XS/Makefile.am (C_libtexinfo_sources),
diff --git a/tp/Texinfo/Config.pm b/tp/Texinfo/Config.pm
index 3fb30ff17b..da301f96a9 100644
--- a/tp/Texinfo/Config.pm
+++ b/tp/Texinfo/Config.pm
@@ -249,6 +249,9 @@ sub texinfo_register_init_loading_warning($) {
# L2H removed in 2021
# return undef var when there is nothing to set.
+# NOTE this has not been done consistently, many options were renamed
+# without doing something here.
+# NOTE in C there is no mapping of values.
sub _GNUT_map_obsolete_options($$)
{
my $input_var = shift;
diff --git a/tp/Texinfo/XS/main/ConfigXS.xs b/tp/Texinfo/XS/main/ConfigXS.xs
index 29becb83d7..640f99dd30 100644
--- a/tp/Texinfo/XS/main/ConfigXS.xs
+++ b/tp/Texinfo/XS/main/ConfigXS.xs
@@ -69,9 +69,6 @@ texinfo_set_from_init_file (option_name, SV *value)
status = 1;
texinfo_command_line_option_add_option_number (option->number);
}
- else
- txi_config_document_warn ("%s: unknown variable %s",
- "texinfo_set_from_init_file", option_name);
RETVAL = status;
OUTPUT:
RETVAL
diff --git a/tp/Texinfo/XS/main/txi_config.c b/tp/Texinfo/XS/main/txi_config.c
index bc6a0bfe0f..7c454523bc 100644
--- a/tp/Texinfo/XS/main/txi_config.c
+++ b/tp/Texinfo/XS/main/txi_config.c
@@ -83,7 +83,7 @@ GNUT_get_conf (size_t number)
char *
GNUT_decode_input (char *text)
-{
+{
OPTION *option
= GNUT_get_conf (program_options->options->COMMAND_LINE_ENCODING.number);
if (option && option->o.string)
@@ -105,7 +105,7 @@ GNUT_encode_message (char *text)
{
int status;
char *result = encode_string (text, option->o.string, &status, 0);
- return result;
+ return result;
}
else
return strdup (text);
@@ -198,14 +198,6 @@ set_option_value (OPTIONS_LIST *options_list, size_t
number,
int
GNUT_set_customization_default (size_t number, const char *value)
{
-
- /*
- ($var, $value) = _GNUT_map_obsolete_options($var, $value);
- if (!defined($var)) {
- return 1;
- }
- */
-
if (option_number_in_option_list (cmdline_options, number)
|| option_number_in_option_list (&init_files_options, number))
return 0;
@@ -217,13 +209,13 @@ GNUT_set_customization_default (size_t number, const char
*value)
void
GNUT_set_from_cmdline (OPTIONS_LIST *options_list, size_t number,
const char *value)
-{
+{
if (!strcmp (value, "undef"))
{
OPTION *option = options_list->sorted_options[number -1];
clear_option (option);
options_list_add_option_number (options_list, option->number);
- }
+ }
else
set_option_value (options_list, number, value);
}
@@ -248,17 +240,32 @@ texinfo_find_command_line_option_name (const char
*option_name)
return option;
}
+/* In Perl the values may be mapped, here we just ignore */
+static int
+warn_obsolete_options (const char *option_name)
+{
+ if (!strcmp (option_name, "L2H"))
+ {
+ txi_config_document_warn ("obsolete option: %s", option_name);
+ return 1;
+ }
+ return 0;
+}
+
OPTION *
texinfo_find_init_file_option_name (const char *option_name)
-{
- OPTION *option = find_option_string (init_files_options.sorted_options,
- option_name);
- /*
- ($var, $value) = _GNUT_map_obsolete_options($var, $value);
- if (!defined($var)) {
- return 1;
- }
- */
+{
+ OPTION *option;
+
+ if (warn_obsolete_options (option_name))
+ return 0;
+
+ option = find_option_string (init_files_options.sorted_options,
+ option_name);
+
+ if (!option)
+ txi_config_document_warn ("%s: unknown variable %s",
+ "texinfo_set_from_init_file", option_name);
return option;
}
@@ -270,17 +277,15 @@ texinfo_command_line_option_add_option_number (size_t
number)
}
int
-GNUT_set_from_init_file (const char *option_name,
- const char *value)
+GNUT_set_from_init_file (const char *option_name, const char *value)
{
- OPTION *option = find_option_string (init_files_options.sorted_options,
- option_name);
- /*
- ($var, $value) = _GNUT_map_obsolete_options($var, $value);
- if (!defined($var)) {
- return 1;
- }
- */
+ OPTION *option;
+
+ if (warn_obsolete_options (option_name))
+ return 0;
+
+ option = find_option_string (init_files_options.sorted_options,
+ option_name);
if (!option)
{
@@ -292,6 +297,7 @@ GNUT_set_from_init_file (const char *option_name,
if (option_number_in_option_list (cmdline_options, option->number))
return 0;
+
set_option_value (&init_files_options, option->number, value);
return 1;
}
@@ -302,7 +308,7 @@ txi_config_add_to_option_list (OPTION *option, const char
*value,
{
STRING_LIST *str_list;
size_t idx_option;
-
+
if (option->type != GOT_bytes_string_list
&& option->type != GOT_file_string_list
&& option->type != GOT_char_string_list)
@@ -329,7 +335,7 @@ txi_config_add_to_option_list (OPTION *option, const char
*value,
add_string (value, str_list);
}
return 1;
-}
+}
int
txi_config_remove_from_option_list (OPTION *option, const char *value)
diff --git a/tp/Texinfo/XS/texi2any.c b/tp/Texinfo/XS/texi2any.c
index c4204921c5..1a2dd0ee1a 100644
--- a/tp/Texinfo/XS/texi2any.c
+++ b/tp/Texinfo/XS/texi2any.c
@@ -362,6 +362,7 @@ get_cmdline_customization_option (OPTIONS_LIST
*options_list,
}
else
{
+ /* in Perl obsolete options may get another error message */
txi_config_document_warn ("unknown variable from command line: %s",
option_name);
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/XS/main/ConfigXS.xs (texinfo_set_from_init_file), tp/Texinfo/XS/main/txi_config.c (warn_obsolete_options) (texinfo_find_init_file_option_name, GNUT_set_from_init_file): warn for obsolete options and ignore. This is different from Perl where values and option names may be mapped.,
Patrice Dumas <=