Skip to content

Commit f3e554b

Browse files
committed
Makes a change to the code generator that should reduce the binary size and possibly RAM use as well.
1 parent f6cfdf9 commit f3e554b

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

gen/python_api_gen_mpy.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1322,7 +1322,7 @@ def register_int_ptr_type(convertor, *types):
13221322
static const mp_lv_obj_type_t mp_lv_{base_obj}_type;
13231323
static const mp_lv_obj_type_t *mp_lv_obj_types[];
13241324
1325-
static inline const mp_obj_type_t *get_BaseObj_type()
1325+
static const mp_obj_type_t *get_BaseObj_type()
13261326
{{
13271327
return mp_lv_{base_obj}_type.mp_obj_type;
13281328
}}
@@ -1482,7 +1482,7 @@ def register_int_ptr_type(convertor, *types):
14821482
LV_OBJ_T *callbacks;
14831483
} mp_lv_obj_t;
14841484
1485-
static inline LV_OBJ_T *mp_to_lv(mp_obj_t mp_obj)
1485+
static LV_OBJ_T *mp_to_lv(mp_obj_t mp_obj)
14861486
{
14871487
if (mp_obj == NULL || mp_obj == mp_const_none) return NULL;
14881488
mp_obj_t native_obj = get_native_obj(mp_obj);
@@ -1497,7 +1497,7 @@ def register_int_ptr_type(convertor, *types):
14971497
return mp_lv_obj->lv_obj;
14981498
}
14991499
1500-
static inline LV_OBJ_T *mp_get_callbacks(mp_obj_t mp_obj)
1500+
static LV_OBJ_T *mp_get_callbacks(mp_obj_t mp_obj)
15011501
{
15021502
if (mp_obj == NULL || mp_obj == mp_const_none) return NULL;
15031503
mp_lv_obj_t *mp_lv_obj = MP_OBJ_TO_PTR(get_native_obj(mp_obj));
@@ -1509,7 +1509,7 @@ def register_int_ptr_type(convertor, *types):
15091509
return mp_lv_obj->callbacks;
15101510
}
15111511
1512-
static inline const mp_obj_type_t *get_BaseObj_type();
1512+
static const mp_obj_type_t *get_BaseObj_type();
15131513
15141514
static void mp_lv_delete_cb(lv_event_t * e)
15151515
{
@@ -1522,7 +1522,7 @@ def register_int_ptr_type(convertor, *types):
15221522
}
15231523
}
15241524
1525-
static inline mp_obj_t lv_to_mp(LV_OBJ_T *lv_obj)
1525+
static mp_obj_t lv_to_mp(LV_OBJ_T *lv_obj)
15261526
{
15271527
if (lv_obj == NULL) return mp_const_none;
15281528
mp_lv_obj_t *self = (mp_lv_obj_t*)lv_obj->user_data;
@@ -1652,17 +1652,17 @@ def register_int_ptr_type(convertor, *types):
16521652
16531653
#endif
16541654
1655-
static inline mp_obj_t convert_to_bool(bool b)
1655+
static mp_obj_t convert_to_bool(bool b)
16561656
{
16571657
return b? mp_const_true: mp_const_false;
16581658
}
16591659
1660-
static inline mp_obj_t convert_to_str(const char *str)
1660+
static mp_obj_t convert_to_str(const char *str)
16611661
{
16621662
return str? mp_obj_new_str(str, strlen(str)): mp_const_none;
16631663
}
16641664
1665-
static inline const char *convert_from_str(mp_obj_t str)
1665+
static const char *convert_from_str(mp_obj_t str)
16661666
{
16671667
if (str == NULL || str == mp_const_none)
16681668
return NULL;
@@ -1691,7 +1691,7 @@ def register_int_ptr_type(convertor, *types):
16911691
return mp_lv_struct;
16921692
}
16931693
1694-
static inline size_t get_lv_struct_size(const mp_obj_type_t *type)
1694+
static size_t get_lv_struct_size(const mp_obj_type_t *type)
16951695
{
16961696
mp_obj_dict_t *self = MP_OBJ_TO_PTR(MP_OBJ_TYPE_GET_SLOT(type, locals_dict));
16971697
mp_map_elem_t *elem = mp_map_lookup(&self->map, MP_OBJ_NEW_QSTR(MP_QSTR___SIZE__), MP_MAP_LOOKUP);
@@ -1944,7 +1944,7 @@ def register_int_ptr_type(convertor, *types):
19441944
19451945
static const mp_lv_struct_t mp_lv_null_obj = { {&mp_blob_type}, NULL };
19461946
1947-
static inline mp_obj_t ptr_to_mp(void *data)
1947+
static mp_obj_t ptr_to_mp(void *data)
19481948
{
19491949
return lv_to_mp_struct(&mp_blob_type, data);
19501950
}
@@ -1965,7 +1965,7 @@ def register_int_ptr_type(convertor, *types):
19651965
19661966
// Cast instance. Can be used in ISR when memory allocation is prohibited
19671967
1968-
static inline mp_obj_t mp_lv_cast_instance(mp_obj_t self_in, mp_obj_t ptr_obj)
1968+
static mp_obj_t mp_lv_cast_instance(mp_obj_t self_in, mp_obj_t ptr_obj)
19691969
{
19701970
mp_lv_struct_t *self = MP_OBJ_TO_PTR(self_in);
19711971
self->data = mp_to_ptr(ptr_obj);
@@ -2534,15 +2534,15 @@ def try_generate_struct(struct_name, struct):
25342534
25352535
static const mp_obj_type_t mp_{sanitized_struct_name}_type;
25362536
2537-
static inline void* mp_write_ptr_{sanitized_struct_name}(mp_obj_t self_in)
2537+
static void* mp_write_ptr_{sanitized_struct_name}(mp_obj_t self_in)
25382538
{{
25392539
mp_lv_struct_t *self = MP_OBJ_TO_PTR(cast(self_in, &mp_{sanitized_struct_name}_type));
25402540
return ({struct_tag}{struct_name}*)self->data;
25412541
}}
25422542
25432543
#define mp_write_{sanitized_struct_name}(struct_obj) *(({struct_tag}{struct_name}*)mp_write_ptr_{sanitized_struct_name}(struct_obj))
25442544
2545-
static inline mp_obj_t mp_read_ptr_{sanitized_struct_name}(void *field)
2545+
static mp_obj_t mp_read_ptr_{sanitized_struct_name}(void *field)
25462546
{{
25472547
return lv_to_mp_struct(&mp_{sanitized_struct_name}_type, field);
25482548
}}
@@ -2775,7 +2775,7 @@ def try_generate_type(type_ast):
27752775
try:
27762776
print("#define %s NULL\n" % func_ptr_name)
27772777
gen_mp_func(func, None)
2778-
print("static inline mp_obj_t mp_lv_{f}(void *func){{ return mp_lv_funcptr(&mp_{f}_mpobj, func, NULL, MP_QSTR_, NULL); }}\n".format(
2778+
print("static mp_obj_t mp_lv_{f}(void *func){{ return mp_lv_funcptr(&mp_{f}_mpobj, func, NULL, MP_QSTR_, NULL); }}\n".format(
27792779
f=func_ptr_name))
27802780
lv_to_mp_funcptr[ptr_type] = func_ptr_name
27812781
# eprint("/* --> lv_to_mp_funcptr[%s] = %s */" % (ptr_type, func_ptr_name))

0 commit comments

Comments
 (0)