[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/Convert/Converter.pm (XS_get_unclose
From: |
Patrice Dumas |
Subject: |
branch master updated: * tp/Texinfo/Convert/Converter.pm (XS_get_unclosed_stream): rename _XS_get_unclosed_stream as XS_get_unclosed_stream. |
Date: |
Tue, 01 Oct 2024 11:26:09 -0400 |
This is an automated email from the git hooks/post-receive script.
pertusus pushed a commit to branch master
in repository texinfo.
The following commit(s) were added to refs/heads/master by this push:
new a2e19a30c6 * tp/Texinfo/Convert/Converter.pm (XS_get_unclosed_stream):
rename _XS_get_unclosed_stream as XS_get_unclosed_stream.
a2e19a30c6 is described below
commit a2e19a30c6d831c8d21089cf2ff35d310805ba0e
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Wed Jul 24 14:58:47 2024 +0200
* tp/Texinfo/Convert/Converter.pm (XS_get_unclosed_stream): rename
_XS_get_unclosed_stream as XS_get_unclosed_stream.
* tp/Texinfo/Convert/Converter.pm, tp/Texinfo/Convert/HTML.pm
(output), tp/t/test_utils.pl (close_files), tp/texi2any.pl: handle
undef converter_unclosed_files in texi2any.pl and test_utils.pl
when processing the output of
Texinfo::Common::output_files_unclosed_files by calling
XS_get_unclosed_stream. Remove get_output_files_XS_unclosed_streams,
now unneeded.
---
ChangeLog | 13 +++++++++++++
tp/Texinfo/Convert/Converter.pm | 31 ++-----------------------------
tp/Texinfo/Convert/HTML.pm | 2 --
tp/Texinfo/XS/main/build_perl_info.c | 7 ++-----
tp/t/test_utils.pl | 17 +++++++++++++++--
tp/texi2any.pl | 17 +++++++++++++++--
6 files changed, 47 insertions(+), 40 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index a0a330ef37..46a0a09472 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,19 @@
(call_formatting_function_format_single_footnote): check and reset
flags in build_html_formatting_state.
+2024-07-24 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/Convert/Converter.pm (XS_get_unclosed_stream): rename
+ _XS_get_unclosed_stream as XS_get_unclosed_stream.
+
+ * tp/Texinfo/Convert/Converter.pm, tp/Texinfo/Convert/HTML.pm
+ (output), tp/t/test_utils.pl (close_files), tp/texi2any.pl: handle
+ undef converter_unclosed_files in texi2any.pl and test_utils.pl
+ when processing the output of
+ Texinfo::Common::output_files_unclosed_files by calling
+ XS_get_unclosed_stream. Remove get_output_files_XS_unclosed_streams,
+ now unneeded.
+
2024-07-24 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/Convert/HTML.pm (_prepare_converted_output_info)
diff --git a/tp/Texinfo/Convert/Converter.pm b/tp/Texinfo/Convert/Converter.pm
index e97d10f5e7..be4195f3d5 100644
--- a/tp/Texinfo/Convert/Converter.pm
+++ b/tp/Texinfo/Convert/Converter.pm
@@ -106,7 +106,7 @@ my %XS_overrides = (
"Texinfo::Convert::Converter::destroy"
=> "Texinfo::Convert::ConvertXS::destroy",
- "Texinfo::Convert::Converter::_XS_get_unclosed_stream"
+ "Texinfo::Convert::Converter::XS_get_unclosed_stream"
=> "Texinfo::Convert::ConvertXS::get_unclosed_stream",
);
@@ -1712,38 +1712,11 @@ sub sort_element_counts($$;$$)
return (\@sorted_name_counts_array, $result);
}
-sub _XS_get_unclosed_stream($$)
+sub XS_get_unclosed_stream($$)
{
return undef;
}
-# this method retrieves the file streams of all the unclosed file paths
-# that came from XS (normally through build_output_files_unclosed_files)
-# but are not associated to a stream yet, as they can't be directly
-# associated to a stream in C code, but the stream can be returned through
-# an XS interface, here Texinfo::Convert::ConvertXS::get_unclosed_stream.
-sub get_output_files_XS_unclosed_streams($)
-{
- my $self = shift;
-
- my $converter_unclosed_files
- = Texinfo::Common::output_files_unclosed_files(
- $self->output_files_information());
- if ($converter_unclosed_files) {
- foreach my $unclosed_file (keys(%$converter_unclosed_files)) {
- if (!defined($converter_unclosed_files->{$unclosed_file})) {
- my $fh = _XS_get_unclosed_stream($self, $unclosed_file);
- if (defined($fh)) {
- $converter_unclosed_files->{$unclosed_file} = $fh;
- } else {
- delete $converter_unclosed_files->{$unclosed_file};
- }
- }
- }
- }
-}
-
-
########################################################################
# XML related methods and variables that may be used in different
# XML Converters.
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index ced8d9ab78..92a9bb2560 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -13552,8 +13552,6 @@ sub output($$)
$destination_directory, $output_filename,
$document_name,
$document, $output_units, $special_units);
- $self->get_output_files_XS_unclosed_streams();
-
if (!defined($text_output)) {
$self->conversion_finalization();
return undef;
diff --git a/tp/Texinfo/XS/main/build_perl_info.c
b/tp/Texinfo/XS/main/build_perl_info.c
index b52f358fca..31fa797692 100644
--- a/tp/Texinfo/XS/main/build_perl_info.c
+++ b/tp/Texinfo/XS/main/build_perl_info.c
@@ -2571,14 +2571,11 @@ build_output_files_unclosed_files (HV *hv,
However, it is possible to pass a stream through the XS
interface. Therefore here, the unclosed file name is registered,
- the stream can then be passed to perl through a call of
+ the stream can then be passed to Perl through a call of
the XS interface Texinfo::Convert::ConvertXS::get_unclosed_stream.
- This is normally done by calling get_output_files_XS_unclosed_streams
- as this method retrieves the file streams of all the unclosed file
- paths that came from XS and are not associated to a stream.
Register that there is an unclosed file from XS by associating
- with undef; if from perl, it would be associated with a file handle */
+ with undef; if from Perl, it would be associated with a file handle */
SV *file_path_sv = newSVpv_byte (file_path, 0);
hv_store_ent (unclosed_files_hv, file_path_sv, newSV (0), 0);
}
diff --git a/tp/t/test_utils.pl b/tp/t/test_utils.pl
index 6501d71094..791130000d 100644
--- a/tp/t/test_utils.pl
+++ b/tp/t/test_utils.pl
@@ -429,9 +429,22 @@ sub close_files($)
if ($converter_unclosed_files) {
my $close_error_nr = 0;
foreach my $unclosed_file (keys(%$converter_unclosed_files)) {
- if (!close($converter_unclosed_files->{$unclosed_file})) {
+ my $fh = $converter_unclosed_files->{$unclosed_file};
+ # undefined file handle means that the path comes from XS (normally
+ # through build_output_files_unclosed_files) but is not associated
+ # with a file handle yet, as a file handle can't be directly associated
+ # with a stream in C code, but the stream can be returned through
+ # an XS interface, here
+ # Texinfo::Convert::ConvertXS::get_unclosed_stream.
+ if (!defined($fh)) {
+ $fh = $converter->XS_get_unclosed_stream($unclosed_file);
+ if (!defined($fh)) {
+ next;
+ }
+ }
+ if (!close($fh)) {
warn(sprintf("tp_utils.pl: error on closing %s: %s\n",
- $converter_unclosed_files->{$unclosed_file}, $!));
+ $unclosed_file, $!));
$close_error_nr++;
}
}
diff --git a/tp/texi2any.pl b/tp/texi2any.pl
index b0ee88ff38..f80a2039e7 100755
--- a/tp/texi2any.pl
+++ b/tp/texi2any.pl
@@ -1526,7 +1526,7 @@ if (get_conf('TREE_TRANSFORMATIONS')) {
# not the case, the converted format is set here. For example, for
# the epub3 format, the converted format is html. The converted format
# should be the format actually used for conversion, in practice
-# this means that the module associated to the converted format in
+# this means that the module associated with the converted format in
# $format_table will be used to find the converter methods.
my $converted_format = $format;
if ($formats_table{$format}->{'converted_format'}) {
@@ -1987,7 +1987,20 @@ while(@input_files) {
$main_unclosed_files{$unclosed_file}
= $converter_unclosed_files->{$unclosed_file};
} else {
- if (!close($converter_unclosed_files->{$unclosed_file})) {
+ my $fh = $converter_unclosed_files->{$unclosed_file};
+ # undefined file handle means that the path comes from XS (normally
+ # through build_output_files_unclosed_files) but is not associated
+ # with a file handle yet, as a file handle can't be directly associated
+ # with a stream in C code, but the stream can be returned through
+ # an XS interface, here
+ # Texinfo::Convert::ConvertXS::get_unclosed_stream.
+ if (!defined($fh)) {
+ $fh = $converter->XS_get_unclosed_stream($unclosed_file);
+ if (!defined($fh)) {
+ next;
+ }
+ }
+ if (!close($fh)) {
warn(sprintf(__("%s: error on closing %s: %s\n"),
$real_command_name, $unclosed_file, $!));
$error_count++;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/Convert/Converter.pm (XS_get_unclosed_stream): rename _XS_get_unclosed_stream as XS_get_unclosed_stream.,
Patrice Dumas <=
- Prev by Date:
branch master updated: * tp/Texinfo/Convert/HTML.pm (_prepare_converted_output_info) (output), tp/Texinfo/XS/convert/ConvertXS.xs (html_prepare_converted_output_info), tp/Texinfo/XS/convert/convert_html.c (html_prepare_converted_output_info): move code from output, before and after _prepare_converted_output_info to _prepare_converted_output_info, including call of prepare_title_titlepage. Add arguments for prepare_title_titlepage. Update XS override and C code.
- Next by Date:
branch master updated: * tp/Texinfo/Convert/HTML.pm (_prepare_converted_output_info) (output), tp/Texinfo/XS/convert/convert_html.c (html_prepare_converted_output_info): move call of structure handler to the beginning of _prepare_converted_output_info out of output.
- Previous by thread:
branch master updated: * tp/Texinfo/Convert/HTML.pm (_prepare_converted_output_info) (output), tp/Texinfo/XS/convert/ConvertXS.xs (html_prepare_converted_output_info), tp/Texinfo/XS/convert/convert_html.c (html_prepare_converted_output_info): move code from output, before and after _prepare_converted_output_info to _prepare_converted_output_info, including call of prepare_title_titlepage. Add arguments for prepare_title_titlepage. Update XS override and C code.
- Next by thread:
branch master updated: * tp/Texinfo/Convert/HTML.pm (_prepare_converted_output_info) (output), tp/Texinfo/XS/convert/convert_html.c (html_prepare_converted_output_info): move call of structure handler to the beginning of _prepare_converted_output_info out of output.
- Index(es):