[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/init/book.pm (book_unit_file_name), tp/t/ini
From: |
Patrice Dumas |
Subject: |
branch master updated: * tp/init/book.pm (book_unit_file_name), tp/t/init/misc_file_collision.init (test_misc_file_name), tp/t/init/only_toc_out.init (toc_out_element_file_name): access 'document_name' through get_info API only. |
Date: |
Sun, 29 Sep 2024 14:44: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 61f9a42a88 * tp/init/book.pm (book_unit_file_name),
tp/t/init/misc_file_collision.init (test_misc_file_name),
tp/t/init/only_toc_out.init (toc_out_element_file_name): access 'document_name'
through get_info API only.
61f9a42a88 is described below
commit 61f9a42a88779a27cdbbe29a4408f069218368f7
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sat Jul 6 21:04:26 2024 +0200
* tp/init/book.pm (book_unit_file_name),
tp/t/init/misc_file_collision.init (test_misc_file_name),
tp/t/init/only_toc_out.init (toc_out_element_file_name): access
'document_name' through get_info API only.
* tp/Texinfo/Convert/HTML.pm (_set_non_breaking_space)
(conversion_initialization, _prepare_title_titlepage)
(_prepare_simpletitle, convert, _prepare_converted_output_info)
(output, get_info), tp/Texinfo/XS/convert/ConvertXS.xs
(html_prepare_converted_output_info, html_prepare_title_titlepage),
tp/Texinfo/XS/convert/build_html_perl_state.c (build_simpletitle),
tp/Texinfo/XS/convert/get_html_perl_info.c
(html_converter_prepare_output_sv): set converter_info information
directly, not from the converter hash, as soon as the information is
ready. Do not set the converter_info information in converter hash
unless it is directly accessed for speed. Also do not set
converter_info information as a reference on string, always set a
string directly. Remove _reset_info.
* tp/Texinfo/Convert/HTML.pm: remove $xml_numeric_entity_nbsp, it is
unused.
---
ChangeLog | 24 +++++
tp/Texinfo/Convert/HTML.pm | 112 +++++++-------------
tp/Texinfo/XS/convert/ConvertXS.xs | 43 ++++++--
tp/Texinfo/XS/convert/build_html_perl_state.c | 7 +-
tp/Texinfo/XS/convert/build_html_perl_state.h | 2 +-
tp/Texinfo/XS/convert/get_html_perl_info.c | 141 ++++++++++++++------------
tp/init/book.pm | 2 +-
tp/t/init/misc_file_collision.init | 2 +-
tp/t/init/only_toc_out.init | 2 +-
9 files changed, 181 insertions(+), 154 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index a2b554afb6..0ca1bdbfd7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,27 @@
+2024-07-06 Patrice Dumas <pertusus@free.fr>
+
+ * tp/init/book.pm (book_unit_file_name),
+ tp/t/init/misc_file_collision.init (test_misc_file_name),
+ tp/t/init/only_toc_out.init (toc_out_element_file_name): access
+ 'document_name' through get_info API only.
+
+ * tp/Texinfo/Convert/HTML.pm (_set_non_breaking_space)
+ (conversion_initialization, _prepare_title_titlepage)
+ (_prepare_simpletitle, convert, _prepare_converted_output_info)
+ (output, get_info), tp/Texinfo/XS/convert/ConvertXS.xs
+ (html_prepare_converted_output_info, html_prepare_title_titlepage),
+ tp/Texinfo/XS/convert/build_html_perl_state.c (build_simpletitle),
+ tp/Texinfo/XS/convert/get_html_perl_info.c
+ (html_converter_prepare_output_sv): set converter_info information
+ directly, not from the converter hash, as soon as the information is
+ ready. Do not set the converter_info information in converter hash
+ unless it is directly accessed for speed. Also do not set
+ converter_info information as a reference on string, always set a
+ string directly. Remove _reset_info.
+
+ * tp/Texinfo/Convert/HTML.pm: remove $xml_numeric_entity_nbsp, it is
+ unused.
+
2024-07-06 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/Convert/DocBook.pm: call internal functions as
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index 3e63fa7779..98d7b08249 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -480,7 +480,6 @@ sub close_html_lone_element($$) {
return $html_element .'>';
}
-my $xml_numeric_entity_nbsp = '&#'.hex('00A0').';';
my $xml_named_entity_nbsp = ' ';
my $html_default_entity_nbsp = $xml_named_entity_nbsp;
@@ -2442,7 +2441,6 @@ sub current_output_unit($)
# information from converter available 'read-only', set up before
# really starting the formatting.
-# 'document' is set up in the generic converter
my %available_converter_info;
foreach my $converter_info ('copying_comment',
'destination_directory', 'document', 'document_name',
@@ -2462,11 +2460,7 @@ sub get_info($$)
confess("BUG: $converter_info not an available converter info");
}
if (defined($self->{'converter_info'}->{$converter_info})) {
- if (ref($self->{'converter_info'}->{$converter_info}) eq 'SCALAR') {
- return ${$self->{'converter_info'}->{$converter_info}};
- } else {
- return $self->{'converter_info'}->{$converter_info};
- }
+ return $self->{'converter_info'}->{$converter_info};
}
return undef;
}
@@ -8798,7 +8792,9 @@ sub _set_non_breaking_space($$)
{
my $self = shift;
my $non_breaking_space = shift;
+ # used for direct access for speed
$self->{'non_breaking_space'} = $non_breaking_space;
+ $self->{'converter_info'}->{'non_breaking_space'} = $non_breaking_space;
}
# transform <hr> to <hr/>
@@ -12193,8 +12189,12 @@ sub conversion_initialization($;$)
my $self = shift;
my $document = shift;
+ $self->{'converter_info'}
+ = {'expanded_formats' => $self->{'expanded_formats'}};
+
if ($document) {
$self->set_document($document);
+ $self->{'converter_info'}->{'document'} = $document;
}
# duplicate such as not to modify the defaults
@@ -12234,7 +12234,8 @@ sub conversion_initialization($;$)
} else {
$self->_set_non_breaking_space($xml_named_entity_nbsp);
}
- $self->{'paragraph_symbol'} = $special_characters_set{'paragraph_symbol'};
+ $self->{'converter_info'}->{'paragraph_symbol'}
+ = $special_characters_set{'paragraph_symbol'};
if (not defined($self->get_conf('OPEN_QUOTE_SYMBOL'))) {
my $set = $self->set_conf('OPEN_QUOTE_SYMBOL',
@@ -12276,6 +12277,8 @@ sub conversion_initialization($;$)
} else {
$self->{'line_break_element'} = '<br>';
}
+ $self->{'converter_info'}->{'line_break_element'}
+ = $self->{'line_break_element'};
$conf_default_no_arg_commands_formatting_normal->{'*'}->{'text'}
= $self->{'line_break_element'};
@@ -12462,7 +12465,7 @@ sub _prepare_title_titlepage($$$$)
}
# title
- $self->{'title_titlepage'}
+ $self->{'converter_info'}->{'title_titlepage'}
= &{$self->formatting_function('format_title_titlepage')}($self);
$self->{'current_filename'} = undef;
}
@@ -12504,8 +12507,10 @@ sub _prepare_simpletitle($)
next if (!$command->{'args'} or !$command->{'args'}->[0]
or !$command->{'args'}->[0]->{'contents'}
or !scalar(@{$command->{'args'}->[0]->{'contents'}}));
- $self->{'simpletitle_tree'} = $command->{'args'}->[0];
- $self->{'simpletitle_command_name'} = $simpletitle_command;
+ $self->{'converter_info'}->{'simpletitle_tree'}
+ = $command->{'args'}->[0];
+ $self->{'converter_info'}->{'simpletitle_command_name'}
+ = $simpletitle_command;
last;
}
}
@@ -12532,10 +12537,6 @@ sub convert($$)
sort(keys(%contents_command_special_unit_variety));
$self->set_global_document_commands('last', \@contents_elements_options);
- # call before _prepare_conversion_units.
- # Some information is not available yet.
- $self->_reset_info();
-
# cache, as it is checked for each text element
if ($self->get_conf('OUTPUT_CHARACTERS')
and $self->get_conf('OUTPUT_ENCODING_NAME')
@@ -12566,16 +12567,11 @@ sub convert($$)
$self->_prepare_simpletitle();
- $self->_reset_info();
-
# title. Not often set in the default case, as convert() is only
# used in the *.t tests, and a title requires both simpletitle_tree
# and SHOW_TITLE set, with the default formatting function.
$self->_prepare_title_titlepage('', '', $output_units);
- # complete information should be available.
- $self->_reset_info();
-
# main conversion here
my $result = $self->_html_convert_convert($document, $output_units,
$special_units);
@@ -12757,24 +12753,6 @@ sub run_stage_handlers($$$$)
return 0;
}
-sub _reset_info()
-{
- my $self = shift;
-
- # reset to be sure that there is no stale information
- $self->{'converter_info'} = {};
- foreach my $converter_info (keys(%available_converter_info)) {
- if (exists($self->{$converter_info})) {
- if (ref($self->{$converter_info}) eq '') {
- # for scalar, use references in case it may change
- $self->{'converter_info'}->{$converter_info} =
\$self->{$converter_info};
- } else {
- $self->{'converter_info'}->{$converter_info} =
$self->{$converter_info};
- }
- }
- }
-}
-
sub _do_js_files($$)
{
my $self = shift;
@@ -12875,11 +12853,12 @@ sub _prepare_converted_output_info($)
}
my $html_title_string;
+ my $title_tree;
if ($fulltitle_tree) {
- $self->{'title_tree'} = $fulltitle_tree;
+ $title_tree = $fulltitle_tree;
$html_title_string
= $self->convert_tree_new_formatting_context({'type' => '_string',
- 'contents' => [$self->{'title_tree'}]},
+ 'contents' => [$title_tree]},
'title_string');
if ($html_title_string !~ /\S/) {
$html_title_string = undef;
@@ -12887,10 +12866,11 @@ sub _prepare_converted_output_info($)
}
if (!defined($html_title_string)) {
my $default_title = $self->cdt('Untitled Document');
- $self->{'title_tree'} = $default_title;
- $self->{'title_string'}
+ $title_tree = $default_title;
+ $self->{'converter_info'}->{'title_tree'} = $title_tree;
+ $self->{'converter_info'}->{'title_string'}
= $self->convert_tree_new_formatting_context({'type' => '_string',
- 'contents' => [$self->{'title_tree'}]},
+ 'contents' => [$title_tree]},
'title_string');
my $input_file_name;
@@ -12910,7 +12890,8 @@ sub _prepare_converted_output_info($)
"must specify a title with a title command or
\@top"));
}
} else {
- $self->{'title_string'} = $html_title_string;
+ $self->{'converter_info'}->{'title_tree'} = $title_tree;
+ $self->{'converter_info'}->{'title_string'} = $html_title_string;
}
# copying comment
@@ -12919,23 +12900,25 @@ sub _prepare_converted_output_info($)
{'contents' => $global_commands->{'copying'}->{'contents'}},
$self->{'convert_text_options'});
if ($copying_comment ne '') {
- $self->{'copying_comment'}
+ $self->{'converter_info'}->{'copying_comment'}
= &{$self->formatting_function('format_comment')}($self,
$copying_comment);
}
}
# documentdescription
if (defined($self->get_conf('documentdescription'))) {
- $self->{'documentdescription_string'}
+ $self->{'converter_info'}->{'documentdescription_string'}
= $self->get_conf('documentdescription');
} elsif ($global_commands and $global_commands->{'documentdescription'}) {
my $tmp = {'contents'
=> $global_commands->{'documentdescription'}->{'contents'}};
- $self->{'documentdescription_string'}
+ my $documentdescription_string
= $self->convert_tree_new_formatting_context({'type' => '_string',
'contents' => [$tmp],},
'documentdescription');
- chomp($self->{'documentdescription_string'});
+ chomp($documentdescription_string);
+ $self->{'converter_info'}->{'documentdescription_string'}
+ = $documentdescription_string;
}
}
@@ -13351,10 +13334,6 @@ sub output($$)
$self->set_conf('SHOW_TITLE', 1);
}
- # set information, to have some information for run_stage_handlers.
- # Some information is not available yet.
- $self->_reset_info();
-
# TODO call in converter_initialize
my $stage_handlers = Texinfo::Config::GNUT_get_stage_handlers();
@@ -13390,7 +13369,7 @@ sub output($$)
sort(keys(%contents_command_special_unit_variety));
$self->set_global_document_commands('last', \@contents_elements_options);
- $self->{'jslicenses'} = {};
+ my $jslicenses = {};
if ($self->get_conf('HTML_MATH')
and $self->get_conf('HTML_MATH') eq 'mathjax') {
# See https://www.gnu.org/licenses/javascript-labels.html
@@ -13398,14 +13377,14 @@ sub output($$)
my $mathjax_script = $self->get_conf('MATHJAX_SCRIPT');
my $mathjax_source = $self->get_conf('MATHJAX_SOURCE');
- $self->{'jslicenses'}->{'mathjax'} = {
+ $jslicenses->{'mathjax'} = {
$mathjax_script =>
[ 'Apache License, Version 2.0.',
'https://www.apache.org/licenses/LICENSE-2.0',
$mathjax_source ]};
}
if ($self->get_conf('INFO_JS_DIR')) {
- $self->{'jslicenses'}->{'infojs'} = {
+ $jslicenses->{'infojs'} = {
'js/info.js' =>
[ 'GNU General Public License 3.0 or later',
'http://www.gnu.org/licenses/gpl-3.0.html',
@@ -13415,6 +13394,9 @@ sub output($$)
'http://www.jclark.com/xml/copying.txt',
'js/modernizr.js' ]};
}
+
+ $self->{'converter_info'}->{'jslicenses'} = $jslicenses;
+
$self->_prepare_css();
# this sets OUTFILE, to be used if not split, but also 'output_filename'
@@ -13433,13 +13415,8 @@ sub output($$)
}
# set for init files
- $self->{'document_name'} = $document_name;
- $self->{'destination_directory'} = $destination_directory;
-
- # set information, to have it available for the conversions
- # in translate_names
- # Some information is not available yet.
- $self->_reset_info();
+ $self->{'converter_info'}->{'document_name'} = $document_name;
+ $self->{'converter_info'}->{'destination_directory'} =
$destination_directory;
# cache, as it is checked for each text element
if ($self->get_conf('OUTPUT_CHARACTERS')
@@ -13464,10 +13441,6 @@ sub output($$)
$output_file, $destination_directory, $output_filename,
$document_name);
- # set information, to have it ready for run_stage_handlers and for titles
- # formatting. Some information is not available yet.
- $self->_reset_info();
-
my $structure_status = $self->run_stage_handlers($stage_handlers,
$document, 'structure');
unless ($structure_status < $handler_fatal_error_level
@@ -13492,10 +13465,6 @@ sub output($$)
$self->_prepare_converted_output_info();
- # set information, to have it ready for run_stage_handlers.
- # Some information is not available yet.
- $self->_reset_info();
-
# TODO document that this stage handler is called with end of preamble
# documentlanguage when it is certain that this will not change ever.
my $init_status = $self->run_stage_handlers($stage_handlers,
@@ -13520,9 +13489,6 @@ sub output($$)
$self->_translate_names();
}
- # complete information should be available.
- $self->_reset_info();
-
# conversion
my $text_output = $self->_html_convert_output($output_file,
$destination_directory, $output_filename,
$document_name,
diff --git a/tp/Texinfo/XS/convert/ConvertXS.xs
b/tp/Texinfo/XS/convert/ConvertXS.xs
index 7c89fb82bc..dbce41be30 100644
--- a/tp/Texinfo/XS/convert/ConvertXS.xs
+++ b/tp/Texinfo/XS/convert/ConvertXS.xs
@@ -2163,24 +2163,40 @@ html_prepare_converted_output_info (SV *converter_in)
if (self->external_references_number > 0)
{
+ HV *converter_info_hv;
+ SV **converter_info_sv
+ = hv_fetch (converter_hv, "converter_info",
+ strlen ("converter_info"), 0);
+
+ if (!converter_info_sv)
+ fatal ("html_prepare_converted_output_info: "
+ "no converter_info found in converter Perl hash");
+
+ if (!SvOK (*converter_info_sv))
+ fatal ("html_prepare_converted_output_info: "
+ "converter_info undef in converter Perl hash");
+
+ converter_info_hv = (HV *) SvRV (*converter_info_sv);
+
if (self->added_title_tree)
build_texinfo_tree (self->title_tree, 1);
if (self->simpletitle_tree)
- build_simpletitle (self, converter_hv);
+ build_simpletitle (self, converter_info_hv);
- hv_store (converter_hv, "title_tree", strlen ("title_tree"),
+ hv_store (converter_info_hv, "title_tree",
+ strlen ("title_tree"),
newRV_inc ((SV *) self->title_tree->hv), 0);
- hv_store (converter_hv, "title_string",
+ hv_store (converter_info_hv, "title_string",
strlen ("title_string"),
newSVpv_utf8 (self->title_string, 0), 0);
if (self->copying_comment)
- hv_store (converter_hv, "copying_comment",
+ hv_store (converter_info_hv, "copying_comment",
strlen ("copying_comment"),
newSVpv_utf8 (self->copying_comment, 0), 0);
if (self->documentdescription_string)
- hv_store (converter_hv, "documentdescription_string",
+ hv_store (converter_info_hv, "documentdescription_string",
strlen ("documentdescription_string"),
newSVpv_utf8 (self->documentdescription_string, 0), 0);
}
@@ -2212,9 +2228,24 @@ html_prepare_title_titlepage (SV *converter_in,
output_file, output_filename, ..
if (self->title_titlepage)
{
HV *converter_hv = (HV *) SvRV (converter_in);
+ HV *converter_info_hv;
+ SV **converter_info_sv
+ = hv_fetch (converter_hv, "converter_info",
+ strlen ("converter_info"), 0);
SV *title_titlepage_sv
= newSVpv_utf8 (self->title_titlepage, 0);
- hv_store (converter_hv, "title_titlepage",
+
+ if (!converter_info_sv)
+ fatal ("html_prepare_title_titlepage: "
+ "no converter_info found in converter Perl hash");
+
+ if (!SvOK (*converter_info_sv))
+ fatal ("html_prepare_title_titlepage: "
+ "converter_info undef in converter Perl hash");
+
+ converter_info_hv = (HV *) SvRV (*converter_info_sv);
+
+ hv_store (converter_info_hv, "title_titlepage",
strlen ("title_titlepage"), title_titlepage_sv, 0);
}
}
diff --git a/tp/Texinfo/XS/convert/build_html_perl_state.c
b/tp/Texinfo/XS/convert/build_html_perl_state.c
index d865b608d0..148e1f6b9a 100644
--- a/tp/Texinfo/XS/convert/build_html_perl_state.c
+++ b/tp/Texinfo/XS/convert/build_html_perl_state.c
@@ -539,15 +539,14 @@ build_pending_footnotes (AV *av,
HTML_PENDING_FOOTNOTE_STACK *stack)
}
void
-build_simpletitle (CONVERTER *converter, HV *converter_hv)
+build_simpletitle (CONVERTER *converter, HV *converter_info_hv)
{
-
dTHX;
- hv_store (converter_hv, "simpletitle_tree",
+ hv_store (converter_info_hv, "simpletitle_tree",
strlen ("simpletitle_tree"),
newRV_inc ((SV *) converter->simpletitle_tree->hv), 0);
- hv_store (converter_hv, "simpletitle_command_name",
+ hv_store (converter_info_hv, "simpletitle_command_name",
strlen ("simpletitle_command_name"),
newSVpv (builtin_command_name (converter->simpletitle_cmd), 0), 0);
}
diff --git a/tp/Texinfo/XS/convert/build_html_perl_state.h
b/tp/Texinfo/XS/convert/build_html_perl_state.h
index 6144115baa..c024afeca5 100644
--- a/tp/Texinfo/XS/convert/build_html_perl_state.h
+++ b/tp/Texinfo/XS/convert/build_html_perl_state.h
@@ -29,6 +29,6 @@ SV *build_replaced_substrings (NAMED_STRING_ELEMENT_LIST
*replaced_substrings);
void build_pending_footnotes (AV *av, HTML_PENDING_FOOTNOTE_STACK *stack);
-void build_simpletitle (CONVERTER *converter, HV *converter_hv);
+void build_simpletitle (CONVERTER *converter, HV *converter_info_hv);
#endif
diff --git a/tp/Texinfo/XS/convert/get_html_perl_info.c
b/tp/Texinfo/XS/convert/get_html_perl_info.c
index 0ff7fe8997..06c73e3593 100644
--- a/tp/Texinfo/XS/convert/get_html_perl_info.c
+++ b/tp/Texinfo/XS/convert/get_html_perl_info.c
@@ -1159,90 +1159,97 @@ void
html_converter_prepare_output_sv (SV *converter_sv, CONVERTER *converter)
{
HV *converter_hv;
- SV **jslicenses_sv;
+ SV **converter_info_sv;
dTHX;
converter_hv = (HV *)SvRV (converter_sv);
- FETCH(jslicenses)
+ FETCH(converter_info);
- if (jslicenses_sv)
+ if (converter_info_sv)
{
- I32 hv_number;
- I32 i;
+ HV *converter_info_hv = (HV *)SvRV (*converter_info_sv);
+ SV **jslicenses_sv = hv_fetch (converter_info_hv, "jslicenses",
+ strlen ("jslicenses"), 0);
- HV *jslicenses_hv = (HV *)SvRV (*jslicenses_sv);
+ if (jslicenses_sv)
+ {
+ I32 hv_number;
+ I32 i;
- hv_number = hv_iterinit (jslicenses_hv);
+ HV *jslicenses_hv = (HV *)SvRV (*jslicenses_sv);
- if (hv_number > 0)
- {
- initialize_js_categories_list (&converter->jslicenses, hv_number);
+ hv_number = hv_iterinit (jslicenses_hv);
- for (i = 0; i < hv_number; i++)
+ if (hv_number > 0)
{
- I32 hv_files_number;
- I32 j;
- HE *next = hv_iternext (jslicenses_hv);
- SV *category_sv = hv_iterkeysv (next);
- const char *category = (char *) SvPVutf8_nolen (category_sv);
- SV *files_info_sv = HeVAL(next);
- HV *files_info_hv = (HV *)SvRV (files_info_sv);
+ initialize_js_categories_list (&converter->jslicenses,
hv_number);
- JSLICENSE_FILE_INFO_LIST *jslicences_files_info
- = &converter->jslicenses.list[i];
+ for (i = 0; i < hv_number; i++)
+ {
+ I32 hv_files_number;
+ I32 j;
+ HE *next = hv_iternext (jslicenses_hv);
+ SV *category_sv = hv_iterkeysv (next);
+ const char *category = (char *) SvPVutf8_nolen (category_sv);
+ SV *files_info_sv = HeVAL(next);
+ HV *files_info_hv = (HV *)SvRV (files_info_sv);
- hv_files_number = hv_iterinit (files_info_hv);
+ JSLICENSE_FILE_INFO_LIST *jslicences_files_info
+ = &converter->jslicenses.list[i];
- initialize_jslicense_files (jslicences_files_info, category,
- hv_files_number);
+ hv_files_number = hv_iterinit (files_info_hv);
- for (j = 0; j < hv_files_number; j++)
- {
- HE *next_file = hv_iternext (files_info_hv);
- SV *filename_sv = hv_iterkeysv (next);
- char *filename = (char *) SvPVutf8_nolen (filename_sv);
- SV *file_info_sv = HeVAL(next_file);
- AV *file_info_av = (AV *)SvRV (file_info_sv);
- SSize_t file_info_nr;
- SV **license_sv;
- SV **url_sv;
- SV **source_sv;
-
- JSLICENSE_FILE_INFO *jslicense_file_info
- = &jslicences_files_info->list[j];
- jslicense_file_info->filename = non_perl_strdup (filename);
-
- file_info_nr = av_top_index (file_info_av) +1;
- if (file_info_nr != 3)
- {
- fprintf (stderr,
- "BUG: %s: %s: jslicence file needs 3 item:
%zu\n",
- category, filename, file_info_nr);
- continue;
- }
- license_sv = av_fetch (file_info_av, 0, 0);
- if (license_sv && SvOK (*license_sv))
- {
- const char *license
- = (char *) SvPVutf8_nolen (*license_sv);
- jslicense_file_info->license
- = non_perl_strdup (license);
- }
- url_sv = av_fetch (file_info_av, 0, 0);
- if (url_sv && SvOK (*url_sv))
- {
- const char *url = (char *) SvPVutf8_nolen (*url_sv);
- jslicense_file_info->url = non_perl_strdup (url);
- }
- source_sv = av_fetch (file_info_av, 0, 0);
- if (source_sv && SvOK (*source_sv))
+ initialize_jslicense_files (jslicences_files_info, category,
+ hv_files_number);
+
+ for (j = 0; j < hv_files_number; j++)
{
- const char *source
- = (char *) SvPVutf8_nolen (*source_sv);
- jslicense_file_info->source
- = non_perl_strdup (source);
+ HE *next_file = hv_iternext (files_info_hv);
+ SV *filename_sv = hv_iterkeysv (next);
+ char *filename = (char *) SvPVutf8_nolen (filename_sv);
+ SV *file_info_sv = HeVAL(next_file);
+ AV *file_info_av = (AV *)SvRV (file_info_sv);
+ SSize_t file_info_nr;
+ SV **license_sv;
+ SV **url_sv;
+ SV **source_sv;
+
+ JSLICENSE_FILE_INFO *jslicense_file_info
+ = &jslicences_files_info->list[j];
+ jslicense_file_info->filename = non_perl_strdup
(filename);
+
+ file_info_nr = av_top_index (file_info_av) +1;
+ if (file_info_nr != 3)
+ {
+ fprintf (stderr,
+ "BUG: %s: %s: jslicence file needs 3 item:
%zu\n",
+ category, filename, file_info_nr);
+ continue;
+ }
+ license_sv = av_fetch (file_info_av, 0, 0);
+ if (license_sv && SvOK (*license_sv))
+ {
+ const char *license
+ = (char *) SvPVutf8_nolen (*license_sv);
+ jslicense_file_info->license
+ = non_perl_strdup (license);
+ }
+ url_sv = av_fetch (file_info_av, 0, 0);
+ if (url_sv && SvOK (*url_sv))
+ {
+ const char *url = (char *) SvPVutf8_nolen (*url_sv);
+ jslicense_file_info->url = non_perl_strdup (url);
+ }
+ source_sv = av_fetch (file_info_av, 0, 0);
+ if (source_sv && SvOK (*source_sv))
+ {
+ const char *source
+ = (char *) SvPVutf8_nolen (*source_sv);
+ jslicense_file_info->source
+ = non_perl_strdup (source);
+ }
}
}
}
diff --git a/tp/init/book.pm b/tp/init/book.pm
index e84ba60e56..ec357345b1 100644
--- a/tp/init/book.pm
+++ b/tp/init/book.pm
@@ -456,7 +456,7 @@ sub book_unit_file_name($$$$)
return ($book_previous_file_name, undef);
}
- my $prefix = $converter->{'document_name'};
+ my $prefix = $converter->get_info('document_name');
my $new_file_name;
my $command;
if ($output_unit->{'unit_command'}) {
diff --git a/tp/t/init/misc_file_collision.init
b/tp/t/init/misc_file_collision.init
index 7dbeaf8d43..16887c1561 100644
--- a/tp/t/init/misc_file_collision.init
+++ b/tp/t/init/misc_file_collision.init
@@ -17,7 +17,7 @@ sub test_misc_file_name($$$$)
or ($converter->{'document_units'}->[2]
and $converter->{'document_units'}->[2] eq $output_unit)) {
my $extension = $converter->get_conf('EXTENSION');
- my $prefix = $converter->{'document_name'};
+ my $prefix = $converter->get_info('document_name');
$filename = "${prefix}_abt"
. ((defined($extension)) ? ".$extension" : '');
} else {
diff --git a/tp/t/init/only_toc_out.init b/tp/t/init/only_toc_out.init
index 2b3ab84009..8884220807 100644
--- a/tp/t/init/only_toc_out.init
+++ b/tp/t/init/only_toc_out.init
@@ -10,7 +10,7 @@ sub toc_out_element_file_name($$$$$)
my $target = shift;
my $filename = shift;
- my $prefix = $converter->{'document_name'};
+ my $prefix = $converter->get_info('document_name');
my $type = $element->{'special_unit_variety'};
if ($type and $type ne 'contents')
{
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/init/book.pm (book_unit_file_name), tp/t/init/misc_file_collision.init (test_misc_file_name), tp/t/init/only_toc_out.init (toc_out_element_file_name): access 'document_name' through get_info API only.,
Patrice Dumas <=