[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
From: |
Patrice Dumas |
Date: |
Sun, 19 Nov 2023 10:41:03 -0500 (EST) |
branch: master
commit cfb10211f1f5aec3783ed0f524be590b1046398f
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sun Nov 19 15:29:32 2023 +0100
* tp/Texinfo/XS/main/converter_types.h (TYPE_CONVERSION_FUNCTION)
(COMMAND_CONVERSION_FUNCTION): declare struct CONVERTER; before
defining TYPE_CONVERSION_FUNCTION and COMMAND_CONVERSION_FUNCTION,
and define those structures before CONVERTER. Solution from Gavin.
---
ChangeLog | 7 ++++
tp/Texinfo/XS/main/converter_types.h | 75 +++++++++++++++++++-----------------
2 files changed, 47 insertions(+), 35 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 8db7f7b3bc..040c49cba5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2023-11-19 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/XS/main/converter_types.h (TYPE_CONVERSION_FUNCTION)
+ (COMMAND_CONVERSION_FUNCTION): declare struct CONVERTER; before
+ defining TYPE_CONVERSION_FUNCTION and COMMAND_CONVERSION_FUNCTION,
+ and define those structures before CONVERTER. Solution from Gavin.
+
2023-11-19 Gavin Smith <gavinsmith0123@gmail.com>
* tp/texi2any.supp: Add variant suppression specification
diff --git a/tp/Texinfo/XS/main/converter_types.h
b/tp/Texinfo/XS/main/converter_types.h
index 2c1afefae0..37206b9390 100644
--- a/tp/Texinfo/XS/main/converter_types.h
+++ b/tp/Texinfo/XS/main/converter_types.h
@@ -361,6 +361,46 @@ typedef struct STRING_WITH_LEN {
size_t len;
} STRING_WITH_LEN;
+/* we have a circular reference with TYPE_CONVERSION_FUNCTION
+ and CONVERTER and with COMMAND_CONVERSION_FUNCTION and CONVERTER */
+struct CONVERTER;
+
+typedef struct TYPE_CONVERSION_FUNCTION {
+ enum formatting_reference_status status;
+ /* points to the perl formatting reference if it is used for
+ conversion */
+ FORMATTING_REFERENCE *formatting_reference;
+ /* the function used for conversion, either a function that calls
+ the perl function in formatting_reference, or another C function */
+ void (* type_conversion) (struct CONVERTER *self, const enum element_type
type,
+ const ELEMENT *element, const char *content,
+ TEXT *text);
+} TYPE_CONVERSION_FUNCTION;
+
+typedef struct HTML_ARG_FORMATTED {
+ const ELEMENT *tree;
+ char *formatted[AFT_type_raw+1];
+} HTML_ARG_FORMATTED;
+
+typedef struct HTML_ARGS_FORMATTED {
+ size_t number;
+ HTML_ARG_FORMATTED *args;
+} HTML_ARGS_FORMATTED;
+
+typedef struct COMMAND_CONVERSION_FUNCTION {
+ enum formatting_reference_status status;
+ /* points to the perl formatting reference if it is used for
+ conversion */
+ FORMATTING_REFERENCE *formatting_reference;
+ /* the function used for conversion, either a function that calls
+ the perl function in formatting_reference, or another C function */
+ void (* command_conversion) (struct CONVERTER *self,
+ const enum command_id cmd,
+ const ELEMENT *element,
+ const HTML_ARGS_FORMATTED *args_formatted,
+ const char *content, TEXT *result);
+} COMMAND_CONVERSION_FUNCTION;
+
typedef struct CONVERTER {
int converter_descriptor;
/* perl converter. This should be HV *hv,
@@ -470,41 +510,6 @@ typedef struct CONVERTER {
int use_unicode_text;
} CONVERTER;
-typedef struct TYPE_CONVERSION_FUNCTION {
- enum formatting_reference_status status;
- /* points to the perl formatting reference if it is used for
- conversion */
- FORMATTING_REFERENCE *formatting_reference;
- /* the function used for conversion, either a function that calls
- the perl function in formatting_reference, or another C function */
- void (* type_conversion) (CONVERTER *self, const enum element_type type,
- const ELEMENT *element, const char *content,
- TEXT *text);
-} TYPE_CONVERSION_FUNCTION;
-
-typedef struct HTML_ARG_FORMATTED {
- const ELEMENT *tree;
- char *formatted[AFT_type_raw+1];
-} HTML_ARG_FORMATTED;
-
-typedef struct HTML_ARGS_FORMATTED {
- size_t number;
- HTML_ARG_FORMATTED *args;
-} HTML_ARGS_FORMATTED;
-
-typedef struct COMMAND_CONVERSION_FUNCTION {
- enum formatting_reference_status status;
- /* points to the perl formatting reference if it is used for
- conversion */
- FORMATTING_REFERENCE *formatting_reference;
- /* the function used for conversion, either a function that calls
- the perl function in formatting_reference, or another C function */
- void (* command_conversion) (CONVERTER *self, const enum command_id cmd,
- const ELEMENT *element,
- const HTML_ARGS_FORMATTED *args_formatted,
- const char *content, TEXT *result);
-} COMMAND_CONVERSION_FUNCTION;
-
typedef struct TRANSLATED_SUI_ASSOCIATION {
enum special_unit_info_tree tree_type;
enum special_unit_info_type string_type;