Browse Source

unix: Make port-specific modules use MP_REGISTER_MODULE.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
pull/8566/head
Jim Mussared 3 years ago
parent
commit
63431a5536
  1. 2
      ports/unix/modffi.c
  2. 2
      ports/unix/modjni.c
  3. 2
      ports/unix/modtermios.c
  4. 2
      ports/unix/modtime.c
  5. 2
      ports/unix/moduselect.c
  6. 2
      ports/unix/modusocket.c
  7. 46
      ports/unix/mpconfigport.h
  8. 4
      ports/windows/mpconfigport.h

2
ports/unix/modffi.c

@ -631,3 +631,5 @@ const mp_obj_module_t mp_module_ffi = {
.base = { &mp_type_module },
.globals = (mp_obj_dict_t *)&mp_module_ffi_globals,
};
MP_REGISTER_MODULE(MP_QSTR_ffi, mp_module_ffi, MICROPY_PY_FFI);

2
ports/unix/modjni.c

@ -712,3 +712,5 @@ const mp_obj_module_t mp_module_jni = {
.base = { &mp_type_module },
.globals = (mp_obj_dict_t *)&mp_module_jni_globals,
};
MP_REGISTER_MODULE(MP_QSTR_jni, mp_module_jni, MICROPY_PY_JNI);

2
ports/unix/modtermios.c

@ -148,3 +148,5 @@ const mp_obj_module_t mp_module_termios = {
.base = { &mp_type_module },
.globals = (mp_obj_dict_t *)&mp_module_termios_globals,
};
MP_REGISTER_MODULE(MP_QSTR_termios, mp_module_termios, MICROPY_PY_TERMIOS);

2
ports/unix/modtime.c

@ -232,4 +232,6 @@ const mp_obj_module_t mp_module_time = {
.globals = (mp_obj_dict_t *)&mp_module_time_globals,
};
MP_REGISTER_MODULE(MP_QSTR_utime, mp_module_time, MICROPY_PY_UTIME);
#endif // MICROPY_PY_UTIME

2
ports/unix/moduselect.c

@ -351,4 +351,6 @@ const mp_obj_module_t mp_module_uselect = {
.globals = (mp_obj_dict_t *)&mp_module_select_globals,
};
MP_REGISTER_MODULE(MP_QSTR_uselect, mp_module_uselect, MICROPY_PY_USELECT_POSIX);
#endif // MICROPY_PY_USELECT_POSIX

2
ports/unix/modusocket.c

@ -701,3 +701,5 @@ const mp_obj_module_t mp_module_socket = {
.base = { &mp_type_module },
.globals = (mp_obj_dict_t *)&mp_module_socket_globals,
};
MP_REGISTER_MODULE(MP_QSTR_usocket, mp_module_socket, MICROPY_PY_SOCKET);

46
ports/unix/mpconfigport.h

@ -219,52 +219,6 @@ extern const struct _mp_print_t mp_stderr_print;
#define mp_type_fileio mp_type_vfs_posix_fileio
#define mp_type_textio mp_type_vfs_posix_textio
extern const struct _mp_obj_module_t mp_module_uselect;
extern const struct _mp_obj_module_t mp_module_time;
extern const struct _mp_obj_module_t mp_module_termios;
extern const struct _mp_obj_module_t mp_module_socket;
extern const struct _mp_obj_module_t mp_module_ffi;
extern const struct _mp_obj_module_t mp_module_jni;
#if MICROPY_PY_FFI
#define MICROPY_PY_FFI_DEF { MP_ROM_QSTR(MP_QSTR_ffi), MP_ROM_PTR(&mp_module_ffi) },
#else
#define MICROPY_PY_FFI_DEF
#endif
#if MICROPY_PY_JNI
#define MICROPY_PY_JNI_DEF { MP_ROM_QSTR(MP_QSTR_jni), MP_ROM_PTR(&mp_module_jni) },
#else
#define MICROPY_PY_JNI_DEF
#endif
#if MICROPY_PY_UTIME
#define MICROPY_PY_UTIME_DEF { MP_ROM_QSTR(MP_QSTR_utime), MP_ROM_PTR(&mp_module_time) },
#else
#define MICROPY_PY_UTIME_DEF
#endif
#if MICROPY_PY_TERMIOS
#define MICROPY_PY_TERMIOS_DEF { MP_ROM_QSTR(MP_QSTR_termios), MP_ROM_PTR(&mp_module_termios) },
#else
#define MICROPY_PY_TERMIOS_DEF
#endif
#if MICROPY_PY_SOCKET
#define MICROPY_PY_SOCKET_DEF { MP_ROM_QSTR(MP_QSTR_usocket), MP_ROM_PTR(&mp_module_socket) },
#else
#define MICROPY_PY_SOCKET_DEF
#endif
#if MICROPY_PY_USELECT_POSIX
#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 \
MICROPY_PY_FFI_DEF \
MICROPY_PY_JNI_DEF \
MICROPY_PY_UTIME_DEF \
MICROPY_PY_SOCKET_DEF \
MICROPY_PY_USELECT_DEF \
MICROPY_PY_TERMIOS_DEF \
// type definitions for the specific machine
// For size_t and ssize_t

4
ports/windows/mpconfigport.h

@ -215,10 +215,6 @@ typedef long mp_off_t;
#define MICROPY_PORT_BUILTINS \
{ MP_ROM_QSTR(MP_QSTR_open), MP_ROM_PTR(&mp_builtin_open_obj) },
extern const struct _mp_obj_module_t mp_module_time;
#define MICROPY_PORT_BUILTIN_MODULES \
{ MP_ROM_QSTR(MP_QSTR_utime), MP_ROM_PTR(&mp_module_time) }, \
#if MICROPY_USE_READLINE == 1
#define MICROPY_PORT_ROOT_POINTERS \
char *readline_hist[50];

Loading…
Cancel
Save