[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/XS/convert/converter.c (default_uppe
From: |
Patrice Dumas |
Subject: |
branch master updated: * tp/Texinfo/XS/convert/converter.c (default_upper_case_commands): add, with @sc. |
Date: |
Tue, 01 Oct 2024 14:59:31 -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 2b92f83ebf * tp/Texinfo/XS/convert/converter.c
(default_upper_case_commands): add, with @sc.
2b92f83ebf is described below
commit 2b92f83ebfbe4fdfe4b2c41ed5d2c77654b1130b
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sun Jul 28 08:44:42 2024 +0200
* tp/Texinfo/XS/convert/converter.c (default_upper_case_commands):
add, with @sc.
* 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_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
(COMMAND_INTEGER_INFORMATION, CONVERTER): add
html_customized_upper_case_commands field in converter. Pass
customized_upper_case_commands to converter_initialize instead of
getting upper_case_commands directly from Perl converter. Initialize
converter upper_case in html_converter_initialize based on defaults in
default_upper_case_commands, and add
html_customized_upper_case_commands information on top.
---
ChangeLog | 18 ++++++++++++++++++
tp/TODO | 1 -
tp/Texinfo/Convert/HTML.pm | 3 ++-
tp/Texinfo/XS/convert/ConvertXS.xs | 2 +-
tp/Texinfo/XS/convert/convert_html.c | 17 +++++++++++++++++
tp/Texinfo/XS/convert/converter.c | 5 +++++
tp/Texinfo/XS/convert/converter.h | 2 ++
tp/Texinfo/XS/convert/get_html_perl_info.c | 23 +++++++++++++++++------
tp/Texinfo/XS/convert/get_html_perl_info.h | 1 +
tp/Texinfo/XS/main/converter_types.h | 9 ++++++++-
10 files changed, 71 insertions(+), 10 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index d8c646ce28..d6d687cca9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,24 @@
* doc/texinfo.texi (HTML Xref Configuration): edit description
of splitting search order.
+2024-07-27 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/XS/convert/converter.c (default_upper_case_commands):
+ add, with @sc.
+
+ * 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_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
+ (COMMAND_INTEGER_INFORMATION, CONVERTER): add
+ html_customized_upper_case_commands field in converter. Pass
+ customized_upper_case_commands to converter_initialize instead of
+ getting upper_case_commands directly from Perl converter. Initialize
+ converter upper_case in html_converter_initialize based on defaults in
+ default_upper_case_commands, and add
+ html_customized_upper_case_commands information on top.
+
2024-07-27 Patrice Dumas <pertusus@free.fr>
* po_document/POTFILES.in: add tp/Texinfo/Data.pm.
diff --git a/tp/TODO b/tp/TODO
index 34a652d3b7..9d2fe65aef 100644
--- a/tp/TODO
+++ b/tp/TODO
@@ -15,7 +15,6 @@ HTML data
to check
%quoted_style_commands
-%default_upper_case_commands
Bugs
====
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index 30c776c541..81e39222b3 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -8738,7 +8738,7 @@ my %special_characters = (
'non_breaking_space' => [$xml_named_entity_nbsp, '00A0'],
);
-sub _XS_html_converter_initialize($$$$$$$$$$$$$)
+sub _XS_html_converter_initialize($$$$$$$$$$$$$$)
{
}
@@ -9129,6 +9129,7 @@ sub converter_initialize($)
\%default_css_string_types_conversion,
\%default_output_units_conversion,
\%defaults_format_special_unit_body_contents,
+ $customized_upper_case_commands,
\%default_css_element_class_styles,
\%default_converted_directions_strings
);
diff --git a/tp/Texinfo/XS/convert/ConvertXS.xs
b/tp/Texinfo/XS/convert/ConvertXS.xs
index b07fc11c72..adc30ce3b9 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
*default_css_element_class_styles, 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 *default_css_element_class_styles, SV
*default_converted_ [...]
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 e629f9ad29..37d08ed105 100644
--- a/tp/Texinfo/XS/convert/convert_html.c
+++ b/tp/Texinfo/XS/convert/convert_html.c
@@ -17219,8 +17219,22 @@ html_converter_initialize (CONVERTER *self)
self->registered_ids = new_string_list ();
#endif
+ /* for @sc */
+ for (i = 0; default_upper_case_commands[i]; i++)
+ self->upper_case[default_upper_case_commands[i]] = 1;
+
/* initialization needing some information from perl */
+ if (self->html_customized_upper_case_commands)
+ {
+ for (i = 0; self->html_customized_upper_case_commands[i].cmd; i++)
+ {
+ COMMAND_INTEGER_INFORMATION *customized_upper
+ = &self->html_customized_upper_case_commands[i];
+ self->upper_case[customized_upper->cmd] = customized_upper->integer;
+ }
+ }
+
nr_special_units = self->special_unit_varieties.number;
self->direction_unit_direction_name = (const char **) malloc
@@ -19329,6 +19343,9 @@ html_free_converter (CONVERTER *self)
free (self->special_unit_info[i]);
}
+ free (self->html_customized_upper_case_commands);
+ self->html_customized_upper_case_commands = 0;
+
/* should be freed on exit.
free (no_arg_formatted_cmd.list);
*/
diff --git a/tp/Texinfo/XS/convert/converter.c
b/tp/Texinfo/XS/convert/converter.c
index 6839fa9c60..c8fd54ef58 100644
--- a/tp/Texinfo/XS/convert/converter.c
+++ b/tp/Texinfo/XS/convert/converter.c
@@ -70,6 +70,11 @@ enum command_id no_brace_command_accent_upper_case[][2] = {
{0, 0},
};
+/* can be used in converters */
+enum command_id default_upper_case_commands[] = {
+ CM_sc, 0,
+};
+
static CONVERTER **converter_list;
static size_t converter_number;
static size_t converter_space;
diff --git a/tp/Texinfo/XS/convert/converter.h
b/tp/Texinfo/XS/convert/converter.h
index cd16c37ad9..3f33ae9926 100644
--- a/tp/Texinfo/XS/convert/converter.h
+++ b/tp/Texinfo/XS/convert/converter.h
@@ -90,6 +90,8 @@ typedef struct PATHS_INFORMATION {
extern enum command_id no_brace_command_accent_upper_case[][2];
+extern enum command_id default_upper_case_commands[];
+
/* in generated cmd_converter.c */
extern const char * xml_text_entity_no_arg_commands[];
diff --git a/tp/Texinfo/XS/convert/get_html_perl_info.c
b/tp/Texinfo/XS/convert/get_html_perl_info.c
index d1b17173c8..1e6fb9afdc 100644
--- a/tp/Texinfo/XS/convert/get_html_perl_info.c
+++ b/tp/Texinfo/XS/convert/get_html_perl_info.c
@@ -134,6 +134,7 @@ html_converter_initialize_sv (SV *converter_sv,
SV *default_css_string_types_conversion,
SV *default_output_units_conversion,
SV *default_special_unit_body,
+ SV *customized_upper_case_commands,
SV *default_css_element_class_styles,
SV *default_converted_directions_strings
)
@@ -163,7 +164,6 @@ html_converter_initialize_sv (SV *converter_sv,
SV **output_units_conversion_sv;
SV **file_id_setting_sv;
SV **code_types_sv;
- SV **upper_case_commands_sv;
SV **pre_class_types_sv;
SV **translated_direction_strings_sv;
SV **customized_direction_strings_sv;
@@ -712,17 +712,22 @@ html_converter_initialize_sv (SV *converter_sv,
}
}
- FETCH(upper_case_commands)
-
- if (upper_case_commands_sv)
+ if (customized_upper_case_commands && SvOK (customized_upper_case_commands))
{
I32 hv_number;
I32 i;
+ int cmd_index = 0;
- HV *upper_case_commands_hv = (HV *)SvRV (*upper_case_commands_sv);
+ HV *upper_case_commands_hv = (HV *)SvRV (customized_upper_case_commands);
hv_number = hv_iterinit (upper_case_commands_hv);
+ converter->html_customized_upper_case_commands
+ = (COMMAND_INTEGER_INFORMATION *) malloc ((hv_number + 1)
+ * sizeof (COMMAND_INTEGER_INFORMATION));
+ memset (converter->html_customized_upper_case_commands, 0,
+ (hv_number + 1) * sizeof (COMMAND_INTEGER_INFORMATION));
+
for (i = 0; i < hv_number; i++)
{
I32 retlen;
@@ -736,7 +741,13 @@ html_converter_initialize_sv (SV *converter_sv,
if (!cmd)
fprintf (stderr, "ERROR: %s: no upper-case command\n",
cmdname);
else
- converter->upper_case[cmd] = upper_case_value;
+ {
+ COMMAND_INTEGER_INFORMATION *customized_upper
+ =
&converter->html_customized_upper_case_commands[cmd_index];
+ customized_upper->cmd = cmd;
+ customized_upper->integer = upper_case_value;
+ cmd_index++;
+ }
}
}
}
diff --git a/tp/Texinfo/XS/convert/get_html_perl_info.h
b/tp/Texinfo/XS/convert/get_html_perl_info.h
index 2de258f34f..6a264bcbc8 100644
--- a/tp/Texinfo/XS/convert/get_html_perl_info.h
+++ b/tp/Texinfo/XS/convert/get_html_perl_info.h
@@ -20,6 +20,7 @@ void html_converter_initialize_sv (SV *converter_sv,
SV *default_css_string_types_conversion,
SV *default_output_units_conversion,
SV *default_special_unit_body,
+ SV *customized_upper_case_commands,
SV *default_css_element_class_styles,
SV *default_converted_directions_strings
);
diff --git a/tp/Texinfo/XS/main/converter_types.h
b/tp/Texinfo/XS/main/converter_types.h
index 7f7a41e14b..1d4306d362 100644
--- a/tp/Texinfo/XS/main/converter_types.h
+++ b/tp/Texinfo/XS/main/converter_types.h
@@ -418,6 +418,11 @@ typedef struct TRANSLATED_COMMAND {
char *translation;
} TRANSLATED_COMMAND;
+typedef struct COMMAND_INTEGER_INFORMATION {
+ enum command_id cmd;
+ int integer;
+} COMMAND_INTEGER_INFORMATION;
+
typedef struct FILE_NAME_PATH_COUNTER {
char *filename;
char *normalized_filename;
@@ -764,6 +769,8 @@ typedef struct CONVERTER {
struct TEXT_OPTIONS *convert_text_options;
struct TEXT_OPTIONS *convert_index_text_options;
+ int upper_case[BUILTIN_CMD_NUMBER];
+
/* output unit files API */
FILE_NAME_PATH_COUNTER_LIST output_unit_files;
@@ -780,8 +787,8 @@ typedef struct CONVERTER {
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;
char *pre_class_types[TXI_TREE_TYPES_NUMBER];
- int upper_case[BUILTIN_CMD_NUMBER];
ACCENT_ENTITY_INFO accent_entities[BUILTIN_CMD_NUMBER];
FIXED_STRING_WITH_LEN special_character[SC_non_breaking_space+1];
FIXED_STRING_WITH_LEN line_break_element;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/XS/convert/converter.c (default_upper_case_commands): add, with @sc.,
Patrice Dumas <=