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/ConvertXS.xs (html_prepar


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/XS/convert/ConvertXS.xs (html_prepare_conversion_units), tp/Texinfo/XS/convert/build_html_perl_state.c (html_pass_conversion_output_units): move code setting Perl data from html_prepare_conversion_units to a new function, html_pass_conversion_output_units.
Date: Tue, 01 Oct 2024 11:54:47 -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 9652f26e7f * tp/Texinfo/XS/convert/ConvertXS.xs 
(html_prepare_conversion_units), tp/Texinfo/XS/convert/build_html_perl_state.c 
(html_pass_conversion_output_units): move code setting Perl data from 
html_prepare_conversion_units to a new function, 
html_pass_conversion_output_units.
9652f26e7f is described below

commit 9652f26e7f39ae2f12c753b002a037fde7986ecd
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Wed Jul 24 15:48:10 2024 +0200

    * tp/Texinfo/XS/convert/ConvertXS.xs (html_prepare_conversion_units),
    tp/Texinfo/XS/convert/build_html_perl_state.c
    (html_pass_conversion_output_units): move code setting Perl data from
    html_prepare_conversion_units to a new function,
    html_pass_conversion_output_units.
    
    * tp/Texinfo/XS/convert/ConvertXS.xs
    (html_prepare_units_directions_files),
    tp/Texinfo/XS/convert/build_html_perl_state.c
    (html_pass_units_directions_files): move code setting Perl data from
    html_prepare_units_directions_files to a new function,
    html_pass_units_directions_files.
---
 ChangeLog                                     | 15 +++++
 tp/Texinfo/XS/convert/ConvertXS.xs            | 71 ++---------------------
 tp/Texinfo/XS/convert/build_html_perl_state.c | 83 +++++++++++++++++++++++++++
 tp/Texinfo/XS/convert/build_html_perl_state.h |  9 +++
 4 files changed, 113 insertions(+), 65 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 85b09fb8b5..7aa354c405 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,21 @@
        (call_formatting_function_format_single_footnote): check and reset
        flags in build_html_formatting_state.
 
+2024-07-24  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/XS/convert/ConvertXS.xs (html_prepare_conversion_units),
+       tp/Texinfo/XS/convert/build_html_perl_state.c
+       (html_pass_conversion_output_units): move code setting Perl data from
+       html_prepare_conversion_units to a new function,
+       html_pass_conversion_output_units.
+
+       * tp/Texinfo/XS/convert/ConvertXS.xs
+       (html_prepare_units_directions_files),
+       tp/Texinfo/XS/convert/build_html_perl_state.c
+       (html_pass_units_directions_files): move code setting Perl data from
+       html_prepare_units_directions_files to a new function,
+       html_pass_units_directions_files.
+
 2024-07-24  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/Convert/HTML.pm (_prepare_converted_output_info)
diff --git a/tp/Texinfo/XS/convert/ConvertXS.xs 
b/tp/Texinfo/XS/convert/ConvertXS.xs
index 3e21c8c246..65d2575192 100644
--- a/tp/Texinfo/XS/convert/ConvertXS.xs
+++ b/tp/Texinfo/XS/convert/ConvertXS.xs
@@ -2123,56 +2123,19 @@ void
 html_prepare_conversion_units (SV *converter_in, ...)
       PROTOTYPE: $$$
       PREINIT:
-         HV *converter_hv;
          CONVERTER *self;
          SV *output_units_sv;
          SV *special_units_sv;
          SV *associated_special_units_sv;
-         HV *output_units_hv;
       PPCODE:
          self = get_sv_converter (converter_in,
                                   "html_prepare_conversion_units");
 
-         converter_hv = (HV *) SvRV (converter_in);
-
          html_prepare_conversion_units (self);
 
-         if (self->external_references_number > 0)
-           {
-         /* need to setup the Perl tree before rebuilding the output units as
-            they refer to Perl root command elements */
-             SV **document_sv
-               = hv_fetch (converter_hv, "document", strlen ("document"), 0);
-             if (document_sv)
-               {
-                 HV *document_hv = (HV *) SvRV (*document_sv);
-                 store_texinfo_tree (self->document, document_hv);
-               }
-
-             output_units_sv = build_output_units_list
-               (self->document, self->output_units_descriptors[OUDT_units]);
-             special_units_sv = build_output_units_list
-               (self->document,
-                self->output_units_descriptors[OUDT_special_units]);
-             associated_special_units_sv = build_output_units_list
-               (self->document,
-                self->output_units_descriptors[OUDT_associated_special_units]);
-           }
-         else
-           {
-             output_units_sv = setup_output_units_handler
-               (self->document, self->output_units_descriptors[OUDT_units]);
-             special_units_sv = setup_output_units_handler
-               (self->document,
-                self->output_units_descriptors[OUDT_special_units]);
-             associated_special_units_sv = setup_output_units_handler
-               (self->document,
-                self->output_units_descriptors[OUDT_associated_special_units]);
-           }
-
-         output_units_hv = (HV *) SvRV (output_units_sv);
-         hv_store (converter_hv, "document_units", strlen ("document_units"),
-                   newRV_inc ((SV *) output_units_hv), 0);
+         html_pass_conversion_output_units (self, converter_in,
+                                      &output_units_sv, &special_units_sv,
+                                      &associated_special_units_sv);
 
          /* calls Perl customization functions, so need to be done after
             build_output_units_list calls to be able to retrieve Perl
@@ -2202,31 +2165,9 @@ html_prepare_units_directions_files (SV *converter_in, 
SV *output_units_in, SV *
                     output_file, destination_directory, output_filename,
                                  document_name);
 
-         if (self->external_references_number > 0)
-           {
-             /* build external_nodes_units before rebuilding the other
-                output units as the external_nodes_units have never been built,
-                while other units were already built without directions
-                information in html_prepare_conversion_units */
-             output_units_list_to_perl_hash (self->document,
-                   self->output_units_descriptors[OUDT_external_nodes_units]);
-
-             rebuild_output_units_list (self->document, output_units_in,
-                           self->output_units_descriptors[OUDT_units]);
-             rebuild_output_units_list (self->document, special_units_in,
-                      self->output_units_descriptors[OUDT_special_units]);
-             rebuild_output_units_list (self->document,
-                                        associated_special_units_in,
-                self->output_units_descriptors[OUDT_associated_special_units]);
-
-             html_setup_global_units_direction_names (self);
-
-             pass_html_elements_in_file_count (converter_in,
-                                               &self->output_unit_files);
-
-             /* file names API */
-             pass_output_unit_files (converter_in, &self->output_unit_files);
-           }
+         html_pass_units_directions_files (self, converter_in, output_units_in,
+                                           special_units_in,
+                                           associated_special_units_in);
 
          RETVAL = newSV (0);
     OUTPUT:
diff --git a/tp/Texinfo/XS/convert/build_html_perl_state.c 
b/tp/Texinfo/XS/convert/build_html_perl_state.c
index d0ebf99192..8fb3e8f77e 100644
--- a/tp/Texinfo/XS/convert/build_html_perl_state.c
+++ b/tp/Texinfo/XS/convert/build_html_perl_state.c
@@ -402,6 +402,55 @@ pass_html_global_units_directions (SV *converter_sv,
             strlen ("global_units_directions"), global_units_directions_sv, 0);
 }
 
+void
+html_pass_conversion_output_units (CONVERTER *converter, SV *converter_sv,
+                                   SV **output_units_sv, SV **special_units_sv,
+                                   SV **associated_special_units_sv)
+{
+  HV *converter_hv;
+
+  dTHX;
+
+  converter_hv = (HV *) SvRV (converter_sv);
+
+  if (converter->external_references_number > 0)
+    {
+ /* need to setup the Perl tree before rebuilding the output units as
+    they refer to Perl root command elements */
+      SV **document_sv
+        = hv_fetch (converter_hv, "document", strlen ("document"), 0);
+      if (document_sv)
+        {
+          HV *document_hv = (HV *) SvRV (*document_sv);
+          store_texinfo_tree (converter->document, document_hv);
+        }
+
+      *output_units_sv = build_output_units_list
+        (converter->document, converter->output_units_descriptors[OUDT_units]);
+      *special_units_sv = build_output_units_list
+        (converter->document,
+         converter->output_units_descriptors[OUDT_special_units]);
+      *associated_special_units_sv = build_output_units_list
+        (converter->document,
+         converter->output_units_descriptors[OUDT_associated_special_units]);
+    }
+  else
+    {
+      *output_units_sv = setup_output_units_handler
+        (converter->document, converter->output_units_descriptors[OUDT_units]);
+      *special_units_sv = setup_output_units_handler
+        (converter->document,
+         converter->output_units_descriptors[OUDT_special_units]);
+      *associated_special_units_sv = setup_output_units_handler
+        (converter->document,
+         converter->output_units_descriptors[OUDT_associated_special_units]);
+    }
+
+  SvREFCNT_inc (*output_units_sv);
+  hv_store (converter_hv, "document_units", strlen ("document_units"),
+            *output_units_sv, 0);
+}
+
 HV *
 build_html_elements_in_file_count (
                  FILE_NAME_PATH_COUNTER_LIST *output_unit_files)
@@ -449,6 +498,40 @@ pass_html_elements_in_file_count (SV *converter_sv,
             newRV_noinc ((SV *) elements_in_file_count_hv), 0);
 }
 
+
+void
+html_pass_units_directions_files (CONVERTER *converter,
+                                  SV *converter_sv, SV *output_units_sv,
+                                  SV *special_units_sv,
+                                  SV *associated_special_units_sv)
+{
+  if (converter->external_references_number > 0)
+    {
+      /* build external_nodes_units before rebuilding the other
+         output units as the external_nodes_units have never been built,
+         while other units were already built without directions
+         information in html_prepare_conversion_units */
+      output_units_list_to_perl_hash (converter->document,
+            converter->output_units_descriptors[OUDT_external_nodes_units]);
+
+      rebuild_output_units_list (converter->document, output_units_sv,
+                    converter->output_units_descriptors[OUDT_units]);
+      rebuild_output_units_list (converter->document, special_units_sv,
+               converter->output_units_descriptors[OUDT_special_units]);
+      rebuild_output_units_list (converter->document,
+                                 associated_special_units_sv,
+         converter->output_units_descriptors[OUDT_associated_special_units]);
+
+      html_setup_global_units_direction_names (converter);
+
+      pass_html_elements_in_file_count (converter_sv,
+                                        &converter->output_unit_files);
+
+      /* file names API */
+      pass_output_unit_files (converter_sv, &converter->output_unit_files);
+    }
+}
+
 void
 build_html_translated_names (HV *hv, CONVERTER *converter)
 {
diff --git a/tp/Texinfo/XS/convert/build_html_perl_state.h 
b/tp/Texinfo/XS/convert/build_html_perl_state.h
index 92571d58ed..7bdf2ced2c 100644
--- a/tp/Texinfo/XS/convert/build_html_perl_state.h
+++ b/tp/Texinfo/XS/convert/build_html_perl_state.h
@@ -21,6 +21,15 @@ void html_pass_converter_initialization_state (const 
CONVERTER *converter,
 void html_pass_converter_setup_state (const CONVERTER *converter,
                                       SV *converter_sv);
 
+void html_pass_conversion_output_units (CONVERTER *converter, SV *converter_sv,
+                                   SV **output_units_sv, SV **special_units_sv,
+                                   SV **associated_special_units_sv);
+
+void html_pass_units_directions_files (CONVERTER *converter,
+                                  SV *converter_sv, SV *output_units_sv,
+                                  SV *special_units_sv,
+                                  SV *associated_special_units_sv);
+
 SV *build_html_files_source_info
                           (const FILE_SOURCE_INFO_LIST *files_source_info);
 void pass_html_global_units_directions (SV *converter_sv,



reply via email to

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