[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/XS/convert/html_conversion_state.c (
From: |
Patrice Dumas |
Subject: |
branch master updated: * tp/Texinfo/XS/convert/html_conversion_state.c (compare_global_units_direction_name) (html_find_direction_name_global_unit), tp/Texinfo/XS/convert/html_prepare_converter.c: move html_find_direction_name_global_unit to html_conversion_state.c and duplicate compare_global_units_direction_name. |
Date: |
Fri, 04 Oct 2024 19:23:15 -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 aec3b0ef6c * tp/Texinfo/XS/convert/html_conversion_state.c
(compare_global_units_direction_name) (html_find_direction_name_global_unit),
tp/Texinfo/XS/convert/html_prepare_converter.c: move
html_find_direction_name_global_unit to html_conversion_state.c and duplicate
compare_global_units_direction_name.
aec3b0ef6c is described below
commit aec3b0ef6cd53a0da31eb2b405d59524e12f53cb
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Thu Aug 15 14:08:06 2024 +0200
* tp/Texinfo/XS/convert/html_conversion_state.c
(compare_global_units_direction_name)
(html_find_direction_name_global_unit),
tp/Texinfo/XS/convert/html_prepare_converter.c: move
html_find_direction_name_global_unit to html_conversion_state.c and
duplicate compare_global_units_direction_name.
---
ChangeLog | 9 +++
tp/Texinfo/XS/convert/html_conversion_state.c | 29 +++++++++
tp/Texinfo/XS/convert/html_conversion_state.h | 3 +
tp/Texinfo/XS/convert/html_prepare_converter.c | 84 ++++++++++++++++----------
tp/Texinfo/XS/convert/html_prepare_converter.h | 12 +++-
5 files changed, 103 insertions(+), 34 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index f8e989c8ce..ed1da42b1b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -8,6 +8,15 @@
(html_default_format_node_redirection_page)
(html_default_format_special_body_about): fix function names.
+2024-08-15 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/XS/convert/html_conversion_state.c
+ (compare_global_units_direction_name)
+ (html_find_direction_name_global_unit),
+ tp/Texinfo/XS/convert/html_prepare_converter.c: move
+ html_find_direction_name_global_unit to html_conversion_state.c and
+ duplicate compare_global_units_direction_name.
+
2024-08-15 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/XS/convert/format_html.c: move code around to have all
diff --git a/tp/Texinfo/XS/convert/html_conversion_state.c
b/tp/Texinfo/XS/convert/html_conversion_state.c
index 552081a432..d5605f13c5 100644
--- a/tp/Texinfo/XS/convert/html_conversion_state.c
+++ b/tp/Texinfo/XS/convert/html_conversion_state.c
@@ -1165,6 +1165,35 @@ html_check_htmlxref_already_warned (CONVERTER *self,
const char *manual_name,
return 0;
}
+static int
+compare_global_units_direction_name (const void *a, const void *b)
+{
+ const SPECIAL_UNIT_DIRECTION *gudn_a = (const SPECIAL_UNIT_DIRECTION *) a;
+ const SPECIAL_UNIT_DIRECTION *gudn_b = (const SPECIAL_UNIT_DIRECTION *) b;
+
+ return strcmp (gudn_a->direction, gudn_b->direction);
+}
+
+/* Used from Perl through an XS override, in similar C codes the
+ direction indices are used instead of the direction names */
+const OUTPUT_UNIT *
+html_find_direction_name_global_unit (const CONVERTER *self,
+ const char *direction_name)
+{
+ SPECIAL_UNIT_DIRECTION *result = 0;
+ static SPECIAL_UNIT_DIRECTION searched_direction;
+
+ searched_direction.direction = direction_name;
+ result = (SPECIAL_UNIT_DIRECTION *) bsearch (&searched_direction,
+ self->global_units_direction_name.list,
+ self->global_units_direction_name.number,
+ sizeof (SPECIAL_UNIT_DIRECTION),
+ compare_global_units_direction_name);
+ if (!result)
+ return 0;
+ return result->output_unit;
+}
+
void
diff --git a/tp/Texinfo/XS/convert/html_conversion_state.h
b/tp/Texinfo/XS/convert/html_conversion_state.h
index 474ec2dce1..93c9f06707 100644
--- a/tp/Texinfo/XS/convert/html_conversion_state.h
+++ b/tp/Texinfo/XS/convert/html_conversion_state.h
@@ -101,6 +101,9 @@ size_t html_check_htmlxref_already_warned (CONVERTER *self,
const char *manual_name,
const SOURCE_INFO *source_info);
+const OUTPUT_UNIT *html_find_direction_name_global_unit (const CONVERTER *self,
+ const char *direction_name);
+
void initialize_css_selector_style_list
(CSS_SELECTOR_STYLE_LIST *selector_styles,
size_t size);
diff --git a/tp/Texinfo/XS/convert/html_prepare_converter.c
b/tp/Texinfo/XS/convert/html_prepare_converter.c
index e47ddf7e97..5575725d53 100644
--- a/tp/Texinfo/XS/convert/html_prepare_converter.c
+++ b/tp/Texinfo/XS/convert/html_prepare_converter.c
@@ -196,6 +196,10 @@ COMMAND_ID_LIST style_formatted_cmd;
COMMAND_ID_LIST accent_cmd;
COMMAND_ID_LIST format_raw_cmd;
+
+
+/* Initialization code called only once. Setup some base/default data */
+
void
register_format_context_command (enum command_id cmd)
{
@@ -599,6 +603,11 @@ html_format_setup (void)
free (css_string_text.text);
}
+
+
+/* setup special units info, apply defaults based on customization variables.
+ Apply specific customizations (from Perl) */
+
/* for customized special_unit_info (coming from Perl) */
SPECIAL_UNIT_INFO *
html_add_special_unit_info (SPECIAL_UNIT_INFO_LIST *special_unit_info_list,
@@ -623,7 +632,7 @@ html_add_special_unit_info (SPECIAL_UNIT_INFO_LIST
*special_unit_info_list,
return special_unit_info;
}
-char **
+static char **
new_special_unit_info_type (int special_units_varieties_nr)
{
char **special_unit_info = (char **)
@@ -685,6 +694,7 @@ html_converter_init_special_unit (CONVERTER *self)
}
}
+/* Used to get Perl formatting references. Initalize in C */
FORMATTING_REFERENCE *
new_special_unit_formatting_references (int special_units_varieties_nr)
{
@@ -695,6 +705,7 @@ new_special_unit_formatting_references (int
special_units_varieties_nr)
return formatting_references;
}
+/* sed to get htmlxref info from Perl. Initalize in C */
HTMLXREF_MANUAL *
new_htmlxref_manual_list (size_t size)
{
@@ -1778,6 +1789,16 @@ html_converter_customize (CONVERTER *self)
*/
}
+
+
+/* Initialize output state. Sequence of:
+ html_initialize_output_state
+ html_setup_output for output() or html_setup_convert for convert()
+
+ To be followed by setting up output units
+ html_prepare_conversion_units
+ */
+
static void
copy_html_no_arg_command_conversion (HTML_NO_ARG_COMMAND_CONVERSION *to,
HTML_NO_ARG_COMMAND_CONVERSION *from)
@@ -1869,7 +1890,7 @@ close_lone_conf_element (OPTION *option)
}
}
-int
+static int
compare_index_name (const void *a, const void *b)
{
const INDEX **idx_a = (const INDEX **) a;
@@ -1878,7 +1899,9 @@ compare_index_name (const void *a, const void *b)
return strcmp ((*idx_a)->name, (*idx_b)->name);
}
-const enum command_id spaces_cmd[] = {CM_SPACE, CM_TAB, CM_NEWLINE, CM_tie};
+static const enum command_id spaces_cmd[] = {
+ CM_SPACE, CM_TAB, CM_NEWLINE, CM_tie
+};
/* called very early in conversion functions, before updating
customization, before calling user-defined functions... */
@@ -2906,7 +2929,7 @@ typedef struct SPECIAL_UNIT_ORDER {
const char *variety;
} SPECIAL_UNIT_ORDER;
-int
+static int
compare_special_units (const void *a, const void *b)
{
const SPECIAL_UNIT_ORDER *spu_order_a = (const SPECIAL_UNIT_ORDER *) a;
@@ -2918,7 +2941,7 @@ compare_special_units (const void *a, const void *b)
return strcmp (spu_order_a->variety, spu_order_b->variety);
}
-void
+static void
prepare_special_units (CONVERTER *self, size_t output_units_descriptor)
{
size_t i;
@@ -3141,6 +3164,16 @@ html_prepare_conversion_units (CONVERTER *self)
+/* prepare HTML targets for nodes, floats, sections, footnotes, heading
+ commands, index entries and special output units. Also prepare
+ normalized file names for root commands.
+
+ Both for output() and convert().
+ NOTE: in Perl done in prepare_conversion_units, separated here to
+ be able, in XS, to setup some Perl data between
html_prepare_conversion_units
+ and html_prepare_conversion_units_targets.
+ */
+
int
html_id_is_registered (CONVERTER *self, const char *string)
{
@@ -3223,7 +3256,7 @@ unique_target (CONVERTER *self, const char *target_base)
}
/* calls customization function requiring output units */
-void
+static void
set_special_units_targets_files (CONVERTER *self, const char *document_name)
{
size_t i;
@@ -3505,7 +3538,7 @@ new_sectioning_command_target (CONVERTER *self, const
ELEMENT *command)
too, is not used later for Top anchors or links, see the NOTE below
associated with setting TOP_NODE_FILE_TARGET.
*/
-void
+static void
set_root_commands_targets_node_files (CONVERTER *self)
{
@@ -3604,7 +3637,7 @@ set_root_commands_targets_node_files (CONVERTER *self)
}
}
-void
+static void
prepare_index_entries_targets (CONVERTER *self)
{
if (self->document->indices_info.number > 0)
@@ -3786,7 +3819,7 @@ static const enum command_id heading_commands_list[] = {
};
/* indirectly calls customization function requiring elements */
-void
+static void
set_heading_commands_targets (CONVERTER *self)
{
int i;
@@ -3867,7 +3900,7 @@ check_targets_order (enum command_id cmd,
HTML_TARGET_LIST *element_targets)
The other data are in document order, for nodes and similar because
the labels list is used instead of identifiers_target on purpose.
*/
-void
+static void
sort_cmd_targets (CONVERTER *self)
{
enum command_id cmd;
@@ -3929,6 +3962,14 @@ html_prepare_conversion_units_targets (CONVERTER *self,
+/* For output() prepare pages and associate them to files, setup unit
+ direction and file counters. In that case
+ html_prepare_output_units_global_targets is called in
+ html_prepare_units_directions_files.
+
+ For convert() html_prepare_output_units_global_targets only is called.
+ */
+
/* Associate output units to the global targets, First, Last, Top, Index.
and special output units */
void
@@ -4082,7 +4123,7 @@ compare_global_units_direction_name (const void *a, const
void *b)
/* To find more easily a global output unit based on a direction name, for an
XS interface, associate global output units to names and sort according
- to names */
+ to names. Only called from Perl/XS, not need to call when doing C only */
void
html_setup_global_units_direction_names (CONVERTER *self)
{
@@ -4132,27 +4173,6 @@ html_setup_global_units_direction_names (CONVERTER *self)
self->global_units_direction_name.number = global_directions_nr;
}
-/* Used from Perl through an XS override, in similar C codes the
- direction indices are used instead of the direction names */
-const OUTPUT_UNIT *
-html_find_direction_name_global_unit (const CONVERTER *self,
- const char *direction_name)
-{
- SPECIAL_UNIT_DIRECTION *result = 0;
- static SPECIAL_UNIT_DIRECTION searched_direction;
-
- searched_direction.direction = direction_name;
- result = (SPECIAL_UNIT_DIRECTION *) bsearch (&searched_direction,
- self->global_units_direction_name.list,
- self->global_units_direction_name.number,
- sizeof (SPECIAL_UNIT_DIRECTION),
- compare_global_units_direction_name);
- if (!result)
- return 0;
- return result->output_unit;
-}
-
-
static char *
add_to_unit_file_name_paths (char **unit_file_name_paths,
const char *filename,
diff --git a/tp/Texinfo/XS/convert/html_prepare_converter.h
b/tp/Texinfo/XS/convert/html_prepare_converter.h
index 517eb5ec39..2338a8f3fe 100644
--- a/tp/Texinfo/XS/convert/html_prepare_converter.h
+++ b/tp/Texinfo/XS/convert/html_prepare_converter.h
@@ -16,6 +16,8 @@ extern const char
*htmlxref_split_type_names[htmlxref_split_type_chapter + 1];
void html_format_setup (void);
+
+
FORMATTING_REFERENCE *new_special_unit_formatting_references
(int special_units_varieties_nr);
@@ -28,6 +30,8 @@ SPECIAL_UNIT_INFO *html_add_special_unit_info (
void html_converter_init_special_unit (CONVERTER *self);
void html_converter_customize (CONVERTER *self);
+
+
char ***new_directions_strings_type (int nr_string_directions,
int nr_dir_str_contexts);
@@ -44,17 +48,21 @@ void html_setup_convert (CONVERTER *self);
void html_prepare_conversion_units (CONVERTER *self);
+
+
int html_id_is_registered (CONVERTER *self, const char *string);
void html_register_id (CONVERTER *self, const char *string);
void html_prepare_conversion_units_targets (CONVERTER *self,
const char *document_name);
+
+/* called separately for convert() */
void html_prepare_output_units_global_targets (CONVERTER *self);
+
+/* called from XS only */
void html_setup_global_units_direction_names (CONVERTER *self);
-const OUTPUT_UNIT *html_find_direction_name_global_unit (const CONVERTER *self,
- const char *direction_name);
FILE_SOURCE_INFO_LIST * html_prepare_units_directions_files (CONVERTER *self,
const char *output_file, const char *destination_directory,
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/XS/convert/html_conversion_state.c (compare_global_units_direction_name) (html_find_direction_name_global_unit), tp/Texinfo/XS/convert/html_prepare_converter.c: move html_find_direction_name_global_unit to html_conversion_state.c and duplicate compare_global_units_direction_name.,
Patrice Dumas <=