[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/Config.pm (register_XS_document_main
From: |
Patrice Dumas |
Subject: |
branch master updated: * tp/Texinfo/Config.pm (register_XS_document_main_configuration): rename Texinfo::Config set_document_main_configuration as register_XS_document_main_configuration. Update callers. |
Date: |
Wed, 25 Oct 2023 06:56:49 -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 8430a3aaf1 * tp/Texinfo/Config.pm
(register_XS_document_main_configuration): rename Texinfo::Config
set_document_main_configuration as register_XS_document_main_configuration.
Update callers.
8430a3aaf1 is described below
commit 8430a3aaf1f58cffc2f62c6e22b648b637c8d2eb
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Wed Oct 25 12:55:20 2023 +0200
* tp/Texinfo/Config.pm (register_XS_document_main_configuration):
rename Texinfo::Config set_document_main_configuration as
register_XS_document_main_configuration. Update callers.
* tp/Texinfo/Common.pm (import, set_document_options),
tp/Texinfo/Config.pm (register_XS_document_main_configuration),
tp/Texinfo/XS/structuring_transfo/StructuringTransfo.xs
(set_document_options): return immediately in
register_XS_document_main_configuration if there is no document
descriptor, warn in XS if document is not found. Move perl code done
in Texinfo::Common in set_document_options to
register_XS_document_main_configuration. Override directly
set_document_options in Texinfo::Common.
* tp/Texinfo/XS/structuring_transfo/StructuringTransfo.xs: minonr
change in syntax.
---
ChangeLog | 35 +++++++++++++++++-----
tp/Texinfo/Common.pm | 12 ++++----
tp/Texinfo/Config.pm | 15 ++++++++--
tp/Texinfo/Structuring.pm | 5 ++--
.../XS/structuring_transfo/StructuringTransfo.xs | 12 ++++----
tp/t/test_utils.pl | 4 ++-
tp/texi2any.pl | 4 ++-
7 files changed, 58 insertions(+), 29 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 6d0c7fbce1..be6f7e95ce 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,25 @@
Use "%s" to print a string with fprintf in case the string contains
conversion specifications.
+2023-10-26 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/Config.pm (register_XS_document_main_configuration):
+ rename Texinfo::Config set_document_main_configuration as
+ register_XS_document_main_configuration. Update callers.
+
+ * tp/Texinfo/Common.pm (import, set_document_options),
+ tp/Texinfo/Config.pm (register_XS_document_main_configuration),
+ tp/Texinfo/XS/structuring_transfo/StructuringTransfo.xs
+ (set_document_options): return immediately in
+ register_XS_document_main_configuration if there is no document
+ descriptor, warn in XS if document is not found. Move perl code done
+ in Texinfo::Common in set_document_options to
+ register_XS_document_main_configuration. Override directly
+ set_document_options in Texinfo::Common.
+
+ * tp/Texinfo/XS/structuring_transfo/StructuringTransfo.xs: minonr
+ change in syntax.
+
2023-10-26 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/Common.pm (import, copy_treeNonXS, copy_contentsNonXS),
@@ -2699,14 +2718,14 @@
* tp/Texinfo/Common.pm (import, %non_decoded_customization_variables)
(_XS_set_document_options, set_document_options),
- tp/Texinfo/Config.pm, tp/Texinfo/XS/main/document.c
- (register_document_options), tp/Texinfo/XS/main/get_perl_info.c
- (add_svav_to_string_list, copy_sv_options)
- (copy_sv_options_for_convert_text), tp/Texinfo/XS/main/utils.c
- (new_options, add_include_directory, add_string),
- tp/Texinfo/XS/structuring_transfo/StructuringTransfo.xs
- (set_document_options), tp/t/test_utils.pl (test), tp/texi2any.pl: move
- %non_decoded_customization_variables to Texinfo::Common. Add XS
+ tp/Texinfo/Config.pm (set_document_main_configuration),
+ tp/Texinfo/XS/main/document.c (register_document_options),
+ tp/Texinfo/XS/main/get_perl_info.c (add_svav_to_string_list,
+ copy_sv_options) (copy_sv_options_for_convert_text),
+ tp/Texinfo/XS/main/utils.c (new_options, add_include_directory,
+ add_string), tp/Texinfo/XS/structuring_transfo/StructuringTransfo.xs
+ (set_document_options), tp/t/test_utils.pl (test), tp/texi2any.pl:
+ move %non_decoded_customization_variables to Texinfo::Common. Add XS
override to encode MainConfig options values and pass options to store
in document, add add_svav_to_string_list based on
copy_sv_options_for_convert_text to get more generically STRING_LIST
diff --git a/tp/Texinfo/Common.pm b/tp/Texinfo/Common.pm
index fc696fad7a..01c5c118eb 100644
--- a/tp/Texinfo/Common.pm
+++ b/tp/Texinfo/Common.pm
@@ -84,7 +84,7 @@ sub import {
if (!defined $ENV{TEXINFO_XS_PARSER}
or $ENV{TEXINFO_XS_PARSER} eq '1') {
Texinfo::XSLoader::override(
- "Texinfo::Common::_XS_set_document_options",
+ "Texinfo::Common::set_document_options",
"Texinfo::StructTransf::set_document_options");
Texinfo::XSLoader::override(
"Texinfo::Common::copy_tree",
@@ -2539,16 +2539,14 @@ sub encode_options($)
return $encoded_options;
}
-sub _XS_set_document_options($$)
-{
-}
-
+# non-XS does nothing and should not even be called as the caller verifies
+# that there is a document descriptor; XS version registers options in XS
+# document. It would have been more logical for this function to be in
+# Texinfo::Config, but we do not want to load any XS in Texinfo::Config.
sub set_document_options($$)
{
my $options = shift;
my $document = shift;
- my $encoded_options = encode_options($options);
- _XS_set_document_options($encoded_options, $document);
}
# functions used for debugging. May be used in other modules.
diff --git a/tp/Texinfo/Config.pm b/tp/Texinfo/Config.pm
index 67154dcc93..18e96eb2bb 100644
--- a/tp/Texinfo/Config.pm
+++ b/tp/Texinfo/Config.pm
@@ -872,13 +872,20 @@ sub set_conf($$$)
return 1;
}
-sub set_document_main_configuration($$)
+# for structuring and tree transformations XS code uses options registered
+# with the document by that function. It is not needed in perl where
+# get_conf above is used.
+sub register_XS_document_main_configuration($$)
{
my $self = shift;
my $document = shift;
+
+ return if (!$document->document_descriptor());
+
+ my $options;
if ($self->{'standalone'}) {
#print STDERR "STDALONE: ".join('|',
sort(keys(%{$self->{'config'}})))."\n";
- Texinfo::Common::set_document_options($self->{'config'}, $document);
+ $options = $self->{'config'};
} else {
my %options = %{$main_program_default_options};
foreach my $config ($self->{'config'}, $init_files_options,
$cmdline_options) {
@@ -887,8 +894,10 @@ sub set_document_main_configuration($$)
}
}
#print STDERR "MAIN: ".join('|', sort(keys(%options)))."\n";
- Texinfo::Common::set_document_options(\%options, $document);
+ $options = \%options;
}
+ my $encoded_options = Texinfo::Common::encode_options($options);
+ Texinfo::Common::set_document_options($encoded_options, $document);
}
1;
diff --git a/tp/Texinfo/Structuring.pm b/tp/Texinfo/Structuring.pm
index c9ce634a2a..2b5b4f5a86 100644
--- a/tp/Texinfo/Structuring.pm
+++ b/tp/Texinfo/Structuring.pm
@@ -1744,15 +1744,14 @@ sub _XS_unsplit($)
# remove the association with document units
# NOTE not documented, but is internally used for tests only.
+# In the situation where unsplit is called, in the test suite, it is
+# always better to do it both for XS and perl.
sub unsplit($)
{
my $root = shift;
my $XS_unsplit_needed = _XS_unsplit($root);
- # In the situation where unsplit is called, in the test suite, it is
- # always better to do it both for XS and perl
-
if (!$root->{'type'} or $root->{'type'} ne 'document_root'
or !$root->{'contents'}) {
return 0;
diff --git a/tp/Texinfo/XS/structuring_transfo/StructuringTransfo.xs
b/tp/Texinfo/XS/structuring_transfo/StructuringTransfo.xs
index cdbc86f8e0..a152d1a6c1 100644
--- a/tp/Texinfo/XS/structuring_transfo/StructuringTransfo.xs
+++ b/tp/Texinfo/XS/structuring_transfo/StructuringTransfo.xs
@@ -166,8 +166,8 @@ set_document_options (SV *sv_options_in, SV *document_in)
PREINIT:
DOCUMENT *document = 0;
CODE:
- /* FIXME warning/error if not found? */
- document = get_sv_document_document (document_in, 0);
+ document = get_sv_document_document (document_in,
+ "set_document_options");
if (document)
{
OPTIONS *options = copy_sv_options (sv_options_in);
@@ -235,8 +235,7 @@ relate_index_entries_to_table_items_in_tree (SV *tree_in,
...)
}
void
-move_index_entries_after_items_in_tree (tree_in)
- SV *tree_in
+move_index_entries_after_items_in_tree (SV *tree_in)
PREINIT:
DOCUMENT *document;
CODE:
@@ -371,6 +370,8 @@ complete_tree_nodes_missing_menu (SV *tree_in, SV
*use_sections_in=0)
if (document)
complete_tree_nodes_missing_menu (document->tree, use_sections);
+# regenerate_master_menu uses the options of the document, so we ignore
+# customization_information, which should contain the same information
void
regenerate_master_menu (SV *document_in, SV *customization_information, SV
*use_sections_in=0)
PREINIT:
@@ -513,8 +514,7 @@ split_by_section (SV *tree_in)
RETVAL
int
-unsplit (tree_in)
- SV *tree_in
+unsplit (SV *tree_in)
PREINIT:
DOCUMENT *document = 0;
CODE:
diff --git a/tp/t/test_utils.pl b/tp/t/test_utils.pl
index ca7efaadd4..29fdc521b9 100644
--- a/tp/t/test_utils.pl
+++ b/tp/t/test_utils.pl
@@ -1004,7 +1004,9 @@ sub test($$)
$main_configuration->set_conf('novalidate', 1);
}
- $main_configuration->set_document_main_configuration($document);
+ # Now that all the configuration has been set, associate it to the
+ # document XS
+ $main_configuration->register_XS_document_main_configuration($document);
my $indices_information = $document->indices_information();
if ($tree_transformations{'relate_index_entries_to_items'}) {
diff --git a/tp/texi2any.pl b/tp/texi2any.pl
index 75f03ba720..26cb16e2c0 100755
--- a/tp/texi2any.pl
+++ b/tp/texi2any.pl
@@ -1505,7 +1505,9 @@ while(@input_files) {
$main_configuration->set_conf('novalidate', 1);
}
- $main_configuration->set_document_main_configuration($document);
+ # Now that all the configuration has been set, associate it to the
+ # document XS
+ $main_configuration->register_XS_document_main_configuration($document);
if (defined(get_conf('MACRO_EXPAND')) and $file_number == 0) {
require Texinfo::Convert::Texinfo;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/Config.pm (register_XS_document_main_configuration): rename Texinfo::Config set_document_main_configuration as register_XS_document_main_configuration. Update callers.,
Patrice Dumas <=