[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
From: |
Patrice Dumas |
Date: |
Tue, 1 Oct 2024 11:22:38 -0400 (EDT) |
branch: master
commit 6146d84a34ae755e10fd4f416b92c1cc8dfd0823
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Wed Jul 24 12:32:22 2024 +0200
* tp/Texinfo/XS/convert/get_html_perl_info.c (html_get_jslicenses_sv)
(html_converter_prepare_output_sv): split html_get_jslicenses_sv out
of html_converter_prepare_output_sv.
---
ChangeLog | 6 ++
tp/Texinfo/Convert/HTML.pm | 4 -
tp/Texinfo/XS/convert/ConvertXS.xs | 4 +
tp/Texinfo/XS/convert/get_html_perl_info.c | 166 +++++++++++++++--------------
4 files changed, 97 insertions(+), 83 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 23308ecb71..e9abea0414 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,12 @@
(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/get_html_perl_info.c (html_get_jslicenses_sv)
+ (html_converter_prepare_output_sv): split html_get_jslicenses_sv out
+ of html_converter_prepare_output_sv.
+
2024-07-24 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/XS/convert/ConvertXS.xs (html_internal_command_text):
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index 6d357e8d85..85d94937e0 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -13473,15 +13473,12 @@ sub output($$)
= @$paths;
# Get the list of output units to be processed.
- # Customization information in $self->{'conf'} is passed to XS code too.
my ($output_units, $special_units, $associated_special_units)
= $self->_prepare_conversion_units($document, $document_name);
# setup untranslated strings
$self->_translate_names();
- # Output units lists are rebuilt in the XS code so there is no need to call
- # rebuild_output_units.
my $files_source_info
= $self->_prepare_units_directions_files($output_units, $special_units,
$associated_special_units,
@@ -13526,7 +13523,6 @@ sub output($$)
return undef;
}
- # information settable by customization files is passed to XS too
$self->_prepare_title_titlepage($output_file, $output_filename,
$output_units);
diff --git a/tp/Texinfo/XS/convert/ConvertXS.xs
b/tp/Texinfo/XS/convert/ConvertXS.xs
index a801b098f4..9d9073551f 100644
--- a/tp/Texinfo/XS/convert/ConvertXS.xs
+++ b/tp/Texinfo/XS/convert/ConvertXS.xs
@@ -2186,6 +2186,7 @@ html_prepare_conversion_units (SV *converter_in, ...)
PUSHs(sv_2mortal(special_units_sv));
PUSHs(sv_2mortal(associated_special_units_sv));
+# Called in output, not in convert
# the return value is not really used with XS, it is passed to another
# XS function, but the value is ignored there.
SV *
@@ -2233,6 +2234,9 @@ html_prepare_units_directions_files (SV *converter_in, SV
*output_units_in, SV *
OUTPUT:
RETVAL
+# Called in convert.
+# Not called through output, as the Perl function is only called from
+# an overriden function in that case.
void
html_prepare_output_units_global_targets (SV *converter_in, SV
*output_units_in, SV *special_units_in, SV *associated_special_units_in)
PREINIT:
diff --git a/tp/Texinfo/XS/convert/get_html_perl_info.c
b/tp/Texinfo/XS/convert/get_html_perl_info.c
index 911fb90474..03fdb6e0bb 100644
--- a/tp/Texinfo/XS/convert/get_html_perl_info.c
+++ b/tp/Texinfo/XS/convert/get_html_perl_info.c
@@ -1501,7 +1501,93 @@ html_conversion_initialization_sv (SV *converter_sv,
CONVERTER *converter)
}
}
}
+}
+
+/* get jslicenses from Perl */
+void
+html_get_jslicenses_sv (SV *jslicenses_sv, CONVERTER *converter)
+{
+ I32 hv_number;
+ I32 i;
+ HV *jslicenses_hv;
+
+ dTHX;
+
+ jslicenses_hv = (HV *)SvRV (jslicenses_sv);
+
+ hv_number = hv_iterinit (jslicenses_hv);
+
+ if (hv_number > 0)
+ {
+ initialize_js_categories_list (&converter->jslicenses, hv_number);
+
+ for (i = 0; i < hv_number; i++)
+ {
+ I32 hv_files_number;
+ I32 j;
+ HE *next = hv_iternext (jslicenses_hv);
+ SV *category_sv = hv_iterkeysv (next);
+ const char *category = (char *) SvPVutf8_nolen (category_sv);
+ SV *files_info_sv = HeVAL(next);
+ HV *files_info_hv = (HV *)SvRV (files_info_sv);
+
+ JSLICENSE_FILE_INFO_LIST *jslicences_files_info
+ = &converter->jslicenses.list[i];
+ hv_files_number = hv_iterinit (files_info_hv);
+
+ initialize_jslicense_files (jslicences_files_info, category,
+ hv_files_number);
+
+ for (j = 0; j < hv_files_number; j++)
+ {
+ HE *next_file = hv_iternext (files_info_hv);
+ SV *filename_sv = hv_iterkeysv (next);
+ char *filename = (char *) SvPVutf8_nolen (filename_sv);
+ SV *file_info_sv = HeVAL(next_file);
+ AV *file_info_av = (AV *)SvRV (file_info_sv);
+ SSize_t file_info_nr;
+ SV **license_sv;
+ SV **url_sv;
+ SV **source_sv;
+
+ JSLICENSE_FILE_INFO *jslicense_file_info
+ = &jslicences_files_info->list[j];
+ jslicense_file_info->filename = non_perl_strdup (filename);
+
+ file_info_nr = av_top_index (file_info_av) +1;
+ if (file_info_nr != 3)
+ {
+ fprintf (stderr,
+ "BUG: %s: %s: jslicence file needs 3 item: %zu\n",
+ category, filename, file_info_nr);
+ continue;
+ }
+ license_sv = av_fetch (file_info_av, 0, 0);
+ if (license_sv && SvOK (*license_sv))
+ {
+ const char *license
+ = (char *) SvPVutf8_nolen (*license_sv);
+ jslicense_file_info->license
+ = non_perl_strdup (license);
+ }
+ url_sv = av_fetch (file_info_av, 1, 0);
+ if (url_sv && SvOK (*url_sv))
+ {
+ const char *url = (char *) SvPVutf8_nolen (*url_sv);
+ jslicense_file_info->url = non_perl_strdup (url);
+ }
+ source_sv = av_fetch (file_info_av, 2, 0);
+ if (source_sv && SvOK (*source_sv))
+ {
+ const char *source
+ = (char *) SvPVutf8_nolen (*source_sv);
+ jslicense_file_info->source
+ = non_perl_strdup (source);
+ }
+ }
+ }
+ }
}
void
@@ -1521,87 +1607,9 @@ html_converter_prepare_output_sv (SV *converter_sv,
CONVERTER *converter)
HV *converter_info_hv = (HV *)SvRV (*converter_info_sv);
SV **jslicenses_sv = hv_fetch (converter_info_hv, "jslicenses",
strlen ("jslicenses"), 0);
-
if (jslicenses_sv)
{
- I32 hv_number;
- I32 i;
-
- HV *jslicenses_hv = (HV *)SvRV (*jslicenses_sv);
-
- hv_number = hv_iterinit (jslicenses_hv);
-
- if (hv_number > 0)
- {
- initialize_js_categories_list (&converter->jslicenses,
hv_number);
-
- for (i = 0; i < hv_number; i++)
- {
- I32 hv_files_number;
- I32 j;
- HE *next = hv_iternext (jslicenses_hv);
- SV *category_sv = hv_iterkeysv (next);
- const char *category = (char *) SvPVutf8_nolen (category_sv);
- SV *files_info_sv = HeVAL(next);
- HV *files_info_hv = (HV *)SvRV (files_info_sv);
-
- JSLICENSE_FILE_INFO_LIST *jslicences_files_info
- = &converter->jslicenses.list[i];
-
- hv_files_number = hv_iterinit (files_info_hv);
-
- initialize_jslicense_files (jslicences_files_info, category,
- hv_files_number);
-
- for (j = 0; j < hv_files_number; j++)
- {
- HE *next_file = hv_iternext (files_info_hv);
- SV *filename_sv = hv_iterkeysv (next);
- char *filename = (char *) SvPVutf8_nolen (filename_sv);
- SV *file_info_sv = HeVAL(next_file);
- AV *file_info_av = (AV *)SvRV (file_info_sv);
- SSize_t file_info_nr;
- SV **license_sv;
- SV **url_sv;
- SV **source_sv;
-
- JSLICENSE_FILE_INFO *jslicense_file_info
- = &jslicences_files_info->list[j];
- jslicense_file_info->filename = non_perl_strdup
(filename);
-
- file_info_nr = av_top_index (file_info_av) +1;
- if (file_info_nr != 3)
- {
- fprintf (stderr,
- "BUG: %s: %s: jslicence file needs 3 item:
%zu\n",
- category, filename, file_info_nr);
- continue;
- }
- license_sv = av_fetch (file_info_av, 0, 0);
- if (license_sv && SvOK (*license_sv))
- {
- const char *license
- = (char *) SvPVutf8_nolen (*license_sv);
- jslicense_file_info->license
- = non_perl_strdup (license);
- }
- url_sv = av_fetch (file_info_av, 1, 0);
- if (url_sv && SvOK (*url_sv))
- {
- const char *url = (char *) SvPVutf8_nolen (*url_sv);
- jslicense_file_info->url = non_perl_strdup (url);
- }
- source_sv = av_fetch (file_info_av, 2, 0);
- if (source_sv && SvOK (*source_sv))
- {
- const char *source
- = (char *) SvPVutf8_nolen (*source_sv);
- jslicense_file_info->source
- = non_perl_strdup (source);
- }
- }
- }
- }
+ html_get_jslicenses_sv (*jslicenses_sv, converter);
}
}
html_converter_prepare_output (converter);