[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
From: |
Patrice Dumas |
Date: |
Sat, 5 Oct 2024 05:22:32 -0400 (EDT) |
branch: master
commit 53385647e5b052f6f6ee677060bfae83fac4b65e
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sat Aug 24 23:40:02 2024 +0200
* tp/Texinfo/Convert/Converter.pm (%common_converters_defaults),
tp/Texinfo/Convert/DocBook.pm (%defaults), tp/Texinfo/Convert/HTML.pm
(%defaults), tp/Texinfo/Convert/IXINSXML.pm (%defaults)
(converter_initialize), tp/Texinfo/Convert/LaTeX.pm (%defaults),
tp/Texinfo/Convert/Plaintext.pm (%defaults),
tp/Texinfo/Convert/TexinfoSXML.pm (%defaults),
tp/Texinfo/Convert/TexinfoXML.pm (%defaults),
tp/Texinfo/XS/convert/converter.c (apply_converter_info)
(destroy_converter_initialization_info)
(copy_converter_initialization_info, free_generic_converter),
tp/Texinfo/XS/convert/get_converter_perl_info.c
(get_converter_info_from_sv),
tp/Texinfo/XS/convert/html_converter_init_options.c
(html_converter_defaults), tp/Texinfo/XS/main/build_perl_info.c
(pass_generic_converter_to_converter_sv),
tp/Texinfo/XS/main/converter_types.h (CONVERTER_INITIALIZATION_INFO)
(CONVERTER): remove 'converted_format' from converters defaults. It
should never give a different information than the module name.
Remove the similar information in C too.
* tp/t/test_converter_option.t: remove tests related to
converted_format.
---
ChangeLog | 25 ++++++++++++++++++++++
tp/Texinfo/Convert/Converter.pm | 14 ++++--------
tp/Texinfo/Convert/DocBook.pm | 3 ---
tp/Texinfo/Convert/HTML.pm | 3 ---
tp/Texinfo/Convert/IXINSXML.pm | 19 ++--------------
tp/Texinfo/Convert/LaTeX.pm | 3 ---
tp/Texinfo/Convert/Plaintext.pm | 3 ---
tp/Texinfo/Convert/TexinfoSXML.pm | 3 ---
tp/Texinfo/Convert/TexinfoXML.pm | 3 ---
tp/Texinfo/XS/convert/converter.c | 15 +------------
tp/Texinfo/XS/convert/get_converter_perl_info.c | 3 ---
.../XS/convert/html_converter_init_options.c | 2 --
tp/Texinfo/XS/main/build_perl_info.c | 3 ---
tp/Texinfo/XS/main/converter_types.h | 5 ++---
tp/t/test_converter_option.t | 11 +---------
tp/t/test_utils.pl | 4 +---
tp/texi2any.pl | 7 ------
17 files changed, 36 insertions(+), 90 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 5a8791f9dc..b23bc299f1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,28 @@
+2024-08-24 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/Convert/Converter.pm (%common_converters_defaults),
+ tp/Texinfo/Convert/DocBook.pm (%defaults), tp/Texinfo/Convert/HTML.pm
+ (%defaults), tp/Texinfo/Convert/IXINSXML.pm (%defaults)
+ (converter_initialize), tp/Texinfo/Convert/LaTeX.pm (%defaults),
+ tp/Texinfo/Convert/Plaintext.pm (%defaults),
+ tp/Texinfo/Convert/TexinfoSXML.pm (%defaults),
+ tp/Texinfo/Convert/TexinfoXML.pm (%defaults),
+ tp/Texinfo/XS/convert/converter.c (apply_converter_info)
+ (destroy_converter_initialization_info)
+ (copy_converter_initialization_info, free_generic_converter),
+ tp/Texinfo/XS/convert/get_converter_perl_info.c
+ (get_converter_info_from_sv),
+ tp/Texinfo/XS/convert/html_converter_init_options.c
+ (html_converter_defaults), tp/Texinfo/XS/main/build_perl_info.c
+ (pass_generic_converter_to_converter_sv),
+ tp/Texinfo/XS/main/converter_types.h (CONVERTER_INITIALIZATION_INFO)
+ (CONVERTER): remove 'converted_format' from converters defaults. It
+ should never give a different information than the module name.
+ Remove the similar information in C too.
+
+ * tp/t/test_converter_option.t: remove tests related to
+ converted_format.
+
2024-08-24 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/XS/convert/converter.c (set_converter_init_information):
diff --git a/tp/Texinfo/Convert/Converter.pm b/tp/Texinfo/Convert/Converter.pm
index d68555db15..6ce4b5a608 100644
--- a/tp/Texinfo/Convert/Converter.pm
+++ b/tp/Texinfo/Convert/Converter.pm
@@ -140,15 +140,10 @@ my $common_defaults =
Texinfo::Options::get_converter_regular_options('common');
# but is available directly in the converter as a hash key.
# FIXME separate the two types of information and check that those
# items are not valid customization options?
-# NOTE converters for now do not add more, set converted_format, and,
-# rarely, output_format. It would be good to keep it that way and add
-# customization options instead.
+# NOTE converters for now do not add more and set, rarely, output_format.
+# It would be good to keep it that way and add customization options instead.
my %common_converters_defaults = (
# Following are set in the main program
- 'converted_format' => undef, # also in converter defaults, but
- # in general set by the caller
- # can be different from the converted_format, for example, epub3
- # output format converted format is html.
'output_format' => undef,
'deprecated_config_directories' => undef,
@@ -548,7 +543,6 @@ sub get_conf($$)
if (!Texinfo::Common::valid_customization_option($conf)) {
confess("CBUG: unknown option $conf\n");
- #return undef;
}
return $self->{'conf'}->{$conf};
@@ -562,7 +556,6 @@ sub set_conf($$$)
if (!Texinfo::Common::valid_customization_option($conf)) {
die "BUG: set_conf: unknown option $conf\n";
- return undef;
}
if ($self->{'configured'}->{$conf}) {
@@ -581,7 +574,6 @@ sub force_conf($$$)
if (!Texinfo::Common::valid_customization_option($conf)) {
die "BUG: force_conf: unknown option $conf\n";
- return undef;
}
$self->{'conf'}->{$conf} = $value;
@@ -1689,6 +1681,8 @@ sub XS_get_unclosed_stream($$)
return undef;
}
+
+
########################################################################
# XML related methods and variables that may be used in different
# XML Converters.
diff --git a/tp/Texinfo/Convert/DocBook.pm b/tp/Texinfo/Convert/DocBook.pm
index de90fdb0d8..aadbb63d76 100644
--- a/tp/Texinfo/Convert/DocBook.pm
+++ b/tp/Texinfo/Convert/DocBook.pm
@@ -51,9 +51,6 @@ my %brace_commands = %Texinfo::Commands::brace_commands;
my $nbsp = '&#'.hex('00A0').';';
my %defaults = (
- # Not a customization option variable
- 'converted_format' => 'docbook',
-
# Customization option variables
'FORMAT_MENU' => 'nomenu',
'EXTENSION' => 'xml', # dbk?
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index b0a04b13b1..a105e7c9ae 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -2517,9 +2517,6 @@ sub convert_tree_new_formatting_context($$$;$$$)
my $regular_defaults = Texinfo::Options::get_converter_regular_options('html');
my %defaults = (
- # Not a customization option variable
- 'converted_format' => 'html',
-
# Customization option variables
%{$regular_defaults},
diff --git a/tp/Texinfo/Convert/IXINSXML.pm b/tp/Texinfo/Convert/IXINSXML.pm
index 553e3d8c33..bb6ab1a9d6 100644
--- a/tp/Texinfo/Convert/IXINSXML.pm
+++ b/tp/Texinfo/Convert/IXINSXML.pm
@@ -41,12 +41,9 @@ our $VERSION = '7.1.90';
my %defaults = (
- # Not customization option variables
- # next two are replaced by the main program value if called from
+ # next is replaced by the main program value if called from
# the main program. 'output_format' is also 'ixinsxml' when set by
- # the main program, but 'converted_format' is set to 'ixinsxml'.
- # More on that subject below.
- 'converted_format' => 'texinfosxml',
+ # the main program.
'output_format' => 'ixinsxml',
# Customization option variables
@@ -63,21 +60,9 @@ sub converter_defaults($$)
return \%defaults;
}
-# In the main program, the 'converted_format' needs to be 'ixinsxml'
-# to find the right module used for conversion (this module). However in
-# the Texinfo::Convert::IXIN output_ixin() function, and maybe in
-# Texinfo::Convert::TexinfoSXML convert_tree(), called from output_ixin(),
-# it may be better to have 'converted_format' set to the format converted
-# from the Texinfo tree, which is texinfosxml. So far it is not needed,
-# inheriting format specific functions is used to select the output format,
-# but it could theoretically be needed for a flexible conversion
-# (since the IXIN project is inactive, the corresponding code is not updated
-# actively either, so it is unlikely to change, though).
sub converter_initialize($) {
my $self = shift;
- $self->{'converted_format'} = $defaults{'converted_format'};
-
# need to call parent module converter_initialize, to initialize
# the converter state. This method is actually implemented in
# the Texinfo::Convert::TexinfoSXML parent class.
diff --git a/tp/Texinfo/Convert/LaTeX.pm b/tp/Texinfo/Convert/LaTeX.pm
index 33c8c83a31..528b744839 100644
--- a/tp/Texinfo/Convert/LaTeX.pm
+++ b/tp/Texinfo/Convert/LaTeX.pm
@@ -782,9 +782,6 @@ foreach my $command
(keys(%{$LaTeX_style_brace_commands{'cmd_text'}})) {
my %defaults = (
- # Not customization option variables
- 'converted_format' => 'latex',
-
# For LaTeX in general, it could make sense to have some customization,
# for example of packages, fonts, document type, to be discussed/though
# about how to setup this customization.
diff --git a/tp/Texinfo/Convert/Plaintext.pm b/tp/Texinfo/Convert/Plaintext.pm
index 05a7f592fe..2a99b8724b 100644
--- a/tp/Texinfo/Convert/Plaintext.pm
+++ b/tp/Texinfo/Convert/Plaintext.pm
@@ -353,9 +353,6 @@ foreach my $command ('var', 'cite', 'dmn',
keys(%brace_code_commands)) {
}
my %defaults = (
- # Not a customization option variable
- 'converted_format' => '',
-
# Customization options
'ENABLE_ENCODING' => 1,
'ASCII_DASHES_AND_QUOTES' => 1,
diff --git a/tp/Texinfo/Convert/TexinfoSXML.pm
b/tp/Texinfo/Convert/TexinfoSXML.pm
index 5e80586821..d17af9d7cd 100644
--- a/tp/Texinfo/Convert/TexinfoSXML.pm
+++ b/tp/Texinfo/Convert/TexinfoSXML.pm
@@ -35,9 +35,6 @@ our $VERSION = '7.1.90';
# SXML specific
my %defaults = (
- # Not a customization option variable
- 'converted_format' => 'texinfosxml',
-
# Customization option variables
'FORMAT_MENU' => 'menu',
'EXTENSION' => 'sxml',
diff --git a/tp/Texinfo/Convert/TexinfoXML.pm b/tp/Texinfo/Convert/TexinfoXML.pm
index 92bb4a018b..4fdb00d1c6 100644
--- a/tp/Texinfo/Convert/TexinfoXML.pm
+++ b/tp/Texinfo/Convert/TexinfoXML.pm
@@ -39,9 +39,6 @@ our $VERSION = '7.1.90';
# TexinfoXML specific
my %defaults = (
- # Not a customization option variable
- 'converted_format' => 'xml',
-
# Customization option variables
'FORMAT_MENU' => 'menu',
'EXTENSION' => 'xml',
diff --git a/tp/Texinfo/XS/convert/converter.c
b/tp/Texinfo/XS/convert/converter.c
index a1b3a5cc93..6f65645c96 100644
--- a/tp/Texinfo/XS/convert/converter.c
+++ b/tp/Texinfo/XS/convert/converter.c
@@ -326,11 +326,6 @@ apply_converter_info (CONVERTER *converter,
free (converter->output_format);
converter->output_format = strdup (init_info->output_format);
}
- if (init_info->converted_format)
- {
- free (converter->converted_format);
- converter->converted_format = strdup (init_info->converted_format);
- }
if (init_info->translated_commands)
{
@@ -380,8 +375,7 @@ set_converter_init_information (CONVERTER *converter,
/*
fprintf (stderr, "XS|CONVERTER Fill conf: %d; %s, %s\n",
converter->converter_descriptor,
- converter->output_format,
- converter->converted_format);
+ converter->output_format);
*/
}
@@ -400,7 +394,6 @@ destroy_converter_initialization_info
(CONVERTER_INITIALIZATION_INFO *init_info)
if (init_info->translated_commands)
destroy_translated_commands (init_info->translated_commands);
- free (init_info->converted_format);
free (init_info->output_format);
free_strings_list (&init_info->texinfo_language_config_dirs);
@@ -415,11 +408,6 @@ static void
copy_converter_initialization_info (CONVERTER_INITIALIZATION_INFO *dst_info,
const CONVERTER_INITIALIZATION_INFO *src_info)
{
- if (src_info->converted_format)
- {
- free (dst_info->converted_format);
- dst_info->converted_format = strdup (src_info->converted_format);
- }
if (src_info->output_format)
{
free (dst_info->output_format);
@@ -1768,7 +1756,6 @@ free_generic_converter (CONVERTER *self)
}
free (self->output_format);
- free (self->converted_format);
free (self->expanded_formats);
if (self->init_conf)
diff --git a/tp/Texinfo/XS/convert/get_converter_perl_info.c
b/tp/Texinfo/XS/convert/get_converter_perl_info.c
index 1921056dd2..9e3ec09786 100644
--- a/tp/Texinfo/XS/convert/get_converter_perl_info.c
+++ b/tp/Texinfo/XS/convert/get_converter_perl_info.c
@@ -286,9 +286,6 @@ get_converter_info_from_sv (SV *conf_sv, const char
*class_name,
if (!strcmp (key, "output_format"))
initialization_info->output_format
= non_perl_strdup (SvPVutf8_nolen (value));
- else if (!strcmp (key, "converted_format"))
- initialization_info->converted_format
- = non_perl_strdup (SvPVutf8_nolen (value));
/* FIXME get deprecated_config_directories if needed */
else if (!strcmp (key, "deprecated_config_directories"))
{}
diff --git a/tp/Texinfo/XS/convert/html_converter_init_options.c
b/tp/Texinfo/XS/convert/html_converter_init_options.c
index 275d6dde3e..87accfae07 100644
--- a/tp/Texinfo/XS/convert/html_converter_init_options.c
+++ b/tp/Texinfo/XS/convert/html_converter_init_options.c
@@ -190,8 +190,6 @@ html_converter_defaults (enum converter_format format,
CONVERTER_INITIALIZATION_INFO *format_defaults
= new_converter_initialization_info ();
- format_defaults->converted_format = strdup ("html");
-
add_html_regular_options_defaults (&format_defaults->conf);
add_html_default_buttons_specifications (&format_defaults->conf, 0);
diff --git a/tp/Texinfo/XS/main/build_perl_info.c
b/tp/Texinfo/XS/main/build_perl_info.c
index 0fe1987809..b0a9beacec 100644
--- a/tp/Texinfo/XS/main/build_perl_info.c
+++ b/tp/Texinfo/XS/main/build_perl_info.c
@@ -3157,9 +3157,6 @@ pass_generic_converter_to_converter_sv (SV *converter_sv,
if (converter->output_format)
STORE("output_format", newSVpv_utf8 (converter->output_format, 0));
- if (converter->converted_format)
- STORE("converted_format", newSVpv_utf8 (converter->converted_format, 0));
-
/* store converter_descriptor in perl converter */
/* NOTE unlikely IV overflow if PERL_QUAD_MAX < SIZE_MAX */
STORE("converter_descriptor", newSViv ((IV)converter->converter_descriptor));
diff --git a/tp/Texinfo/XS/main/converter_types.h
b/tp/Texinfo/XS/main/converter_types.h
index e727ba831b..6db2d190fc 100644
--- a/tp/Texinfo/XS/main/converter_types.h
+++ b/tp/Texinfo/XS/main/converter_types.h
@@ -763,7 +763,6 @@ typedef struct PRE_CLASS_TYPE_INFO {
/* information on converter configuration from a source of configuration
(either output format or user customization) */
typedef struct CONVERTER_INITIALIZATION_INFO {
- char *converted_format;
char *output_format;
TRANSLATED_COMMAND *translated_commands;
STRING_LIST texinfo_language_config_dirs;
@@ -779,7 +778,8 @@ typedef struct CONVERTER {
void *hv;
/* this is the type of the converter, not of the output. (Similar to
- a module name in Perl) */
+ a module name in Perl). Should only be used to determine which
+ functions are to be called */
enum converter_format format;
/* used to pass converter_defaults result, if going through XS and
destroyed shortly after */
@@ -791,7 +791,6 @@ typedef struct CONVERTER {
OPTIONS *format_defaults_conf;
STRING_LIST texinfo_language_config_dirs;
char *output_format;
- char *converted_format;
EXPANDED_FORMAT *expanded_formats;
TRANSLATED_COMMAND *translated_commands;
diff --git a/tp/t/test_converter_option.t b/tp/t/test_converter_option.t
index 2a7f81d66c..3cfb16a28e 100644
--- a/tp/t/test_converter_option.t
+++ b/tp/t/test_converter_option.t
@@ -6,7 +6,7 @@ use Texinfo::ModulePath (undef, undef, undef, 'updirs' => 2);
use Test::More;
-BEGIN { plan tests => 7; }
+BEGIN { plan tests => 4; }
use Texinfo::Convert::HTML;
use Texinfo::Convert::Info;
@@ -16,9 +16,6 @@ use Texinfo::Convert::DocBook;
my $html_converter = Texinfo::Convert::HTML->converter({'toto' => 1});
# cannot be used to test, as it triggers a call to confess
#my $toto = $html_converter->get_conf('toto');
-my $html_converted_format = $html_converter->{'converted_format'};
-#print STDERR "HTML: c '$html_converted_format'\n";
-is ($html_converted_format, 'html', 'HTML converted_format');
my $html_output_format = $html_converter->{'output_format'};
#print STDERR "HTML: o '$html_output_format'\n";
is ($html_output_format, undef, 'HTML output_format unset');
@@ -32,14 +29,8 @@ is ($html_output_format_with_output_format, 'my format',
'HTML output_format set');
my $info_converter = Texinfo::Convert::Info->converter({'titi' => 1});
-my $info_converted_format = $info_converter->{'converted_format'};
-#print STDERR "Info: '$info_converted_format'\n";
-is ($info_converted_format, '', 'Info converted_format');
my $docbook_converter = Texinfo::Convert::DocBook->converter();
-my $docbook_converted_format = $docbook_converter->{'converted_format'};
-#print STDERR "DocBook: '$docbook_converted_format'\n";
-is ($docbook_converted_format, 'docbook', 'DocBook converted_format');
my $docbook_output_format = $docbook_converter->{'output_format'};
#print STDERR "DocBook: o '$docbook_output_format'\n";
is ($docbook_output_format, undef, 'DocBook output_format unset');
diff --git a/tp/t/test_utils.pl b/tp/t/test_utils.pl
index 32de3b434e..12da2cb13b 100644
--- a/tp/t/test_utils.pl
+++ b/tp/t/test_utils.pl
@@ -418,9 +418,7 @@ sub set_converter_option_defaults($$;$)
if (!defined($converter_options->{'output_format'})) {
$converter_options->{'output_format'} = $format;
}
- if (!defined($converter_options->{'converted_format'})) {
- $converter_options->{'converted_format'} = $format;
- }
+
if (!defined($converter_options->{'DEBUG'})) {
$converter_options->{'DEBUG'} = $debug;
}
diff --git a/tp/texi2any.pl b/tp/texi2any.pl
index 39b76ef911..ae54de3239 100755
--- a/tp/texi2any.pl
+++ b/tp/texi2any.pl
@@ -1949,7 +1949,6 @@ while(@input_files) {
# for instance to have some consistent information for Structuring
# and Converters.
$converter_options->{'output_format'} = $format;
- $converter_options->{'converted_format'} = $converted_format;
$converter_options->{'deprecated_config_directories'}
= \%deprecated_directories;
unshift @{$converter_options->{'INCLUDE_DIRECTORIES'}},
@@ -2076,12 +2075,6 @@ while(@input_files) {
%$file_cmdline_options,
};
- # This is not clear that this is correct. On the one hand it could
- # be more consistent with the formatting to have nothing here or a
- # format corresponding to Texinfo::Convert::TextContent. On the other
- # hand, the information of the format could be useful. Not very
- # important as long as this information is not used.
- $sort_element_converter_options->{'converted_format'} = $converted_format;
unshift @{$sort_element_converter_options->{'INCLUDE_DIRECTORIES'}},
@prepended_include_directories;