[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/XS/convert/html_converter_init_optio
From: |
Patrice Dumas |
Subject: |
branch master updated: * tp/Texinfo/XS/convert/html_converter_init_options.c, tp/Texinfo/XS/convert/html_prepare_converter.c (html_converter_initialize_beginning): move html_converter_initialize_beginning to html_prepare_converter.c. |
Date: |
Fri, 04 Oct 2024 19:47:03 -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 09b53ba567 * tp/Texinfo/XS/convert/html_converter_init_options.c,
tp/Texinfo/XS/convert/html_prepare_converter.c
(html_converter_initialize_beginning): move html_converter_initialize_beginning
to html_prepare_converter.c.
09b53ba567 is described below
commit 09b53ba567269ab96f5e8f4478e182180a57e4c6
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sat Aug 17 16:09:44 2024 +0200
* tp/Texinfo/XS/convert/html_converter_init_options.c,
tp/Texinfo/XS/convert/html_prepare_converter.c
(html_converter_initialize_beginning): move
html_converter_initialize_beginning to html_prepare_converter.c.
* tp/Texinfo/XS/main/converter_types.h (TARGET_CONTENTS_FILENAME)
(FILE_NAME_PATH, TARGET_DIRECTORY_FILENAME),
tp/Texinfo/XS/main/utils.h: move struct declarations to
converter_types.h.
---
ChangeLog | 12 ++++++
tp/Texinfo/XS/convert/ConvertXS.xs | 12 +++---
tp/Texinfo/XS/convert/call_html_perl_function.c | 7 +++-
tp/Texinfo/XS/convert/call_html_perl_function.h | 3 --
tp/Texinfo/XS/convert/html_conversion_api.h | 3 +-
.../XS/convert/html_converter_init_options.c | 44 +--------------------
tp/Texinfo/XS/convert/html_prepare_converter.c | 45 +++++++++++++++++++++-
tp/Texinfo/XS/convert/html_prepare_converter.h | 2 +
.../XS/convert/replace_perl_call_html_function.c | 8 ++--
tp/Texinfo/XS/main/converter_types.h | 20 +++++++++-
tp/Texinfo/XS/main/utils.h | 18 ---------
11 files changed, 98 insertions(+), 76 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 6bc446d77c..7845aa13ac 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2024-08-17 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/XS/convert/html_converter_init_options.c,
+ tp/Texinfo/XS/convert/html_prepare_converter.c
+ (html_converter_initialize_beginning): move
+ html_converter_initialize_beginning to html_prepare_converter.c.
+
+ * tp/Texinfo/XS/main/converter_types.h (TARGET_CONTENTS_FILENAME)
+ (FILE_NAME_PATH, TARGET_DIRECTORY_FILENAME),
+ tp/Texinfo/XS/main/utils.h: move struct declarations to
+ converter_types.h.
+
2024-08-17 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/XS/convert/texinfo.c (txi_converter_setup): use
diff --git a/tp/Texinfo/XS/convert/ConvertXS.xs
b/tp/Texinfo/XS/convert/ConvertXS.xs
index d2f23410b3..d77d4bf176 100644
--- a/tp/Texinfo/XS/convert/ConvertXS.xs
+++ b/tp/Texinfo/XS/convert/ConvertXS.xs
@@ -134,8 +134,8 @@ converter_defaults (SV *converter_in, SV *conf_sv)
converter_format
= find_perl_converter_class_converter_format (class_name);
- /* use txi_base_sorted_options static data to find the type of
- options by name */
+ /* use txi_base_sorted_options to find the type of options
+ specified by name */
conf = get_converter_info_from_sv (conf_sv, class_name, 0,
txi_base_sorted_options);
@@ -146,6 +146,7 @@ converter_defaults (SV *converter_in, SV *conf_sv)
if (self)
{
+ /* store format_defaults in the C converter */
const char *key = "converter_descriptor";
HV *converter_hv = (HV *)SvRV (converter_in);
@@ -162,6 +163,7 @@ converter_defaults (SV *converter_in, SV *conf_sv)
}
else
{
+ /* return format_defaults built to Perl */
RETVAL
= build_sv_options_from_options_list (&format_defaults->conf, 0);
destroy_converter_initialization_info (format_defaults);
@@ -169,7 +171,7 @@ converter_defaults (SV *converter_in, SV *conf_sv)
OUTPUT:
RETVAL
-# NOTE not sure what the scope of class is. When tested, valgrind did not
+# NOTE not sure what the scope of class_name is. When tested, valgrind did not
# complain.
void
generic_converter_init (SV *converter_in, const char *class_name, SV
*format_defaults_sv, SV *conf_sv=0)
@@ -185,8 +187,8 @@ generic_converter_init (SV *converter_in, const char
*class_name, SV *format_def
format_defaults = get_converter_info_from_sv (format_defaults_sv,
class_name, self, self->sorted_options);
- /* if format_defaults_sv is undef, it means that format_defaults
- should have been registered in the C converter */
+ /* if format_defaults_sv is undef, it should mean that format_defaults
+ has been registered in the C converter */
if (!format_defaults)
{
format_defaults = self->format_defaults;
diff --git a/tp/Texinfo/XS/convert/call_html_perl_function.c
b/tp/Texinfo/XS/convert/call_html_perl_function.c
index 4235212e66..9d7249186a 100644
--- a/tp/Texinfo/XS/convert/call_html_perl_function.c
+++ b/tp/Texinfo/XS/convert/call_html_perl_function.c
@@ -31,11 +31,17 @@
#undef context
#include "text.h"
+#include "tree_types.h"
+/* *BUTTON* */
#include "option_types.h"
#include "converter_types.h"
#include "types_data.h"
/* for element_command_name (or could be builtin_command_data) */
#include "builtin_commands.h"
+/* new_target_filename non_perl_strndup new_target_contents_filename
+ new_file_name_path new_target_directory_filename non_perl_free
+ new_formatted_button_info output_unit_type_names enum output_unit_type
+ */
#include "utils.h"
#include "debug.h"
/* for newSVpv_utf8 build_texinfo_tree */
@@ -1780,7 +1786,6 @@ call_formatting_function_format_node_redirection_page
(CONVERTER *self,
-
void
call_types_conversion (CONVERTER *self, const enum element_type type,
const FORMATTING_REFERENCE *formatting_reference,
diff --git a/tp/Texinfo/XS/convert/call_html_perl_function.h
b/tp/Texinfo/XS/convert/call_html_perl_function.h
index 068cf8252c..d7552cd6f6 100644
--- a/tp/Texinfo/XS/convert/call_html_perl_function.h
+++ b/tp/Texinfo/XS/convert/call_html_perl_function.h
@@ -5,9 +5,6 @@
#include "tree_types.h"
#include "option_types.h"
#include "converter_types.h"
-/* for TARGET_CONTENTS_FILENAME FILE_NAME_PATH
- TARGET_DIRECTORY_FILENAME */
-#include "utils.h"
#include "translations.h"
TARGET_FILENAME *call_file_id_setting_special_unit_target_file_name
diff --git a/tp/Texinfo/XS/convert/html_conversion_api.h
b/tp/Texinfo/XS/convert/html_conversion_api.h
index efb5e8365a..75db035bd3 100644
--- a/tp/Texinfo/XS/convert/html_conversion_api.h
+++ b/tp/Texinfo/XS/convert/html_conversion_api.h
@@ -25,9 +25,8 @@
#include "document_types.h"
#include "converter_types.h"
-void html_converter_initialize_beginning (CONVERTER *self);
-
/* in html_prepare_converter.c */
+void html_converter_initialize_beginning (CONVERTER *self);
void html_converter_init_special_unit (CONVERTER *self);
void html_converter_customize (CONVERTER *self);
diff --git a/tp/Texinfo/XS/convert/html_converter_init_options.c
b/tp/Texinfo/XS/convert/html_converter_init_options.c
index 19929fc5b5..8a4354e8a5 100644
--- a/tp/Texinfo/XS/convert/html_converter_init_options.c
+++ b/tp/Texinfo/XS/convert/html_converter_init_options.c
@@ -24,16 +24,14 @@
#include "converters_defaults.h"
/* html_get_direction_index html_free_button_specification_list */
#include "utils.h"
-/* option_force_conf */
+/* add_new_button_option */
#include "customization_options.h"
#include "create_buttons.h"
/* new_converter_initialization_info */
#include "converter.h"
#include "html_converter_api.h"
-/* HTML converter options setting and initialization. Not with format
- specific converter code, since this code is called from generic
- converter code. */
+/* HTML converter options setting and initialization -- converter_defaults. */
static const int DEFAULT_MISC_BUTTONS[] = {
D_direction_Top, BSUD_D_Contents, D_direction_Index, BSUD_D_About,
@@ -221,41 +219,3 @@ html_converter_defaults (enum converter_format format,
return format_defaults;
}
-/* this code corresponds to the Perl converter_initialize code, only for
- code to be called before Perl customization setup information is passed */
-void
-html_converter_initialize_beginning (CONVERTER *self)
-{
- const char *split = self->conf->SPLIT.o.string;
- int max_header_level = self->conf->MAX_HEADER_LEVEL.o.integer;
-
- if (!self->conf->FORMAT_MENU.o.string)
- option_force_conf (&self->conf->FORMAT_MENU, 0, "");
-
- /* NOTE we reset silently if the split specification is not one known.
- The main program warns if the specific command line option value is
- not known. We could add a warning here to catch mistakes in init
- files. Wait for user reports.
- */
- if (split && strlen (split) && strcmp (split, "chapter")
- && strcmp (split, "section") && strcmp (split, "node"))
- option_force_conf (&self->conf->SPLIT, 0, "node");
-
- if (max_header_level < 0)
- option_force_conf (&self->conf->MAX_HEADER_LEVEL, 4, 0);
- else if (max_header_level < 1)
- option_force_conf (&self->conf->MAX_HEADER_LEVEL, 1, 0);
-
- /* For CONTENTS_OUTPUT_LOCATION
- should lead to contents not output, but if not, it is not an issue,
- the way to set contents to be output or not should be through the
- contents and shortcontents @-commands and customization options.
- */
-
- if (!self->conf->CONTENTS_OUTPUT_LOCATION.o.string)
- option_force_conf (&self->conf->CONTENTS_OUTPUT_LOCATION, 0, "");
- if (!self->conf->INDEX_ENTRY_COLON.o.string)
- option_force_conf (&self->conf->INDEX_ENTRY_COLON, 0, "");
- if (!self->conf->MENU_ENTRY_COLON.o.string)
- option_force_conf (&self->conf->MENU_ENTRY_COLON, 0, "");
-}
diff --git a/tp/Texinfo/XS/convert/html_prepare_converter.c
b/tp/Texinfo/XS/convert/html_prepare_converter.c
index f29c8fa5f0..b56401bf44 100644
--- a/tp/Texinfo/XS/convert/html_prepare_converter.c
+++ b/tp/Texinfo/XS/convert/html_prepare_converter.c
@@ -33,6 +33,7 @@
#include "builtin_commands.h"
#include "command_stack.h"
#include "utils.h"
+/* option_force_conf option_set_conf copy_options */
#include "customization_options.h"
#include "extra.h"
#include "targets.h"
@@ -607,9 +608,51 @@ html_format_setup (void)
-/* setup special units info, apply defaults based on customization variables.
+/* converter_initialize functions.
+
+ beginning of converter initialize, setup special units info, apply
+ defaults based on customization variables.
Apply specific customizations (from Perl) */
+/* this code corresponds to the Perl converter_initialize code, only for
+ code to be called before Perl customization setup information is passed */
+void
+html_converter_initialize_beginning (CONVERTER *self)
+{
+ const char *split = self->conf->SPLIT.o.string;
+ int max_header_level = self->conf->MAX_HEADER_LEVEL.o.integer;
+
+ if (!self->conf->FORMAT_MENU.o.string)
+ option_force_conf (&self->conf->FORMAT_MENU, 0, "");
+
+ /* NOTE we reset silently if the split specification is not one known.
+ The main program warns if the specific command line option value is
+ not known. We could add a warning here to catch mistakes in init
+ files. Wait for user reports.
+ */
+ if (split && strlen (split) && strcmp (split, "chapter")
+ && strcmp (split, "section") && strcmp (split, "node"))
+ option_force_conf (&self->conf->SPLIT, 0, "node");
+
+ if (max_header_level < 0)
+ option_force_conf (&self->conf->MAX_HEADER_LEVEL, 4, 0);
+ else if (max_header_level < 1)
+ option_force_conf (&self->conf->MAX_HEADER_LEVEL, 1, 0);
+
+ /* For CONTENTS_OUTPUT_LOCATION
+ should lead to contents not output, but if not, it is not an issue,
+ the way to set contents to be output or not should be through the
+ contents and shortcontents @-commands and customization options.
+ */
+
+ if (!self->conf->CONTENTS_OUTPUT_LOCATION.o.string)
+ option_force_conf (&self->conf->CONTENTS_OUTPUT_LOCATION, 0, "");
+ if (!self->conf->INDEX_ENTRY_COLON.o.string)
+ option_force_conf (&self->conf->INDEX_ENTRY_COLON, 0, "");
+ if (!self->conf->MENU_ENTRY_COLON.o.string)
+ option_force_conf (&self->conf->MENU_ENTRY_COLON, 0, "");
+}
+
/* for customized special_unit_info (coming from Perl) */
SPECIAL_UNIT_INFO *
html_add_special_unit_info (SPECIAL_UNIT_INFO_LIST *special_unit_info_list,
diff --git a/tp/Texinfo/XS/convert/html_prepare_converter.h
b/tp/Texinfo/XS/convert/html_prepare_converter.h
index 5d63a3e106..b357b05e9f 100644
--- a/tp/Texinfo/XS/convert/html_prepare_converter.h
+++ b/tp/Texinfo/XS/convert/html_prepare_converter.h
@@ -24,6 +24,8 @@ extern const char
*htmlxref_split_type_names[htmlxref_split_type_chapter + 1];
+/* void html_converter_initialize_beginning (CONVERTER *self); */
+
/* called from XS only */
FORMATTING_REFERENCE *new_special_unit_formatting_references
(int special_units_varieties_nr);
diff --git a/tp/Texinfo/XS/convert/replace_perl_call_html_function.c
b/tp/Texinfo/XS/convert/replace_perl_call_html_function.c
index baaabe349e..0fba386433 100644
--- a/tp/Texinfo/XS/convert/replace_perl_call_html_function.c
+++ b/tp/Texinfo/XS/convert/replace_perl_call_html_function.c
@@ -1,13 +1,15 @@
+/* replacements for Perl functions calling. Some are actually called, most are
+ defined to please the linker */
#include <config.h>
#include "tree_types.h"
+/* *BUTTON* */
#include "option_types.h"
#include "converter_types.h"
-/* for TARGET_CONTENTS_FILENAME FILE_NAME_PATH
- TARGET_DIRECTORY_FILENAME */
+/* new_string_list find_string *string
+ */
#include "utils.h"
-#include "translations.h"
#include "call_html_perl_function.h"
TARGET_FILENAME *
diff --git a/tp/Texinfo/XS/main/converter_types.h
b/tp/Texinfo/XS/main/converter_types.h
index b8b129e7bb..faa3a58ce9 100644
--- a/tp/Texinfo/XS/main/converter_types.h
+++ b/tp/Texinfo/XS/main/converter_types.h
@@ -953,12 +953,30 @@ typedef struct TRANSLATED_SUI_ASSOCIATION {
enum special_unit_info_type string_type;
} TRANSLATED_SUI_ASSOCIATION;
-/* used in several converter codes, but not in this file */
+/* following types used in several converter codes, but not in this file */
typedef struct TARGET_FILENAME {
char *target;
char *filename;
} TARGET_FILENAME;
+typedef struct TARGET_CONTENTS_FILENAME {
+ char *target;
+ char *filename;
+ char *target_contents;
+ char *target_shortcontents;
+} TARGET_CONTENTS_FILENAME;
+
+typedef struct FILE_NAME_PATH {
+ char *filename;
+ char *filepath;
+} FILE_NAME_PATH;
+
+typedef struct TARGET_DIRECTORY_FILENAME {
+ char *filename;
+ char *directory;
+ char *target;
+} TARGET_DIRECTORY_FILENAME;
+
#endif
diff --git a/tp/Texinfo/XS/main/utils.h b/tp/Texinfo/XS/main/utils.h
index 6f4d358b6b..5155a422fc 100644
--- a/tp/Texinfo/XS/main/utils.h
+++ b/tp/Texinfo/XS/main/utils.h
@@ -129,24 +129,6 @@ typedef struct ACCENTS_STACK {
ELEMENT *argument;
} ACCENTS_STACK;
-typedef struct TARGET_CONTENTS_FILENAME {
- char *target;
- char *filename;
- char *target_contents;
- char *target_shortcontents;
-} TARGET_CONTENTS_FILENAME;
-
-typedef struct FILE_NAME_PATH {
- char *filename;
- char *filepath;
-} FILE_NAME_PATH;
-
-typedef struct TARGET_DIRECTORY_FILENAME {
- char *filename;
- char *directory;
- char *target;
-} TARGET_DIRECTORY_FILENAME;
-
void non_perl_free (void *ptr);
void *non_perl_malloc (size_t size);
char *non_perl_strdup (const char *s);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/XS/convert/html_converter_init_options.c, tp/Texinfo/XS/convert/html_prepare_converter.c (html_converter_initialize_beginning): move html_converter_initialize_beginning to html_prepare_converter.c.,
Patrice Dumas <=