[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/XS/main/utils.c (list_add_option) (a
From: |
Patrice Dumas |
Subject: |
branch master updated: * tp/Texinfo/XS/main/utils.c (list_add_option) (add_option_string_value, add_option_copy, copy_options_list): add a copy function for options lists. |
Date: |
Thu, 03 Oct 2024 17:54:34 -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 ee2e68c717 * tp/Texinfo/XS/main/utils.c (list_add_option)
(add_option_string_value, add_option_copy, copy_options_list): add a copy
function for options lists.
ee2e68c717 is described below
commit ee2e68c717bad1adb5b6f97770212db45ecc890c
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sat Aug 10 11:10:52 2024 +0200
* tp/Texinfo/XS/main/utils.c (list_add_option)
(add_option_string_value, add_option_copy, copy_options_list): add a
copy function for options lists.
* tp/Texinfo/XS/convert/texinfo.c (txi_converter),
tp/Texinfo/XS/teximakehtml.c (main): pass options to txi_converter and
copy them to conf.
---
ChangeLog | 10 ++++++++
tp/Texinfo/XS/convert/texinfo.c | 8 +++++--
tp/Texinfo/XS/convert/texinfo.h | 2 +-
tp/Texinfo/XS/main/utils.c | 51 +++++++++++++++++++++++++++++++++--------
tp/Texinfo/XS/main/utils.h | 3 +++
tp/Texinfo/XS/teximakehtml.c | 2 +-
6 files changed, 62 insertions(+), 14 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index a8b829c368..3ff13bb358 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2024-08-10 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/XS/main/utils.c (list_add_option)
+ (add_option_string_value, add_option_copy, copy_options_list): add a
+ copy function for options lists.
+
+ * tp/Texinfo/XS/convert/texinfo.c (txi_converter),
+ tp/Texinfo/XS/teximakehtml.c (main): pass options to txi_converter and
+ copy them to conf.
+
2024-10-03 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/XS/convert/convert_html.c (html_setup_output): rename
diff --git a/tp/Texinfo/XS/convert/texinfo.c b/tp/Texinfo/XS/convert/texinfo.c
index fe987e6d67..4f08ac9e1a 100644
--- a/tp/Texinfo/XS/convert/texinfo.c
+++ b/tp/Texinfo/XS/convert/texinfo.c
@@ -140,10 +140,9 @@ txi_complete_document (DOCUMENT *document, unsigned long
flags,
document->options);
}
-/* TODO add other options argument */
CONVERTER *
txi_converter (const char *format, const char *locale_encoding,
- const char *program_file)
+ const char *program_file, OPTIONS_LIST *customizations)
{
size_t converter_descriptor;
CONVERTER *converter;
@@ -189,6 +188,11 @@ txi_converter (const char *format, const char
*locale_encoding,
add_option_string_value (&conf->conf, converter->sorted_options,
"DEBUG", 1, 0);
*/
+ if (customizations)
+ {
+ copy_options_list (&conf->conf, customizations,
+ converter->sorted_options);
+ }
/* pass information to the converter and format specific initialization */
set_converter_init_information (converter, converter_format,
diff --git a/tp/Texinfo/XS/convert/texinfo.h b/tp/Texinfo/XS/convert/texinfo.h
index 2a5711eeb5..9acafe7185 100644
--- a/tp/Texinfo/XS/convert/texinfo.h
+++ b/tp/Texinfo/XS/convert/texinfo.h
@@ -38,7 +38,7 @@ void txi_complete_document (DOCUMENT *document, unsigned long
flags,
int format_menu);
CONVERTER *txi_converter (const char *format, const char *locale_encoding,
- const char *program_file);
+ const char *program_file, OPTIONS_LIST *customizations);
char *txi_html_output (CONVERTER *converter, DOCUMENT *document);
diff --git a/tp/Texinfo/XS/main/utils.c b/tp/Texinfo/XS/main/utils.c
index 5d7be31797..db20fda8f9 100644
--- a/tp/Texinfo/XS/main/utils.c
+++ b/tp/Texinfo/XS/main/utils.c
@@ -2120,8 +2120,20 @@ new_option_string_value (OPTION **sorted_options,
return option;
}
+static void
+list_add_option (OPTIONS_LIST *options_list, OPTION *option)
+{
+ if (options_list->number >= options_list->space)
+ {
+ options_list->list = realloc (options_list->list,
+ (options_list->space += 5) * sizeof (OPTION *));
+ }
+ options_list->list[options_list->number] = option;
+ options_list->number++;
+}
+
OPTION *
-add_option_string_value (OPTIONS_LIST *options_list, OPTION **sorted_options,
+add_option_string_value (OPTIONS_LIST *options_list, OPTION **sorted_options,
const char *option_name, int int_value,
const char *char_value)
{
@@ -2129,19 +2141,38 @@ add_option_string_value (OPTIONS_LIST *options_list,
OPTION **sorted_options,
int_value, char_value);
if (option)
- {
- if (options_list->number >= options_list->space)
- {
- options_list->list = realloc (options_list->list,
- (options_list->space += 5) * sizeof (OPTION *));
- }
- options_list->list[options_list->number] = option;
- options_list->number++;
- }
+ list_add_option (options_list, option);
+
+ return option;
+}
+
+OPTION *
+add_option_copy (OPTIONS_LIST *options_list, OPTION **sorted_options,
+ const OPTION *src_option)
+{
+ OPTION *option
+ = new_option (src_option->type, src_option->name, src_option->number);
+
+ copy_option (option, src_option);
+
+ list_add_option (options_list, option);
return option;
}
+void
+copy_options_list (OPTIONS_LIST *options_list,
+ const OPTIONS_LIST *options_src, OPTION **sorted_options)
+{
+ size_t i;
+
+ if (options_src > 0)
+ {
+ for (i = 0; i < options_src->number; i++)
+ add_option_copy (options_list, sorted_options, options_src->list[i]);
+ }
+}
+
void
free_options_list (OPTIONS_LIST *options_list)
{
diff --git a/tp/Texinfo/XS/main/utils.h b/tp/Texinfo/XS/main/utils.h
index 43c451065d..2f3aec91a2 100644
--- a/tp/Texinfo/XS/main/utils.h
+++ b/tp/Texinfo/XS/main/utils.h
@@ -291,6 +291,9 @@ OPTION *add_option_string_value (OPTIONS_LIST *options_list,
const char *option_name, int int_value,
const char *char_value);
+void copy_options_list (OPTIONS_LIST *options_list,
+ const OPTIONS_LIST *options_src, OPTION **sorted_options);
+
TARGET_FILENAME *new_target_filename (void);
TARGET_CONTENTS_FILENAME *new_target_contents_filename (void);
FILE_NAME_PATH *new_file_name_path (void);
diff --git a/tp/Texinfo/XS/teximakehtml.c b/tp/Texinfo/XS/teximakehtml.c
index a6d39c989e..34be8cf6c2 100644
--- a/tp/Texinfo/XS/teximakehtml.c
+++ b/tp/Texinfo/XS/teximakehtml.c
@@ -160,7 +160,7 @@ main (int argc, char *argv[])
/* setup converter */
- converter = txi_converter ("html", locale_encoding, program_file);
+ converter = txi_converter ("html", locale_encoding, program_file, 0);
free (program_file);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/XS/main/utils.c (list_add_option) (add_option_string_value, add_option_copy, copy_options_list): add a copy function for options lists.,
Patrice Dumas <=