diff options
author | Damien George <damien.p.george@gmail.com> | 2017-02-22 12:55:28 +1100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2017-02-22 12:58:11 +1100 |
commit | b1b090255c5156987b36711e929544546603029c (patch) | |
tree | 9772e567265cba38589d8065d76b85697d4cef65 /py | |
parent | f563406d2e342be1535592f80680c510f9aade9a (diff) |
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.
Diffstat (limited to 'py')
-rw-r--r-- | py/moduerrno.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/py/moduerrno.c b/py/moduerrno.c index ad166ced3..de66c941b 100644 --- a/py/moduerrno.c +++ b/py/moduerrno.c @@ -32,9 +32,10 @@ #if MICROPY_PY_UERRNO -// This list could be defined per port in mpconfigport.h to tailor it to a -// specific port's needs. But for now we have a common list. -#define ERRNO_LIST \ +// This list can be defined per port in mpconfigport.h to tailor it to a +// specific port's needs. If it's not defined then we provide a default. +#ifndef MICROPY_PY_UERRNO_LIST +#define MICROPY_PY_UERRNO_LIST \ X(EPERM) \ X(ENOENT) \ X(EIO) \ @@ -58,10 +59,12 @@ X(EALREADY) \ X(EINPROGRESS) \ +#endif + #if MICROPY_PY_UERRNO_ERRORCODE STATIC const mp_rom_map_elem_t errorcode_table[] = { #define X(e) { MP_ROM_INT(MP_ ## e), MP_ROM_QSTR(MP_QSTR_## e) }, - ERRNO_LIST + MICROPY_PY_UERRNO_LIST #undef X }; @@ -85,7 +88,7 @@ STATIC const mp_rom_map_elem_t mp_module_uerrno_globals_table[] = { #endif #define X(e) { MP_ROM_QSTR(MP_QSTR_## e), MP_ROM_INT(MP_ ## e) }, - ERRNO_LIST + MICROPY_PY_UERRNO_LIST #undef X }; |