[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
From: |
Patrice Dumas |
Date: |
Mon, 6 Nov 2023 02:58:16 -0500 (EST) |
branch: master
commit 7467fde7bc656de6a3c0f19c9bbd2625837d4388
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Mon Nov 6 08:58:04 2023 +0100
* tp/Texinfo/Convert/HTML.pm (_prepare_units_directions_files)
(convert), tp/Texinfo/XS/convert/ConvertXS.xs
(html_prepare_units_directions_files)
(html_prepare_output_units_global_targets),
tp/Texinfo/XS/main/build_perl_info.c
(build_html_global_units_directions)
(set_html_global_units_directions): add
set_html_global_units_directions to set in XS
"global_units_directions" in perl converter instead of returning to
perl.
---
ChangeLog | 13 +++++++++++++
tp/Texinfo/Convert/HTML.pm | 7 ++-----
tp/Texinfo/XS/convert/ConvertXS.xs | 28 ++++++++++++----------------
tp/Texinfo/XS/main/build_perl_info.c | 31 ++++++++++++++++++++++++++++---
tp/Texinfo/XS/main/build_perl_info.h | 3 ++-
5 files changed, 57 insertions(+), 25 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index be7594f9da..d94cc2129b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2023-11-06 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/Convert/HTML.pm (_prepare_units_directions_files)
+ (convert), tp/Texinfo/XS/convert/ConvertXS.xs
+ (html_prepare_units_directions_files)
+ (html_prepare_output_units_global_targets),
+ tp/Texinfo/XS/main/build_perl_info.c
+ (build_html_global_units_directions)
+ (set_html_global_units_directions): add
+ set_html_global_units_directions to set in XS
+ "global_units_directions" in perl converter instead of returning to
+ perl.
+
2023-11-06 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/Convert/Converter.pm, tp/Texinfo/Convert/HTML.pm:
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index 6457180a22..2ba64155c0 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -9473,14 +9473,13 @@ sub _prepare_units_directions_files($$$$$$$$)
my $document_name = shift;
if ($self->{'converter_descriptor'} and $XS_convert) {
- my ($XS_files_source_info, $global_units_directions,
+ my ($XS_files_source_info,
$elements_in_file_count, $filenames,
$file_counters, $out_filepaths)
= _XS_prepare_units_directions_files($self,
$output_units, $special_units, $associated_special_units,
$output_file, $destination_directory,
$output_filename, $document_name);
- $self->{'global_units_directions'} = $global_units_directions;
$self->{'elements_in_file_count'} = $elements_in_file_count;
$self->{'filenames'} = $filenames;
@@ -11172,10 +11171,8 @@ sub convert($$)
if ($self->{'converter_descriptor'} and $XS_convert) {
# Do it preferentially in XS, and import to perl, to have data
# setup in C for XS too.
- my $global_units_directions =
- _XS_prepare_output_units_global_targets($self,
+ _XS_prepare_output_units_global_targets($self,
$output_units, $special_units, $associated_special_units);
- $self->{'global_units_directions'} = $global_units_directions;
} else {
$self->_prepare_output_units_global_targets($output_units,
$special_units,
diff --git a/tp/Texinfo/XS/convert/ConvertXS.xs
b/tp/Texinfo/XS/convert/ConvertXS.xs
index 6ac9cfd86d..f392f8f8b2 100644
--- a/tp/Texinfo/XS/convert/ConvertXS.xs
+++ b/tp/Texinfo/XS/convert/ConvertXS.xs
@@ -286,7 +286,6 @@ html_prepare_units_directions_files (SV *converter_in, SV
*output_units_in, SV *
int associated_special_units_descriptor = 0;
FILE_SOURCE_INFO_LIST *files_source_info = 0;
SV *files_source_info_sv;
- SV *global_units_directions_sv;
SV *elements_in_file_count_sv;
SV *filenames_sv;
@@ -320,9 +319,9 @@ html_prepare_units_directions_files (SV *converter_in, SV
*output_units_in, SV *
files_source_info_sv
= build_html_files_source_info (files_source_info);
- global_units_directions_sv
- = build_html_global_units_directions (self->global_units_directions,
- self->special_units_direction_name);
+ set_html_global_units_directions (converter_in,
+ self->global_units_directions,
+ self->special_units_direction_name);
elements_in_file_count_sv
= build_html_elements_in_file_count (&self->output_unit_files);
@@ -331,16 +330,15 @@ html_prepare_units_directions_files (SV *converter_in, SV
*output_units_in, SV *
file_counters_sv = build_file_counters (&self->output_unit_files);
out_filepaths_sv = build_out_filepaths (&self->output_unit_files);
- EXTEND(SP, 6);
+ EXTEND(SP, 5);
PUSHs(sv_2mortal(files_source_info_sv));
- PUSHs(sv_2mortal(global_units_directions_sv));
PUSHs(sv_2mortal(elements_in_file_count_sv));
PUSHs(sv_2mortal(filenames_sv));
PUSHs(sv_2mortal(file_counters_sv));
PUSHs(sv_2mortal(out_filepaths_sv));
-SV *
+void
html_prepare_output_units_global_targets (SV *converter_in, SV
*output_units_in, SV *special_units_in, SV *associated_special_units_in)
PREINIT:
CONVERTER *self = 0;
@@ -372,11 +370,9 @@ html_prepare_output_units_global_targets (SV
*converter_in, SV *output_units_in,
rebuild_output_units_list (associated_special_units_in,
associated_special_units_descriptor);
- RETVAL
- = build_html_global_units_directions (self->global_units_directions,
- self->special_units_direction_name);
- OUTPUT:
- RETVAL
+ set_html_global_units_directions (converter_in,
+ self->global_units_directions,
+ self->special_units_direction_name);
void
@@ -455,18 +451,18 @@ html_convert_convert (SV *converter_in, SV *tree_in, SV
*output_units_in, SV *sp
int special_units_descriptor = 0;
char *result;
CODE:
- self = get_sv_converter (converter_in, 0);
+ 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_tree_document (tree_in, 0);
+ document = get_sv_tree_document (tree_in, "html_convert_convert");
if (SvOK (output_units_in))
output_units_descriptor
= get_sv_output_units_descriptor (output_units_in,
- "html_prepare_output_units_global_targets output
units");
+ "html_convert_convert output units");
if (SvOK (special_units_in))
special_units_descriptor
= get_sv_output_units_descriptor (special_units_in,
- "html_prepare_output_units_global_targets special
units");
+ "html_convert_convert special units");
result = html_convert_convert (self, document->tree,
output_units_descriptor,
special_units_descriptor);
diff --git a/tp/Texinfo/XS/main/build_perl_info.c
b/tp/Texinfo/XS/main/build_perl_info.c
index 87fb6193dc..324019b631 100644
--- a/tp/Texinfo/XS/main/build_perl_info.c
+++ b/tp/Texinfo/XS/main/build_perl_info.c
@@ -1698,7 +1698,7 @@ build_html_files_source_info (FILE_SOURCE_INFO_LIST
*files_source_info)
return newRV_noinc ((SV *) hv);
}
-SV *
+HV *
build_html_global_units_directions (OUTPUT_UNIT **global_units_directions,
SPECIAL_UNIT_DIRECTION **special_units_direction_name)
{
@@ -1710,7 +1710,7 @@ build_html_global_units_directions (OUTPUT_UNIT
**global_units_directions,
dTHX;
if (!global_units_directions)
- return newSV(0);
+ return 0;
hv = newHV ();
@@ -1732,7 +1732,32 @@ build_html_global_units_directions (OUTPUT_UNIT
**global_units_directions,
newRV_inc ((SV *) output_unit->hv), 0);
}
- return newRV_noinc ((SV *) hv);
+ return hv;
+}
+
+void
+set_html_global_units_directions (SV *converter_sv,
+ OUTPUT_UNIT **global_units_directions,
+ SPECIAL_UNIT_DIRECTION **special_units_direction_name)
+{
+ HV *global_units_directions_hv;
+ SV *global_units_directions_sv;
+
+ dTHX;
+
+ HV *converter_hv = (HV *) SvRV (converter_sv);
+
+ global_units_directions_hv
+ = build_html_global_units_directions (global_units_directions,
+ special_units_direction_name);
+ if (global_units_directions_hv)
+ global_units_directions_sv
+ = newRV_noinc ((SV *) global_units_directions_hv);
+ else
+ global_units_directions_sv = newSV (0);
+
+ hv_store (converter_hv, "global_units_directions",
+ strlen ("global_units_directions"), global_units_directions_sv, 0);
}
SV *
diff --git a/tp/Texinfo/XS/main/build_perl_info.h
b/tp/Texinfo/XS/main/build_perl_info.h
index 2218f0dc81..ee20e646ec 100644
--- a/tp/Texinfo/XS/main/build_perl_info.h
+++ b/tp/Texinfo/XS/main/build_perl_info.h
@@ -45,7 +45,8 @@ void pass_converter_errors (ERROR_MESSAGE_LIST
*error_messages,
HV *converter_hv);
SV *build_html_files_source_info (FILE_SOURCE_INFO_LIST *files_source_info);
-SV *build_html_global_units_directions (OUTPUT_UNIT **global_units_directions,
+void set_html_global_units_directions (SV *converter_sv,
+ OUTPUT_UNIT **global_units_directions,
SPECIAL_UNIT_DIRECTION **special_units_direction_name);
SV *build_html_elements_in_file_count (
FILE_NAME_PATH_COUNTER_LIST *output_unit_files);