[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
From: |
Patrice Dumas |
Date: |
Tue, 12 Dec 2023 11:44:30 -0500 (EST) |
branch: master
commit ff01803522dcf4239d086ad4f692cb0c3a60126b
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Tue Dec 12 17:11:44 2023 +0100
* tp/Texinfo/XS/main/errors.c (message_list_line_error_internal)
(line_error_internal, message_list_line_error_ext)
(message_list_command_warn, vmessage_list_command_warn)
(message_list_command_error): add an explicit warn argument to
message_list_line_error_internal. Pass OPTIONS information to
message_list_line_error_ext, message_list_command_warn,
vmessage_list_command_warn and message_list_command_error.
Update callers.
---
ChangeLog | 11 ++++++
tp/Texinfo/XS/convert/convert_html.c | 6 ++--
tp/Texinfo/XS/main/convert_utils.c | 6 ++--
tp/Texinfo/XS/main/errors.c | 13 +++++--
tp/Texinfo/XS/main/errors.h | 10 ++++--
tp/Texinfo/XS/structuring_transfo/structuring.c | 42 +++++++++++++---------
.../XS/structuring_transfo/transformations.c | 3 +-
7 files changed, 63 insertions(+), 28 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 82fc5c4323..d38d659e97 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2023-12-12 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/XS/main/errors.c (message_list_line_error_internal)
+ (line_error_internal, message_list_line_error_ext)
+ (message_list_command_warn, vmessage_list_command_warn)
+ (message_list_command_error): add an explicit warn argument to
+ message_list_line_error_internal. Pass OPTIONS information to
+ message_list_line_error_ext, message_list_command_warn,
+ vmessage_list_command_warn and message_list_command_error.
+ Update callers.
+
2023-12-12 Patrice Dumas <pertusus@free.fr>
No empty file_name in source info
diff --git a/tp/Texinfo/XS/convert/convert_html.c
b/tp/Texinfo/XS/convert/convert_html.c
index 4f977b6cf1..c9ac3b2dc8 100644
--- a/tp/Texinfo/XS/convert/convert_html.c
+++ b/tp/Texinfo/XS/convert/convert_html.c
@@ -1974,7 +1974,8 @@ noticed_line_warn (CONVERTER *self, const ELEMENT
*element,
va_start (v, format);
- vmessage_list_command_warn (&self->error_messages, element, format, v);
+ vmessage_list_command_warn (&self->error_messages, self->conf,
+ element, format, v);
}
/* to be inlined in text parsing codes */
@@ -2855,6 +2856,7 @@ external_node_href (CONVERTER *self, const ELEMENT
*external_node,
source_command))
{
message_list_command_warn (&self->error_messages,
+ self->conf,
source_command,
"no htmlxref.cnf entry found for `%s'",
manual_name);
@@ -8228,7 +8230,7 @@ html_prepare_converted_output_info (CONVERTER *self)
cmd_source_info.file_name = self->document->global_info->input_file_name;
/* TODO the message is not registered for gettext. In perl source,
it is registered */
- message_list_line_error_ext(&self->error_messages,
+ message_list_line_error_ext(&self->error_messages, self->conf,
MSG_warning, 0, &cmd_source_info,
"must specify a title with a title command or @top");
}
diff --git a/tp/Texinfo/XS/main/convert_utils.c
b/tp/Texinfo/XS/main/convert_utils.c
index 770dede5a5..675adbdb02 100644
--- a/tp/Texinfo/XS/main/convert_utils.c
+++ b/tp/Texinfo/XS/main/convert_utils.c
@@ -291,7 +291,7 @@ expand_verbatiminclude (ERROR_MESSAGE_LIST *error_messages,
&status, ¤t->source_info);
else
decoded_file = file;
- message_list_command_error (error_messages, current,
+ message_list_command_error (error_messages, options, current,
"could not read %s: %s",
decoded_file, strerror (errno));
if (file_name_encoding)
@@ -338,7 +338,7 @@ expand_verbatiminclude (ERROR_MESSAGE_LIST *error_messages,
¤t->source_info);
else
decoded_file = file;
- message_list_command_error (error_messages, current,
+ message_list_command_error (error_messages, options, current,
"error on closing @verbatiminclude file %s: %s",
decoded_file, strerror (errno));
if (file_name_encoding)
@@ -350,7 +350,7 @@ expand_verbatiminclude (ERROR_MESSAGE_LIST *error_messages,
}
else if (error_messages)
{
- message_list_command_error (error_messages, current,
+ message_list_command_error (error_messages, options, current,
"@%s: could not find %s",
builtin_command_name (current->cmd),
file_name_text);
diff --git a/tp/Texinfo/XS/main/errors.c b/tp/Texinfo/XS/main/errors.c
index 727f5fec33..a41d54bb10 100644
--- a/tp/Texinfo/XS/main/errors.c
+++ b/tp/Texinfo/XS/main/errors.c
@@ -135,6 +135,7 @@ message_list_line_formatted_message (ERROR_MESSAGE_LIST
*error_messages,
static void
message_list_line_error_internal (ERROR_MESSAGE_LIST *error_messages,
enum error_type type, int continuation,
+ int warn,
const SOURCE_INFO *cmd_source_info,
const char *format, va_list v)
{
@@ -150,7 +151,7 @@ message_list_line_error_internal (ERROR_MESSAGE_LIST
*error_messages,
message_list_line_formatted_message (error_messages,
type, continuation,
- cmd_source_info, message, debug_output);
+ cmd_source_info, message, warn);
}
void
@@ -243,7 +244,7 @@ line_error_internal (enum error_type type, int continuation,
const char *format, va_list v)
{
message_list_line_error_internal (&error_messages_list,
- type, continuation, cmd_source_info,
+ type, continuation, debug_output, cmd_source_info,
format, v);
}
@@ -287,6 +288,7 @@ command_warn (const ELEMENT *e, const char *format, ...)
void
message_list_line_error_ext (ERROR_MESSAGE_LIST *error_messages,
+ OPTIONS *conf,
enum error_type type, int continuation,
SOURCE_INFO *cmd_source_info, const char *format, ...)
{
@@ -294,17 +296,20 @@ message_list_line_error_ext (ERROR_MESSAGE_LIST
*error_messages,
va_start (v, format);
message_list_line_error_internal (error_messages, type, continuation,
+ (conf && conf->DEBUG > 0),
cmd_source_info, format, v);
}
void
message_list_command_warn (ERROR_MESSAGE_LIST *error_messages,
+ OPTIONS *conf,
const ELEMENT *e, const char *format, ...)
{
va_list v;
va_start (v, format);
message_list_line_error_internal (error_messages, MSG_warning, 0,
+ (conf && conf->DEBUG > 0),
&e->source_info, format, v);
}
@@ -312,9 +317,11 @@ message_list_command_warn (ERROR_MESSAGE_LIST
*error_messages,
function already has a variable argument */
void
vmessage_list_command_warn (ERROR_MESSAGE_LIST *error_messages,
+ OPTIONS *conf,
const ELEMENT *e, const char *format, va_list v)
{
message_list_line_error_internal (error_messages, MSG_warning, 0,
+ (conf && conf->DEBUG > 0),
&e->source_info, format, v);
}
@@ -329,12 +336,14 @@ command_error (const ELEMENT *e, const char *format, ...)
void
message_list_command_error (ERROR_MESSAGE_LIST *error_messages,
+ OPTIONS *conf,
const ELEMENT *e, const char *format, ...)
{
va_list v;
va_start (v, format);
message_list_line_error_internal (error_messages, MSG_error, 0,
+ (conf && conf->DEBUG > 0),
&e->source_info, format, v);
}
diff --git a/tp/Texinfo/XS/main/errors.h b/tp/Texinfo/XS/main/errors.h
index 6861c3ac29..fb95650ed7 100644
--- a/tp/Texinfo/XS/main/errors.h
+++ b/tp/Texinfo/XS/main/errors.h
@@ -26,12 +26,15 @@ void message_list_line_formatted_message
(ERROR_MESSAGE_LIST *error_messages,
const SOURCE_INFO *cmd_source_info,
char *message, int warn);
void message_list_line_error_ext (ERROR_MESSAGE_LIST *error_messages,
- enum error_type type, int continuation,
+ OPTIONS *conf,
+ enum error_type type, int continuation,
SOURCE_INFO *cmd_source_info, const char *format, ...);
void message_list_command_error (ERROR_MESSAGE_LIST *error_messages,
- const ELEMENT *e, const char *format, ...);
+ OPTIONS *conf,
+ const ELEMENT *e, const char *format, ...);
void message_list_command_warn (ERROR_MESSAGE_LIST *error_messages,
- const ELEMENT *e, const char *format, ...);
+ OPTIONS *conf,
+ const ELEMENT *e, const char *format, ...);
void message_list_document_formatted_message (ERROR_MESSAGE_LIST
*error_messages,
OPTIONS *conf,
@@ -44,6 +47,7 @@ void message_list_document_warn (ERROR_MESSAGE_LIST
*error_messages,
OPTIONS *conf,
const char *format, ...);
void vmessage_list_command_warn (ERROR_MESSAGE_LIST *error_messages,
+ OPTIONS *conf,
const ELEMENT *e, const char *format, va_list v);
extern ERROR_MESSAGE_LIST error_messages_list;
diff --git a/tp/Texinfo/XS/structuring_transfo/structuring.c
b/tp/Texinfo/XS/structuring_transfo/structuring.c
index 4fa267ac6e..e46979f4db 100644
--- a/tp/Texinfo/XS/structuring_transfo/structuring.c
+++ b/tp/Texinfo/XS/structuring_transfo/structuring.c
@@ -79,6 +79,7 @@ sectioning_structure (DOCUMENT *document)
{
ELEMENT *root = document->tree;
ERROR_MESSAGE_LIST *error_messages = document->error_messages;
+ OPTIONS *options = document->options;
ELEMENT *sec_root = 0;
ELEMENT *previous_section = 0;
@@ -132,7 +133,7 @@ sectioning_structure (DOCUMENT *document)
ELEMENT_LIST *section_childs = new_list ();
if (level - prev_section_level > 1)
{
- message_list_command_error (error_messages, content,
+ message_list_command_error (error_messages, options, content,
"raising the section level of @%s which is too low",
builtin_command_name (content->cmd));
level = prev_section_level + 1;
@@ -201,13 +202,14 @@ sectioning_structure (DOCUMENT *document)
/* level is 0 for part and section level -1 for sec root. The
condition means section level > 1, ie below chapter-level.
*/
- message_list_command_warn (error_messages,
+ message_list_command_warn (error_messages, options,
content, "no chapter-level command before @%s",
builtin_command_name (content->cmd));
}
else
{
- message_list_command_warn (error_messages, content,
+ message_list_command_warn (error_messages, options,
+ content,
"lowering the section level of @%s appearing after a lower element",
builtin_command_name (content->cmd));
level = sec_root_level +1;
@@ -375,7 +377,7 @@ sectioning_structure (DOCUMENT *document)
= lookup_extra_element (content, "part_associated_section");
if (!part_associated_section)
{
- message_list_command_warn (error_messages, content,
+ message_list_command_warn (error_messages, options, content,
"no sectioning command associated with @%s",
builtin_command_name (content->cmd));
}
@@ -395,13 +397,15 @@ warn_non_empty_parts (DOCUMENT *document)
{
GLOBAL_COMMANDS *global_commands = document->global_commands;
ERROR_MESSAGE_LIST *error_messages = document->error_messages;
+ OPTIONS *options = document->options;
+
int i;
for (i = 0; i < global_commands->part.number; i++)
{
ELEMENT *part = global_commands->part.list[i];
if (!is_content_empty (part, 0))
- message_list_command_warn (error_messages, part,
+ message_list_command_warn (error_messages, options, part,
"@%s not empty", builtin_command_name (part->cmd));
}
}
@@ -412,6 +416,7 @@ check_menu_entry (DOCUMENT *document, enum command_id cmd,
{
ERROR_MESSAGE_LIST *error_messages = document->error_messages;
LABEL_LIST *identifiers_target = document->identifiers_target;
+ OPTIONS *options = document->options;
char *normalized_menu_node = lookup_extra_string (menu_entry_node,
"normalized");
@@ -422,7 +427,7 @@ check_menu_entry (DOCUMENT *document, enum command_id cmd,
if (!menu_node)
{
char *entry_node_texi = link_element_to_texi (menu_entry_node);
- message_list_command_error (error_messages, menu_content,
+ message_list_command_error (error_messages, options, menu_content,
"@%s reference to nonexistent node `%s'",
builtin_command_name (cmd), entry_node_texi);
free (entry_node_texi);
@@ -435,7 +440,7 @@ check_menu_entry (DOCUMENT *document, enum command_id cmd,
{
char *entry_node_texi = link_element_to_texi (menu_entry_node);
char *menu_node_texi = target_element_to_texi_label (menu_node);
- message_list_command_warn (error_messages, menu_content,
+ message_list_command_warn (error_messages, options, menu_content,
"@%s entry node name `%s' different from %s name `%s'",
builtin_command_name (cmd), entry_node_texi,
builtin_command_name (menu_node->cmd), menu_node_texi);
@@ -566,6 +571,7 @@ check_nodes_are_referenced (DOCUMENT *document)
LABEL_LIST *identifiers_target = document->identifiers_target;
ELEMENT_LIST *refs = document->internal_references;
ERROR_MESSAGE_LIST *error_messages = document->error_messages;
+ OPTIONS *options = document->options;
char **referenced_identifiers;
size_t referenced_identifier_space;
@@ -772,7 +778,7 @@ check_nodes_are_referenced (DOCUMENT *document)
{
char *node_texi = target_element_to_texi_label(node);
nr_not_found++;
- message_list_command_warn (error_messages, node,
+ message_list_command_warn (error_messages, options, node,
"node `%s' unreferenced",
node_texi);
free (node_texi);
@@ -831,7 +837,7 @@ set_menus_node_directions (DOCUMENT *document)
for (j = 1; j < menus->number; j++)
{
ELEMENT *menu = menus->list[j];
- message_list_command_warn (error_messages,
+ message_list_command_warn (error_messages, options,
menu, "multiple @%s",
builtin_command_name (menu->cmd));
}
@@ -1074,7 +1080,7 @@ complete_node_tree_with_menus (DOCUMENT *document)
= target_element_to_texi_label
(direction_associated_node);
message_list_command_warn (error_messages,
- node,
+ options, node,
"node %s for `%s' is `%s' in sectioning but not in menu",
direction_names[d], node_texi,
direction_texi);
@@ -1110,7 +1116,7 @@ complete_node_tree_with_menus (DOCUMENT *document)
= target_element_to_texi_label
(elt_menu_direction);
message_list_command_warn (
- error_messages, node,
+ error_messages, options, node,
"node `%s' is %s for `%s' in menu but not in sectioning",
entry_texi, direction_names[d], node_texi);
free (node_texi);
@@ -1204,7 +1210,8 @@ complete_node_tree_with_menus (DOCUMENT *document)
(node_directions->contents.list[d]);
char *menu_dir_texi
= target_element_to_texi_label (menu_direction);
- message_list_command_warn (error_messages, node,
+ message_list_command_warn (error_messages, options,
+ node,
"node %s pointer for `%s' is `%s' but %s is `%s' in menu",
direction_names[d], node_texi,
dir_texi, direction_names[d],
@@ -1271,7 +1278,8 @@ complete_node_tree_with_menus (DOCUMENT *document)
{
char *up_texi = target_element_to_texi_label (up_node);
char *node_texi = target_element_to_texi_label (node);
- message_list_command_warn (error_messages, up_node,
+ message_list_command_warn (error_messages, options,
+ up_node,
"node `%s' lacks menu item for `%s' despite being its Up target",
up_texi, node_texi);
free (up_texi);
@@ -1443,7 +1451,7 @@ nodes_tree (DOCUMENT *document)
char *node_target_texi
= target_element_to_texi_label
(node_target);
message_list_command_warn (
- error_messages, node,
+ error_messages, options, node,
"%s pointer `%s' (for node `%s') different from %s name `%s'",
direction_texts[direction],
direction_texi, node_texi,
@@ -1463,7 +1471,7 @@ nodes_tree (DOCUMENT *document)
char *direction_texi
= link_element_to_texi(direction_element);
message_list_command_error (
- error_messages, node,
+ error_messages, options, node,
"%s reference to nonexistent `%s'",
direction_texts[direction],
direction_texi);
@@ -1540,7 +1548,7 @@ associate_internal_references (DOCUMENT *document)
|| options->novalidate <= 0)
{
char *label_texi = link_element_to_texi (label_element);
- message_list_command_error (error_messages,
+ message_list_command_error (error_messages, options,
ref, "@%s reference to nonexistent node `%s'",
builtin_command_name (ref->cmd), label_texi);
free (label_texi);
@@ -1559,7 +1567,7 @@ associate_internal_references (DOCUMENT *document)
char *label_texi = link_element_to_texi (label_element);
char *target_texi
= target_element_to_texi_label (node_target);
- message_list_command_warn (error_messages, ref,
+ message_list_command_warn (error_messages, options, ref,
"@%s to `%s', different from %s name `%s'",
builtin_command_name (ref->cmd), label_texi,
builtin_command_name (node_target->cmd),
diff --git a/tp/Texinfo/XS/structuring_transfo/transformations.c
b/tp/Texinfo/XS/structuring_transfo/transformations.c
index 19a3f934b2..303f129d8b 100644
--- a/tp/Texinfo/XS/structuring_transfo/transformations.c
+++ b/tp/Texinfo/XS/structuring_transfo/transformations.c
@@ -1262,6 +1262,7 @@ protect_hashchar_at_line_beginning_internal (const char
*type,
{
DOCUMENT *document = (DOCUMENT *) argument;
ERROR_MESSAGE_LIST *error_messages = document->error_messages;
+ OPTIONS *options = document->options;
if (current->text.end > 0)
{
@@ -1311,7 +1312,7 @@ protect_hashchar_at_line_beginning_internal (const char
*type,
&& parent_for_warn->source_info.line_nr)
{
message_list_command_warn (
- error_messages,
+ error_messages, options,
parent_for_warn ,
"could not protect hash character in @%s",
builtin_command_name (parent_for_warn->cmd));