[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/Translations.pm (import), tp/Texinfo
From: |
Patrice Dumas |
Subject: |
branch master updated: * tp/Texinfo/Translations.pm (import), tp/Texinfo/XS/Makefile.am, tp/Texinfo/XS/main/DocumentXS.xs (translations_configure), tp/Texinfo/XS/main/TranslationsXS.xs: rename configure as translations_configure and move to DocumentXS.xs. Do not build TranslationsXS anymore. |
Date: |
Tue, 14 Nov 2023 06:55:35 -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 28cbff6a42 * tp/Texinfo/Translations.pm (import),
tp/Texinfo/XS/Makefile.am, tp/Texinfo/XS/main/DocumentXS.xs
(translations_configure), tp/Texinfo/XS/main/TranslationsXS.xs: rename
configure as translations_configure and move to DocumentXS.xs. Do not build
TranslationsXS anymore.
28cbff6a42 is described below
commit 28cbff6a42b34b0d40b6fab8f17d9ee73aef8827
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Tue Nov 14 12:55:25 2023 +0100
* tp/Texinfo/Translations.pm (import), tp/Texinfo/XS/Makefile.am,
tp/Texinfo/XS/main/DocumentXS.xs (translations_configure),
tp/Texinfo/XS/main/TranslationsXS.xs: rename configure as
translations_configure and move to DocumentXS.xs. Do not build
TranslationsXS anymore.
---
ChangeLog | 8 ++++++++
tp/Texinfo/Document.pm | 2 ++
tp/Texinfo/DocumentXS.pm | 4 ++--
tp/Texinfo/StructTransf.pm | 7 ++-----
tp/Texinfo/Translations.pm | 22 ++++++++++++++++------
tp/Texinfo/TranslationsXS.pm | 6 ++++--
tp/Texinfo/XS/Makefile.am | 29 ++++++++++++++++-------------
tp/Texinfo/XS/main/DocumentXS.xs | 8 ++++++++
tp/Texinfo/XS/main/TranslationsXS.xs | 8 --------
tp/Texinfo/XS/main/translations.c | 2 +-
tp/Texinfo/XS/main/translations.h | 4 ++--
11 files changed, 61 insertions(+), 39 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 05088870ca..4174d81c45 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2023-11-14 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/Translations.pm (import), tp/Texinfo/XS/Makefile.am,
+ tp/Texinfo/XS/main/DocumentXS.xs (translations_configure),
+ tp/Texinfo/XS/main/TranslationsXS.xs: rename configure as
+ translations_configure and move to DocumentXS.xs. Do not build
+ TranslationsXS anymore.
+
2023-11-14 Patrice Dumas <pertusus@free.fr>
* Pod-Simple-Texinfo/lib/Pod/Simple/Texinfo.pm,
diff --git a/tp/Texinfo/Document.pm b/tp/Texinfo/Document.pm
index ac80b7abf0..ae9d9b8cc9 100644
--- a/tp/Texinfo/Document.pm
+++ b/tp/Texinfo/Document.pm
@@ -28,6 +28,8 @@ use warnings;
use Texinfo::DocumentXS;
+use Texinfo::XSLoader;
+
use Texinfo::Common;
our $module_loaded = 0;
diff --git a/tp/Texinfo/DocumentXS.pm b/tp/Texinfo/DocumentXS.pm
index 8b4c277bfb..b186a03b85 100644
--- a/tp/Texinfo/DocumentXS.pm
+++ b/tp/Texinfo/DocumentXS.pm
@@ -1,4 +1,4 @@
-# Document.pm: load parsed Texinfo tree document XS functions.
+# DocumentXS.pm: load parsed Texinfo tree document XS functions.
#
# Copyright 2010-2023 Free Software Foundation, Inc.
#
@@ -15,7 +15,7 @@
# 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;
+package Texinfo::DocumentXS;
use strict;
use warnings;
diff --git a/tp/Texinfo/StructTransf.pm b/tp/Texinfo/StructTransf.pm
index 193aae65e7..07d6b87fb6 100644
--- a/tp/Texinfo/StructTransf.pm
+++ b/tp/Texinfo/StructTransf.pm
@@ -1,3 +1,4 @@
+# StructTransf.pm: load structuring and tree transformation XS
# Copyright 2023 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
@@ -13,12 +14,8 @@
# 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::Convert::ConvertXS;
+package Texinfo::StructTransf;
-# This package loads XS implementations of converter functions.
-
-# same as texi2any.pl
-use 5.00405;
use strict;
use warnings;
diff --git a/tp/Texinfo/Translations.pm b/tp/Texinfo/Translations.pm
index 999fe4776a..f9329499c0 100644
--- a/tp/Texinfo/Translations.pm
+++ b/tp/Texinfo/Translations.pm
@@ -40,7 +40,7 @@ use Locale::Messages;
# to load a parser
use Texinfo::Parser;
-use Texinfo::TranslationsXS;
+use Texinfo::DocumentXS;
# we want a reliable way to switch locale for the document
# strings translations so we don't use the system gettext.
@@ -51,7 +51,7 @@ sub import {
if (!$module_loaded) {
Texinfo::XSLoader::override(
"Texinfo::Translations::_XS_configure",
- "Texinfo::TranslationsXS::configure");
+ "Texinfo::DocumentXS::translations_configure");
# Example of how gdt could be overriden. Not used because
# the approach is flawed as there won't be any substitution if the trees in
# $replaced_substrings are not registered in C data, as is the case in
@@ -288,6 +288,8 @@ sub translate_string($$;$$)
return $translated_string;
}
+# Get document translation - handle translations of in-document strings.
+# Return a parsed Texinfo tree
sub gdt($$;$$$)
{
my ($customization_information, $string, $replaced_substrings,
@@ -311,18 +313,24 @@ sub gdt($$;$$$)
return $result_tree;
}
+# Get document translation - handle translations of in-document strings.
+# In general for already converted strings that do not need to go through
+# a Texinfo tree.
sub gdt_string($$;$$$)
{
my ($customization_information, $string, $replaced_substrings,
$translation_context, $lang) = @_;
- # allows to redefine translate_string, as done in the HTML converter. Cannot
- # directly call translate_string on $customization_information, as it may not
- # provide the method if it does not inherit from Texinfo::Translations, as is
- # the case for Texinfo::Parser.
+ # Following code allows to redefine translate_string, as done in the HTML
+ # converter. We check with can() explicitely instead of letting inheritance
+ # rules determine which method to call (which would be achieved with
+ # $customization_information->translate_string) because
+ # $customization_information may not provide the method if it does not
+ # inherit from Texinfo::Translations, as is the case for Texinfo::Parser.
my $translate_string_method
= $customization_information->can('translate_string');
$translate_string_method = \&translate_string if (!$translate_string_method);
+
my $translated_string = &$translate_string_method($customization_information,
$string, $translation_context, $lang);
@@ -452,6 +460,8 @@ sub _substitute($$) {
return $tree;
}
+# Same as gdt but with mandatory translation context, used for marking
+# of strings with translation contexts
sub pgdt($$$;$$)
{
my ($customization_information, $translation_context, $string,
diff --git a/tp/Texinfo/TranslationsXS.pm b/tp/Texinfo/TranslationsXS.pm
index 5d901b241f..e380243d50 100644
--- a/tp/Texinfo/TranslationsXS.pm
+++ b/tp/Texinfo/TranslationsXS.pm
@@ -1,4 +1,4 @@
-# Translations.pm: translate strings.
+# TranslationsXS.pm: load string document related XS functions.
#
# Copyright 2010-2023 Free Software Foundation, Inc.
#
@@ -15,7 +15,9 @@
# 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::Translations;
+# currently unused
+
+package Texinfo::TranslationXS;
use strict;
use warnings;
diff --git a/tp/Texinfo/XS/Makefile.am b/tp/Texinfo/XS/Makefile.am
index d4b3169beb..6d91f121f4 100644
--- a/tp/Texinfo/XS/Makefile.am
+++ b/tp/Texinfo/XS/Makefile.am
@@ -338,20 +338,23 @@ DocumentXS_la_LDFLAGS = $(AM_LDFLAGS) $(XSLIBS_LDFLAGS)
########################## Translations XS
-if HAVE_ICONV
-xs_LTLIBRARIES += TranslationsXS.la
-endif
-
-TranslationsXS_la_SOURCES = \
- main/TranslationsXS.c
-
-EXTRA_DIST += main/TranslationsXS.xs
+# Not used for now as replaced_substrings
+# perl element tree cannot be retrieved in C stored documents.
-# locate include files under out-of-source builds.
-TranslationsXS_la_CPPFLAGS = -I$(srcdir)/main $(AM_CPPFLAGS) $(XSLIBS_CPPFLAGS)
-TranslationsXS_la_CFLAGS = $(XSLIBS_CFLAGS)
-TranslationsXS_la_LIBADD = libtexinfoxs.la libtexinfo.la
-TranslationsXS_la_LDFLAGS = $(AM_LDFLAGS) $(XSLIBS_LDFLAGS)
+#if HAVE_ICONV
+#xs_LTLIBRARIES += TranslationsXS.la
+#endif
+#
+#TranslationsXS_la_SOURCES = \
+# main/TranslationsXS.c
+#
+#EXTRA_DIST += main/TranslationsXS.xs
+#
+## locate include files under out-of-source builds.
+#TranslationsXS_la_CPPFLAGS = -I$(srcdir)/main $(AM_CPPFLAGS)
$(XSLIBS_CPPFLAGS)
+#TranslationsXS_la_CFLAGS = $(XSLIBS_CFLAGS)
+#TranslationsXS_la_LIBADD = libtexinfoxs.la libtexinfo.la
+#TranslationsXS_la_LDFLAGS = $(AM_LDFLAGS) $(XSLIBS_LDFLAGS)
########################## StructuringTransfo XS
diff --git a/tp/Texinfo/XS/main/DocumentXS.xs b/tp/Texinfo/XS/main/DocumentXS.xs
index 4a24e51f53..ad5c087862 100644
--- a/tp/Texinfo/XS/main/DocumentXS.xs
+++ b/tp/Texinfo/XS/main/DocumentXS.xs
@@ -34,6 +34,7 @@
#include "tree_types.h"
#include "document_types.h"
#include "document.h"
+#include "translations.h"
#include "get_perl_info.h"
#include "build_perl_info.h"
@@ -41,6 +42,13 @@ MODULE = Texinfo::DocumentXS PACKAGE =
Texinfo::DocumentXS
PROTOTYPES: ENABLE
+void
+translations_configure (localesdir, strings_textdomain="texinfo_document")
+ char *localesdir = (char *)SvPVbyte_nolen($arg);
+ char *strings_textdomain;
+ CODE:
+ translations_configure (localesdir, strings_textdomain);
+
SV *
rebuild_document (SV *document_in, ...)
PROTOTYPE: $;$
diff --git a/tp/Texinfo/XS/main/TranslationsXS.xs
b/tp/Texinfo/XS/main/TranslationsXS.xs
index 789c210a0b..c74c87ed0d 100644
--- a/tp/Texinfo/XS/main/TranslationsXS.xs
+++ b/tp/Texinfo/XS/main/TranslationsXS.xs
@@ -40,14 +40,6 @@ MODULE = Texinfo::TranslationsXS PACKAGE =
Texinfo::TranslationsXS
PROTOTYPES: ENABLE
-void
-configure (localesdir, strings_textdomain="texinfo_document")
- char *localesdir = (char *)SvPVbyte_nolen($arg);
- char *strings_textdomain;
- CODE:
- configure (localesdir, strings_textdomain);
-
-
# TODO not sure that the options_in argument is good to be
# copy_sv_options argument, may need to retrieve a converter
# first or Parser configuration. Does not matter much as
diff --git a/tp/Texinfo/XS/main/translations.c
b/tp/Texinfo/XS/main/translations.c
index 6500d17f27..bc9707b1d9 100644
--- a/tp/Texinfo/XS/main/translations.c
+++ b/tp/Texinfo/XS/main/translations.c
@@ -55,7 +55,7 @@ static char *locale_command = 0;
static char *strings_textdomain = "texinfo_document";
void
-configure (char *localesdir, char *strings_textdomain_in)
+translations_configure (char *localesdir, char *strings_textdomain_in)
{
char *textdomain_directory;
if (strings_textdomain_in)
diff --git a/tp/Texinfo/XS/main/translations.h
b/tp/Texinfo/XS/main/translations.h
index 7f906566be..9dc0d150e0 100644
--- a/tp/Texinfo/XS/main/translations.h
+++ b/tp/Texinfo/XS/main/translations.h
@@ -21,6 +21,8 @@ typedef struct NAMED_STRING_ELEMENT_LIST {
NAMED_STRING_ELEMENT *list;
} NAMED_STRING_ELEMENT_LIST;
+void translations_configure (char *localesdir, char *strings_textdomain_in);
+
char *translate_string (OPTIONS *options, const char * string,
const char *translation_context, const char *in_lang);
int replace_convert_substrings (char *translated_string,
@@ -54,6 +56,4 @@ void add_element_to_named_string_element_list
(NAMED_STRING_ELEMENT_LIST *nsel,
char *name, ELEMENT *element);
void destroy_named_string_element_list (NAMED_STRING_ELEMENT_LIST *nsel);
-void configure (char *localesdir, char *strings_textdomain_in);
-
#endif
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/Translations.pm (import), tp/Texinfo/XS/Makefile.am, tp/Texinfo/XS/main/DocumentXS.xs (translations_configure), tp/Texinfo/XS/main/TranslationsXS.xs: rename configure as translations_configure and move to DocumentXS.xs. Do not build TranslationsXS anymore.,
Patrice Dumas <=
- Prev by Date:
branch master updated: * Pod-Simple-Texinfo/lib/Pod/Simple/Texinfo.pm, Pod-Simple-Texinfo/pod2texi.pl: update for the move of functions to Texinfo::Document.
- Next by Date:
branch master updated: * tp/Texinfo/command_data.txt (item_LINE, itemx, defblock, defline, deftypeline): Remove contain_basic_inline flag. There is no reason an @anchor should not occur inside @item, inside @table, or the other commands, as no index entry is being created with the @anchor.
- Previous by thread:
branch master updated: * Pod-Simple-Texinfo/lib/Pod/Simple/Texinfo.pm, Pod-Simple-Texinfo/pod2texi.pl: update for the move of functions to Texinfo::Document.
- Next by thread:
branch master updated: * tp/Texinfo/command_data.txt (item_LINE, itemx, defblock, defline, deftypeline): Remove contain_basic_inline flag. There is no reason an @anchor should not occur inside @item, inside @table, or the other commands, as no index entry is being created with the @anchor.
- Index(es):