Merge pull request #13273 from s-hadinger/berry_fix_static

Berry and LVGL fixes
This commit is contained in:
s-hadinger 2021-10-04 19:30:20 +02:00 committed by GitHub
commit fe5bdea577
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 60 additions and 47 deletions

View File

@ -330,77 +330,77 @@ const be_ctypes_structure_t be_lv_meter_scale = {
}};
const be_ctypes_structure_t be_lv_meter_indicator = {
20, /* size in bytes */
16, /* size in bytes */
5, /* number of elements */
be_ctypes_instance_mappings,
(const be_ctypes_structure_item_t[5]) {
{ "end_value", 16, 0, 0, ctypes_i32, 0 },
{ "opa", 8, 0, 0, ctypes_u8, 0 },
{ "end_value", 12, 0, 0, ctypes_i32, 0 },
{ "opa", 5, 0, 0, ctypes_u8, 0 },
{ "scale", 0, 0, 0, ctypes_ptr32, 0 },
{ "start_value", 12, 0, 0, ctypes_i32, 0 },
{ "type", 4, 0, 0, ctypes_i32, 0 },
{ "start_value", 8, 0, 0, ctypes_i32, 0 },
{ "type", 4, 0, 0, ctypes_u8, 0 },
}};
const be_ctypes_structure_t be_lv_meter_indicator_needle_img = {
28, /* size in bytes */
24, /* size in bytes */
8, /* number of elements */
be_ctypes_instance_mappings,
(const be_ctypes_structure_item_t[8]) {
{ "end_value", 16, 0, 0, ctypes_i32, 0 },
{ "opa", 8, 0, 0, ctypes_u8, 0 },
{ "pivot_x", 24, 0, 0, ctypes_i16, 0 },
{ "pivot_y", 26, 0, 0, ctypes_i16, 0 },
{ "end_value", 12, 0, 0, ctypes_i32, 0 },
{ "opa", 5, 0, 0, ctypes_u8, 0 },
{ "pivot_x", 20, 0, 0, ctypes_i16, 0 },
{ "pivot_y", 22, 0, 0, ctypes_i16, 0 },
{ "scale", 0, 0, 0, ctypes_ptr32, 0 },
{ "src", 20, 0, 0, ctypes_ptr32, 0 },
{ "start_value", 12, 0, 0, ctypes_i32, 0 },
{ "type", 4, 0, 0, ctypes_i32, 0 },
{ "src", 16, 0, 0, ctypes_ptr32, 0 },
{ "start_value", 8, 0, 0, ctypes_i32, 0 },
{ "type", 4, 0, 0, ctypes_u8, 0 },
}};
const be_ctypes_structure_t be_lv_meter_indicator_needle_line = {
26, /* size in bytes */
22, /* size in bytes */
8, /* number of elements */
be_ctypes_instance_mappings,
(const be_ctypes_structure_item_t[8]) {
{ "color", 24, 0, 0, ctypes_u16, 1 },
{ "end_value", 16, 0, 0, ctypes_i32, 0 },
{ "opa", 8, 0, 0, ctypes_u8, 0 },
{ "r_mod", 22, 0, 0, ctypes_i16, 0 },
{ "color", 20, 0, 0, ctypes_u16, 1 },
{ "end_value", 12, 0, 0, ctypes_i32, 0 },
{ "opa", 5, 0, 0, ctypes_u8, 0 },
{ "r_mod", 18, 0, 0, ctypes_i16, 0 },
{ "scale", 0, 0, 0, ctypes_ptr32, 0 },
{ "start_value", 12, 0, 0, ctypes_i32, 0 },
{ "type", 4, 0, 0, ctypes_i32, 0 },
{ "width", 20, 0, 0, ctypes_u16, 0 },
{ "start_value", 8, 0, 0, ctypes_i32, 0 },
{ "type", 4, 0, 0, ctypes_u8, 0 },
{ "width", 16, 0, 0, ctypes_u16, 0 },
}};
const be_ctypes_structure_t be_lv_meter_indicator_arc = {
32, /* size in bytes */
28, /* size in bytes */
9, /* number of elements */
be_ctypes_instance_mappings,
(const be_ctypes_structure_item_t[9]) {
{ "color", 28, 0, 0, ctypes_u16, 1 },
{ "end_value", 16, 0, 0, ctypes_i32, 0 },
{ "opa", 8, 0, 0, ctypes_u8, 0 },
{ "r_mod", 30, 0, 0, ctypes_i16, 0 },
{ "color", 24, 0, 0, ctypes_u16, 1 },
{ "end_value", 12, 0, 0, ctypes_i32, 0 },
{ "opa", 5, 0, 0, ctypes_u8, 0 },
{ "r_mod", 26, 0, 0, ctypes_i16, 0 },
{ "scale", 0, 0, 0, ctypes_ptr32, 0 },
{ "src", 24, 0, 0, ctypes_ptr32, 0 },
{ "start_value", 12, 0, 0, ctypes_i32, 0 },
{ "type", 4, 0, 0, ctypes_i32, 0 },
{ "width", 20, 0, 0, ctypes_u16, 0 },
{ "src", 20, 0, 0, ctypes_ptr32, 0 },
{ "start_value", 8, 0, 0, ctypes_i32, 0 },
{ "type", 4, 0, 0, ctypes_u8, 0 },
{ "width", 16, 0, 0, ctypes_u16, 0 },
}};
const be_ctypes_structure_t be_lv_meter_indicator_scale_lines = {
27, /* size in bytes */
23, /* size in bytes */
9, /* number of elements */
be_ctypes_instance_mappings,
(const be_ctypes_structure_item_t[9]) {
{ "color_end", 24, 0, 0, ctypes_u16, 1 },
{ "color_start", 22, 0, 0, ctypes_u16, 1 },
{ "end_value", 16, 0, 0, ctypes_i32, 0 },
{ "local_grad", 26, 0, 1, ctypes_bf, 0 },
{ "opa", 8, 0, 0, ctypes_u8, 0 },
{ "color_end", 20, 0, 0, ctypes_u16, 1 },
{ "color_start", 18, 0, 0, ctypes_u16, 1 },
{ "end_value", 12, 0, 0, ctypes_i32, 0 },
{ "local_grad", 22, 0, 1, ctypes_bf, 0 },
{ "opa", 5, 0, 0, ctypes_u8, 0 },
{ "scale", 0, 0, 0, ctypes_ptr32, 0 },
{ "start_value", 12, 0, 0, ctypes_i32, 0 },
{ "type", 4, 0, 0, ctypes_i32, 0 },
{ "width_mod", 20, 0, 0, ctypes_i16, 0 },
{ "start_value", 8, 0, 0, ctypes_i32, 0 },
{ "type", 4, 0, 0, ctypes_u8, 0 },
{ "width_mod", 16, 0, 0, ctypes_i16, 0 },
}};
const be_ctypes_structure_t be_lv_obj_class = {

View File

@ -86,7 +86,7 @@ const lvbe_call_c_t lv_func[] = {
{ "refr_now", (void*) &lv_refr_now, "", "(lv_disp)" },
{ "scr_act", (void*) &lv_scr_act, "lv_obj", "" },
{ "scr_load", (void*) &lv_scr_load, "", "(lv_obj)" },
{ "scr_load_anim", (void*) &lv_scr_load_anim, "", "(lv_obj)(lv_scr_load_anim)iib" },
{ "scr_load_anim", (void*) &lv_scr_load_anim, "", "(lv_obj)iiib" },
{ "theme_apply", (void*) &lv_theme_apply, "", "(lv_obj)" },
{ "theme_get_color_primary", (void*) &lv_theme_get_color_primary, "lv_color", "(lv_obj)" },
{ "theme_get_color_secondary", (void*) &lv_theme_get_color_secondary, "lv_color", "(lv_obj)" },

View File

@ -58,12 +58,20 @@ static int m_attrlist(bvm *vm)
be_return(vm);
}
static void m_findmember_protected(bvm *vm, void* data)
{
be_getmember(vm, 1, (const char*) data);
}
static int m_findmember(bvm *vm)
{
int top = be_top(vm);
if (top >= 2 && (be_isinstance(vm, 1) || be_ismodule(vm, 1) || be_isclass(vm, 1)) && be_isstring(vm, 2)) {
be_getmember(vm, 1, be_tostring(vm, 2));
be_return(vm);
int ret = be_execprotected(vm, &m_findmember_protected, (void*) be_tostring(vm, 2));
if (ret == BE_OK) {
// be_getmember(vm, 1, be_tostring(vm, 2));
be_return(vm);
}
}
be_return_nil(vm);
}

View File

@ -30,6 +30,7 @@ const char* be_vtype2str(bvalue *v)
case BE_INSTANCE: return "instance";
case BE_MODULE: return "module";
case BE_INDEX: return "var";
case BE_COMPTR: return "ptr";
default: return "invalid type";
}
}

View File

@ -209,6 +209,7 @@ typedef const char* (*breader)(void*, size_t*);
#define var_ismap(_v) var_istype(_v, BE_MAP)
#define var_ismodule(_v) var_istype(_v, BE_MODULE)
#define var_isindex(_v) var_istype(_v, BE_INDEX)
#define var_iscomptr(_v) var_istype(_v, BE_COMPTR)
#define var_isnumber(_v) (var_isint(_v) || var_isreal(_v))
#define var_setnil(_v) var_settype(_v, BE_NIL)

View File

@ -1420,11 +1420,12 @@ static void classdef_stmt(bparser *parser, bclass *c)
static void class_inherit(bparser *parser, bexpdesc *e)
{
if (next_type(parser) == OptColon) { /* ':' */
bexpdesc ec = *e; /* work on a copy because we preserve original class */
bexpdesc e1;
scan_next_token(parser); /* skip ':' */
expr(parser, &e1);
check_var(parser, &e1);
be_code_setsuper(parser->finfo, e, &e1);
be_code_setsuper(parser->finfo, &ec, &e1);
}
}

View File

@ -77,7 +77,7 @@
res = var_tobool(a) op var_tobool(b); \
} else if (var_isstr(a)) { /* string op string */ \
res = 1 op be_eqstr(a->v.s, b->v.s); \
} else if (var_isclass(a) || var_isfunction(a)) { \
} else if (var_isclass(a) || var_isfunction(a) || var_iscomptr(a)) { \
res = var_toobj(a) op var_toobj(b); \
} else { \
binop_error(vm, #op, a, b); \

View File

@ -46,12 +46,13 @@ typedef struct {
int16_t rotation;
}lv_meter_scale_t;
typedef enum {
enum {
LV_METER_INDICATOR_TYPE_NEEDLE_IMG,
LV_METER_INDICATOR_TYPE_NEEDLE_LINE,
LV_METER_INDICATOR_TYPE_SCALE_LINES,
LV_METER_INDICATOR_TYPE_ARC,
}lv_meter_indicator_type_t;
};
typedef uint8_t lv_meter_indicator_type_t;
typedef struct {
lv_meter_scale_t * scale;

View File

@ -13,7 +13,7 @@ ctypes.print_types()
lv_style_int = ctypes.i16
lv_color = [ctypes.u16, "lv_color"] # cast to the class instance, constructor is called with 2 args: (nil, value)
lv_grad_dir = ctypes.u8
lv_meter_indicator_type_t = ctypes.i32 # probablu an anomaly that needs to be fixed
lv_meter_indicator_type_t = ctypes.u8
lv_opa = ctypes.u8
lv_blend_mode = ctypes.u8
lv_align = ctypes.u8

View File

@ -96,6 +96,7 @@ return_types = {
"lv_style_value_t": "i",
"lv_img_src_t": "i",
"lv_colorwheel_mode_t": "i",
"lv_scr_load_anim_t": "i",
"_lv_event_dsc_t *": "i",