From bc7a5194701f32f9edd99df2a41eb4ce382d52e7 Mon Sep 17 00:00:00 2001 From: "ALI Mohammadiyeh (Max Base)" Date: Sat, 28 Dec 2024 16:11:53 +0100 Subject: [PATCH] Adding #ifndef #define #endif --- src/ast_layout.c | 61 +++---------------- src/generated-config/ast_block_type.h | 2 + .../ast_layout_attribute_style_global.h | 2 + .../ast_layout_attribute_style_state_type.h | 2 + .../ast_layout_attribute_style_type.h | 2 + .../ast_layout_attribute_style_value.h | 2 + .../ast_layout_attribute_style_value_extern.h | 2 + .../ast_layout_attribute_type.h | 2 + .../ast_layout_attribute_value.h | 2 + .../ast_layout_attribute_value_extern.h | 2 + src/generated-config/ast_layout_type.h | 2 + .../ast_layout_type_attributes.h | 2 + .../ast_layout_type_attributes_all.h | 5 ++ .../ast_layout_type_attributes_values.h | 19 ++---- src/generated-config/ast_type.h | 2 + 15 files changed, 40 insertions(+), 69 deletions(-) diff --git a/src/ast_layout.c b/src/ast_layout.c index d7b566d5..e7d1b6a8 100644 --- a/src/ast_layout.c +++ b/src/ast_layout.c @@ -580,16 +580,14 @@ ast_layout_attribute_type_t name_to_ast_layout_attribute_type(char *name) { GENERATED_NAME, FILTER, ALLOWED_VALUES, \ SUBTAGS) \ else if (strcmp(name, NAME_LOWER) == 0) { \ - type = TYPE; \ - return type; \ + return TYPE; \ } #define ADD_LAYOUT_ATTRIBUTE_TYPE_REPEAT(TYPE, NAME, NAME_LOWER, ENDUSER_NAME, \ GENERATED_NAME, FILTER, \ ALLOWED_VALUES, SUBTAGS) \ else if (strcmp(name, NAME_LOWER) == 0) { \ - type = TYPE; \ - return type; \ + return TYPE; \ } #include "generated-config/ast_layout_attribute_type.h" @@ -601,15 +599,13 @@ ast_layout_attribute_type_t name_to_ast_layout_attribute_type(char *name) { GENERATED_NAME, FILTER, \ ALLOWED_VALUES, SUBTAGS) \ else if (strcmp(name, NAME_LOWER) == 0) { \ - type = TYPE; \ - return type; \ + return TYPE; \ } #define ADD_LAYOUT_ATTRIBUTE_STYLE_TYPE_HIDE(TYPE, NAME, NAME_LOWER, \ ENDUSER_NAME, GENERATED_NAME, \ FILTER, ALLOWED_VALUES, SUBTAGS) \ else if (strcmp(name, NAME_LOWER) == 0) { \ - type = TYPE; \ - return type; \ + return TYPE; \ } #include "generated-config/ast_layout_attribute_style_type.h" @@ -619,13 +615,11 @@ ast_layout_attribute_type_t name_to_ast_layout_attribute_type(char *name) { ast_layout_attribute_type_t ast_layout_attribute_enduser_name_in_node_to_type(char *name, ast_layout_node_type_t parent_node_type) { - if (false) {} - for (int i = 0; i < map_size; i++) { if (layout_map[i].type == parent_node_type) { for (int j = 0 ; j < layout_map[i].count_allowed_arguments; j++) { ast_layout_attribute_type_t argument_type = layout_map[i].allowed_arguments[j]; - char *enduser_name = (argument_type); + char *enduser_name = ast_layout_node_type_to_enduser_name(argument_type); if (strcmp(name, enduser_name) == 0) { return argument_type; @@ -633,29 +627,6 @@ ast_layout_attribute_type_t ast_layout_attribute_enduser_name_in_node_to_type(ch } } } - - - #define ADD_LAYOUT_ATTRIBUTE_TYPE_REPEAT(TYPE, NAME, NAME_LOWER, ENDUSER_NAME, \ - GENERATED_NAME, FILTER, \ - ALLOWED_VALUES, SUBTAGS) - - #include "generated-config/ast_layout_attribute_type.h" - - #undef ADD_LAYOUT_ATTRIBUTE_STYLE_TYPE - #undef ADD_LAYOUT_ATTRIBUTE_STYLE_TYPE_REPEAT - - #define ADD_LAYOUT_ATTRIBUTE_STYLE_TYPE(TYPE, NAME, NAME_LOWER, ENDUSER_NAME, \ - GENERATED_NAME, FILTER, ALLOWED_VALUES, \ - SUBTAGS) \ - else if (TYPE == type) { \ - return ENDUSER_NAME; \ - } - - #define ADD_LAYOUT_ATTRIBUTE_STYLE_TYPE_REPEAT(TYPE, NAME, NAME_LOWER, ENDUSER_NAME, \ - GENERATED_NAME, FILTER, \ - ALLOWED_VALUES, SUBTAGS) - - #include "generated-config/ast_layout_attribute_style_type.h" return AST_LAYOUT_ATTRIBUTE_TYPE_ERROR; } @@ -676,26 +647,8 @@ ast_layout_attribute_type_t enduser_name_to_ast_layout_attribute_type_in_node( ast_layout_attribute_type_t type = ast_layout_attribute_enduser_name_in_node_to_type(name, parent_node_type); if (type == AST_LAYOUT_ATTRIBUTE_TYPE_ERROR ) { - // #undef ADD_LAYOUT_ATTRIBUTE_TYPE - // #undef ADD_LAYOUT_ATTRIBUTE_TYPE_REPEAT - - // #define ADD_LAYOUT_ATTRIBUTE_TYPE(TYPE, NAME, NAME_LOWER, ENDUSER_NAME, \ - // GENERATED_NAME, FILTER, ALLOWED_VALUES, \ - // SUBTAGS) \ - // if (strcmp(name, ENDUSER_NAME) == 0) { \ - // type = TYPE; \ - // count++; \ - // } - - // #define ADD_LAYOUT_ATTRIBUTE_TYPE_REPEAT(TYPE, NAME, NAME_LOWER, ENDUSER_NAME, \ - // GENERATED_NAME, FILTER, \ - // ALLOWED_VALUES, SUBTAGS) \ - // if (strcmp(name, ENDUSER_NAME) == 0) { \ - // type = TYPE; \ - // count++; \ - // } - - // #include "generated-config/ast_layout_attribute_type.h" + + if (false) {} #undef ADD_LAYOUT_ATTRIBUTE_STYLE_TYPE #undef ADD_LAYOUT_ATTRIBUTE_STYLE_TYPE_REPEAT diff --git a/src/generated-config/ast_block_type.h b/src/generated-config/ast_block_type.h index 6ce0aa33..4f581306 100644 --- a/src/generated-config/ast_block_type.h +++ b/src/generated-config/ast_block_type.h @@ -26,3 +26,5 @@ ADD_BLOCK_TYPE(AST_BLOCK_TYPE_ERROR, "ERROR", "error") + + diff --git a/src/generated-config/ast_layout_attribute_style_global.h b/src/generated-config/ast_layout_attribute_style_global.h index d04ff08f..2cec78f2 100644 --- a/src/generated-config/ast_layout_attribute_style_global.h +++ b/src/generated-config/ast_layout_attribute_style_global.h @@ -25,3 +25,5 @@ ADD_LAYOUT_ATTRIBUTE_STYLE_GLOBAL_VALUE(unset, "حذف شده") + + diff --git a/src/generated-config/ast_layout_attribute_style_state_type.h b/src/generated-config/ast_layout_attribute_style_state_type.h index 9037f47d..5ab43cc6 100644 --- a/src/generated-config/ast_layout_attribute_style_state_type.h +++ b/src/generated-config/ast_layout_attribute_style_state_type.h @@ -85,3 +85,5 @@ ADD_LAYOUT_ATTRIBUTE_STYLE_STATE_TYPE(AST_LAYOUT_ATTRIBUTE_STYLE_STATE_TYPE_EMPT + + diff --git a/src/generated-config/ast_layout_attribute_style_type.h b/src/generated-config/ast_layout_attribute_style_type.h index bcbf717e..b733ea21 100644 --- a/src/generated-config/ast_layout_attribute_style_type.h +++ b/src/generated-config/ast_layout_attribute_style_type.h @@ -584,3 +584,5 @@ ADD_LAYOUT_ATTRIBUTE_STYLE_TYPE_HIDE(AST_LAYOUT_ATTRIBUTE_STYLE_TYPE_ERROR, "ERR + + diff --git a/src/generated-config/ast_layout_attribute_style_value.h b/src/generated-config/ast_layout_attribute_style_value.h index 5efc173e..08d90730 100644 --- a/src/generated-config/ast_layout_attribute_style_value.h +++ b/src/generated-config/ast_layout_attribute_style_value.h @@ -1488,3 +1488,5 @@ const ast_layout_attribute_pair_t ast_layout_allowed_style_list_zoom[] = { + + diff --git a/src/generated-config/ast_layout_attribute_style_value_extern.h b/src/generated-config/ast_layout_attribute_style_value_extern.h index e08ece2f..69aea3ce 100644 --- a/src/generated-config/ast_layout_attribute_style_value_extern.h +++ b/src/generated-config/ast_layout_attribute_style_value_extern.h @@ -375,3 +375,5 @@ extern const ast_layout_attribute_pair_t ast_layout_allowed_style_list_zoom[]; + + diff --git a/src/generated-config/ast_layout_attribute_type.h b/src/generated-config/ast_layout_attribute_type.h index bf2c1a34..e0580dc3 100644 --- a/src/generated-config/ast_layout_attribute_type.h +++ b/src/generated-config/ast_layout_attribute_type.h @@ -85,3 +85,5 @@ ADD_LAYOUT_ATTRIBUTE_TYPE(AST_LAYOUT_ATTRIBUTE_TYPE_RESPONSIVE_MIN_HEIGHT, "RESP + + diff --git a/src/generated-config/ast_layout_attribute_value.h b/src/generated-config/ast_layout_attribute_value.h index 56523b4b..312830ef 100644 --- a/src/generated-config/ast_layout_attribute_value.h +++ b/src/generated-config/ast_layout_attribute_value.h @@ -55,3 +55,5 @@ const ast_layout_attribute_pair_t ast_layout_allowed_lang[] = { + + diff --git a/src/generated-config/ast_layout_attribute_value_extern.h b/src/generated-config/ast_layout_attribute_value_extern.h index a218f1b7..2ab7bfde 100644 --- a/src/generated-config/ast_layout_attribute_value_extern.h +++ b/src/generated-config/ast_layout_attribute_value_extern.h @@ -30,3 +30,5 @@ extern const ast_layout_attribute_pair_t ast_layout_allowed_lang[]; + + diff --git a/src/generated-config/ast_layout_type.h b/src/generated-config/ast_layout_type.h index 22c3645f..dab53bf8 100644 --- a/src/generated-config/ast_layout_type.h +++ b/src/generated-config/ast_layout_type.h @@ -143,3 +143,5 @@ ADD_LAYOUT_TYPE_REPEAT(AST_LAYOUT_TYPE_MEDIA, "MEDIA", "media", "@media", "وا + + diff --git a/src/generated-config/ast_layout_type_attributes.h b/src/generated-config/ast_layout_type_attributes.h index 54f19c9f..e8556216 100644 --- a/src/generated-config/ast_layout_type_attributes.h +++ b/src/generated-config/ast_layout_type_attributes.h @@ -153,3 +153,5 @@ else if (attribute->parent_node_type == AST_LAYOUT_TYPE_MEDIA) { + + diff --git a/src/generated-config/ast_layout_type_attributes_all.h b/src/generated-config/ast_layout_type_attributes_all.h index eb9d0f33..5196a029 100644 --- a/src/generated-config/ast_layout_type_attributes_all.h +++ b/src/generated-config/ast_layout_type_attributes_all.h @@ -1,3 +1,6 @@ +#ifndef _AST_LAYOUT_TYPE_ATTRIBUTES_ALL_H_ +#define _AST_LAYOUT_TYPE_ATTRIBUTES_ALL_H_ + layout_map_entry_t layout_map[] = { // ----------- BEGIN AUTO GENERATED ----------- // { AST_LAYOUT_TYPE_INCLUDE, valid_attributes_include, valid_attributes_include_length }, @@ -114,3 +117,5 @@ layout_map_entry_t layout_map[] = { }; const size_t map_size = sizeof(layout_map) / sizeof(layout_map[0]); + +#endif diff --git a/src/generated-config/ast_layout_type_attributes_values.h b/src/generated-config/ast_layout_type_attributes_values.h index 695c8928..b00bc12e 100644 --- a/src/generated-config/ast_layout_type_attributes_values.h +++ b/src/generated-config/ast_layout_type_attributes_values.h @@ -1,3 +1,6 @@ +#ifndef _AST_LAYOUT_TYPE_ATTRIBUTES_VALUES_H_ +#define _AST_LAYOUT_TYPE_ATTRIBUTES_VALUES_H_ + // ----------- BEGIN AUTO GENERATED ----------- // ast_layout_attribute_type_t valid_attributes_include[] = { AST_LAYOUT_ATTRIBUTE_TYPE_SRC, @@ -204,18 +207,4 @@ const size_t valid_attributes_media_length = 0; // ----------- END AUTO GENERATED ----------- // - - - - - - - - - - - - - - - +#endif diff --git a/src/generated-config/ast_type.h b/src/generated-config/ast_type.h index e1b832ae..eb82222d 100644 --- a/src/generated-config/ast_type.h +++ b/src/generated-config/ast_type.h @@ -34,3 +34,5 @@ ADD_TYPE(AST_TYPE_ERROR, "ERROR", "error") + +