aboutsummaryrefslogtreecommitdiffstats
path: root/src/mds-kbdc/tree.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/mds-kbdc/tree.h')
-rw-r--r--src/mds-kbdc/tree.h720
1 files changed, 344 insertions, 376 deletions
diff --git a/src/mds-kbdc/tree.h b/src/mds-kbdc/tree.h
index e9d28f4..392c85b 100644
--- a/src/mds-kbdc/tree.h
+++ b/src/mds-kbdc/tree.h
@@ -32,142 +32,142 @@
/**
* Value of `mds_kbdc_tree_t.type` for `mds_kbdc_tree_information_t`
*/
-#define MDS_KBDC_TREE_TYPE_INFORMATION 0
+#define MDS_KBDC_TREE_TYPE_INFORMATION 0
/**
* Value of `mds_kbdc_tree_t.type` for `mds_kbdc_tree_information_language_t`
*/
-#define MDS_KBDC_TREE_TYPE_INFORMATION_LANGUAGE 1
+#define MDS_KBDC_TREE_TYPE_INFORMATION_LANGUAGE 1
/**
* Value of `mds_kbdc_tree_t.type` for `mds_kbdc_tree_information_country_t`
*/
-#define MDS_KBDC_TREE_TYPE_INFORMATION_COUNTRY 2
+#define MDS_KBDC_TREE_TYPE_INFORMATION_COUNTRY 2
/**
* Value of `mds_kbdc_tree_t.type` for `mds_kbdc_tree_information_variant_t`
*/
-#define MDS_KBDC_TREE_TYPE_INFORMATION_VARIANT 3
+#define MDS_KBDC_TREE_TYPE_INFORMATION_VARIANT 3
/**
* Value of `mds_kbdc_tree_t.type` for `mds_kbdc_tree_include_t`
*/
-#define MDS_KBDC_TREE_TYPE_INCLUDE 4
+#define MDS_KBDC_TREE_TYPE_INCLUDE 4
/**
* Value of `mds_kbdc_tree_t.type` for `mds_kbdc_tree_function_t`
*/
-#define MDS_KBDC_TREE_TYPE_FUNCTION 5
+#define MDS_KBDC_TREE_TYPE_FUNCTION 5
/**
* Value of `mds_kbdc_tree_t.type` for `mds_kbdc_tree_macro_t`
*/
-#define MDS_KBDC_TREE_TYPE_MACRO 6
+#define MDS_KBDC_TREE_TYPE_MACRO 6
/**
* Value of `mds_kbdc_tree_t.type` for `mds_kbdc_tree_assumption`
*/
-#define MDS_KBDC_TREE_TYPE_ASSUMPTION 7
+#define MDS_KBDC_TREE_TYPE_ASSUMPTION 7
/**
* Value of `mds_kbdc_tree_t.type` for `mds_kbdc_tree_assumption_have_t`
*/
-#define MDS_KBDC_TREE_TYPE_ASSUMPTION_HAVE 8
+#define MDS_KBDC_TREE_TYPE_ASSUMPTION_HAVE 8
/**
* Value of `mds_kbdc_tree_t.type` for `mds_kbdc_tree_assumption_have_chars_t`
*/
-#define MDS_KBDC_TREE_TYPE_ASSUMPTION_HAVE_CHARS 9
+#define MDS_KBDC_TREE_TYPE_ASSUMPTION_HAVE_CHARS 9
/**
* Value of `mds_kbdc_tree_t.type` for `mds_kbdc_tree_assumption_have_range_t`
*/
-#define MDS_KBDC_TREE_TYPE_ASSUMPTION_HAVE_RANGE 10
+#define MDS_KBDC_TREE_TYPE_ASSUMPTION_HAVE_RANGE 10
/**
* Value of `mds_kbdc_tree_t.type` for `mds_kbdc_tree_for_t`
*/
-#define MDS_KBDC_TREE_TYPE_FOR 11
+#define MDS_KBDC_TREE_TYPE_FOR 11
/**
* Value of `mds_kbdc_tree_t.type` for `mds_kbdc_tree_if_t`
*/
-#define MDS_KBDC_TREE_TYPE_IF 12
+#define MDS_KBDC_TREE_TYPE_IF 12
/**
* Value of `mds_kbdc_tree_t.type` for `mds_kbdc_tree_let_t`
*/
-#define MDS_KBDC_TREE_TYPE_LET 13
+#define MDS_KBDC_TREE_TYPE_LET 13
/**
* Value of `mds_kbdc_tree_t.type` for `mds_kbdc_tree_map_t`
*/
-#define MDS_KBDC_TREE_TYPE_MAP 14
+#define MDS_KBDC_TREE_TYPE_MAP 14
/**
* Value of `mds_kbdc_tree_t.type` for `mds_kbdc_tree_array_t`
*/
-#define MDS_KBDC_TREE_TYPE_ARRAY 15
+#define MDS_KBDC_TREE_TYPE_ARRAY 15
/**
* Value of `mds_kbdc_tree_t.type` for `mds_kbdc_tree_keys_t`
*/
-#define MDS_KBDC_TREE_TYPE_KEYS 16
+#define MDS_KBDC_TREE_TYPE_KEYS 16
/**
* Value of `mds_kbdc_tree_t.type` for `mds_kbdc_tree_string_t`
*/
-#define MDS_KBDC_TREE_TYPE_STRING 17
+#define MDS_KBDC_TREE_TYPE_STRING 17
/**
* Value of `mds_kbdc_tree_t.type` for `mds_kbdc_tree_compiled_keys_t`
*/
-#define MDS_KBDC_TREE_TYPE_COMPILED_KEYS 18
+#define MDS_KBDC_TREE_TYPE_COMPILED_KEYS 18
/**
* Value of `mds_kbdc_tree_t.type` for `mds_kbdc_tree_compiled_string_t`
*/
-#define MDS_KBDC_TREE_TYPE_COMPILED_STRING 19
+#define MDS_KBDC_TREE_TYPE_COMPILED_STRING 19
/**
* Value of `mds_kbdc_tree_t.type` for `mds_kbdc_tree_nothing_t`
*/
-#define MDS_KBDC_TREE_TYPE_NOTHING 20
+#define MDS_KBDC_TREE_TYPE_NOTHING 20
/**
* Value of `mds_kbdc_tree_t.type` for `mds_kbdc_tree_alternation_t`
*/
-#define MDS_KBDC_TREE_TYPE_ALTERNATION 21
+#define MDS_KBDC_TREE_TYPE_ALTERNATION 21
/**
* Value of `mds_kbdc_tree_t.type` for `mds_kbdc_tree_unordered_t`
*/
-#define MDS_KBDC_TREE_TYPE_UNORDERED 22
+#define MDS_KBDC_TREE_TYPE_UNORDERED 22
/**
* Value of `mds_kbdc_tree_t.type` for `mds_kbdc_tree_ordered_t`
*/
-#define MDS_KBDC_TREE_TYPE_ORDERED 23
+#define MDS_KBDC_TREE_TYPE_ORDERED 23
/**
* Value of `mds_kbdc_tree_t.type` for `mds_kbdc_tree_macro_call_t`
*/
-#define MDS_KBDC_TREE_TYPE_MACRO_CALL 24
+#define MDS_KBDC_TREE_TYPE_MACRO_CALL 24
/**
* Value of `mds_kbdc_tree_t.type` for `mds_kbdc_tree_return_t`
*/
-#define MDS_KBDC_TREE_TYPE_RETURN 25
+#define MDS_KBDC_TREE_TYPE_RETURN 25
/**
* Value of `mds_kbdc_tree_t.type` for `mds_kbdc_tree_break_t`
*/
-#define MDS_KBDC_TREE_TYPE_BREAK 26
+#define MDS_KBDC_TREE_TYPE_BREAK 26
/**
* Value of `mds_kbdc_tree_t.type` for `mds_kbdc_tree_continue_t`
*/
-#define MDS_KBDC_TREE_TYPE_CONTINUE 27
+#define MDS_KBDC_TREE_TYPE_CONTINUE 27
@@ -196,13 +196,13 @@ typedef union mds_kbdc_tree mds_kbdc_tree_t;
* - size_t loc_end; -- The last byte in the source code where this is found, exclusive
* - long processed; -- The lasted step where the statement has already been processed once
*/
-#define MDS_KBDC_TREE_COMMON \
- int type; \
- mds_kbdc_tree_t* next; \
- size_t loc_line; \
- size_t loc_start; \
- size_t loc_end; \
- long processed
+#define MDS_KBDC_TREE_COMMON\
+ int type;\
+ mds_kbdc_tree_t *next;\
+ size_t loc_line;\
+ size_t loc_start;\
+ size_t loc_end;\
+ long processed
/**
* This macro is used in this header file, and is then
@@ -211,7 +211,7 @@ typedef union mds_kbdc_tree mds_kbdc_tree_t;
* @param S:size_t The size of the data structure excluding this padding and
* the members defined by the macro `MDS_KBDC_TREE_COMMON`
*/
-#define MDS_KBDC_TREE_PADDING_(S) char _padding[(5 * sizeof(void*) - (S)) / sizeof(char)]
+#define MDS_KBDC_TREE_PADDING_(S) char _padding[(5 * sizeof(void*) - (S)) / sizeof(char)]
/**
* This macro is used in this header file, and is then
@@ -221,7 +221,7 @@ typedef union mds_kbdc_tree mds_kbdc_tree_t;
* structure excluding this padding and the members defined
* by the macro `MDS_KBDC_TREE_COMMON`
*/
-#define MDS_KBDC_TREE_PADDING(N) MDS_KBDC_TREE_PADDING_((N) * sizeof(void*))
+#define MDS_KBDC_TREE_PADDING(N) MDS_KBDC_TREE_PADDING_((N) * sizeof(void*))
@@ -232,17 +232,16 @@ typedef union mds_kbdc_tree mds_kbdc_tree_t;
* the common members, a pointer to the first
* node on next level in the tree
*/
-struct mds_kbdc_tree_nesting
-{
- MDS_KBDC_TREE_COMMON;
-
- /**
- * The first child node, `.inner.next`
- * is used to access the second child node.
- */
- mds_kbdc_tree_t* inner;
-
- MDS_KBDC_TREE_PADDING(1);
+struct mds_kbdc_tree_nesting {
+ MDS_KBDC_TREE_COMMON;
+
+ /**
+ * The first child node, `.inner.next`
+ * is used to access the second child node.
+ */
+ mds_kbdc_tree_t *inner;
+
+ MDS_KBDC_TREE_PADDING(1);
};
@@ -258,16 +257,15 @@ typedef struct mds_kbdc_tree_nesting mds_kbdc_tree_information_t;
* for the tree structurs for the information
* entries: the children of `mds_kbdc_tree_information_t`
*/
-struct mds_kbdc_tree_information_data
-{
- MDS_KBDC_TREE_COMMON;
-
- /**
- * The value of the information entry
- */
- char* data;
-
- MDS_KBDC_TREE_PADDING(1);
+struct mds_kbdc_tree_information_data {
+ MDS_KBDC_TREE_COMMON;
+
+ /**
+ * The value of the information entry
+ */
+ char *data;
+
+ MDS_KBDC_TREE_PADDING(1);
};
@@ -290,27 +288,25 @@ typedef struct mds_kbdc_tree_information_data mds_kbdc_tree_information_variant_
/**
* Leaf structure for inclusion of a file
*/
-typedef struct mds_kbdc_tree_include
-{
- MDS_KBDC_TREE_COMMON;
-
- /**
- * The included layout code tree
- */
- mds_kbdc_tree_t* inner;
-
- /**
- * The filename of the file to include
- */
- char* filename;
-
- /**
- * The source code of the file included by this statement
- */
- mds_kbdc_source_code_t* source_code;
-
- MDS_KBDC_TREE_PADDING(3);
-
+typedef struct mds_kbdc_tree_include {
+ MDS_KBDC_TREE_COMMON;
+
+ /**
+ * The included layout code tree
+ */
+ mds_kbdc_tree_t *inner;
+
+ /**
+ * The filename of the file to include
+ */
+ char *filename;
+
+ /**
+ * The source code of the file included by this statement
+ */
+ mds_kbdc_source_code_t* source_code;
+
+ MDS_KBDC_TREE_PADDING(3);
} mds_kbdc_tree_include_t;
@@ -320,28 +316,27 @@ typedef struct mds_kbdc_tree_include
* for tree structurs that define a callable
* element
*/
-struct mds_kbdc_tree_callable
-{
- MDS_KBDC_TREE_COMMON;
-
- /**
- * The first child node, `.inner.next`
- * is used to access the second child node
- */
- mds_kbdc_tree_t* inner;
-
- /* It is important that `.inner` is first because
- * it is first in `struct mds_kbdc_tree_nesting`
- * too which means that `.inner` has to same
- * offset everyever (except in `mds_kbdc_tree_if_t`).
- */
-
- /**
- * The name of the callable
- */
- char* name;
-
- MDS_KBDC_TREE_PADDING(2);
+struct mds_kbdc_tree_callable {
+ MDS_KBDC_TREE_COMMON;
+
+ /**
+ * The first child node, `.inner.next`
+ * is used to access the second child node
+ */
+ mds_kbdc_tree_t *inner;
+
+ /* It is important that `.inner` is first because
+ * it is first in `struct mds_kbdc_tree_nesting`
+ * too which means that `.inner` has to same
+ * offset everyever (except in `mds_kbdc_tree_if_t`).
+ */
+
+ /**
+ * The name of the callable
+ */
+ char *name;
+
+ MDS_KBDC_TREE_PADDING(2);
};
@@ -366,17 +361,15 @@ typedef struct mds_kbdc_tree_nesting mds_kbdc_tree_assumption_t;
* Tree structure for making the assumption
* that there is a mapping to a key or string
*/
-typedef struct mds_kbdc_tree_assumption_have
-{
- MDS_KBDC_TREE_COMMON;
-
- /**
- * The key or string
- */
- mds_kbdc_tree_t* data;
-
- MDS_KBDC_TREE_PADDING(1);
-
+typedef struct mds_kbdc_tree_assumption_have {
+ MDS_KBDC_TREE_COMMON;
+
+ /**
+ * The key or string
+ */
+ mds_kbdc_tree_t *data;
+
+ MDS_KBDC_TREE_PADDING(1);
} mds_kbdc_tree_assumption_have_t;
@@ -384,17 +377,15 @@ typedef struct mds_kbdc_tree_assumption_have
* Leaf structure for making the assumption
* that there are mappings to a set of characters
*/
-typedef struct mds_kbdc_tree_assumption_have_chars
-{
- MDS_KBDC_TREE_COMMON;
-
- /**
- * The characters
- */
- char* chars;
-
- MDS_KBDC_TREE_PADDING(1);
-
+typedef struct mds_kbdc_tree_assumption_have_chars {
+ MDS_KBDC_TREE_COMMON;
+
+ /**
+ * The characters
+ */
+ char *chars;
+
+ MDS_KBDC_TREE_PADDING(1);
} mds_kbdc_tree_assumption_have_chars_t;
@@ -402,91 +393,85 @@ typedef struct mds_kbdc_tree_assumption_have_chars
* Leaf structure for making the assumption
* that there are mappings to a range of characters
*/
-typedef struct mds_kbdc_tree_assumption_have_range
-{
- MDS_KBDC_TREE_COMMON;
-
- /**
- * The first character, inclusive
- */
- char* first;
-
- /**
- * The last character, inclusive
- */
- char* last;
-
- MDS_KBDC_TREE_PADDING(2);
-
+typedef struct mds_kbdc_tree_assumption_have_range {
+ MDS_KBDC_TREE_COMMON;
+
+ /**
+ * The first character, inclusive
+ */
+ char *first;
+
+ /**
+ * The last character, inclusive
+ */
+ char *last;
+
+ MDS_KBDC_TREE_PADDING(2);
} mds_kbdc_tree_assumption_have_range_t;
/**
* Tree structure for a "for"-loop
*/
-typedef struct mds_kbdc_tree_for
-{
- MDS_KBDC_TREE_COMMON;
-
- /**
- * The first child node, `.inner.next` is
- * used to access the second child node.
- * This is what should be done inside the loop.
- */
- mds_kbdc_tree_t* inner;
-
- /* It is important that `.inner` is first because
- * it is first in `struct mds_kbdc_tree_nesting`
- * too which means that `.inner` has to same
- * offset everyever (except in `mds_kbdc_tree_if_t`).
- */
-
- /**
- * The first value to variable should take, inclusive
- */
- char* first;
-
- /**
- * The last value the variable should take, inclusive
- */
- char* last;
-
- /**
- * The variable
- */
- char* variable;
-
- MDS_KBDC_TREE_PADDING(4);
-
+typedef struct mds_kbdc_tree_for {
+ MDS_KBDC_TREE_COMMON;
+
+ /**
+ * The first child node, `.inner.next` is
+ * used to access the second child node.
+ * This is what should be done inside the loop.
+ */
+ mds_kbdc_tree_t *inner;
+
+ /* It is important that `.inner` is first because
+ * it is first in `struct mds_kbdc_tree_nesting`
+ * too which means that `.inner` has to same
+ * offset everyever (except in `mds_kbdc_tree_if_t`).
+ */
+
+ /**
+ * The first value to variable should take, inclusive
+ */
+ char *first;
+
+ /**
+ * The last value the variable should take, inclusive
+ */
+ char *last;
+
+ /**
+ * The variable
+ */
+ char *variable;
+
+ MDS_KBDC_TREE_PADDING(4);
} mds_kbdc_tree_for_t;
/**
* Tree structure for a "if"-statement
*/
-typedef struct mds_kbdc_tree_if
-{
- MDS_KBDC_TREE_COMMON;
-
- /**
- * The condition
- */
- char* condition;
-
- /**
- * This is what should be done inside
- * if the condition is satisfied
- */
- mds_kbdc_tree_t* inner;
-
- /**
- * This is what should be done inside
- * if the condition is not satisfied
- */
- mds_kbdc_tree_t* otherwise;
-
- MDS_KBDC_TREE_PADDING(3);
-
+typedef struct mds_kbdc_tree_if {
+ MDS_KBDC_TREE_COMMON;
+
+ /**
+ * The condition
+ */
+ char *condition;
+
+ /**
+ * This is what should be done inside
+ * if the condition is satisfied
+ */
+ mds_kbdc_tree_t *inner;
+
+ /**
+ * This is what should be done inside
+ * if the condition is not satisfied
+ */
+ mds_kbdc_tree_t *otherwise;
+
+ MDS_KBDC_TREE_PADDING(3);
} mds_kbdc_tree_if_t;
@@ -494,22 +479,20 @@ typedef struct mds_kbdc_tree_if
* Tree structure for assigning a value to a variable,
* possibly declaring the variable in the process
*/
-typedef struct mds_kbdc_tree_let
-{
- MDS_KBDC_TREE_COMMON;
-
- /**
- * The variable
- */
- char* variable;
-
- /**
- * The value to assign to the variable
- */
- mds_kbdc_tree_t* value;
-
- MDS_KBDC_TREE_PADDING(2);
-
+typedef struct mds_kbdc_tree_let {
+ MDS_KBDC_TREE_COMMON;
+
+ /**
+ * The variable
+ */
+ char *variable;
+
+ /**
+ * The value to assign to the variable
+ */
+ mds_kbdc_tree_t *value;
+
+ MDS_KBDC_TREE_PADDING(2);
} mds_kbdc_tree_let_t;
@@ -522,127 +505,115 @@ typedef struct mds_kbdc_tree_let
* in such case `sequence` should not be `NULL` but
* `sequence.next` and `result` should be `NULL`
*/
-typedef struct mds_kbdc_tree_map
-{
- MDS_KBDC_TREE_COMMON;
-
- /**
- * The input sequence
- */
- mds_kbdc_tree_t* sequence;
-
- /**
- * The output sequence
- */
- mds_kbdc_tree_t* result;
-
- /*
- * These are ordered so that `mds_kbdc_tree_t.macro_call.arguments`
- * and `mds_kbdc_tree_t.map.sequence` have the same address.
- */
-
- MDS_KBDC_TREE_PADDING(2);
-
+typedef struct mds_kbdc_tree_map {
+ MDS_KBDC_TREE_COMMON;
+
+ /**
+ * The input sequence
+ */
+ mds_kbdc_tree_t *sequence;
+
+ /**
+ * The output sequence
+ */
+ mds_kbdc_tree_t *result;
+
+ /*
+ * These are ordered so that `mds_kbdc_tree_t.macro_call.arguments`
+ * and `mds_kbdc_tree_t.map.sequence` have the same address.
+ */
+
+ MDS_KBDC_TREE_PADDING(2);
} mds_kbdc_tree_map_t;
/**
* Tree structure for an array of values
*/
-typedef struct mds_kbdc_tree_array
-{
- MDS_KBDC_TREE_COMMON;
-
- /**
- * The first value, `.elements.next`
- * is used to access the second value.
- */
- mds_kbdc_tree_t* elements;
-
- MDS_KBDC_TREE_PADDING(1);
-
+typedef struct mds_kbdc_tree_array {
+ MDS_KBDC_TREE_COMMON;
+
+ /**
+ * The first value, `.elements.next`
+ * is used to access the second value.
+ */
+ mds_kbdc_tree_t *elements;
+
+ MDS_KBDC_TREE_PADDING(1);
} mds_kbdc_tree_array_t;
/**
* Leaf structure for a key-combination
*/
-typedef struct mds_kbdc_tree_keys
-{
- MDS_KBDC_TREE_COMMON;
-
- /**
- * The key-combination
- */
- char* keys;
-
- MDS_KBDC_TREE_PADDING(1);
-
+typedef struct mds_kbdc_tree_keys {
+ MDS_KBDC_TREE_COMMON;
+
+ /**
+ * The key-combination
+ */
+ char *keys;
+
+ MDS_KBDC_TREE_PADDING(1);
} mds_kbdc_tree_keys_t;
/**
* Leaf structure for a string
*/
-typedef struct mds_kbdc_tree_string
-{
- MDS_KBDC_TREE_COMMON;
-
- /**
- * The string
- */
- char* string;
-
- /*
- * `evaluate_element` in "compile-layout.c" utilises
- * that `mds_kbdc_tree_string.string` has the same
- * offset as `mds_kbdc_tree_keys.keys`.
- */
-
- MDS_KBDC_TREE_PADDING(1);
-
+typedef struct mds_kbdc_tree_string {
+ MDS_KBDC_TREE_COMMON;
+
+ /**
+ * The string
+ */
+ char *string;
+
+ /*
+ * `evaluate_element` in "compile-layout.c" utilises
+ * that `mds_kbdc_tree_string.string` has the same
+ * offset as `mds_kbdc_tree_keys.keys`.
+ */
+
+ MDS_KBDC_TREE_PADDING(1);
} mds_kbdc_tree_string_t;
/**
* Leaf structure for a compiled key-combination
*/
-typedef struct mds_kbdc_tree_compiled_keys
-{
- MDS_KBDC_TREE_COMMON;
-
- /**
- * The key-combination
- *
- * Strictly terminated by -1
- */
- char32_t* keys;
-
- MDS_KBDC_TREE_PADDING(1);
-
+typedef struct mds_kbdc_tree_compiled_keys {
+ MDS_KBDC_TREE_COMMON;
+
+ /**
+ * The key-combination
+ *
+ * Strictly terminated by -1
+ */
+ char32_t *keys;
+
+ MDS_KBDC_TREE_PADDING(1);
} mds_kbdc_tree_compiled_keys_t;
/**
* Leaf structure for a compiled string
*/
-typedef struct mds_kbdc_tree_compiled_string
-{
- MDS_KBDC_TREE_COMMON;
-
- /**
- * The string
- */
- char32_t* string;
-
- /*
- * `evaluate_element` in "compile-layout.c" utilises
- * that `mds_kbdc_tree_string.compiled_string` has the
- * same offset as `mds_kbdc_tree_keys.compiled_keys`.
- */
-
- MDS_KBDC_TREE_PADDING(1);
-
+typedef struct mds_kbdc_tree_compiled_string {
+ MDS_KBDC_TREE_COMMON;
+
+ /**
+ * The string
+ */
+ char32_t *string;
+
+ /*
+ * `evaluate_element` in "compile-layout.c" utilises
+ * that `mds_kbdc_tree_string.compiled_string` has the
+ * same offset as `mds_kbdc_tree_keys.compiled_keys`.
+ */
+
+ MDS_KBDC_TREE_PADDING(1);
} mds_kbdc_tree_compiled_string_t;
@@ -652,11 +623,9 @@ typedef struct mds_kbdc_tree_compiled_string
* Other leaf structures without any content may `typedef`
* this structure
*/
-typedef struct mds_kbdc_tree_nothing
-{
- MDS_KBDC_TREE_COMMON;
- MDS_KBDC_TREE_PADDING(0);
-
+typedef struct mds_kbdc_tree_nothing {
+ MDS_KBDC_TREE_COMMON;
+ MDS_KBDC_TREE_PADDING(0);
} mds_kbdc_tree_nothing_t;
@@ -682,29 +651,27 @@ typedef struct mds_kbdc_tree_nesting mds_kbdc_tree_ordered_t;
/**
* Tree structure for a macro call
*/
-typedef struct mds_kbdc_tree_macro_call
-{
- MDS_KBDC_TREE_COMMON;
-
- /**
- * The first input argument for the
- * macro call, the second is accessed
- * using `.arguments.next`
- */
- mds_kbdc_tree_t* arguments;
-
- /**
- * The name of the macro
- */
- char* name;
-
- /*
- * These are ordered so that `mds_kbdc_tree_t.macro_call.arguments`
- * and `mds_kbdc_tree_t.map.sequence` have the same address.
- */
-
- MDS_KBDC_TREE_PADDING(2);
-
+typedef struct mds_kbdc_tree_macro_call {
+ MDS_KBDC_TREE_COMMON;
+
+ /**
+ * The first input argument for the
+ * macro call, the second is accessed
+ * using `.arguments.next`
+ */
+ mds_kbdc_tree_t *arguments;
+
+ /**
+ * The name of the macro
+ */
+ char *name;
+
+ /*
+ * These are ordered so that `mds_kbdc_tree_t.macro_call.arguments`
+ * and `mds_kbdc_tree_t.map.sequence` have the same address.
+ */
+
+ MDS_KBDC_TREE_PADDING(2);
} mds_kbdc_tree_macro_call_t;
@@ -728,45 +695,47 @@ typedef struct mds_kbdc_tree_nothing mds_kbdc_tree_continue_t;
/**
* Keyboard layout syntax tree
*/
-union mds_kbdc_tree
-{
+union mds_kbdc_tree {
+#if defined(__GNUC__)
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wpedantic" /* unnamed struct */
- struct
- {
- MDS_KBDC_TREE_COMMON;
- MDS_KBDC_TREE_PADDING(0);
- };
+#endif
+ struct {
+ MDS_KBDC_TREE_COMMON;
+ MDS_KBDC_TREE_PADDING(0);
+ };
+#if defined(__GNUC__)
# pragma GCC diagnostic pop
-
- mds_kbdc_tree_information_t information;
- mds_kbdc_tree_information_language_t language;
- mds_kbdc_tree_information_country_t country;
- mds_kbdc_tree_information_variant_t variant;
- mds_kbdc_tree_include_t include;
- mds_kbdc_tree_function_t function;
- mds_kbdc_tree_macro_t macro;
- mds_kbdc_tree_assumption_t assumption;
- mds_kbdc_tree_assumption_have_t have;
- mds_kbdc_tree_assumption_have_chars_t have_chars;
- mds_kbdc_tree_assumption_have_range_t have_range;
- mds_kbdc_tree_for_t for_;
- mds_kbdc_tree_if_t if_;
- mds_kbdc_tree_let_t let;
- mds_kbdc_tree_map_t map;
- mds_kbdc_tree_array_t array;
- mds_kbdc_tree_keys_t keys;
- mds_kbdc_tree_string_t string;
- mds_kbdc_tree_compiled_keys_t compiled_keys;
- mds_kbdc_tree_compiled_string_t compiled_string;
- mds_kbdc_tree_nothing_t nothing;
- mds_kbdc_tree_alternation_t alternation;
- mds_kbdc_tree_unordered_t unordered;
- mds_kbdc_tree_ordered_t ordered;
- mds_kbdc_tree_macro_call_t macro_call;
- mds_kbdc_tree_return_t return_;
- mds_kbdc_tree_break_t break_;
- mds_kbdc_tree_continue_t continue_;
+#endif
+
+ mds_kbdc_tree_information_t information;
+ mds_kbdc_tree_information_language_t language;
+ mds_kbdc_tree_information_country_t country;
+ mds_kbdc_tree_information_variant_t variant;
+ mds_kbdc_tree_include_t include;
+ mds_kbdc_tree_function_t function;
+ mds_kbdc_tree_macro_t macro;
+ mds_kbdc_tree_assumption_t assumption;
+ mds_kbdc_tree_assumption_have_t have;
+ mds_kbdc_tree_assumption_have_chars_t have_chars;
+ mds_kbdc_tree_assumption_have_range_t have_range;
+ mds_kbdc_tree_for_t for_;
+ mds_kbdc_tree_if_t if_;
+ mds_kbdc_tree_let_t let;
+ mds_kbdc_tree_map_t map;
+ mds_kbdc_tree_array_t array;
+ mds_kbdc_tree_keys_t keys;
+ mds_kbdc_tree_string_t string;
+ mds_kbdc_tree_compiled_keys_t compiled_keys;
+ mds_kbdc_tree_compiled_string_t compiled_string;
+ mds_kbdc_tree_nothing_t nothing;
+ mds_kbdc_tree_alternation_t alternation;
+ mds_kbdc_tree_unordered_t unordered;
+ mds_kbdc_tree_ordered_t ordered;
+ mds_kbdc_tree_macro_call_t macro_call;
+ mds_kbdc_tree_return_t return_;
+ mds_kbdc_tree_break_t break_;
+ mds_kbdc_tree_continue_t continue_;
};
@@ -777,7 +746,7 @@ union mds_kbdc_tree
* @param this The memory slot for the tree node
* @param type The type of the node
*/
-void mds_kbdc_tree_initialise(mds_kbdc_tree_t* restrict this, int type);
+void mds_kbdc_tree_initialise(mds_kbdc_tree_t *restrict this, int type);
/**
* Create a tree node
@@ -785,7 +754,7 @@ void mds_kbdc_tree_initialise(mds_kbdc_tree_t* restrict this, int type);
* @param type The type of the node
* @return The tree node, `NULL` on error
*/
-mds_kbdc_tree_t* mds_kbdc_tree_create(int type);
+mds_kbdc_tree_t *mds_kbdc_tree_create(int type);
/**
* Release all resources stored in a tree node,
@@ -794,7 +763,7 @@ mds_kbdc_tree_t* mds_kbdc_tree_create(int type);
*
* @param this The tree node
*/
-void mds_kbdc_tree_destroy_nonrecursive(mds_kbdc_tree_t* restrict this);
+void mds_kbdc_tree_destroy_nonrecursive(mds_kbdc_tree_t *restrict this);
/**
* Release all resources stored in a tree node,
@@ -804,7 +773,7 @@ void mds_kbdc_tree_destroy_nonrecursive(mds_kbdc_tree_t* restrict this);
*
* @param this The tree node
*/
-void mds_kbdc_tree_free_nonrecursive(mds_kbdc_tree_t* restrict this);
+void mds_kbdc_tree_free_nonrecursive(mds_kbdc_tree_t *restrict this);
/**
* Release all resources stored in a tree node
@@ -813,7 +782,7 @@ void mds_kbdc_tree_free_nonrecursive(mds_kbdc_tree_t* restrict this);
*
* @param this The tree node
*/
-void mds_kbdc_tree_destroy(mds_kbdc_tree_t* restrict this);
+void mds_kbdc_tree_destroy(mds_kbdc_tree_t *restrict this);
/**
* Release all resources stored in a tree node
@@ -822,7 +791,7 @@ void mds_kbdc_tree_destroy(mds_kbdc_tree_t* restrict this);
*
* @param this The tree node
*/
-void mds_kbdc_tree_free(mds_kbdc_tree_t* restrict this);
+void mds_kbdc_tree_free(mds_kbdc_tree_t *restrict this);
/**
@@ -832,7 +801,7 @@ void mds_kbdc_tree_free(mds_kbdc_tree_t* restrict this);
* @param this The tree node
* @return A duplicate of `this`, `NULL` on error
*/
-mds_kbdc_tree_t* mds_kbdc_tree_dup(const mds_kbdc_tree_t* restrict this);
+mds_kbdc_tree_t *mds_kbdc_tree_dup(const mds_kbdc_tree_t *restrict this);
/**
@@ -841,7 +810,7 @@ mds_kbdc_tree_t* mds_kbdc_tree_dup(const mds_kbdc_tree_t* restrict this);
* @param this The tree node
* @param output The output file
*/
-void mds_kbdc_tree_print(const mds_kbdc_tree_t* restrict this, FILE* output);
+void mds_kbdc_tree_print(const mds_kbdc_tree_t *restrict this, FILE *output);
@@ -850,4 +819,3 @@ void mds_kbdc_tree_print(const mds_kbdc_tree_t* restrict this, FILE* output);
#undef MDS_KBDC_TREE_COMMON
#endif
-