chore(xml): add guards around widget parsers (#8932)

This commit is contained in:
Gabor Kiss-Vamosi
2025-09-23 20:55:02 +02:00
committed by GitHub
parent 751e740289
commit 954121308b
39 changed files with 122 additions and 43 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
#include "../../lv_examples.h"
#if LV_BUILD_EXAMPLES && LV_USE_XML && LV_USE_TRANSLATION
#if LV_BUILD_EXAMPLES && LV_USE_XML && LV_USE_TRANSLATION && LV_FONT_MONTSERRAT_18
void lv_example_xml_2(void)
{
+3 -3
View File
@@ -556,7 +556,7 @@
/* Used to pick the correct GPU revision header it depends on the vendor */
#define LV_VG_LITE_HAL_GPU_REVISION 0x40
/* Base memory addres of the GPU IP it depends on SoC, default value is for NXP based devices */
/* Base memory address of the GPU IP it depends on SoC, default value is for NXP based devices */
#define LV_VG_LITE_HAL_GPU_BASE_ADDRESS 0x40240000
#endif
@@ -1064,7 +1064,7 @@
/** Get the applications idle percentage.
* - Requires `LV_USE_OS == LV_OS_PTHREAD` */
#define LV_SYSMON_GET_PROC_IDLE lv_os_get_proc_idle_percent
#endif
#endif
/** 1: Show CPU usage and FPS count.
* - Requires `LV_USE_SYSMON = 1` */
@@ -1204,7 +1204,7 @@
#if LV_USE_TEST
/** Enable `lv_test_screenshot_compare`.
* Requires libpng and a few MB of extra RAM. */
* Requires lodepng and a few MB of extra RAM. */
#define LV_USE_TEST_SCREENSHOT_COMPARE 0
#endif /*LV_USE_TEST*/
+3 -3
View File
@@ -1587,7 +1587,7 @@
#endif
#endif
/* Base memory addres of the GPU IP it depends on SoC, default value is for NXP based devices */
/* Base memory address of the GPU IP it depends on SoC, default value is for NXP based devices */
#ifndef LV_VG_LITE_HAL_GPU_BASE_ADDRESS
#ifdef CONFIG_LV_VG_LITE_HAL_GPU_BASE_ADDRESS
#define LV_VG_LITE_HAL_GPU_BASE_ADDRESS CONFIG_LV_VG_LITE_HAL_GPU_BASE_ADDRESS
@@ -3353,7 +3353,7 @@
#define LV_SYSMON_GET_PROC_IDLE lv_os_get_proc_idle_percent
#endif
#endif
#endif
#endif
/** 1: Show CPU usage and FPS count.
* - Requires `LV_USE_SYSMON = 1` */
@@ -3809,7 +3809,7 @@
#if LV_USE_TEST
/** Enable `lv_test_screenshot_compare`.
* Requires libpng and a few MB of extra RAM. */
* Requires lodepng and a few MB of extra RAM. */
#ifndef LV_USE_TEST_SCREENSHOT_COMPARE
#ifdef CONFIG_LV_USE_TEST_SCREENSHOT_COMPARE
#define LV_USE_TEST_SCREENSHOT_COMPARE CONFIG_LV_USE_TEST_SCREENSHOT_COMPARE
+75
View File
@@ -10,6 +10,14 @@
#include "lv_xml.h"
#if LV_USE_XML
#if LV_USE_OBJ_NAME == 0
#error "LV_USE_OBJ_NAME is required to use XMLs"
#endif
#if LV_USE_OBSERVER == 0
#error "LV_USE_OBSERVER is required to use XMLs"
#endif
#include "lv_xml.h"
#include "lv_xml_base_types.h"
#include "lv_xml_parser.h"
@@ -89,42 +97,109 @@ void lv_xml_init(void)
lv_xml_register_font(NULL, "lv_font_default", lv_font_get_default());
lv_xml_widget_register("lv_obj", lv_xml_obj_create, lv_xml_obj_apply);
#if LV_USE_BUTTON
lv_xml_widget_register("lv_button", lv_xml_button_create, lv_xml_button_apply);
#endif
#if LV_USE_LABEL
lv_xml_widget_register("lv_label", lv_xml_label_create, lv_xml_label_apply);
#endif
#if LV_USE_IMAGE
lv_xml_widget_register("lv_image", lv_xml_image_create, lv_xml_image_apply);
#endif
#if LV_USE_BAR
lv_xml_widget_register("lv_bar", lv_xml_bar_create, lv_xml_bar_apply);
#endif
#if LV_USE_SLIDER
lv_xml_widget_register("lv_slider", lv_xml_slider_create, lv_xml_slider_apply);
#endif
#if LV_USE_TABVIEW
lv_xml_widget_register("lv_tabview", lv_xml_tabview_create, lv_xml_tabview_apply);
lv_xml_widget_register("lv_tabview-tab_bar", lv_xml_tabview_tab_bar_create, lv_xml_tabview_tab_bar_apply);
lv_xml_widget_register("lv_tabview-tab", lv_xml_tabview_tab_create, lv_xml_tabview_tab_apply);
lv_xml_widget_register("lv_tabview-tab_button", lv_xml_tabview_tab_button_create, lv_xml_tabview_tab_button_apply);
#endif
#if LV_USE_CHART
lv_xml_widget_register("lv_chart", lv_xml_chart_create, lv_xml_chart_apply);
lv_xml_widget_register("lv_chart-cursor", lv_xml_chart_cursor_create, lv_xml_chart_cursor_apply);
lv_xml_widget_register("lv_chart-series", lv_xml_chart_series_create, lv_xml_chart_series_apply);
lv_xml_widget_register("lv_chart-axis", lv_xml_chart_axis_create, lv_xml_chart_axis_apply);
#endif
#if LV_USE_TABLE
lv_xml_widget_register("lv_table", lv_xml_table_create, lv_xml_table_apply);
lv_xml_widget_register("lv_table-column", lv_xml_table_column_create, lv_xml_table_column_apply);
lv_xml_widget_register("lv_table-cell", lv_xml_table_cell_create, lv_xml_table_cell_apply);
#endif
#if LV_USE_DROPDOWN
lv_xml_widget_register("lv_dropdown", lv_xml_dropdown_create, lv_xml_dropdown_apply);
lv_xml_widget_register("lv_dropdown-list", lv_xml_dropdown_list_create, lv_xml_dropdown_list_apply);
#endif
#if LV_USE_ROLLER
lv_xml_widget_register("lv_roller", lv_xml_roller_create, lv_xml_roller_apply);
#endif
#if LV_USE_SCALE
lv_xml_widget_register("lv_scale", lv_xml_scale_create, lv_xml_scale_apply);
lv_xml_widget_register("lv_scale-section", lv_xml_scale_section_create, lv_xml_scale_section_apply);
#endif
#if LV_USE_SPAN
lv_xml_widget_register("lv_spangroup", lv_xml_spangroup_create, lv_xml_spangroup_apply);
lv_xml_widget_register("lv_spangroup-span", lv_xml_spangroup_span_create, lv_xml_spangroup_span_apply);
#endif
#if LV_USE_BUTTONMATRIX
lv_xml_widget_register("lv_buttonmatrix", lv_xml_buttonmatrix_create, lv_xml_buttonmatrix_apply);
#endif
#if LV_USE_TEXTAREA
lv_xml_widget_register("lv_textarea", lv_xml_textarea_create, lv_xml_textarea_apply);
#endif
#if LV_USE_KEYBOARD
lv_xml_widget_register("lv_keyboard", lv_xml_keyboard_create, lv_xml_keyboard_apply);
#endif
#if LV_USE_ARC
lv_xml_widget_register("lv_arc", lv_xml_arc_create, lv_xml_arc_apply);
#endif
#if LV_USE_SWITCH
lv_xml_widget_register("lv_switch", lv_xml_switch_create, lv_xml_switch_apply);
#endif
#if LV_USE_CHECKBOX
lv_xml_widget_register("lv_checkbox", lv_xml_checkbox_create, lv_xml_checkbox_apply);
#endif
#if LV_USE_CANVAS
lv_xml_widget_register("lv_canvas", lv_xml_canvas_create, lv_xml_canvas_apply);
#endif
#if LV_USE_CALENDAR
lv_xml_widget_register("lv_calendar", lv_xml_calendar_create, lv_xml_calendar_apply);
#if LV_USE_CALENDAR_HEADER_ARROW
lv_xml_widget_register("lv_calendar-header_arrow", lv_xml_calendar_header_arrow_create,
lv_xml_calendar_header_arrow_apply);
#endif
#if LV_USE_CALENDAR_HEADER_DROPDOWN
lv_xml_widget_register("lv_calendar-header_dropdown", lv_xml_calendar_header_dropdown_create,
lv_xml_calendar_header_dropdown_apply);
#endif
#endif
#if LV_USE_QRCODE
lv_xml_widget_register("lv_qrcode", lv_xml_qrcode_create, lv_xml_qrcode_apply);
#endif
lv_xml_widget_register("lv_obj-style", lv_obj_xml_style_create, lv_obj_xml_style_apply);
lv_xml_widget_register("lv_obj-remove_style", lv_obj_xml_remove_style_create, lv_obj_xml_remove_style_apply);
+1 -1
View File
@@ -7,7 +7,7 @@
* INCLUDES
*********************/
#include "lv_xml_arc_parser.h"
#if LV_USE_XML
#if LV_USE_XML && LV_USE_ARC
#include "../../../lvgl.h"
#include "../../../lvgl_private.h"
+1 -1
View File
@@ -14,7 +14,7 @@ extern "C" {
* INCLUDES
*********************/
#include "../lv_xml.h"
#if LV_USE_XML
#if LV_USE_XML && LV_USE_ARC
/**********************
* TYPEDEFS
+1 -1
View File
@@ -7,7 +7,7 @@
* INCLUDES
*********************/
#include "lv_xml_bar_parser.h"
#if LV_USE_XML
#if LV_USE_XML && LV_USE_BAR
#include "../../../lvgl.h"
#include "../../../lvgl_private.h"
+1 -1
View File
@@ -14,7 +14,7 @@ extern "C" {
* INCLUDES
*********************/
#include "../lv_xml.h"
#if LV_USE_XML
#if LV_USE_XML && LV_USE_BAR
/**********************
* TYPEDEFS
@@ -8,7 +8,7 @@
*********************/
#include "lv_xml_button_parser.h"
#if LV_USE_XML
#if LV_USE_XML && LV_USE_BUTTON
#include "../../../lvgl.h"
#include "../../../lvgl_private.h"
@@ -14,7 +14,7 @@ extern "C" {
* INCLUDES
*********************/
#include "../lv_xml.h"
#if LV_USE_XML
#if LV_USE_XML && LV_USE_BUTTON
/**********************
* TYPEDEFS
@@ -7,7 +7,7 @@
* INCLUDES
*********************/
#include "lv_xml_buttonmatrix_parser.h"
#if LV_USE_XML
#if LV_USE_XML && LV_USE_BUTTONMATRIX
#include "../../../lvgl.h"
#include "../../../lvgl_private.h"
@@ -14,7 +14,7 @@ extern "C" {
* INCLUDES
*********************/
#include "../lv_xml.h"
#if LV_USE_XML
#if LV_USE_XML && LV_USE_BUTTONMATRIX
/**********************
* TYPEDEFS
@@ -7,7 +7,7 @@
* INCLUDES
*********************/
#include "lv_xml_calendar_parser.h"
#if LV_USE_XML
#if LV_USE_XML && LV_USE_CALENDAR
#include "../../../lvgl.h"
#include "../../../lvgl_private.h"
@@ -63,6 +63,7 @@ void lv_xml_calendar_apply(lv_xml_parser_state_t * state, const char ** attrs)
}
}
#if LV_USE_CALENDAR_HEADER_DROPDOWN
void * lv_xml_calendar_header_dropdown_create(lv_xml_parser_state_t * state, const char ** attrs)
{
LV_UNUSED(attrs);
@@ -74,7 +75,9 @@ void lv_xml_calendar_header_dropdown_apply(lv_xml_parser_state_t * state, const
{
lv_xml_obj_apply(state, attrs); /*Apply the common properties, e.g. width, height, styles flags etc*/
}
#endif
#if LV_USE_CALENDAR_HEADER_ARROW
void * lv_xml_calendar_header_arrow_create(lv_xml_parser_state_t * state, const char ** attrs)
{
LV_UNUSED(attrs);
@@ -87,6 +90,7 @@ void lv_xml_calendar_header_arrow_apply(lv_xml_parser_state_t * state, const cha
{
lv_xml_obj_apply(state, attrs); /*Apply the common properties, e.g. width, height, styles flags etc*/
}
#endif
/**********************
+1 -1
View File
@@ -7,7 +7,7 @@
* INCLUDES
*********************/
#include "lv_xml_chart_parser.h"
#if LV_USE_XML
#if LV_USE_XML && LV_USE_CHART
#include "../../../lvgl.h"
#include "../../../lvgl_private.h"
+1 -1
View File
@@ -14,7 +14,7 @@ extern "C" {
* INCLUDES
*********************/
#include "../lv_xml.h"
#if LV_USE_XML
#if LV_USE_XML && LV_USE_CHART
/**********************
* TYPEDEFS
@@ -7,7 +7,7 @@
* INCLUDES
*********************/
#include "lv_xml_dropdown_parser.h"
#if LV_USE_XML
#if LV_USE_XML && LV_USE_DROPDOWN
#include "../../../lvgl.h"
#include "../../../lvgl_private.h"
@@ -14,7 +14,7 @@ extern "C" {
* INCLUDES
*********************/
#include "../lv_xml.h"
#if LV_USE_XML
#if LV_USE_XML && LV_USE_DROPDOWN
/**********************
* TYPEDEFS
+1 -1
View File
@@ -7,7 +7,7 @@
* INCLUDES
*********************/
#include "lv_xml_image_parser.h"
#if LV_USE_XML
#if LV_USE_XML && LV_USE_IMAGE
#include "../../../lvgl.h"
#include "../../../lvgl_private.h"
+2 -2
View File
@@ -14,7 +14,7 @@ extern "C" {
* INCLUDES
*********************/
#include "../lv_xml.h"
#if LV_USE_XML
#if LV_USE_XML && LV_USE_IMAGE
/**********************
* TYPEDEFS
@@ -40,4 +40,4 @@ void lv_xml_check_file(const char * filepath);
} /*extern "C"*/
#endif
#endif /*LV_XML_IMAGE_PARSER_H*/
#endif /*LV_XML_IMAGE_PARSER_H*/
@@ -7,7 +7,7 @@
* INCLUDES
*********************/
#include "lv_xml_keyboard_parser.h"
#if LV_USE_XML
#if LV_USE_XML && LV_USE_KEYBOARD
#include "../../../lvgl.h"
#include "../../../lvgl_private.h"
@@ -14,7 +14,7 @@ extern "C" {
* INCLUDES
*********************/
#include "../lv_xml.h"
#if LV_USE_XML
#if LV_USE_XML && LV_USE_KEYBOARD
/**********************
* TYPEDEFS
+1 -1
View File
@@ -7,7 +7,7 @@
* INCLUDES
*********************/
#include "lv_xml_label_parser.h"
#if LV_USE_XML
#if LV_USE_XML && LV_USE_LABEL
#include "../../../lvgl.h"
#include "../../../lvgl_private.h"
+1 -1
View File
@@ -14,7 +14,7 @@ extern "C" {
* INCLUDES
*********************/
#include "../lv_xml.h"
#if LV_USE_XML
#if LV_USE_XML && LV_USE_LABEL
/**********************
* TYPEDEFS
@@ -7,7 +7,7 @@
* INCLUDES
*********************/
#include "lv_xml_qrcode_parser.h"
#if LV_USE_XML
#if LV_USE_XML && LV_USE_QRCODE
#include "../../../lvgl.h"
#include "../../../lvgl_private.h"
@@ -14,7 +14,7 @@ extern "C" {
* INCLUDES
*********************/
#include "../lv_xml.h"
#if LV_USE_XML
#if LV_USE_XML && LV_USE_QRCODE
/**********************
* TYPEDEFS
@@ -7,7 +7,7 @@
* INCLUDES
*********************/
#include "lv_xml_roller_parser.h"
#if LV_USE_XML
#if LV_USE_XML && LV_USE_ROLLER
#include "../../../lvgl.h"
#include "../../../lvgl_private.h"
@@ -14,7 +14,7 @@ extern "C" {
* INCLUDES
*********************/
#include "../lv_xml.h"
#if LV_USE_XML
#if LV_USE_XML && LV_USE_ROLLER
/**********************
* TYPEDEFS
+1 -1
View File
@@ -7,7 +7,7 @@
* INCLUDES
*********************/
#include "lv_xml_scale_parser.h"
#if LV_USE_XML
#if LV_USE_XML && LV_USE_SCALE
#include "../../../lvgl.h"
#include "../../../lvgl_private.h"
+1 -1
View File
@@ -14,7 +14,7 @@ extern "C" {
* INCLUDES
*********************/
#include "../lv_xml.h"
#if LV_USE_XML
#if LV_USE_XML && LV_USE_SCALE
/**********************
* TYPEDEFS
@@ -7,7 +7,7 @@
* INCLUDES
*********************/
#include "lv_xml_slider_parser.h"
#if LV_USE_XML
#if LV_USE_XML && LV_USE_SLIDER
#include "../../../lvgl.h"
#include "../../../lvgl_private.h"
@@ -14,7 +14,7 @@ extern "C" {
* INCLUDES
*********************/
#include "../lv_xml.h"
#if LV_USE_XML
#if LV_USE_XML && LV_USE_SLIDER
/**********************
* TYPEDEFS
@@ -7,7 +7,7 @@
* INCLUDES
*********************/
#include "lv_xml_spangroup_parser.h"
#if LV_USE_XML
#if LV_USE_XML && LV_USE_SPAN
#include "../../../lvgl.h"
#include "../../../lvgl_private.h"
@@ -14,7 +14,7 @@ extern "C" {
* INCLUDES
*********************/
#include "../lv_xml.h"
#if LV_USE_XML
#if LV_USE_XML && LV_USE_SPAN
/**********************
* TYPEDEFS
+1 -1
View File
@@ -7,7 +7,7 @@
* INCLUDES
*********************/
#include "lv_xml_table_parser.h"
#if LV_USE_XML
#if LV_USE_XML && LV_USE_TABLE
#include "../../../lvgl.h"
#include "../../../lvgl_private.h"
+1 -1
View File
@@ -14,7 +14,7 @@ extern "C" {
* INCLUDES
*********************/
#include "../lv_xml.h"
#if LV_USE_XML
#if LV_USE_XML && LV_USE_TABLE
/**********************
* TYPEDEFS
@@ -7,7 +7,7 @@
* INCLUDES
*********************/
#include "lv_xml_tabview_parser.h"
#if LV_USE_XML
#if LV_USE_XML && LV_USE_TABVIEW
#include "../../../lvgl.h"
#include "../../../lvgl_private.h"
@@ -14,7 +14,7 @@ extern "C" {
* INCLUDES
*********************/
#include "../lv_xml.h"
#if LV_USE_XML
#if LV_USE_XML && LV_USE_TABVIEW
/**********************
* TYPEDEFS
@@ -7,7 +7,7 @@
* INCLUDES
*********************/
#include "lv_xml_textarea_parser.h"
#if LV_USE_XML
#if LV_USE_XML && LV_USE_TEXTAREA
#include "../../../lvgl.h"
#include "../../../lvgl_private.h"
@@ -14,7 +14,7 @@ extern "C" {
* INCLUDES
*********************/
#include "../lv_xml.h"
#if LV_USE_XML
#if LV_USE_XML && LV_USE_TEXTAREA
/**********************
* TYPEDEFS