[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
From: |
Patrice Dumas |
Date: |
Thu, 9 Nov 2023 15:59:25 -0500 (EST) |
branch: master
commit ae57f3c71185d0938a5a8c079c9be7583630fd54
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Wed Nov 8 09:22:08 2023 +0100
* tp/Texinfo/Common.pm (copy_tree),
tp/Texinfo/XS/main/manipulate_tree.c (copy_tree),
tp/Texinfo/XS/structuring_transfo/StructuringTransfo.xs (copy_tree):
remove second argument of copy_tree. Update callers.
* tp/t/test_tree_copy.t: use copy_treeNonXS instead of skipping the
test with a manual tree.
---
ChangeLog | 10 ++++++++++
tp/Texinfo/Common.pm | 10 ++++------
tp/Texinfo/Translations.pm | 8 ++++----
tp/Texinfo/XS/main/convert_utils.c | 8 ++++----
tp/Texinfo/XS/main/manipulate_tree.c | 6 +++---
tp/Texinfo/XS/main/manipulate_tree.h | 2 +-
tp/Texinfo/XS/parsetexi/indices.c | 8 ++++----
tp/Texinfo/XS/structuring_transfo/StructuringTransfo.xs | 7 +++----
tp/Texinfo/XS/structuring_transfo/structuring.c | 2 +-
tp/t/test_tree_copy.t | 12 ++++--------
10 files changed, 38 insertions(+), 35 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index a881acc913..7502e0cf16 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2023-11-08 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/Common.pm (copy_tree),
+ tp/Texinfo/XS/main/manipulate_tree.c (copy_tree),
+ tp/Texinfo/XS/structuring_transfo/StructuringTransfo.xs (copy_tree):
+ remove second argument of copy_tree. Update callers.
+
+ * tp/t/test_tree_copy.t: use copy_treeNonXS instead of skipping the
+ test with a manual tree.
+
2023-11-09 Gavin Smith <gavinsmith0123@gmail.com>
Locale-independent XS paragraph formatting
diff --git a/tp/Texinfo/Common.pm b/tp/Texinfo/Common.pm
index 799dfb7476..0b25e5217d 100644
--- a/tp/Texinfo/Common.pm
+++ b/tp/Texinfo/Common.pm
@@ -2064,21 +2064,19 @@ sub _copy_extra_info($$;$)
}
}
-sub copy_tree($;$)
+sub copy_tree($)
{
my $current = shift;
- my $parent = shift;
- my $copy = _copy_tree($current, $parent);
+ my $copy = _copy_tree($current, undef);
_copy_extra_info($current, $copy);
return $copy;
}
# Never overriden by XS version
-sub copy_treeNonXS($;$)
+sub copy_treeNonXS($)
{
my $current = shift;
- my $parent = shift;
- my $copy = _copy_tree($current, $parent);
+ my $copy = _copy_tree($current, undef);
_copy_extra_info($current, $copy);
return $copy;
}
diff --git a/tp/Texinfo/Translations.pm b/tp/Texinfo/Translations.pm
index a916af8a8e..999fe4776a 100644
--- a/tp/Texinfo/Translations.pm
+++ b/tp/Texinfo/Translations.pm
@@ -508,10 +508,10 @@ sub complete_indices($$)
my $def_command = $main_entry_element->{'extra'}->{'def_command'};
- my $class_copy = Texinfo::Common::copy_treeNonXS($class, undef);
- my $name_copy = Texinfo::Common::copy_treeNonXS($name, undef);
- my $ref_class_copy = Texinfo::Common::copy_treeNonXS($class, undef);
- my $ref_name_copy = Texinfo::Common::copy_treeNonXS($name, undef);
+ my $class_copy = Texinfo::Common::copy_treeNonXS($class);
+ my $name_copy = Texinfo::Common::copy_treeNonXS($name);
+ my $ref_class_copy = Texinfo::Common::copy_treeNonXS($class);
+ my $ref_name_copy = Texinfo::Common::copy_treeNonXS($name);
# Use the document language that was current when the command was
# used for getting the translation.
diff --git a/tp/Texinfo/XS/main/convert_utils.c
b/tp/Texinfo/XS/main/convert_utils.c
index 43101d9077..cd302a9473 100644
--- a/tp/Texinfo/XS/main/convert_utils.c
+++ b/tp/Texinfo/XS/main/convert_utils.c
@@ -447,14 +447,14 @@ definition_category_tree (OPTIONS * options, ELEMENT
*current)
{
if (arg_category)
{
- ELEMENT *category_copy = copy_tree (arg_category, 0);
+ ELEMENT *category_copy = copy_tree (arg_category);
return category_copy;
}
else
return 0;
}
- class_copy = copy_tree (arg_class, 0);
+ class_copy = copy_tree (arg_class);
if (!options)
{
@@ -473,7 +473,7 @@ definition_category_tree (OPTIONS * options, ELEMENT
*current)
|| !strcmp(def_command, "defmethod")
|| !strcmp(def_command, "deftypemethod"))
{
- ELEMENT *category_copy = copy_tree (arg_category, 0);
+ ELEMENT *category_copy = copy_tree (arg_category);
if (options)
{
NAMED_STRING_ELEMENT_LIST *substrings
@@ -505,7 +505,7 @@ definition_category_tree (OPTIONS * options, ELEMENT
*current)
|| !strcmp(def_command, "defcv")
|| !strcmp(def_command, "deftypecv"))
{
- ELEMENT *category_copy = copy_tree (arg_category, 0);
+ ELEMENT *category_copy = copy_tree (arg_category);
if (options)
{
NAMED_STRING_ELEMENT_LIST *substrings
diff --git a/tp/Texinfo/XS/main/manipulate_tree.c
b/tp/Texinfo/XS/main/manipulate_tree.c
index 34084b46f0..dd83827387 100644
--- a/tp/Texinfo/XS/main/manipulate_tree.c
+++ b/tp/Texinfo/XS/main/manipulate_tree.c
@@ -311,9 +311,9 @@ copy_extra_info (ELEMENT *current, ELEMENT *new)
}
ELEMENT *
-copy_tree (ELEMENT *current, ELEMENT *parent)
+copy_tree (ELEMENT *current)
{
- ELEMENT *copy = copy_tree_internal (current, parent);
+ ELEMENT *copy = copy_tree_internal (current, 0);
copy_extra_info (current, copy);
return copy;
}
@@ -325,7 +325,7 @@ copy_contents (ELEMENT *element, enum element_type type)
ELEMENT *result;
tmp->contents = element->contents;
- result = copy_tree (tmp, 0);
+ result = copy_tree (tmp);
tmp->contents.list = 0;
destroy_element (tmp);
diff --git a/tp/Texinfo/XS/main/manipulate_tree.h
b/tp/Texinfo/XS/main/manipulate_tree.h
index 925c38dac4..157726cb15 100644
--- a/tp/Texinfo/XS/main/manipulate_tree.h
+++ b/tp/Texinfo/XS/main/manipulate_tree.h
@@ -21,7 +21,7 @@
#include "tree_types.h"
-ELEMENT *copy_tree (ELEMENT *current, ELEMENT *parent);
+ELEMENT *copy_tree (ELEMENT *current);
ELEMENT *copy_contents (ELEMENT *element, enum element_type type);
diff --git a/tp/Texinfo/XS/parsetexi/indices.c
b/tp/Texinfo/XS/parsetexi/indices.c
index 7c4c4bb681..dc89ed6ebe 100644
--- a/tp/Texinfo/XS/parsetexi/indices.c
+++ b/tp/Texinfo/XS/parsetexi/indices.c
@@ -448,10 +448,10 @@ complete_indices (int document_descriptor)
"documentlanguage");
NAMED_STRING_ELEMENT_LIST *substrings
= new_named_string_element_list ();
- ELEMENT *name_copy = copy_tree (name, 0);
- ELEMENT *class_copy = copy_tree (class, 0);
- ELEMENT *ref_name_copy = copy_tree (name, 0);
- ELEMENT *ref_class_copy = copy_tree (class, 0);
+ ELEMENT *name_copy = copy_tree (name);
+ ELEMENT *class_copy = copy_tree (class);
+ ELEMENT *ref_name_copy = copy_tree (name);
+ ELEMENT *ref_class_copy = copy_tree (class);
add_element_to_named_string_element_list (substrings,
"name", name_copy);
diff --git a/tp/Texinfo/XS/structuring_transfo/StructuringTransfo.xs
b/tp/Texinfo/XS/structuring_transfo/StructuringTransfo.xs
index 59d6b68541..79431c64e2 100644
--- a/tp/Texinfo/XS/structuring_transfo/StructuringTransfo.xs
+++ b/tp/Texinfo/XS/structuring_transfo/StructuringTransfo.xs
@@ -32,10 +32,10 @@
#include "options_types.h"
#include "tree_types.h"
+#include "converter_types.h"
#include "tree.h"
#include "utils.h"
#include "manipulate_tree.h"
-/* for copy_tree */
#include "document.h"
#include "transformations.h"
#include "structuring.h"
@@ -188,16 +188,15 @@ fill_gaps_in_sectioning (SV *tree_in)
destroy_element (added_sections);
}
-# FIXME what to do with the parent argument?
SV *
-copy_tree (SV *tree_in, SV *parent_in=0)
+copy_tree (SV *tree_in)
PREINIT:
DOCUMENT *document;
CODE:
document = get_sv_tree_document (tree_in, "copy_tree");
if (document)
{
- ELEMENT *result = copy_tree (document->tree, 0);
+ ELEMENT *result = copy_tree (document->tree);
/* FIXME have a similar system but for trees only? */
int copy_document_descriptor = register_document (result, 0, 0, 0,
0, 0, 0, 0, 0, 0);
diff --git a/tp/Texinfo/XS/structuring_transfo/structuring.c
b/tp/Texinfo/XS/structuring_transfo/structuring.c
index b16897e992..c39e68eeda 100644
--- a/tp/Texinfo/XS/structuring_transfo/structuring.c
+++ b/tp/Texinfo/XS/structuring_transfo/structuring.c
@@ -1837,7 +1837,7 @@ print_down_menus(ELEMENT *node, LABEL_LIST
*identifiers_target,
ELEMENT *entry = menu->contents.list[j];
if (entry->type == ET_menu_entry)
{
- ELEMENT *entry_copy = copy_tree (entry, 0);
+ ELEMENT *entry_copy = copy_tree (entry);
ELEMENT *node;
add_to_contents_as_array (master_menu_contents, entry_copy);
/* gather node children to recursively print their menus */
diff --git a/tp/t/test_tree_copy.t b/tp/t/test_tree_copy.t
index 6bccdb05e3..74376c898f 100644
--- a/tp/t/test_tree_copy.t
+++ b/tp/t/test_tree_copy.t
@@ -56,10 +56,7 @@
$tref->{'contents'}->[1]->{'extra'}->{'thing'}->{'contents'}->[0]->{'extra'}->{'
my $tref_texi = Texinfo::Convert::Texinfo::convert_to_texinfo($tref);
-SKIP:
-{
- skip "test perl not XS", 1 if ($with_XS);
-my $tref_copy = Texinfo::Common::copy_tree($tref, undef);
+my $tref_copy = Texinfo::Common::copy_treeNonXS($tref);
my $tref_copy_texi = Texinfo::Convert::Texinfo::convert_to_texinfo($tref_copy);
@@ -68,7 +65,6 @@ my $tref_copy_texi =
Texinfo::Convert::Texinfo::convert_to_texinfo($tref_copy);
# messages.
is ($tref_texi, $tref_copy_texi, "ref within extra tree");
-}
my $text = '@setfilename some@@file.ext
@@ -141,7 +137,7 @@ my $test_parser = Texinfo::Parser::parser();
my $document = Texinfo::Parser::parse_texi_piece($test_parser, $text);
my $tree = $document->tree();
my $test_registrar = $test_parser->registered_errors();
-my $copy = Texinfo::Common::copy_tree($tree, undef);
+my $copy = Texinfo::Common::copy_tree($tree);
my $texi_tree = Texinfo::Convert::Texinfo::convert_to_texinfo($tree);
@@ -156,7 +152,7 @@ Texinfo::Structuring::sectioning_structure($tree,
$test_registrar,
$tree = Texinfo::Structuring::rebuild_tree($tree);
-my $copy_with_sec = Texinfo::Common::copy_tree($tree, undef);
+my $copy_with_sec = Texinfo::Common::copy_tree($tree);
my $texi_tree_with_sec = Texinfo::Convert::Texinfo::convert_to_texinfo($tree);
my $texi_copy_with_sec
@@ -188,7 +184,7 @@ foreach my $file_include (['Texinfo', $manual_file,
$manual_include_dir],
warn "$label: ".$error_message->{'error_line'}
if ($debug);
}
- my $test_tree_copy = Texinfo::Common::copy_tree($texinfo_test_tree, undef);
+ my $test_tree_copy = Texinfo::Common::copy_tree($texinfo_test_tree);
my $test_texi
= Texinfo::Convert::Texinfo::convert_to_texinfo($texinfo_test_tree);