[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/XS/convert/convert_html.c (accent_cm
From: |
Patrice Dumas |
Subject: |
branch master updated: * tp/Texinfo/XS/convert/convert_html.c (accent_cmd, html_format_setup) (html_converter_initialize, html_free_converter), tp/Texinfo/XS/convert/get_html_perl_info.c (html_converter_initialize_sv), tp/Texinfo/XS/main/converter_types.h (CONVERTER): collect accent commands in accent_cmd in convert_html.c, not in converter. Remove accent_cmd converter field. |
Date: |
Wed, 02 Oct 2024 06:28:05 -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 95180050d8 * tp/Texinfo/XS/convert/convert_html.c (accent_cmd,
html_format_setup) (html_converter_initialize, html_free_converter),
tp/Texinfo/XS/convert/get_html_perl_info.c (html_converter_initialize_sv),
tp/Texinfo/XS/main/converter_types.h (CONVERTER): collect accent commands in
accent_cmd in convert_html.c, not in converter. Remove accent_cmd converter
field.
95180050d8 is described below
commit 95180050d829643edf1dd667b2d8fe00a0df3d35
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Wed Jul 31 16:38:42 2024 +0200
* tp/Texinfo/XS/convert/convert_html.c (accent_cmd, html_format_setup)
(html_converter_initialize, html_free_converter),
tp/Texinfo/XS/convert/get_html_perl_info.c
(html_converter_initialize_sv), tp/Texinfo/XS/main/converter_types.h
(CONVERTER): collect accent commands in accent_cmd in convert_html.c,
not in converter. Remove accent_cmd converter field.
* tp/Texinfo/XS/convert/convert_html.c (style_formatted_cmd)
(html_format_setup, html_converter_initialize, html_free_converter),
tp/Texinfo/XS/convert/get_html_perl_info.c
(html_converter_initialize_sv), tp/Texinfo/XS/main/converter_types.h
(CONVERTER): collect style brace commands in style_formatted_cmd in
convert_html.c, not in converter. Remove style_formatted_cmd
converter field.
* tp/Texinfo/Convert/HTML.pm (converter_initialize),
tp/Texinfo/XS/convert/ConvertXS.xs (html_converter_initialize_sv),
tp/Texinfo/XS/convert/get_html_perl_info.c
(html_converter_initialize_sv), tp/Texinfo/XS/main/converter_types.h
(COMMAND_HTML_STYLE_COMMAND_CONVERSION, CONVERTER),
tp/Texinfo/XS/convert/convert_html.c (html_free_converter): add
html_customized_style_commands field to converter with type
COMMAND_HTML_STYLE_COMMAND_CONVERSION. Pass
style_commands_customized_formatting_info from Perl to C through
html_converter_initialize_sv.
* tp/Texinfo/XS/convert/convert_html.c (quoted_style_commands)
(default_style_commands_formatting, html_format_setup): add
quoted_style_commands. set default_style_commands_formatting based on
quoted_style_commands and html_style_commands_element from
conversion_data.c.
* tp/Texinfo/XS/convert/convert_html.c (html_converter_initialize),
tp/Texinfo/XS/convert/get_html_perl_info.c
(html_converter_initialize_sv): set
self->html_style_command_conversion based on
default_style_commands_formatting and on
self->html_customized_style_commands in C. Do not get
style_commands_formatting from Perl.
---
ChangeLog | 42 +++++++
tp/Texinfo/Convert/HTML.pm | 3 +-
tp/Texinfo/XS/convert/ConvertXS.xs | 3 +-
tp/Texinfo/XS/convert/convert_html.c | 179 ++++++++++++++++++++++++-----
tp/Texinfo/XS/convert/get_html_perl_info.c | 54 ++++-----
tp/Texinfo/XS/convert/get_html_perl_info.h | 1 +
tp/Texinfo/XS/main/converter_types.h | 8 +-
7 files changed, 229 insertions(+), 61 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index f00f968b09..6f37fc5c03 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,45 @@
+2024-07-31 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/XS/convert/convert_html.c (accent_cmd, html_format_setup)
+ (html_converter_initialize, html_free_converter),
+ tp/Texinfo/XS/convert/get_html_perl_info.c
+ (html_converter_initialize_sv), tp/Texinfo/XS/main/converter_types.h
+ (CONVERTER): collect accent commands in accent_cmd in convert_html.c,
+ not in converter. Remove accent_cmd converter field.
+
+ * tp/Texinfo/XS/convert/convert_html.c (style_formatted_cmd)
+ (html_format_setup, html_converter_initialize, html_free_converter),
+ tp/Texinfo/XS/convert/get_html_perl_info.c
+ (html_converter_initialize_sv), tp/Texinfo/XS/main/converter_types.h
+ (CONVERTER): collect style brace commands in style_formatted_cmd in
+ convert_html.c, not in converter. Remove style_formatted_cmd
+ converter field.
+
+ * tp/Texinfo/Convert/HTML.pm (converter_initialize),
+ tp/Texinfo/XS/convert/ConvertXS.xs (html_converter_initialize_sv),
+ tp/Texinfo/XS/convert/get_html_perl_info.c
+ (html_converter_initialize_sv), tp/Texinfo/XS/main/converter_types.h
+ (COMMAND_HTML_STYLE_COMMAND_CONVERSION, CONVERTER),
+ tp/Texinfo/XS/convert/convert_html.c (html_free_converter): add
+ html_customized_style_commands field to converter with type
+ COMMAND_HTML_STYLE_COMMAND_CONVERSION. Pass
+ style_commands_customized_formatting_info from Perl to C through
+ html_converter_initialize_sv.
+
+ * tp/Texinfo/XS/convert/convert_html.c (quoted_style_commands)
+ (default_style_commands_formatting, html_format_setup): add
+ quoted_style_commands. set default_style_commands_formatting based on
+ quoted_style_commands and html_style_commands_element from
+ conversion_data.c.
+
+ * tp/Texinfo/XS/convert/convert_html.c (html_converter_initialize),
+ tp/Texinfo/XS/convert/get_html_perl_info.c
+ (html_converter_initialize_sv): set
+ self->html_style_command_conversion based on
+ default_style_commands_formatting and on
+ self->html_customized_style_commands in C. Do not get
+ style_commands_formatting from Perl.
+
2024-07-31 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/Convert/HTML.pm (converter_initialize): setup
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index 56aaecca5d..f412fbb6dc 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($$$$$$$$$$$$$$$$$)
{
}
@@ -9148,6 +9148,7 @@ sub converter_initialize($)
$customized_upper_case_commands,
$customized_type_formatting,
\%customized_accent_entities,
+ \%style_commands_customized_formatting_info,
$customized_special_unit_info,
$customized_direction_strings
);
diff --git a/tp/Texinfo/XS/convert/ConvertXS.xs
b/tp/Texinfo/XS/convert/ConvertXS.xs
index 3ad38615fd..6077b37937 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 *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;
CODE:
@@ -607,6 +607,7 @@ html_converter_initialize_sv (SV *converter_in, SV
*default_formatting_reference
customized_upper_case_commands,
customized_type_formatting,
customized_accent_entities,
+ customized_style_commands,
customized_direction_strings);
diff --git a/tp/Texinfo/XS/convert/convert_html.c
b/tp/Texinfo/XS/convert/convert_html.c
index d3afe125fe..db5ea82cdb 100644
--- a/tp/Texinfo/XS/convert/convert_html.c
+++ b/tp/Texinfo/XS/convert/convert_html.c
@@ -140,6 +140,10 @@ const PRE_CLASS_TYPE_INFO default_pre_class_types[] = {
{0, 0}
};
+static enum command_id quoted_style_commands[] = {
+ CM_samp, 0
+};
+
const char *count_elements_in_filename_type_names[] = {
"total", "remaining", "current"};
@@ -215,6 +219,9 @@ CMD_VARIETY command_special_unit_variety[] = {
static HTML_NO_ARG_COMMAND_CONVERSION default_no_arg_commands_formatting
[BUILTIN_CMD_NUMBER][NO_ARG_COMMAND_CONTEXT_NR];
+static HTML_STYLE_COMMAND_CONVERSION default_style_commands_formatting
+ [BUILTIN_CMD_NUMBER][STYLE_COMMAND_CONTEXT_NR];
+
/* used to set flags to non-zero with a flag that does nothing */
#define F_AFT_none 0x0001
@@ -236,6 +243,7 @@ static HTML_NO_ARG_COMMAND_CONVERSION
default_no_arg_commands_formatting
#define HF_HTML_align 0x0020
#define HF_special_variety 0x0040
#define HF_indented_preformatted 0x0080
+#define HF_style_command 0x0100
typedef struct HTML_COMMAND_STRUCT {
unsigned long flags;
@@ -14365,7 +14373,7 @@ static const COMMAND_INTERNAL_CONVERSION
commands_internal_conversion_table[] =
{CM_math, &convert_math_command},
{CM_titlefont, &convert_titlefont_command},
{CM_U, &convert_U_command},
- /* note that if indicateurl had been in self->style_formatted_cmd this
+ /* note that if indicateurl had been in style_formatted_cmd this
would have prevented indicateurl to be associated to
convert_style_command */
{CM_indicateurl, &convert_indicateurl_command},
@@ -16808,6 +16816,8 @@ static COMMAND_STACK preformatted_cmd_list;
static COMMAND_STACK def_cmd_list;
COMMAND_ID_LIST no_arg_formatted_cmd;
+COMMAND_ID_LIST style_formatted_cmd;
+COMMAND_ID_LIST accent_cmd;
static char *unicode_entities[BUILTIN_CMD_NUMBER];
@@ -16844,6 +16854,8 @@ html_format_setup (void)
{
int i;
int no_arg_formatted_cmd_nr = 0;
+ int accent_cmd_nr = 0;
+ int style_formatted_cmd_nr = 0;
int no_arg_formatted_cmd_idx;
int default_commands_args_nr
= sizeof (default_commands_args) / sizeof (default_commands_args[0]);
@@ -16923,12 +16935,26 @@ html_format_setup (void)
}
/* set flags */
- /* also count the number of no_arg_formatted_cmd commands */
+ /* also count the number of no_arg_formatted_cmd, style_formatted_cmd and
+ accent_cmd commands */
for (i = 1; i < BUILTIN_CMD_NUMBER; i++)
{
if (xml_text_entity_no_arg_commands_formatting[i])
no_arg_formatted_cmd_nr++;
+ if (html_style_commands_element[i]
+ || (builtin_command_data[i].flags & CF_brace
+ && (builtin_command_data[i].data == BRACE_style_other
+ || builtin_command_data[i].data == BRACE_style_code
+ || builtin_command_data[i].data == BRACE_style_no_code)))
+ {
+ html_commands_data[i].flags |= HF_style_command;
+ style_formatted_cmd_nr++;
+ }
+
+ if (builtin_command_data[i].flags & CF_accent)
+ accent_cmd_nr++;
+
if ((builtin_command_data[i].flags & CF_block
&& builtin_command_data[i].data != BLOCK_format_raw)
|| builtin_command_data[i].flags & CF_root)
@@ -16961,6 +16987,10 @@ html_format_setup (void)
for (i = 0; additional_format_context_cmd[i]; i++)
register_format_context_command (additional_format_context_cmd[i]);
+ /* do not consider indicateurl to be a style command, it has a different
+ formatting function */
+ html_commands_data[CM_indicateurl].flags &= ~HF_style_command;
+
for (i = 0; HTML_align_cmd[i]; i++)
{
enum command_id cmd = HTML_align_cmd[i];
@@ -16971,10 +17001,46 @@ html_format_setup (void)
initialize_cmd_list (&no_arg_formatted_cmd, no_arg_formatted_cmd_nr,
no_arg_formatted_cmd_nr);
+ initialize_cmd_list (&accent_cmd, accent_cmd_nr, 0);
+ initialize_cmd_list (&style_formatted_cmd, style_formatted_cmd_nr, 0);
+
+ for (i = 0; quoted_style_commands[i]; i++)
+ {
+ enum command_id cmd = quoted_style_commands[i];
+ enum conversion_context cctx;
+ for (cctx = 0; cctx < STYLE_COMMAND_CONTEXT_NR; cctx++)
+ {
+ default_style_commands_formatting[cmd][cctx].quote = 1;
+ }
+ }
no_arg_formatted_cmd_idx = 0;
for (i = 0; i < BUILTIN_CMD_NUMBER; i++)
{
+ if (builtin_command_data[i].flags & CF_accent)
+ {
+ accent_cmd.list[accent_cmd.number] = i;
+ accent_cmd.number++;
+ }
+
+ if (html_commands_data[i].flags & HF_style_command)
+ {
+ style_formatted_cmd.list[style_formatted_cmd.number] = i;
+ style_formatted_cmd.number++;
+
+ if (html_style_commands_element[i])
+ {
+ enum conversion_context cctx;
+ for (cctx = 0; cctx < STYLE_COMMAND_CONTEXT_NR; cctx++)
+ {
+ /* the default_style_commands_formatting contains const char only
+ but the type is not const, so drop the const with a cast */
+ default_style_commands_formatting[i][cctx].element
+ = (char *) html_style_commands_element[i];
+ }
+ }
+ }
+
if (xml_text_entity_no_arg_commands_formatting[i])
{
/* the value is never modified but the struct field type is not const
@@ -16992,6 +17058,10 @@ html_format_setup (void)
default_no_arg_commands_formatting[i][HCC_type_preformatted].unset =
1;
}
}
+
+ default_style_commands_formatting[CM_sc][HCC_type_preformatted].element
+ = "span";
+
/* modify normal context values and add other contexts values, removing
unset. Should only be for commands with normal context already set.
*/
@@ -17454,6 +17524,16 @@ html_converter_initialize (CONVERTER *self)
for (i = 0; default_upper_case_commands[i]; i++)
self->upper_case[default_upper_case_commands[i]] = 1;
+ for (i = 0; default_code_types[i]; i++)
+ self->code_types[default_code_types[i]] = 1;
+
+ for (i = 0; default_pre_class_types[i].type; i++)
+ {
+ const PRE_CLASS_TYPE_INFO *pre_class_type = &default_pre_class_types[i];
+ self->pre_class_types[pre_class_type->type]
+ = strdup (pre_class_type->pre_class);
+ }
+
/* initialization needing some information from perl */
if (self->html_customized_upper_case_commands)
@@ -17466,9 +17546,6 @@ html_converter_initialize (CONVERTER *self)
}
}
- for (i = 0; default_code_types[i]; i++)
- self->code_types[default_code_types[i]] = 1;
-
if (self->html_customized_code_types)
{
for (i = 0; self->html_customized_code_types[i].type; i++)
@@ -17479,13 +17556,6 @@ html_converter_initialize (CONVERTER *self)
}
}
- for (i = 0; default_pre_class_types[i].type; i++)
- {
- const PRE_CLASS_TYPE_INFO *pre_class_type = &default_pre_class_types[i];
- self->pre_class_types[pre_class_type->type]
- = strdup (pre_class_type->pre_class);
- }
-
if (self->html_customized_pre_class_types)
{
for (i = 0; self->html_customized_pre_class_types[i].type; i++)
@@ -17535,6 +17605,43 @@ html_converter_initialize (CONVERTER *self)
}
}
+ for (i = 0; i < style_formatted_cmd.number; i++)
+ {
+ enum command_id cmd = style_formatted_cmd.list[i];
+ enum conversion_context cctx;
+ for (cctx = 0; cctx < STYLE_COMMAND_CONTEXT_NR; cctx++)
+ {
+ HTML_STYLE_COMMAND_CONVERSION *format_spec
+ = &self->html_style_command_conversion[cmd][cctx];
+ HTML_STYLE_COMMAND_CONVERSION *default_spec
+ = &default_style_commands_formatting[cmd][cctx];
+
+ if (default_spec->element)
+ format_spec->element = strdup (default_spec->element);
+ format_spec->quote = default_spec->quote;
+ }
+ }
+
+ for (i = 0; self->html_customized_style_commands[i].cmd; i++)
+ {
+ enum conversion_context cctx;
+ enum command_id cmd = self->html_customized_style_commands[i].cmd;
+ for (cctx = 0; cctx < STYLE_COMMAND_CONTEXT_NR; cctx++)
+ {
+ if (self->html_customized_style_commands[i].conversion[cctx])
+ {
+ HTML_STYLE_COMMAND_CONVERSION *format_spec
+ = &self->html_style_command_conversion[cmd][cctx];
+ HTML_STYLE_COMMAND_CONVERSION *custom_spec
+ = self->html_customized_style_commands[i].conversion[cctx];
+
+ if (custom_spec->element)
+ format_spec->element = strdup (custom_spec->element);
+ format_spec->quote = custom_spec->quote;
+ }
+ }
+ }
+
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,
@@ -17807,11 +17914,11 @@ html_converter_initialize (CONVERTER *self)
}
/* accents commands implemented in C */
- if (self->accent_cmd.number)
+ if (accent_cmd.number)
{
- for (i = 0; i < self->accent_cmd.number; i++)
+ for (i = 0; i < accent_cmd.number; i++)
{
- enum command_id cmd = self->accent_cmd.list[i];
+ enum command_id cmd = accent_cmd.list[i];
COMMAND_CONVERSION_FUNCTION *command_conversion
= &self->command_conversion_function[cmd];
COMMAND_CONVERSION_FUNCTION *css_string_command_conversion
@@ -17834,11 +17941,11 @@ html_converter_initialize (CONVERTER *self)
/* all the commands in style_formatted_cmd are implemented in C.
It is not only the style commands, some others too. indicateurl
is not in style_formatted_cmd for now either */
- if (self->style_formatted_cmd.number)
+ if (style_formatted_cmd.number)
{
- for (i = 0; i < self->style_formatted_cmd.number; i++)
+ for (i = 0; i < style_formatted_cmd.number; i++)
{
- enum command_id cmd = self->style_formatted_cmd.list[i];
+ enum command_id cmd = style_formatted_cmd.list[i];
COMMAND_CONVERSION_FUNCTION *command_conversion
= &self->command_conversion_function[cmd];
COMMAND_CONVERSION_FUNCTION *css_string_command_conversion
@@ -19646,18 +19753,18 @@ html_free_converter (CONVERTER *self)
}
}
- for (i = 0; i < self->accent_cmd.number; i++)
+ for (i = 0; i < accent_cmd.number; i++)
{
- enum command_id cmd = self->accent_cmd.list[i];
+ enum command_id cmd = accent_cmd.list[i];
ACCENT_ENTITY_INFO *accent_info
= &self->accent_entities[cmd];
free (accent_info->entity);
free (accent_info->characters);
}
- for (i = 0; i < self->style_formatted_cmd.number; i++)
+ for (i = 0; i < style_formatted_cmd.number; i++)
{
- enum command_id cmd = self->style_formatted_cmd.list[i];
+ enum command_id cmd = style_formatted_cmd.list[i];
enum conversion_context cctx;
for (cctx = 0; cctx < STYLE_COMMAND_CONTEXT_NR; cctx++)
{
@@ -19782,18 +19889,36 @@ html_free_converter (CONVERTER *self)
self->html_customized_accent_entity_info = 0;
}
+ if (self->html_customized_style_commands)
+ {
+ for (i = 0; self->html_customized_style_commands[i].cmd; i++)
+ {
+ int cctx;
+ for (cctx = 0; cctx < STYLE_COMMAND_CONTEXT_NR; cctx++)
+ {
+ if (self->html_customized_style_commands[i].conversion[cctx])
+ {
+ HTML_STYLE_COMMAND_CONVERSION *format_spec
+ = self->html_customized_style_commands[i].conversion[cctx];
+ free (format_spec->element);
+ free (format_spec);
+ }
+ }
+ }
+ free (self->html_customized_style_commands);
+ self->html_customized_style_commands = 0;
+ }
+
/* should be freed on exit.
free (no_arg_formatted_cmd.list);
- */
- free (self->accent_cmd.list);
+ free (accent_cmd.list);
-/* should be freed on exit.
free (preformatted_cmd_list.stack);
free (def_cmd_list.stack);
- */
- free (self->style_formatted_cmd.list);
+ free (style_formatted_cmd.list);
+ */
for (i = 0; i < self->pending_closes.number; i++)
{
diff --git a/tp/Texinfo/XS/convert/get_html_perl_info.c
b/tp/Texinfo/XS/convert/get_html_perl_info.c
index 771b068028..2fdbc9d144 100644
--- a/tp/Texinfo/XS/convert/get_html_perl_info.c
+++ b/tp/Texinfo/XS/convert/get_html_perl_info.c
@@ -228,6 +228,7 @@ html_converter_initialize_sv (SV *converter_sv,
SV *customized_upper_case_commands,
SV *customized_type_formatting,
SV *customized_accent_entities,
+ SV *customized_style_commands,
SV *customized_direction_strings
)
{
@@ -244,7 +245,6 @@ html_converter_initialize_sv (SV *converter_sv,
HV *default_output_units_conversion_hv;
SV **htmlxref_sv;
SV **formatting_function_sv;
- SV **style_commands_formatting_sv;
SV **stage_handlers_sv;
SV **special_unit_body_sv;
SV **types_open_sv;
@@ -261,7 +261,6 @@ html_converter_initialize_sv (SV *converter_sv,
HV *types_conversion_hv;
HV *output_units_conversion_hv;
CONVERTER *converter;
- int nr_accent_cmd = 0;
int nr_string_directions;
enum direction_string_type DS_type;
int nr_dir_str_contexts = TDS_context_string +1;
@@ -438,9 +437,9 @@ html_converter_initialize_sv (SV *converter_sv,
if (customized_accent_entities && SvOK (customized_accent_entities))
{
+ int cmd_idx = 0;
I32 hv_number;
I32 i;
- int cmd_idx = 0;
HV *accent_entities_hv
= (HV *)SvRV (customized_accent_entities);
@@ -496,20 +495,22 @@ html_converter_initialize_sv (SV *converter_sv,
}
}
-
-#define FETCH(key) key##_sv = hv_fetch (converter_hv, #key, strlen (#key), 0);
- FETCH(style_commands_formatting)
-
- if (style_commands_formatting_sv)
+ if (customized_style_commands && SvOK (customized_style_commands))
{
+ int cmd_idx = 0;
I32 hv_number;
I32 i;
HV *style_commands_formatting_hv
- = (HV *)SvRV (*style_commands_formatting_sv);
+ = (HV *)SvRV (customized_style_commands);
hv_number = hv_iterinit (style_commands_formatting_hv);
- initialize_cmd_list (&converter->style_formatted_cmd, hv_number, 0);
+
+ converter->html_customized_style_commands
+ = (COMMAND_HTML_STYLE_COMMAND_CONVERSION *) malloc ((hv_number + 1)
+ * sizeof (COMMAND_HTML_STYLE_COMMAND_CONVERSION));
+ memset (converter->html_customized_style_commands, 0,
+ (hv_number + 1) * sizeof (COMMAND_HTML_STYLE_COMMAND_CONVERSION));
for (i = 0; i < hv_number; i++)
{
@@ -528,9 +529,9 @@ html_converter_initialize_sv (SV *converter_sv,
I32 context_nr;
I32 j;
- converter->style_formatted_cmd.list[
- converter->style_formatted_cmd.number] = cmd;
- converter->style_formatted_cmd.number++;
+ COMMAND_HTML_STYLE_COMMAND_CONVERSION *custom_style_command
+ = &converter->html_customized_style_commands[cmd_idx];
+ custom_style_command->cmd = cmd;
context_nr = hv_iterinit (context_hv);
for (j = 0; j < context_nr; j++)
@@ -561,13 +562,17 @@ html_converter_initialize_sv (SV *converter_sv,
{
I32 spec_number;
I32 s;
- HTML_STYLE_COMMAND_CONVERSION *format_spec;
+ HTML_STYLE_COMMAND_CONVERSION *format_spec
+ = (HTML_STYLE_COMMAND_CONVERSION *)
+ malloc (sizeof (HTML_STYLE_COMMAND_CONVERSION));
HV *format_spec_hv = (HV *)SvRV (format_spec_sv);
- format_spec
- = &converter
- ->html_style_command_conversion[cmd][context_idx];
+ memset (format_spec, 0,
+ sizeof (HTML_STYLE_COMMAND_CONVERSION));
+
+ custom_style_command->conversion[context_idx]
+ = format_spec;
spec_number = hv_iterinit (format_spec_hv);
for (s = 0; s < spec_number; s++)
@@ -591,11 +596,13 @@ html_converter_initialize_sv (SV *converter_sv,
*/
}
}
+ cmd_idx++;
}
}
}
}
+#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)
{
@@ -1003,14 +1010,8 @@ html_converter_initialize_sv (SV *converter_sv,
conversion_formatting_reference, ref_name,
default_commands_conversion_hv,
commands_conversion_hv);
-
- /* NOTE use the loop to collect the number of accent commands too */
- if (builtin_command_data[i].flags & CF_accent)
- nr_accent_cmd++;
}
- initialize_cmd_list (&converter->accent_cmd, nr_accent_cmd, 0);
-
default_css_string_commands_conversion_hv
= (HV *)SvRV (default_css_string_commands_conversion);
/* copy the normal formatting references and replace the css strings
@@ -1033,13 +1034,6 @@ html_converter_initialize_sv (SV *converter_sv,
register_formatting_reference_default ("css_command_conversion",
conversion_formatting_reference, ref_name,
default_css_string_commands_conversion_hv);
-
- /* NOTE we use the loop to collect the accent commands too */
- if (builtin_command_data[i].flags & CF_accent)
- {
- converter->accent_cmd.list[converter->accent_cmd.number] = i;
- converter->accent_cmd.number++;
- }
}
diff --git a/tp/Texinfo/XS/convert/get_html_perl_info.h
b/tp/Texinfo/XS/convert/get_html_perl_info.h
index 0b56cc38f7..19f4b0e407 100644
--- a/tp/Texinfo/XS/convert/get_html_perl_info.h
+++ b/tp/Texinfo/XS/convert/get_html_perl_info.h
@@ -25,6 +25,7 @@ void html_converter_initialize_sv (SV *converter_sv,
SV *customized_upper_case_commands,
SV *customized_type_formatting,
SV *customized_accent_entities,
+ SV *customized_style_commands,
SV *customized_direction_strings
);
diff --git a/tp/Texinfo/XS/main/converter_types.h
b/tp/Texinfo/XS/main/converter_types.h
index 9c82f68171..160221175a 100644
--- a/tp/Texinfo/XS/main/converter_types.h
+++ b/tp/Texinfo/XS/main/converter_types.h
@@ -340,6 +340,11 @@ typedef struct HTML_STYLE_COMMAND_CONVERSION {
int quote;
} HTML_STYLE_COMMAND_CONVERSION;
+typedef struct COMMAND_HTML_STYLE_COMMAND_CONVERSION {
+ enum command_id cmd;
+ HTML_STYLE_COMMAND_CONVERSION *conversion[STYLE_COMMAND_CONTEXT_NR];
+} COMMAND_HTML_STYLE_COMMAND_CONVERSION;
+
typedef struct HTML_DIRECTION_STRING_TRANSLATED {
char *to_convert;
char *converted[TDS_context_string +1];
@@ -783,8 +788,6 @@ typedef struct CONVERTER {
/* set for a converter */
int external_references_number; /* total number of external references
that could be called */
- COMMAND_ID_LIST style_formatted_cmd;
- COMMAND_ID_LIST accent_cmd;
int code_types[TXI_TREE_TYPES_NUMBER];
COMMAND_INTEGER_INFORMATION *html_customized_upper_case_commands;
TYPE_INTEGER_INFORMATION *html_customized_code_types;
@@ -834,6 +837,7 @@ typedef struct CONVERTER {
PRE_CLASS_TYPE_INFO *html_customized_pre_class_types;
COMMAND_ACCENT_ENTITY_INFO *html_customized_accent_entity_info;
HTML_STYLE_COMMAND_CONVERSION
html_style_command_conversion[BUILTIN_CMD_NUMBER][STYLE_COMMAND_CONTEXT_NR];
+ COMMAND_HTML_STYLE_COMMAND_CONVERSION *html_customized_style_commands;
/* set for a converter, modified in a document */
HTML_NO_ARG_COMMAND_CONVERSION
html_no_arg_command_conversion[BUILTIN_CMD_NUMBER][NO_ARG_COMMAND_CONTEXT_NR];
char ***directions_strings[TDS_TYPE_MAX_NR];
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/XS/convert/convert_html.c (accent_cmd, html_format_setup) (html_converter_initialize, html_free_converter), tp/Texinfo/XS/convert/get_html_perl_info.c (html_converter_initialize_sv), tp/Texinfo/XS/main/converter_types.h (CONVERTER): collect accent commands in accent_cmd in convert_html.c, not in converter. Remove accent_cmd converter field.,
Patrice Dumas <=