texinfo-commits
[Top][All Lists]
Advanced

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

[no subject]


From: Patrice Dumas
Date: Wed, 2 Oct 2024 07:35:42 -0400 (EDT)

branch: master
commit 16b6d9a3c6c07365371112a97cd3f34da4fe5552
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Wed Jul 31 17:10:31 2024 +0200

    * tp/Texinfo/XS/convert/ConvertXS.xs (html_converter_initialize_sv),
    tp/Texinfo/XS/convert/get_html_perl_info.c
    (html_converter_initialize_sv): move call to html_converter_initialize
    and copy_converter_conf_sv out of get_html_perl_info.c to
    ConvertXS.xs.
    
    * tp/Texinfo/Convert/HTML.pm (converter_initialize),
    tp/Texinfo/XS/convert/ConvertXS.xs (html_converter_initialize_sv),
    p/Texinfo/XS/convert/get_html_perl_info.c
    (html_converter_initialize_sv): pass
    customized_no_arg_commands_formatting as an argument.
---
 ChangeLog                                  | 14 +++++++
 tp/Texinfo/Convert/HTML.pm                 | 14 ++++---
 tp/Texinfo/XS/convert/ConvertXS.xs         | 67 ++++++++++++++++++------------
 tp/Texinfo/XS/convert/get_html_perl_info.c | 19 +++------
 tp/Texinfo/XS/convert/get_html_perl_info.h |  1 +
 5 files changed, 69 insertions(+), 46 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 6f37fc5c03..7ee9945dc3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2024-07-31  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/XS/convert/ConvertXS.xs (html_converter_initialize_sv),
+       tp/Texinfo/XS/convert/get_html_perl_info.c
+       (html_converter_initialize_sv): move call to html_converter_initialize
+       and copy_converter_conf_sv out of get_html_perl_info.c to
+       ConvertXS.xs.
+
+       * tp/Texinfo/Convert/HTML.pm (converter_initialize),
+       tp/Texinfo/XS/convert/ConvertXS.xs (html_converter_initialize_sv),
+       p/Texinfo/XS/convert/get_html_perl_info.c
+       (html_converter_initialize_sv): pass
+       customized_no_arg_commands_formatting as an argument.
+
 2024-07-31  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/XS/convert/convert_html.c (accent_cmd, html_format_setup)
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index f412fbb6dc..a4fed373e1 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -8745,7 +8745,7 @@ my %special_characters = (
   'non_breaking_space' => [$xml_named_entity_nbsp, '00A0'],
 );
 
-sub _XS_html_converter_initialize($$$$$$$$$$$$$$$$$)
+sub _XS_html_converter_initialize($$$$$$$$$$$$$$$$$$)
 {
 }
 
@@ -8943,20 +8943,23 @@ sub converter_initialize($)
 
   # get customization only at that point, as the defaults may be changed
   # with the encoding
-  $self->{'customized_no_arg_commands_formatting'} = {};
+  my $customized_no_arg_commands_formatting = {};
   foreach my $command (keys(%{$default_no_arg_commands_formatting{'normal'}})) 
{
-    $self->{'customized_no_arg_commands_formatting'}->{$command} = {};
+    $customized_no_arg_commands_formatting->{$command} = {};
     foreach my $context (@no_args_commands_contexts) {
       my $no_arg_command_customized_formatting
         = Texinfo::Config::GNUT_get_no_arg_command_formatting($command,
                                                               $context);
       if (defined($no_arg_command_customized_formatting)) {
-        
$self->{'customized_no_arg_commands_formatting'}->{$command}->{$context}
+        $customized_no_arg_commands_formatting->{$command}->{$context}
            = $no_arg_command_customized_formatting;
       }
     }
   }
 
+  $self->{'customized_no_arg_commands_formatting'}
+    = $customized_no_arg_commands_formatting;
+
   $self->{'file_id_setting'} = {};
   my $customized_file_id_setting_references
     = Texinfo::Config::GNUT_get_file_id_setting_references();
@@ -9148,7 +9151,8 @@ sub converter_initialize($)
                              $customized_upper_case_commands,
                              $customized_type_formatting,
                              \%customized_accent_entities,
-                     \%style_commands_customized_formatting_info,
+                             \%style_commands_customized_formatting_info,
+                             $customized_no_arg_commands_formatting,
                              $customized_special_unit_info,
                              $customized_direction_strings
                             );
diff --git a/tp/Texinfo/XS/convert/ConvertXS.xs 
b/tp/Texinfo/XS/convert/ConvertXS.xs
index 6077b37937..aadfed4e89 100644
--- a/tp/Texinfo/XS/convert/ConvertXS.xs
+++ b/tp/Texinfo/XS/convert/ConvertXS.xs
@@ -579,36 +579,49 @@ void
 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_special_unit_body, SV 
*customized_upper_case_commands, SV *customized_type_formatting, SV 
*customized_accent_entiti [...]
+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_special_unit_body, SV 
*customized_upper_case_commands, SV *customized_type_formatting, SV 
*customized_accent_entiti [...]
       PREINIT:
         CONVERTER *self;
+        HV *converter_hv;
       CODE:
-         self = get_sv_converter (converter_in, 
"html_converter_initialize_sv");
-
-         /* initialize first the special unit info, as the special unit
-            directions are needed for the remainder of initialization.
-            Therefore special unit Perl customization needs to be read
-            and special unit initialization in C code needs to be run
-            too before doing the remaining */
-         html_converter_init_special_unit_sv (converter_in,
-                                              customized_special_unit_info);
-         html_converter_init_special_unit (self);
-         html_converter_initialize_sv (converter_in,
-                          default_formatting_references,
-                          default_css_string_formatting_references,
-                          default_commands_open,
-                          default_commands_conversion,
-                          default_css_string_commands_conversion,
-                          default_types_open,
-                          default_types_conversion,
-                          default_css_string_types_conversion,
-                          default_output_units_conversion,
-                          default_special_unit_body,
-                          customized_upper_case_commands,
-                          customized_type_formatting,
-                          customized_accent_entities,
-                          customized_style_commands,
-                          customized_direction_strings);
+        self = get_sv_converter (converter_in, "html_converter_initialize_sv");
+
+        converter_hv = (HV *)SvRV (converter_in);
+
+        /* initialize first the special unit info, as the special unit
+           directions are needed for the remainder of initialization.
+           Therefore special unit Perl customization needs to be read
+           and special unit initialization in C code needs to be run
+           too before doing the remaining */
+        html_converter_init_special_unit_sv (converter_in,
+                                             customized_special_unit_info);
+        html_converter_init_special_unit (self);
+        html_converter_initialize_sv (converter_in,
+                         default_formatting_references,
+                         default_css_string_formatting_references,
+                         default_commands_open,
+                         default_commands_conversion,
+                         default_css_string_commands_conversion,
+                         default_types_open,
+                         default_types_conversion,
+                         default_css_string_types_conversion,
+                         default_output_units_conversion,
+                         default_special_unit_body,
+                         customized_upper_case_commands,
+                         customized_type_formatting,
+                         customized_accent_entities,
+                         customized_style_commands,
+                         customized_no_arg_commands_formatting,
+                         customized_direction_strings);
+
+        html_converter_initialize (self);
+
+   /* at that point, the format specific informations, in particular the number
+      of special elements is available, such that all the options can be
+      passed to C.  It is important to set the force argument to 1 to get
+      all the configuration, even if the configured field is set */
+        copy_converter_conf_sv (converter_hv, self,
+                                &self->conf, "conf", 1);
 
 
 void
diff --git a/tp/Texinfo/XS/convert/get_html_perl_info.c 
b/tp/Texinfo/XS/convert/get_html_perl_info.c
index 2fdbc9d144..38e0e5d3ad 100644
--- a/tp/Texinfo/XS/convert/get_html_perl_info.c
+++ b/tp/Texinfo/XS/convert/get_html_perl_info.c
@@ -229,6 +229,7 @@ html_converter_initialize_sv (SV *converter_sv,
                               SV *customized_type_formatting,
                               SV *customized_accent_entities,
                               SV *customized_style_commands,
+                              SV *customized_no_arg_commands_formatting,
                               SV *customized_direction_strings
                              )
 {
@@ -251,7 +252,6 @@ html_converter_initialize_sv (SV *converter_sv,
   SV **types_conversion_sv;
   SV **commands_open_sv;
   SV **commands_conversion_sv;
-  SV **customized_no_arg_commands_formatting_sv;
   SV **output_units_conversion_sv;
   SV **file_id_setting_sv;
   HV *formatting_function_hv;
@@ -602,14 +602,13 @@ html_converter_initialize_sv (SV *converter_sv,
         }
     }
 
-#define FETCH(key) key##_sv = hv_fetch (converter_hv, #key, strlen (#key), 0);
-  FETCH(customized_no_arg_commands_formatting)
-  if (customized_no_arg_commands_formatting_sv)
+  if (customized_no_arg_commands_formatting
+      && SvOK (customized_no_arg_commands_formatting))
     {
       I32 hv_number;
       I32 i;
       HV *customized_no_arg_commands_formatting_hv
-        = (HV *) SvRV (*customized_no_arg_commands_formatting_sv);
+        = (HV *) SvRV (customized_no_arg_commands_formatting);
 
       hv_number = hv_iterinit (customized_no_arg_commands_formatting_hv);
 
@@ -877,6 +876,7 @@ html_converter_initialize_sv (SV *converter_sv,
         }
     }
 
+#define FETCH(key) key##_sv = hv_fetch (converter_hv, #key, strlen (#key), 0);
   FETCH(htmlxref)
 
   if (htmlxref_sv)
@@ -1246,15 +1246,6 @@ html_converter_initialize_sv (SV *converter_sv,
             }
         }
     }
-
-  html_converter_initialize (converter);
-
-  /* at that point, the format specific informations, in particular the number
-     of special elements is available, such that all the options can be
-     passed to C.  It is important to set the force argument to 1 to get
-     all the configuration, even if the configured field is set */
-  copy_converter_conf_sv (converter_hv, converter,
-                          &converter->conf, "conf", 1);
 }
 
 /* not used, the initialization is done in C, with customization taken
diff --git a/tp/Texinfo/XS/convert/get_html_perl_info.h 
b/tp/Texinfo/XS/convert/get_html_perl_info.h
index 19f4b0e407..36503b10da 100644
--- a/tp/Texinfo/XS/convert/get_html_perl_info.h
+++ b/tp/Texinfo/XS/convert/get_html_perl_info.h
@@ -26,6 +26,7 @@ void html_converter_initialize_sv (SV *converter_sv,
                                   SV *customized_type_formatting,
                                   SV *customized_accent_entities,
                                   SV *customized_style_commands,
+                                  SV *customized_no_arg_commands_formatting,
                                   SV *customized_direction_strings
                                   );
 



reply via email to

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