texinfo-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

branch master updated: * tp/Texinfo/Data/default_direction_strings.csv,


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/Data/default_direction_strings.csv, tp/Texinfo/Data/default_special_unit_info.csv, tp/maintain/generate_code_convert_data.pl: determine translation context automatically. Remove columns from data files.
Date: Tue, 01 Oct 2024 17:26:15 -0400

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 3ca249a90b * tp/Texinfo/Data/default_direction_strings.csv, 
tp/Texinfo/Data/default_special_unit_info.csv, 
tp/maintain/generate_code_convert_data.pl: determine translation context 
automatically.  Remove columns from data files.
3ca249a90b is described below

commit 3ca249a90ba13f32947a23444434d2f5ff50ccf9
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Mon Jul 29 19:36:44 2024 +0200

    * tp/Texinfo/Data/default_direction_strings.csv,
    tp/Texinfo/Data/default_special_unit_info.csv,
    tp/maintain/generate_code_convert_data.pl: determine translation
    context automatically.  Remove columns from data files.
    
    * tp/Makefile.am (maintenance_files, Texinfo/Data.pm),
    tp/Texinfo/XS/Makefile.am (libtexinfo_la_SOURCES, EXTRA_DIST)
    (BUILT_SOURCES, main/conversion_data.c, MAINTAINERCLEANFILES),
    tp/Texinfo/XS/convert/convert_html.c,
    tp/Texinfo/XS/main/converter_types.h,
    tp/Texinfo/XS/main/option_types.h, tp/Texinfo/XS/main/tree_types.h,
    tp/maintain/generate_code_convert_data.pl: generate automatically C
    code files based on tp/Texinfo/Data/*.csv in
    generate_code_convert_data.pl in parallel with Perl code generation.
    Replace from manually set enum, arrays and macros
    special_unit_info_type_names, translated_special_unit_info,
    direction_type_translation_context, enum special_unit_info_type, enum
    special_unit_info_tree, TDS_TRANSLATED_TYPES_LIST,
    TDS_NON_TRANSLATED_TYPES_LIST, TDS_TYPE_MAX_NR, FIRSTINFILE_MIN_IDX,
    FIRSTINFILE_MAX_IDX, HTML_GLOBAL_DIRECTIONS_LIST,
    RUD_DIRECTIONS_TYPES_LIST and RUD_FILE_DIRECTIONS_TYPES.
---
 ChangeLog                                      |  24 +
 tp/Makefile.am                                 |   6 +-
 tp/Texinfo/Data.pm                             |   2 +-
 tp/Texinfo/Data/default_direction_strings.csv  |  48 +-
 tp/Texinfo/Data/default_special_unit_info.csv  |  10 +-
 tp/Texinfo/XS/Makefile.am                      |  18 +
 tp/Texinfo/XS/convert/build_html_perl_state.c  |   1 +
 tp/Texinfo/XS/convert/convert_html.c           |  20 +-
 tp/Texinfo/XS/convert/get_html_perl_info.c     |   1 +
 tp/Texinfo/XS/main/converter_types.h           |  36 +-
 tp/Texinfo/XS/main/option_types.h              |   5 +-
 tp/Texinfo/XS/main/tree_types.h                |  27 +-
 tp/Texinfo/XS/main/utils.c                     |   1 +
 tp/maintain/generate_code_convert_data.pl      | 629 +++++++++++++++++++++++++
 tp/maintain/generate_convert_data_perl_code.pl | 414 ----------------
 15 files changed, 711 insertions(+), 531 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 8348cb6d6f..b5f229afc6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,27 @@
+2024-07-29  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/Data/default_direction_strings.csv,
+       tp/Texinfo/Data/default_special_unit_info.csv,
+       tp/maintain/generate_code_convert_data.pl: determine translation
+       context automatically.  Remove columns from data files.
+
+       * tp/Makefile.am (maintenance_files, Texinfo/Data.pm),
+       tp/Texinfo/XS/Makefile.am (libtexinfo_la_SOURCES, EXTRA_DIST)
+       (BUILT_SOURCES, main/conversion_data.c, MAINTAINERCLEANFILES),
+       tp/Texinfo/XS/convert/convert_html.c,
+       tp/Texinfo/XS/main/converter_types.h,
+       tp/Texinfo/XS/main/option_types.h, tp/Texinfo/XS/main/tree_types.h,
+       tp/maintain/generate_code_convert_data.pl: generate automatically C
+       code files based on tp/Texinfo/Data/*.csv in
+       generate_code_convert_data.pl in parallel with Perl code generation.
+       Replace from manually set enum, arrays and macros
+       special_unit_info_type_names, translated_special_unit_info,
+       direction_type_translation_context, enum special_unit_info_type, enum
+       special_unit_info_tree, TDS_TRANSLATED_TYPES_LIST,
+       TDS_NON_TRANSLATED_TYPES_LIST, TDS_TYPE_MAX_NR, FIRSTINFILE_MIN_IDX,
+       FIRSTINFILE_MAX_IDX, HTML_GLOBAL_DIRECTIONS_LIST,
+       RUD_DIRECTIONS_TYPES_LIST and RUD_FILE_DIRECTIONS_TYPES.
+
 2024-07-29  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/Data/default_direction_strings.csv: fix order.
diff --git a/tp/Makefile.am b/tp/Makefile.am
index 7be3896b62..87bf6deb0c 100644
--- a/tp/Makefile.am
+++ b/tp/Makefile.am
@@ -329,7 +329,7 @@ maintenance_files = \
   maintain/change_perl_modules_version.sh \
   maintain/copy_change_file_name_encoding.pl \
   maintain/language-subtag-registry \
-  maintain/generate_convert_data_perl_code.pl \
+  maintain/generate_code_convert_data.pl \
   maintain/regenerate_cmd_tests.sh \
   maintain/regenerate_converters_documentation.sh \
   maintain/regenerate_docstr.sh \
@@ -385,8 +385,8 @@ $(srcdir)/Texinfo/Commands.pm: Texinfo/command_data.txt 
$(srcdir)/maintain/regen
 $(srcdir)/Texinfo/Options.pm: Texinfo/options_data.txt 
$(srcdir)/maintain/regenerate_perl_options_info.pl
        $(srcdir)/maintain/regenerate_perl_options_info.pl 
$(srcdir)/Texinfo/Options.pm < $(srcdir)/Texinfo/options_data.txt
 
-$(srcdir)/Texinfo/Data.pm: Texinfo/Data/default_css_element_class_styles.csv 
Texinfo/Data/default_direction_strings.csv 
Texinfo/Data/default_special_unit_info.csv 
Texinfo/Data/html_style_commands_element.csv 
$(srcdir)/maintain/generate_convert_data_perl_code.pl
-       $(srcdir)/maintain/generate_convert_data_perl_code.pl 
$(srcdir)/Texinfo/Data/default_css_element_class_styles.csv 
$(srcdir)/Texinfo/Data/default_direction_strings.csv 
$(srcdir)/Texinfo/Data/default_special_unit_info.csv 
$(srcdir)/Texinfo/Data/html_style_commands_element.csv $@
+$(srcdir)/Texinfo/Data.pm: Texinfo/Data/default_css_element_class_styles.csv 
Texinfo/Data/default_direction_strings.csv 
Texinfo/Data/default_special_unit_info.csv 
Texinfo/Data/html_style_commands_element.csv 
$(srcdir)/maintain/generate_code_convert_data.pl
+       $(srcdir)/maintain/generate_code_convert_data.pl 
$(srcdir)/Texinfo/Data/default_css_element_class_styles.csv 
$(srcdir)/Texinfo/Data/default_direction_strings.csv 
$(srcdir)/Texinfo/Data/default_special_unit_info.csv 
$(srcdir)/Texinfo/Data/html_style_commands_element.csv perl $@
 
 libsrcdir = $(srcdir)/maintain/lib
 
diff --git a/tp/Texinfo/Data.pm b/tp/Texinfo/Data.pm
index 5d280de84b..0317d1d09b 100644
--- a/tp/Texinfo/Data.pm
+++ b/tp/Texinfo/Data.pm
@@ -278,7 +278,7 @@ my %default_translated_directions_strings = (
     'Index' => {'to_convert' => Texinfo::Common::pgdt('Index direction button 
label', 'Index')},
     'Last' => {'to_convert' => Texinfo::Common::pgdt('Last direction button 
label', 'Last')},
     ' ' => {'converted' => ' '},
-    'This' => {'to_convert' => Texinfo::Common::pgdt('This direction button 
label', 'This')},
+    'This' => {'to_convert' => Texinfo::Common::pgdt('This (current section) 
direction button label', 'This')},
     'Forward' => {'to_convert' => Texinfo::Common::pgdt('Forward direction 
button label', 'Forward')},
     'Back' => {'to_convert' => Texinfo::Common::pgdt('Back direction button 
label', 'Back')},
     'FastForward' => {'to_convert' => Texinfo::Common::pgdt('FastForward 
direction button label', 'FastForward')},
diff --git a/tp/Texinfo/Data/default_direction_strings.csv 
b/tp/Texinfo/Data/default_direction_strings.csv
index ef46570273..7413b73076 100644
--- a/tp/Texinfo/Data/default_direction_strings.csv
+++ b/tp/Texinfo/Data/default_direction_strings.csv
@@ -1,24 +1,24 @@
-direction|rel|accesskey|example|text converted|text to_convert context|text 
to_convert string|description converted|description to_convert 
context|description to_convert string|button converted|button to_convert 
context|button to_convert string|
-First|||1.| ${bar}&lt; ||||First direction description|First section in 
reading order||First direction button label|First|
-Top|start|| $html_default_entity_nbsp ||Top direction string|Top||Top 
direction description|Cover (top) of document||Top direction button label|Top|
-Index|index|| $html_default_entity_nbsp ||Index direction string|Index||Index 
direction description|Index||Index direction button label|Index|
-Last|||1.2.4| &gt;${bar} ||||Last direction description|Last section in 
reading order||Last direction button label|Last|
- |||| $html_default_entity_nbsp |||||| |||
-This|||1.2.3||This (current section) direction string|current||This (current 
section) direction description|Current section||This direction button 
label|This|
-Forward|next|n|1.2.4| &gt; ||||Forward direction description|Next section in 
reading order||Forward direction button label|Forward|
-Back|prev|p|1.2.2| &lt; ||||Back direction description|Previous section in 
reading order||Back direction button label|Back|
-FastForward|||2| &gt;&gt; ||||FastForward direction description|Next 
chapter||FastForward direction button label|FastForward|
-FastBack|||1| &lt;&lt; ||||FastBack direction description|Beginning of this 
chapter or previous chapter||FastBack direction button label|FastBack|
-Next|next|n|1.2.4||Next direction string|Next||Next direction description|Next 
section on same level||Next direction button label|Next|
-Prev|prev|p|1.2.2||Prev direction string|Prev||Prev direction 
description|Previous section on same level||Prev direction button label|Prev|
-Up|up|u|1.2||Up direction string| Up ||Up direction description|Up section||Up 
direction button label|Up|
-NodeNext|next|n|1.2.4||NodeNext direction string|Next||NodeNext direction 
description|Next node||NodeNext direction button label|NodeNext|
-NodePrev|prev|p|1.2.2||NodePrev direction string|Previous||NodePrev direction 
description|Previous node||NodePrev direction button label|NodePrev|
-NodeUp|up|u|1.2||NodeUp direction string|Up||NodeUp direction description|Up 
node||NodeUp direction button label|NodeUp|
-NodeForward|||1.2.4||NodeForward direction string|Forward node||NodeForward 
direction description|Next node in node reading order||NodeForward direction 
button label|NodeForward|
-NodeBack|||1.2.2||NodeBack direction string|Back node||NodeBack direction 
description|Previous node in node reading order||NodeBack direction button 
label|NodeBack|
-PrevFile|prev|| $html_default_entity_nbsp ||PrevFile direction string|Previous 
file||PrevFile direction description|Back section in previous file||PrevFile 
direction button label|PrevFile|
-NextFile|next|| $html_default_entity_nbsp ||NextFile direction string|Next 
file||NextFile direction description|Forward section in next file||NextFile 
direction button label|NextFile|
-Contents|contents|| $html_default_entity_nbsp ||Contents direction 
string|Contents||Contents direction description|Table of contents||Contents 
direction button label|Contents|
-Overview||| $html_default_entity_nbsp ||Overview direction 
string|Overview||Overview direction description|Short table of 
contents||Overview direction button label|Overview|
-About|help|| $html_default_entity_nbsp | ? ||||About direction 
description|About (help)||About direction button label|About|
+direction|rel|accesskey|example|text converted|text to_convert 
string|description converted|description to_convert string|button 
converted|button to_convert string|
+First|||1.| ${bar}&lt; |||First section in reading order||First|
+Top|start|| $html_default_entity_nbsp ||Top||Cover (top) of document||Top|
+Index|index|| $html_default_entity_nbsp ||Index||Index||Index|
+Last|||1.2.4| &gt;${bar} |||Last section in reading order||Last|
+ |||| $html_default_entity_nbsp |||| ||
+This|||1.2.3||current||Current section||This|
+Forward|next|n|1.2.4| &gt; |||Next section in reading order||Forward|
+Back|prev|p|1.2.2| &lt; |||Previous section in reading order||Back|
+FastForward|||2| &gt;&gt; |||Next chapter||FastForward|
+FastBack|||1| &lt;&lt; |||Beginning of this chapter or previous 
chapter||FastBack|
+Next|next|n|1.2.4||Next||Next section on same level||Next|
+Prev|prev|p|1.2.2||Prev||Previous section on same level||Prev|
+Up|up|u|1.2|| Up ||Up section||Up|
+NodeNext|next|n|1.2.4||Next||Next node||NodeNext|
+NodePrev|prev|p|1.2.2||Previous||Previous node||NodePrev|
+NodeUp|up|u|1.2||Up||Up node||NodeUp|
+NodeForward|||1.2.4||Forward node||Next node in node reading 
order||NodeForward|
+NodeBack|||1.2.2||Back node||Previous node in node reading order||NodeBack|
+PrevFile|prev|| $html_default_entity_nbsp ||Previous file||Back section in 
previous file||PrevFile|
+NextFile|next|| $html_default_entity_nbsp ||Next file||Forward section in next 
file||NextFile|
+Contents|contents|| $html_default_entity_nbsp ||Contents||Table of 
contents||Contents|
+Overview||| $html_default_entity_nbsp ||Overview||Short table of 
contents||Overview|
+About|help|| $html_default_entity_nbsp | ? |||About (help)||About|
diff --git a/tp/Texinfo/Data/default_special_unit_info.csv 
b/tp/Texinfo/Data/default_special_unit_info.csv
index b334c447b0..81dffb3008 100644
--- a/tp/Texinfo/Data/default_special_unit_info.csv
+++ b/tp/Texinfo/Data/default_special_unit_info.csv
@@ -1,5 +1,5 @@
-type|class|direction|order|file_string|target|heading context|heading string|
-contents|contents|Contents|30|_toc|SEC_Contents|contents section heading|Table 
of Contents|
-shortcontents|shortcontents|Overview|20|_ovr|SEC_Shortcontents|shortcontents 
section heading|Short Table of Contents|
-footnotes|footnotes|Footnotes|10|_fot|SEC_Footnotes|footnotes section 
heading|Footnotes|
-about|about|About|40|_abt|SEC_About|about section heading|About This Document|
+type|class|direction|order|file_string|target|heading string|
+contents|contents|Contents|30|_toc|SEC_Contents|Table of Contents|
+shortcontents|shortcontents|Overview|20|_ovr|SEC_Shortcontents|Short Table of 
Contents|
+footnotes|footnotes|Footnotes|10|_fot|SEC_Footnotes|Footnotes|
+about|about|About|40|_abt|SEC_About|About This Document|
diff --git a/tp/Texinfo/XS/Makefile.am b/tp/Texinfo/XS/Makefile.am
index 61816b3daa..615c213371 100644
--- a/tp/Texinfo/XS/Makefile.am
+++ b/tp/Texinfo/XS/Makefile.am
@@ -137,6 +137,8 @@ libtexinfo_la_SOURCES= \
                      main/convert_to_text.h \
                      main/convert_utils.c \
                      main/convert_utils.h \
+                     main/conversion_data.c \
+                     main/conversion_data.h \
                      main/floats.c \
                      main/floats.h \
                      main/manipulate_tree.c \
@@ -212,6 +214,8 @@ libtexinfo_la_SOURCES= \
 
 EXTRA_DIST += main/accent_tables_8bit_codepoints.c
 EXTRA_DIST += main/command_data.c
+EXTRA_DIST += main/conversion_data.c
+EXTRA_DIST += main/conversion_data.h
 EXTRA_DIST += main/cmd_normalization.c
 EXTRA_DIST += main/cmd_unicode.c
 EXTRA_DIST += main/cmd_text.c
@@ -232,6 +236,8 @@ BUILT_SOURCES = main/accent_tables_8bit_codepoints.c \
                 main/cmd_unicode.c \
                 main/command_data.c \
                 main/command_ids.h \
+                main/conversion_data.c \
+                main/conversion_data.h \
                 main/element_types.c \
                 main/element_types.h \
                 main/global_commands_types.h \
@@ -300,6 +306,18 @@ $(srcdir)/main/options_init_free.c 
$(srcdir)/main/options_types.h $(srcdir)/main
 MAINTAINERCLEANFILES += main/options_init_free.c main/options_types.h \
                         main/options_get_perl.c
 
+$(srcdir)/main/conversion_data.c $(srcdir)/main/conversion_data.h: 
$(srcdir)/../Data/default_css_element_class_styles.csv 
$(srcdir)/../Data/default_direction_strings.csv 
$(srcdir)/../Data/default_special_unit_info.csv 
$(srcdir)/../Data/html_style_commands_element.csv 
$(srcdir)/../../maintain/generate_code_convert_data.pl
+       $(PERL) $(srcdir)/../../maintain/generate_code_convert_data.pl \
+               $(srcdir)/../Data/default_css_element_class_styles.csv \
+               $(srcdir)/../Data/default_direction_strings.csv \
+               $(srcdir)/../Data/default_special_unit_info.csv \
+               $(srcdir)/../Data/html_style_commands_element.csv \
+               C $(srcdir)/main/conversion_data.c \
+               $(srcdir)/main/conversion_data.h
+
+MAINTAINERCLEANFILES += main/conversion_data.c main/conversion_data.h
+
+
 ########################## shared perl XS library for texinfo XS codes
 # it is separate from libtexinfo because of different dependencies; it
 # does not depend on gnulib.  Both libraries are used by following XS.
diff --git a/tp/Texinfo/XS/convert/build_html_perl_state.c 
b/tp/Texinfo/XS/convert/build_html_perl_state.c
index 15acfef271..03b6dc7a3e 100644
--- a/tp/Texinfo/XS/convert/build_html_perl_state.c
+++ b/tp/Texinfo/XS/convert/build_html_perl_state.c
@@ -29,6 +29,7 @@
 
 #undef context
 
+#include "conversion_data.h"
 #include "tree_types.h"
 #include "converter_types.h"
 /* for builtin_command_name */
diff --git a/tp/Texinfo/XS/convert/convert_html.c 
b/tp/Texinfo/XS/convert/convert_html.c
index 37d08ed105..f9fcac2923 100644
--- a/tp/Texinfo/XS/convert/convert_html.c
+++ b/tp/Texinfo/XS/convert/convert_html.c
@@ -27,6 +27,7 @@
 
 #include "copy-file.h"
 
+#include "conversion_data.h"
 #include "text.h"
 #include "element_types.h"
 #include "tree_types.h"
@@ -158,13 +159,6 @@ const char *html_stage_handler_stage_type_names[] = {
   #undef html_hsht_type
 };
 
-const char *special_unit_info_type_names[SUI_type_heading + 1] =
-{
-  #define sui_type(name) #name,
-   SUI_TYPES_LIST
-  #undef sui_type
-};
-
 const char *direction_string_type_names[] =
 {
   #define tds_type(name) #name,
@@ -195,13 +189,6 @@ const enum htmlxref_split_type 
htmlxref_entries[htmlxref_split_type_chapter + 1]
  { htmlxref_split_type_chapter, htmlxref_split_type_section, 
htmlxref_split_type_node, htmlxref_split_type_mono },
 };
 
-
-const TRANSLATED_SUI_ASSOCIATION translated_special_unit_info[] = {
-  {SUIT_type_heading, SUI_type_heading},
-  /* these special types end the list */
-  {SUIT_type_none, SUI_type_none},
-};
-
 CMD_VARIETY command_special_unit_variety[] = {
                                 {CM_contents, "contents"},
                                 {CM_shortcontents, "shortcontents"},
@@ -3043,11 +3030,6 @@ clear_direction_string_type (const CONVERTER *self, char 
***type_directions_stri
     }
 }
 
-static const char *direction_type_translation_context[] =
-{
-  "button label", "description", "string"
-};
-
 const char *
 direction_string (CONVERTER *self, int direction,
                   enum direction_string_type string_type,
diff --git a/tp/Texinfo/XS/convert/get_html_perl_info.c 
b/tp/Texinfo/XS/convert/get_html_perl_info.c
index cae30a2027..a04e3d2658 100644
--- a/tp/Texinfo/XS/convert/get_html_perl_info.c
+++ b/tp/Texinfo/XS/convert/get_html_perl_info.c
@@ -31,6 +31,7 @@
 
 #undef context
 
+#include "conversion_data.h"
 #include "command_ids.h"
 #include "converter_types.h"
 #include "types_data.h"
diff --git a/tp/Texinfo/XS/main/converter_types.h 
b/tp/Texinfo/XS/main/converter_types.h
index 07a99bc2bc..2f9f3d3813 100644
--- a/tp/Texinfo/XS/main/converter_types.h
+++ b/tp/Texinfo/XS/main/converter_types.h
@@ -21,6 +21,7 @@
 /* for FILE */
 #include <stdio.h>
 
+#include "conversion_data.h"
 #include "element_types.h"
 #include "command_ids.h"
 #include "tree_types.h"
@@ -77,45 +78,10 @@ enum conversion_context {
   #undef cctx_type
 };
 
-#define SUI_TYPES_LIST \
-  sui_type(class) \
-  sui_type(direction) \
-  sui_type(order) \
-  sui_type(file_string) \
-  sui_type(target) \
-  sui_type(heading)
-
-enum special_unit_info_type {
-   SUI_type_none = -1,
-  #define sui_type(name) SUI_type_ ## name,
-   SUI_TYPES_LIST
-  #undef sui_type
-};
-
-/* translated from corresponding SUI_type* */
-enum special_unit_info_tree {
-   SUIT_type_none = -1,
-
-   SUIT_type_heading,
-};
-
 enum special_target_type {
    ST_footnote_location,
 };
 
-#define TDS_TRANSLATED_TYPES_LIST \
-  tds_type(button) \
-  tds_type(description) \
-  tds_type(text)
-
-#define TDS_NON_TRANSLATED_TYPES_LIST \
-  tds_type(accesskey) \
-  tds_type(example) \
-  tds_type(rel)
-
-#define TDS_TRANSLATED_MAX_NR TDS_type_text +1
-#define TDS_TYPE_MAX_NR TDS_type_rel +1
-
 enum direction_string_type {
   #define tds_type(name) TDS_type_ ## name,
    TDS_TRANSLATED_TYPES_LIST
diff --git a/tp/Texinfo/XS/main/option_types.h 
b/tp/Texinfo/XS/main/option_types.h
index e52b57ac02..83a58bdf51 100644
--- a/tp/Texinfo/XS/main/option_types.h
+++ b/tp/Texinfo/XS/main/option_types.h
@@ -19,6 +19,7 @@
 
 #include <stddef.h>
 
+#include "conversion_data.h"
 #include "tree_types.h"
 
 enum global_option_type {
@@ -51,10 +52,6 @@ enum direction_unit_direction {
   #undef rud_type
 };
 
-/* TODO next two very dangerous */
-#define FIRSTINFILE_MIN_IDX D_direction_FirstInFileThis
-#define FIRSTINFILE_MAX_IDX D_direction_FirstInFileNodeBack
-
 #define FIRSTINFILE_OFFSET (D_direction_This - D_direction_FirstInFileThis)
 #define FIRSTINFILE_NR (FIRSTINFILE_MAX_IDX - FIRSTINFILE_MIN_IDX +1)
 /* used for the three directions like D_direction_Next to retrieve the
diff --git a/tp/Texinfo/XS/main/tree_types.h b/tp/Texinfo/XS/main/tree_types.h
index 5b80dc1404..a538e682a4 100644
--- a/tp/Texinfo/XS/main/tree_types.h
+++ b/tp/Texinfo/XS/main/tree_types.h
@@ -19,6 +19,7 @@
 #include <stddef.h>
 #include <stdint.h>
 
+#include "conversion_data.h"
 #include "command_ids.h"
 #include "element_types.h"
 #include "text.h"
@@ -165,11 +166,6 @@ enum ai_key_name {
    special_unit_info and put later on in
    special_units_direction_name
  */
-#define HTML_GLOBAL_DIRECTIONS_LIST \
-   hgdt_name(First) \
-   hgdt_name(Top) \
-   hgdt_name(Index) \
-   hgdt_name(Last)
 
 enum global_unit_direction {
   #define hgdt_name(name) D_ ## name,
@@ -178,27 +174,6 @@ enum global_unit_direction {
    D_Space,
 };
 
-/* relative output unit directions */
-#define RUD_DIRECTIONS_TYPES_LIST \
-   rud_type(This) \
-   rud_type(Forward) \
-   rud_type(Back) \
-   rud_type(FastForward) \
-   rud_type(FastBack) \
-   rud_type(Next) \
-   rud_type(Prev) \
-   rud_type(Up) \
-   rud_type(NodeNext) \
-   rud_type(NodePrev) \
-   rud_type(NodeUp) \
-   rud_type(NodeForward) \
-   rud_type(NodeBack)
-
-/* relative output unit file directions */
-#define RUD_FILE_DIRECTIONS_TYPES \
-   rud_type(PrevFile) \
-   rud_type(NextFile)
-
 enum relative_unit_direction_type {
   #define rud_type(name) RUD_type_## name,
    RUD_DIRECTIONS_TYPES_LIST
diff --git a/tp/Texinfo/XS/main/utils.c b/tp/Texinfo/XS/main/utils.c
index b5b84942e7..606026dc4a 100644
--- a/tp/Texinfo/XS/main/utils.c
+++ b/tp/Texinfo/XS/main/utils.c
@@ -29,6 +29,7 @@
 #include "uniwidth.h"
 #include <unictype.h>
 
+#include "conversion_data.h"
 /* also for xvasprintf */
 #include "text.h"
 #include "command_ids.h"
diff --git a/tp/maintain/generate_code_convert_data.pl 
b/tp/maintain/generate_code_convert_data.pl
new file mode 100755
index 0000000000..eb9b306967
--- /dev/null
+++ b/tp/maintain/generate_code_convert_data.pl
@@ -0,0 +1,629 @@
+#! /usr/bin/env perl
+
+# generate_convert_data_perl_code.pl: generate perl hashes based on
+# data information also used in XS.
+#
+# Copyright 2024 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/>.
+
+# ./maintain/generate_convert_data_perl_code.pl 
Texinfo/Data/default_css_element_class_styles.csv 
Texinfo/Data/default_direction_strings.csv 
Texinfo/Data/default_special_unit_info.csv 
Texinfo/Data/html_style_commands_element.csv Texinfo/Data.pm
+
+use strict;
+
+use warnings;
+
+use File::Basename;
+use Text::Wrap;
+
+my $program_name = basename($0);
+
+my $base_default_css_element_class_styles_file = $ARGV[0];
+
+open (BDCSS, "<$base_default_css_element_class_styles_file")
+  or die "open $base_default_css_element_class_styles_file failed: $!";
+
+my $default_direction_strings_file = $ARGV[1];
+open (DDS, "<$default_direction_strings_file")
+  or die "open $default_direction_strings_file failed: $!";
+
+my $default_special_unit_info_file = $ARGV[2];
+open (DSUI, "<$default_special_unit_info_file")
+  or die "open $default_special_unit_info_file failed: $!";
+
+my $style_commands_element_file = $ARGV[3];
+open (SCE, "<$style_commands_element_file")
+  or die "open $style_commands_element_file failed: $!";
+
+
+my $header_line = <BDCSS>;
+chomp($header_line);
+#print STDERR "$header_line\n";
+my @header = split(/\|/, $header_line);
+my ($selector_index, $style_index, $notes_index);
+my $header_index = 0;
+foreach my $header (@header) {
+  if ($header eq 'selector') {
+    $selector_index = $header_index;
+  } elsif ($header eq 'style') {
+    $style_index = $header_index;
+  } elsif ($header eq 'notes') {
+    $notes_index = $header_index;
+  }
+  $header_index++;
+}
+if (!defined($selector_index) or !defined($style_index)
+    or !defined($notes_index)) {
+  die "missing header column ($selector_index, $style_index, $notes_index)\n";
+}
+
+my $lang = $ARGV[4];
+
+my $perl_format = 0;
+my $C_format = 0;
+if ($lang eq 'perl') {
+  $perl_format = 1;
+} else {
+  $C_format = 1;
+}
+
+my $out_file = $ARGV[5];
+
+die "Need an output file\n" if (!defined($out_file));
+
+open(OUT, ">$out_file") or die "Open $out_file: $!\n";
+
+my $initial_notes_tab;
+my $subsequent_notes_tab;
+
+if ($perl_format) {
+  $initial_notes_tab = ' # ';
+  $subsequent_notes_tab = ' # ';
+
+  print OUT "# Automatically generated from $program_name\n\n";
+
+  print OUT "package Texinfo::Data;\n\n";
+
+  print OUT "use Texinfo::Common;\n\n";
+
+  print OUT "my %base_default_css_element_class_styles = (\n";
+
+} else {
+  my $header_file = $ARGV[6];
+
+  die "Need an output header\n" if (!defined($header_file));
+
+  open(HDR, ">$header_file") or die "Open $header_file: $!\n";
+
+  $initial_notes_tab = '';
+  $subsequent_notes_tab = '   ';
+
+  print OUT "/* Automatically generated from $program_name */\n\n";
+
+  print OUT "#include <config.h>\n\n";
+  print OUT "#include \"conversion_data.h\"\n";
+  print OUT "#include \"converter_types.h\"\n\n";
+
+  print OUT "const CSS_SELECTOR_STYLE base_default_css_element_class_styles[] 
= {\n";
+}
+
+while (<BDCSS>) {
+  chomp;
+  my @data = split (/\|/);
+  my $notes = $data[$notes_index];
+  if (defined($notes) and $notes ne '') {
+    my $lines;
+    if ($perl_format) {
+      $lines = wrap($initial_notes_tab, $subsequent_notes_tab, ($notes));
+      print OUT $lines."\n";
+    } else {
+      $lines = wrap($initial_notes_tab, $subsequent_notes_tab, ($notes . ' 
*/'));
+      print OUT "/* $lines\n";
+    }
+  }
+  my $selector = $data[$selector_index];
+  if (!defined($selector) or $selector eq '') {
+    die "$base_default_css_element_class_styles_file: Bad selector\n";
+  }
+  my $style = $data[$style_index];
+  if (!defined($style) or $style eq '') {
+    die "$base_default_css_element_class_styles_file: Bad style\n";
+  }
+  if ($perl_format) {
+    print OUT "    '$selector'    => '$style',\n";
+  } else {
+    print OUT "    {\"$selector\", \"$style\"},\n";
+  }
+}
+
+my $C_header_string = 'CONVERSION_DATA_H';
+if ($perl_format) {
+
+  print OUT ");\n\n";
+
+  print OUT 'sub get_base_default_css_info() {'."\n"
+  .'  return \%base_default_css_element_class_styles;'."\n"
+  ."}\n\n";
+} else {
+
+  print OUT "};\n\n";
+
+  print HDR "/* Automatically generated from $program_name */\n\n";
+  print HDR "#ifndef $C_header_string\n"
+         ."#define $C_header_string\n\n";
+}
+
+
+my @su_ordered_untranslated_hashes;
+my @su_ordered_translated_hashes;
+
+my $su_header_line = <DSUI>;
+chomp($su_header_line);
+#print STDERR "$su_header_line\n";
+my @su_header = split(/\|/, $su_header_line);
+my $special_unit_header = shift @su_header;
+
+my $su_header_index = 1;
+my $su_type;
+my %su_header_indices;
+foreach my $header (@su_header) {
+  if ($header =~ /^([^ ]+) ([^ ]+)$/) {
+    my $spec = $2;
+    if ($spec ne 'string') {
+      die "Unknown special unit column spec $spec\n";
+    }
+    $su_type = $1;
+    push @su_ordered_translated_hashes, $su_type;
+    $su_header_indices{$su_type} = {$spec => $su_header_index};
+  } elsif ($header eq '') {
+    continue;
+  } else {
+    push @su_ordered_untranslated_hashes, $header;
+    $su_type = undef;
+    $su_header_indices{$header} = $su_header_index;
+  }
+  $su_header_index++;
+}
+
+if ($C_format) {
+  print HDR "enum special_unit_info_type {\n"
+         ."   SUI_type_none = -1,\n";
+
+  print OUT "const char *special_unit_info_type_names[] = {\n";
+}
+
+my %su_hash_lines;
+foreach my $type (@su_ordered_untranslated_hashes, 
@su_ordered_translated_hashes) {
+  $su_hash_lines{$type} = '';
+  if ($C_format) {
+    print HDR "   SUI_type_${type},\n";
+    print OUT "   \"${type}\",\n";
+  }
+}
+
+if ($C_format) {
+  print OUT "};\n\n";
+  print HDR "};\n\n";
+
+  print HDR "/* translated from corresponding SUI_type* */\n";
+  print HDR "enum special_unit_info_tree {\n"
+         ."   SUIT_type_none = -1,\n\n";
+
+  print OUT "const TRANSLATED_SUI_ASSOCIATION translated_special_unit_info[] = 
{\n";
+  foreach my $type (@su_ordered_translated_hashes) {
+    print HDR "   SUIT_type_${type},\n";
+    print OUT "  {SUIT_type_${type}, SUI_type_${type}},\n";
+  }
+  print OUT "  /* these special types end the list */\n"
+         ."  {SUIT_type_none, SUI_type_none},\n"
+         ."};\n\n";
+
+  print HDR "};\n\n";
+
+}
+
+# gather for direction structures below
+my %su_directions;
+my @su_ordered;
+while (<DSUI>) {
+  chomp;
+  my @data = split (/\|/);
+  my $special_unit = $data[0];
+  push @su_ordered, $special_unit;
+  foreach my $untranslated_type (@su_ordered_untranslated_hashes) {
+    my $index = $su_header_indices{$untranslated_type};
+    my $value = '';
+    if (defined($data[$index])) {
+      $value = $data[$index];
+      if ($untranslated_type eq 'direction') {
+        $su_directions{$value} = 1;
+      }
+    }
+    if ($perl_format) {
+      $su_hash_lines{$untranslated_type} .= "    '$special_unit' => 
'$value',\n";
+    } else {
+      my $value = '0';
+      if (defined($data[$index])) {
+        $value = "\"$data[$index]\"";
+      }
+      $su_hash_lines{$untranslated_type} .= "$value, ";
+    }
+  }
+  foreach my $translated_type (@su_ordered_translated_hashes) {
+    my $string = $data[$su_header_indices{$translated_type}->{'string'}];
+    if (defined($string) and $string ne '') {
+      my $context = $special_unit . ' section heading';
+      if ($perl_format) {
+        $su_hash_lines{$translated_type}
+         .= "    '$special_unit' => Texinfo::Common::pgdt('$context', 
'$string'),\n";
+      } else {
+        $su_hash_lines{$translated_type}
+         .= "pgdt_noop(\"$context\", \"$string\"), ";
+      }
+    } else {
+      print STDERR "REMARK: '$special_unit': no $translated_type\n";
+      if ($C_format) {
+        $su_hash_lines{$translated_type} .= '0, ';
+      }
+    }
+  }
+}
+my $special_units_nr = scalar(@su_ordered);
+
+if ($perl_format) {
+  print OUT "my %default_special_unit_info = (\n";
+
+  foreach my $type (@su_ordered_untranslated_hashes) {
+    print OUT "\n  '$type' => {\n";
+    print OUT $su_hash_lines{$type};
+    print OUT "  },\n";
+  }
+
+  print OUT ");\n\n";
+
+  print OUT 'sub get_default_special_unit_info() {'."\n"
+   .'  return \%default_special_unit_info;'."\n"
+   ."}\n\n";
+
+
+  print OUT "my %default_translated_special_unit_info = (\n";
+  foreach my $type (@su_ordered_translated_hashes) {
+    print OUT "\n  '$type' => {\n";
+    print OUT $su_hash_lines{$type};
+    print OUT "  },\n";
+  }
+  print OUT ");\n\n";
+
+  print OUT 'sub get_default_translated_special_unit_info() {'."\n"
+   .'  return \%default_translated_special_unit_info;'."\n"
+   ."}\n\n";
+} else {
+
+
+  my $last_type = "SUI_type_".$su_ordered_translated_hashes[-1];
+
+  print OUT "static char *default_special_unit_varieties_array[] = {\n";
+  foreach my $special_units (@su_ordered) {
+    print OUT "  \"$special_units\",\n";
+  }
+  print OUT "};\n";
+
+  print OUT "const STRING_LIST default_special_unit_varieties = 
{default_special_unit_varieties_array, $special_units_nr, 
$special_units_nr};\n\n";
+
+
+  # FIXME somwhere else?
+  print OUT "#define pgdt_noop(Context,String) String\n";
+
+  print OUT "const char * const 
defaul_special_unit_info[$last_type+1][$special_units_nr] = {\n";
+  foreach my $type (@su_ordered_untranslated_hashes, 
@su_ordered_translated_hashes) {
+    print OUT "  {".$su_hash_lines{$type}."},\n";
+  }
+  print OUT "};\n\n";
+
+}
+
+my @global_directions = ('First', 'Top', 'Index', 'Last');
+# add space 'direction'
+my @ordered_global_directions = (@global_directions, ' ');
+my %ordered_global_directions_hash;
+foreach my $global_direction (@ordered_global_directions) {
+  $ordered_global_directions_hash{$global_direction} = 1;
+}
+
+my %direction_orders = (
+  'global' => \@ordered_global_directions,
+  'relative' => [],
+  'file' => []
+);
+my @orders_order = ('global', 'relative', 'file');
+
+my @d_ordered_untranslated_hashes;
+my @d_ordered_translated_hashes;
+
+my $d_header_line = <DDS>;
+chomp($d_header_line);
+#print STDERR "$d_header_line\n";
+my @d_header = split(/\|/, $d_header_line);
+my $direction_header = shift @d_header;
+
+my $d_header_index = 1;
+my $type;
+my %d_header_indices;
+foreach my $header (@d_header) {
+  if ($header =~ /^([^ ]+) converted$/) {
+    $type = $1;
+    push @d_ordered_translated_hashes, $type;
+    $d_header_indices{$type} = {'converted' => $d_header_index};
+  } elsif ($header =~ /^([^ ]+) to_convert ([^ ]+)$/) {
+    if ($1 ne $type) {
+      die "Non matching type $1 ne $type\n";
+    }
+    my $spec = $2;
+    if ($spec ne 'string') {
+      die "Unknown to_convert spec $spec\n";
+    }
+    $d_header_indices{$type}->{'to_convert'} = $d_header_index;
+  } elsif ($header eq '') {
+    continue;
+  } else {
+    push @d_ordered_untranslated_hashes, $header;
+    $type = undef;
+    $d_header_indices{$header} = $d_header_index;
+  }
+  $d_header_index++;
+}
+
+sub substitute_direction_value
+{
+  my $input = shift;
+  $input =~ s/\$html_default_entity_nbsp/&nbsp;/;
+  $input =~ s/\$\{bar\}/\|/;
+  return $input;
+}
+
+my %hash_lines;
+my %hash_values;
+foreach my $type (@d_ordered_untranslated_hashes, 
@d_ordered_translated_hashes) {
+  $hash_lines{$type} = '';
+  $hash_values{$type} = {};
+}
+
+my %type_contexts_map = (
+   'text' => 'string',
+   'description' => 'description',
+   'button' => 'button label',
+);
+
+if ($C_format) {
+  print HDR "extern const char *direction_type_translation_context[];\n";
+
+  # we define preprocessor macros
+  print HDR "#define TDS_TRANSLATED_TYPES_LIST \\\n";
+  foreach my $type (@d_ordered_translated_hashes) {
+    print HDR "  tds_type(${type}) \\\n";
+  }
+  print HDR "\n\n";
+
+  print HDR "#define TDS_NON_TRANSLATED_TYPES_LIST \\\n";
+  foreach my $type (@d_ordered_untranslated_hashes) {
+    print HDR "  tds_type(${type}) \\\n";
+  }
+  print HDR "\n\n";
+
+  print HDR "#define TDS_TRANSLATED_MAX_NR TDS_type_"
+   .$d_ordered_translated_hashes[-1]." +1\n\n";
+  print HDR "#define TDS_TYPE_MAX_NR TDS_type_"
+   .$d_ordered_untranslated_hashes[-1]." +1\n\n";
+
+  print OUT "const char *direction_type_translation_context[] = {\n";
+  foreach my $type (@d_ordered_translated_hashes) {
+    print OUT '"'.$type_contexts_map{$type}.'", '."\n";
+  }
+  print OUT "};\n\n";
+}
+
+my @relative_directions_order;
+my @file_directions_order;
+while (<DDS>) {
+  chomp;
+  my @data = split (/\|/);
+  my $direction = $data[0];
+  if (!$ordered_global_directions_hash{$direction}
+      and !$su_directions{$direction}) {
+    if ($direction =~ /File/) {
+      push @{$direction_orders{'file'}}, $direction;
+    } else {
+      push @{$direction_orders{'relative'}}, $direction;
+    }
+  }
+  foreach my $untranslated_type (@d_ordered_untranslated_hashes) {
+    my $index = $d_header_indices{$untranslated_type};
+    my $value = '';
+    if (defined($data[$index])) {
+      $value = substitute_direction_value($data[$index]);
+    }
+    if ($perl_format) {
+      $hash_lines{$untranslated_type} .= "    '$direction' => '$value',\n";
+    } else {
+      if ($value ne '') {
+        $hash_values{$untranslated_type}->{$direction} = {'untranslated' => 
$value};
+      }
+    }
+  }
+  foreach my $translated_type (@d_ordered_translated_hashes) {
+    my $converted_value = 
$data[$d_header_indices{$translated_type}->{'converted'}];
+    if (defined($converted_value) and $converted_value ne '') {
+      my $value = substitute_direction_value($converted_value);
+      if ($perl_format) {
+        $hash_lines{$translated_type}
+          .= "    '$direction' => {'converted' => '$value'},\n";
+      } else {
+        $hash_values{$translated_type}->{$direction} = {'converted' => $value};
+      }
+    } else {
+      my $string = $data[$d_header_indices{$translated_type}->{'to_convert'}];
+      if (defined($string) and $string ne '') {
+        my $context;
+        my $value = substitute_direction_value($string);
+        # as an exception 'This' becomes 'This (current section)' in contexts
+        if ($direction eq 'This') {
+          $context = 'This (current section)';
+        } else {
+          $context = $direction;
+        }
+        $context .= ' direction '.$type_contexts_map{$translated_type};
+        if ($perl_format) {
+          $hash_lines{$translated_type}
+           .= "    '$direction' => {'to_convert' "
+                       ."=> Texinfo::Common::pgdt('$context', '$value')},\n";
+        } else {
+          $hash_values{$translated_type}->{$direction} = {'string' => $value,
+                                                          'context' => 
$context};
+        }
+      } else {
+        print STDERR "REMARK: '$direction': no $translated_type\n";
+      }
+    }
+  }
+}
+
+if ($perl_format) {
+  print OUT 'sub get_directions_order() {'."\n"
+    . 'return [';
+  foreach my $order (@orders_order) {
+    print OUT '['.join(', ', map{"'$_'"} @{$direction_orders{$order}})."],\n";
+  }
+  print OUT "];\n}\n\n";
+
+
+  print OUT "my %default_converted_directions_strings = (\n";
+
+  foreach my $type (@d_ordered_untranslated_hashes) {
+    print OUT "\n  '$type' => {\n";
+    print OUT $hash_lines{$type};
+    print OUT "  },\n";
+  }
+
+  print OUT ");\n\n";
+
+  print OUT 'sub get_default_converted_directions_strings() {'."\n"
+   .'  return \%default_converted_directions_strings;'."\n"
+   ."}\n\n";
+
+  print OUT "my %default_translated_directions_strings = (\n";
+  foreach my $type (@d_ordered_translated_hashes) {
+    print OUT "\n  '$type' => {\n";
+    print OUT $hash_lines{$type};
+    print OUT "  },\n";
+  }
+  print OUT ");\n\n";
+
+  print OUT 'sub get_default_translated_directions_strings() {'."\n"
+   .'  return \%default_translated_directions_strings;'."\n"
+   ."}\n\n";
+} else {
+
+  print HDR "#define HTML_GLOBAL_DIRECTIONS_LIST \\\n";
+  foreach my $direction (@{$direction_orders{'global'}}) {
+    if ($direction ne ' ') {
+      print HDR "   hgdt_name(${direction}) \\\n";
+    }
+  }
+  print HDR "\n\n";
+
+  print HDR "/* relative output unit directions */\n";
+  print HDR "#define RUD_DIRECTIONS_TYPES_LIST \\\n";
+  foreach my $direction (@{$direction_orders{'relative'}}) {
+    print HDR "   rud_type(${direction}) \\\n";
+  }
+  print HDR "\n\n";
+
+  print HDR "/* relative output unit file directions */\n";
+  print HDR "#define RUD_FILE_DIRECTIONS_TYPES \\\n";
+  foreach my $direction (@{$direction_orders{'file'}}) {
+    print HDR "   rud_type(${direction}) \\\n";
+  }
+  print HDR "\n\n";
+
+  print HDR "/* for buttons directions */\n";
+  print HDR "#define FIRSTINFILE_MIN_IDX D_direction_FirstInFile"
+     .$direction_orders{'relative'}[0]."\n";
+  print HDR "#define FIRSTINFILE_MAX_IDX D_direction_FirstInFile"
+     .$direction_orders{'relative'}[-1]."\n\n";
+}
+
+my $sce_header_line = <SCE>;
+chomp($sce_header_line);
+#print STDERR "$sce_header_line\n";
+my @sce_header = split(/\|/, $sce_header_line);
+my ($sce_command_index, $sce_html_element_index, $sce_notes_index);
+my $sce_header_index = 0;
+foreach my $header (@sce_header) {
+  if ($header eq 'command') {
+    $sce_command_index = $sce_header_index;
+  } elsif ($header eq 'html_element') {
+    $sce_html_element_index = $sce_header_index;
+  } elsif ($header eq 'notes') {
+    $sce_notes_index = $sce_header_index;
+  }
+  $sce_header_index++;
+}
+if (!defined($sce_command_index) or !defined($sce_html_element_index)
+    or !defined($notes_index)) {
+  die "missing header column ($sce_command_index, "
+                   ."$sce_html_element_index, $sce_notes_index)\n";
+}
+
+if ($perl_format) {
+  print OUT "my %html_style_commands_element = (\n";
+}
+
+my $line_nr = 1;
+while (<SCE>) {
+  $line_nr++;
+  chomp;
+  my @data = split (/\|/);
+  my $notes = $data[$sce_notes_index];
+  if (defined($notes) and $notes ne '') {
+    my $lines;
+    if ($perl_format) {
+      $lines = wrap($initial_notes_tab, $subsequent_notes_tab, ($notes));
+      print OUT $lines."\n";
+    }
+  }
+  my $sce_command = $data[$sce_command_index];
+  if (!defined($sce_command) or $sce_command eq '') {
+    die "$style_commands_element_file: $line_nr: Bad command\n";
+  }
+  my $sce_html_element = $data[$sce_html_element_index];
+  if (!defined($sce_html_element) or $sce_html_element eq '') {
+    die "$style_commands_element_file: $line_nr: Bad html_element\n";
+  }
+  if ($perl_format) {
+    print OUT "    '$sce_command'    => '$sce_html_element',\n";
+  }
+}
+
+if ($perl_format) {
+  print OUT ");\n\n";
+
+  print OUT 'sub get_html_style_commands_element() {'."\n"
+   .'  return \%html_style_commands_element;'."\n"
+   ."}\n\n";
+
+  print OUT "1;\n";
+} else {
+  print HDR "#endif\n";
+}
+
diff --git a/tp/maintain/generate_convert_data_perl_code.pl 
b/tp/maintain/generate_convert_data_perl_code.pl
deleted file mode 100755
index 9a2ceaefaf..0000000000
--- a/tp/maintain/generate_convert_data_perl_code.pl
+++ /dev/null
@@ -1,414 +0,0 @@
-#! /usr/bin/env perl
-
-# generate_convert_data_perl_code.pl: generate perl hashes based on
-# data information also used in XS.
-#
-# Copyright 2024 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/>.
-
-# ./maintain/generate_convert_data_perl_code.pl 
Texinfo/Data/default_css_element_class_styles.csv 
Texinfo/Data/default_direction_strings.csv 
Texinfo/Data/default_special_unit_info.csv 
Texinfo/Data/html_style_commands_element.csv Texinfo/Data.pm
-
-use strict;
-
-use warnings;
-
-use File::Basename;
-use Text::Wrap;
-
-my $program_name = basename($0);
-
-my $base_default_css_element_class_styles_file = $ARGV[0];
-
-open (BDCSS, "<$base_default_css_element_class_styles_file")
-  or die "open $base_default_css_element_class_styles_file failed: $!";
-
-my $default_direction_strings_file = $ARGV[1];
-open (DDS, "<$default_direction_strings_file")
-  or die "open $default_direction_strings_file failed: $!";
-
-my $default_special_unit_info_file = $ARGV[2];
-open (DSUI, "<$default_special_unit_info_file")
-  or die "open $default_special_unit_info_file failed: $!";
-
-my $style_commands_element_file = $ARGV[3];
-open (SCE, "<$style_commands_element_file")
-  or die "open $style_commands_element_file failed: $!";
-
-
-my $header_line = <BDCSS>;
-chomp($header_line);
-#print STDERR "$header_line\n";
-my @header = split(/\|/, $header_line);
-my ($selector_index, $style_index, $notes_index);
-my $header_index = 0;
-foreach my $header (@header) {
-  if ($header eq 'selector') {
-    $selector_index = $header_index;
-  } elsif ($header eq 'style') {
-    $style_index = $header_index;
-  } elsif ($header eq 'notes') {
-    $notes_index = $header_index;
-  }
-  $header_index++;
-}
-if (!defined($selector_index) or !defined($style_index)
-    or !defined($notes_index)) {
-  die "missing header column ($selector_index, $style_index, $notes_index)\n";
-}
-
-my $out_file = $ARGV[4];
-
-die "Need an output file\n" if (!defined($out_file));
-
-open(OUT, ">$out_file") or die "Open $out_file: $!\n";
-    
-print OUT "# Automatically generated from $program_name\n\n";
-
-print OUT "package Texinfo::Data;\n\n";
-
-print OUT "use Texinfo::Common;\n\n";
-
-print OUT "my %base_default_css_element_class_styles = (\n";
-
-my $initial_notes_tab = ' # ';
-my $subsequent_notes_tab = ' # ';
-while (<BDCSS>) {
-  chomp;
-  my @data = split (/\|/);
-  my $notes = $data[$notes_index];
-  if (defined($notes) and $notes ne '') {
-    my $lines = wrap($initial_notes_tab, $subsequent_notes_tab, ($notes));
-    print OUT $lines."\n";
-  }
-  my $selector = $data[$selector_index];
-  if (!defined($selector) or $selector eq '') {
-    die "$base_default_css_element_class_styles_file: Bad selector\n";
-  }
-  my $style = $data[$style_index];
-  if (!defined($style) or $style eq '') {
-    die "$base_default_css_element_class_styles_file: Bad style\n";
-  }
-  print OUT "    '$selector'    => '$style',\n";
-}
-
-print OUT ");\n\n";
-
-print OUT 'sub get_base_default_css_info() {
-  return \%base_default_css_element_class_styles;
-}'."\n\n";
-
-
-my @su_ordered_untranslated_hashes;
-my @su_ordered_translated_hashes;
-
-my $su_header_line = <DSUI>;
-chomp($su_header_line);
-#print STDERR "$su_header_line\n";
-my @su_header = split(/\|/, $su_header_line);
-my $special_unit_header = shift @su_header;
-
-my $su_header_index = 1;
-my $su_type;
-my %su_header_indices;
-foreach my $header (@su_header) {
-  if ($header =~ /^([^ ]+) ([^ ]+)$/) {
-    my $spec = $2;
-    if ($spec ne 'context' and $spec ne 'string') {
-      die "Unknown special unit column spec $spec\n";
-    }
-    if ($spec eq 'context') {
-      $su_type = $1;
-      push @su_ordered_translated_hashes, $su_type;
-      $su_header_indices{$su_type} = {};
-    } elsif ($1 ne $su_type) {
-      die "Non matching type $1 ne $su_type\n";
-    }
-    $su_header_indices{$su_type}->{$spec} = $su_header_index;
-  } elsif ($header eq '') {
-    continue;
-  } else {
-    push @su_ordered_untranslated_hashes, $header;
-    $su_type = undef;
-    $su_header_indices{$header} = $su_header_index;
-  }
-  $su_header_index++;
-}
-
-my %su_hash_lines;
-foreach my $type (@su_ordered_untranslated_hashes, 
@su_ordered_translated_hashes) {
-  $su_hash_lines{$type} = '';
-}
-# gather for direction structures below
-my %su_directions;
-my @su_ordered;
-while (<DSUI>) {
-  chomp;
-  my @data = split (/\|/);
-  my $special_unit = $data[0];
-  push @su_ordered, $special_unit;
-  foreach my $untranslated_type (@su_ordered_untranslated_hashes) {
-    my $index = $su_header_indices{$untranslated_type};
-    my $value = '';
-    if (defined($data[$index])) {
-      $value = $data[$index];
-      if ($untranslated_type eq 'direction') {
-        $su_directions{$value} = 1;
-      }
-    }
-    $su_hash_lines{$untranslated_type} .= "    '$special_unit' => '$value',\n";
-  }
-  foreach my $translated_type (@su_ordered_translated_hashes) {
-    my $context = $data[$su_header_indices{$translated_type}->{'context'}];
-    my $string = $data[$su_header_indices{$translated_type}->{'string'}];
-    if (defined($string) and $string ne '') {
-      if (!defined($context) or $context eq '') {
-        print STDERR "ERROR: '$special_unit': '$string' but no context\n";
-      } else {
-        $su_hash_lines{$translated_type}
-         .= "    '$special_unit' => Texinfo::Common::pgdt('$context', 
'$string'),\n";
-      }
-    } else {
-      print STDERR "REMARK: '$special_unit': no $translated_type\n";
-    }
-  }
-}
-
-print OUT "my %default_special_unit_info = (\n";
-
-foreach my $type (@su_ordered_untranslated_hashes) {
-  print OUT "\n  '$type' => {\n";
-  print OUT $su_hash_lines{$type};
-  print OUT "  },\n";
-}
-
-print OUT ");\n\n";
-
-print OUT 'sub get_default_special_unit_info() {
-  return \%default_special_unit_info;
-}'."\n\n";
-
-print OUT "my %default_translated_special_unit_info = (\n";
-foreach my $type (@su_ordered_translated_hashes) {
-  print OUT "\n  '$type' => {\n";
-  print OUT $su_hash_lines{$type};
-  print OUT "  },\n";
-}
-print OUT ");\n\n";
-
-print OUT 'sub get_default_translated_special_unit_info() {
-  return \%default_translated_special_unit_info;
-}'."\n\n";
-
-
-my @global_directions = ('First', 'Top', 'Index', 'Last');
-# add space 'direction'
-my @ordered_global_directions = (@global_directions, ' ');
-my %ordered_global_directions_hash;
-foreach my $global_direction (@ordered_global_directions) {
-  $ordered_global_directions_hash{$global_direction} = 1;
-}
-
-my %direction_orders = (
-  'global' => \@ordered_global_directions,
-  'relative' => [],
-  'file' => []
-);
-my @orders_order = ('global', 'relative', 'file');
-
-my @d_ordered_untranslated_hashes;
-my @d_ordered_translated_hashes;
-
-my $d_header_line = <DDS>;
-chomp($d_header_line);
-#print STDERR "$d_header_line\n";
-my @d_header = split(/\|/, $d_header_line);
-my $direction_header = shift @d_header;
-
-my $d_header_index = 1;
-my $type;
-my %d_header_indices;
-foreach my $header (@d_header) {
-  if ($header =~ /^([^ ]+) converted$/) {
-    $type = $1;
-    push @d_ordered_translated_hashes, $type;
-    $d_header_indices{$type} = {'converted' => $d_header_index};
-  } elsif ($header =~ /^([^ ]+) to_convert ([^ ]+)$/) {
-    if ($1 ne $type) {
-      die "Non matching type $1 ne $type\n";
-    }
-    my $spec = $2;
-    if ($spec ne 'context' and $spec ne 'string') {
-      die "Unknown to_convert spec $spec\n";
-    }
-    if (!defined($d_header_indices{$type}->{'to_convert'})) {
-      $d_header_indices{$type}->{'to_convert'} = {};
-    }
-    $d_header_indices{$type}->{'to_convert'}->{$spec} = $d_header_index;
-  } elsif ($header eq '') {
-    continue;
-  } else {
-    push @d_ordered_untranslated_hashes, $header;
-    $type = undef;
-    $d_header_indices{$header} = $d_header_index;
-  }
-  $d_header_index++;
-}
-
-sub substitute_direction_value
-{
-  my $input = shift;
-  $input =~ s/\$html_default_entity_nbsp/&nbsp;/;
-  $input =~ s/\$\{bar\}/\|/;
-  return $input;
-}
-
-my %hash_lines;
-foreach my $type (@d_ordered_untranslated_hashes, 
@d_ordered_translated_hashes) {
-  $hash_lines{$type} = '';
-}
-my @relative_directions_order;
-my @file_directions_order;
-while (<DDS>) {
-  chomp;
-  my @data = split (/\|/);
-  my $direction = $data[0];
-  if (!$ordered_global_directions_hash{$direction}
-      and !$su_directions{$direction}) {
-    if ($direction =~ /File/) {
-      push @{$direction_orders{'file'}}, $direction;
-    } else {
-      push @{$direction_orders{'relative'}}, $direction;
-    }
-  }
-  foreach my $untranslated_type (@d_ordered_untranslated_hashes) {
-    my $index = $d_header_indices{$untranslated_type};
-    my $value = '';
-    if (defined($data[$index])) {
-      $value = substitute_direction_value($data[$index]);
-    }
-    $hash_lines{$untranslated_type} .= "    '$direction' => '$value',\n";
-  }
-  foreach my $translated_type (@d_ordered_translated_hashes) {
-    my $converted_value = 
$data[$d_header_indices{$translated_type}->{'converted'}];
-    if (defined($converted_value) and $converted_value ne '') {
-      $hash_lines{$translated_type}
-        .= "    '$direction' => {'converted' => '"
-                   .substitute_direction_value($converted_value)."'},\n";
-    } else {
-      my $context = 
$data[$d_header_indices{$translated_type}->{'to_convert'}->{'context'}];
-      my $string = 
$data[$d_header_indices{$translated_type}->{'to_convert'}->{'string'}];
-      if (defined($string) and $string ne '') {
-        if (!defined($context) or $context eq '') {
-          print STDERR "ERROR: '$direction': '$string' but no context\n";
-        } else {
-          $hash_lines{$translated_type}
-           .= "    '$direction' => {'to_convert' => 
Texinfo::Common::pgdt('$context', '"
-             . substitute_direction_value($string)."')},\n";
-        }
-      } else {
-        print STDERR "REMARK: '$direction': no $translated_type\n";
-      }
-    }
-  }
-}
-
-print OUT 'sub get_directions_order() {'."\n"
-  . 'return [';
-foreach my $order (@orders_order) {
-  print OUT '['.join(', ', map{"'$_'"} @{$direction_orders{$order}})."],\n";
-}
-print OUT "];\n}\n\n";
-
-
-print OUT "my %default_converted_directions_strings = (\n";
-
-foreach my $type (@d_ordered_untranslated_hashes) {
-  print OUT "\n  '$type' => {\n";
-  print OUT $hash_lines{$type};
-  print OUT "  },\n";
-}
-
-print OUT ");\n\n";
-
-print OUT 'sub get_default_converted_directions_strings() {
-  return \%default_converted_directions_strings;
-}'."\n\n";
-
-print OUT "my %default_translated_directions_strings = (\n";
-foreach my $type (@d_ordered_translated_hashes) {
-  print OUT "\n  '$type' => {\n";
-  print OUT $hash_lines{$type};
-  print OUT "  },\n";
-}
-print OUT ");\n\n";
-
-print OUT 'sub get_default_translated_directions_strings() {
-  return \%default_translated_directions_strings;
-}'."\n\n";
-
-
-my $sce_header_line = <SCE>;
-chomp($sce_header_line);
-#print STDERR "$sce_header_line\n";
-my @sce_header = split(/\|/, $sce_header_line);
-my ($sce_command_index, $sce_html_element_index, $sce_notes_index);
-my $sce_header_index = 0;
-foreach my $header (@sce_header) {
-  if ($header eq 'command') {
-    $sce_command_index = $sce_header_index;
-  } elsif ($header eq 'html_element') {
-    $sce_html_element_index = $sce_header_index;
-  } elsif ($header eq 'notes') {
-    $sce_notes_index = $sce_header_index;
-  }
-  $sce_header_index++;
-}
-if (!defined($sce_command_index) or !defined($sce_html_element_index)
-    or !defined($notes_index)) {
-  die "missing header column ($sce_command_index, "
-                   ."$sce_html_element_index, $sce_notes_index)\n";
-}
-
-print OUT "my %html_style_commands_element = (\n";
-
-my $line_nr = 1;
-while (<SCE>) {
-  $line_nr++;
-  chomp;
-  my @data = split (/\|/);
-  my $notes = $data[$sce_notes_index];
-  if (defined($notes) and $notes ne '') {
-    my $lines = wrap($initial_notes_tab, $subsequent_notes_tab, ($notes));
-    print OUT $lines."\n";
-  }
-  my $sce_command = $data[$sce_command_index];
-  if (!defined($sce_command) or $sce_command eq '') {
-    die "$style_commands_element_file: $line_nr: Bad command\n";
-  }
-  my $sce_html_element = $data[$sce_html_element_index];
-  if (!defined($sce_html_element) or $sce_html_element eq '') {
-    die "$style_commands_element_file: $line_nr: Bad html_element\n";
-  }
-  print OUT "    '$sce_command'    => '$sce_html_element',\n";
-}
-
-print OUT ");\n\n";
-
-print OUT 'sub get_html_style_commands_element() {
-  return \%html_style_commands_element;
-}'."\n\n";
-
-print OUT "1;\n";
-



reply via email to

[Prev in Thread] Current Thread [Next in Thread]