[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/XS/convert/get_converter_perl_info.c
From: |
Patrice Dumas |
Subject: |
branch master updated: * tp/Texinfo/XS/convert/get_converter_perl_info.c (set_translated_commands): remove converter, use directly generated translated commands. |
Date: |
Wed, 02 Oct 2024 17:55:49 -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 9123eddf44 * tp/Texinfo/XS/convert/get_converter_perl_info.c
(set_translated_commands): remove converter, use directly generated translated
commands.
9123eddf44 is described below
commit 9123eddf44da3d3089f1a85e33a6d8db0b4dffa7
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sun Aug 4 15:36:03 2024 +0200
* tp/Texinfo/XS/convert/get_converter_perl_info.c
(set_translated_commands): remove converter, use directly generated
translated commands.
* tp/Texinfo/XS/convert/get_converter_perl_info.c: remove
get_sv_configured_options.
---
ChangeLog | 15 +++-
tp/Texinfo/XS/convert/ConvertXS.xs | 1 +
tp/Texinfo/XS/convert/get_converter_perl_info.c | 99 ++++++++++---------------
tp/Texinfo/XS/convert/get_converter_perl_info.h | 10 +--
tp/Texinfo/XS/convert/get_html_perl_info.c | 1 +
tp/Texinfo/XS/main/convert_to_text.h | 2 +-
tp/Texinfo/XS/main/get_perl_info.c | 2 -
tp/Texinfo/XS/main/get_perl_info.h | 3 +-
8 files changed, 60 insertions(+), 73 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 40bae7c2fa..c254b5348d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,8 +1,11 @@
-2024-10-02 Patrice Dumas <pertusus@free.fr>
+2024-08-04 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/XS/convert/get_converter_perl_info.c
- (get_converter_info_from_sv): do not error out on
- deprecated_config_directories customization hash directory key.
+ (set_translated_commands): remove converter, use directly generated
+ translated commands.
+
+ * tp/Texinfo/XS/convert/get_converter_perl_info.c: remove
+ get_sv_configured_options.
2024-08-04 Patrice Dumas <pertusus@free.fr>
@@ -54,6 +57,12 @@
not certain that it is worth keeping this possibility, especially
since it is not used anwhere in Texinfo currently.
+2024-10-02 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/XS/convert/get_converter_perl_info.c
+ (get_converter_info_from_sv): do not error out on
+ deprecated_config_directories customization hash directory key.
+
2024-08-04 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/Convert/Converter.pm (_generic_converter_init): update
diff --git a/tp/Texinfo/XS/convert/ConvertXS.xs
b/tp/Texinfo/XS/convert/ConvertXS.xs
index d08bc5dc1a..acc0d17da2 100644
--- a/tp/Texinfo/XS/convert/ConvertXS.xs
+++ b/tp/Texinfo/XS/convert/ConvertXS.xs
@@ -50,6 +50,7 @@
#include "converter.h"
#include "get_perl_info.h"
#include "build_perl_info.h"
+#include "get_converter_perl_info.h"
#include "build_html_perl_state.h"
#include "convert_html.h"
#include "get_converter_perl_info.h"
diff --git a/tp/Texinfo/XS/convert/get_converter_perl_info.c
b/tp/Texinfo/XS/convert/get_converter_perl_info.c
index 7730db97d1..0ebe7979e5 100644
--- a/tp/Texinfo/XS/convert/get_converter_perl_info.c
+++ b/tp/Texinfo/XS/convert/get_converter_perl_info.c
@@ -30,13 +30,19 @@
#undef context
+#include "command_ids.h"
+#include "option_types.h"
+#include "options_types.h"
#include "converter_types.h"
#include "builtin_commands.h"
#include "utils.h"
-#include "converter.h"
+#include "builtin_commands.h"
+#include "convert_to_text.h"
#include "get_perl_info.h"
+#include "converter.h"
#include "get_converter_perl_info.h"
+
CONVERTER *
get_sv_converter (SV *sv_in, const char *warn_string)
{
@@ -85,8 +91,36 @@ converter_set_document_from_sv (SV *converter_in, SV
*document_in)
return converter;
}
+/* add to converter hash the INIT_INFO_SV key values that are
+ not customization variables, listed in NO_VALID_CUSTOMIZATION */
+static void
+set_non_customization_sv (HV *converter_hv, SV *init_info_sv,
+ STRING_LIST *non_valid_customization)
+{
+ dTHX;
+
+ if (non_valid_customization->number > 0)
+ {
+ HV *init_info_hv = (HV *) SvRV (init_info_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 (init_info_hv, key, strlen (key), 0);
+ if (*value)
+ {
+ if (SvOK (*value))
+ SvREFCNT_inc (*value);
+ hv_store (converter_hv, key, strlen (key), *value, 0);
+ }
+ }
+ }
+}
+
TRANSLATED_COMMAND *
-set_translated_commands (SV *translated_commands_sv, CONVERTER *converter)
+set_translated_commands (SV *translated_commands_sv)
{
TRANSLATED_COMMAND *translated_commands = 0;
@@ -129,7 +163,7 @@ set_translated_commands (SV *translated_commands_sv,
CONVERTER *converter)
{
char *tmp_spec = (char *) SvPVutf8_nolen (translation_sv);
TRANSLATED_COMMAND *translated_command
- = &converter->translated_commands[i];
+ = &translated_commands[i];
translated_command->translation = non_perl_strdup (tmp_spec);
translated_command->cmd = cmd;
}
@@ -179,6 +213,7 @@ get_converter_info_from_sv (SV *conf_sv, const char *class,
if (!hv_number)
return 0;
+ /* FIXME move to Pure C */
initialization_info->conf.list
= (OPTION *) malloc (sizeof (OPTION) * hv_number);
memset (initialization_info->conf.list, 0, sizeof (OPTION) * hv_number);
@@ -206,7 +241,7 @@ get_converter_info_from_sv (SV *conf_sv, const char *class,
if (!strcmp (key, "translated_commands"))
initialization_info->translated_commands
- = set_translated_commands (value, converter);
+ = set_translated_commands (value);
/* FIXME get deprecated_config_directories if needed */
else if (!strcmp (key, "deprecated_config_directories"))
{}
@@ -236,34 +271,6 @@ get_converter_info_from_sv (SV *conf_sv, const char *class,
return 0;
}
-/* add to converter hash the INIT_INFO_SV key values that are
- not customization variables, listed in NO_VALID_CUSTOMIZATION */
-static void
-set_non_customization_sv (HV *converter_hv, SV *init_info_sv,
- STRING_LIST *non_valid_customization)
-{
- dTHX;
-
- if (non_valid_customization->number > 0)
- {
- HV *init_info_hv = (HV *) SvRV (init_info_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 (init_info_hv, key, strlen (key), 0);
- if (*value)
- {
- if (SvOK (*value))
- SvREFCNT_inc (*value);
- hv_store (converter_hv, key, strlen (key), *value, 0);
- }
- }
- }
-}
-
/* CLASS is the perl converter class. It could also be taken from
the object */
enum converter_format
@@ -355,34 +362,6 @@ get_expanded_formats (HV *hv, EXPANDED_FORMAT
**expanded_formats)
}
}
-/* Unused */
-void
-get_sv_configured_options (SV *configured_sv_in, OPTION **sorted_options)
-{
- I32 hv_number;
- I32 i;
- HV *configured_hv;
-
- dTHX;
-
- configured_hv = (HV *)SvRV (configured_sv_in);
-
- hv_number = hv_iterinit (configured_hv);
- for (i = 0; i < hv_number; i++)
- {
- char *key;
- I32 retlen;
- SV *value = hv_iternextsv (configured_hv, &key, &retlen);
- if (value && SvOK (value))
- {
- int configured = SvIV (value);
- set_sorted_option_key_configured (sorted_options, key, configured);
- }
- }
-}
-
-/* output format specific */
-
/* map hash reference of Convert::Text options to TEXT_OPTIONS */
/* _raw_state is not fetched, as it is not documented as an option,
and there is no way to set it through text options either, it can only
diff --git a/tp/Texinfo/XS/convert/get_converter_perl_info.h
b/tp/Texinfo/XS/convert/get_converter_perl_info.h
index 7c53ed49ec..b7af9fb802 100644
--- a/tp/Texinfo/XS/convert/get_converter_perl_info.h
+++ b/tp/Texinfo/XS/convert/get_converter_perl_info.h
@@ -5,13 +5,12 @@
#include "EXTERN.h"
#include "perl.h"
+#include "tree_types.h"
+#include "document_types.h"
#include "converter_types.h"
-
-struct TEXT_OPTIONS;
+#include "convert_to_text.h"
CONVERTER *get_sv_converter (SV *sv_in, const char *warn_string);
-CONVERTER *converter_set_document_from_sv (SV *converter_in, SV *document_in);
-
enum converter_format converter_get_info_from_sv (SV *converter_sv,
const char *class,
CONVERTER *converter,
@@ -19,7 +18,8 @@ enum converter_format converter_get_info_from_sv (SV
*converter_sv,
CONVERTER_INITIALIZATION_INFO *format_defaults,
CONVERTER_INITIALIZATION_INFO *conf,
int *status);
+CONVERTER *converter_set_document_from_sv (SV *converter_in, SV *document_in);
-struct TEXT_OPTIONS *copy_sv_options_for_convert_text (SV *sv_in);
+TEXT_OPTIONS *copy_sv_options_for_convert_text (SV *sv_in);
#endif
diff --git a/tp/Texinfo/XS/convert/get_html_perl_info.c
b/tp/Texinfo/XS/convert/get_html_perl_info.c
index 38e0e5d3ad..2dc460d11a 100644
--- a/tp/Texinfo/XS/convert/get_html_perl_info.c
+++ b/tp/Texinfo/XS/convert/get_html_perl_info.c
@@ -44,6 +44,7 @@
#include "converter.h"
#include "convert_html.h"
#include "get_perl_info.h"
+#include "get_converter_perl_info.h"
/* for newSVpv_utf8 */
#include "build_perl_info.h"
#include "get_converter_perl_info.h"
diff --git a/tp/Texinfo/XS/main/convert_to_text.h
b/tp/Texinfo/XS/main/convert_to_text.h
index e96d2c6ad6..ab76197fa2 100644
--- a/tp/Texinfo/XS/main/convert_to_text.h
+++ b/tp/Texinfo/XS/main/convert_to_text.h
@@ -51,7 +51,7 @@ void text_set_options_encoding_if_not_ascii (CONVERTER *self,
void text_set_options_encoding (TEXT_OPTIONS *text_options, char *encoding);
void text_reset_options_encoding (TEXT_OPTIONS *text_options);
-/* used in converters in perl */
+/* used in converters in Perl */
char *text_accents (const ELEMENT *accent, char *encoding, int set_case);
char *text_brace_no_arg_command (const ELEMENT *e, TEXT_OPTIONS *options);
diff --git a/tp/Texinfo/XS/main/get_perl_info.c
b/tp/Texinfo/XS/main/get_perl_info.c
index 3664370158..a1100b268d 100644
--- a/tp/Texinfo/XS/main/get_perl_info.c
+++ b/tp/Texinfo/XS/main/get_perl_info.c
@@ -44,8 +44,6 @@
#include "parser_conf.h"
#include "document.h"
#include "output_unit.h"
-#include "convert_to_text.h"
-#include "converter.h"
#include "get_perl_info.h"
/* See the NOTE in build_perl_info.c on use of functions related to
diff --git a/tp/Texinfo/XS/main/get_perl_info.h
b/tp/Texinfo/XS/main/get_perl_info.h
index 890010d1dc..6bd06f1287 100644
--- a/tp/Texinfo/XS/main/get_perl_info.h
+++ b/tp/Texinfo/XS/main/get_perl_info.h
@@ -17,6 +17,7 @@ void html_fill_options (OPTIONS *options, const CONVERTER
*converter);
int get_sv_option (OPTION *option, SV *value, int force,
OPTIONS *options, const CONVERTER *converter);
+
void get_sv_options (SV *sv, OPTIONS *options, OPTION **sorted_options,
CONVERTER *converter, int force);
int get_sorted_options_key_sv_option (OPTIONS *options, OPTION
**sorted_options,
@@ -52,8 +53,6 @@ INDEX_ENTRY *find_index_entry_sv (const SV *index_entry_sv,
INDEX_SORTED_BY_LETTER *get_sv_index_entries_sorted_by_letter
(INDEX_LIST *indices_info, SV
*index_entries_sorted_by_letter);
-TEXT_OPTIONS *copy_sv_options_for_convert_text (SV *sv_in);
-
BUTTON_SPECIFICATION_LIST *html_get_button_specification_list
(const CONVERTER *converter, const SV
*buttons_sv);
void html_fill_button_specification_list (const CONVERTER *converter,
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/XS/convert/get_converter_perl_info.c (set_translated_commands): remove converter, use directly generated translated commands.,
Patrice Dumas <=