[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/XS/convert/ConvertXS.xs, tp/Texinfo/
From: |
Patrice Dumas |
Subject: |
branch master updated: * tp/Texinfo/XS/convert/ConvertXS.xs, tp/Texinfo/XS/main/converter_types.h (CONVERTER_INITIALIZATION_INFO), tp/Texinfo/XS/convert/converter.c (apply_converter_info) (set_converter_init_information, new_converter_initialization_info), tp/Texinfo/XS/main/get_perl_info.c (get_converter_info_from_sv) (converter_get_info_from_sv): rename CONVERTER_DEFAULTS_INFO as CONVERTER_INITIALIZATION_INFO. Rename apply_converter_defaults as apply_converter_info, fill_converter_conf as set_converter_init_i [...] |
Date: |
Wed, 02 Oct 2024 17:01: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 b8612184c9 * tp/Texinfo/XS/convert/ConvertXS.xs,
tp/Texinfo/XS/main/converter_types.h (CONVERTER_INITIALIZATION_INFO),
tp/Texinfo/XS/convert/converter.c (apply_converter_info)
(set_converter_init_information, new_converter_initialization_info),
tp/Texinfo/XS/main/get_perl_info.c (get_converter_info_from_sv)
(converter_get_info_from_sv): rename CONVERTER_DEFAULTS_INFO as
CONVERTER_INITIALIZATION_INFO. Rename apply_converter_defaults as
apply_converter_info, fill_converter_conf as [...]
b8612184c9 is described below
commit b8612184c9060314a8fc2a4197b0d1c9718f5f25
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sun Aug 4 09:59:10 2024 +0200
* tp/Texinfo/XS/convert/ConvertXS.xs,
tp/Texinfo/XS/main/converter_types.h (CONVERTER_INITIALIZATION_INFO),
tp/Texinfo/XS/convert/converter.c (apply_converter_info)
(set_converter_init_information, new_converter_initialization_info),
tp/Texinfo/XS/main/get_perl_info.c (get_converter_info_from_sv)
(converter_get_info_from_sv): rename CONVERTER_DEFAULTS_INFO as
CONVERTER_INITIALIZATION_INFO. Rename apply_converter_defaults as
apply_converter_info, fill_converter_conf as
set_converter_init_information, new_converter_defaults_info as
new_converter_initialization_info, free_converter_defaults_info as
free_converter_initialization_info, get_converter_defaults_from_sv as
get_converter_info_from_sv and converter_get_defaults_sv as
converter_get_info_from_sv. Update users/callers.
---
ChangeLog | 16 ++++
tp/Texinfo/XS/convert/ConvertXS.xs | 18 ++--
tp/Texinfo/XS/convert/converter.c | 26 +++---
tp/Texinfo/XS/convert/converter.h | 11 ++-
tp/Texinfo/XS/convert/get_converter_perl_info.c | 119 ++++++++++++------------
tp/Texinfo/XS/convert/get_converter_perl_info.h | 8 +-
tp/Texinfo/XS/main/converter_types.h | 6 +-
7 files changed, 109 insertions(+), 95 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 863afe82e4..da6b9baa2c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -11,6 +11,22 @@
(get_converter_defaults_from_sv, converter_get_defaults_sv),
tp/Texinfo/XS/main/get_perl_info.c: move to get_converter_perl_info.c.
+2024-08-04 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/XS/convert/ConvertXS.xs,
+ tp/Texinfo/XS/main/converter_types.h (CONVERTER_INITIALIZATION_INFO),
+ tp/Texinfo/XS/convert/converter.c (apply_converter_info)
+ (set_converter_init_information, new_converter_initialization_info),
+ tp/Texinfo/XS/main/get_perl_info.c (get_converter_info_from_sv)
+ (converter_get_info_from_sv): rename CONVERTER_DEFAULTS_INFO as
+ CONVERTER_INITIALIZATION_INFO. Rename apply_converter_defaults as
+ apply_converter_info, fill_converter_conf as
+ set_converter_init_information, new_converter_defaults_info as
+ new_converter_initialization_info, free_converter_defaults_info as
+ free_converter_initialization_info, get_converter_defaults_from_sv as
+ get_converter_info_from_sv and converter_get_defaults_sv as
+ converter_get_info_from_sv. Update users/callers.
+
2024-08-04 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/XS/main/api_to_perl.c (register_perl_data),
diff --git a/tp/Texinfo/XS/convert/ConvertXS.xs
b/tp/Texinfo/XS/convert/ConvertXS.xs
index 50afd7afe4..6cf30145ef 100644
--- a/tp/Texinfo/XS/convert/ConvertXS.xs
+++ b/tp/Texinfo/XS/convert/ConvertXS.xs
@@ -94,22 +94,22 @@ converter_initialize (SV *converter_in, const char *class,
SV *format_defaults_s
PREINIT:
size_t converter_descriptor;
CONVERTER *self;
- CONVERTER_DEFAULTS_INFO *format_defaults;
- CONVERTER_DEFAULTS_INFO *conf;
+ CONVERTER_INITIALIZATION_INFO *format_defaults;
+ CONVERTER_INITIALIZATION_INFO *conf;
CODE:
converter_descriptor = new_converter ();
self = retrieve_converter (converter_descriptor);
- format_defaults = new_converter_defaults_info ();
- conf = new_converter_defaults_info ();
+ format_defaults = new_converter_initialization_info ();
+ conf = new_converter_initialization_info ();
- converter_get_defaults_sv (converter_in, self, format_defaults_sv,
- conf_sv, format_defaults, conf);
+ converter_get_info_from_sv (converter_in, self, format_defaults_sv,
+ conf_sv, format_defaults, conf);
- fill_converter_conf (self, format_defaults, conf);
+ set_converter_init_information (self, format_defaults, conf);
- free_converter_defaults_info (format_defaults);
- free_converter_defaults_info (conf);
+ free_converter_initialization_info (format_defaults);
+ free_converter_initialization_info (conf);
pass_generic_converter_to_converter_sv (converter_in, self);
diff --git a/tp/Texinfo/XS/convert/converter.c
b/tp/Texinfo/XS/convert/converter.c
index fc89857cbf..adbd5c09fc 100644
--- a/tp/Texinfo/XS/convert/converter.c
+++ b/tp/Texinfo/XS/convert/converter.c
@@ -258,8 +258,8 @@ new_converter (void)
}
static void
-apply_converter_defaults (CONVERTER *converter,
- CONVERTER_DEFAULTS_INFO *defaults, int set_configured)
+apply_converter_info (CONVERTER *converter,
+ CONVERTER_INITIALIZATION_INFO *defaults, int set_configured)
{
copy_options_list_options (converter->conf, converter->sorted_options,
&defaults->conf, set_configured);
@@ -284,13 +284,13 @@ apply_converter_defaults (CONVERTER *converter,
}
void
-fill_converter_conf (CONVERTER *converter,
- CONVERTER_DEFAULTS_INFO *format_defaults,
- CONVERTER_DEFAULTS_INFO *user_conf)
+set_converter_init_information (CONVERTER *converter,
+ CONVERTER_INITIALIZATION_INFO *format_defaults,
+ CONVERTER_INITIALIZATION_INFO *user_conf)
{
- apply_converter_defaults (converter, format_defaults, 0);
+ apply_converter_info (converter, format_defaults, 0);
- apply_converter_defaults (converter, user_conf, 1);
+ apply_converter_info (converter, user_conf, 1);
/* in Perl sets converter_init_conf, but in C we use only one
structure for converter_init_conf and output_init_conf, which
@@ -311,17 +311,17 @@ fill_converter_conf (CONVERTER *converter,
}
-CONVERTER_DEFAULTS_INFO *
-new_converter_defaults_info (void)
+CONVERTER_INITIALIZATION_INFO *
+new_converter_initialization_info (void)
{
- CONVERTER_DEFAULTS_INFO *result = (CONVERTER_DEFAULTS_INFO *)
- malloc (sizeof (CONVERTER_DEFAULTS_INFO));
- memset (result, 0, sizeof (CONVERTER_DEFAULTS_INFO));
+ CONVERTER_INITIALIZATION_INFO *result = (CONVERTER_INITIALIZATION_INFO *)
+ malloc (sizeof (CONVERTER_INITIALIZATION_INFO));
+ memset (result, 0, sizeof (CONVERTER_INITIALIZATION_INFO));
return result;
}
void
-free_converter_defaults_info (CONVERTER_DEFAULTS_INFO *defaults)
+free_converter_initialization_info (CONVERTER_INITIALIZATION_INFO *defaults)
{
if (defaults->translated_commands)
destroy_translated_commands (defaults->translated_commands);
diff --git a/tp/Texinfo/XS/convert/converter.h
b/tp/Texinfo/XS/convert/converter.h
index 1582a52254..0904ed08e1 100644
--- a/tp/Texinfo/XS/convert/converter.h
+++ b/tp/Texinfo/XS/convert/converter.h
@@ -112,12 +112,13 @@ CONVERTER *retrieve_converter (int converter_descriptor);
size_t new_converter (void);
void unregister_converter_descriptor (int converter_descriptor);
-void fill_converter_conf (CONVERTER *converter,
- CONVERTER_DEFAULTS_INFO *format_defaults,
- CONVERTER_DEFAULTS_INFO *user_conf);
+void set_converter_init_information (CONVERTER *converter,
+ CONVERTER_INITIALIZATION_INFO *format_defaults,
+ CONVERTER_INITIALIZATION_INFO *user_conf);
-CONVERTER_DEFAULTS_INFO *new_converter_defaults_info (void);
-void free_converter_defaults_info (CONVERTER_DEFAULTS_INFO *defaults);
+CONVERTER_INITIALIZATION_INFO *new_converter_initialization_info (void);
+void free_converter_initialization_info (
+ CONVERTER_INITIALIZATION_INFO *defaults);
void converter_set_document (CONVERTER *converter, DOCUMENT *document);
diff --git a/tp/Texinfo/XS/convert/get_converter_perl_info.c
b/tp/Texinfo/XS/convert/get_converter_perl_info.c
index b7395f631c..551faf13d3 100644
--- a/tp/Texinfo/XS/convert/get_converter_perl_info.c
+++ b/tp/Texinfo/XS/convert/get_converter_perl_info.c
@@ -158,36 +158,10 @@ get_option_from_sv (OPTION *option, SV *option_sv,
CONVERTER *converter,
return status;
}
-static void
-set_non_customization_sv (HV *converter_hv, SV *defaults_sv,
- STRING_LIST *non_valid_customization)
-{
- dTHX;
-
- if (non_valid_customization->number > 0)
- {
- HV *defaults_hv = (HV *) SvRV (defaults_sv);
- size_t i;
- for (i = 0; i < non_valid_customization->number; i++)
- {
- const char *key
- = non_valid_customization->list[i];
- /* not a customization variable, set in converter */
- SV **value = hv_fetch (defaults_hv, key, strlen (key), 0);
- if (*value)
- {
- if (SvOK (*value))
- SvREFCNT_inc (*value);
- hv_store (converter_hv, key, strlen (key), *value, 0);
- }
- }
- }
-}
-
static int
-get_converter_defaults_from_sv (SV *conf_sv, CONVERTER *converter,
- OPTION **sorted_options,
- CONVERTER_DEFAULTS_INFO *defaults_info)
+get_converter_info_from_sv (SV *conf_sv, CONVERTER *converter,
+ OPTION **sorted_options,
+ CONVERTER_INITIALIZATION_INFO *defaults_info)
{
dTHX;
@@ -251,48 +225,37 @@ get_converter_defaults_from_sv (SV *conf_sv, CONVERTER
*converter,
return 0;
}
-void
-get_expanded_formats (HV *hv, EXPANDED_FORMAT **expanded_formats)
+static void
+set_non_customization_sv (HV *converter_hv, SV *defaults_sv,
+ STRING_LIST *non_valid_customization)
{
- SV **expanded_formats_sv;
-
dTHX;
- expanded_formats_sv = hv_fetch (hv, "expanded_formats",
- strlen ("expanded_formats"), 0);
- if (expanded_formats_sv && SvOK (*expanded_formats_sv))
+ if (non_valid_customization->number > 0)
{
- I32 i;
- I32 formats_nr;
-
- if (!*expanded_formats)
- *expanded_formats = new_expanded_formats ();
-
- HV *expanded_formats_hv = (HV *)SvRV (*expanded_formats_sv);
-
- formats_nr = hv_iterinit (expanded_formats_hv);
-
- for (i = 0; i < formats_nr; i++)
+ HV *defaults_hv = (HV *) SvRV (defaults_sv);
+ size_t i;
+ for (i = 0; i < non_valid_customization->number; i++)
{
- char *format;
- I32 retlen;
- SV *value_sv = hv_iternextsv (expanded_formats_hv, &format, &retlen);
- if (SvTRUE (value_sv))
+ const char *key
+ = non_valid_customization->list[i];
+ /* not a customization variable, set in converter */
+ SV **value = hv_fetch (defaults_hv, key, strlen (key), 0);
+ if (*value)
{
- add_expanded_format (*expanded_formats, format);
+ if (SvOK (*value))
+ SvREFCNT_inc (*value);
+ hv_store (converter_hv, key, strlen (key), *value, 0);
}
}
}
}
-/* Texinfo::Convert::Converter generic initialization for all the converters */
-/* Called early, in particuliar before any format specific code has been
- called */
int
-converter_get_defaults_sv (SV *converter_sv, CONVERTER *converter,
- SV *format_defaults_sv, SV *conf_sv,
- CONVERTER_DEFAULTS_INFO *format_defaults,
- CONVERTER_DEFAULTS_INFO *conf)
+converter_get_info_from_sv (SV *converter_sv, CONVERTER *converter,
+ SV *format_defaults_sv, SV *conf_sv,
+ CONVERTER_INITIALIZATION_INFO *format_defaults,
+ CONVERTER_INITIALIZATION_INFO *conf)
{
HV *converter_hv;
int has_format_defaults;
@@ -305,10 +268,10 @@ converter_get_defaults_sv (SV *converter_sv, CONVERTER
*converter,
converter->hv = converter_hv;
has_format_defaults
- = get_converter_defaults_from_sv (format_defaults_sv, converter,
+ = get_converter_info_from_sv (format_defaults_sv, converter,
converter->sorted_options, format_defaults);
- has_conf = get_converter_defaults_from_sv (conf_sv, converter,
+ has_conf = get_converter_info_from_sv (conf_sv, converter,
converter->sorted_options, conf);
set_non_customization_sv (converter_hv, format_defaults_sv,
@@ -326,6 +289,40 @@ converter_get_defaults_sv (SV *converter_sv, CONVERTER
*converter,
return has_format_defaults + has_conf;
}
+void
+get_expanded_formats (HV *hv, EXPANDED_FORMAT **expanded_formats)
+{
+ SV **expanded_formats_sv;
+
+ dTHX;
+
+ expanded_formats_sv = hv_fetch (hv, "expanded_formats",
+ strlen ("expanded_formats"), 0);
+ if (expanded_formats_sv && SvOK (*expanded_formats_sv))
+ {
+ I32 i;
+ I32 formats_nr;
+
+ if (!*expanded_formats)
+ *expanded_formats = new_expanded_formats ();
+
+ HV *expanded_formats_hv = (HV *)SvRV (*expanded_formats_sv);
+
+ formats_nr = hv_iterinit (expanded_formats_hv);
+
+ for (i = 0; i < formats_nr; i++)
+ {
+ char *format;
+ I32 retlen;
+ SV *value_sv = hv_iternextsv (expanded_formats_hv, &format, &retlen);
+ if (SvTRUE (value_sv))
+ {
+ add_expanded_format (*expanded_formats, format);
+ }
+ }
+ }
+}
+
/* Unused */
void
get_sv_configured_options (SV *configured_sv_in, OPTION **sorted_options)
diff --git a/tp/Texinfo/XS/convert/get_converter_perl_info.h
b/tp/Texinfo/XS/convert/get_converter_perl_info.h
index fa29ccad5e..2e1fbcbcdf 100644
--- a/tp/Texinfo/XS/convert/get_converter_perl_info.h
+++ b/tp/Texinfo/XS/convert/get_converter_perl_info.h
@@ -12,10 +12,10 @@ struct TEXT_OPTIONS;
CONVERTER *get_sv_converter (SV *sv_in, const char *warn_string);
CONVERTER *converter_set_document_from_sv (SV *converter_in, SV *document_in);
-int converter_get_defaults_sv (SV *converter_sv, CONVERTER *converter,
- SV *format_defaults_sv, SV *conf_sv,
- CONVERTER_DEFAULTS_INFO *format_defaults,
- CONVERTER_DEFAULTS_INFO *conf);
+int converter_get_info_from_sv (SV *converter_sv, CONVERTER *converter,
+ SV *format_defaults_sv, SV *conf_sv,
+ CONVERTER_INITIALIZATION_INFO *format_defaults,
+ CONVERTER_INITIALIZATION_INFO *conf);
struct TEXT_OPTIONS *copy_sv_options_for_convert_text (SV *sv_in);
diff --git a/tp/Texinfo/XS/main/converter_types.h
b/tp/Texinfo/XS/main/converter_types.h
index 6748c4714a..12dbfd421c 100644
--- a/tp/Texinfo/XS/main/converter_types.h
+++ b/tp/Texinfo/XS/main/converter_types.h
@@ -918,16 +918,16 @@ typedef struct CONVERTER {
void *pl_info_hv; /* converter->{'converter_info'} */
} CONVERTER;
-/* information on converter defaults from a source of configuration
+/* information on converter configuration from a source of configuration
(either output format or user customization) */
-typedef struct CONVERTER_DEFAULTS_INFO {
+typedef struct CONVERTER_INITIALIZATION_INFO {
char *converted_format;
char *output_format;
TRANSLATED_COMMAND *translated_commands;
OPTIONS_LIST conf;
/* gather strings that are not customization options */
STRING_LIST non_valid_customization;
-} CONVERTER_DEFAULTS_INFO;
+} CONVERTER_INITIALIZATION_INFO;
typedef struct TRANSLATED_SUI_ASSOCIATION {
enum special_unit_info_tree tree_type;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/XS/convert/ConvertXS.xs, tp/Texinfo/XS/main/converter_types.h (CONVERTER_INITIALIZATION_INFO), tp/Texinfo/XS/convert/converter.c (apply_converter_info) (set_converter_init_information, new_converter_initialization_info), tp/Texinfo/XS/main/get_perl_info.c (get_converter_info_from_sv) (converter_get_info_from_sv): rename CONVERTER_DEFAULTS_INFO as CONVERTER_INITIALIZATION_INFO. Rename apply_converter_defaults as apply_converter_info, fill_converter_conf as set_converter_init_i [...],
Patrice Dumas <=