[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
From: |
Patrice Dumas |
Date: |
Sat, 9 Mar 2024 17:52:48 -0500 (EST) |
branch: master
commit 3d37341099fb27dfdd9a2775bd7a3faaab12f8df
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sat Mar 9 23:52:43 2024 +0100
* tp/Texinfo/XS/main/build_perl_info.c (element_to_perl_hash): store
associated_unit in element.
* tp/Texinfo/XS/main/document.c (register_document_sections_list):
fix document->modified_information flag used.
* tp/Texinfo/Document.pm (labels_list), tp/Texinfo/Convert/HTML.pm
(_set_root_commands_targets_node_files): add an interface for Document
'labels_list'.
* tp/Texinfo/XS/main/DocumentXS.xs (document_tree): no warning if
XS document is not found.
* tp/Texinfo/XS/main/DocumentXS.xs (document_tree),
tp/Texinfo/XS/main/build_perl_info.c (store_texinfo_tree): split
store_texinfo_tree out of document_tree to be able to call
build_texinfo_tree if needed.
* tp/Texinfo/Document.pm (%XS_structure_overrides),
tp/Texinfo/XS/main/DocumentXS.xs (document_global_information)
(document_indices_information, document_global_commands_information)
(document_labels_information, document_nodes_list)
(document_sections_list, document_floats_information)
(document_internal_references_information, document_labels_list),
tp/Texinfo/XS/main/build_perl_info.c (BUILD_PERL_DOCUMENT_ITEM)
(BUILD_PERL_DOCUMENT_LIST, document_global_information): add an XS
override for document accessors.
* tp/Texinfo/XS/convert/ConvertXS.xs
(get_converter_indices_sorted_by_index)
(get_converter_indices_sorted_by_letter),
tp/Texinfo/XS/main/DocumentXS.xs (indices_sort_strings): get index
entries by calling document_indices_information.
---
ChangeLog | 36 +++++++
tp/Texinfo/Convert/HTML.pm | 8 +-
tp/Texinfo/Document.pm | 32 +++++-
tp/Texinfo/XS/convert/ConvertXS.xs | 22 ++---
tp/Texinfo/XS/main/DocumentXS.xs | 63 +++++++-----
tp/Texinfo/XS/main/build_perl_info.c | 185 +++++++++++++++++++++++++++++++++++
tp/Texinfo/XS/main/build_perl_info.h | 14 +++
tp/Texinfo/XS/main/document.c | 2 +-
tp/t/test_utils.pl | 1 -
tp/texi2any.pl | 1 +
10 files changed, 320 insertions(+), 44 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 239343d04b..83e3e47cbb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,39 @@
+2024-03-09 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/XS/main/build_perl_info.c (element_to_perl_hash): store
+ associated_unit in element.
+
+ * tp/Texinfo/XS/main/document.c (register_document_sections_list):
+ fix document->modified_information flag used.
+
+ * tp/Texinfo/Document.pm (labels_list), tp/Texinfo/Convert/HTML.pm
+ (_set_root_commands_targets_node_files): add an interface for Document
+ 'labels_list'.
+
+ * tp/Texinfo/XS/main/DocumentXS.xs (document_tree): no warning if
+ XS document is not found.
+
+ * tp/Texinfo/XS/main/DocumentXS.xs (document_tree),
+ tp/Texinfo/XS/main/build_perl_info.c (store_texinfo_tree): split
+ store_texinfo_tree out of document_tree to be able to call
+ build_texinfo_tree if needed.
+
+ * tp/Texinfo/Document.pm (%XS_structure_overrides),
+ tp/Texinfo/XS/main/DocumentXS.xs (document_global_information)
+ (document_indices_information, document_global_commands_information)
+ (document_labels_information, document_nodes_list)
+ (document_sections_list, document_floats_information)
+ (document_internal_references_information, document_labels_list),
+ tp/Texinfo/XS/main/build_perl_info.c (BUILD_PERL_DOCUMENT_ITEM)
+ (BUILD_PERL_DOCUMENT_LIST, document_global_information): add an XS
+ override for document accessors.
+
+ * tp/Texinfo/XS/convert/ConvertXS.xs
+ (get_converter_indices_sorted_by_index)
+ (get_converter_indices_sorted_by_letter),
+ tp/Texinfo/XS/main/DocumentXS.xs (indices_sort_strings): get index
+ entries by calling document_indices_information.
+
2024-03-09 Patrice Dumas <pertusus@free.fr>
XS override for Texinfo::Document tree
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index c2c6cbf365..686a63d867 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -9484,19 +9484,19 @@ sub _set_root_commands_targets_node_files($)
my $self = shift;
my $sections_list;
- my $identifiers_target;
+ my $labels_list;
if ($self->{'document'}) {
$sections_list = $self->{'document'}->sections_list();
- $identifiers_target = $self->{'document'}->labels_information();
+ $labels_list = $self->{'document'}->labels_list();
}
- if ($identifiers_target) {
+ if ($labels_list) {
my $extension = '';
$extension = '.'.$self->get_conf('EXTENSION')
if (defined($self->get_conf('EXTENSION'))
and $self->get_conf('EXTENSION') ne '');
- foreach my $target_element (@{$self->{'document'}->{'labels_list'}}) {
+ foreach my $target_element (@$labels_list) {
next if (not $target_element->{'extra'}
or not $target_element->{'extra'}->{'is_target'});
my $label_element = Texinfo::Common::get_label_element($target_element);
diff --git a/tp/Texinfo/Document.pm b/tp/Texinfo/Document.pm
index 96f73165c2..05d503ae87 100644
--- a/tp/Texinfo/Document.pm
+++ b/tp/Texinfo/Document.pm
@@ -63,7 +63,25 @@ our %XS_structure_overrides = (
"Texinfo::Document::rebuild_tree"
=> "Texinfo::DocumentXS::rebuild_tree",
"Texinfo::Document::tree"
- => "Texinfo::DocumentXS::tree",
+ => "Texinfo::DocumentXS::document_tree",
+ "Texinfo::Document::global_information"
+ => "Texinfo::DocumentXS::document_global_information",
+ "Texinfo::Document::indices_information"
+ => "Texinfo::DocumentXS::document_indices_information",
+ "Texinfo::Document::global_commands_information"
+ => "Texinfo::DocumentXS::document_global_commands_information",
+ "Texinfo::Document::labels_information"
+ => "Texinfo::DocumentXS::document_labels_information",
+ "Texinfo::Document::labels_list"
+ => "Texinfo::DocumentXS::document_labels_list",
+ "Texinfo::Document::nodes_list"
+ => "Texinfo::DocumentXS::document_nodes_list",
+ "Texinfo::Document::sections_list"
+ => "Texinfo::DocumentXS::document_sections_list",
+ "Texinfo::Document::floats_information"
+ => "Texinfo::DocumentXS::document_floats_information",
+ "Texinfo::Document::internal_references_information"
+ => "Texinfo::DocumentXS::document_internal_references_information",
"Texinfo::Document::indices_sort_strings"
=> "Texinfo::DocumentXS::indices_sort_strings",
);
@@ -187,6 +205,12 @@ sub labels_information($)
return $self->{'identifiers_target'};
}
+sub labels_list($)
+{
+ my $self = shift;
+ return $self->{'labels_list'};
+}
+
sub nodes_list($)
{
my $self = shift;
@@ -581,6 +605,12 @@ X<C<labels_information>>
I<$identifier_target> is a hash reference whose keys are normalized
labels, and the associated value is the corresponding @-command.
+=item $labels_list = labels_list ($document)
+X<C<labels_list>>
+
+I<$labels_list> is a list of Texinfo tree command elements that
+could be the target of cross references.
+
=back
Information on C<@float> grouped by type of floats, each type corresponding
diff --git a/tp/Texinfo/XS/convert/ConvertXS.xs
b/tp/Texinfo/XS/convert/ConvertXS.xs
index 23c1f91dbd..15e52b818c 100644
--- a/tp/Texinfo/XS/convert/ConvertXS.xs
+++ b/tp/Texinfo/XS/convert/ConvertXS.xs
@@ -202,15 +202,14 @@ get_converter_indices_sorted_by_index (SV *converter_sv)
RETVAL = 0;
if (document_sv)
{
- SV **indices_information_sv;
- HV *document_hv = (HV *) SvRV (*document_sv);
- indices_information_sv
- = hv_fetch (document_hv, "indices", strlen ("indices"), 0);
+ SV *indices_information_sv
+ = document_indices_information (*document_sv);
- if (index_entries_by_index && indices_information_sv)
+ if (index_entries_by_index && indices_information_sv
+ && SvOK (indices_information_sv))
{
HV *indices_information_hv
- = (HV *) SvRV (*indices_information_sv);
+ = (HV *) SvRV (indices_information_sv);
HV *index_entries_by_index_hv
= build_sorted_indices_by_index (index_entries_by_index,
indices_information_hv);
@@ -243,15 +242,14 @@ get_converter_indices_sorted_by_letter (SV *converter_sv)
RETVAL = 0;
if (document_sv)
{
- SV **indices_information_sv;
- HV *document_hv = (HV *) SvRV (*document_sv);
- indices_information_sv
- = hv_fetch (document_hv, "indices", strlen ("indices"), 0);
+ SV *indices_information_sv
+ = document_indices_information (*document_sv);
- if (index_entries_by_letter && indices_information_sv)
+ if (index_entries_by_letter && indices_information_sv
+ && SvOK (indices_information_sv))
{
HV *indices_information_hv
- = (HV *) SvRV (*indices_information_sv);
+ = (HV *) SvRV (indices_information_sv);
HV *index_entries_by_letter_hv
= build_sorted_indices_by_letter (index_entries_by_letter,
indices_information_hv);
diff --git a/tp/Texinfo/XS/main/DocumentXS.xs b/tp/Texinfo/XS/main/DocumentXS.xs
index edff5e8b79..76f61ddfee 100644
--- a/tp/Texinfo/XS/main/DocumentXS.xs
+++ b/tp/Texinfo/XS/main/DocumentXS.xs
@@ -196,25 +196,18 @@ document_tree (SV *document_in, int handler_only=0)
if (!handler_only)
{
- DOCUMENT *document = get_sv_document_document (document_in,
- "document_tree");
+ DOCUMENT *document = get_sv_document_document (document_in, 0);
if (document)
{
- if (document->modified_information & F_DOCM_tree)
- {
- HV *hv_tree = build_texinfo_tree (document->tree, 0);
- result_sv = newRV_inc ((SV *) hv_tree);
- hv_store (document_hv, key, strlen (key), result_sv, 0);
- document->modified_information &= ~F_DOCM_tree;
- }
+ result_sv = store_texinfo_tree (document, document_hv);
}
}
if (!result_sv)
{
- SV **tree_sv = hv_fetch (document_hv, key, strlen (key), 0);
- if (tree_sv)
- result_sv = *tree_sv;
+ SV **sv_ref = hv_fetch (document_hv, key, strlen (key), 0);
+ if (sv_ref && SvOK (*sv_ref))
+ result_sv = *sv_ref;
}
if (result_sv)
@@ -227,6 +220,32 @@ document_tree (SV *document_in, int handler_only=0)
OUTPUT:
RETVAL
+SV *
+document_global_information (SV *document_in)
+
+SV *
+document_indices_information (SV *document_in)
+
+SV *
+document_global_commands_information (SV *document_in)
+
+SV *
+document_labels_information (SV *document_in)
+
+SV *
+document_nodes_list (SV *document_in)
+
+SV *
+document_sections_list (SV *document_in)
+
+SV *
+document_floats_information (SV *document_in)
+
+SV *
+document_internal_references_information (SV *document_in)
+
+SV *
+document_labels_list (SV *document_in)
# customization_information
SV *
@@ -235,7 +254,6 @@ indices_sort_strings (SV *document_in, ...)
PREINIT:
DOCUMENT *document = 0;
const INDICES_SORT_STRINGS *indices_sort_strings = 0;
- HV *document_hv;
SV *result_sv = 0;
const char *key = "index_entries_sort_strings";
CODE:
@@ -246,22 +264,19 @@ indices_sort_strings (SV *document_in, ...)
= document_indices_sort_strings (document, document->error_messages,
document->options);
- document_hv = (HV *) SvRV (document_in);
-
if (indices_sort_strings)
{
+ HV *document_hv = (HV *) SvRV (document_in);
/* build Perl data only if needed and cache the built Perl
data in the same hash as done in overriden Perl code */
if (document->modified_information & F_DOCM_indices_sort_strings)
{
- /* TODO maybe would be better to call $document->indices_information()
- or build_indices_information function to pass to Perl if needed */
- SV **indices_information_sv
- = hv_fetch (document_hv, "indices", strlen ("indices"), 0);
+ SV *indices_information_sv
+ = document_indices_information (document_in);
if (indices_information_sv)
{
HV *indices_information_hv
- = (HV *) SvRV (*indices_information_sv);
+ = (HV *) SvRV (indices_information_sv);
HV *indices_sort_strings_hv
= build_indices_sort_strings (indices_sort_strings,
indices_information_hv);
@@ -275,11 +290,9 @@ indices_sort_strings (SV *document_in, ...)
}
else
{ /* retrieve previously stored result */
- SV **index_entries_sort_strings_sv
- = hv_fetch (document_hv, key, strlen (key), 0);
- if (index_entries_sort_strings_sv
- && SvOK (*index_entries_sort_strings_sv))
- result_sv = *index_entries_sort_strings_sv;
+ SV **sv_ref = hv_fetch (document_hv, key, strlen (key), 0);
+ if (sv_ref && SvOK (*sv_ref))
+ result_sv = *sv_ref;
/* error out if not found? Or rebuild? */
}
}
diff --git a/tp/Texinfo/XS/main/build_perl_info.c
b/tp/Texinfo/XS/main/build_perl_info.c
index c196e08844..b45513ff9b 100644
--- a/tp/Texinfo/XS/main/build_perl_info.c
+++ b/tp/Texinfo/XS/main/build_perl_info.c
@@ -50,6 +50,7 @@
#include "output_unit.h"
/* for clear_error_message_list */
#include "errors.h"
+#include "get_perl_info.h"
#include "build_perl_info.h"
#define LOCALEDIR DATADIR "/locale"
@@ -675,6 +676,12 @@ element_to_perl_hash (ELEMENT *e, int avoid_recursion)
store_additional_info (e, &e->extra_info, "extra", avoid_recursion);
store_additional_info (e, &e->info_info, "info", avoid_recursion);
+ if (e->associated_unit)
+ {
+ hv_store (e->hv, "associated_unit", strlen ("associated_unit"),
+ newRV_inc ((SV *) e->associated_unit->hv), 0);
+ }
+
store_source_mark_list (e);
if (e->source_info.line_nr)
@@ -1549,6 +1556,184 @@ rebuild_document (SV *document_in, int no_store)
}
}
+SV *
+store_texinfo_tree (DOCUMENT *document, HV *document_hv)
+{
+ SV *result_sv = 0;
+ const char *key = "tree";
+
+ dTHX;
+
+ if (document->modified_information & F_DOCM_tree)
+ {
+ HV *result_hv = build_texinfo_tree (document->tree, 0);
+ hv_store (result_hv, "tree_document_descriptor",
+ strlen ("tree_document_descriptor"),
+ newSViv (document->descriptor), 0);
+ result_sv = newRV_inc ((SV *) result_hv);
+ hv_store (document_hv, key, strlen (key), result_sv, 0);
+ document->modified_information &= ~F_DOCM_tree;
+ }
+ return result_sv;
+}
+
+#define BUILD_PERL_DOCUMENT_ITEM(fieldname,keyname,funcname,buildname,HVAV) \
+SV * \
+document_##funcname (SV *document_in) \
+{ \
+ HV *document_hv; \
+ SV *result_sv = 0; \
+ const char *key = #keyname; \
+\
+ dTHX;\
+\
+ document_hv = (HV *) SvRV (document_in); \
+ DOCUMENT *document = get_sv_document_document (document_in, "document_"
#funcname); \
+\
+ if (document && document->fieldname)\
+ {\
+ store_texinfo_tree (document, document_hv);\
+ if (document->modified_information & F_DOCM_##fieldname)\
+ {\
+ HVAV *result_av_hv = buildname (document->fieldname);\
+ result_sv = newRV_inc ((SV *) result_av_hv);\
+ hv_store (document_hv, key, strlen (key), result_sv, 0);\
+ document->modified_information &= ~F_DOCM_##fieldname;\
+ }\
+ }\
+\
+ if (!result_sv)\
+ {\
+ SV **sv_ref = hv_fetch (document_hv, key, strlen (key), 0);\
+ if (sv_ref && SvOK (*sv_ref))\
+ result_sv = *sv_ref;\
+ }\
+\
+ if (result_sv)\
+ {\
+ SvREFCNT_inc (result_sv);\
+ }\
+ else\
+ result_sv = newSV (0);\
+\
+ return result_sv;\
+}
+
+/*
+BUILD_PERL_DOCUMENT_ITEM(fieldname,keyname,funcname,buildname,HVAV)
+ */
+
+BUILD_PERL_DOCUMENT_ITEM(index_names,indices,indices_information,build_index_data,HV)
+
+BUILD_PERL_DOCUMENT_ITEM(global_commands,commands_info,global_commands_information,build_global_commands,HV)
+
+BUILD_PERL_DOCUMENT_ITEM(identifiers_target,identifiers_target,labels_information,build_identifiers_target,HV)
+
+BUILD_PERL_DOCUMENT_ITEM(nodes_list,nodes_list,nodes_list,build_elements_list,AV)
+
+BUILD_PERL_DOCUMENT_ITEM(sections_list,sections_list,sections_list,build_elements_list,AV)
+
+#undef BUILD_PERL_DOCUMENT_ITEM
+
+#define BUILD_PERL_DOCUMENT_LIST(fieldname,keyname,funcname,buildname,HVAV) \
+SV * \
+document_##funcname (SV *document_in) \
+{ \
+ HV *document_hv; \
+ SV *result_sv = 0; \
+ const char *key = #keyname; \
+\
+ dTHX;\
+\
+ document_hv = (HV *) SvRV (document_in); \
+ DOCUMENT *document = get_sv_document_document (document_in, "document_"
#funcname); \
+\
+ if (document && document->fieldname)\
+ {\
+ store_texinfo_tree (document, document_hv);\
+ if (document->modified_information & F_DOCM_##fieldname)\
+ {\
+ HVAV *result_av_hv = buildname (document->fieldname->list,\
+ document->fieldname->number);\
+ result_sv = newRV_inc ((SV *) result_av_hv);\
+ hv_store (document_hv, key, strlen (key), result_sv, 0);\
+ document->modified_information &= ~F_DOCM_##fieldname;\
+ }\
+ }\
+\
+ if (!result_sv)\
+ {\
+ SV **sv_ref = hv_fetch (document_hv, key, strlen (key), 0);\
+ if (sv_ref && SvOK (*sv_ref))\
+ result_sv = *sv_ref;\
+ }\
+\
+ if (result_sv)\
+ {\
+ SvREFCNT_inc (result_sv);\
+ }\
+ else\
+ result_sv = newSV (0);\
+\
+ return result_sv;\
+}
+
+/*
+BUILD_PERL_DOCUMENT_LIST(fieldname,keyname,funcname,buildname,HVAV)
+*/
+
+BUILD_PERL_DOCUMENT_LIST(floats,listoffloats_list,floats_information,build_float_types_list,HV)
+
+BUILD_PERL_DOCUMENT_LIST(internal_references,internal_references,internal_references_information,build_internal_xref_list,AV)
+
+BUILD_PERL_DOCUMENT_LIST(labels_list,labels_list,labels_list,build_target_elements_list,AV)
+
+#undef BUILD_PERL_DOCUMENT_LIST
+
+SV *
+document_global_information (SV *document_in)
+{
+ HV *document_hv;
+ SV *result_sv = 0;
+ const char *key = "global_info";
+
+ dTHX;
+
+ document_hv = (HV *) SvRV (document_in);
+
+ DOCUMENT *document = get_sv_document_document (document_in,
+ "document_global_information");
+ if (document)
+ {
+ store_texinfo_tree (document, document_hv);
+ if (document->modified_information & F_DOCM_global_info)
+ {
+ HV *result_hv = build_global_info (document->global_info,
+ document->global_commands);
+ build_global_info_tree_info (result_hv, document->global_info);
+ result_sv = newRV_inc ((SV *) result_hv);
+ hv_store (document_hv, key, strlen (key), result_sv, 0);
+ document->modified_information &= ~F_DOCM_global_info;
+ }
+ }
+
+ if (!result_sv)
+ {
+ SV **sv_ref = hv_fetch (document_hv, key, strlen (key), 0);
+ if (sv_ref && SvOK (*sv_ref))
+ result_sv = *sv_ref;
+ }
+
+ if (result_sv)
+ {
+ SvREFCNT_inc (result_sv);
+ }
+ else
+ result_sv = newSV (0);
+
+ return result_sv;
+}
+
static void
diff --git a/tp/Texinfo/XS/main/build_perl_info.h
b/tp/Texinfo/XS/main/build_perl_info.h
index e857d6d579..80d881513f 100644
--- a/tp/Texinfo/XS/main/build_perl_info.h
+++ b/tp/Texinfo/XS/main/build_perl_info.h
@@ -35,6 +35,7 @@ SV *get_document (size_t document_descriptor);
void rebuild_document (SV *document_in, int no_store);
HV *build_texinfo_tree (ELEMENT *root, int avoid_recursion);
+SV *store_texinfo_tree (DOCUMENT *document, HV *document_hv);
AV *build_errors (ERROR_MESSAGE* error_list, size_t error_number);
AV *build_target_elements_list (LABEL *labels_list,
size_t labels_number);
@@ -45,8 +46,21 @@ HV *build_float_list (FLOAT_RECORD *floats_list, size_t
floats_number);
HV *build_index_data (INDEX **index_names_in);
HV *build_global_info (GLOBAL_INFO *global_info_ref,
GLOBAL_COMMANDS *global_commands_ref);
+void build_global_info_tree_info (HV *hv, GLOBAL_INFO *global_info_ref);
HV *build_global_commands (GLOBAL_COMMANDS *global_commands_ref);
+SV *document_indices_information (SV *document_in);
+SV *document_global_commands_information (SV *document_in);
+SV *document_labels_information (SV *document_in);
+SV *document_nodes_list (SV *document_in);
+SV *document_sections_list (SV *document_in);
+
+SV *document_floats_information (SV *document_in);
+SV *document_internal_references_information (SV *document_in);
+SV *document_labels_list (SV *document_in);
+
+SV *document_global_information (SV *document_in);
+
void pass_document_parser_errors_to_registrar (int document_descriptor,
SV *parser_sv);
SV *pass_errors_to_registrar (ERROR_MESSAGE_LIST *error_messages,
diff --git a/tp/Texinfo/XS/main/document.c b/tp/Texinfo/XS/main/document.c
index 04965824a8..ad3a6add95 100644
--- a/tp/Texinfo/XS/main/document.c
+++ b/tp/Texinfo/XS/main/document.c
@@ -134,7 +134,7 @@ register_document_sections_list (DOCUMENT *document,
ELEMENT_LIST *sections_list)
{
document->sections_list = sections_list;
- document->modified_information |= F_DOCM_nodes_list;
+ document->modified_information |= F_DOCM_sections_list;
}
void
diff --git a/tp/t/test_utils.pl b/tp/t/test_utils.pl
index 35a572c7ea..f0bc2afb99 100644
--- a/tp/t/test_utils.pl
+++ b/tp/t/test_utils.pl
@@ -1134,7 +1134,6 @@ sub test($$)
# could be in a if !$XS_structuring, but the function should not be
# overriden already in that case
Texinfo::Document::rebuild_document($document);
- # should not actually be useful, as the same element should be reused.
$tree = $document->tree();
my $indices_information = $document->indices_information();
diff --git a/tp/texi2any.pl b/tp/texi2any.pl
index 5d9225b29f..448ae6e0d6 100755
--- a/tp/texi2any.pl
+++ b/tp/texi2any.pl
@@ -1675,6 +1675,7 @@ while(@input_files) {
Texinfo::Structuring::number_floats($document);
}
+ # do it now to get error messages here
if ($formats_table{$converted_format}->{'setup_index_entries_sort_strings'})
{
Texinfo::Document::indices_sort_strings($document, $main_configuration);
}