[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/XS/convert/convert_html.c (html_defa
From: |
Patrice Dumas |
Subject: |
branch master updated: * tp/Texinfo/XS/convert/convert_html.c (html_default_format_footnotes_sequence): free footnote_location_href. |
Date: |
Tue, 01 Oct 2024 17:44:06 -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 77611900d6 * tp/Texinfo/XS/convert/convert_html.c
(html_default_format_footnotes_sequence): free footnote_location_href.
77611900d6 is described below
commit 77611900d66fb937285caac24842ae46c018f42b
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Tue Jul 30 13:19:29 2024 +0200
* tp/Texinfo/XS/convert/convert_html.c
(html_default_format_footnotes_sequence): free footnote_location_href.
* tp/Texinfo/XS/convert/get_html_perl_info.c
(register_formatting_reference_default)
(register_formatting_reference_with_default): handle HV set to 0 in
argument.
* tp/maintain/generate_code_convert_data.pl: add
SPECIAL_UNIT_INFO_TYPE_NR and default_special_unit_info declarations.
* tp/Texinfo/Convert/HTML.pm (converter_initialize),
tp/Texinfo/XS/convert/ConvertXS.xs (html_converter_initialize_sv),
tp/Texinfo/XS/convert/convert_html.c (html_add_special_unit_info)
(html_converter_initialize, reset_special_unit_info_list)
(html_reset_converter, html_free_converter),
tp/Texinfo/XS/convert/get_html_perl_info.c
(html_converter_initialize_sv), tp/Texinfo/XS/main/converter_types.h
(SPECIAL_UNIT_INFO, SPECIAL_UNIT_INFO_LIST, CONVERTER): get
customized_special_unit_info in argument of
html_converter_initialize_sv, put it in SPECIAL_UNIT_INFO_LIST new
type in customized_special_unit_info field of converter. Also get the
customized_special_unit_varieties in converter, although this
information is not used for now. Set special_unit_varieties based on
defaults in conversion_data.c and set special_unit_info default in
html_converter_initialize before applying customization.
---
ChangeLog | 29 +++++++
tp/Texinfo/Convert/HTML.pm | 3 +-
tp/Texinfo/XS/convert/ConvertXS.xs | 2 +-
tp/Texinfo/XS/convert/convert_html.c | 93 +++++++++++++++++++++
tp/Texinfo/XS/convert/convert_html.h | 8 ++
tp/Texinfo/XS/convert/get_html_perl_info.c | 128 ++++++++++++++++-------------
tp/Texinfo/XS/convert/get_html_perl_info.h | 1 +
tp/Texinfo/XS/main/conversion_data.c | 14 ++--
tp/Texinfo/XS/main/conversion_data.h | 5 ++
tp/Texinfo/XS/main/converter_types.h | 16 +++-
tp/maintain/generate_code_convert_data.pl | 16 ++--
11 files changed, 240 insertions(+), 75 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 5885a9b0be..78c353aac3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,32 @@
+2024-07-30 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/XS/convert/convert_html.c
+ (html_default_format_footnotes_sequence): free footnote_location_href.
+
+ * tp/Texinfo/XS/convert/get_html_perl_info.c
+ (register_formatting_reference_default)
+ (register_formatting_reference_with_default): handle HV set to 0 in
+ argument.
+
+ * tp/maintain/generate_code_convert_data.pl: add
+ SPECIAL_UNIT_INFO_TYPE_NR and default_special_unit_info declarations.
+
+ * tp/Texinfo/Convert/HTML.pm (converter_initialize),
+ tp/Texinfo/XS/convert/ConvertXS.xs (html_converter_initialize_sv),
+ tp/Texinfo/XS/convert/convert_html.c (html_add_special_unit_info)
+ (html_converter_initialize, reset_special_unit_info_list)
+ (html_reset_converter, html_free_converter),
+ tp/Texinfo/XS/convert/get_html_perl_info.c
+ (html_converter_initialize_sv), tp/Texinfo/XS/main/converter_types.h
+ (SPECIAL_UNIT_INFO, SPECIAL_UNIT_INFO_LIST, CONVERTER): get
+ customized_special_unit_info in argument of
+ html_converter_initialize_sv, put it in SPECIAL_UNIT_INFO_LIST new
+ type in customized_special_unit_info field of converter. Also get the
+ customized_special_unit_varieties in converter, although this
+ information is not used for now. Set special_unit_varieties based on
+ defaults in conversion_data.c and set special_unit_info default in
+ html_converter_initialize before applying customization.
+
2024-07-29 Patrice Dumas <pertusus@free.fr>
* tp/maintain/generate_code_convert_data.pl: add
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index d66cb10e74..a0c67292bb 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -8740,7 +8740,7 @@ my %special_characters = (
'non_breaking_space' => [$xml_named_entity_nbsp, '00A0'],
);
-sub _XS_html_converter_initialize($$$$$$$$$$$$$)
+sub _XS_html_converter_initialize($$$$$$$$$$$$$$)
{
}
@@ -9132,6 +9132,7 @@ sub converter_initialize($)
\%default_output_units_conversion,
\%defaults_format_special_unit_body_contents,
$customized_upper_case_commands,
+ $customized_special_unit_info,
\%default_converted_directions_strings
);
delete $self->{'sorted_special_unit_varieties'};
diff --git a/tp/Texinfo/XS/convert/ConvertXS.xs
b/tp/Texinfo/XS/convert/ConvertXS.xs
index ea905f848e..2e4e819ebb 100644
--- a/tp/Texinfo/XS/convert/ConvertXS.xs
+++ b/tp/Texinfo/XS/convert/ConvertXS.xs
@@ -579,7 +579,7 @@ 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 *default_converted_directions_strings)
+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_special_unit_info, SV
*default_converted_dire [...]
void
html_conversion_initialization (SV *converter_in, const char *context, SV
*document_in=0)
diff --git a/tp/Texinfo/XS/convert/convert_html.c
b/tp/Texinfo/XS/convert/convert_html.c
index 04fba64ce1..8c81c24c76 100644
--- a/tp/Texinfo/XS/convert/convert_html.c
+++ b/tp/Texinfo/XS/convert/convert_html.c
@@ -3123,6 +3123,29 @@ direction_string (CONVERTER *self, int direction,
return self->directions_strings[string_type][direction][context];
}
+SPECIAL_UNIT_INFO *
+html_add_special_unit_info (SPECIAL_UNIT_INFO_LIST *special_unit_info_list,
+ int type, size_t variety_nr, const char *value)
+{
+ SPECIAL_UNIT_INFO *special_unit_info;
+
+ if (special_unit_info_list->number == special_unit_info_list->space)
+ {
+ special_unit_info_list->list = realloc (special_unit_info_list->list,
+ sizeof (SPECIAL_UNIT_INFO) * (special_unit_info_list->space += 5));
+ }
+ special_unit_info
+ = &special_unit_info_list->list[special_unit_info_list->number];
+ memset (special_unit_info, 0, sizeof (SPECIAL_UNIT_INFO));
+ special_unit_info->type = type;
+ special_unit_info->variety_nr = variety_nr;
+ if (value)
+ special_unit_info->value = strdup (value);
+
+ special_unit_info_list->number++;
+ return special_unit_info;
+}
+
/* note that the returned pointer may be invalidated if the targets list
is reallocated. Callers should make sure that the html target is
used before a reallocation is possible */
@@ -6942,6 +6965,7 @@ html_default_format_footnotes_sequence (CONVERTER *self,
TEXT *result)
result);
free (footnote_mark);
+ free (footnote_location_href);
}
}
destroy_pending_footnotes (pending_footnotes);
@@ -17321,8 +17345,52 @@ html_converter_initialize (CONVERTER *self)
}
}
+ /* NOTE if the special units can be customized, then
+ self->special_unit_varieties should be used directly instead.
+ Also default special units and special units indices should be
+ mapped instead of assuming that they are the same when setting
+ self->special_unit_info */
+ copy_strings (&self->special_unit_varieties,
&default_special_unit_varieties);
+
nr_special_units = self->special_unit_varieties.number;
+ /* special units info */
+ /* set to defaults */
+ if (nr_special_units > 0)
+ {
+ enum special_unit_info_type j;
+ for (j = 0; j < SPECIAL_UNIT_INFO_TYPE_NR; j++)
+ {
+ int k;
+
+ self->special_unit_info[j]
+ = new_special_unit_info_type (nr_special_units);
+ for (k = 0; k < nr_special_units; k++)
+ {
+ if (default_special_unit_info[j][k])
+ self->special_unit_info[j][k]
+ = strdup (default_special_unit_info[j][k]);
+ }
+ }
+ /* apply customization */
+ for (i = 0; i < self->customized_special_unit_info.number; i++)
+ {
+ SPECIAL_UNIT_INFO *special_unit_info
+ = &self->customized_special_unit_info.list[i];
+ size_t variety_idx = special_unit_info->variety_nr -1;
+ enum special_unit_info_type type = special_unit_info->type;
+
+ free (self->special_unit_info[type][variety_idx]);
+
+ if (special_unit_info->value)
+ self->special_unit_info[type][variety_idx]
+ = strdup (special_unit_info->value);
+ else
+ self->special_unit_info[type][variety_idx] = 0;
+ }
+ }
+
+
self->direction_unit_direction_name = (const char **) malloc
((nr_special_units + NON_SPECIAL_DIRECTIONS_NR +1) * sizeof (char *));
memcpy (self->direction_unit_direction_name, html_button_direction_names,
@@ -17723,6 +17791,25 @@ html_converter_initialize (CONVERTER *self)
*/
}
+void
+reset_special_unit_info_list (SPECIAL_UNIT_INFO_LIST *special_unit_info_list)
+{
+ size_t i;
+ for (i = 0; i < special_unit_info_list->number; i++)
+ {
+ SPECIAL_UNIT_INFO *special_unit_info = &special_unit_info_list->list[i];
+ free (special_unit_info->value);
+ }
+ special_unit_info_list->number = 0;
+}
+
+void
+free_special_unit_info_list (SPECIAL_UNIT_INFO_LIST *special_unit_info_list)
+{
+ reset_special_unit_info_list (special_unit_info_list);
+ free (special_unit_info_list->list);
+}
+
void
reset_html_targets_list (CONVERTER *self, HTML_TARGET_LIST *targets)
{
@@ -19063,6 +19150,8 @@ html_reset_converter (CONVERTER *self)
}
self->html_target_cmds.top = 0;
+ reset_special_unit_info_list (&self->customized_special_unit_info);
+
free (self->shared_conversion_state.footnote_id_numbers);
free (self->shared_conversion_state.formatted_listoffloats_nr);
@@ -19251,6 +19340,10 @@ html_free_converter (CONVERTER *self)
free_generic_converter (self);
+ free_special_unit_info_list (&self->customized_special_unit_info);
+
+ free_strings_list (&self->customized_special_unit_varieties);
+
free (self->direction_unit_direction_name);
free (self->special_unit_body);
diff --git a/tp/Texinfo/XS/convert/convert_html.h
b/tp/Texinfo/XS/convert/convert_html.h
index db157631aa..887caffc81 100644
--- a/tp/Texinfo/XS/convert/convert_html.h
+++ b/tp/Texinfo/XS/convert/convert_html.h
@@ -19,6 +19,10 @@ enum css_info_type {
CI_css_info_rules,
};
+/* in main/conversion_data.c */
+extern const STRING_LIST default_special_unit_varieties;
+
+
extern const char *html_conversion_context_type_names[];
extern const char *html_global_unit_direction_names[];
@@ -73,6 +77,10 @@ FORMATTING_REFERENCE *new_special_unit_formatting_references
(int special_units_varieties_nr);
char **new_special_unit_info_type (int special_units_varieties_nr);
+SPECIAL_UNIT_INFO *html_add_special_unit_info (
+ SPECIAL_UNIT_INFO_LIST *special_unit_info_list,
+ int type, size_t variety_nr, const char *value);
+
int html_id_is_registered (CONVERTER *self, const char *string);
void html_register_id (CONVERTER *self, const char *string);
diff --git a/tp/Texinfo/XS/convert/get_html_perl_info.c
b/tp/Texinfo/XS/convert/get_html_perl_info.c
index 4a9106e0c4..7fd27e5ab9 100644
--- a/tp/Texinfo/XS/convert/get_html_perl_info.c
+++ b/tp/Texinfo/XS/convert/get_html_perl_info.c
@@ -58,10 +58,13 @@ register_formatting_reference_default (const char
*type_string,
FORMATTING_REFERENCE *formatting_reference,
const char *ref_name, HV *default_hv)
{
- SV **default_formatting_reference_sv;
+ SV **default_formatting_reference_sv = 0;
dTHX;
+ if (!default_hv)
+ return 0;
+
default_formatting_reference_sv
= hv_fetch (default_hv, ref_name, strlen (ref_name), 0);
@@ -93,6 +96,9 @@ register_formatting_reference_with_default (const char
*type_string,
default_formatting_reference_sv = register_formatting_reference_default (
type_string, formatting_reference, ref_name, default_hv);
+ if (!customized_hv)
+ return;
+
formatting_reference_sv
= hv_fetch (customized_hv, ref_name, strlen (ref_name), 0);
if (formatting_reference_sv)
@@ -136,6 +142,7 @@ html_converter_initialize_sv (SV *converter_sv,
SV *default_output_units_conversion,
SV *default_special_unit_body,
SV *customized_upper_case_commands,
+ SV *customized_special_unit_info,
SV *default_converted_directions_strings
)
{
@@ -152,10 +159,10 @@ html_converter_initialize_sv (SV *converter_sv,
HV *default_output_units_conversion_hv;
SV **htmlxref_sv;
SV **formatting_function_sv;
- SV **sorted_special_unit_varieties_sv;
SV **accent_entities_sv;
SV **style_commands_formatting_sv;
SV **stage_handlers_sv;
+ SV **special_unit_body_sv;
SV **types_open_sv;
SV **types_conversion_sv;
SV **commands_open_sv;
@@ -181,11 +188,18 @@ html_converter_initialize_sv (SV *converter_sv,
int nr_dir_str_contexts = TDS_context_string +1;
/* need to be passed as argument to get from Perl */
SV *default_css_element_class_styles = 0;
+ const STRING_LIST *special_unit_varieties;
dTHX;
converter = get_sv_converter (converter_sv, "html_converter_initialize_sv");
+ /* NOTE if the special units can be customized, then the
+ converter->special_unit_varieties should be set and used instead */
+ special_unit_varieties = &default_special_unit_varieties;
+ /*
+ special_unit_varieties = &converter->special_unit_varieties;
+ */
converter_hv = (HV *)SvRV (converter_sv);
default_formatting_references_hv
@@ -225,70 +239,65 @@ html_converter_initialize_sv (SV *converter_sv,
}
}
-#define FETCH(key) key##_sv = hv_fetch (converter_hv, #key, strlen (#key), 0);
- FETCH(sorted_special_unit_varieties)
-
- if (sorted_special_unit_varieties_sv)
+ if (customized_special_unit_info && SvOK (customized_special_unit_info))
{
enum special_unit_info_type j;
- SV **simplified_special_unit_info_sv;
HV *special_unit_info_hv;
- STRING_LIST *special_unit_varieties = &converter->special_unit_varieties;
- if (sorted_special_unit_varieties_sv)
- add_svav_to_string_list (*sorted_special_unit_varieties_sv,
- special_unit_varieties, svt_char);
-
- FETCH(simplified_special_unit_info);
+ STRING_LIST *customized_special_unit_varieties
+ = &converter->customized_special_unit_varieties;
+ clear_strings_list (customized_special_unit_varieties);
- special_unit_info_hv = (HV *) SvRV(*simplified_special_unit_info_sv);
+ special_unit_info_hv = (HV *) SvRV(customized_special_unit_info);
- for (j = 0; j < SUI_type_heading+1; j++)
+ for (j = 0; j < SPECIAL_UNIT_INFO_TYPE_NR; j++)
{
SV **special_unit_info_type_sv;
const char *sui_type = special_unit_info_type_names[j];
special_unit_info_type_sv = hv_fetch (special_unit_info_hv,
sui_type, strlen (sui_type),
0);
- if (special_unit_info_type_sv)
+ if (special_unit_info_type_sv && SvOK (*special_unit_info_type_sv))
{
- int k;
+ I32 hv_number;
+ I32 i;
HV *special_unit_info_type_hv;
- if (!SvOK (*special_unit_info_type_sv))
- {
- fprintf (stderr, "BUG: special_unit_info: %s: undef\n",
- sui_type);
- }
-
special_unit_info_type_hv
= (HV *) SvRV(*special_unit_info_type_sv);
- converter->special_unit_info[j]
- = new_special_unit_info_type (special_unit_varieties->number);
+ hv_number = hv_iterinit (special_unit_info_type_hv);
- for (k = 0; k < special_unit_varieties->number; k++)
+ for (i = 0; i < hv_number; i++)
{
- char *variety_name = special_unit_varieties->list[k];
- SV **info_type_variety_sv
- = hv_fetch (special_unit_info_type_hv, variety_name,
- strlen (variety_name), 0);
- if (info_type_variety_sv)
+ HE *next = hv_iternext (special_unit_info_type_hv);
+ SV *variety_sv = hv_iterkeysv (next);
+ char *variety = (char *) SvPVutf8_nolen (variety_sv);
+ SV *value_sv = HeVAL(next);
+ char *value = 0;
+ /* the customized_special_unit_varieties are not used
+ further but is filled to retain the information on
+ the variety customized, even if they are ignored */
+ size_t customized_variety_nr = find_string (
+ customized_special_unit_varieties,
+ variety);
+ size_t variety_nr = find_string (special_unit_varieties,
+ variety);
+
+ if (!customized_variety_nr)
{
- /* can be undef if set undef in user init file */
- if (SvOK (*info_type_variety_sv))
- {
- const char *value
- = (char *) SvPVutf8_nolen (*info_type_variety_sv);
- converter->special_unit_info[j][k]
- = non_perl_strdup (value);
- }
- else
- converter->special_unit_info[j][k] = 0;
+ add_string (variety, customized_special_unit_varieties);
+ }
+
+ if (variety_nr)
+ {
+
+ if (SvOK (value_sv))
+ value = (char *) SvPVutf8_nolen (value_sv);
+
+ html_add_special_unit_info (
+ &converter->customized_special_unit_info, j,
+ variety_nr, value);
}
- /*
- else
- fprintf (stderr, "Missing %d:%s %d:%s\n", j, sui_type, k,
variety_name);
- */
}
}
}
@@ -301,7 +310,7 @@ html_converter_initialize_sv (SV *converter_sv,
HV *default_converted_directions_strings_hv
= (HV *) SvRV (default_converted_directions_strings);
nr_string_directions = NON_SPECIAL_DIRECTIONS_NR - FIRSTINFILE_NR
- + converter->special_unit_varieties.number;
+ + special_unit_varieties->number;
int non_translated_directions_strings_nr
= (TDS_TYPE_MAX_NR) - (TDS_TRANSLATED_MAX_NR);
for (DS_type = 0; DS_type < non_translated_directions_strings_nr;
@@ -331,8 +340,9 @@ html_converter_initialize_sv (SV *converter_sv,
if (i < FIRSTINFILE_MIN_IDX)
direction_name = html_button_direction_names[i];
else
+ /* FIXME if special units are dynamic this is incorrect */
direction_name
- = converter->special_unit_info[SUI_type_direction]
+ = default_special_unit_info[SUI_type_direction]
[i - FIRSTINFILE_MIN_IDX];
spec_sv = hv_fetch (direction_hv, direction_name,
@@ -355,6 +365,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)
@@ -598,19 +609,18 @@ html_converter_initialize_sv (SV *converter_sv,
output_units_conversion_hv);
}
- if (sorted_special_unit_varieties_sv)
+ if (special_unit_varieties->number > 0)
{
- SV **special_unit_body_sv;
- HV *special_unit_body_hv;
+ HV *special_unit_body_hv = 0;
HV *default_special_unit_body_hv;
- STRING_LIST *special_unit_varieties = &converter->special_unit_varieties;
converter->special_unit_body
- = new_special_unit_formatting_references
- (special_unit_varieties->number);
+ = new_special_unit_formatting_references
+ (special_unit_varieties->number);
FETCH(special_unit_body)
- special_unit_body_hv = (HV *)SvRV (*special_unit_body_sv);
+ if (special_unit_body_sv)
+ special_unit_body_hv = (HV *)SvRV (*special_unit_body_sv);
default_special_unit_body_hv = (HV *)SvRV (default_special_unit_body);
for (i = 0; i < special_unit_varieties->number; i++)
@@ -921,7 +931,7 @@ html_converter_initialize_sv (SV *converter_sv,
/* The corresponding direction without FirstInFile are used instead
of FirstInFile*, so the directions_strings are not set */
nr_string_directions = NON_SPECIAL_DIRECTIONS_NR - FIRSTINFILE_NR
- + converter->special_unit_varieties.number;
+ + special_unit_varieties->number;
for (DS_type = 0; DS_type < TDS_TRANSLATED_MAX_NR; DS_type++)
{
@@ -947,8 +957,9 @@ html_converter_initialize_sv (SV *converter_sv,
if (i < FIRSTINFILE_MIN_IDX)
direction_name = html_button_direction_names[i];
else
+ /* FIXME if special units are dynamic this is incorrect */
direction_name
- = converter->special_unit_info[SUI_type_direction]
+ = default_special_unit_info[SUI_type_direction]
[i - FIRSTINFILE_MIN_IDX];
spec_sv = hv_fetch (direction_hv, direction_name,
@@ -1134,7 +1145,7 @@ html_converter_initialize_sv (SV *converter_sv,
SV **direction_sv;
size_t customized_type = DS_type - (TDS_TRANSLATED_MAX_NR);
- /* do not use new_directions_strings_type as a 0 for a directions
+ /* do not use new_directions_strings_type as a 0 for a direction
array
is allowed here, it means that there is a customized value undef
*/
converter->customized_directions_strings[customized_type]
= (char ***) malloc (nr_string_directions * sizeof (char **));
@@ -1158,8 +1169,9 @@ html_converter_initialize_sv (SV *converter_sv,
if (i < FIRSTINFILE_MIN_IDX)
direction_name = html_button_direction_names[i];
else
+ /* FIXME if special units are dynamic this is incorrect */
direction_name
- = converter->special_unit_info[SUI_type_direction]
+ = default_special_unit_info[SUI_type_direction]
[i - FIRSTINFILE_MIN_IDX];
context_sv = hv_fetch (direction_hv, direction_name,
diff --git a/tp/Texinfo/XS/convert/get_html_perl_info.h
b/tp/Texinfo/XS/convert/get_html_perl_info.h
index 9b213c098b..7ff9ed4cd8 100644
--- a/tp/Texinfo/XS/convert/get_html_perl_info.h
+++ b/tp/Texinfo/XS/convert/get_html_perl_info.h
@@ -21,6 +21,7 @@ void html_converter_initialize_sv (SV *converter_sv,
SV *default_output_units_conversion,
SV *default_special_unit_body,
SV *customized_upper_case_commands,
+ SV *customized_special_unit_info,
SV *default_converted_directions_strings
);
diff --git a/tp/Texinfo/XS/main/conversion_data.c
b/tp/Texinfo/XS/main/conversion_data.c
index 81212d1ea7..160ad2cf22 100644
--- a/tp/Texinfo/XS/main/conversion_data.c
+++ b/tp/Texinfo/XS/main/conversion_data.c
@@ -93,13 +93,13 @@ static char *default_special_unit_varieties_array[] = {
const STRING_LIST default_special_unit_varieties =
{default_special_unit_varieties_array, 4, 4};
#define pgdt_noop(Context,String) String
-const char * const defaul_special_unit_info[SUI_type_heading+1][4] = {
- {"contents", "shortcontents", "footnotes", "about", },
- {"Contents", "Overview", "Footnotes", "About", },
- {"30", "20", "10", "40", },
- {"_toc", "_ovr", "_fot", "_abt", },
- {"SEC_Contents", "SEC_Shortcontents", "SEC_Footnotes", "SEC_About", },
- {pgdt_noop("contents section heading", "Table of Contents"),
pgdt_noop("shortcontents section heading", "Short Table of Contents"),
pgdt_noop("footnotes section heading", "Footnotes"), pgdt_noop("about section
heading", "About This Document"), },
+const char * const default_special_unit_info[SPECIAL_UNIT_INFO_TYPE_NR][4] = {
+ {"contents", "shortcontents", "footnotes", "about", }, /* class */
+ {"Contents", "Overview", "Footnotes", "About", }, /* direction */
+ {"30", "20", "10", "40", }, /* order */
+ {"_toc", "_ovr", "_fot", "_abt", }, /* file_string */
+ {"SEC_Contents", "SEC_Shortcontents", "SEC_Footnotes", "SEC_About", }, /*
target */
+ {pgdt_noop("contents section heading", "Table of Contents"),
pgdt_noop("shortcontents section heading", "Short Table of Contents"),
pgdt_noop("footnotes section heading", "Footnotes"), pgdt_noop("about section
heading", "About This Document"), }, /* heading */
};
const char *direction_type_translation_context[] = {
diff --git a/tp/Texinfo/XS/main/conversion_data.h
b/tp/Texinfo/XS/main/conversion_data.h
index 9963afd743..9e44f84072 100644
--- a/tp/Texinfo/XS/main/conversion_data.h
+++ b/tp/Texinfo/XS/main/conversion_data.h
@@ -20,6 +20,8 @@ enum special_unit_info_type {
SUI_type_heading,
};
+#define SPECIAL_UNIT_INFO_TYPE_NR 6
+
/* translated from corresponding SUI_type* */
enum special_unit_info_tree {
SUIT_type_none = -1,
@@ -27,7 +29,10 @@ enum special_unit_info_tree {
SUIT_type_heading,
};
+extern const char * const
default_special_unit_info[SPECIAL_UNIT_INFO_TYPE_NR][4];
+
extern const char *direction_type_translation_context[];
+
#define TDS_TRANSLATED_TYPES_LIST \
tds_type(text) \
tds_type(description) \
diff --git a/tp/Texinfo/XS/main/converter_types.h
b/tp/Texinfo/XS/main/converter_types.h
index 2f9f3d3813..74d1157066 100644
--- a/tp/Texinfo/XS/main/converter_types.h
+++ b/tp/Texinfo/XS/main/converter_types.h
@@ -714,6 +714,18 @@ typedef struct HTML_STAGE_HANDLER_INFO_LIST {
HTML_STAGE_HANDLER_INFO *list;
} HTML_STAGE_HANDLER_INFO_LIST;
+typedef struct SPECIAL_UNIT_INFO {
+ int type;
+ size_t variety_nr;
+ char *value;
+} SPECIAL_UNIT_INFO;
+
+typedef struct SPECIAL_UNIT_INFO_LIST {
+ size_t number;
+ size_t space;
+ SPECIAL_UNIT_INFO *list;
+} SPECIAL_UNIT_INFO_LIST;
+
typedef struct CONVERTER {
int converter_descriptor;
/* perl converter. This should be HV *hv,
@@ -780,7 +792,9 @@ typedef struct CONVERTER {
FORMATTING_REFERENCE output_units_conversion[OU_special_unit+1];
FORMATTING_REFERENCE *special_unit_body;
STRING_LIST special_unit_varieties;
- char **special_unit_info[SUI_type_heading+1];
+ STRING_LIST customized_special_unit_varieties;
+ SPECIAL_UNIT_INFO_LIST customized_special_unit_info;
+ char **special_unit_info[SPECIAL_UNIT_INFO_TYPE_NR];
HTMLXREF_MANUAL_LIST htmlxref;
TYPE_CONVERSION_FUNCTION type_conversion_function[TXI_TREE_TYPES_NUMBER];
TYPE_CONVERSION_FUNCTION
css_string_type_conversion_function[TXI_TREE_TYPES_NUMBER];
diff --git a/tp/maintain/generate_code_convert_data.pl
b/tp/maintain/generate_code_convert_data.pl
index 1dc761df25..418112195c 100755
--- a/tp/maintain/generate_code_convert_data.pl
+++ b/tp/maintain/generate_code_convert_data.pl
@@ -226,6 +226,10 @@ if ($C_format) {
print OUT "};\n\n";
print HDR "};\n\n";
+ print HDR "#define SPECIAL_UNIT_INFO_TYPE_NR "
+ .(scalar(@su_ordered_untranslated_hashes)
+ + scalar(@su_ordered_translated_hashes))."\n\n";
+
print HDR "/* translated from corresponding SUI_type* */\n";
print HDR "enum special_unit_info_tree {\n"
." SUIT_type_none = -1,\n\n";
@@ -323,8 +327,6 @@ if ($perl_format) {
} else {
- my $last_type = "SUI_type_".$su_ordered_translated_hashes[-1];
-
print OUT "static char *default_special_unit_varieties_array[] = {\n";
foreach my $special_units (@su_ordered) {
print OUT " \"$special_units\",\n";
@@ -333,16 +335,16 @@ if ($perl_format) {
print OUT "const STRING_LIST default_special_unit_varieties =
{default_special_unit_varieties_array, $special_units_nr,
$special_units_nr};\n\n";
-
- # FIXME somwhere else?
+ # FIXME somewhere else?
print OUT "#define pgdt_noop(Context,String) String\n";
- print OUT "const char * const
defaul_special_unit_info[$last_type+1][$special_units_nr] = {\n";
+ print OUT "const char * const
default_special_unit_info[SPECIAL_UNIT_INFO_TYPE_NR][$special_units_nr] = {\n";
foreach my $type (@su_ordered_untranslated_hashes,
@su_ordered_translated_hashes) {
- print OUT " {".$su_hash_lines{$type}."},\n";
+ print OUT " {".$su_hash_lines{$type}."}, /* $type */\n";
}
print OUT "};\n\n";
+ print HDR "extern const char * const
default_special_unit_info[SPECIAL_UNIT_INFO_TYPE_NR][$special_units_nr];\n\n";
}
my @global_directions = ('First', 'Top', 'Index', 'Last');
@@ -418,7 +420,7 @@ my %type_contexts_map = (
);
if ($C_format) {
- print HDR "extern const char *direction_type_translation_context[];\n";
+ print HDR "extern const char *direction_type_translation_context[];\n\n";
# we define preprocessor macros
print HDR "#define TDS_TRANSLATED_TYPES_LIST \\\n";
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/XS/convert/convert_html.c (html_default_format_footnotes_sequence): free footnote_location_href.,
Patrice Dumas <=