[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/XS/main/DocumentXS.xs (rebuild_docum
From: |
Patrice Dumas |
Subject: |
branch master updated: * tp/Texinfo/XS/main/DocumentXS.xs (rebuild_document, rebuild_tree) (remove_document_descriptor, remove_document, clear_document_errors) (set_document_options), tp/Makefile.am (dist_modules_DATA), tp/Texinfo/Document.pm (import, rebuild_document, rebuild_tree) (clear_document_errors), tp/Texinfo/XS/Makefile.am (DocumentXS_la_SOURCES): move rebuild_document, rebuild_tree, remove_document_descriptor, remove_document and clear_document_errors to a new XS associated to Texinfo::Document. |
Date: |
Tue, 14 Nov 2023 04:28:37 -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 c199e060df * tp/Texinfo/XS/main/DocumentXS.xs (rebuild_document,
rebuild_tree) (remove_document_descriptor, remove_document,
clear_document_errors) (set_document_options), tp/Makefile.am
(dist_modules_DATA), tp/Texinfo/Document.pm (import, rebuild_document,
rebuild_tree) (clear_document_errors), tp/Texinfo/XS/Makefile.am
(DocumentXS_la_SOURCES): move rebuild_document, rebuild_tree,
remove_document_descriptor, remove_document and clear_document_errors to a new
XS associated to Tex [...]
c199e060df is described below
commit c199e060df883d295720a25427a650ab3c625a0e
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Tue Nov 14 10:28:26 2023 +0100
* tp/Texinfo/XS/main/DocumentXS.xs (rebuild_document, rebuild_tree)
(remove_document_descriptor, remove_document, clear_document_errors)
(set_document_options), tp/Makefile.am (dist_modules_DATA),
tp/Texinfo/Document.pm (import, rebuild_document, rebuild_tree)
(clear_document_errors), tp/Texinfo/XS/Makefile.am
(DocumentXS_la_SOURCES): move rebuild_document, rebuild_tree,
remove_document_descriptor, remove_document and clear_document_errors
to a new XS associated to Texinfo::Document.
---
.gitignore | 1 +
ChangeLog | 11 ++
tp/Makefile.am | 1 +
tp/TODO | 4 +-
tp/Texinfo/Common.pm | 3 +-
tp/Texinfo/Document.pm | 48 +++++-
tp/Texinfo/DocumentXS.pm | 42 +++++
tp/Texinfo/Structuring.pm | 31 ----
tp/Texinfo/XS/Makefile.am | 17 +++
tp/Texinfo/XS/main/DocumentXS.xs | 169 +++++++++++++++++++++
tp/Texinfo/XS/main/extra.c | 2 +-
.../XS/structuring_transfo/StructuringTransfo.xs | 126 ---------------
tp/t/automatic_menus.t | 6 +-
tp/t/automatic_nodes.t | 6 +-
tp/t/do_master_menu.t | 9 +-
tp/t/index_before_item.t | 3 +-
tp/t/protect_character_in_texinfo.t | 7 +-
tp/t/reference_to_text_in_tree.t | 7 +-
tp/t/test_fill_gaps_in_sectioning.t | 5 +-
tp/t/test_protect_contents.t | 5 +-
tp/t/test_protect_hashchar_at_line_beginning.t | 5 +-
tp/t/test_tree_copy.t | 5 +-
tp/t/test_utils.pl | 5 +-
tp/texi2any.pl | 6 +-
24 files changed, 330 insertions(+), 194 deletions(-)
diff --git a/.gitignore b/.gitignore
index 0b9024740e..9b3dcb8fdb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -318,6 +318,7 @@ tp/Texinfo/XS/gnulib/m4/ltsugar.m4
tp/Texinfo/XS/gnulib/m4/ltversion.m4
tp/Texinfo/XS/gnulib/m4/lt~obsolete.m4
+tp/Texinfo/XS/main/DocumentXS.c
tp/Texinfo/XS/main/TranslationsXS.c
tp/Texinfo/XS/main/accent_tables_8bit_codepoints.c
tp/Texinfo/XS/main/command_data.c
diff --git a/ChangeLog b/ChangeLog
index 000ef835fa..572ac4ddd7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2023-11-14 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/XS/main/DocumentXS.xs (rebuild_document, rebuild_tree)
+ (remove_document_descriptor, remove_document, clear_document_errors)
+ (set_document_options), tp/Makefile.am (dist_modules_DATA),
+ tp/Texinfo/Document.pm (import, rebuild_document, rebuild_tree)
+ (clear_document_errors), tp/Texinfo/XS/Makefile.am
+ (DocumentXS_la_SOURCES): move rebuild_document, rebuild_tree,
+ remove_document_descriptor, remove_document and clear_document_errors
+ to a new XS associated to Texinfo::Document.
+
2023-11-13 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/XS/convert/convert_html.c (html_destroy): output a debug
diff --git a/tp/Makefile.am b/tp/Makefile.am
index 5f824a3d7a..f6652ea8df 100644
--- a/tp/Makefile.am
+++ b/tp/Makefile.am
@@ -70,6 +70,7 @@ dist_modules_DATA = \
Texinfo/Commands.pm \
Texinfo/DebugTree.pm \
Texinfo/Document.pm \
+ Texinfo/DocumentXS.pm \
Texinfo/Documentlanguages.pm \
Texinfo/MiscXS.pm \
Texinfo/Options.pm \
diff --git a/tp/TODO b/tp/TODO
index d700de0263..8a3bc510ae 100644
--- a/tp/TODO
+++ b/tp/TODO
@@ -20,8 +20,8 @@ module, and the _l variants seem to be in glibc but are are
not in the glibc
documentation. According to Eli, if the locale's codeset is UTF-8, glibc
uses the full Unicode CLDR, which is what we want.
-Document that Texinfo::Structuring::rebuild_document or
-Texinfo::Structuring::rebuild_tree should be called after tree modifications
+Document that Texinfo::Document::rebuild_document or
+Texinfo::Document::rebuild_tree should be called after tree modifications
if the parser is XS but converters are perl.
the code in _parsed_manual_tree in Pod-Simple-Texinfo/pod2texi.pl
diff --git a/tp/Texinfo/Common.pm b/tp/Texinfo/Common.pm
index ec44d15a82..edbdfd9167 100644
--- a/tp/Texinfo/Common.pm
+++ b/tp/Texinfo/Common.pm
@@ -45,6 +45,7 @@ use Locale::Messages;
# FIXME do we really want XS in that file? Move to
# Structuring.pm?
+use Texinfo::DocumentXS;
use Texinfo::StructTransf;
use Texinfo::XSLoader;
@@ -90,7 +91,7 @@ my $XS_structuring = ((not defined($ENV{TEXINFO_XS})
our %XS_overrides = (
"Texinfo::Common::set_document_options"
- => "Texinfo::StructTransf::set_document_options",
+ => "Texinfo::DocumentXS::set_document_options",
"Texinfo::Common::copy_tree"
=> "Texinfo::StructTransf::copy_tree",
"Texinfo::Common::relate_index_entries_to_table_items_in_tree"
diff --git a/tp/Texinfo/Document.pm b/tp/Texinfo/Document.pm
index 0ef4129520..ac80b7abf0 100644
--- a/tp/Texinfo/Document.pm
+++ b/tp/Texinfo/Document.pm
@@ -26,9 +26,9 @@ use warnings;
# To check if there is no erroneous autovivification
#no autovivification qw(fetch delete exists store strict);
-use Texinfo::Common;
+use Texinfo::DocumentXS;
-use Texinfo::StructTransf;
+use Texinfo::Common;
our $module_loaded = 0;
sub import {
@@ -37,9 +37,22 @@ sub import {
or $ENV{TEXINFO_XS_PARSER} eq '1') {
Texinfo::XSLoader::override(
"Texinfo::Document::remove_document",
- # TODO add a Document XS .xs file and move to that file?
- "Texinfo::StructTransf::remove_document"
- );
+ "Texinfo::DocumentXS::remove_document");
+ Texinfo::XSLoader::override(
+ "Texinfo::Document::rebuild_document",
+ "Texinfo::DocumentXS::rebuild_document");
+ Texinfo::XSLoader::override(
+ "Texinfo::Document::rebuild_tree",
+ "Texinfo::DocumentXS::rebuild_tree");
+ Texinfo::XSLoader::override(
+ "Texinfo::Document::remove_document_descriptor",
+ "Texinfo::DocumentXS::remove_document_descriptor");
+ Texinfo::XSLoader::override(
+ "Texinfo::Document::clear_document_errors",
+ "Texinfo::DocumentXS::clear_document_errors");
+ Texinfo::XSLoader::override(
+ "Texinfo::Document::set_document_options",
+ "Texinfo::DocumentXS::set_document_options");
}
$module_loaded = 1;
}
@@ -259,6 +272,31 @@ sub remove_document ($)
my $document = shift;
}
+# this method does nothing, but the XS override rebuilds the perl
+# document based on XS data.
+sub rebuild_document($;$)
+{
+ my $document = shift;
+ my $no_store = shift;
+
+ return $document;
+}
+
+# this method does nothing, but the XS override rebuilds the perl
+# tree based on XS data.
+sub rebuild_tree($;$)
+{
+ my $tree = shift;
+ my $no_store = shift;
+
+ return $tree;
+}
+
+# this method does nothing, but the XS override clears the document errors
+sub clear_document_errors($)
+{
+}
+
1;
__END__
=head1 NAME
diff --git a/tp/Texinfo/DocumentXS.pm b/tp/Texinfo/DocumentXS.pm
new file mode 100644
index 0000000000..8b4c277bfb
--- /dev/null
+++ b/tp/Texinfo/DocumentXS.pm
@@ -0,0 +1,42 @@
+# Document.pm: load parsed Texinfo tree document XS functions.
+#
+# Copyright 2010-2023 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License,
+# or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+package Texinfo::Document;
+
+use strict;
+use warnings;
+
+our $VERSION = '7.1dev';
+
+use Texinfo::XSLoader;
+
+BEGIN {
+ our $warning_message = undef;
+ our $fatal_message = undef;
+
+ my $package = Texinfo::XSLoader::init (
+ "Texinfo::DocumentXS",
+ "Texinfo::DocumentXS",
+ "DocumentXS",
+ undef,
+ 0,
+ $warning_message,
+ $fatal_message
+ );
+}
+
+1;
diff --git a/tp/Texinfo/Structuring.pm b/tp/Texinfo/Structuring.pm
index 39ba71b75b..89d512eff9 100644
--- a/tp/Texinfo/Structuring.pm
+++ b/tp/Texinfo/Structuring.pm
@@ -93,12 +93,6 @@ my $XS_structuring = ((not defined($ENV{TEXINFO_XS})
or $ENV{TEXINFO_XS_STRUCTURE} ne '0'));
our %XS_overrides = (
- "Texinfo::Structuring::rebuild_document"
- => "Texinfo::StructTransf::rebuild_document",
- "Texinfo::Structuring::rebuild_tree"
- => "Texinfo::StructTransf::rebuild_tree",
- "Texinfo::Structuring::clear_document_errors"
- => "Texinfo::StructTransf::clear_document_errors",
"Texinfo::Structuring::associate_internal_references"
=> "Texinfo::StructTransf::associate_internal_references",
"Texinfo::Structuring::sectioning_structure"
@@ -157,31 +151,6 @@ my %command_structuring_level =
%Texinfo::Common::command_structuring_level;
my %appendix_commands = %Texinfo::Commands::appendix_commands;
my %unnumbered_commands = %Texinfo::Commands::unnumbered_commands;
-# this method does nothing, but the XS override rebuilds the perl
-# document based on XS data.
-sub rebuild_document($;$)
-{
- my $document = shift;
- my $no_store = shift;
-
- return $document;
-}
-
-# this method does nothing, but the XS override rebuilds the perl
-# tree based on XS data.
-sub rebuild_tree($;$)
-{
- my $tree = shift;
- my $no_store = shift;
-
- return $tree;
-}
-
-# this method does nothing, but the XS override clears the document errors
-sub clear_document_errors($)
-{
-}
-
# Go through the sectioning commands (e.g. @chapter, not @node), and
# set:
# 'section_level'
diff --git a/tp/Texinfo/XS/Makefile.am b/tp/Texinfo/XS/Makefile.am
index 070a405a9e..d4b3169beb 100644
--- a/tp/Texinfo/XS/Makefile.am
+++ b/tp/Texinfo/XS/Makefile.am
@@ -319,6 +319,23 @@ Parsetexi_la_CFLAGS = $(XSLIBS_CFLAGS)
Parsetexi_la_LIBADD = libtexinfoxs.la libtexinfo.la
Parsetexi_la_LDFLAGS = $(AM_LDFLAGS) $(XSLIBS_LDFLAGS)
+########################## Document XS
+
+if HAVE_ICONV
+xs_LTLIBRARIES += DocumentXS.la
+endif
+
+DocumentXS_la_SOURCES = \
+ main/DocumentXS.c
+
+EXTRA_DIST += main/DocumentXS.xs
+
+# locate include files under out-of-source builds.
+DocumentXS_la_CPPFLAGS = -I$(srcdir)/main $(AM_CPPFLAGS) $(XSLIBS_CPPFLAGS)
+DocumentXS_la_CFLAGS = $(XSLIBS_CFLAGS)
+DocumentXS_la_LIBADD = libtexinfoxs.la libtexinfo.la
+DocumentXS_la_LDFLAGS = $(AM_LDFLAGS) $(XSLIBS_LDFLAGS)
+
########################## Translations XS
if HAVE_ICONV
diff --git a/tp/Texinfo/XS/main/DocumentXS.xs b/tp/Texinfo/XS/main/DocumentXS.xs
new file mode 100644
index 0000000000..4a24e51f53
--- /dev/null
+++ b/tp/Texinfo/XS/main/DocumentXS.xs
@@ -0,0 +1,169 @@
+/* Copyright 2023 Free Software Foundation, Inc.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#include <config.h>
+
+/* Avoid namespace conflicts. */
+#define context perl_context
+
+#define PERL_NO_GET_CONTEXT
+#include "EXTERN.h"
+#include "perl.h"
+#if defined _WIN32 && !defined __CYGWIN__
+# undef free
+#endif
+#include "XSUB.h"
+
+#undef context
+
+#include "ppport.h"
+
+#include "options_types.h"
+#include "tree_types.h"
+#include "document_types.h"
+#include "document.h"
+#include "get_perl_info.h"
+#include "build_perl_info.h"
+
+MODULE = Texinfo::DocumentXS PACKAGE = Texinfo::DocumentXS
+
+PROTOTYPES: ENABLE
+
+SV *
+rebuild_document (SV *document_in, ...)
+ PROTOTYPE: $;$
+ PREINIT:
+ int no_store = 0;
+ int document_descriptor;
+ SV **document_descriptor_sv;
+ char *descriptor_key = "document_descriptor";
+ HV *hv_in;
+ CODE:
+ if (items > 1)
+ if (SvOK(ST(1)))
+ no_store = SvIV (ST(1));
+
+ hv_in = (HV *)SvRV (document_in);
+ document_descriptor_sv = hv_fetch (hv_in, descriptor_key,
+ strlen (descriptor_key), 0);
+ if (document_descriptor_sv)
+ {
+ SV **info_sv;
+ SV *rebuilt_doc_sv;
+ HV *rebuilt_doc_hv;
+
+ document_descriptor = SvIV (*document_descriptor_sv);
+ rebuilt_doc_sv = build_document (document_descriptor, no_store);
+ RETVAL = rebuilt_doc_sv;
+ rebuilt_doc_hv = (HV *)SvRV (rebuilt_doc_sv);
+ info_sv = hv_fetch (hv_in, "info", strlen ("info"), 0);
+ /* copy input document info keys values not already in new document
+ info. Should only happen for info keys set in perl only. */
+ if (info_sv)
+ {
+ I32 hv_number;
+ I32 i;
+ HV *info_hv = (HV *)SvRV (*info_sv);
+ SV **rebuilt_info_sv = hv_fetch (rebuilt_doc_hv, "info",
+ strlen ("info"), 0);
+ HV *rebuilt_info_hv = 0;
+ if (!rebuilt_info_sv)
+ {
+ HV *rebuilt_info_hv = newHV ();
+ SV *rebuilt_info_ref = newRV_noinc ((SV *)
rebuilt_info_hv);
+ hv_store (rebuilt_doc_hv, "info", strlen ("info"),
+ rebuilt_info_ref, 0);
+ }
+ else
+ {
+ rebuilt_info_hv = (HV *)SvRV (*rebuilt_info_sv);
+ }
+ hv_number = hv_iterinit (info_hv);
+ for (i = 0; i < hv_number; i++)
+ {
+ char *key;
+ I32 retlen;
+ SV *value = hv_iternextsv(info_hv,
+ &key, &retlen);
+ SV **existing_key_sv = hv_fetch (rebuilt_info_hv, key,
+ strlen (key), 0);
+ if (!existing_key_sv)
+ hv_store (rebuilt_info_hv, key, strlen (key), value, 0);
+ }
+ }
+ }
+ else
+ {
+ fprintf (stderr, "ERROR: document rebuild: no %s\n",
descriptor_key);
+ RETVAL = newSV(0);
+ }
+ OUTPUT:
+ RETVAL
+
+SV *
+rebuild_tree (SV *tree_in, ...)
+ PROTOTYPE: $;$
+ PREINIT:
+ int no_store = 0;
+ DOCUMENT *document = 0;
+ CODE:
+ if (items > 1)
+ if (SvOK(ST(1)))
+ no_store = SvIV (ST(1));
+
+ document = get_sv_tree_document (tree_in, "rebuild_tree");
+ if (document)
+ {
+ ELEMENT *tree;
+
+ build_document (document->descriptor, no_store);
+ tree = document->tree;
+ RETVAL = newRV_inc ((SV *) tree->hv);
+ }
+ else
+ RETVAL = newSV(0);
+ OUTPUT:
+ RETVAL
+
+void
+remove_document_descriptor (int document_descriptor)
+
+void
+remove_document (SV *document_in)
+ PREINIT:
+ DOCUMENT *document = 0;
+ CODE:
+ /* it is ok not to found a document if there is no
+ document descriptor */
+ document = get_sv_document_document (document_in, 0);
+ if (document)
+ remove_document_descriptor (document->descriptor);
+
+void
+clear_document_errors (int document_descriptor)
+
+void
+set_document_options (SV *sv_options_in, SV *document_in)
+ PREINIT:
+ DOCUMENT *document = 0;
+ CODE:
+ document = get_sv_document_document (document_in,
+ "set_document_options");
+ if (document)
+ {
+ OPTIONS *options = copy_sv_options (sv_options_in);
+ register_document_options (document, options);
+ }
+
diff --git a/tp/Texinfo/XS/main/extra.c b/tp/Texinfo/XS/main/extra.c
index bee68d017e..bb3c2de64b 100644
--- a/tp/Texinfo/XS/main/extra.c
+++ b/tp/Texinfo/XS/main/extra.c
@@ -26,7 +26,7 @@
#include "debug.h"
#include "extra.h"
-/* used in tree copy, but should not be used in general */
+/* directly used in tree copy, but should not be directly used in general */
void
add_associated_info_key (ASSOCIATED_INFO *a, char *key, intptr_t value,
enum extra_type type)
diff --git a/tp/Texinfo/XS/structuring_transfo/StructuringTransfo.xs
b/tp/Texinfo/XS/structuring_transfo/StructuringTransfo.xs
index a6c98cbe9d..99dcffa2e7 100644
--- a/tp/Texinfo/XS/structuring_transfo/StructuringTransfo.xs
+++ b/tp/Texinfo/XS/structuring_transfo/StructuringTransfo.xs
@@ -47,132 +47,6 @@ MODULE = Texinfo::StructTransf PACKAGE =
Texinfo::StructTransf
PROTOTYPES: ENABLE
-SV *
-rebuild_document (SV *document_in, ...)
- PROTOTYPE: $;$
- PREINIT:
- int no_store = 0;
- int document_descriptor;
- SV **document_descriptor_sv;
- char *descriptor_key = "document_descriptor";
- HV *hv_in;
- CODE:
- if (items > 1)
- if (SvOK(ST(1)))
- no_store = SvIV (ST(1));
-
- hv_in = (HV *)SvRV (document_in);
- document_descriptor_sv = hv_fetch (hv_in, descriptor_key,
- strlen (descriptor_key), 0);
- if (document_descriptor_sv)
- {
- SV **info_sv;
- SV *rebuilt_doc_sv;
- HV *rebuilt_doc_hv;
-
- document_descriptor = SvIV (*document_descriptor_sv);
- rebuilt_doc_sv = build_document (document_descriptor, no_store);
- RETVAL = rebuilt_doc_sv;
- rebuilt_doc_hv = (HV *)SvRV (rebuilt_doc_sv);
- info_sv = hv_fetch (hv_in, "info", strlen ("info"), 0);
- /* copy input document info keys values not already in new document
- info. Should only happen for info keys set in perl only. */
- if (info_sv)
- {
- I32 hv_number;
- I32 i;
- HV *info_hv = (HV *)SvRV (*info_sv);
- SV **rebuilt_info_sv = hv_fetch (rebuilt_doc_hv, "info",
- strlen ("info"), 0);
- HV *rebuilt_info_hv = 0;
- if (!rebuilt_info_sv)
- {
- HV *rebuilt_info_hv = newHV ();
- SV *rebuilt_info_ref = newRV_noinc ((SV *)
rebuilt_info_hv);
- hv_store (rebuilt_doc_hv, "info", strlen ("info"),
- rebuilt_info_ref, 0);
- }
- else
- {
- rebuilt_info_hv = (HV *)SvRV (*rebuilt_info_sv);
- }
- hv_number = hv_iterinit (info_hv);
- for (i = 0; i < hv_number; i++)
- {
- char *key;
- I32 retlen;
- SV *value = hv_iternextsv(info_hv,
- &key, &retlen);
- SV **existing_key_sv = hv_fetch (rebuilt_info_hv, key,
- strlen (key), 0);
- if (!existing_key_sv)
- hv_store (rebuilt_info_hv, key, strlen (key), value, 0);
- }
- }
- }
- else
- {
- fprintf (stderr, "ERROR: document rebuild: no %s\n",
descriptor_key);
- RETVAL = newSV(0);
- }
- OUTPUT:
- RETVAL
-
-SV *
-rebuild_tree (SV *tree_in, ...)
- PROTOTYPE: $;$
- PREINIT:
- int no_store = 0;
- DOCUMENT *document = 0;
- CODE:
- if (items > 1)
- if (SvOK(ST(1)))
- no_store = SvIV (ST(1));
-
- document = get_sv_tree_document (tree_in, "rebuild_tree");
- if (document)
- {
- ELEMENT *tree;
-
- build_document (document->descriptor, no_store);
- tree = document->tree;
- RETVAL = newRV_inc ((SV *) tree->hv);
- }
- else
- RETVAL = newSV(0);
- OUTPUT:
- RETVAL
-
-void
-remove_document_descriptor (int document_descriptor)
-
-void
-remove_document (SV *document_in)
- PREINIT:
- DOCUMENT *document = 0;
- CODE:
- /* it is ok not to found a document if there is no
- document descriptor */
- document = get_sv_document_document (document_in, 0);
- if (document)
- remove_document_descriptor (document->descriptor);
-
-void
-clear_document_errors (int document_descriptor)
-
-void
-set_document_options (SV *sv_options_in, SV *document_in)
- PREINIT:
- DOCUMENT *document = 0;
- CODE:
- document = get_sv_document_document (document_in,
- "set_document_options");
- if (document)
- {
- OPTIONS *options = copy_sv_options (sv_options_in);
- register_document_options (document, options);
- }
-
void
fill_gaps_in_sectioning (SV *tree_in)
PREINIT:
diff --git a/tp/t/automatic_menus.t b/tp/t/automatic_menus.t
index a238bd4eba..8934574c36 100644
--- a/tp/t/automatic_menus.t
+++ b/tp/t/automatic_menus.t
@@ -8,8 +8,10 @@ use Texinfo::ModulePath (undef, undef, undef, 'updirs' => 2);
BEGIN { plan tests => 12; }
use Texinfo::Parser;
-use Texinfo::Transformations;
use Texinfo::Convert::Texinfo;
+use Texinfo::Document;
+use Texinfo::Structuring;
+use Texinfo::Transformations;
use Data::Dumper;
@@ -39,7 +41,7 @@ sub test($$$;$$)
Texinfo::Transformations::complete_tree_nodes_menus($tree, $use_sections);
}
- $tree = Texinfo::Structuring::rebuild_tree($tree);
+ $tree = Texinfo::Document::rebuild_tree($tree);
my $texi_result = Texinfo::Convert::Texinfo::convert_to_texinfo($tree);
diff --git a/tp/t/automatic_nodes.t b/tp/t/automatic_nodes.t
index 5f426988d3..c991a40fd5 100644
--- a/tp/t/automatic_nodes.t
+++ b/tp/t/automatic_nodes.t
@@ -10,6 +10,8 @@ BEGIN { plan tests => 27; }
use Texinfo::Parser;
use Texinfo::Transformations;
use Texinfo::Convert::Texinfo;
+use Texinfo::Document;
+use Texinfo::Structuring;
use Data::Dumper;
@@ -173,7 +175,7 @@
Texinfo::Structuring::associate_internal_references($document, $registrar,
$parser);
Texinfo::Transformations::insert_nodes_for_sectioning_commands($document,
$registrar, $parser);
-$document = Texinfo::Structuring::rebuild_document($document);
+$document = Texinfo::Document::rebuild_document($document);
$tree = $document->tree();
my $result = Texinfo::Convert::Texinfo::convert_to_texinfo($tree);
is ($result, $reference, 'add nodes');
@@ -197,7 +199,7 @@
Texinfo::Structuring::associate_internal_references($document, $registrar,
Texinfo::Transformations::insert_nodes_for_sectioning_commands($document,
$registrar, $parser);
-$document = Texinfo::Structuring::rebuild_document($document);
+$document = Texinfo::Document::rebuild_document($document);
my $identifier_target = $document->labels_information();
my $indices_information = $document->indices_information();
diff --git a/tp/t/do_master_menu.t b/tp/t/do_master_menu.t
index 6fc9d87a80..c9da6ebfdc 100644
--- a/tp/t/do_master_menu.t
+++ b/tp/t/do_master_menu.t
@@ -10,6 +10,7 @@ BEGIN { plan tests => 5; }
use Texinfo::Parser;
use Texinfo::Transformations;
use Texinfo::Convert::Texinfo;
+use Texinfo::Document;
use Texinfo::Structuring;
use Data::Dumper;
@@ -127,7 +128,7 @@ my $document = $parser->parse_texi_piece($in_detailmenu);
my $registrar = $parser->registered_errors();
Texinfo::Structuring::associate_internal_references($document, $registrar,
$parser);
-$document = Texinfo::Structuring::rebuild_document($document);
+$document = Texinfo::Document::rebuild_document($document);
my $identifier_target = $document->labels_information();
my $top_node = $identifier_target->{'Top'};
# FIXME does not test XS
@@ -176,7 +177,7 @@ $document = $parser->parse_texi_piece($no_detailmenu);
$registrar = $parser->registered_errors();
Texinfo::Structuring::associate_internal_references($document, $registrar,
$parser);
-$document = Texinfo::Structuring::rebuild_document($document);
+$document = Texinfo::Document::rebuild_document($document);
$identifier_target = $document->labels_information();
$top_node = $identifier_target->{'Top'};
# FIXME does not test XS
@@ -192,7 +193,7 @@ $registrar = $parser->registered_errors();
Texinfo::Structuring::associate_internal_references($document, $registrar,
$parser);
Texinfo::Transformations::regenerate_master_menu($document, $parser);
-$document = Texinfo::Structuring::rebuild_document($document);
+$document = Texinfo::Document::rebuild_document($document);
my $tree = $document->tree();
$out = Texinfo::Convert::Texinfo::convert_to_texinfo($tree);
@@ -206,7 +207,7 @@ $registrar = $parser->registered_errors();
Texinfo::Structuring::associate_internal_references($document, $registrar,
$parser);
Texinfo::Transformations::regenerate_master_menu($document, $parser);
-$document = Texinfo::Structuring::rebuild_document($document);
+$document = Texinfo::Document::rebuild_document($document);
$tree = $document->tree();
$out = Texinfo::Convert::Texinfo::convert_to_texinfo($tree);
diff --git a/tp/t/index_before_item.t b/tp/t/index_before_item.t
index b3c15a4ffb..91b89c3526 100644
--- a/tp/t/index_before_item.t
+++ b/tp/t/index_before_item.t
@@ -9,6 +9,7 @@ BEGIN { plan tests => 6; }
use Texinfo::Parser qw(parse_texi_piece);
use Texinfo::Common qw(move_index_entries_after_items_in_tree);
+use Texinfo::Document;
use Texinfo::Structuring;
use Texinfo::Convert::Texinfo;
use Texinfo::DebugTree;
@@ -27,7 +28,7 @@ sub run_test($$$)
#print STDERR Texinfo::DebugTree::convert_tree(undef, $tree)."\n";
move_index_entries_after_items_in_tree($tree);
- $tree = Texinfo::Structuring::rebuild_tree($tree);
+ $tree = Texinfo::Document::rebuild_tree($tree);
my $texi_result = Texinfo::Convert::Texinfo::convert_to_texinfo($tree);
diff --git a/tp/t/protect_character_in_texinfo.t
b/tp/t/protect_character_in_texinfo.t
index cb4f51827e..a4eef97c2f 100644
--- a/tp/t/protect_character_in_texinfo.t
+++ b/tp/t/protect_character_in_texinfo.t
@@ -10,8 +10,9 @@ BEGIN { plan tests => 7; }
use Texinfo::Parser qw(parse_texi_line parse_texi_piece);
use Texinfo::Common qw(protect_comma_in_tree protect_colon_in_tree
protect_node_after_label_in_tree);
-use Texinfo::Structuring;
use Texinfo::Convert::Texinfo;
+use Texinfo::Document;
+use Texinfo::Structuring;
ok(1);
@@ -52,10 +53,10 @@ sub run_test($$$$)
}
}
- $document = Texinfo::Structuring::rebuild_document($document);
+ $document = Texinfo::Document::rebuild_document($document);
$tree_as_text = $document->tree();
- $tree_as_line = Texinfo::Structuring::rebuild_tree($tree_as_line);
+ $tree_as_line = Texinfo::Document::rebuild_tree($tree_as_line);
my $texi_result_as_text
= Texinfo::Convert::Texinfo::convert_to_texinfo($tree_as_text);
diff --git a/tp/t/reference_to_text_in_tree.t b/tp/t/reference_to_text_in_tree.t
index 83fabe763b..c56080aab1 100644
--- a/tp/t/reference_to_text_in_tree.t
+++ b/tp/t/reference_to_text_in_tree.t
@@ -8,9 +8,10 @@ use Test::More;
BEGIN { plan tests => 3; }
use Texinfo::Parser;
-use Texinfo::Transformations;
-use Texinfo::Structuring;
use Texinfo::Convert::Texinfo;
+use Texinfo::Document;
+use Texinfo::Structuring;
+use Texinfo::Transformations;
ok(1);
@@ -25,7 +26,7 @@ sub run_test($$$)
my $tree = $document->tree();
Texinfo::Transformations::reference_to_arg_in_tree($tree);
- $tree = Texinfo::Structuring::rebuild_tree($tree);
+ $tree = Texinfo::Document::rebuild_tree($tree);
my $texi_result = Texinfo::Convert::Texinfo::convert_to_texinfo($tree);
diff --git a/tp/t/test_fill_gaps_in_sectioning.t
b/tp/t/test_fill_gaps_in_sectioning.t
index d89537e670..66279eefa1 100644
--- a/tp/t/test_fill_gaps_in_sectioning.t
+++ b/tp/t/test_fill_gaps_in_sectioning.t
@@ -9,8 +9,9 @@ BEGIN { plan tests => 6; }
use Texinfo::Transformations;
use Texinfo::Parser qw(parse_texi_text);
-use Texinfo::Structuring;
use Texinfo::Convert::Texinfo;
+use Texinfo::Document;
+use Texinfo::Structuring;
ok(1, "modules loading");
@@ -42,7 +43,7 @@ sub test_correction($$$;$)
$test_correct_level);
}
- $tree = Texinfo::Structuring::rebuild_tree($tree);
+ $tree = Texinfo::Document::rebuild_tree($tree);
{
local $Data::Dumper::Purity = 1;
#local $Data::Dumper::Maxdepth = 2;
diff --git a/tp/t/test_protect_contents.t b/tp/t/test_protect_contents.t
index 90d283eeea..2d9ac5c237 100644
--- a/tp/t/test_protect_contents.t
+++ b/tp/t/test_protect_contents.t
@@ -9,9 +9,10 @@ BEGIN { plan tests => 2; }
use Texinfo::Parser qw(parse_texi_line parse_texi_piece);
use Texinfo::Common qw(protect_first_parenthesis);
+use Texinfo::Convert::Texinfo;
+use Texinfo::Document;
use Texinfo::Structuring;
use Texinfo::Transformations;
-use Texinfo::Convert::Texinfo;
ok(1);
@@ -29,7 +30,7 @@ sub run_test($$$$)
if ($do->{'protect_first_parenthesis'}) {
Texinfo::Transformations::protect_first_parenthesis_in_targets($tree);
- $tree = Texinfo::Structuring::rebuild_tree($tree);
+ $tree = Texinfo::Document::rebuild_tree($tree);
$texi_result
= Texinfo::Convert::Texinfo::convert_to_texinfo($tree);
diff --git a/tp/t/test_protect_hashchar_at_line_beginning.t
b/tp/t/test_protect_hashchar_at_line_beginning.t
index bb3754504d..98bccda873 100644
--- a/tp/t/test_protect_hashchar_at_line_beginning.t
+++ b/tp/t/test_protect_hashchar_at_line_beginning.t
@@ -9,8 +9,9 @@ BEGIN { plan tests => 9; }
use Texinfo::Parser;
use Texinfo::Transformations;
-use Texinfo::Structuring;
+use Texinfo::Document;
use Texinfo::Convert::Texinfo;
+use Texinfo::Structuring;
use Data::Dumper;
@@ -44,7 +45,7 @@ sub run_test($$$;$)
Texinfo::Transformations::protect_hashchar_at_line_beginning($tree,
$registrar, $parser);
- $document = Texinfo::Structuring::rebuild_document($document);
+ $document = Texinfo::Document::rebuild_document($document);
$corrected_tree = $document->tree();
if ($with_XS) {
diff --git a/tp/t/test_tree_copy.t b/tp/t/test_tree_copy.t
index 74376c898f..72cc68298c 100644
--- a/tp/t/test_tree_copy.t
+++ b/tp/t/test_tree_copy.t
@@ -14,8 +14,9 @@ use File::Spec;
use Texinfo::Common;
use Texinfo::Parser;
-use Texinfo::Structuring;
use Texinfo::Convert::Texinfo;
+use Texinfo::Document;
+use Texinfo::Structuring;
my $srcdir = $ENV{'srcdir'};
if (defined($srcdir)) {
@@ -150,7 +151,7 @@ is ($texi_copy, $texi_tree, "tree and copy to texi match");
Texinfo::Structuring::sectioning_structure($tree, $test_registrar,
$test_parser);
-$tree = Texinfo::Structuring::rebuild_tree($tree);
+$tree = Texinfo::Document::rebuild_tree($tree);
my $copy_with_sec = Texinfo::Common::copy_tree($tree);
diff --git a/tp/t/test_utils.pl b/tp/t/test_utils.pl
index f8b2ce2db4..79a1b5bd0f 100644
--- a/tp/t/test_utils.pl
+++ b/tp/t/test_utils.pl
@@ -65,6 +65,7 @@ use Texinfo::Convert::Texinfo;
use Texinfo::Config;
use Texinfo::Parser;
use Texinfo::Convert::Text;
+use Texinfo::Document;
use Texinfo::Structuring;
use Texinfo::Convert::PlainTexinfo;
use Texinfo::Translations;
@@ -1085,7 +1086,7 @@ sub test($$)
}
# could be in a if !$XS_structuring, but the function should not be
# overriden already in that case
- $document = Texinfo::Structuring::rebuild_document($document);
+ $document = Texinfo::Document::rebuild_document($document);
# should not actually be useful, as the same element should be reused.
$tree = $document->tree();
@@ -1093,7 +1094,7 @@ sub test($$)
foreach my $error (@{$document->{'errors'}}) {
$registrar->add_formatted_message($error);
}
- Texinfo::Structuring::clear_document_errors(
+ Texinfo::Document::clear_document_errors(
$document->document_descriptor());
}
diff --git a/tp/texi2any.pl b/tp/texi2any.pl
index b1d4d1cce0..6309fd2edc 100755
--- a/tp/texi2any.pl
+++ b/tp/texi2any.pl
@@ -1517,7 +1517,7 @@ while(@input_files) {
# no need to rebuild the tree here if convert_to_texinfo is XS code.
if (not (defined $ENV{TEXINFO_XS_CONVERT}
and $ENV{TEXINFO_XS_CONVERT} eq '1')) {
- $document = Texinfo::Structuring::rebuild_document($document);
+ $document = Texinfo::Document::rebuild_document($document);
$tree = $document->tree();
}
my $texinfo_text = Texinfo::Convert::Texinfo::convert_to_texinfo($tree);
@@ -1639,13 +1639,13 @@ while(@input_files) {
Texinfo::Structuring::number_floats($document);
}
- $document = Texinfo::Structuring::rebuild_document($document);
+ $document = Texinfo::Document::rebuild_document($document);
if ($XS_structuring) {
foreach my $error (@{$document->{'errors'}}) {
$registrar->add_formatted_message($error);
}
- Texinfo::Structuring::clear_document_errors(
+ Texinfo::Document::clear_document_errors(
$document->document_descriptor());
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/XS/main/DocumentXS.xs (rebuild_document, rebuild_tree) (remove_document_descriptor, remove_document, clear_document_errors) (set_document_options), tp/Makefile.am (dist_modules_DATA), tp/Texinfo/Document.pm (import, rebuild_document, rebuild_tree) (clear_document_errors), tp/Texinfo/XS/Makefile.am (DocumentXS_la_SOURCES): move rebuild_document, rebuild_tree, remove_document_descriptor, remove_document and clear_document_errors to a new XS associated to Texinfo::Document.,
Patrice Dumas <=