From dcffe24094683730e8206163ddeca40da8d170d4 Mon Sep 17 00:00:00 2001 From: Kevin Schlosser Date: Wed, 16 Aug 2023 14:24:37 -0600 Subject: [PATCH] fix: add guard macros to lv_style_gen.c,h and lv_obj_style_gen.c,h (#4450) --- scripts/style_api_gen.py | 30 ++++++++++++++++++++++++++++++ src/core/lv_obj_style_gen.c | 10 ++++++++++ src/core/lv_obj_style_gen.h | 15 +++++++++++++++ src/misc/lv_style_gen.c | 10 ++++++++++ src/misc/lv_style_gen.h | 14 ++++++++++++++ 5 files changed, 79 insertions(+) diff --git a/scripts/style_api_gen.py b/scripts/style_api_gen.py index 8f8fce77d..398ced0d6 100755 --- a/scripts/style_api_gen.py +++ b/scripts/style_api_gen.py @@ -502,34 +502,64 @@ def docs(p): base_dir = os.path.abspath(os.path.dirname(__file__)) sys.stdout = open(base_dir + '/../src/core/lv_obj_style_gen.h', 'w') + +HEADING = f''' +/* + ********************************************************************** + * DO NOT EDIT + * This file is automatically generated by "{os.path.split(__file__)[-1]}" + ********************************************************************** + */ + +''' + +print(HEADING) +print('#ifndef LV_OBJ_STYLE_GEN_H') +print('#define LV_OBJ_STYLE_GEN_H') +print() print("#include \"../misc/lv_area.h\"") print("#include \"../misc/lv_style.h\"") print("#include \"../core/lv_obj_style.h\"") +print() for p in props: obj_style_get(p) for p in props: local_style_set_h(p) +print() +print('#endif /* LV_OBJ_STYLE_GEN_H */') + sys.stdout = open(base_dir + '/../src/core/lv_obj_style_gen.c', 'w') +print(HEADING) print("#include \"lv_obj.h\"") +print() for p in props: local_style_set_c(p) sys.stdout = open(base_dir + '/../src/misc/lv_style_gen.c', 'w') +print(HEADING) print("#include \"lv_style.h\"") +print() for p in props: style_set_c(p) sys.stdout = open(base_dir + '/../src/misc/lv_style_gen.h', 'w') +print(HEADING) +print('#ifndef LV_STYLE_GEN_H') +print('#define LV_STYLE_GEN_H') +print() for p in props: style_set_h(p) for p in props: style_const_set(p) +print() +print('#endif /* LV_STYLE_GEN_H */') + sys.stdout = open(base_dir + '/../docs/overview/style-props.md', 'w') diff --git a/src/core/lv_obj_style_gen.c b/src/core/lv_obj_style_gen.c index be049a090..17e1e0c8f 100644 --- a/src/core/lv_obj_style_gen.c +++ b/src/core/lv_obj_style_gen.c @@ -1,5 +1,15 @@ + +/* + ********************************************************************** + * DO NOT EDIT + * This file is automatically generated by "style_api_gen.py" + ********************************************************************** + */ + + #include "lv_obj.h" + void lv_obj_set_style_width(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) { lv_style_value_t v = { diff --git a/src/core/lv_obj_style_gen.h b/src/core/lv_obj_style_gen.h index 121a87c0e..aeab1ff50 100644 --- a/src/core/lv_obj_style_gen.h +++ b/src/core/lv_obj_style_gen.h @@ -1,6 +1,19 @@ + +/* + ********************************************************************** + * DO NOT EDIT + * This file is automatically generated by "style_api_gen.py" + ********************************************************************** + */ + + +#ifndef LV_OBJ_STYLE_GEN_H +#define LV_OBJ_STYLE_GEN_H + #include "../misc/lv_area.h" #include "../misc/lv_style.h" #include "../core/lv_obj_style.h" + static inline lv_coord_t lv_obj_get_style_width(const struct _lv_obj_t * obj, uint32_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_WIDTH); @@ -695,3 +708,5 @@ void lv_obj_set_style_transition(struct _lv_obj_t * obj, const lv_style_transiti void lv_obj_set_style_blend_mode(struct _lv_obj_t * obj, lv_blend_mode_t value, lv_style_selector_t selector); void lv_obj_set_style_layout(struct _lv_obj_t * obj, uint16_t value, lv_style_selector_t selector); void lv_obj_set_style_base_dir(struct _lv_obj_t * obj, lv_base_dir_t value, lv_style_selector_t selector); + +#endif /* LV_OBJ_STYLE_GEN_H */ diff --git a/src/misc/lv_style_gen.c b/src/misc/lv_style_gen.c index 70adbaa9c..2a35ae360 100644 --- a/src/misc/lv_style_gen.c +++ b/src/misc/lv_style_gen.c @@ -1,5 +1,15 @@ + +/* + ********************************************************************** + * DO NOT EDIT + * This file is automatically generated by "style_api_gen.py" + ********************************************************************** + */ + + #include "lv_style.h" + void lv_style_set_width(lv_style_t * style, lv_coord_t value) { lv_style_value_t v = { diff --git a/src/misc/lv_style_gen.h b/src/misc/lv_style_gen.h index 7bc5c5701..19d711023 100644 --- a/src/misc/lv_style_gen.h +++ b/src/misc/lv_style_gen.h @@ -1,3 +1,15 @@ + +/* + ********************************************************************** + * DO NOT EDIT + * This file is automatically generated by "style_api_gen.py" + ********************************************************************** + */ + + +#ifndef LV_STYLE_GEN_H +#define LV_STYLE_GEN_H + void lv_style_set_width(lv_style_t * style, lv_coord_t value); extern const lv_style_prop_t _lv_style_const_prop_id_WIDTH; void lv_style_set_min_width(lv_style_t * style, lv_coord_t value); @@ -621,3 +633,5 @@ extern const lv_style_prop_t _lv_style_const_prop_id_BASE_DIR; { \ .prop_ptr = &_lv_style_const_prop_id_BASE_DIR, .value = { .num = (int32_t)val } \ } + +#endif /* LV_STYLE_GEN_H */