texinfo-commits
[Top][All Lists]
Advanced

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

[no subject]


From: Patrice Dumas
Date: Thu, 3 Oct 2024 08:03:38 -0400 (EDT)

branch: master
commit 947df760f25920f3da48bf5e39eab5e289c0ebb5
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Thu Oct 3 09:47:48 2024 +0200

    * tp/Texinfo/XS/convert/converter_options.c
    (buttons_special_units_names),
    tp/Texinfo/XS/convert/converter_options.h (enum
    BUTTON_special_unit_directions): rename t2h_special_units_names as
    buttons_special_units_names and enum T2H_special_unit_directions as
    enum BUTTON_special_unit_directions.
---
 ChangeLog                                 |  9 ++++++++
 tp/Texinfo/XS/convert/converter_options.c | 38 ++++++++++++++++---------------
 tp/Texinfo/XS/convert/converter_options.h | 15 +++++++++++-
 3 files changed, 43 insertions(+), 19 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 337d40fa68..c65c9a4d84 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2024-10-03  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/XS/convert/converter_options.c
+       (buttons_special_units_names),
+       tp/Texinfo/XS/convert/converter_options.h (enum
+       BUTTON_special_unit_directions): rename t2h_special_units_names as
+       buttons_special_units_names and enum T2H_special_unit_directions as
+       enum BUTTON_special_unit_directions.
+
 2024-10-03  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/XS/main/build_perl_info.h: declare
diff --git a/tp/Texinfo/XS/convert/converter_options.c 
b/tp/Texinfo/XS/convert/converter_options.c
index 1203674784..b994e0c6b6 100644
--- a/tp/Texinfo/XS/convert/converter_options.c
+++ b/tp/Texinfo/XS/convert/converter_options.c
@@ -23,10 +23,18 @@
 #include "converter_types.h"
 #include "converters_defaults.h"
 #include "utils.h"
+#include "converter_options.h"
 
 /* code for converters options setting.  Not with format specific converter
    code, since this code is called from generic converter code. */
 
+/* should be consistent with enum BUTTON_special_unit_directions.  See
+   the comment there */
+static const char *buttons_special_units_names[] = {
+    "Contents",
+    "About",
+};
+
 /* create button specification */
 void
 new_button_specification (BUTTON_SPECIFICATION *button,
@@ -173,35 +181,24 @@ new_section_footer_buttons (const CONVERTER *self)
 
 
 
-/* TEXI2HTML buttons */
-enum T2H_special_unit_directions {
-    T2H_D_About = -3,
-    T2H_D_Contents,
-};
-
-static const char *t2h_special_units_names[] = {
-    "Contents",
-    "About",
-};
-
 /* same as NODE_FOOTER_BUTTONS */
 static const int T2H_SECTION_BUTTONS[] = {
  D_direction_FastBack, D_direction_Back, D_direction_Up, D_direction_Forward,
  D_direction_FastForward,
  D_direction_Space, D_direction_Space, D_direction_Space, D_direction_Space,
- D_direction_Top, T2H_D_Contents, D_direction_Index, T2H_D_About,
+ D_direction_Top, BSUD_D_Contents, D_direction_Index, BSUD_D_About,
  -1
 };
 
 /* same as TOP_FOOTER_BUTTONS */
 static const int T2H_TOP_BUTTONS[] = {
  D_direction_Back, D_direction_Forward, D_direction_Space,
- T2H_D_Contents, D_direction_Index, T2H_D_About,
+ BSUD_D_Contents, D_direction_Index, BSUD_D_About,
  -1
 };
 
 static const int T2H_MISC_BUTTONS[] = {
- D_direction_Top, T2H_D_Contents, D_direction_Index, T2H_D_About,
+ D_direction_Top, BSUD_D_Contents, D_direction_Index, BSUD_D_About,
  -1
 };
 
@@ -209,7 +206,7 @@ static const int T2H_MISC_BUTTONS[] = {
 static const int T2H_CHAPTER_BUTTONS[] = {
  D_direction_FastBack, D_direction_FastForward, D_direction_Space,
  D_direction_Space, D_direction_Space, D_direction_Space, D_direction_Space,
- D_direction_Top, T2H_D_Contents, D_direction_Index, T2H_D_About,
+ D_direction_Top, BSUD_D_Contents, D_direction_Index, BSUD_D_About,
  -1
 };
 
@@ -219,9 +216,14 @@ static const int T2H_SECTION_FOOTER_BUTTONS[] = {
  -1
 };
 
+/* a negative direction in DIRECTIONS corresponds to a special direction
+   which index is not known early and is better stored as a string.
 
-static BUTTON_SPECIFICATION_LIST *
-new_directions_list_buttons_specifications (CONVERTER *self,
+   Mainly called for texi2html style navigation buttons, but also for
+   default special units navigation panel buttons.
+ */
+BUTTON_SPECIFICATION_LIST *
+new_directions_list_buttons_specifications (const CONVERTER *self,
                                             const int* directions)
 {
   int buttons_nr = 0;
@@ -239,7 +241,7 @@ new_directions_list_buttons_specifications (CONVERTER *self,
       if (direction < 0)
         {
           int name_idx = -direction - 2;
-          direction_string = t2h_special_units_names[name_idx];
+          direction_string = buttons_special_units_names[name_idx];
         }
       new_button_specification (&result->list[i], BST_direction,
                         0, direction, direction_string, 0, 0, 0);
diff --git a/tp/Texinfo/XS/convert/converter_options.h 
b/tp/Texinfo/XS/convert/converter_options.h
index 32a8da0360..60a53e89ac 100644
--- a/tp/Texinfo/XS/convert/converter_options.h
+++ b/tp/Texinfo/XS/convert/converter_options.h
@@ -5,13 +5,26 @@
 #include "option_types.h"
 #include "converter_types.h"
 
+/* the enum value is negative to denote a special unit direction with
+   a direction index not already known.  And such that -enum_value -2
+   is the index in the special units directions names array */
+enum BUTTON_special_unit_directions {
+    BSUD_D_About = -3,
+    BSUD_D_Contents,
+};
+
 BUTTON_SPECIFICATION_LIST *new_basic_buttons (const CONVERTER *self,
-                              enum button_function_type function_type);
+                   enum button_function_type function_type,
+                   int with_about);
 
 BUTTON_SPECIFICATION_LIST *new_link_buttons (const CONVERTER *self);
 BUTTON_SPECIFICATION_LIST *new_section_buttons (const CONVERTER *self);
 BUTTON_SPECIFICATION_LIST *new_section_footer_buttons (const CONVERTER *self);
 
+BUTTON_SPECIFICATION_LIST *new_directions_list_buttons_specifications (
+                                            const CONVERTER *self,
+                                            const int *directions);
+
 void html_converter_defaults (CONVERTER *self,
                               CONVERTER_INITIALIZATION_INFO *format_defaults);
 #endif



reply via email to

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