[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/XS/convert/converter.c (register_con
From: |
Patrice Dumas |
Subject: |
branch master updated: * tp/Texinfo/XS/convert/converter.c (register_converter), tp/Texinfo/XS/convert/get_html_perl_info.c (html_converter_initialize_sv), tp/Texinfo/XS/main/get_perl_info.c (converter_initialize), tp/Texinfo/XS/main/utils.c: use a local variable as initial converter before calling register_converter. Pass converter to converter_initialize. Remove new_converter function. |
Date: |
Sun, 12 Nov 2023 18:29:45 -0500 |
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 c6d67c9a10 * tp/Texinfo/XS/convert/converter.c (register_converter),
tp/Texinfo/XS/convert/get_html_perl_info.c (html_converter_initialize_sv),
tp/Texinfo/XS/main/get_perl_info.c (converter_initialize),
tp/Texinfo/XS/main/utils.c: use a local variable as initial converter before
calling register_converter. Pass converter to converter_initialize. Remove
new_converter function.
c6d67c9a10 is described below
commit c6d67c9a10f5d6873c101baec549d915c28e3f4f
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Mon Nov 13 00:29:38 2023 +0100
* tp/Texinfo/XS/convert/converter.c (register_converter),
tp/Texinfo/XS/convert/get_html_perl_info.c
(html_converter_initialize_sv), tp/Texinfo/XS/main/get_perl_info.c
(converter_initialize), tp/Texinfo/XS/main/utils.c: use a local
variable as initial converter before calling register_converter. Pass
converter to converter_initialize. Remove new_converter function.
* tp/Texinfo/XS/convert/converter.c (set_global_document_commands),
tp/Texinfo/XS/main/utils.c (set_informative_command_value)
(set_global_document_command): pass options and global commands to
set_informative_command_value and set_global_document_command, not
converters.
* tp/Texinfo/XS/main/converter_types.h (TRANSLATED_SUI_ASSOCIATION),
tp/Texinfo/XS/main/utils.c: move TRANSLATED_SUI_ASSOCIATION to
converter_types.h.
* tp/Texinfo/XS/convert/ConvertXS.xs (html_convert_output),
tp/Texinfo/XS/main/build_perl_info.c (build_output_files_information):
pass converter SV to build_output_files_information and pass directly
OUTPUT_FILES_INFORMATION.
* tp/Texinfo/XS/Makefile.am (libtexinfo_la_SOURCES),
tp/Texinfo/XS/main/converter_types.h,
tp/Texinfo/XS/main/document_types.h (enum error_type, ERROR_MESSAGE)
(ERROR_MESSAGE_LIST, GLOBAL_INFO, DOCUMENT, EXPANDED_FORMAT): move
parsed document types to a new file, document_types.h. Update includes
for all the files.
* tp/Texinfo/XS/convert/convert_html.c
(html_global_unit_direction_names, html_conversion_context_type_names)
(html_formatting_reference_names, html_argument_formatting_type_names)
(special_unit_info_type_names, translated_special_unit_info),
tp/Texinfo/XS/main/utils.c: move code used in HTML conversion to
convert_html.c.
---
ChangeLog | 38 ++++++++++++++
tp/TODO | 7 ---
tp/Texinfo/XS/Makefile.am | 1 +
tp/Texinfo/XS/convert/ConvertXS.xs | 3 +-
tp/Texinfo/XS/convert/build_html_perl_state.c | 1 +
tp/Texinfo/XS/convert/convert_html.c | 38 ++++++++++++++
tp/Texinfo/XS/convert/convert_html.h | 8 +++
tp/Texinfo/XS/convert/convert_plain_texinfo.h | 2 +-
tp/Texinfo/XS/convert/convert_text.h | 2 +-
tp/Texinfo/XS/convert/converter.c | 7 +--
tp/Texinfo/XS/convert/get_html_perl_info.c | 6 ++-
tp/Texinfo/XS/convert/indices_in_conversion.c | 1 +
tp/Texinfo/XS/main/build_perl_info.c | 13 ++---
tp/Texinfo/XS/main/build_perl_info.h | 4 +-
tp/Texinfo/XS/main/convert_to_text.h | 1 +
tp/Texinfo/XS/main/convert_utils.c | 2 +-
tp/Texinfo/XS/main/convert_utils.h | 3 +-
tp/Texinfo/XS/main/converter_types.h | 57 +++------------------
tp/Texinfo/XS/main/document.c | 1 +
tp/Texinfo/XS/main/document.h | 3 +-
tp/Texinfo/XS/main/errors.c | 2 +-
tp/Texinfo/XS/main/errors.h | 3 +-
tp/Texinfo/XS/main/get_perl_info.c | 7 +--
tp/Texinfo/XS/main/get_perl_info.h | 3 +-
tp/Texinfo/XS/main/manipulate_tree.c | 1 +
tp/Texinfo/XS/main/targets.c | 2 +-
tp/Texinfo/XS/main/translations.h | 2 +-
tp/Texinfo/XS/main/utils.c | 59 +++-------------------
tp/Texinfo/XS/main/utils.h | 22 ++------
tp/Texinfo/XS/parsetexi/indices.c | 8 +--
tp/Texinfo/XS/parsetexi/parser.h | 2 +-
.../XS/structuring_transfo/StructuringTransfo.xs | 2 +-
tp/Texinfo/XS/structuring_transfo/structuring.c | 2 +-
tp/Texinfo/XS/structuring_transfo/structuring.h | 2 +-
.../XS/structuring_transfo/transformations.c | 2 +-
.../XS/structuring_transfo/transformations.h | 2 +-
36 files changed, 150 insertions(+), 169 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index c5bc2e841f..73eb7533d2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,41 @@
+2023-11-12 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/XS/convert/converter.c (register_converter),
+ tp/Texinfo/XS/convert/get_html_perl_info.c
+ (html_converter_initialize_sv), tp/Texinfo/XS/main/get_perl_info.c
+ (converter_initialize), tp/Texinfo/XS/main/utils.c: use a local
+ variable as initial converter before calling register_converter. Pass
+ converter to converter_initialize. Remove new_converter function.
+
+ * tp/Texinfo/XS/convert/converter.c (set_global_document_commands),
+ tp/Texinfo/XS/main/utils.c (set_informative_command_value)
+ (set_global_document_command): pass options and global commands to
+ set_informative_command_value and set_global_document_command, not
+ converters.
+
+ * tp/Texinfo/XS/main/converter_types.h (TRANSLATED_SUI_ASSOCIATION),
+ tp/Texinfo/XS/main/utils.c: move TRANSLATED_SUI_ASSOCIATION to
+ converter_types.h.
+
+ * tp/Texinfo/XS/convert/ConvertXS.xs (html_convert_output),
+ tp/Texinfo/XS/main/build_perl_info.c (build_output_files_information):
+ pass converter SV to build_output_files_information and pass directly
+ OUTPUT_FILES_INFORMATION.
+
+ * tp/Texinfo/XS/Makefile.am (libtexinfo_la_SOURCES),
+ tp/Texinfo/XS/main/converter_types.h,
+ tp/Texinfo/XS/main/document_types.h (enum error_type, ERROR_MESSAGE)
+ (ERROR_MESSAGE_LIST, GLOBAL_INFO, DOCUMENT, EXPANDED_FORMAT): move
+ parsed document types to a new file, document_types.h. Update includes
+ for all the files.
+
+ * tp/Texinfo/XS/convert/convert_html.c
+ (html_global_unit_direction_names, html_conversion_context_type_names)
+ (html_formatting_reference_names, html_argument_formatting_type_names)
+ (special_unit_info_type_names, translated_special_unit_info),
+ tp/Texinfo/XS/main/utils.c: move code used in HTML conversion to
+ convert_html.c.
+
2023-11-12 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/Common.pm (split_custom_heading_command_contents),
diff --git a/tp/TODO b/tp/TODO
index 097a1c6bff..05fd22711f 100644
--- a/tp/TODO
+++ b/tp/TODO
@@ -29,13 +29,6 @@ does not work perfectly with XS. See FIXME in the code.
Tested in
./manual_tests/manual_sectioning_gap_test.sh
Not a priority.
-If needed, could change TEXINFO_XS_CONVERT to have 3 possibilities
-TEXINFO_XS_CONVERT=omit => use perl as much as possible
-TEXINFO_XS_CONVERT=both => try to run both perl and XS when possible
-TEXINFO_XS_CONVERT=only => try to run only XS code
-It is not clear that it is useful, though, 0 and 1 corresponding to
-omit and only could be sufficient.
-
Use a union for extra/info information instead of coercing a pointer?
Use ELEMENT_LIST for extra_contents extra_directions?
diff --git a/tp/Texinfo/XS/Makefile.am b/tp/Texinfo/XS/Makefile.am
index 6fc24a0b3a..070a405a9e 100644
--- a/tp/Texinfo/XS/Makefile.am
+++ b/tp/Texinfo/XS/Makefile.am
@@ -114,6 +114,7 @@ endif
# in main but not the other way around.
libtexinfo_la_SOURCES= \
main/tree_types.h \
+ main/document_types.h \
main/tree.c \
main/tree.h \
main/text.c \
diff --git a/tp/Texinfo/XS/convert/ConvertXS.xs
b/tp/Texinfo/XS/convert/ConvertXS.xs
index 1d710a13d5..d61bd0b537 100644
--- a/tp/Texinfo/XS/convert/ConvertXS.xs
+++ b/tp/Texinfo/XS/convert/ConvertXS.xs
@@ -615,7 +615,8 @@ html_convert_output (SV *converter_in, SV *tree_in, SV
*output_units_in, SV *spe
free (result);
}
- build_output_files_information (self);
+ build_output_files_information (converter_in,
+ &self->output_files_information);
}
if (result_sv)
diff --git a/tp/Texinfo/XS/convert/build_html_perl_state.c
b/tp/Texinfo/XS/convert/build_html_perl_state.c
index bd0f0bc4fe..9d60abbbce 100644
--- a/tp/Texinfo/XS/convert/build_html_perl_state.c
+++ b/tp/Texinfo/XS/convert/build_html_perl_state.c
@@ -42,6 +42,7 @@
#include "build_perl_info.h"
/* for NAMED_STRING_ELEMENT_LIST */
#include "translations.h"
+#include "convert_html.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 5200c54ef1..289182406b 100644
--- a/tp/Texinfo/XS/convert/convert_html.c
+++ b/tp/Texinfo/XS/convert/convert_html.c
@@ -38,6 +38,7 @@
#include "convert_to_texinfo.h"
#include "translations.h"
#include "convert_utils.h"
+#include "convert_to_text.h"
#include "call_html_perl_function.h"
/* for TREE_AND_STRINGS */
#include "document.h"
@@ -54,6 +55,43 @@ typedef struct CMD_VARIETY {
char *variety;
} CMD_VARIETY;
+char *html_global_unit_direction_names[] = {
+ #define hgdt_name(name) #name,
+ HTML_GLOBAL_DIRECTIONS_LIST
+ #undef hgdt_name
+};
+
+char *html_conversion_context_type_names[] = {
+ #define cctx_type(name) #name,
+ HCC_CONTEXT_TYPES_LIST
+ #undef cctx_type
+};
+
+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
+ #undef html_aft_type
+};
+
+const char *special_unit_info_type_names[SUI_type_heading + 1] =
+{
+ #define sui_type(name) #name,
+ SUI_TYPES_LIST
+ #undef sui_type
+};
+
+TRANSLATED_SUI_ASSOCIATION translated_special_unit_info[] = {
+ {SUIT_type_heading, SUI_type_heading},
+ /* these special types end the list */
+ {SUIT_type_none, SUI_type_none},
+};
+
CMD_VARIETY command_special_unit_variety[] = {
{CM_contents, "contents"},
{CM_shortcontents, "shortcontents"},
diff --git a/tp/Texinfo/XS/convert/convert_html.h
b/tp/Texinfo/XS/convert/convert_html.h
index 7d9f2ce2c3..578ff23fbd 100644
--- a/tp/Texinfo/XS/convert/convert_html.h
+++ b/tp/Texinfo/XS/convert/convert_html.h
@@ -6,6 +6,14 @@
/* for FILE_SOURCE_INFO_LIST */
#include "utils.h"
+extern char *html_conversion_context_type_names[];
+extern char *html_global_unit_direction_names[];
+
+extern char *html_formatting_reference_names[];
+
+extern TRANSLATED_SUI_ASSOCIATION translated_special_unit_info[];
+extern const char *special_unit_info_type_names[SUI_type_heading + 1];
+
void html_converter_initialize (CONVERTER *self);
void html_initialize_output_state (CONVERTER *self, char *context);
diff --git a/tp/Texinfo/XS/convert/convert_plain_texinfo.h
b/tp/Texinfo/XS/convert/convert_plain_texinfo.h
index ed17f8bfc4..8eaf414e61 100644
--- a/tp/Texinfo/XS/convert/convert_plain_texinfo.h
+++ b/tp/Texinfo/XS/convert/convert_plain_texinfo.h
@@ -2,7 +2,7 @@
#ifndef CONVERT_PLAIN_TEXINFO_H
#define CONVERT_PLAIN_TEXINFO_H
-#include "converter_types.h"
+#include "document_types.h"
char *plain_texinfo_convert (DOCUMENT *document);
diff --git a/tp/Texinfo/XS/convert/convert_text.h
b/tp/Texinfo/XS/convert/convert_text.h
index 1845daa76f..75575ad59f 100644
--- a/tp/Texinfo/XS/convert/convert_text.h
+++ b/tp/Texinfo/XS/convert/convert_text.h
@@ -2,7 +2,7 @@
#ifndef CONVERT_TEXT_H
#define CONVERT_TEXT_H
-#include "converter_types.h"
+#include "document_types.h"
#include "convert_to_text.h"
char *text_convert (DOCUMENT *document, TEXT_OPTIONS *options);
diff --git a/tp/Texinfo/XS/convert/converter.c
b/tp/Texinfo/XS/convert/converter.c
index 0a9badbf90..95bcb59f3f 100644
--- a/tp/Texinfo/XS/convert/converter.c
+++ b/tp/Texinfo/XS/convert/converter.c
@@ -81,8 +81,6 @@ register_converter (CONVERTER *converter)
converter, registered_converter, converter->document);
*/
- free (converter);
-
registered_converter->converter_descriptor = converter_index +1;
return converter_index +1;
@@ -193,7 +191,10 @@ set_global_document_commands (CONVERTER *converter,
command_location_names[location],
builtin_command_data[cmd].cmdname);
}
- element = set_global_document_command (converter, cmd, location);
+ element
+ = set_global_document_command
(converter->document->global_commands,
+ converter->conf,
+ cmd, location);
if (!element)
{
COMMAND_OPTION_VALUE *option_value = command_init (cmd,
diff --git a/tp/Texinfo/XS/convert/get_html_perl_info.c
b/tp/Texinfo/XS/convert/get_html_perl_info.c
index b4570b6d5e..4abb0a2f09 100644
--- a/tp/Texinfo/XS/convert/get_html_perl_info.c
+++ b/tp/Texinfo/XS/convert/get_html_perl_info.c
@@ -157,11 +157,15 @@ html_converter_initialize_sv (SV *converter_sv,
HV *types_conversion_hv;
HV *output_units_conversion_hv;
int converter_descriptor = 0;
+ CONVERTER initial_converter;
CONVERTER *converter;
dTHX;
- converter = converter_initialize (converter_sv);
+ converter = &initial_converter;
+ memset (converter, 0, sizeof (CONVERTER));
+
+ converter_initialize (converter_sv, converter);
converter_hv = (HV *)SvRV (converter_sv);
diff --git a/tp/Texinfo/XS/convert/indices_in_conversion.c
b/tp/Texinfo/XS/convert/indices_in_conversion.c
index 6721d4ad12..dccb185122 100644
--- a/tp/Texinfo/XS/convert/indices_in_conversion.c
+++ b/tp/Texinfo/XS/convert/indices_in_conversion.c
@@ -22,6 +22,7 @@
#include "unistr.h"
#include "tree_types.h"
+#include "converter_types.h"
#include "utils.h"
#include "extra.h"
#include "unicode.h"
diff --git a/tp/Texinfo/XS/main/build_perl_info.c
b/tp/Texinfo/XS/main/build_perl_info.c
index 7a7d3b2f3b..fb1370b90a 100644
--- a/tp/Texinfo/XS/main/build_perl_info.c
+++ b/tp/Texinfo/XS/main/build_perl_info.c
@@ -1757,9 +1757,9 @@ build_output_files_opened_files (HV *hv,
}
}
-/* for the perl converter associated to CONVERTER */
void
-build_output_files_information (CONVERTER *converter)
+build_output_files_information (SV *converter_sv,
+ OUTPUT_FILES_INFORMATION *output_files_information)
{
HV *hv;
SV **output_files_sv;
@@ -1767,10 +1767,7 @@ build_output_files_information (CONVERTER *converter)
dTHX;
- if (!converter->hv)
- return;
-
- hv = converter->hv;
+ hv = (HV *) SvRV (converter_sv);
output_files_sv = hv_fetch (hv, "output_files",
strlen ("output_files"), 0);
@@ -1787,8 +1784,8 @@ build_output_files_information (CONVERTER *converter)
}
build_output_files_opened_files (output_files_hv,
- &converter->output_files_information);
+ output_files_information);
build_output_files_unclosed_files (output_files_hv,
- &converter->output_files_information);
+ output_files_information);
}
diff --git a/tp/Texinfo/XS/main/build_perl_info.h
b/tp/Texinfo/XS/main/build_perl_info.h
index 11e4f3d17c..a5bc1ce6bc 100644
--- a/tp/Texinfo/XS/main/build_perl_info.h
+++ b/tp/Texinfo/XS/main/build_perl_info.h
@@ -9,6 +9,7 @@
#include "global_commands_types.h"
#include "tree_types.h"
+#include "document_types.h"
#include "converter_types.h"
int init (int texinfo_uninstalled, char *srcdir_in);
@@ -44,6 +45,7 @@ void pass_output_unit_files (SV *converter_sv,
void pass_converter_errors (ERROR_MESSAGE_LIST *error_messages,
HV *converter_hv);
-void build_output_files_information (CONVERTER *converter);
+void build_output_files_information (SV *converter_sv,
+ OUTPUT_FILES_INFORMATION *output_files_information);
#endif
diff --git a/tp/Texinfo/XS/main/convert_to_text.h
b/tp/Texinfo/XS/main/convert_to_text.h
index d403b3cdf1..2d7dd674d4 100644
--- a/tp/Texinfo/XS/main/convert_to_text.h
+++ b/tp/Texinfo/XS/main/convert_to_text.h
@@ -4,6 +4,7 @@
#include "options_types.h"
#include "tree_types.h"
+#include "document_types.h"
#include "converter_types.h"
typedef struct TEXT_OPTIONS {
diff --git a/tp/Texinfo/XS/main/convert_utils.c
b/tp/Texinfo/XS/main/convert_utils.c
index 5b20746cb1..e8b8a8f64f 100644
--- a/tp/Texinfo/XS/main/convert_utils.c
+++ b/tp/Texinfo/XS/main/convert_utils.c
@@ -31,8 +31,8 @@
#include "extra.h"
#include "errors.h"
#include "debug.h"
-#include "manipulate_tree.h"
#include "utils.h"
+#include "manipulate_tree.h"
#include "translations.h"
#include "convert_to_texinfo.h"
#include "convert_utils.h"
diff --git a/tp/Texinfo/XS/main/convert_utils.h
b/tp/Texinfo/XS/main/convert_utils.h
index d56c49444a..0ef03e7d4e 100644
--- a/tp/Texinfo/XS/main/convert_utils.h
+++ b/tp/Texinfo/XS/main/convert_utils.h
@@ -6,9 +6,8 @@
#include "options_types.h"
#include "tree_types.h"
+#include "document_types.h"
#include "converter_types.h"
-#include "convert_to_text.h"
-#include "utils.h"
extern char *convert_utils_month_name[12];
diff --git a/tp/Texinfo/XS/main/converter_types.h
b/tp/Texinfo/XS/main/converter_types.h
index 147951724d..517984fd1e 100644
--- a/tp/Texinfo/XS/main/converter_types.h
+++ b/tp/Texinfo/XS/main/converter_types.h
@@ -23,10 +23,7 @@
#include "tree_types.h"
#include "element_types.h"
#include "options_types.h"
-#include "global_commands_types.h"
-
-enum error_type { MSG_error, MSG_warning,
- MSG_document_error, MSG_document_warning };
+#include "document_types.h"
enum formatting_reference_status {
FRS_status_none,
@@ -170,53 +167,6 @@ typedef struct {
size_t space;
} MONOSPACE_CONTEXT_STACK;
-typedef struct {
- char *message;
- char *error_line;
- enum error_type type;
- int continuation;
- SOURCE_INFO source_info;
-} ERROR_MESSAGE;
-
-typedef struct {
- ERROR_MESSAGE *list;
- size_t number;
- size_t space;
-} ERROR_MESSAGE_LIST;
-
-typedef struct GLOBAL_INFO {
- char *input_file_name;
- char *input_directory;
- char *input_encoding_name;
- int sections_level_modifier;
- ELEMENT dircategory_direntry; /* an array of elements */
- /* Ignored characters for index sort key */
- IGNORED_CHARS ignored_chars;
-} GLOBAL_INFO;
-
-typedef struct DOCUMENT {
- int descriptor;
- ELEMENT *tree;
- INDEX **index_names;
- FLOAT_RECORD_LIST *floats;
- LISTOFFLOATS_TYPE_LIST *listoffloats;
- ELEMENT_LIST *internal_references;
- LABEL_LIST *labels_list;
- LABEL_LIST *identifiers_target;
- GLOBAL_INFO *global_info;
- GLOBAL_COMMANDS *global_commands;
- STRING_LIST *small_strings;
- ELEMENT_LIST *nodes_list;
- ELEMENT_LIST *sections_list;
- ERROR_MESSAGE_LIST *error_messages;
- OPTIONS *options; /* for options used in structuring */
-} DOCUMENT;
-
-typedef struct expanded_format {
- char *format;
- int expandedp;
-} EXPANDED_FORMAT;
-
typedef struct VARIETY_DIRECTION_INDEX {
char *special_unit_variety;
int direction_index;
@@ -478,4 +428,9 @@ typedef struct CONVERTER {
char *current_filename;
} CONVERTER;
+typedef struct TRANSLATED_SUI_ASSOCIATION {
+ enum special_unit_info_tree tree_type;
+ enum special_unit_info_type string_type;
+} TRANSLATED_SUI_ASSOCIATION;
+
#endif
diff --git a/tp/Texinfo/XS/main/document.c b/tp/Texinfo/XS/main/document.c
index 99f188ae33..029448e2d9 100644
--- a/tp/Texinfo/XS/main/document.c
+++ b/tp/Texinfo/XS/main/document.c
@@ -23,6 +23,7 @@
#include "global_commands_types.h"
#include "options_types.h"
#include "tree_types.h"
+#include "document_types.h"
#include "tree.h"
#include "floats.h"
#include "errors.h"
diff --git a/tp/Texinfo/XS/main/document.h b/tp/Texinfo/XS/main/document.h
index 6c758e5c62..d883d34319 100644
--- a/tp/Texinfo/XS/main/document.h
+++ b/tp/Texinfo/XS/main/document.h
@@ -7,8 +7,7 @@
#include "options_types.h"
#include "global_commands_types.h"
#include "tree_types.h"
-/* for DOCUMENT ERROR_MESSAGE_LIST GLOBAL_INFO */
-#include "converter_types.h"
+#include "document_types.h"
typedef struct TREE_AND_STRINGS {
ELEMENT *tree;
diff --git a/tp/Texinfo/XS/main/errors.c b/tp/Texinfo/XS/main/errors.c
index 08f8b91129..7e2b6f2318 100644
--- a/tp/Texinfo/XS/main/errors.c
+++ b/tp/Texinfo/XS/main/errors.c
@@ -27,7 +27,7 @@
#include <string.h>
#include "tree_types.h"
-#include "converter_types.h"
+#include "document_types.h"
/* also for xvasprintf */
#include "text.h"
/* for debug_output */
diff --git a/tp/Texinfo/XS/main/errors.h b/tp/Texinfo/XS/main/errors.h
index 55702d89cd..da62eea719 100644
--- a/tp/Texinfo/XS/main/errors.h
+++ b/tp/Texinfo/XS/main/errors.h
@@ -5,7 +5,8 @@
#include <stdarg.h>
#include "tree_types.h"
-#include "converter_types.h"
+#include "options_types.h"
+#include "document_types.h"
void line_error (char *format, ...);
void line_warn (char *format, ...);
diff --git a/tp/Texinfo/XS/main/get_perl_info.c
b/tp/Texinfo/XS/main/get_perl_info.c
index fa6e22a4ca..386f3237cd 100644
--- a/tp/Texinfo/XS/main/get_perl_info.c
+++ b/tp/Texinfo/XS/main/get_perl_info.c
@@ -337,12 +337,11 @@ set_translated_commands (CONVERTER *converter, HV *hv_in)
}
}
-CONVERTER *
-converter_initialize (SV *converter_sv)
+void
+converter_initialize (SV *converter_sv, CONVERTER *converter)
{
HV *hv_in;
SV **converter_init_conf_sv;
- CONVERTER *converter = new_converter ();
DOCUMENT *document;
dTHX;
@@ -365,8 +364,6 @@ converter_initialize (SV *converter_sv)
set_translated_commands (converter, hv_in);
get_expanded_formats (hv_in, &converter->expanded_formats);
-
- return converter;
}
/* initialize an XS converter from a perl converter right before conversion */
diff --git a/tp/Texinfo/XS/main/get_perl_info.h
b/tp/Texinfo/XS/main/get_perl_info.h
index f34f5b5355..28e2e3e4e0 100644
--- a/tp/Texinfo/XS/main/get_perl_info.h
+++ b/tp/Texinfo/XS/main/get_perl_info.h
@@ -7,6 +7,7 @@
#include "options_types.h"
#include "tree_types.h"
+#include "document_types.h"
#include "converter_types.h"
#include "convert_to_text.h"
@@ -25,7 +26,7 @@ void set_conf (CONVERTER *converter, const char *conf, SV
*value);
CONVERTER *set_output_converter_sv (SV *sv_in, char *warn_string);
CONVERTER *get_sv_converter (SV *sv_in, char *warn_string);
-CONVERTER *converter_initialize (SV *converter_sv);
+void converter_initialize (SV *converter_sv, CONVERTER *converter);
INDEX_SORTED_BY_LETTER *get_sv_index_entries_sorted_by_letter
(INDEX **index_names, SV *index_entries_sorted_by_letter);
diff --git a/tp/Texinfo/XS/main/manipulate_tree.c
b/tp/Texinfo/XS/main/manipulate_tree.c
index dd83827387..dc82c7240b 100644
--- a/tp/Texinfo/XS/main/manipulate_tree.c
+++ b/tp/Texinfo/XS/main/manipulate_tree.c
@@ -28,6 +28,7 @@
#include "debug.h"
#include "targets.h"
#include "utils.h"
+#include "manipulate_tree.h"
/* copy_tree from Texinfo::Common */
diff --git a/tp/Texinfo/XS/main/targets.c b/tp/Texinfo/XS/main/targets.c
index 1d0b5fc7b4..341b69e9e0 100644
--- a/tp/Texinfo/XS/main/targets.c
+++ b/tp/Texinfo/XS/main/targets.c
@@ -20,7 +20,7 @@
#include <string.h>
#include "tree_types.h"
-#include "converter_types.h"
+#include "document_types.h"
#include "tree.h"
#include "errors.h"
#include "debug.h"
diff --git a/tp/Texinfo/XS/main/translations.h
b/tp/Texinfo/XS/main/translations.h
index 595b72b3f2..7f906566be 100644
--- a/tp/Texinfo/XS/main/translations.h
+++ b/tp/Texinfo/XS/main/translations.h
@@ -6,7 +6,7 @@
#include "options_types.h"
#include "tree_types.h"
-#include "converter_types.h"
+#include "document_types.h"
/* element or string may not always be present */
typedef struct NAMED_STRING_ELEMENT {
diff --git a/tp/Texinfo/XS/main/utils.c b/tp/Texinfo/XS/main/utils.c
index 2a04c0f165..3fb0f40fb6 100644
--- a/tp/Texinfo/XS/main/utils.c
+++ b/tp/Texinfo/XS/main/utils.c
@@ -68,43 +68,6 @@ const char *output_unit_type_names[] = {"unit",
"external_node_unit",
"special_unit"};
-char *html_global_unit_direction_names[] = {
- #define hgdt_name(name) #name,
- HTML_GLOBAL_DIRECTIONS_LIST
- #undef hgdt_name
-};
-
-char *html_conversion_context_type_names[] = {
- #define cctx_type(name) #name,
- HCC_CONTEXT_TYPES_LIST
- #undef cctx_type
-};
-
-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
- #undef html_aft_type
-};
-
-const char *special_unit_info_type_names[SUI_type_heading + 1] =
-{
- #define sui_type(name) #name,
- SUI_TYPES_LIST
- #undef sui_type
-};
-
-TRANSLATED_SUI_ASSOCIATION translated_special_unit_info[] = {
- {SUIT_type_heading, SUI_type_heading},
- /* these special types end the list */
- {SUIT_type_none, SUI_type_none},
-};
-
ENCODING_CONVERSION_LIST output_conversions = {0, 0, 0, -1};
ENCODING_CONVERSION_LIST input_conversions = {0, 0, 0, 1};
@@ -970,8 +933,8 @@ informative_command_value (ELEMENT *element)
return 0;
}
-void
-set_informative_command_value (CONVERTER *self, ELEMENT *element)
+static void
+set_informative_command_value (OPTIONS *options, ELEMENT *element)
{
char *value = 0;
enum command_id cmd = element_builtin_cmd (element);
@@ -982,7 +945,7 @@ set_informative_command_value (CONVERTER *self, ELEMENT
*element)
if (value)
{
- COMMAND_OPTION_REF *option_ref = get_command_option (self->conf, cmd);
+ COMMAND_OPTION_REF *option_ref = get_command_option (options, cmd);
if (option_ref)
{
if (option_ref->type == GO_int)
@@ -1078,14 +1041,15 @@ get_global_document_command (GLOBAL_COMMANDS
*global_commands,
and associated customization variables are not set/reset either.
*/
ELEMENT *
-set_global_document_command (CONVERTER *self, enum command_id cmd,
+set_global_document_command (GLOBAL_COMMANDS *global_commands, OPTIONS
*options,
+ enum command_id cmd,
enum command_location command_location)
{
ELEMENT *element
- = get_global_document_command (self->document->global_commands, cmd,
+ = get_global_document_command (global_commands, cmd,
command_location);
if (element)
- set_informative_command_value (self, element);
+ set_informative_command_value (options, element);
return element;
}
@@ -1099,15 +1063,6 @@ new_options (void)
return options;
}
-CONVERTER *
-new_converter (void)
-{
- CONVERTER *converter
- = (CONVERTER *) malloc (sizeof (CONVERTER));
- memset (converter, 0, sizeof (CONVERTER));
- return converter;
-}
-
/* misc functions used in general in structuring and in conversion */
diff --git a/tp/Texinfo/XS/main/utils.h b/tp/Texinfo/XS/main/utils.h
index 354d4d0f88..be22f1b8e4 100644
--- a/tp/Texinfo/XS/main/utils.h
+++ b/tp/Texinfo/XS/main/utils.h
@@ -24,7 +24,7 @@
#include "global_commands_types.h"
#include "tree_types.h"
#include "command_ids.h"
-#include "converter_types.h"
+#include "document_types.h"
#include "builtin_commands.h"
extern const char *whitespace_chars;
@@ -40,11 +40,6 @@ extern const char *output_unit_type_names[];
extern const char *command_location_names[];
-extern char *html_conversion_context_type_names[];
-extern char *html_global_unit_direction_names[];
-
-extern char *html_formatting_reference_names[];
-
typedef struct {
char *encoding_name;
iconv_t iconv;
@@ -152,14 +147,6 @@ enum command_location {
#define HMSF_multiple_pass 0x2000
#define HMSF_translations 0x4000
-typedef struct TRANSLATED_SUI_ASSOCIATION {
- enum special_unit_info_tree tree_type;
- enum special_unit_info_type string_type;
-} TRANSLATED_SUI_ASSOCIATION;
-
-extern TRANSLATED_SUI_ASSOCIATION translated_special_unit_info[];
-extern const char *special_unit_info_type_names[SUI_type_heading + 1];
-
typedef struct TARGET_FILENAME {
char *target;
char *filename;
@@ -271,14 +258,13 @@ int format_expanded_p (EXPANDED_FORMAT *formats, char
*format);
char *enumerate_item_representation (char *specification, int number);
-CONVERTER *new_converter (void);
-
ELEMENT *get_global_document_command (GLOBAL_COMMANDS *global_commands,
enum command_id cmd,
enum command_location command_location);
char *informative_command_value (ELEMENT *element);
-ELEMENT *set_global_document_command (CONVERTER *self, enum command_id cmd,
- enum command_location command_location);
+ELEMENT *set_global_document_command (GLOBAL_COMMANDS *global_commands,
+ OPTIONS *options, enum command_id cmd,
+ enum command_location command_location);
ELEMENT *get_cmd_global_command (GLOBAL_COMMANDS *global_commands_ref,
enum command_id cmd);
#endif
diff --git a/tp/Texinfo/XS/parsetexi/indices.c
b/tp/Texinfo/XS/parsetexi/indices.c
index 332f5f0861..c08a4b6cf1 100644
--- a/tp/Texinfo/XS/parsetexi/indices.c
+++ b/tp/Texinfo/XS/parsetexi/indices.c
@@ -18,19 +18,19 @@
#include <stdio.h>
#include <stdlib.h>
-#include "options_types.h"
-#include "converter_types.h"
#include "tree_types.h"
#include "command_ids.h"
+/* document and options used in complete_indices */
+#include "options_types.h"
+#include "document_types.h"
#include "tree.h"
-/* for xasprintf and other */
#include "errors.h"
#include "debug.h"
#include "command_stack.h"
#include "context_stack.h"
#include "builtin_commands.h"
#include "extra.h"
-/* for ultimate_index */
+/* for ultimate_index xasprintf */
#include "utils.h"
/* for copy_tree */
#include "manipulate_tree.h"
diff --git a/tp/Texinfo/XS/parsetexi/parser.h b/tp/Texinfo/XS/parsetexi/parser.h
index 97b2bf8355..873305ed49 100644
--- a/tp/Texinfo/XS/parsetexi/parser.h
+++ b/tp/Texinfo/XS/parsetexi/parser.h
@@ -24,7 +24,7 @@
#include "global_commands_types.h"
#include "tree_types.h"
/* for GLOBAL_INFO */
-#include "converter_types.h"
+#include "document_types.h"
#include "tree.h"
#include "context_stack.h"
#include "commands.h"
diff --git a/tp/Texinfo/XS/structuring_transfo/StructuringTransfo.xs
b/tp/Texinfo/XS/structuring_transfo/StructuringTransfo.xs
index 538e277fd1..a6c98cbe9d 100644
--- a/tp/Texinfo/XS/structuring_transfo/StructuringTransfo.xs
+++ b/tp/Texinfo/XS/structuring_transfo/StructuringTransfo.xs
@@ -32,7 +32,7 @@
#include "options_types.h"
#include "tree_types.h"
-#include "converter_types.h"
+#include "document_types.h"
#include "tree.h"
#include "utils.h"
#include "manipulate_tree.h"
diff --git a/tp/Texinfo/XS/structuring_transfo/structuring.c
b/tp/Texinfo/XS/structuring_transfo/structuring.c
index a7c98dbb07..39d27d4ce2 100644
--- a/tp/Texinfo/XS/structuring_transfo/structuring.c
+++ b/tp/Texinfo/XS/structuring_transfo/structuring.c
@@ -24,7 +24,7 @@
#include "element_types.h"
#include "options_types.h"
#include "tree_types.h"
-#include "converter_types.h"
+#include "document_types.h"
#include "tree.h"
#include "extra.h"
#include "errors.h"
diff --git a/tp/Texinfo/XS/structuring_transfo/structuring.h
b/tp/Texinfo/XS/structuring_transfo/structuring.h
index c329de92dc..6de4347f02 100644
--- a/tp/Texinfo/XS/structuring_transfo/structuring.h
+++ b/tp/Texinfo/XS/structuring_transfo/structuring.h
@@ -4,7 +4,7 @@
#include "options_types.h"
#include "tree_types.h"
-#include "converter_types.h"
+#include "document_types.h"
void associate_internal_references (DOCUMENT *document);
ELEMENT_LIST *sectioning_structure (DOCUMENT *document);
diff --git a/tp/Texinfo/XS/structuring_transfo/transformations.c
b/tp/Texinfo/XS/structuring_transfo/transformations.c
index 70d7764af5..3a368d0740 100644
--- a/tp/Texinfo/XS/structuring_transfo/transformations.c
+++ b/tp/Texinfo/XS/structuring_transfo/transformations.c
@@ -29,7 +29,7 @@
#include "element_types.h"
#include "tree_types.h"
#include "command_ids.h"
-#include "converter_types.h"
+#include "document_types.h"
#include "text.h"
#include "tree.h"
#include "builtin_commands.h"
diff --git a/tp/Texinfo/XS/structuring_transfo/transformations.h
b/tp/Texinfo/XS/structuring_transfo/transformations.h
index e2424f79ae..505c4c966a 100644
--- a/tp/Texinfo/XS/structuring_transfo/transformations.h
+++ b/tp/Texinfo/XS/structuring_transfo/transformations.h
@@ -3,7 +3,7 @@
#define TRANSFORMATIONS_H
#include "tree_types.h"
-#include "converter_types.h"
+#include "document_types.h"
ELEMENT_LIST *fill_gaps_in_sectioning (ELEMENT *root);
void relate_index_entries_to_table_items_in_tree (ELEMENT *tree,
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/XS/convert/converter.c (register_converter), tp/Texinfo/XS/convert/get_html_perl_info.c (html_converter_initialize_sv), tp/Texinfo/XS/main/get_perl_info.c (converter_initialize), tp/Texinfo/XS/main/utils.c: use a local variable as initial converter before calling register_converter. Pass converter to converter_initialize. Remove new_converter function.,
Patrice Dumas <=