Commit b1b09025 authored by Damien George's avatar Damien George

py/moduerrno: Make list of errno codes configurable.

It's configurable by defining MICROPY_PY_UERRNO_LIST.  If this is not
defined then a default is provided.
parent f563406d
...@@ -32,9 +32,10 @@ ...@@ -32,9 +32,10 @@
#if MICROPY_PY_UERRNO #if MICROPY_PY_UERRNO
// This list could be defined per port in mpconfigport.h to tailor it to a // This list can be defined per port in mpconfigport.h to tailor it to a
// specific port's needs. But for now we have a common list. // specific port's needs. If it's not defined then we provide a default.
#define ERRNO_LIST \ #ifndef MICROPY_PY_UERRNO_LIST
#define MICROPY_PY_UERRNO_LIST \
X(EPERM) \ X(EPERM) \
X(ENOENT) \ X(ENOENT) \
X(EIO) \ X(EIO) \
...@@ -58,10 +59,12 @@ ...@@ -58,10 +59,12 @@
X(EALREADY) \ X(EALREADY) \
X(EINPROGRESS) \ X(EINPROGRESS) \
#endif
#if MICROPY_PY_UERRNO_ERRORCODE #if MICROPY_PY_UERRNO_ERRORCODE
STATIC const mp_rom_map_elem_t errorcode_table[] = { STATIC const mp_rom_map_elem_t errorcode_table[] = {
#define X(e) { MP_ROM_INT(MP_ ## e), MP_ROM_QSTR(MP_QSTR_## e) }, #define X(e) { MP_ROM_INT(MP_ ## e), MP_ROM_QSTR(MP_QSTR_## e) },
ERRNO_LIST MICROPY_PY_UERRNO_LIST
#undef X #undef X
}; };
...@@ -85,7 +88,7 @@ STATIC const mp_rom_map_elem_t mp_module_uerrno_globals_table[] = { ...@@ -85,7 +88,7 @@ STATIC const mp_rom_map_elem_t mp_module_uerrno_globals_table[] = {
#endif #endif
#define X(e) { MP_ROM_QSTR(MP_QSTR_## e), MP_ROM_INT(MP_ ## e) }, #define X(e) { MP_ROM_QSTR(MP_QSTR_## e), MP_ROM_INT(MP_ ## e) },
ERRNO_LIST MICROPY_PY_UERRNO_LIST
#undef X #undef X
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment