[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
From: |
Patrice Dumas |
Date: |
Wed, 13 Mar 2024 19:23:23 -0400 (EDT) |
branch: master
commit fb11aaaf75d35a7fb6198a8008d5ccd8451fdd07
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Wed Mar 13 23:58:45 2024 +0100
* tp/Texinfo/XS/convert/ConvertXS.xs (html_convert_convert)
(html_convert_output): use directly C document associated to
converter.
Other minor changes.
---
ChangeLog | 8 ++++++++
tp/Texinfo/XS/convert/ConvertXS.xs | 28 ++++++++++++++--------------
tp/Texinfo/XS/convert/convert_html.c | 2 +-
tp/Texinfo/XS/main/command_stack.c | 4 ++--
tp/t/test_utils.pl | 2 +-
5 files changed, 26 insertions(+), 18 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 3834688e0d..b04d3ad5ce 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2024-03-13 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/XS/convert/ConvertXS.xs (html_convert_convert)
+ (html_convert_output): use directly C document associated to
+ converter.
+
+ Other minor changes.
+
2024-03-13 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/XS/convert/call_html_perl_function.c: remove conditions
diff --git a/tp/Texinfo/XS/convert/ConvertXS.xs
b/tp/Texinfo/XS/convert/ConvertXS.xs
index b324956a6c..8ec4655e27 100644
--- a/tp/Texinfo/XS/convert/ConvertXS.xs
+++ b/tp/Texinfo/XS/convert/ConvertXS.xs
@@ -1924,6 +1924,8 @@ html_prepare_conversion_units (SV *converter_in, ...)
PUSHs(sv_2mortal(special_units_sv));
PUSHs(sv_2mortal(associated_special_units_sv));
+# the return value is not really used with XS, it is passed to another
+# XS function, but the value is ignored there.
SV *
html_prepare_units_directions_files (SV *converter_in, SV *output_units_in, SV
*special_units_in, SV *associated_special_units_in, output_file,
destination_directory, output_filename, document_name)
const char *output_file = (char *)SvPVutf8_nolen($arg);
@@ -2076,14 +2078,17 @@ html_prepare_title_titlepage (SV *converter_in, SV
*output_units_in, output_file
build_html_formatting_state (self, self->modified_state);
self->modified_state = 0;
}
- /* should always happen as a string is always returned, possibly empty */
- if (self->title_titlepage && self->external_references_number > 0)
+ if (self->external_references_number > 0)
{
- HV *converter_hv = (HV *) SvRV (converter_in);
- SV *title_titlepage_sv
- = newSVpv_utf8 (self->title_titlepage, 0);
- hv_store (converter_hv, "title_titlepage",
+ /* should always happen as a string is always returned, possibly empty */
+ if (self->title_titlepage)
+ {
+ HV *converter_hv = (HV *) SvRV (converter_in);
+ SV *title_titlepage_sv
+ = newSVpv_utf8 (self->title_titlepage, 0);
+ hv_store (converter_hv, "title_titlepage",
strlen ("title_titlepage"), title_titlepage_sv, 0);
+ }
}
}
@@ -2097,8 +2102,7 @@ html_convert_convert (SV *converter_in, SV *document_in,
SV *output_units_in, SV
self = get_sv_converter (converter_in, "html_convert_convert");
/* there could be strange results if the document and the converter
document
do not match. There is no reason why it would happen, though */
- document = get_sv_document_document (document_in,
- "html_convert_convert");
+ document = self->document;
result = html_convert_convert (self, document->tree);
if (self->modified_state)
{
@@ -2147,16 +2151,12 @@ html_convert_output (SV *converter_in, SV *document_in,
SV *output_units_in, SV
const char *document_name = (char *)SvPVutf8_nolen($arg);
PREINIT:
CONVERTER *self = 0;
- DOCUMENT *document = 0;
SV *result_sv = 0;
CODE:
- /* add warn string? */
self = get_sv_converter (converter_in, "html_convert_output");
- document = get_sv_document_document (document_in,
- "html_convert_output");
- if (self && document)
+ if (self && self->document)
{
- char *result = html_convert_output (self, document->tree,
+ char *result = html_convert_output (self, self->document->tree,
output_file, destination_directory, output_filename,
document_name);
diff --git a/tp/Texinfo/XS/convert/convert_html.c
b/tp/Texinfo/XS/convert/convert_html.c
index fa8eb62ab5..646c5ddb15 100644
--- a/tp/Texinfo/XS/convert/convert_html.c
+++ b/tp/Texinfo/XS/convert/convert_html.c
@@ -17433,7 +17433,7 @@ html_translate_names (CONVERTER *self)
if (target_info)
{
/* the tree is a reference to special_unit_info_tree, so it should
- not be freed, but need to be reset to trigger the creation of the
+ not be freed, but it needs to be reset to trigger the creation of the
special_unit_info_tree tree when needed */
clear_tree_added_elements (self, &target_info->tree);
free (target_info->command_text[HTT_string]);
diff --git a/tp/Texinfo/XS/main/command_stack.c
b/tp/Texinfo/XS/main/command_stack.c
index 6bbac2e0f4..2fdc45897a 100644
--- a/tp/Texinfo/XS/main/command_stack.c
+++ b/tp/Texinfo/XS/main/command_stack.c
@@ -219,7 +219,7 @@ pop_stack_element (ELEMENT_STACK *stack)
}
-/* elements stack that can also be called from an external language (perl)
+/* elements stack that can also be called from an external language (Perl)
where there is no reference to C elements */
void
push_element_reference_stack_element (ELEMENT_REFERENCE_STACK *stack,
@@ -269,7 +269,7 @@ command_is_in_referred_command_stack (const
ELEMENT_REFERENCE_STACK *stack,
}
-/* HTML specific but also used to build perl */
+/* HTML specific but also used to build Perl data */
HTML_DOCUMENT_CONTEXT *
html_top_document_context (const CONVERTER *self)
{
diff --git a/tp/t/test_utils.pl b/tp/t/test_utils.pl
index 20761204e0..a22d1794a7 100644
--- a/tp/t/test_utils.pl
+++ b/tp/t/test_utils.pl
@@ -1518,7 +1518,7 @@ sub test($$)
if (defined($converted_errors{$format})) {
local $Data::Dumper::Sortkeys = 1;
$out_result .= Data::Dumper->Dump([$converted_errors{$format}],
-
['$result_converted_errors{\''.$format.'\'}->{\''.$test_name.'\'}'])
+ ['$result_converted_errors{\''.$format.'\'}->{\''.$test_name.'\'}'])
."\n\n";
}
}