[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
From: |
Patrice Dumas |
Date: |
Wed, 3 Jan 2024 18:10:55 -0500 (EST) |
branch: master
commit ea8c5a72889e1c930bf13fd7caff917612c661ff
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Thu Jan 4 00:10:54 2024 +0100
* tp/Texinfo/XS/convert/get_html_perl_info.c
(html_converter_initialize_sv): call recopy_converter_conf_sv in
html_converter_initialize_sv as soon as format specific information
has been gathered.
* tp/Texinfo/Convert/HTML.pm (%XS_conversion_overrides)
(_XS_reset_output_init_conf, output),
tp/Texinfo/XS/convert/ConvertXS.xs (reset_output_init_conf)
(html_prepare_conversion_units), tp/Texinfo/XS/main/get_perl_info.c
(reset_output_init_conf): add a specific override,
reset_output_init_conf called after 'output_init_conf' is reset
instead of doing it in html_prepare_conversion_units.
Remove set_output_converter_sv, which did it previously.
---
ChangeLog | 16 ++++++++++++++++
tp/Texinfo/Convert/Converter.pm | 8 ++++++--
tp/Texinfo/Convert/HTML.pm | 4 ++++
tp/Texinfo/XS/convert/ConvertXS.xs | 8 ++++++--
tp/Texinfo/XS/convert/get_html_perl_info.c | 5 +++++
tp/Texinfo/XS/main/get_perl_info.c | 11 +++++------
tp/Texinfo/XS/main/get_perl_info.h | 3 +--
7 files changed, 43 insertions(+), 12 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index d3b4f2cb58..fa7743e783 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2024-01-03 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/XS/convert/get_html_perl_info.c
+ (html_converter_initialize_sv): call recopy_converter_conf_sv in
+ html_converter_initialize_sv as soon as format specific information
+ has been gathered.
+
+ * tp/Texinfo/Convert/HTML.pm (%XS_conversion_overrides)
+ (_XS_reset_output_init_conf, output),
+ tp/Texinfo/XS/convert/ConvertXS.xs (reset_output_init_conf)
+ (html_prepare_conversion_units), tp/Texinfo/XS/main/get_perl_info.c
+ (reset_output_init_conf): add a specific override,
+ reset_output_init_conf called after 'output_init_conf' is reset
+ instead of doing it in html_prepare_conversion_units.
+ Remove set_output_converter_sv, which did it previously.
+
2024-01-03 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/XS/convert/converter.c (copy_option, new_option_value)
diff --git a/tp/Texinfo/Convert/Converter.pm b/tp/Texinfo/Convert/Converter.pm
index cc020aaa8b..f5a541501f 100644
--- a/tp/Texinfo/Convert/Converter.pm
+++ b/tp/Texinfo/Convert/Converter.pm
@@ -317,9 +317,13 @@ sub converter($;$)
$converter->{'error_warning_messages'} = [];
- # XS converter initialization
- # get_conf should not be used before that point, such that the conf is
+ # XS converter initialization.
+ # NOTE get_conf should not be used before that point, such that the conf is
# initialized before it is called for the first time.
+ # NOTE format specific information is not available at this point, such that
+ # some options may not be obtained. This is the case for HTML for instance.
+ # In particular the special units information need to be known before buttons
+ # information can be passed to C.
_XS_converter_initialize($converter);
Texinfo::Common::set_output_encodings($converter,
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index e4e11c5332..9538c7c710 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -118,6 +118,8 @@ my %XS_conversion_overrides = (
=> "Texinfo::Convert::ConvertXS::html_initialize_output_state",
"Texinfo::Convert::HTML::_finalize_output_state"
=> "Texinfo::Convert::ConvertXS::html_finalize_output_state",
+ "Texinfo::Convert::HTML::_XS_reset_output_init_conf"
+ => "Texinfo::Convert::ConvertXS::reset_output_init_conf",
"Texinfo::Convert::HTML::_prepare_simpletitle"
=> "Texinfo::Convert::ConvertXS::html_prepare_simpletitle",
"Texinfo::Convert::HTML::_prepare_converted_output_info"
@@ -12290,6 +12292,8 @@ sub output($$)
# this output file especially. Set a corresponding initial
# configuration.
$self->{'output_init_conf'} = { %{$self->{'conf'}} };
+ # pass to XS.
+ _XS_reset_output_init_conf($self, 'reset_output_init_conf');
# set BODYTEXT
$self->set_global_document_commands('preamble', ['documentlanguage']);
diff --git a/tp/Texinfo/XS/convert/ConvertXS.xs
b/tp/Texinfo/XS/convert/ConvertXS.xs
index f5bbc53930..a531d40b94 100644
--- a/tp/Texinfo/XS/convert/ConvertXS.xs
+++ b/tp/Texinfo/XS/convert/ConvertXS.xs
@@ -1615,6 +1615,10 @@ html_merge_index_entries (SV *converter_in)
if (self)
html_merge_index_entries (self);
+void
+reset_output_init_conf (SV *sv_in, warn_string)
+ char *warn_string = (char *)SvPVutf8_nolen($arg);
+
# my ($output_units, $special_units, $associated_special_units)
# = $self->_prepare_conversion_units($root, $document_name);
void
@@ -1635,8 +1639,8 @@ html_prepare_conversion_units (SV *converter_in, ...)
if (items > 2 && SvOK(ST(2)))
document_name = SvPVutf8_nolen (ST(2));
- self = set_output_converter_sv (converter_in,
- "html_prepare_conversion_units");
+ self = get_sv_converter (converter_in,
+ "html_prepare_conversion_units");
if (self->conf->OUTPUT_CHARACTERS.integer > 0
&& self->conf->OUTPUT_ENCODING_NAME.string
diff --git a/tp/Texinfo/XS/convert/get_html_perl_info.c
b/tp/Texinfo/XS/convert/get_html_perl_info.c
index 508c7e8eca..4850e8c2dc 100644
--- a/tp/Texinfo/XS/convert/get_html_perl_info.c
+++ b/tp/Texinfo/XS/convert/get_html_perl_info.c
@@ -1073,6 +1073,11 @@ html_converter_initialize_sv (SV *converter_sv,
}
}
html_converter_initialize (converter);
+
+ /* at that point, the format specific informations, in particular the number
+ of special elements is available, such that all the options can be
+ passed to C */
+ recopy_converter_conf_sv (converter_hv, converter, &converter->conf, "conf");
}
void
diff --git a/tp/Texinfo/XS/main/get_perl_info.c
b/tp/Texinfo/XS/main/get_perl_info.c
index 961e838cae..9f676e7d3f 100644
--- a/tp/Texinfo/XS/main/get_perl_info.c
+++ b/tp/Texinfo/XS/main/get_perl_info.c
@@ -428,6 +428,8 @@ set_translated_commands (CONVERTER *converter, HV *hv_in)
}
/* Texinfo::Convert::Converter generic initialization for all the converters */
+/* Called early, in particuliar before any format specific code has been
+ called */
int
converter_initialize (SV *converter_sv)
{
@@ -551,9 +553,9 @@ recopy_converter_conf_sv (HV *hv, CONVERTER *converter,
}
}
-/* initialize an XS converter from a perl converter right before conversion */
-CONVERTER *
-set_output_converter_sv (SV *sv_in, const char *warn_string)
+/* reset output_init_conf. Can be called after it has been modified */
+void
+reset_output_init_conf (SV *sv_in, const char *warn_string)
{
HV *hv_in;
CONVERTER *converter = 0;
@@ -564,11 +566,8 @@ set_output_converter_sv (SV *sv_in, const char
*warn_string)
hv_in = (HV *)SvRV (sv_in);
- recopy_converter_conf_sv (hv_in, converter, &converter->conf, "conf");
-
recopy_converter_conf_sv (hv_in, converter, &converter->init_conf,
"output_init_conf");
- return converter;
}
/* code in comments allow to sort the index names to have a fixed order
diff --git a/tp/Texinfo/XS/main/get_perl_info.h
b/tp/Texinfo/XS/main/get_perl_info.h
index 50aa4faca7..d646071b47 100644
--- a/tp/Texinfo/XS/main/get_perl_info.h
+++ b/tp/Texinfo/XS/main/get_perl_info.h
@@ -33,10 +33,9 @@ void recopy_converter_conf_sv (HV *hv, CONVERTER *converter,
void set_conf (CONVERTER *converter, const char *conf, SV *value);
void force_conf (CONVERTER *converter, const char *conf, SV *value);
-CONVERTER *set_output_converter_sv (SV *sv_in, const char *warn_string);
CONVERTER *get_sv_converter (SV *sv_in, const char *warn_string);
-
int converter_initialize (SV *converter_sv);
+void reset_output_init_conf (SV *sv_in, const char *warn_string);
INDEX_SORTED_BY_LETTER *get_sv_index_entries_sorted_by_letter
(INDEX **index_names, SV *index_entries_sorted_by_letter);