texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: * tp/Texinfo/XS/texi2any.c (main): add set_messag


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/XS/texi2any.c (main): add set_message_encoding and set the variable to the customized MESSAGE_ENCODING value. Use set_message_encoding for calls to txi_handle_*error_messages.
Date: Sat, 28 Dec 2024 04:00:45 -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 3dbbde607c * tp/Texinfo/XS/texi2any.c (main): add set_message_encoding 
and set the variable to the customized MESSAGE_ENCODING value.  Use 
set_message_encoding for calls to txi_handle_*error_messages.
3dbbde607c is described below

commit 3dbbde607c6e16d50c7a781329a4ec2812cede59
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sat Dec 28 10:00:23 2024 +0100

    * tp/Texinfo/XS/texi2any.c (main): add set_message_encoding and set
    the variable to the customized MESSAGE_ENCODING value.  Use
    set_message_encoding for calls to txi_handle_*error_messages.
    
    * tp/Texinfo/XS/convert/texinfo.c (txi_parser): remove locale_encoding
    argument, take it from options_list only.  Update caller.
---
 ChangeLog                       |  9 +++++++++
 tp/Texinfo/XS/convert/texinfo.c | 11 ++++-------
 tp/Texinfo/XS/convert/texinfo.h |  4 ++--
 tp/Texinfo/XS/texi2any.c        | 15 +++++++++++----
 4 files changed, 26 insertions(+), 13 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 1fa0365cf5..83df13c830 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2024-12-27  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/XS/texi2any.c (main): add set_message_encoding and set
+       the variable to the customized MESSAGE_ENCODING value.  Use
+       set_message_encoding for calls to txi_handle_*error_messages.
+
+       * tp/Texinfo/XS/convert/texinfo.c (txi_parser): remove locale_encoding
+       argument, take it from options_list only.  Update caller.
+
 2024-12-27  Patrice Dumas  <pertusus@free.fr>
 
        Raw text converter in C
diff --git a/tp/Texinfo/XS/convert/texinfo.c b/tp/Texinfo/XS/convert/texinfo.c
index a17ab745f7..a6c3ff997b 100644
--- a/tp/Texinfo/XS/convert/texinfo.c
+++ b/tp/Texinfo/XS/convert/texinfo.c
@@ -256,8 +256,8 @@ txi_converter_format_defaults (const char *converted_format,
    Also sets INCLUDE_DIRECTORIES minimally if not specified in options.
    The implementation is similar to parsetexi/Parsetexi.pm on purpose. */
 void
-txi_parser (const char *file_path, const char *locale_encoding,
-            const VALUE_LIST *values, OPTIONS_LIST *options_list)
+txi_parser (const char *file_path, const VALUE_LIST *values,
+            OPTIONS_LIST *options_list)
 {
   char *input_file_name_and_directory[2];
   char *input_directory;
@@ -287,9 +287,6 @@ txi_parser (const char *file_path, const char 
*locale_encoding,
         }
     }
 
-  /* set from arguments.  Options override */
-  parser_conf_set_LOCALE_ENCODING (locale_encoding);
-
   if (options_list)
     {
       for (i = 0; i < options_list->number; i++)
@@ -551,7 +548,7 @@ txi_handle_parser_error_messages (DOCUMENT *document, int 
no_warn,
                                   const char *message_encoding)
 {
   return output_error_messages (&document->parser_error_messages, no_warn,
-                         use_filename, message_encoding);
+                                use_filename, message_encoding);
 }
 
 size_t
@@ -560,7 +557,7 @@ txi_handle_document_error_messages (DOCUMENT *document, int 
no_warn,
                                     const char *message_encoding)
 {
   return output_error_messages (&document->error_messages, no_warn,
-                         use_filename, message_encoding);
+                                use_filename, message_encoding);
 
 }
 
diff --git a/tp/Texinfo/XS/convert/texinfo.h b/tp/Texinfo/XS/convert/texinfo.h
index d35ca38d18..229184ff43 100644
--- a/tp/Texinfo/XS/convert/texinfo.h
+++ b/tp/Texinfo/XS/convert/texinfo.h
@@ -50,8 +50,8 @@ CONVERTER_INITIALIZATION_INFO *txi_converter_format_defaults (
                                const char *external_module,
                                OPTIONS_LIST *customizations);
 
-void txi_parser (const char *file_path, const char *locale_encoding,
-                 const VALUE_LIST *values, OPTIONS_LIST *options);
+void txi_parser (const char *file_path, const VALUE_LIST *values,
+                 OPTIONS_LIST *options);
 
 DOCUMENT *txi_parse_texi_file (const char *input_file_path, int *status);
 
diff --git a/tp/Texinfo/XS/texi2any.c b/tp/Texinfo/XS/texi2any.c
index c1350e2f81..2bad3f55ed 100644
--- a/tp/Texinfo/XS/texi2any.c
+++ b/tp/Texinfo/XS/texi2any.c
@@ -816,6 +816,7 @@ main (int argc, char *argv[], char *env[])
   OPTION *no_warn_option;
   OPTION *format_menu_option;
   OPTION *debug_option;
+  OPTION *message_encoding_option;
   int no_warn = 0;
   int test_mode_set = 0;
   int debug = 0;
@@ -847,6 +848,7 @@ main (int argc, char *argv[], char *env[])
   const char *external_module = 0;
   int default_is_html = 1;
   char *init_file_format;
+  const char *set_message_encoding = 0;
 
   parse_file_path (argv[0], program_file_name_and_directory);
   program_file = program_file_name_and_directory[0];
@@ -1944,6 +1946,11 @@ main (int argc, char *argv[], char *env[])
                         configured_name_version);
     }
 
+  message_encoding_option
+    = GNUT_get_conf (program_options.options->MESSAGE_ENCODING.number);
+  if (message_encoding_option && message_encoding_option->o.string)
+    set_message_encoding = message_encoding_option->o.string;
+
   if (optind < argc)
     {
       int j;
@@ -2068,14 +2075,14 @@ main (int argc, char *argv[], char *env[])
 
       /* Texinfo file parsing */
       /* initialize parser */
-      txi_parser (input_file_path, locale_encoding, &values, &parser_options);
+      txi_parser (input_file_path, &values, &parser_options);
 
       /* Texinfo document tree parsing */
       document = txi_parse_texi_file (input_file_path, &status);
 
       errors_nr
         = txi_handle_parser_error_messages (document, no_warn, test_mode_set,
-                                            locale_encoding);
+                                            set_message_encoding);
       if (status)
         {
           errors_count = handle_errors (errors_nr, errors_count, 
&opened_files);
@@ -2224,7 +2231,7 @@ main (int argc, char *argv[], char *env[])
       errors_nr
         = txi_handle_document_error_messages (document, no_warn,
                                               test_mode_set,
-                                              locale_encoding);
+                                              set_message_encoding);
 
       errors_count = handle_errors (errors_nr, errors_count, &opened_files);
 
@@ -2288,7 +2295,7 @@ main (int argc, char *argv[], char *env[])
 
       errors_nr
         = txi_handle_converter_error_messages (converter, no_warn,
-                                           test_mode_set, locale_encoding);
+                                       test_mode_set, set_message_encoding);
 
       errors_count = handle_errors (errors_nr, errors_count, &opened_files);
 



reply via email to

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