py/objexcept: Make MP_DEFINE_EXCEPTION public so ports can define excs.

This commit is contained in:
Damien George
2018-03-17 00:31:40 +11:00
parent f6a1f18603
commit 5edce4539b
2 changed files with 16 additions and 13 deletions

View File

@@ -37,4 +37,17 @@ typedef struct _mp_obj_exception_t {
mp_obj_tuple_t *args;
} mp_obj_exception_t;
void mp_obj_exception_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t kind);
void mp_obj_exception_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest);
#define MP_DEFINE_EXCEPTION(exc_name, base_name) \
const mp_obj_type_t mp_type_ ## exc_name = { \
{ &mp_type_type }, \
.name = MP_QSTR_ ## exc_name, \
.print = mp_obj_exception_print, \
.make_new = mp_obj_exception_make_new, \
.attr = mp_obj_exception_attr, \
.parent = &mp_type_ ## base_name, \
};
#endif // MICROPY_INCLUDED_PY_OBJEXCEPT_H