[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
From: |
Patrice Dumas |
Date: |
Sun, 29 Sep 2024 17:37:16 -0400 (EDT) |
branch: master
commit c783f2c18793202c56c679a6e52cacebd45c81f6
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sat Jul 13 09:26:03 2024 +0200
* tp/Texinfo/XS/Makefile.am (libtexinfo_la_SOURCES, EXTRA_DIST)
(BUILT_SOURCES), tp/Texinfo/XS/main/convert_to_text.c,
tp/maintain/setup_converters_code_tables.pl: merge cmd_symbol.c in
cmd_text.c and setup cmd_text.c as a separately built file.
* tp/Texinfo/XS/Makefile.am (ConvertXS_la_SOURCES, EXTRA_DIST),
tp/Texinfo/Convert/Converter.pm (%xml_text_entity_no_arg_commands),
tp/maintain/setup_converters_code_tables.pl: make
%xml_text_entity_no_arg_commands our. Setup cmd_converter.c with
xml_text_entity_no_arg_commands in C.
* tp/Texinfo/XS/convert/converter.c
(xml_text_entity_no_arg_commands_formatting, converter_setup),
tp/Texinfo/XS/convert/ConvertXS.xs (init): setup
xml_text_entity_no_arg_commands_formatting.
* tp/Texinfo/Convert/HTML.pm (%XS_conversion_overrides)
(_XS_format_setup, import), tp/Texinfo/XS/convert/ConvertXS.xs
(html_format_setup), tp/Texinfo/XS/convert/convert_html.c
(html_format_setup): rename _XS_format_init as _XS_format_setup
and html_format_init as html_format_setup. Rename
nr_default_commands_args variable as default_commands_args_nr.
* tp/Texinfo/XS/convert/convert_html.c (no_arg_formatted_cmd)
(html_format_setup, html_free_converter),
tp/Texinfo/XS/convert/get_html_perl_info.c
(html_converter_initialize_sv), tp/Texinfo/XS/main/converter_types.h
(no_arg_formatted_cmd): make no_arg_formatted_cmd a
static variable instead of being in a converter, and setup
no_arg_formatted_cmd in html_format_setup. Update users.
* tp/Texinfo/XS/convert/convert_html.c
(default_no_arg_commands_formatting, html_format_setup): prepare
default_no_arg_commands_formatting.
---
ChangeLog | 37 ++++++++++
tp/Texinfo/Convert/Converter.pm | 2 +-
tp/Texinfo/Convert/HTML.pm | 8 +--
tp/Texinfo/XS/Makefile.am | 48 +++++++------
tp/Texinfo/XS/convert/ConvertXS.xs | 3 +-
tp/Texinfo/XS/convert/convert_html.c | 106 +++++++++++++++++++---------
tp/Texinfo/XS/convert/convert_html.h | 2 +-
tp/Texinfo/XS/convert/converter.c | 20 ++++++
tp/Texinfo/XS/convert/converter.h | 8 +++
tp/Texinfo/XS/convert/get_html_perl_info.c | 3 +-
tp/Texinfo/XS/main/convert_to_text.c | 4 --
tp/Texinfo/XS/main/convert_to_text.h | 5 ++
tp/Texinfo/XS/main/converter_types.h | 1 -
tp/maintain/setup_converters_code_tables.pl | 62 +++++++++++-----
14 files changed, 226 insertions(+), 83 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index e3f3dcc7a3..d0ef899a8f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,40 @@
+2024-07-13 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/XS/Makefile.am (libtexinfo_la_SOURCES, EXTRA_DIST)
+ (BUILT_SOURCES), tp/Texinfo/XS/main/convert_to_text.c,
+ tp/maintain/setup_converters_code_tables.pl: merge cmd_symbol.c in
+ cmd_text.c and setup cmd_text.c as a separately built file.
+
+ * tp/Texinfo/XS/Makefile.am (ConvertXS_la_SOURCES, EXTRA_DIST),
+ tp/Texinfo/Convert/Converter.pm (%xml_text_entity_no_arg_commands),
+ tp/maintain/setup_converters_code_tables.pl: make
+ %xml_text_entity_no_arg_commands our. Setup cmd_converter.c with
+ xml_text_entity_no_arg_commands in C.
+
+ * tp/Texinfo/XS/convert/converter.c
+ (xml_text_entity_no_arg_commands_formatting, converter_setup),
+ tp/Texinfo/XS/convert/ConvertXS.xs (init): setup
+ xml_text_entity_no_arg_commands_formatting.
+
+ * tp/Texinfo/Convert/HTML.pm (%XS_conversion_overrides)
+ (_XS_format_setup, import), tp/Texinfo/XS/convert/ConvertXS.xs
+ (html_format_setup), tp/Texinfo/XS/convert/convert_html.c
+ (html_format_setup): rename _XS_format_init as _XS_format_setup
+ and html_format_init as html_format_setup. Rename
+ nr_default_commands_args variable as default_commands_args_nr.
+
+ * tp/Texinfo/XS/convert/convert_html.c (no_arg_formatted_cmd)
+ (html_format_setup, html_free_converter),
+ tp/Texinfo/XS/convert/get_html_perl_info.c
+ (html_converter_initialize_sv), tp/Texinfo/XS/main/converter_types.h
+ (no_arg_formatted_cmd): make no_arg_formatted_cmd a
+ static variable instead of being in a converter, and setup
+ no_arg_formatted_cmd in html_format_setup. Update users.
+
+ * tp/Texinfo/XS/convert/convert_html.c
+ (default_no_arg_commands_formatting, html_format_setup): prepare
+ default_no_arg_commands_formatting.
+
2024-07-12 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/XS/main/convert_to_text.c, tp/Texinfo/XS/main/unicode.c,
diff --git a/tp/Texinfo/Convert/Converter.pm b/tp/Texinfo/Convert/Converter.pm
index e1fd80999b..33809d6020 100644
--- a/tp/Texinfo/Convert/Converter.pm
+++ b/tp/Texinfo/Convert/Converter.pm
@@ -1777,7 +1777,7 @@ sub xml_protect_text($$)
}
# 'today' is not set here.
-my %xml_text_entity_no_arg_commands = (
+our %xml_text_entity_no_arg_commands = (
# nobrace_symbol_text
'&' => '&',
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index 761de7367a..8208db40e5 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -101,8 +101,8 @@ my %XS_overrides = (
);
my %XS_conversion_overrides = (
- "Texinfo::Convert::HTML::_XS_format_init"
- => "Texinfo::Convert::ConvertXS::html_format_init",
+ "Texinfo::Convert::HTML::_XS_format_setup"
+ => "Texinfo::Convert::ConvertXS::html_format_setup",
"Texinfo::Convert::HTML::_XS_html_converter_initialize"
=> "Texinfo::Convert::ConvertXS::html_converter_initialize_sv",
"Texinfo::Convert::HTML::_initialize_output_state"
@@ -292,7 +292,7 @@ my %XS_conversion_overrides = (
);
# XS initialization independent of customization
-sub _XS_format_init()
+sub _XS_format_setup()
{
}
@@ -307,7 +307,7 @@ sub import {
foreach my $sub (keys %XS_conversion_overrides) {
Texinfo::XSLoader::override ($sub, $XS_conversion_overrides{$sub});
}
- _XS_format_init();
+ _XS_format_setup();
}
$module_loaded = 1;
}
diff --git a/tp/Texinfo/XS/Makefile.am b/tp/Texinfo/XS/Makefile.am
index 2606b6a15b..b67b3aecaa 100644
--- a/tp/Texinfo/XS/Makefile.am
+++ b/tp/Texinfo/XS/Makefile.am
@@ -146,6 +146,7 @@ libtexinfo_la_SOURCES= \
main/command_stack.c \
main/command_stack.h \
main/cmd_structuring.c \
+ main/cmd_text.c \
main/parser_conf.c \
main/parser_conf.h \
main/targets.c \
@@ -213,7 +214,6 @@ EXTRA_DIST += main/accent_tables_8bit_codepoints.c
EXTRA_DIST += main/command_data.c
EXTRA_DIST += main/cmd_normalization.c
EXTRA_DIST += main/cmd_unicode.c
-EXTRA_DIST += main/cmd_symbol.c
EXTRA_DIST += main/cmd_text.c
EXTRA_DIST += main/global_multi_commands_case.c
EXTRA_DIST += main/global_unique_commands_case.c
@@ -224,22 +224,22 @@ libtexinfo_la_CFLAGS = $(XSLIBS_CFLAGS)
libtexinfo_la_LIBADD = $(top_builddir)/gnulib/lib/libgnu.la
libtexinfo_la_LDFLAGS = -version-info 0:0:0 $(perl_conf_LDFLAGS) $(LTLIBINTL)
$(LTLIBICONV) $(LTLIBUNISTRING)
-BUILT_SOURCES=main/accent_tables_8bit_codepoints.c \
- main/cmd_normalization.c \
- main/cmd_unicode.c \
- main/cmd_structuring.c \
- main/cmd_symbol.c \
- main/cmd_text.c \
- main/command_data.c \
- main/command_ids.h \
- main/element_types.c \
- main/element_types.h \
- main/global_commands_types.h \
- main/global_multi_commands_case.c \
- main/global_unique_commands_case.c \
- main/options_init_free.c \
- main/options_get_perl.c \
- main/options_types.h
+BUILT_SOURCES = main/accent_tables_8bit_codepoints.c \
+ convert/cmd_converter.c \
+ main/cmd_normalization.c \
+ main/cmd_structuring.c \
+ main/cmd_text.c \
+ main/cmd_unicode.c \
+ main/command_data.c \
+ main/command_ids.h \
+ main/element_types.c \
+ main/element_types.h \
+ main/global_commands_types.h \
+ main/global_multi_commands_case.c \
+ main/global_unique_commands_case.c \
+ main/options_init_free.c \
+ main/options_get_perl.c \
+ main/options_types.h
# Need to be distributed
EXTRA_DIST+=main/element_types.txt main/element_types.awk \
@@ -270,14 +270,14 @@ $(srcdir)/../Commands.pm: ../command_data.txt
$(srcdir)/../../maintain/regenerat
$(srcdir)/../Options.pm: $(srcdir)/../options_data.txt
$(srcdir)/../../maintain/regenerate_perl_options_info.pl
$(PERL) $(srcdir)/../../maintain/regenerate_perl_options_info.pl
$(srcdir)/../Options.pm < $(srcdir)/../options_data.txt
-$(srcdir)/main/cmd_normalization.c $(srcdir)/main/cmd_unicode.c
$(srcdir)/main/cmd_structuring.c $(srcdir)/main/cmd_symbol.c
$(srcdir)/main/cmd_text.c: main/command_data.c ../Commands.pm ../Options.pm
$(srcdir)/../../maintain/setup_converters_code_tables.pl
+$(srcdir)/main/cmd_normalization.c $(srcdir)/main/cmd_unicode.c
$(srcdir)/main/cmd_structuring.c $(srcdir)/main/cmd_text.c
$(srcdir)/convert/cmd_converter.c: main/command_data.c ../Commands.pm
../Options.pm $(srcdir)/../../maintain/setup_converters_code_tables.pl
$(TXI_MODULES_ENV) $(PERL)
$(srcdir)/../../maintain/setup_converters_code_tables.pl \
< $(srcdir)/main/command_data.c \
$(srcdir)/main/cmd_normalization.c \
$(srcdir)/main/cmd_unicode.c \
$(srcdir)/main/cmd_structuring.c \
- $(srcdir)/main/cmd_symbol.c \
- $(srcdir)/main/cmd_text.c
+ $(srcdir)/main/cmd_text.c \
+ $(srcdir)/convert/cmd_converter.c
MAINTAINERCLEANFILES += main/cmd_normalization.c main/cmd_unicode.c \
main/cmd_structuring.c main/cmd_symbol.c main/cmd_text.c
@@ -448,10 +448,14 @@ CLEANFILES += convert/ConvertXS.c
ConvertXS_la_SOURCES = \
convert/get_html_perl_info.c \
convert/get_html_perl_info.h \
- convert/get_converter_perl_info.c \
- convert/get_converter_perl_info.h
+ convert/converter.h \
+ convert/converter.c \
+ convert/cmd_converter.c \
+ convert/convert_html.h \
+ convert/convert_html.c
EXTRA_DIST += convert/ConvertXS.xs
+EXTRA_DIST += convert/cmd_converter.c
# To locate include files under out-of-source builds.
ConvertXS_la_CPPFLAGS = -I$(srcdir)/main -I$(srcdir)/structuring_transfo
-I$(srcdir)/convert $(AM_CPPFLAGS) $(GNULIB_CPPFLAGS) $(XSLIBS_CPPFLAGS)
diff --git a/tp/Texinfo/XS/convert/ConvertXS.xs
b/tp/Texinfo/XS/convert/ConvertXS.xs
index 7e95eca7fc..2921738437 100644
--- a/tp/Texinfo/XS/convert/ConvertXS.xs
+++ b/tp/Texinfo/XS/convert/ConvertXS.xs
@@ -72,6 +72,7 @@ int
init (...)
CODE:
set_element_type_name_info ();
+ converter_setup ();
RETVAL = 1;
OUTPUT:
RETVAL
@@ -540,7 +541,7 @@ text_convert_tree (SV *options_in, SV *tree_in)
# HTML
void
-html_format_init ()
+html_format_setup ()
void
html_converter_initialize_sv (SV *converter_in, SV
*default_formatting_references, SV *default_css_string_formatting_references,
SV *default_commands_open, SV *default_commands_conversion, SV
*default_css_string_commands_conversion, SV *default_types_open, SV
*default_types_conversion, SV *default_css_string_types_conversion, SV
*default_output_units_conversion, SV *default_no_arg_commands_formatting, SV
*default_special_unit_body)
diff --git a/tp/Texinfo/XS/convert/convert_html.c
b/tp/Texinfo/XS/convert/convert_html.c
index 0290ab7945..9f11c8cadc 100644
--- a/tp/Texinfo/XS/convert/convert_html.c
+++ b/tp/Texinfo/XS/convert/convert_html.c
@@ -208,6 +208,8 @@ CMD_VARIETY command_special_unit_variety[] = {
{0, 0},
};
+static HTML_COMMAND_CONVERSION
default_no_arg_commands_formatting[BUILTIN_CMD_NUMBER][HCC_type_css_string+1];
+
/* used to set flags to non-zero with a flag that does nothing */
#define F_AFT_none 0x0001
@@ -16609,12 +16611,16 @@ reset_translated_special_unit_info_tree (CONVERTER
*self)
static COMMAND_STACK preformatted_cmd_list;
static COMMAND_STACK def_cmd_list;
+
+static COMMAND_ID_LIST no_arg_formatted_cmd;
+
/* set information that is independent of customization, only called once */
void
-html_format_init (void)
+html_format_setup (void)
{
int i;
- int nr_default_commands_args
+ int no_arg_formatted_cmd_nr = 0;
+ int default_commands_args_nr
= sizeof (default_commands_args) / sizeof (default_commands_args[0]);
int max_args = MAX_COMMAND_ARGS_NR;
@@ -16622,7 +16628,7 @@ html_format_init (void)
CM_example, CM_display, CM_lisp, 0
};
- for (i = 0; i < nr_default_commands_args; i++)
+ for (i = 0; i < default_commands_args_nr; i++)
{
/* we file the status for specified commands, to distinguish them
but it is not actually used in the code, as we default to
@@ -16659,8 +16665,13 @@ html_format_init (void)
html_commands_data[cmd].upper_case_cmd = upper_case_cmd;
}
+ /* set flags */
+ /* also count the number of no_arg_formatted_cmd commands */
for (i = 1; i < BUILTIN_CMD_NUMBER; i++)
{
+ if (xml_text_entity_no_arg_commands_formatting[i])
+ no_arg_formatted_cmd_nr++;
+
if ((builtin_command_data[i].flags & CF_block
&& builtin_command_data[i].data != BLOCK_format_raw)
|| builtin_command_data[i].flags & CF_root)
@@ -16700,6 +16711,39 @@ html_format_init (void)
}
html_commands_data[CM_float].flags |= HF_composition_context;
+
+ initialize_cmd_list (&no_arg_formatted_cmd, no_arg_formatted_cmd_nr,
+ no_arg_formatted_cmd_nr);
+
+ no_arg_formatted_cmd_nr = 0;
+ for (i = 0; i < BUILTIN_CMD_NUMBER; i++)
+ {
+ if (xml_text_entity_no_arg_commands_formatting[i])
+ {
+ /* need to cast to drop const */
+ default_no_arg_commands_formatting[i][HCC_type_normal].text
+ = (char *)xml_text_entity_no_arg_commands_formatting[i];
+
+ no_arg_formatted_cmd.list[no_arg_formatted_cmd_nr] = i;
+ no_arg_formatted_cmd_nr++;
+ }
+ }
+ default_no_arg_commands_formatting[CM_SPACE][HCC_type_normal].text =
" ";
+ default_no_arg_commands_formatting[CM_TAB][HCC_type_normal].text = " ";
+ default_no_arg_commands_formatting[CM_NEWLINE][HCC_type_normal].text =
" ";
+
+ default_no_arg_commands_formatting[CM_enddots][HCC_type_normal].text = "...";
+ default_no_arg_commands_formatting[CM_enddots][HCC_type_normal].element
+ = "small";
+
+ default_no_arg_commands_formatting[CM_dots][HCC_type_preformatted].text
+ = "...";
+ default_no_arg_commands_formatting[CM_enddots][HCC_type_preformatted].text
+ = "...";
+
+ default_no_arg_commands_formatting[CM_ASTERISK][HCC_type_normal].text =
"<br>";
+ default_no_arg_commands_formatting[CM_ASTERISK][HCC_type_preformatted].text
+ = "\n";
}
static int
@@ -16985,12 +17029,12 @@ html_converter_initialize (CONVERTER *self)
/* note that we allocate the same size as no_arg_formatted_cmd
even though in general there are much less translated commands,
for simplicity */
- if (self->no_arg_formatted_cmd.number)
+ if (no_arg_formatted_cmd.number)
{
self->no_arg_formatted_cmd_translated.list = (enum command_id *)
- malloc (self->no_arg_formatted_cmd.number * sizeof (enum command_id));
+ malloc (no_arg_formatted_cmd.number * sizeof (enum command_id));
memset (self->no_arg_formatted_cmd_translated.list, 0,
- self->no_arg_formatted_cmd.number * sizeof (enum command_id));
+ no_arg_formatted_cmd.number * sizeof (enum command_id));
}
for (i = 0; command_special_unit_variety[i].cmd; i++)
@@ -17146,29 +17190,26 @@ html_converter_initialize (CONVERTER *self)
}
/* all the no arg formatted commands are implemented in C */
- if (self->no_arg_formatted_cmd.number)
+ for (i = 0; i < no_arg_formatted_cmd.number; i++)
{
- for (i = 0; i < self->no_arg_formatted_cmd.number; i++)
+ enum command_id cmd = no_arg_formatted_cmd.list[i];
+ COMMAND_CONVERSION_FUNCTION *command_conversion
+ = &self->command_conversion_function[cmd];
+ COMMAND_CONVERSION_FUNCTION *css_string_command_conversion
+ = &self->css_string_command_conversion_function[cmd];
+ if (command_conversion->status == FRS_status_default_set)
{
- enum command_id cmd = self->no_arg_formatted_cmd.list[i];
- COMMAND_CONVERSION_FUNCTION *command_conversion
- = &self->command_conversion_function[cmd];
- COMMAND_CONVERSION_FUNCTION *css_string_command_conversion
- = &self->css_string_command_conversion_function[cmd];
- if (command_conversion->status == FRS_status_default_set)
- {
- command_conversion->formatting_reference = 0;
- command_conversion->status = FRS_status_internal;
- command_conversion->command_conversion
- = &convert_no_arg_command;
- external_command_conversion_function--;
- }
-
- css_string_command_conversion->formatting_reference = 0;
- css_string_command_conversion->status = FRS_status_internal;
- css_string_command_conversion->command_conversion
- = &css_string_convert_no_arg_command;
+ command_conversion->formatting_reference = 0;
+ command_conversion->status = FRS_status_internal;
+ command_conversion->command_conversion
+ = &convert_no_arg_command;
+ external_command_conversion_function--;
}
+
+ css_string_command_conversion->formatting_reference = 0;
+ css_string_command_conversion->status = FRS_status_internal;
+ css_string_command_conversion->command_conversion
+ = &css_string_convert_no_arg_command;
}
/* accents commands implemented in C */
@@ -18499,9 +18540,9 @@ html_free_converter (CONVERTER *self)
free_strings_list (&self->css_rule_lines);
free_strings_list (&self->css_import_lines);
- for (i = 0; i < self->no_arg_formatted_cmd.number; i++)
+ for (i = 0; i < no_arg_formatted_cmd.number; i++)
{
- enum command_id cmd = self->no_arg_formatted_cmd.list[i];
+ enum command_id cmd = no_arg_formatted_cmd.list[i];
enum conversion_context cctx;
for (cctx = 0; cctx < HCC_type_css_string+1; cctx++)
{
@@ -18588,7 +18629,9 @@ html_free_converter (CONVERTER *self)
}
free (self->htmlxref.list);
- free (self->no_arg_formatted_cmd.list);
+ /* should be freed on exit.
+ free (no_arg_formatted_cmd.list);
+ */
free (self->accent_cmd.list);
@@ -18802,7 +18845,6 @@ html_translate_names (CONVERTER *self)
/* self->no_arg_formatted_cmd_translated is used here to hold the translated
commands, and the information is kept if it is also used to pass
translated commands results to Perl */
- if (self->no_arg_formatted_cmd.number)
{
int translated_nr = 0;
COMMAND_ID_LIST *translated_cmds
@@ -18815,9 +18857,9 @@ html_translate_names (CONVERTER *self)
* sizeof (enum command_id));
}
- for (j = 0; j < self->no_arg_formatted_cmd.number; j++)
+ for (j = 0; j < no_arg_formatted_cmd.number; j++)
{
- enum command_id cmd = self->no_arg_formatted_cmd.list[j];
+ enum command_id cmd = no_arg_formatted_cmd.list[j];
enum conversion_context cctx;
int add_cmd = 0;
for (cctx = 0; cctx < HCC_type_css_string+1; cctx++)
diff --git a/tp/Texinfo/XS/convert/convert_html.h
b/tp/Texinfo/XS/convert/convert_html.h
index 349167a192..32008d7656 100644
--- a/tp/Texinfo/XS/convert/convert_html.h
+++ b/tp/Texinfo/XS/convert/convert_html.h
@@ -39,7 +39,7 @@ extern const char *count_elements_in_filename_type_names[];
extern const char *html_stage_handler_stage_type_names[];
-void html_format_init (void);
+void html_format_setup (void);
void html_converter_initialize (CONVERTER *self);
diff --git a/tp/Texinfo/XS/convert/converter.c
b/tp/Texinfo/XS/convert/converter.c
index f8f4e1e84b..8eef5ca294 100644
--- a/tp/Texinfo/XS/convert/converter.c
+++ b/tp/Texinfo/XS/convert/converter.c
@@ -43,6 +43,7 @@
#include "utils.h"
#include "errors.h"
#include "builtin_commands.h"
+/* also for cmd_text data */
#include "convert_to_text.h"
#include "node_name_normalization.h"
/* cdt_tree ... */
@@ -73,6 +74,25 @@ static CONVERTER **converter_list;
static size_t converter_number;
static size_t converter_space;
+const char *xml_text_entity_no_arg_commands_formatting[BUILTIN_CMD_NUMBER];
+
+void
+converter_setup (void)
+{
+ int i;
+ for (i = 0; i < BUILTIN_CMD_NUMBER; i++)
+ {
+ if (xml_text_entity_no_arg_commands[i])
+ xml_text_entity_no_arg_commands_formatting[i]
+ = xml_text_entity_no_arg_commands[i];
+ else if (nobrace_symbol_text[i])
+ xml_text_entity_no_arg_commands_formatting[i] = nobrace_symbol_text[i];
+ else if (text_brace_no_arg_commands[i])
+ xml_text_entity_no_arg_commands_formatting[i]
+ = text_brace_no_arg_commands[i];
+ }
+}
+
CONVERTER *
retrieve_converter (int converter_descriptor)
{
diff --git a/tp/Texinfo/XS/convert/converter.h
b/tp/Texinfo/XS/convert/converter.h
index cb672ed07c..498131a837 100644
--- a/tp/Texinfo/XS/convert/converter.h
+++ b/tp/Texinfo/XS/convert/converter.h
@@ -73,6 +73,14 @@ typedef struct FLOAT_CAPTION_PREPENDED_ELEMENT {
extern enum command_id no_brace_command_accent_upper_case[][2];
+/* in generated cmd_converter.c */
+extern const char * xml_text_entity_no_arg_commands[];
+
+/* in converter.c */
+extern const char *xml_text_entity_no_arg_commands_formatting[];
+
+void converter_setup (void);
+
CONVERTER *retrieve_converter (int converter_descriptor);
size_t new_converter (void);
void unregister_converter_descriptor (int converter_descriptor);
diff --git a/tp/Texinfo/XS/convert/get_html_perl_info.c
b/tp/Texinfo/XS/convert/get_html_perl_info.c
index c8474e32bb..16b43238ff 100644
--- a/tp/Texinfo/XS/convert/get_html_perl_info.c
+++ b/tp/Texinfo/XS/convert/get_html_perl_info.c
@@ -427,7 +427,7 @@ html_converter_initialize_sv (SV *converter_sv,
}
/* gather no_arg_formatted_cmd commands. The formatting is gathered later
- as it depends on the document encoding */
+ as it depends on the document encoding
if (SvOK (default_no_arg_commands_formatting))
{
I32 hv_number;
@@ -458,6 +458,7 @@ html_converter_initialize_sv (SV *converter_sv,
qsort (converter->no_arg_formatted_cmd.list, hv_number,
sizeof (enum command_id), compare_ints);
}
+ */
FETCH(sorted_special_unit_varieties)
diff --git a/tp/Texinfo/XS/main/convert_to_text.c
b/tp/Texinfo/XS/main/convert_to_text.c
index 283200dfcc..5a22a5ef55 100644
--- a/tp/Texinfo/XS/main/convert_to_text.c
+++ b/tp/Texinfo/XS/main/convert_to_text.c
@@ -47,10 +47,6 @@
#include "translations.h"
#include "convert_to_text.h"
-#include "cmd_symbol.c"
-#include "cmd_text.c"
-
-
TEXT_OPTIONS *
new_text_options (void)
{
diff --git a/tp/Texinfo/XS/main/convert_to_text.h
b/tp/Texinfo/XS/main/convert_to_text.h
index 5fbb633f70..e96d2c6ad6 100644
--- a/tp/Texinfo/XS/main/convert_to_text.h
+++ b/tp/Texinfo/XS/main/convert_to_text.h
@@ -33,6 +33,11 @@ typedef struct TEXT_OPTIONS {
size_t document_descriptor;
} TEXT_OPTIONS;
+/* in cmd_text.c */
+extern const char *nobrace_symbol_text[];
+extern const char *text_brace_no_arg_commands[];
+extern const char *sort_brace_no_arg_commands[];
+
char *convert_to_text (const ELEMENT *root, TEXT_OPTIONS *text_options);
TEXT_OPTIONS *new_text_options (void);
void destroy_text_options (TEXT_OPTIONS *text_options);
diff --git a/tp/Texinfo/XS/main/converter_types.h
b/tp/Texinfo/XS/main/converter_types.h
index d16061433e..4e988d1cb2 100644
--- a/tp/Texinfo/XS/main/converter_types.h
+++ b/tp/Texinfo/XS/main/converter_types.h
@@ -772,7 +772,6 @@ typedef struct CONVERTER {
/* set for a converter */
int external_references_number; /* total number of external references
that could be called */
- COMMAND_ID_LIST no_arg_formatted_cmd;
COMMAND_ID_LIST style_formatted_cmd;
COMMAND_ID_LIST accent_cmd;
int code_types[TXI_TREE_TYPES_NUMBER];
diff --git a/tp/maintain/setup_converters_code_tables.pl
b/tp/maintain/setup_converters_code_tables.pl
index 7d25105147..8ec82d9a6c 100755
--- a/tp/maintain/setup_converters_code_tables.pl
+++ b/tp/maintain/setup_converters_code_tables.pl
@@ -62,6 +62,7 @@ BEGIN
use Texinfo::Common;
use Texinfo::Convert::Unicode;
use Texinfo::Convert::Text;
+use Texinfo::Convert::Converter;
my @commands_order = ('');
@@ -131,12 +132,12 @@ die "Need a file for unicode tables\n" if
(!defined($unicode_file));
my $structuring_file = $ARGV[2];
die "Need a file for structuring tables\n" if (!defined($structuring_file));
-my $symbol_file = $ARGV[3];
-die "Need a file for symbols tables\n" if (!defined($symbol_file));
-
-my $text_file = $ARGV[4];
+my $text_file = $ARGV[3];
die "Need a file for text tables\n" if (!defined($text_file));
+my $converter_file = $ARGV[4];
+die "Need a file for converter tables\n" if (!defined($converter_file));
+
my %unicode_diacritics = %Texinfo::Convert::Unicode::unicode_diacritics;
my %unicode_character_brace_no_arg_commands
= %Texinfo::Convert::Unicode::unicode_character_brace_no_arg_commands;
@@ -147,7 +148,7 @@ open(UNIC, '>', $unicode_file) or die "Open $unicode_file:
$!\n";
print UNIC "/* Automatically generated from $program_name */\n\n";
-print UNIC '#include "unicode.h"'."\n\n";
+print UNIC "#include \"unicode.h\"\n\n";
print UNIC "const DIACRITIC_UNICODE unicode_diacritics[] = {\n";
foreach my $command_name (@commands_order) {
my $command = $command_name;
@@ -238,11 +239,14 @@ print STRUC "};\n\n";
close (STRUC);
-open(SYMB, '>', $symbol_file) or die "Open $symbol_file: $!\n";
+open(TEXT, '>', $text_file) or die "Open $text_file: $!\n";
+
+print TEXT "/* Automatically generated from $program_name */\n\n";
-print SYMB "/* Automatically generated from $program_name */\n\n";
+print TEXT "#include <config.h>\n\n";
+print TEXT "#include \"convert_to_text.h\"\n\n";
-print SYMB "const char *nobrace_symbol_text[] = {\n";
+print TEXT "const char *nobrace_symbol_text[] = {\n";
foreach my $command_name (@commands_order) {
my $command = $command_name;
if (exists($name_commands{$command_name})) {
@@ -251,16 +255,12 @@ foreach my $command_name (@commands_order) {
if (defined($Texinfo::Common::nobrace_symbol_text{$command_name})) {
my $symbol = $Texinfo::Common::nobrace_symbol_text{$command_name};
my $protected = join ('', map {_protect_char($_)} split ('', $symbol));
- print SYMB "\"$protected\", /* $command */\n";
+ print TEXT "\"$protected\", /* $command */\n";
} else {
- print SYMB "0,\n";
+ print TEXT "0,\n";
}
}
-print SYMB "};\n\n";
-
-close(SYMB);
-
-open(TEXT, '>', $text_file) or die "Open $text_file: $!\n";
+print TEXT "};\n\n";
print TEXT "/* Automatically generated from $program_name */\n\n";
@@ -302,7 +302,7 @@ open(NORM, '>', $normalization_file) or die "Open
$normalization_file: $!\n";
print NORM "/* Automatically generated from $program_name */\n\n";
-print NORM "const char * command_normalization_text[] = {\n";
+print NORM "const char *command_normalization_text[] = {\n";
foreach my $command_name (@commands_order) {
my $command = $command_name;
if (exists($name_commands{$command_name})) {
@@ -328,3 +328,33 @@ print NORM "};\n\n";
close(NORM);
+
+my %xml_text_entity_no_arg_commands
+ = %Texinfo::Convert::Converter::xml_text_entity_no_arg_commands;
+
+open(CONV, '>', $converter_file) or die "Open $converter_file: $!\n";
+
+print CONV "/* Automatically generated from $0 */\n\n";
+
+print CONV "const char *xml_text_entity_no_arg_commands[] = {\n";
+foreach my $command_name (@commands_order) {
+ my $command = $command_name;
+ if (exists($name_commands{$command_name})) {
+ $command = $name_commands{$command_name};
+ }
+ #print CONV "$command; ";
+
+ my $result = $xml_text_entity_no_arg_commands{$command_name};
+
+ if (defined($result)) {
+ my $protected = join ('', map {_protect_char($_)} split ('', $result));
+ print CONV "\"$protected\", /* $command */\n";
+ } else {
+ print CONV "0,\n";
+ }
+}
+print CONV "};\n\n";
+
+close(CONV);
+
+