texinfo-commits
[Top][All Lists]
Advanced

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

[no subject]


From: Patrice Dumas
Date: Sun, 27 Oct 2024 17:53:37 -0400 (EDT)

branch: master
commit f9ebe832ea780912e57c04ab5ba6e6f0b09c1c75
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sun Oct 27 22:53:25 2024 +0100

    * tp/Texinfo/XS/convert/converter.c (converter_converter),
    tp/Texinfo/XS/convert/texinfo.c (txi_converter_setup): call
    converter_initialize in txi_converter_setup, not in
    converter_converter.
    Add top_srcdir/util to TEXINFO_LANGUAGE_DIRECTORIES as in texi2any.pl,
    after the converter_converter call and before calling
    converter_initialize.
---
 ChangeLog                         | 10 ++++++++++
 tp/Texinfo/XS/convert/converter.c | 12 ++++++++----
 tp/Texinfo/XS/convert/converter.h |  1 +
 tp/Texinfo/XS/convert/texinfo.c   | 34 +++++++++++++++++++++++++---------
 4 files changed, 44 insertions(+), 13 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 0507f01b37..f4cad26ee5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2024-10-27  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/XS/convert/converter.c (converter_converter),
+       tp/Texinfo/XS/convert/texinfo.c (txi_converter_setup): call
+       converter_initialize in txi_converter_setup, not in
+       converter_converter.
+       Add top_srcdir/util to TEXINFO_LANGUAGE_DIRECTORIES as in texi2any.pl,
+       after the converter_converter call and before calling
+       converter_initialize.
+
 2024-10-27  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/XS/teximakehtml.c (main): call txi_general_setup with
diff --git a/tp/Texinfo/XS/convert/converter.c 
b/tp/Texinfo/XS/convert/converter.c
index c0c281ee82..a4df233f18 100644
--- a/tp/Texinfo/XS/convert/converter.c
+++ b/tp/Texinfo/XS/convert/converter.c
@@ -431,7 +431,7 @@ converter_defaults (enum converter_format converter_format,
 }
 
 /* corresponds to Perl $converter->converter_initialize() Converter */
-static void
+void
 converter_initialize (CONVERTER *converter)
 {
   if (converter->format != COF_none
@@ -443,7 +443,13 @@ converter_initialize (CONVERTER *converter)
     }
 }
 
-/* Texinfo::Convert::XXXX->converter($conf) in Perl */
+/* Texinfo::Convert::XXXX->converter($conf) in Perl, except for the call
+   to converter_initialize. */
+/* FIXME should it contain converter_initialize?  It does not to be able
+   to set TEXINFO_LANGUAGE_DIRECTORIES after set_converter_init_information
+   call to be able to check if TEST customization option is set.  This seems
+   too different from the logic used in Perl where customisation variables
+   are available very early, in texi2any.pl */
 /* only called from C, not from Perl */
 CONVERTER *
 converter_converter (enum converter_format format,
@@ -470,8 +476,6 @@ converter_converter (enum converter_format format,
 
   destroy_converter_initialization_info (user_conf);
 
-  converter_initialize (converter);
-
   return converter;
 }
 
diff --git a/tp/Texinfo/XS/convert/converter.h 
b/tp/Texinfo/XS/convert/converter.h
index c76037f983..f2437d6927 100644
--- a/tp/Texinfo/XS/convert/converter.h
+++ b/tp/Texinfo/XS/convert/converter.h
@@ -146,6 +146,7 @@ CONVERTER_INITIALIZATION_INFO *converter_defaults (
                     CONVERTER_INITIALIZATION_INFO *user_conf);
 CONVERTER *converter_converter (enum converter_format format,
                      const CONVERTER_INITIALIZATION_INFO *input_user_conf);
+void converter_initialize (CONVERTER *converter);
 
 CONVERTER_INITIALIZATION_INFO *new_converter_initialization_info (void);
 void destroy_converter_initialization_info (
diff --git a/tp/Texinfo/XS/convert/texinfo.c b/tp/Texinfo/XS/convert/texinfo.c
index 6421398273..9ee262b075 100644
--- a/tp/Texinfo/XS/convert/texinfo.c
+++ b/tp/Texinfo/XS/convert/texinfo.c
@@ -344,7 +344,7 @@ txi_converter_setup (const char *format_str,
                      const char *output_format,
                      const char *locale_encoding,
                      const char *program_file,
-                     const STRING_LIST *texinfo_language_config_dirs,
+                     const STRING_LIST *texinfo_language_config_dirs_in,
                      OPTIONS_LIST *customizations)
 {
   enum converter_format converter_format
@@ -357,6 +357,7 @@ txi_converter_setup (const char *format_str,
   const char *configured_url = PACKAGE_URL_CONFIG;
   const char *configured_name_version
     = PACKAGE_NAME_CONFIG " " PACKAGE_VERSION_CONFIG;
+  STRING_LIST *texinfo_language_config_dirs = new_string_list ();
 
   conf = new_converter_initialization_info ();
 
@@ -370,14 +371,11 @@ txi_converter_setup (const char *format_str,
     err_add_option_string_value (&conf->conf, txi_base_sorted_options,
                         "TEXINFO_OUTPUT_FORMAT", 0, format_str);
 
-  if (texinfo_language_config_dirs)
-    {
-      if (! add_option_strlist_value (&conf->conf, txi_base_sorted_options,
-                               "TEXINFO_LANGUAGE_DIRECTORIES",
-                               texinfo_language_config_dirs))
-       fprintf (stderr, "BUG: error setting %s\n",
-                        "TEXINFO_LANGUAGE_DIRECTORIES");
-    }
+
+  if (texinfo_language_config_dirs_in)
+    copy_strings (texinfo_language_config_dirs,
+                  texinfo_language_config_dirs_in);
+
 
   /* similar to options coming from texi2any */
   err_add_option_string_value (&conf->conf, txi_base_sorted_options,
@@ -413,7 +411,25 @@ txi_converter_setup (const char *format_str,
 
   self = converter_converter (converter_format, conf);
 
+  if (!self->conf->TEST.o.integer && conversion_paths_info.texinfo_uninstalled
+      && conversion_paths_info.p.uninstalled.top_srcdir)
+    {
+      char *in_source_util_dir;
+      xasprintf (&in_source_util_dir, "%s/util",
+                conversion_paths_info.p.uninstalled.top_srcdir);
+      add_string (in_source_util_dir, texinfo_language_config_dirs);
+      free (in_source_util_dir);
+    }
+
+  copy_strings (self->conf->TEXINFO_LANGUAGE_DIRECTORIES.o.strlist,
+                texinfo_language_config_dirs);
+
+  destroy_strings_list (texinfo_language_config_dirs);
+
   destroy_converter_initialization_info (conf);
+
+  converter_initialize (self);
+
   return self;
 }
 



reply via email to

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