unix/moduselect: Make configurable with MICROPY_PY_USELECT.

This commit is contained in:
Paul Sokolovsky 2015-12-13 08:47:00 +02:00
parent f925165942
commit 2d11b17419
2 changed files with 15 additions and 1 deletions

View File

@ -25,6 +25,10 @@
* THE SOFTWARE. * THE SOFTWARE.
*/ */
#include "py/mpconfig.h"
#if MICROPY_PY_USELECT
#include <stdio.h> #include <stdio.h>
#include <errno.h> #include <errno.h>
#include <poll.h> #include <poll.h>
@ -212,3 +216,5 @@ const mp_obj_module_t mp_module_uselect = {
.name = MP_QSTR_uselect, .name = MP_QSTR_uselect,
.globals = (mp_obj_dict_t*)&mp_module_select_globals, .globals = (mp_obj_dict_t*)&mp_module_select_globals,
}; };
#endif // MICROPY_PY_USELECT

View File

@ -104,6 +104,9 @@
#define MICROPY_PY_UHEAPQ (1) #define MICROPY_PY_UHEAPQ (1)
#define MICROPY_PY_UHASHLIB (1) #define MICROPY_PY_UHASHLIB (1)
#define MICROPY_PY_UBINASCII (1) #define MICROPY_PY_UBINASCII (1)
#ifndef MICROPY_PY_USELECT
#define MICROPY_PY_USELECT (1)
#endif
#define MICROPY_PY_MACHINE (1) #define MICROPY_PY_MACHINE (1)
// Define to MICROPY_ERROR_REPORTING_DETAILED to get function, etc. // Define to MICROPY_ERROR_REPORTING_DETAILED to get function, etc.
@ -158,6 +161,11 @@ extern const struct _mp_obj_module_t mp_module_jni;
#else #else
#define MICROPY_PY_SOCKET_DEF #define MICROPY_PY_SOCKET_DEF
#endif #endif
#if MICROPY_PY_USELECT
#define MICROPY_PY_USELECT_DEF { MP_ROM_QSTR(MP_QSTR_uselect), MP_ROM_PTR(&mp_module_uselect) },
#else
#define MICROPY_PY_USELECT_DEF
#endif
#define MICROPY_PORT_BUILTIN_MODULES \ #define MICROPY_PORT_BUILTIN_MODULES \
MICROPY_PY_FFI_DEF \ MICROPY_PY_FFI_DEF \
@ -166,7 +174,7 @@ extern const struct _mp_obj_module_t mp_module_jni;
MICROPY_PY_SOCKET_DEF \ MICROPY_PY_SOCKET_DEF \
{ MP_ROM_QSTR(MP_QSTR_machine), MP_ROM_PTR(&mp_module_machine) }, \ { MP_ROM_QSTR(MP_QSTR_machine), MP_ROM_PTR(&mp_module_machine) }, \
{ MP_ROM_QSTR(MP_QSTR_uos), MP_ROM_PTR(&mp_module_os) }, \ { MP_ROM_QSTR(MP_QSTR_uos), MP_ROM_PTR(&mp_module_os) }, \
{ MP_ROM_QSTR(MP_QSTR_uselect), MP_ROM_PTR(&mp_module_uselect) }, \ MICROPY_PY_USELECT_DEF \
MICROPY_PY_TERMIOS_DEF \ MICROPY_PY_TERMIOS_DEF \
// type definitions for the specific machine // type definitions for the specific machine