[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
From: |
Patrice Dumas |
Date: |
Fri, 4 Oct 2024 12:17:54 -0400 (EDT) |
branch: master
commit 9781a24ef63da16c351ad6c935b1b3e5954f941f
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Wed Aug 14 19:52:00 2024 +0200
* tp/Texinfo/XS/convert/convert_html.c,
tp/Texinfo/XS/convert/html_prepare_converter.c
(html_global_unit_direction_names, html_formatting_reference_names)
(html_add_special_unit_info, new_special_unit_info_type)
(new_special_unit_formatting_references, new_htmlxref_manual_list)
(initialize_js_categories_list, initialize_jslicense_files): move
functions and variables to html_prepare_converter.c.
---
ChangeLog | 10 +++
tp/Texinfo/XS/convert/build_html_perl_state.c | 10 ++-
tp/Texinfo/XS/convert/convert_html.c | 89 -------------------------
tp/Texinfo/XS/convert/convert_html.h | 21 ------
tp/Texinfo/XS/convert/get_html_perl_info.c | 11 +++-
tp/Texinfo/XS/convert/html_prepare_converter.c | 90 ++++++++++++++++++++++++++
tp/Texinfo/XS/convert/html_prepare_converter.h | 26 ++++++++
7 files changed, 145 insertions(+), 112 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 94501a7097..d30f17c049 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -8,6 +8,16 @@
* tp/Texinfo/XS/convert/convert_html.c (html_command_description):
call html_get_target instead of find_element_target.
+2024-08-14 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/XS/convert/convert_html.c,
+ tp/Texinfo/XS/convert/html_prepare_converter.c
+ (html_global_unit_direction_names, html_formatting_reference_names)
+ (html_add_special_unit_info, new_special_unit_info_type)
+ (new_special_unit_formatting_references, new_htmlxref_manual_list)
+ (initialize_js_categories_list, initialize_jslicense_files): move
+ functions and variables to html_prepare_converter.c.
+
2024-08-14 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/XS/convert/convert_html.c (html_get_target): call
diff --git a/tp/Texinfo/XS/convert/build_html_perl_state.c
b/tp/Texinfo/XS/convert/build_html_perl_state.c
index 2857514b06..e4ab2192e4 100644
--- a/tp/Texinfo/XS/convert/build_html_perl_state.c
+++ b/tp/Texinfo/XS/convert/build_html_perl_state.c
@@ -48,8 +48,16 @@
#include "build_perl_info.h"
/* for NAMED_STRING_ELEMENT_LIST */
#include "translations.h"
-/* also for html_argument_formatting_type_names */
+/* for no_arg_formatted_cmd */
+#include "html_converter_types.h"
+/* for html_conversion_context_type_names direction_string_type_names
+ direction_string_context_names html_argument_formatting_type_names
+ translated_special_unit_info
+ */
#include "convert_html.h"
+/* for special_unit_info_type_names html_global_unit_direction_names
+ html_setup_global_units_direction_names */
+#include "html_prepare_converter.h"
#include "build_html_perl_state.h"
#define LOCALEDIR DATADIR "/locale"
diff --git a/tp/Texinfo/XS/convert/convert_html.c
b/tp/Texinfo/XS/convert/convert_html.c
index 6ec72dfc1c..d7e2c6da76 100644
--- a/tp/Texinfo/XS/convert/convert_html.c
+++ b/tp/Texinfo/XS/convert/convert_html.c
@@ -69,25 +69,12 @@
#include "html_conversion_state.h"
#include "convert_html.h"
-const char *html_global_unit_direction_names[] = {
- #define hgdt_name(name) #name,
- HTML_GLOBAL_DIRECTIONS_LIST
- #undef hgdt_name
- " ",
-};
-
const char *html_conversion_context_type_names[] = {
#define cctx_type(name) #name,
HCC_CONTEXT_TYPES_LIST
#undef cctx_type
};
-const char *html_formatting_reference_names[] = {
- #define html_fr_reference(name) #name,
- HTML_FORMATTING_REFERENCES_LIST
- #undef html_fr_reference
-};
-
const char *html_argument_formatting_type_names[] = {
#define html_aft_type(name) #name,
HTML_ARGUMENTS_FORMATTED_FORMAT_TYPE
@@ -1490,29 +1477,6 @@ 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;
-}
-
const char *
html_command_id (const CONVERTER *self, const ELEMENT *command)
{
@@ -13459,59 +13423,6 @@ reset_translated_special_unit_info_tree (CONVERTER
*self)
/* these constructors/initialization allow to use malloc from this
file and not from a file including Perl headers */
-HTMLXREF_MANUAL *
-new_htmlxref_manual_list (size_t size)
-{
- HTMLXREF_MANUAL *result = (HTMLXREF_MANUAL *)
- malloc (size * sizeof (HTMLXREF_MANUAL));
- memset (result, 0, size * sizeof (HTMLXREF_MANUAL));
-
- return result;
-}
-
-void
-initialize_js_categories_list (JSLICENSE_CATEGORY_LIST *js_files_info,
- size_t size)
-{
- js_files_info->list = (JSLICENSE_FILE_INFO_LIST *)
- malloc (size * sizeof (JSLICENSE_FILE_INFO_LIST));
- memset (js_files_info->list, 0,
- size * sizeof (JSLICENSE_FILE_INFO_LIST));
- js_files_info->number = size;
-}
-
-void
-initialize_jslicense_files (JSLICENSE_FILE_INFO_LIST *jslicences_files_info,
- const char *category, size_t size)
-{
- jslicences_files_info->category = strdup (category);
- jslicences_files_info->list = (JSLICENSE_FILE_INFO *)
- malloc (size * sizeof (JSLICENSE_FILE_INFO));
- memset (jslicences_files_info->list, 0,
- size * sizeof (JSLICENSE_FILE_INFO));
- jslicences_files_info->number = size;
-}
-
-FORMATTING_REFERENCE *
-new_special_unit_formatting_references (int special_units_varieties_nr)
-{
- FORMATTING_REFERENCE *formatting_references = (FORMATTING_REFERENCE *)
- malloc (special_units_varieties_nr * sizeof (FORMATTING_REFERENCE));
- memset (formatting_references, 0,
- special_units_varieties_nr * sizeof (FORMATTING_REFERENCE));
- return formatting_references;
-}
-
-char **
-new_special_unit_info_type (int special_units_varieties_nr)
-{
- char **special_unit_info = (char **)
- malloc ((special_units_varieties_nr +1) * sizeof (char *));
- memset (special_unit_info, 0,
- (special_units_varieties_nr +1) * sizeof (char *));
- return special_unit_info;
-}
-
void
reset_special_unit_info_list (SPECIAL_UNIT_INFO_LIST *special_unit_info_list)
{
diff --git a/tp/Texinfo/XS/convert/convert_html.h
b/tp/Texinfo/XS/convert/convert_html.h
index a3d3eafcac..7fd685d23e 100644
--- a/tp/Texinfo/XS/convert/convert_html.h
+++ b/tp/Texinfo/XS/convert/convert_html.h
@@ -29,21 +29,15 @@ typedef struct ROOT_AND_UNIT {
} ROOT_AND_UNIT;
extern const char *html_conversion_context_type_names[];
-extern const char *html_global_unit_direction_names[];
-
-extern const char *html_formatting_reference_names[];
extern const char *html_argument_formatting_type_names[];
extern const TRANSLATED_SUI_ASSOCIATION translated_special_unit_info[];
-extern const char *special_unit_info_type_names[SUI_type_heading + 1];
-extern const char *htmlxref_split_type_names[htmlxref_split_type_chapter + 1];
extern const char *direction_string_type_names[];
extern const char *direction_string_context_names[];
extern const char *html_stage_handler_stage_type_names[];
-extern COMMAND_ID_LIST no_arg_formatted_cmd;
void html_conversion_finalization (CONVERTER *self);
@@ -95,20 +89,6 @@ int html_run_stage_handlers (CONVERTER *self,
void html_default_format_protect_text (const char *text, TEXT *result);
-HTMLXREF_MANUAL *new_htmlxref_manual_list (size_t size);
-void initialize_js_categories_list (JSLICENSE_CATEGORY_LIST *js_files_info,
- size_t size);
-void initialize_jslicense_files
- (JSLICENSE_FILE_INFO_LIST *jslicences_files_info,
- const char *category, size_t size);
-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_special_unit_variety_direction_index (const CONVERTER *self,
const char *special_unit_variety);
@@ -317,7 +297,6 @@ SPECIAL_BODY_FORMATTING_FUNCTION(about)
void html_prepare_output_units_global_targets (CONVERTER *self);
-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);
diff --git a/tp/Texinfo/XS/convert/get_html_perl_info.c
b/tp/Texinfo/XS/convert/get_html_perl_info.c
index d87582bde5..380a58a834 100644
--- a/tp/Texinfo/XS/convert/get_html_perl_info.c
+++ b/tp/Texinfo/XS/convert/get_html_perl_info.c
@@ -44,8 +44,17 @@
#include "output_unit.h"
#include "converter.h"
#include "html_conversion_state.h"
-/* new_directions_strings_type */
+/* new_directions_strings_type initialize_js_categories_list
+ initialize_jslicense_files new_special_unit_formatting_references
+ new_htmlxref_manual_list htmlxref_split_type_names
+ html_formatting_reference_names */
#include "html_prepare_converter.h"
+/*
+ for html_conversion_context_type_names direction_string_type_names
+ direction_string_context_names html_stage_handler_stage_type_names
+ html_special_unit_variety_direction_index html_get_target
+ find_footnote_id_number
+ */
#include "convert_html.h"
#include "get_perl_info.h"
#include "get_converter_perl_info.h"
diff --git a/tp/Texinfo/XS/convert/html_prepare_converter.c
b/tp/Texinfo/XS/convert/html_prepare_converter.c
index 4e1748375d..ab640d49e3 100644
--- a/tp/Texinfo/XS/convert/html_prepare_converter.c
+++ b/tp/Texinfo/XS/convert/html_prepare_converter.c
@@ -65,6 +65,19 @@ typedef struct COMMAND_ID_ARGS_SPECIFICATION {
/* in main/conversion_data.c */
extern const CSS_SELECTOR_STYLE base_default_css_element_class_styles[];
+const char *html_global_unit_direction_names[] = {
+ #define hgdt_name(name) #name,
+ HTML_GLOBAL_DIRECTIONS_LIST
+ #undef hgdt_name
+ " ",
+};
+
+const char *html_formatting_reference_names[] = {
+ #define html_fr_reference(name) #name,
+ HTML_FORMATTING_REFERENCES_LIST
+ #undef html_fr_reference
+};
+
static CSS_SELECTOR_STYLE_LIST default_css_element_class_styles;
COMMAND_ARGS_SPECIFICATION html_command_args_flags[BUILTIN_CMD_NUMBER];
@@ -582,6 +595,40 @@ html_format_setup (void)
free (css_string_text.text);
}
+/* for customized special_unit_info (coming from Perl) */
+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;
+}
+
+char **
+new_special_unit_info_type (int special_units_varieties_nr)
+{
+ char **special_unit_info = (char **)
+ malloc ((special_units_varieties_nr +1) * sizeof (char *));
+ memset (special_unit_info, 0,
+ (special_units_varieties_nr +1) * sizeof (char *));
+ return special_unit_info;
+}
+
void
html_converter_init_special_unit (CONVERTER *self)
{
@@ -634,6 +681,26 @@ html_converter_init_special_unit (CONVERTER *self)
}
}
+FORMATTING_REFERENCE *
+new_special_unit_formatting_references (int special_units_varieties_nr)
+{
+ FORMATTING_REFERENCE *formatting_references = (FORMATTING_REFERENCE *)
+ malloc (special_units_varieties_nr * sizeof (FORMATTING_REFERENCE));
+ memset (formatting_references, 0,
+ special_units_varieties_nr * sizeof (FORMATTING_REFERENCE));
+ return formatting_references;
+}
+
+HTMLXREF_MANUAL *
+new_htmlxref_manual_list (size_t size)
+{
+ HTMLXREF_MANUAL *result = (HTMLXREF_MANUAL *)
+ malloc (size * sizeof (HTMLXREF_MANUAL));
+ memset (result, 0, size * sizeof (HTMLXREF_MANUAL));
+
+ return result;
+}
+
static HTML_DIRECTION_STRING_TRANSLATED *
new_directions_strings_translated_type (int nr_string_directions)
{
@@ -2623,6 +2690,29 @@ fill_jslicense_file_info (JSLICENSE_FILE_INFO
*jslicense_file_info,
jslicense_file_info->source = strdup (source);
}
+void
+initialize_js_categories_list (JSLICENSE_CATEGORY_LIST *js_files_info,
+ size_t size)
+{
+ js_files_info->list = (JSLICENSE_FILE_INFO_LIST *)
+ malloc (size * sizeof (JSLICENSE_FILE_INFO_LIST));
+ memset (js_files_info->list, 0,
+ size * sizeof (JSLICENSE_FILE_INFO_LIST));
+ js_files_info->number = size;
+}
+
+void
+initialize_jslicense_files (JSLICENSE_FILE_INFO_LIST *jslicences_files_info,
+ const char *category, size_t size)
+{
+ jslicences_files_info->category = strdup (category);
+ jslicences_files_info->list = (JSLICENSE_FILE_INFO *)
+ malloc (size * sizeof (JSLICENSE_FILE_INFO));
+ memset (jslicences_files_info->list, 0,
+ size * sizeof (JSLICENSE_FILE_INFO));
+ jslicences_files_info->number = size;
+}
+
/* first function to call a stage handler */
int
html_setup_output (CONVERTER *self, char **paths)
diff --git a/tp/Texinfo/XS/convert/html_prepare_converter.h
b/tp/Texinfo/XS/convert/html_prepare_converter.h
index 9dab29f8a3..6f672c18db 100644
--- a/tp/Texinfo/XS/convert/html_prepare_converter.h
+++ b/tp/Texinfo/XS/convert/html_prepare_converter.h
@@ -5,8 +5,26 @@
#include "command_ids.h"
#include "converter_types.h"
+/* in conversion_data.c */
+extern const char *special_unit_info_type_names[SUI_type_heading + 1];
+
+extern const char *html_global_unit_direction_names[];
+
+extern const char *html_formatting_reference_names[];
+
+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);
+
+HTMLXREF_MANUAL *new_htmlxref_manual_list (size_t size);
+
+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);
+
void html_converter_init_special_unit (CONVERTER *self);
void html_converter_customize (CONVERTER *self);
@@ -15,6 +33,12 @@ char ***new_directions_strings_type (int
nr_string_directions,
void html_initialize_output_state (CONVERTER *self, const char *context);
+void initialize_js_categories_list (JSLICENSE_CATEGORY_LIST *js_files_info,
+ size_t size);
+void initialize_jslicense_files
+ (JSLICENSE_FILE_INFO_LIST *jslicences_files_info,
+ const char *category, size_t size);
+
int html_setup_output (CONVERTER *self, char **paths);
void html_setup_convert (CONVERTER *self);
@@ -23,6 +47,8 @@ void html_prepare_conversion_units (CONVERTER *self);
void html_prepare_conversion_units_targets (CONVERTER *self,
const char *document_name);
+void html_setup_global_units_direction_names (CONVERTER *self);
+
FILE_SOURCE_INFO_LIST * html_prepare_units_directions_files (CONVERTER *self,
const char *output_file, const char *destination_directory,
const char *output_filename, const char *document_name);