[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
From: |
Patrice Dumas |
Date: |
Wed, 2 Oct 2024 02:13:44 -0400 (EDT) |
branch: master
commit 27990b352f2fd7af382dd626ac9379f4b875ccb9
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Wed Oct 2 08:13:46 2024 +0200
* tp/Texinfo/XS/convert/get_converter_perl_info.c
(converter_initialize): readd converter_initialize that was mistakenly
removed.
---
ChangeLog | 6 +++
tp/Texinfo/XS/convert/get_converter_perl_info.c | 66 +++++++++++++++++++++++++
2 files changed, 72 insertions(+)
diff --git a/ChangeLog b/ChangeLog
index df97d5aaf2..bbcb0bb163 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2024-10-02 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/XS/convert/get_converter_perl_info.c
+ (converter_initialize): readd converter_initialize that was mistakenly
+ removed.
+
2024-07-30 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/XS/convert/convert_html.c (direction_string)
diff --git a/tp/Texinfo/XS/convert/get_converter_perl_info.c
b/tp/Texinfo/XS/convert/get_converter_perl_info.c
index 8c935b0bde..27cebdf60f 100644
--- a/tp/Texinfo/XS/convert/get_converter_perl_info.c
+++ b/tp/Texinfo/XS/convert/get_converter_perl_info.c
@@ -169,6 +169,72 @@ get_expanded_formats (HV *hv, EXPANDED_FORMAT
**expanded_formats)
}
}
+/* 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)
+{
+ HV *hv_in;
+ SV **configured_sv;
+ SV **output_format_sv;
+ size_t converter_descriptor = 0;
+ CONVERTER *converter;
+
+ dTHX;
+
+ converter_descriptor = new_converter ();
+ converter = retrieve_converter (converter_descriptor);
+
+ hv_in = (HV *)SvRV (converter_sv);
+
+#define FETCH(key) key##_sv = hv_fetch (hv_in, #key, strlen (#key), 0);
+ FETCH(output_format)
+
+ if (output_format_sv && SvOK (*output_format_sv))
+ {
+ converter->output_format
+ = non_perl_strdup (SvPVutf8_nolen (*output_format_sv));
+ }
+
+ /*
+ fprintf (stderr, "XS|CONVERTER Init: %zu; %s\n", converter_descriptor,
+ converter->output_format);
+ */
+
+ converter->conf = new_options ();
+ /* force is not set, but at this point, the configured field should not
+ be set, so it would not have an effect anyway */
+ copy_converter_conf_sv (hv_in, converter, &converter->conf, "conf", 0);
+
+ converter->init_conf = new_options ();
+ copy_converter_conf_sv (hv_in, converter, &converter->init_conf,
+ "converter_init_conf", 1);
+
+ FETCH(configured);
+
+ if (configured_sv && SvOK (*configured_sv))
+ {
+ get_sv_configured_options (*configured_sv, converter->conf);
+ }
+
+#undef FETCH
+ set_translated_commands (converter, hv_in);
+
+ converter->expanded_formats = new_expanded_formats ();
+ set_expanded_formats_from_options (converter->expanded_formats,
+ converter->conf);
+
+ converter->hv = hv_in;
+
+ /* store converter_descriptor in perl converter */
+ hv_store (hv_in, "converter_descriptor",
+ strlen ("converter_descriptor"),
+ newSViv (converter_descriptor), 0);
+
+ return converter_descriptor;
+}
+
/* output format specific */
/* map hash reference of Convert::Text options to TEXT_OPTIONS */