[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
From: |
Patrice Dumas |
Date: |
Tue, 24 Dec 2024 16:06:41 -0500 (EST) |
branch: master
commit c1af9f09f701a1242decc72a45ef12b3c3bdeaf8
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Tue Dec 24 21:01:04 2024 +0100
* tp/Texinfo/XS/convert/call_conversion_perl.c (call_eval_use_module)
(call_config_GNUT_load_init_file), tp/Texinfo/XS/convert/texinfo.c
(txi_converter_output_format_setup), tp/Texinfo/XS/teximakehtml.c
(main): add call_eval_use_module that evals use module to load a
module. Pass external_module to txi_converter_output_format_setup
to call call_eval_use_module.
* tp/init/book.pm (book_unit_file_name): always return a two elements
list.
---
ChangeLog | 12 ++++++++++++
tp/Texinfo/XS/convert/call_conversion_perl.c | 20 +++++++++++++-------
tp/Texinfo/XS/convert/call_conversion_perl.h | 2 ++
tp/Texinfo/XS/convert/replace_call_conversion_perl.c | 5 +++++
tp/Texinfo/XS/convert/texinfo.c | 15 ++++++++++++---
tp/Texinfo/XS/convert/texinfo.h | 3 ++-
tp/Texinfo/XS/teximakehtml.c | 12 ++++++------
tp/init/book.pm | 2 +-
8 files changed, 53 insertions(+), 18 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 5465bd3477..2f2b22b02f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2024-12-24 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/XS/convert/call_conversion_perl.c (call_eval_use_module)
+ (call_config_GNUT_load_init_file), tp/Texinfo/XS/convert/texinfo.c
+ (txi_converter_output_format_setup), tp/Texinfo/XS/teximakehtml.c
+ (main): add call_eval_use_module that evals use module to load a
+ module. Pass external_module to txi_converter_output_format_setup
+ to call call_eval_use_module.
+
+ * tp/init/book.pm (book_unit_file_name): always return a two elements
+ list.
+
2024-12-24 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/Convert/LaTeX.pm (convert_math_to_images): add
diff --git a/tp/Texinfo/XS/convert/call_conversion_perl.c
b/tp/Texinfo/XS/convert/call_conversion_perl.c
index 6b098134bc..56c0c074db 100644
--- a/tp/Texinfo/XS/convert/call_conversion_perl.c
+++ b/tp/Texinfo/XS/convert/call_conversion_perl.c
@@ -36,7 +36,19 @@
memory allocation */
-static int texinfo_convert_html_module_loaded;
+void
+call_eval_use_module (const char *module_name)
+{
+ SV *sv_str;
+ char *str;
+
+ dTHX;
+
+ sv_str = newSVpvf("use %s;", module_name);
+ str = SvPV_nolen(sv_str);
+
+ eval_pv (str, TRUE);
+}
int
call_config_GNUT_load_init_file (const char *file_path)
@@ -45,12 +57,6 @@ call_config_GNUT_load_init_file (const char *file_path)
dTHX;
- if (!texinfo_convert_html_module_loaded)
- {
- eval_pv ("use Texinfo::Convert::HTML;", TRUE);
- texinfo_convert_html_module_loaded = 1;
- }
-
dSP;
ENTER;
diff --git a/tp/Texinfo/XS/convert/call_conversion_perl.h
b/tp/Texinfo/XS/convert/call_conversion_perl.h
index b91a9fdb73..eb058ccab3 100644
--- a/tp/Texinfo/XS/convert/call_conversion_perl.h
+++ b/tp/Texinfo/XS/convert/call_conversion_perl.h
@@ -6,6 +6,8 @@
#include "document_types.h"
#include "converter_types.h"
+void call_eval_use_module (const char *module_name);
+
CONVERTER *call_convert_converter (const char *module_name,
const CONVERTER_INITIALIZATION_INFO *conf);
char *call_converter_output (const char *module_name, CONVERTER *self,
diff --git a/tp/Texinfo/XS/convert/replace_call_conversion_perl.c
b/tp/Texinfo/XS/convert/replace_call_conversion_perl.c
index f2f301ab6e..931ef06ce1 100644
--- a/tp/Texinfo/XS/convert/replace_call_conversion_perl.c
+++ b/tp/Texinfo/XS/convert/replace_call_conversion_perl.c
@@ -6,6 +6,11 @@
#include "document_types.h"
#include "call_conversion_perl.h"
+void
+call_eval_use_module (const char *module_name)
+{
+}
+
int
call_config_GNUT_load_init_file (const char *file_path)
{
diff --git a/tp/Texinfo/XS/convert/texinfo.c b/tp/Texinfo/XS/convert/texinfo.c
index 99659c18ce..32bd2b0313 100644
--- a/tp/Texinfo/XS/convert/texinfo.c
+++ b/tp/Texinfo/XS/convert/texinfo.c
@@ -187,13 +187,22 @@ txi_customization_loading_finish (int
embedded_interpreter)
/* initialization of the library for a specific output format, to be
called once */
void
-txi_converter_output_format_setup (const char *converted_format)
+txi_converter_output_format_setup (const char *converted_format,
+ const char *external_module)
{
enum converter_format converter_format
= find_format_name_converter_format (converted_format);
- if (converter_format == COF_html)
- html_format_setup ();
+ if (external_module)
+ call_eval_use_module (external_module);
+
+ /* TODO remove the if (!$Texinfo::XSLoader::embedded_xs) in HTML.pm and use
+ an else here? */
+ {
+ /* TODO use the table of format functions? */
+ if (converter_format == COF_html)
+ html_format_setup ();
+ }
}
/* This function should be used to get information on an output format
diff --git a/tp/Texinfo/XS/convert/texinfo.h b/tp/Texinfo/XS/convert/texinfo.h
index 8271f2141d..e7c68f31ef 100644
--- a/tp/Texinfo/XS/convert/texinfo.h
+++ b/tp/Texinfo/XS/convert/texinfo.h
@@ -42,7 +42,8 @@ void txi_set_base_default_options (OPTIONS_LIST *options,
void txi_customization_loading_setup (int embedded_interpreter,
int *argc_ref, char ***argv_ref, char ***env_ref);
-void txi_converter_output_format_setup (const char *format_str);
+void txi_converter_output_format_setup (const char *converted_format,
+ const char *external_module);
CONVERTER_INITIALIZATION_INFO *txi_converter_format_defaults (
const char *format_str,
diff --git a/tp/Texinfo/XS/teximakehtml.c b/tp/Texinfo/XS/teximakehtml.c
index 8b3fcf36ae..661fafba95 100644
--- a/tp/Texinfo/XS/teximakehtml.c
+++ b/tp/Texinfo/XS/teximakehtml.c
@@ -1890,8 +1890,13 @@ main (int argc, char *argv[], char *env[])
free_strings_list (&default_expanded_formats);
+ if (format_specification->module && embedded_interpreter
+ && (!strcmp (converted_format, "html")
+ && loaded_init_files_nr > 0))
+ external_module = format_specification->module;
+
/* corresponds to eval "require $module"; in texi2any.pl */
- txi_converter_output_format_setup (converted_format);
+ txi_converter_output_format_setup (converted_format, external_module);
/*
For now, FORMAT_MENU is the only variable that can be set from converter
@@ -2000,11 +2005,6 @@ main (int argc, char *argv[], char *env[])
configured_name_version);
}
- if (format_specification->module && embedded_interpreter
- && (!strcmp (converted_format, "html")
- && loaded_init_files_nr > 0))
- external_module = format_specification->module;
-
if (optind < argc)
{
int j;
diff --git a/tp/init/book.pm b/tp/init/book.pm
index ebe4b4558a..0aff645231 100644
--- a/tp/init/book.pm
+++ b/tp/init/book.pm
@@ -492,7 +492,7 @@ sub book_unit_file_name($$$$)
$command =
$output_unit->{'unit_command'}->{'extra'}->{'associated_section'};
}
}
- return undef unless ($command);
+ return (undef, undef) unless ($command);
if ($converter->unit_is_top_output_unit($output_unit)) {
$new_file_name = "${prefix}_top.html";
} elsif (defined($command->{'extra'}->{'section_number'})