From 121fa236a974b7b0115fab252456ea73ea943691 Mon Sep 17 00:00:00 2001 From: idea4good Date: Thu, 18 Aug 2022 16:30:44 +0800 Subject: [PATCH] 1. remove 'register' key word for C++ 17 2. support gcc for MCU --- GuiLite.h | 24 ++++++++++++------------ src/core/adapter/api_linux.cpp | 2 +- src/core/adapter/api_unknow.cpp | 2 +- src/core/display.h | 12 ++++++------ src/widgets/wave_ctrl.h | 8 ++++---- 5 files changed, 24 insertions(+), 24 deletions(-) diff --git a/GuiLite.h b/GuiLite.h index 80550e1..433b3e8 100644 --- a/GuiLite.h +++ b/GuiLite.h @@ -316,8 +316,8 @@ protected: } return; } - register int _width = m_width; - register int _height = m_height; + int _width = m_width; + int _height = m_height; int x, y; if (m_color_bytes == 2) { @@ -357,8 +357,8 @@ protected: { return -1; } - register int _width = m_width; - register int _height = m_height; + int _width = m_width; + int _height = m_height; left = (left >= _width) ? (_width - 1) : left; right = (right >= _width) ? (_width - 1) : right; top = (top >= _height) ? (_height - 1) : top; @@ -708,8 +708,8 @@ inline c_surface* c_display::alloc_surface(Z_ORDER_LEVEL max_zorder, c_rect laye } inline int c_display::swipe_surface(c_surface* s0, c_surface* s1, int x0, int x1, int y0, int y1, int offset) { - register int surface_width = s0->m_width; - register int surface_height = s0->m_height; + int surface_width = s0->m_width; + int surface_height = s0->m_height; if (offset < 0 || offset > surface_width || y0 < 0 || y0 >= surface_height || y1 < 0 || y1 >= surface_height || x0 < 0 || x0 >= surface_width || x1 < 0 || x1 >= surface_width) { @@ -3318,9 +3318,9 @@ protected: } c_rect rect; get_screen_rect(rect); - register int width = rect.width(); - register int top = rect.m_top; - register int left = rect.m_left; + int width = rect.width(); + int top = rect.m_top; + int left = rect.m_left; for (int y_pos = (m_wave_top - 1); y_pos <= (m_wave_bottom + 1); y_pos++) { (m_bg_fb) ? m_surface->draw_pixel(x, y_pos, m_bg_fb[(y_pos - top) * width + (x - left)], m_z_order) : m_surface->draw_pixel(x, y_pos, 0, m_z_order); @@ -3334,7 +3334,7 @@ protected: } c_rect rect; get_screen_rect(rect); - register unsigned int* p_des = m_bg_fb; + unsigned int* p_des = m_bg_fb; for (int y = rect.m_top; y <= rect.m_bottom; y++) { for (int x = rect.m_left; x <= rect.m_right; x++) @@ -3378,7 +3378,7 @@ c_lattice_font_op the_lattice_font_op = c_lattice_font_op(); c_font_operator* c_word::fontOperator = &the_lattice_font_op; #endif #ifdef GUILITE_ON -#if (defined __linux__) || (defined __APPLE__) +#if ((defined __linux__) && (!defined __none_os__)) || (defined __APPLE__) #include #include #include @@ -3728,7 +3728,7 @@ int c_fifo::write(void* buf, int len) #endif #endif #ifdef GUILITE_ON -#if (!defined _WIN32) && (!defined WIN32) && (!defined _WIN64) && (!defined WIN64) && (!defined __linux__) && (!defined __APPLE__) +#if (defined __none_os__) || ((!defined _WIN32) && (!defined WIN32) && (!defined _WIN64) && (!defined WIN64) && (!defined __linux__) && (!defined __APPLE__)) #include diff --git a/src/core/adapter/api_linux.cpp b/src/core/adapter/api_linux.cpp index aa993fa..6023041 100644 --- a/src/core/adapter/api_linux.cpp +++ b/src/core/adapter/api_linux.cpp @@ -1,5 +1,5 @@ #ifdef GUILITE_ON -#if (defined __linux__) || (defined __APPLE__) +#if ((defined __linux__) && (!defined __none_os__)) || (defined __APPLE__) #include "../../core/api.h" #include diff --git a/src/core/adapter/api_unknow.cpp b/src/core/adapter/api_unknow.cpp index feefc7b..e28a5df 100644 --- a/src/core/adapter/api_unknow.cpp +++ b/src/core/adapter/api_unknow.cpp @@ -1,5 +1,5 @@ #ifdef GUILITE_ON -#if (!defined _WIN32) && (!defined WIN32) && (!defined _WIN64) && (!defined WIN64) && (!defined __linux__) && (!defined __APPLE__) +#if (defined __none_os__) || ((!defined _WIN32) && (!defined WIN32) && (!defined _WIN64) && (!defined WIN64) && (!defined __linux__) && (!defined __APPLE__)) #include "../../core/api.h" #include diff --git a/src/core/display.h b/src/core/display.h index 54b8b2f..cb8444d 100644 --- a/src/core/display.h +++ b/src/core/display.h @@ -119,8 +119,8 @@ protected: return; } - register int _width = m_width; - register int _height = m_height; + int _width = m_width; + int _height = m_height; int x, y; if (m_color_bytes == 2) { @@ -162,8 +162,8 @@ protected: return -1; } - register int _width = m_width; - register int _height = m_height; + int _width = m_width; + int _height = m_height; left = (left >= _width) ? (_width - 1) : left; right = (right >= _width) ? (_width - 1) : right; @@ -555,8 +555,8 @@ inline c_surface* c_display::alloc_surface(Z_ORDER_LEVEL max_zorder, c_rect laye inline int c_display::swipe_surface(c_surface* s0, c_surface* s1, int x0, int x1, int y0, int y1, int offset) { - register int surface_width = s0->m_width; - register int surface_height = s0->m_height; + int surface_width = s0->m_width; + int surface_height = s0->m_height; if (offset < 0 || offset > surface_width || y0 < 0 || y0 >= surface_height || y1 < 0 || y1 >= surface_height || x0 < 0 || x0 >= surface_width || x1 < 0 || x1 >= surface_width) diff --git a/src/widgets/wave_ctrl.h b/src/widgets/wave_ctrl.h index 0fa0336..bc39438 100644 --- a/src/widgets/wave_ctrl.h +++ b/src/widgets/wave_ctrl.h @@ -218,9 +218,9 @@ protected: c_rect rect; get_screen_rect(rect); - register int width = rect.width(); - register int top = rect.m_top; - register int left = rect.m_left; + int width = rect.width(); + int top = rect.m_top; + int left = rect.m_left; for (int y_pos = (m_wave_top - 1); y_pos <= (m_wave_bottom + 1); y_pos++) { (m_bg_fb) ? m_surface->draw_pixel(x, y_pos, m_bg_fb[(y_pos - top) * width + (x - left)], m_z_order) : m_surface->draw_pixel(x, y_pos, 0, m_z_order); @@ -235,7 +235,7 @@ protected: c_rect rect; get_screen_rect(rect); - register unsigned int* p_des = m_bg_fb; + unsigned int* p_des = m_bg_fb; for (int y = rect.m_top; y <= rect.m_bottom; y++) { for (int x = rect.m_left; x <= rect.m_right; x++)