[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Disabling XS translation functions - please help
From: |
Gavin Smith |
Subject: |
Disabling XS translation functions - please help |
Date: |
Fri, 27 Oct 2023 13:56:20 +0100 |
I was attempting to disable the XS translation functions in the XS parser,
as I said in another email. This would be necessary for the XS parser to
function correctly, and should allow for isolating and disabling the other
new texi2any code that is causing a slowdown.
However, I found even this seemingly simple task impossible with the
hours I've spent on it. I thought that we would disable the call to
complete_indices in parser.c, and do it in Parsetexi.pm:
diff --git a/tp/Texinfo/XS/parsetexi/Parsetexi.pm
b/tp/Texinfo/XS/parsetexi/Parsetexi.pm
index f64bb2c76f..d6f6f0a759 100644
--- a/tp/Texinfo/XS/parsetexi/Parsetexi.pm
+++ b/tp/Texinfo/XS/parsetexi/Parsetexi.pm
@@ -194,8 +194,8 @@ sub _get_parser_info($$;$) {
my $document = build_document ($document_descriptor, $no_store);
- #Texinfo::Translations::complete_indices ($self,
- # $document->indices_information());
+ Texinfo::Translations::complete_indices ($self,
+ $document->indices_information());
# Copy the errors into the error list in Texinfo::Report.
foreach my $error (@{$document->{'errors'}}) {
diff --git a/tp/Texinfo/XS/parsetexi/indices.c
b/tp/Texinfo/XS/parsetexi/indices.c
index 113b69221b..4e607eee46 100644
--- a/tp/Texinfo/XS/parsetexi/indices.c
+++ b/tp/Texinfo/XS/parsetexi/indices.c
@@ -366,6 +366,8 @@ resolve_indices_merged_in (void)
}
}
+/* Currently unused, as it relies on getting translations with gdt/gettext
+ which does not currently work in the XS module. */
void
complete_indices (int document_descriptor)
{
diff --git a/tp/Texinfo/XS/parsetexi/parser.c b/tp/Texinfo/XS/parsetexi/parser.c
index 46ceec0a9f..b4b6ffea5c 100644
--- a/tp/Texinfo/XS/parsetexi/parser.c
+++ b/tp/Texinfo/XS/parsetexi/parser.c
@@ -2742,7 +2742,8 @@ parse_texi (ELEMENT *root_elt, ELEMENT *current_elt)
document_descriptor = store_document(current);
- complete_indices (document_descriptor);
+ /* Does not currently work. */
+ //complete_indices (document_descriptor);
return document_descriptor;
}
I also disabled the XS translations module:
diff --git a/tp/Texinfo/Translations.pm b/tp/Texinfo/Translations.pm
index 28f91bb29d..7823a9df7f 100644
--- a/tp/Texinfo/Translations.pm
+++ b/tp/Texinfo/Translations.pm
@@ -24,6 +24,8 @@ our $VERSION = '7.1';
use Texinfo::XSLoader;
+use Texinfo::TranslationsNonXS;
+
# BEWARE the setup is weird here, because we load the NonXS module in any case.
# Indeed, the XS module does not work, except for the configure(_XS) function
# that we want to call. So, we load the XS code here, but also the NonXS
@@ -32,7 +34,8 @@ use Texinfo::XSLoader;
# NonXS functions. We override a function with configure(_XS) in the NonXS
# module to call the XS code configure(_XS).
-BEGIN {
+#BEGIN {
+if (0) {
our $warning_message = undef;
our $fatal_message = undef;
However, this does not work in the tests (t/languages.t
simple_documentlanguage). Even though 'def_index_element' is set correctly
in Texinfo::Translations::complete_indices, later on when it is used
(in index_content_element in Texinfo/Common.pm), it is unset again!
I suspected that the call to Texinfo::Structuring::rebuild_document (in
texi2any.pl, and in t/test_utils.pl) was responsible, and indeed when
I comment out that line the tests get further (but still break as
rebuild_document was doing something else that was necessary).
Question: why are we rebuilding the tree in rebuild_document when
it has already been built?
There doesn't seem to be any way to easily call
Texinfo::Translations::complete_indices (non-XS version) again to
complete the tree as was already done in Parsetexi.pm.
I tried calling complete_indices after rebuild_document:
diff --git a/tp/t/test_utils.pl b/tp/t/test_utils.pl
index 29fdc521b9..4268d07621 100644
--- a/tp/t/test_utils.pl
+++ b/tp/t/test_utils.pl
@@ -1081,6 +1081,9 @@ sub test($$)
}
$document = Texinfo::Structuring::rebuild_document($document);
+ Texinfo::Translations::complete_indices ($parser,
+ $document->indices_information());
+
# should not actually be useful, as the same element should be reused.
$tree = $document->tree();
but this doesn't work either.
I consider texi2any to be in a semi-broken state at the moment, with
the new code entangled with the program in a way that I am finding
difficult to remove. I may not have much more time to work on this in
the coming days.
- Disabling XS translation functions - please help,
Gavin Smith <=