texinfo-commits
[Top][All Lists]
Advanced

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

[no subject]


From: Patrice Dumas
Date: Sun, 29 Sep 2024 15:49:10 -0400 (EDT)

branch: master
commit 940f3a35d3404746db88a99222f2de20f0c2dc7e
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sun Sep 29 21:49:10 2024 +0200

    * tp/Texinfo/XS/convert/get_converter_perl_info.c
    (converter_set_document, converter_initialize)
    (reset_output_init_conf), tp/Texinfo/XS/main/get_perl_info.c: move
    converter_set_document, converter_initialize and
    reset_output_init_conf to get_converter_perl_info.c.
---
 ChangeLog                                       |  12 ++-
 tp/Texinfo/XS/convert/get_converter_perl_info.c | 111 ++++++++++++++++++++++++
 tp/Texinfo/XS/main/get_perl_info.c              | 111 ------------------------
 3 files changed, 121 insertions(+), 113 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 402d69054f..888e7e2faf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,10 @@
 2024-09-29  Patrice Dumas  <pertusus@free.fr>
 
-       * tp/Texinfo/XS/convert/convert_html.c (html_init_output): set
-       MATHJAX_CONFIGURATION.
+       * tp/Texinfo/XS/convert/get_converter_perl_info.c
+       (converter_set_document, converter_initialize)
+       (reset_output_init_conf), tp/Texinfo/XS/main/get_perl_info.c: move
+       converter_set_document, converter_initialize and
+       reset_output_init_conf to get_converter_perl_info.c.
 
 2024-07-07  Patrice Dumas  <pertusus@free.fr>
 
@@ -24,6 +27,11 @@
 
        * tp/Texinfo/XS/main/get_perl_info.c: minor changes.
 
+2024-09-29  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/XS/convert/convert_html.c (html_init_output): set
+       MATHJAX_CONFIGURATION.
+
 2024-07-07  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/XS/convert/converter.c (set_conf, force_conf)
diff --git a/tp/Texinfo/XS/convert/get_converter_perl_info.c 
b/tp/Texinfo/XS/convert/get_converter_perl_info.c
index 41cf34587b..c6e45be239 100644
--- a/tp/Texinfo/XS/convert/get_converter_perl_info.c
+++ b/tp/Texinfo/XS/convert/get_converter_perl_info.c
@@ -68,6 +68,33 @@ get_sv_converter (SV *sv_in, const char *warn_string)
   return converter;
 }
 
+void
+converter_set_document (SV *converter_in, SV *document_in)
+{
+  CONVERTER *converter;
+  DOCUMENT *document;
+
+  dTHX;
+
+  converter = get_sv_converter (converter_in, "converter_set_document");
+  document = get_sv_document_document (document_in, 0);
+
+   /*
+  if (document)
+    {
+      fprintf (stderr, "XS|CONVERTER %d: Document %d\n",
+           converter->converter_descriptor, document->descriptor);
+    }
+    */
+
+  converter->document = document;
+
+  set_output_encoding (converter->conf, converter->document);
+
+  converter->convert_text_options
+    = copy_converter_options_for_convert_text (converter);
+}
+
 void
 set_translated_commands (CONVERTER *converter, HV *hv_in)
 {
@@ -152,6 +179,90 @@ get_expanded_formats (HV *hv, EXPANDED_FORMAT 
**expanded_formats)
     }
 }
 
+/* Texinfo::Convert::Converter generic initialization for all the converters */
+/* Called early, in particuliar before any format specific code has been
+   called */
+int
+converter_initialize (SV *converter_sv)
+{
+  HV *hv_in;
+  SV **configured_sv;
+  SV **output_format_sv;
+  size_t converter_descriptor = 0;
+  CONVERTER *converter;
+
+  dTHX;
+
+  converter_descriptor = new_converter ();
+  converter = retrieve_converter (converter_descriptor);
+
+  hv_in = (HV *)SvRV (converter_sv);
+
+#define FETCH(key) key##_sv = hv_fetch (hv_in, #key, strlen (#key), 0);
+  FETCH(output_format)
+
+  if (output_format_sv && SvOK (*output_format_sv))
+    {
+      converter->output_format
+         = non_perl_strdup (SvPVutf8_nolen (*output_format_sv));
+    }
+
+   /*
+  fprintf (stderr, "XS|CONVERTER Init: %zu; %s\n", converter_descriptor,
+                   converter->output_format);
+    */
+
+  converter->conf = new_options ();
+  /* force is not set, but at this point, the configured field should not
+     be set, so it would not have an effect anyway */
+  copy_converter_conf_sv (hv_in, converter, &converter->conf, "conf", 0);
+
+  converter->init_conf = new_options ();
+  copy_converter_conf_sv (hv_in, converter, &converter->init_conf,
+                                              "converter_init_conf", 1);
+
+  FETCH(configured);
+
+
+  if (configured_sv && SvOK (*configured_sv))
+    {
+      get_sv_configured_options (*configured_sv, converter->conf);
+    }
+
+#undef FETCH
+  set_translated_commands (converter, hv_in);
+
+  get_expanded_formats (hv_in, &converter->expanded_formats);
+
+  converter->hv = hv_in;
+
+  /* store converter_descriptor in perl converter */
+  hv_store (hv_in, "converter_descriptor",
+            strlen ("converter_descriptor"),
+            newSViv (converter_descriptor), 0);
+
+  return converter_descriptor;
+}
+
+/* reset output_init_conf.  Can be called after it has been modified */
+void
+reset_output_init_conf (SV *sv_in)
+{
+  CONVERTER *converter;
+
+  dTHX;
+
+  converter = get_sv_converter (sv_in, "reset_output_init_conf");
+
+  if (converter)
+    {
+      HV *hv_in = (HV *)SvRV (sv_in);
+
+      copy_converter_conf_sv (hv_in, converter, &converter->init_conf,
+                             "output_init_conf", 1);
+    }
+}
+
 /* output format specific */
 
 /* map hash reference of Convert::Text options to TEXT_OPTIONS */
diff --git a/tp/Texinfo/XS/main/get_perl_info.c 
b/tp/Texinfo/XS/main/get_perl_info.c
index 5b5e194ea1..63618f2608 100644
--- a/tp/Texinfo/XS/main/get_perl_info.c
+++ b/tp/Texinfo/XS/main/get_perl_info.c
@@ -459,117 +459,6 @@ copy_converter_conf_sv (HV *hv, CONVERTER *converter,
     }
 }
 
-void
-converter_set_document (SV *converter_in, SV *document_in)
-{
-  CONVERTER *converter;
-  DOCUMENT *document;
-
-  dTHX;
-
-  converter = get_sv_converter (converter_in, "converter_set_document");
-  document = get_sv_document_document (document_in, 0);
-
-   /*
-  if (document)
-    {
-      fprintf (stderr, "XS|CONVERTER %d: Document %d\n",
-           converter->converter_descriptor, document->descriptor);
-    }
-    */
-
-  converter->document = document;
-
-  set_output_encoding (converter->conf, converter->document);
-
-  converter->convert_text_options
-    = copy_converter_options_for_convert_text (converter);
-}
-
-/* Texinfo::Convert::Converter generic initialization for all the converters */
-/* Called early, in particuliar before any format specific code has been
-   called */
-int
-converter_initialize (SV *converter_sv)
-{
-  HV *hv_in;
-  SV **configured_sv;
-  SV **output_format_sv;
-  size_t converter_descriptor = 0;
-  CONVERTER *converter;
-
-  dTHX;
-
-  converter_descriptor = new_converter ();
-  converter = retrieve_converter (converter_descriptor);
-
-  hv_in = (HV *)SvRV (converter_sv);
-
-#define FETCH(key) key##_sv = hv_fetch (hv_in, #key, strlen (#key), 0);
-  FETCH(output_format)
-
-  if (output_format_sv && SvOK (*output_format_sv))
-    {
-      converter->output_format
-         = non_perl_strdup (SvPVutf8_nolen (*output_format_sv));
-    }
-
-   /*
-  fprintf (stderr, "XS|CONVERTER Init: %zu; %s\n", converter_descriptor,
-                   converter->output_format);
-    */
-
-  converter->conf = new_options ();
-  /* force is not set, but at this point, the configured field should not
-     be set, so it would not have an effect anyway */
-  copy_converter_conf_sv (hv_in, converter, &converter->conf, "conf", 0);
-
-  converter->init_conf = new_options ();
-  copy_converter_conf_sv (hv_in, converter, &converter->init_conf,
-                                              "converter_init_conf", 1);
-
-  FETCH(configured);
-
-
-  if (configured_sv && SvOK (*configured_sv))
-    {
-      get_sv_configured_options (*configured_sv, converter->conf);
-    }
-
-#undef FETCH
-  set_translated_commands (converter, hv_in);
-
-  get_expanded_formats (hv_in, &converter->expanded_formats);
-
-  converter->hv = hv_in;
-
-  /* store converter_descriptor in perl converter */
-  hv_store (hv_in, "converter_descriptor",
-            strlen ("converter_descriptor"),
-            newSViv (converter_descriptor), 0);
-
-  return converter_descriptor;
-}
-
-/* reset output_init_conf.  Can be called after it has been modified */
-void
-reset_output_init_conf (SV *sv_in)
-{
-  CONVERTER *converter;
-
-  dTHX;
-
-  converter = get_sv_converter (sv_in, "reset_output_init_conf");
-
-  if (converter)
-    {
-      HV *hv_in = (HV *)SvRV (sv_in);
-
-      copy_converter_conf_sv (hv_in, converter, &converter->init_conf,
-                             "output_init_conf", 1);
-    }
-}
-
 INDEX_ENTRY *
 find_index_entry_sv (const SV *index_entry_sv, INDEX_LIST *indices_info,
                      const char *warn_string, const INDEX **entry_idx,



reply via email to

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