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