MAKE_ENUM_TYPE for new style type defs
This commit is contained in:
parent
2cc07aef73
commit
f9f75d8202
16
py/enum.h
16
py/enum.h
@ -51,15 +51,13 @@ typedef struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#define MAKE_ENUM_TYPE(module, type, typename, ...) \
|
#define MAKE_ENUM_TYPE(module, type, typename, ...) \
|
||||||
const mp_obj_type_t typename##_type = { \
|
MP_DEFINE_CONST_OBJ_TYPE(typename##_type, \
|
||||||
{ &mp_type_type }, \
|
MP_QSTR_##type, \
|
||||||
.name = MP_QSTR_##type, \
|
0, \
|
||||||
.print = typename##_print, \
|
print, typename##_print, \
|
||||||
.locals_dict = (mp_obj_dict_t *)&typename##_locals_dict, \
|
locals_dict, &typename##_locals_dict, \
|
||||||
##__VA_ARGS__ \
|
##__VA_ARGS__ \
|
||||||
}
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
mp_obj_t cp_enum_find(const mp_obj_type_t *type, int value);
|
mp_obj_t cp_enum_find(const mp_obj_type_t *type, int value);
|
||||||
int cp_enum_value(const mp_obj_type_t *type, mp_obj_t obj, qstr arg_name);
|
int cp_enum_value(const mp_obj_type_t *type, mp_obj_t obj, qstr arg_name);
|
||||||
|
Loading…
Reference in New Issue
Block a user