MAKE_ENUM_TYPE for new style type defs

This commit is contained in:
Jeff Epler 2023-09-22 13:39:24 -05:00
parent 2cc07aef73
commit f9f75d8202
No known key found for this signature in database
GPG Key ID: D5BF15AB975AB4DE

View File

@ -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, \
##__VA_ARGS__ \
}
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);