[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/Structuring.pm (construct_nodes_tree
From: |
Patrice Dumas |
Subject: |
branch master updated: * tp/Texinfo/Structuring.pm (construct_nodes_tree), tp/Texinfo/XS/structuring_transfo/structuring.c (construct_nodes_tree): rename nodes_tree as construct_nodes_tree. Upate callers. |
Date: |
Fri, 17 Jan 2025 11:02:13 -0500 |
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 02d9796932 * tp/Texinfo/Structuring.pm (construct_nodes_tree),
tp/Texinfo/XS/structuring_transfo/structuring.c (construct_nodes_tree): rename
nodes_tree as construct_nodes_tree. Upate callers.
02d9796932 is described below
commit 02d9796932cf9cbf6be8d141243c63b5d8d015aa
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Fri Jan 17 17:02:13 2025 +0100
* tp/Texinfo/Structuring.pm (construct_nodes_tree),
tp/Texinfo/XS/structuring_transfo/structuring.c
(construct_nodes_tree): rename nodes_tree as construct_nodes_tree.
Upate callers.
* tp/Texinfo/Structuring.pm (construct_nodes_tree)
(sectioning_structure), tp/Texinfo/Document.pm,
tp/Texinfo/XS/main/document.c,
tp/Texinfo/XS/structuring_transfo/structuring.c (sectioning_structure)
(construct_nodes_tree): register nodes lists
nd sections lists directly in construct_nodes_tree and
sectioning_structure. Remove register_document_nodes_list,
register_document_sections_list. Upate callers.
---
ChangeLog | 16 +++++++++
tp/Texinfo/Document.pm | 39 +++-------------------
tp/Texinfo/Structuring.pm | 37 +++++++++++---------
tp/Texinfo/XS/convert/texinfo.c | 8 ++---
tp/Texinfo/XS/main/document.c | 16 ---------
tp/Texinfo/XS/main/document.h | 4 ---
.../XS/structuring_transfo/StructuringTransfoXS.xs | 20 +++++------
tp/Texinfo/XS/structuring_transfo/structuring.c | 10 +++++-
tp/Texinfo/XS/structuring_transfo/structuring.h | 2 +-
tp/Texinfo/XS/texi2any.c | 1 -
tp/t/test_utils.pl | 13 ++------
tp/t/z_misc/convert_to_text.t | 7 +---
tp/texi2any.pl | 11 ++----
13 files changed, 67 insertions(+), 117 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 79e23e4043..ffdd9240dc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2025-01-17 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/Structuring.pm (construct_nodes_tree),
+ tp/Texinfo/XS/structuring_transfo/structuring.c
+ (construct_nodes_tree): rename nodes_tree as construct_nodes_tree.
+ Upate callers.
+
+ * tp/Texinfo/Structuring.pm (construct_nodes_tree)
+ (sectioning_structure), tp/Texinfo/Document.pm,
+ tp/Texinfo/XS/main/document.c,
+ tp/Texinfo/XS/structuring_transfo/structuring.c (sectioning_structure)
+ (construct_nodes_tree): register nodes lists
+ nd sections lists directly in construct_nodes_tree and
+ sectioning_structure. Remove register_document_nodes_list,
+ register_document_sections_list. Upate callers.
+
2025-01-17 Patrice Dumas <pertusus@free.fr>
Use the TEXINFO_C_PERL_EMBED env variable to prevent loading embedded
Perl
diff --git a/tp/Texinfo/Document.pm b/tp/Texinfo/Document.pm
index 03815e96b0..ba16d5dff9 100644
--- a/tp/Texinfo/Document.pm
+++ b/tp/Texinfo/Document.pm
@@ -129,20 +129,6 @@ sub register_tree($$)
$document->{'tree'} = $tree;
}
-sub register_document_nodes_list($$)
-{
- my $document = shift;
- my $nodes_list = shift;
- $document->{'nodes_list'} = $nodes_list;
-}
-
-sub register_document_sections_list($$)
-{
- my $document = shift;
- my $sections_list = shift;
- $document->{'sections_list'} = $sections_list;
-}
-
sub _XS_set_document_global_info($$$)
{
}
@@ -707,16 +693,13 @@ to the same document with @-commands that refer to node,
anchors or floats.
=item $nodes_list = nodes_list($document)
Returns an array reference containing the document nodes. In general set to
-the nodes list returned by L<Texinfo::Structuring
-nodes_tree|Texinfo::Structuring/$nodes_list = nodes_tree($document)>, by a call
-to L<register_document_nodes_list|/register_document_nodes_list ($document,
-$nodes_list)>.
+the nodes list constructed by L<Texinfo::Structuring
+construct_nodes_tree|Texinfo::Structuring/$nodes_list =
construct_nodes_tree($document)>.
=item $sections_list = sections_list($document)
-Returns an array reference containing the document sections. In general set
to the sections list returned by
-L<Texinfo::Structuring
sectioning_structure|Texinfo::Structuring/$sections_list =
sectioning_structure($document)>,
-by a call to
L<register_document_sections_list|/register_document_sections_list ($document,
$sections_list)>.
+Returns an array reference containing the document sections. In general set
to the sections list determined by
+L<Texinfo::Structuring
sectioning_structure|Texinfo::Structuring/$sections_list =
sectioning_structure($document)>.
=back
@@ -937,13 +920,6 @@ Further information can be registered in the document.
=over
-=item register_document_nodes_list ($document, $nodes_list)
-X<C<register_document_nodes_list>>
-
-Register the I<$nodes_list> array reference as I<$document> nodes
-list. This method should be called after the processing of document
-structure.
-
=item register_document_options ($document, $options)
X<C<register_document_options>>
@@ -955,13 +931,6 @@ Indeed, document customization options are mainly accessed
by structuring and
tree transformation methods (by calling L<< C<get_conf>|/$value =
$document->get_conf($variable_name) >>). The options should in general be
registered before
the calls to C<get_conf>.
-=item register_document_sections_list ($document, $sections_list)
-X<C<register_document_sections_list>>
-
-Register the I<$sections_list> array reference as I<$document> sections
-list. This method should be called after the processing of document
-structure.
-
=item set_document_global_info($document, $key, $value)
X<C<set_document_global_info>>
diff --git a/tp/Texinfo/Structuring.pm b/tp/Texinfo/Structuring.pm
index 7c7d584215..6c0cfdc471 100644
--- a/tp/Texinfo/Structuring.pm
+++ b/tp/Texinfo/Structuring.pm
@@ -60,7 +60,7 @@ our @EXPORT_OK = qw(
associate_internal_references
check_nodes_are_referenced
complete_node_tree_with_menus
- nodes_tree
+ construct_nodes_tree
number_floats
sectioning_structure
set_menus_node_directions
@@ -78,8 +78,8 @@ my %XS_overrides = (
=> "Texinfo::StructTransfXS::sectioning_structure",
"Texinfo::Structuring::warn_non_empty_parts"
=> "Texinfo::StructTransfXS::warn_non_empty_parts",
- "Texinfo::Structuring::nodes_tree"
- => "Texinfo::StructTransfXS::nodes_tree",
+ "Texinfo::Structuring::construct_nodes_tree"
+ => "Texinfo::StructTransfXS::construct_nodes_tree",
"Texinfo::Structuring::set_menus_node_directions"
=> "Texinfo::StructTransfXS::set_menus_node_directions",
"Texinfo::Structuring::complete_node_tree_with_menus"
@@ -339,6 +339,7 @@ sub sectioning_structure($)
if (scalar(@sections_list) == 0) {
return undef;
} else {
+ $document->{'sections_list'} = \@sections_list;
return \@sections_list;
}
}
@@ -917,7 +918,7 @@ sub complete_node_tree_with_menus($)
}
# set node directions based on sectioning and @node explicit directions
-sub nodes_tree($)
+sub construct_nodes_tree($)
{
my $document = shift;
@@ -1044,6 +1045,9 @@ sub nodes_tree($)
}
}
}
+
+ $document->{'nodes_list'} = \@nodes_list;
+
return \@nodes_list;
}
@@ -1620,14 +1624,14 @@ Texinfo::Structuring - information on Texinfo::Document
document structure
=head1 SYNOPSIS
- use Texinfo::Structuring qw(sectioning_structure nodes_tree number_floats
- associate_internal_references);
+ use Texinfo::Structuring qw(sectioning_structure construct_nodes_tree
+ number_floats associate_internal_references);
# $document is a parsed Texinfo::Document document.
# When customization variables information is needed, it is obtained
# from the $document by calling the get_conf() method.
- my $sections_list = sectioning_structure($document);
- my $nodes_list = nodes_tree($document);
+ sectioning_structure($document);
+ construct_nodes_tree($document);
set_menus_node_directions($document);
complete_node_tree_with_menus($document);
check_nodes_are_referenced($document);
@@ -1645,9 +1649,9 @@ C<Texinfo::Structuring> allows to collect information on
a Texinfo
document structure. Thanks to C<sectioning_structure> the hierarchy of
sectioning commands is determined. The directions implied by menus are
determined with C<set_menus_node_directions>. The node tree is analysed
-with C<nodes_tree>. Nodes directions are completed with menu directions
-with C<complete_node_tree_with_menus>. Floats get their standard
-numbering with C<number_floats> and internal references are matched up
+with C<construct_nodes_tree>. Nodes directions are completed with
+menu directions with C<complete_node_tree_with_menus>. Floats get their
+standard numbering with C<number_floats> and internal references are matched up
with nodes, floats or anchors with C<associate_internal_references>.
=head1 METHODS
@@ -1731,11 +1735,11 @@ Returns the Texinfo tree corresponding to a single menu
entry pointing to
I<$node>. If I<$use_sections> is set, use the section name for the menu
entry name. Returns C<undef> if the node argument is missing.
-=item $nodes_list = nodes_tree($document)
-X<C<nodes_tree>>
+=item $nodes_list = construct_nodes_tree($document)
+X<C<construct_nodes_tree>>
-Goes through nodes in I<$document> tree and set directions. Returns the
-list of nodes.
+Goes through nodes in I<$document> tree and set directions. Set the list of
+nodes in the I<$document>. Returns the list of nodes.
This functions sets, in the C<extra> node element hash:
@@ -1766,7 +1770,8 @@ and lowered sections, when needed.
X<C<sectioning_structure>>
This function goes through the parsed document tree and gather information
-on the document structure for sectioning commands. It returns a reference
+on the document structure for sectioning commands. It sets the sections
+elements list in the document and returns a reference
on the sections elements list.
It sets section elements C<extra> hash values:
diff --git a/tp/Texinfo/XS/convert/texinfo.c b/tp/Texinfo/XS/convert/texinfo.c
index 11ad90e448..284d145968 100644
--- a/tp/Texinfo/XS/convert/texinfo.c
+++ b/tp/Texinfo/XS/convert/texinfo.c
@@ -431,7 +431,6 @@ void
txi_complete_document (DOCUMENT *document, unsigned long flags,
int format_menu)
{
- CONST_ELEMENT_LIST *sections_list;
int use_sections = (flags & STTF_complete_menus_use_sections);
if (flags & STTF_relate_index_entries_to_table_items)
@@ -446,9 +445,7 @@ txi_complete_document (DOCUMENT *document, unsigned long
flags,
associate_internal_references (document);
- sections_list = sectioning_structure (document);
- if (sections_list)
- register_document_sections_list (document, sections_list);
+ sectioning_structure (document);
if (!(flags & STTF_no_warn_non_empty_parts))
warn_non_empty_parts (document);
@@ -464,8 +461,7 @@ txi_complete_document (DOCUMENT *document, unsigned long
flags,
if (flags & STTF_nodes_tree)
{
- CONST_ELEMENT_LIST *nodes_list = nodes_tree (document);
- register_document_nodes_list (document, nodes_list);
+ construct_nodes_tree (document);
if (format_menu)
{
diff --git a/tp/Texinfo/XS/main/document.c b/tp/Texinfo/XS/main/document.c
index c08567a4df..23b15341c3 100644
--- a/tp/Texinfo/XS/main/document.c
+++ b/tp/Texinfo/XS/main/document.c
@@ -106,22 +106,6 @@ new_document (void)
return document;
}
-void
-register_document_nodes_list (DOCUMENT *document,
- CONST_ELEMENT_LIST *nodes_list)
-{
- document->nodes_list = nodes_list;
- document->modified_information |= F_DOCM_nodes_list;
-}
-
-void
-register_document_sections_list (DOCUMENT *document,
- CONST_ELEMENT_LIST *sections_list)
-{
- document->sections_list = sections_list;
- document->modified_information |= F_DOCM_sections_list;
-}
-
void
register_document_options (DOCUMENT *document, OPTIONS *options,
OPTION **sorted_options)
diff --git a/tp/Texinfo/XS/main/document.h b/tp/Texinfo/XS/main/document.h
index 8a541c63f2..6d0f9e1c0f 100644
--- a/tp/Texinfo/XS/main/document.h
+++ b/tp/Texinfo/XS/main/document.h
@@ -15,10 +15,6 @@ struct TEXT_OPTIONS;
DOCUMENT *retrieve_document (size_t document_descriptor);
DOCUMENT *new_document (void);
-void register_document_nodes_list (DOCUMENT *document,
- CONST_ELEMENT_LIST *nodes_list);
-void register_document_sections_list (DOCUMENT *document,
- CONST_ELEMENT_LIST *sections_list);
void register_document_options (DOCUMENT *document, OPTIONS *options,
OPTION **sorted_options);
void register_document_convert_index_text_options (DOCUMENT *document,
diff --git a/tp/Texinfo/XS/structuring_transfo/StructuringTransfoXS.xs
b/tp/Texinfo/XS/structuring_transfo/StructuringTransfoXS.xs
index 02694be0bc..bc30d577a8 100644
--- a/tp/Texinfo/XS/structuring_transfo/StructuringTransfoXS.xs
+++ b/tp/Texinfo/XS/structuring_transfo/StructuringTransfoXS.xs
@@ -165,9 +165,9 @@ associate_internal_references (SV *document_in)
associate_internal_references (document);
-# The perl function returns a list of sections, but it is only used
-# to register in the document. It is better to reserve the return
-# value for a return status, if it becomes needed.
+# The perl function returns a list of sections, but it is not used.
+# It is better to reserve the return value for a return status, if it
+# becomes needed.
void
sectioning_structure (SV *document_in)
PREINIT:
@@ -177,8 +177,7 @@ sectioning_structure (SV *document_in)
"sectioning_structure");
if (document)
{
- CONST_ELEMENT_LIST *sections_list = sectioning_structure
(document);
- register_document_sections_list (document, sections_list);
+ sectioning_structure (document);
}
void
@@ -292,19 +291,18 @@ insert_nodes_for_sectioning_commands (SV *document_in)
destroy_list (added_nodes);
}
-# The Perl function returns a list of nodes, but it is only used
-# to register in the document. It is better to reserve the return
-# value for a return status, if it becomes needed.
+# The Perl function returns a list of nodes, but it is not used.
+# It is better to reserve the return value for a return status, if it
+# becomes needed.
void
-nodes_tree (SV *document_in)
+construct_nodes_tree (SV *document_in)
PREINIT:
DOCUMENT *document = 0;
CODE:
document = get_sv_document_document (document_in, "nodes_tree");
if (document)
{
- CONST_ELEMENT_LIST *nodes_list = nodes_tree (document);
- register_document_nodes_list (document, nodes_list);
+ construct_nodes_tree (document);
}
# For the next functions, the Perl function returns a tree, as the
diff --git a/tp/Texinfo/XS/structuring_transfo/structuring.c
b/tp/Texinfo/XS/structuring_transfo/structuring.c
index c52e2051ab..eff8097715 100644
--- a/tp/Texinfo/XS/structuring_transfo/structuring.c
+++ b/tp/Texinfo/XS/structuring_transfo/structuring.c
@@ -398,6 +398,10 @@ sectioning_structure (DOCUMENT *document)
return 0;
}
free (section_number.text);
+
+ document->sections_list = sections_list;
+ document->modified_information |= F_DOCM_sections_list;
+
return sections_list;
}
@@ -1324,7 +1328,7 @@ complete_node_tree_with_menus (DOCUMENT *document)
/* set node directions based on sectioning and @node explicit directions */
CONST_ELEMENT_LIST *
-nodes_tree (DOCUMENT *document)
+construct_nodes_tree (DOCUMENT *document)
{
const LABEL_LIST *identifiers_target = &document->identifiers_target;
const ELEMENT *root = document->tree;
@@ -1507,6 +1511,10 @@ nodes_tree (DOCUMENT *document)
}
}
}
+
+ document->nodes_list = nodes_list;
+ document->modified_information |= F_DOCM_nodes_list;
+
return nodes_list;
}
diff --git a/tp/Texinfo/XS/structuring_transfo/structuring.h
b/tp/Texinfo/XS/structuring_transfo/structuring.h
index 4738bdc601..7a9ca012c9 100644
--- a/tp/Texinfo/XS/structuring_transfo/structuring.h
+++ b/tp/Texinfo/XS/structuring_transfo/structuring.h
@@ -9,7 +9,7 @@
void associate_internal_references (DOCUMENT *document);
CONST_ELEMENT_LIST *sectioning_structure (DOCUMENT *document);
-CONST_ELEMENT_LIST *nodes_tree (DOCUMENT *document);
+CONST_ELEMENT_LIST *construct_nodes_tree (DOCUMENT *document);
CONST_ELEMENT_LIST *get_node_node_childs_from_sectioning (const ELEMENT *node);
void warn_non_empty_parts (DOCUMENT *document);
void set_menus_node_directions (DOCUMENT *document);
diff --git a/tp/Texinfo/XS/texi2any.c b/tp/Texinfo/XS/texi2any.c
index dafaca8cf2..c00a6ccb06 100644
--- a/tp/Texinfo/XS/texi2any.c
+++ b/tp/Texinfo/XS/texi2any.c
@@ -2201,7 +2201,6 @@ main (int argc, char *argv[], char *env[])
/* to be kept in sync with build_html_perl_info.c
html_pass_conversion_initialization */
- /* internal links code is in Perl */
if (loaded_init_files_nr > 0 || need_latex)
external_module = format_specification->module;
}
diff --git a/tp/t/test_utils.pl b/tp/t/test_utils.pl
index 962133a6f2..1c41b7991c 100644
--- a/tp/t/test_utils.pl
+++ b/tp/t/test_utils.pl
@@ -1162,13 +1162,8 @@ sub test($$)
Texinfo::Structuring::associate_internal_references($document);
- my $sections_list
- = Texinfo::Structuring::sectioning_structure($document);
+ Texinfo::Structuring::sectioning_structure($document);
- if ($sections_list) {
- Texinfo::Document::register_document_sections_list($document,
- $sections_list);
- }
Texinfo::Structuring::warn_non_empty_parts($document);
if ($tree_transformations{'complete_tree_nodes_menus'}) {
@@ -1181,11 +1176,7 @@ sub test($$)
Texinfo::Transformations::regenerate_master_menu($document);
}
- my $nodes_tree_nodes_list
- = Texinfo::Structuring::nodes_tree($document);
-
- Texinfo::Document::register_document_nodes_list($document,
- $nodes_tree_nodes_list);
+ Texinfo::Structuring::construct_nodes_tree($document);
Texinfo::Structuring::set_menus_node_directions($document);
diff --git a/tp/t/z_misc/convert_to_text.t b/tp/t/z_misc/convert_to_text.t
index 612c958bbe..476f83c358 100644
--- a/tp/t/z_misc/convert_to_text.t
+++ b/tp/t/z_misc/convert_to_text.t
@@ -75,13 +75,8 @@ my $tree = $document->tree();
#print STDERR Texinfo::DebugTree->convert_tree($tree);
# Setup sectioning commands numbers
-my $sections_list
- = Texinfo::Structuring::sectioning_structure($document);
+Texinfo::Structuring::sectioning_structure($document);
-if ($sections_list) {
- Texinfo::Document::register_document_sections_list($document,
- $sections_list);
-}
# rebuild the tree
$tree = $document->tree();
diff --git a/tp/texi2any.pl b/tp/texi2any.pl
index e7d96d9d1b..91f55105c1 100755
--- a/tp/texi2any.pl
+++ b/tp/texi2any.pl
@@ -1898,13 +1898,7 @@ while(@input_files) {
# information obtained through Texinfo::Structuring
# and useful in converters.
# every format needs the sectioning structure
- my $sections_list
- = Texinfo::Structuring::sectioning_structure($document);
-
- if ($sections_list) {
- Texinfo::Document::register_document_sections_list($document,
- $sections_list);
- }
+ Texinfo::Structuring::sectioning_structure($document);
if (!$formats_table{$converted_format}->{'no_warn_non_empty_parts'}) {
Texinfo::Structuring::warn_non_empty_parts($document);
@@ -1921,8 +1915,7 @@ while(@input_files) {
}
if ($formats_table{$converted_format}->{'nodes_tree'}) {
- my $nodes_list = Texinfo::Structuring::nodes_tree($document);
- Texinfo::Document::register_document_nodes_list($document, $nodes_list);
+ Texinfo::Structuring::construct_nodes_tree($document);
# With this condition, menu is the default for 'FORMAT_MENU'.
# However, this can only happen if
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/Structuring.pm (construct_nodes_tree), tp/Texinfo/XS/structuring_transfo/structuring.c (construct_nodes_tree): rename nodes_tree as construct_nodes_tree. Upate callers.,
Patrice Dumas <=