texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: * tp/Texinfo/XS/convert/convert_html.c (html_conv


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/XS/convert/convert_html.c (html_converter_initialize), tp/Texinfo/XS/main/get_perl_info.c (html_converter_initialize_sv): move code mapping variety names to index in global_units_directions to html_converter_initialize.
Date: Sun, 05 Nov 2023 18:30:09 -0500

This is an automated email from the git hooks/post-receive script.

pertusus pushed a commit to branch master
in repository texinfo.

The following commit(s) were added to refs/heads/master by this push:
     new 0afb4590ba * tp/Texinfo/XS/convert/convert_html.c 
(html_converter_initialize), tp/Texinfo/XS/main/get_perl_info.c 
(html_converter_initialize_sv): move code mapping variety names to index in 
global_units_directions to html_converter_initialize.
0afb4590ba is described below

commit 0afb4590baddc1ae10f8c70e8cb135c79295754a
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Mon Nov 6 00:30:00 2023 +0100

    * tp/Texinfo/XS/convert/convert_html.c (html_converter_initialize),
    tp/Texinfo/XS/main/get_perl_info.c (html_converter_initialize_sv):
    move code mapping variety names to index in global_units_directions
    to html_converter_initialize.
    
    * tp/Texinfo/XS/main/get_perl_info.c (html_converter_initialize_sv):
    convert style commands element to UTF-8.  Set converter HV only once.
---
 ChangeLog                            | 10 ++++++++++
 tp/Texinfo/XS/convert/convert_html.c | 22 ++++++++++++++++++++++
 tp/Texinfo/XS/main/get_perl_info.c   | 29 ++++++-----------------------
 3 files changed, 38 insertions(+), 23 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 086041315e..3436100ec2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2023-11-05  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/XS/convert/convert_html.c (html_converter_initialize),
+       tp/Texinfo/XS/main/get_perl_info.c (html_converter_initialize_sv):
+       move code mapping variety names to index in global_units_directions
+       to html_converter_initialize.
+
+       * tp/Texinfo/XS/main/get_perl_info.c (html_converter_initialize_sv):
+       convert style commands element to UTF-8.  Set converter HV only once.
+
 2023-11-05  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/XS/convert/convert_html.c (html_converter_initialize),
diff --git a/tp/Texinfo/XS/convert/convert_html.c 
b/tp/Texinfo/XS/convert/convert_html.c
index db5acaba53..5a5aabc840 100644
--- a/tp/Texinfo/XS/convert/convert_html.c
+++ b/tp/Texinfo/XS/convert/convert_html.c
@@ -2410,6 +2410,28 @@ html_converter_initialize (CONVERTER *self)
   memset (self->global_units_directions, 0,
     (D_Last + nr_special_units+1) * sizeof (OUTPUT_UNIT));
 
+  /* prepare mapping of variety names to index in global_units_directions */
+  self->varieties_direction_index = (VARIETY_DIRECTION_INDEX **)
+        malloc (sizeof (VARIETY_DIRECTION_INDEX *) * (nr_special_units +1));
+  if (nr_special_units)
+    {
+      STRING_LIST *special_unit_varieties = &self->special_unit_varieties;
+
+      for (i = 0; i < special_unit_varieties->number; i++)
+        {
+          VARIETY_DIRECTION_INDEX *variety_direction_index
+            = (VARIETY_DIRECTION_INDEX *)
+                 malloc (sizeof (VARIETY_DIRECTION_INDEX));
+          self->varieties_direction_index[i] = variety_direction_index;
+          variety_direction_index->special_unit_variety
+            = special_unit_varieties->list[i];
+          variety_direction_index->direction_index
+            = D_Last +1 +i;
+        }
+      self->varieties_direction_index[i] = 0;
+   }
+
+
   /* note that we allocate the same size as no_arg_formatted_cmd
      even though in general there are much less translated commands,
      for simplicity */
diff --git a/tp/Texinfo/XS/main/get_perl_info.c 
b/tp/Texinfo/XS/main/get_perl_info.c
index 499a06bd84..7736e6cc59 100644
--- a/tp/Texinfo/XS/main/get_perl_info.c
+++ b/tp/Texinfo/XS/main/get_perl_info.c
@@ -523,7 +523,7 @@ html_converter_initialize_sv (SV *converter_sv,
                               SV *default_output_units_conversion)
 {
   int i;
-  HV *hv_in;
+  HV *converter_hv;
   HV *default_formatting_references_hv;
   HV *default_css_string_formatting_references_hv;
   HV *default_commands_open_hv;
@@ -557,14 +557,14 @@ html_converter_initialize_sv (SV *converter_sv,
 
   converter = converter_initialize (converter_sv);
 
-  hv_in = (HV *)SvRV (converter_sv);
+  converter_hv = (HV *)SvRV (converter_sv);
 
   default_formatting_references_hv
     = (HV *)SvRV (default_formatting_references);
   default_css_string_formatting_references_hv
     = (HV *)SvRV (default_css_string_formatting_references);
 
-#define FETCH(key) key##_sv = hv_fetch (hv_in, #key, strlen(#key), 0);
+#define FETCH(key) key##_sv = hv_fetch (converter_hv, #key, strlen(#key), 0);
   FETCH(formatting_function);
 
   /* no need to check if it exists */
@@ -813,21 +813,6 @@ html_converter_initialize_sv (SV *converter_sv,
                 }
             }
         }
-      /* prepare mapping of variety names to index in global_units_directions 
*/
-      converter->varieties_direction_index = (VARIETY_DIRECTION_INDEX **)
-              malloc (sizeof (VARIETY_DIRECTION_INDEX *)
-                      * (special_unit_varieties->number +1));
-      for (j = 0; j < special_unit_varieties->number; j++)
-        {
-          VARIETY_DIRECTION_INDEX *variety_direction_index
-            = (VARIETY_DIRECTION_INDEX *) malloc (sizeof 
(VARIETY_DIRECTION_INDEX));
-          converter->varieties_direction_index[j] = variety_direction_index;
-          variety_direction_index->special_unit_variety
-            = special_unit_varieties->list[j];
-          variety_direction_index->direction_index
-            = D_Last +1 +j;
-        }
-      converter->varieties_direction_index[j] = 0;
     }
 
   FETCH(code_types)
@@ -1136,7 +1121,7 @@ html_converter_initialize_sv (SV *converter_sv,
                               if (!strcmp (key, "element"))
                                 {
                                   char *tmp_spec
-                                    = (char *) SvPVbyte_nolen (spec_sv);
+                                    = (char *) SvPVutf8_nolen (spec_sv);
                                   format_spec->element = strdup (tmp_spec);
                                 }
                               else if (!strcmp (key, "quote"))
@@ -1153,16 +1138,14 @@ html_converter_initialize_sv (SV *converter_sv,
 
   html_converter_initialize (converter);
 
+  converter->hv = converter_hv;
+
   converter_descriptor = register_converter (converter);
-  /* a fresh converter, registered */
-  converter = retrieve_converter (converter_descriptor);
 
   /* store converter_descriptor in perl converter */
-  HV *converter_hv = (HV *)SvRV(converter_sv);
   hv_store (converter_hv, "converter_descriptor",
             strlen("converter_descriptor"),
             newSViv (converter_descriptor), 0);
-  converter->hv = converter_hv;
 
   return converter_descriptor;
 }



reply via email to

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