From 1bf2dcb15ecf4ba37211327f4378b164a5aaf567 Mon Sep 17 00:00:00 2001 From: Jim Mussared Date: Thu, 18 Aug 2022 14:47:56 +1000 Subject: [PATCH] all: Rename mp_umodule*, mp_module_umodule* to remove the "u" prefix. This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared --- extmod/misc.h | 16 ++--- extmod/modbluetooth.c | 4 +- extmod/modubinascii.c | 4 +- extmod/moducryptolib.c | 10 +-- extmod/moduhashlib.c | 10 +-- extmod/moduheapq.c | 10 +-- extmod/modujson.c | 10 +-- extmod/moduos.c | 66 ++++++++++---------- extmod/moduplatform.c | 4 +- extmod/modurandom.c | 10 +-- extmod/modure.c | 4 +- extmod/moduselect.c | 4 +- extmod/modusocket.c | 10 +-- extmod/modussl_axtls.c | 4 +- extmod/modussl_mbedtls.c | 4 +- extmod/modutime.c | 60 +++++++++--------- extmod/modutime.h | 20 +++--- extmod/modutimeq.c | 10 +-- extmod/moduwebsocket.c | 4 +- extmod/moduzlib.c | 10 +-- extmod/uos_dupterm.c | 26 ++++---- extmod/utime_mphal.c | 0 ports/cc3200/mods/moduhashlib.c | 2 +- ports/cc3200/mods/moduos.c | 4 +- ports/cc3200/mods/modusocket.c | 10 +-- ports/cc3200/mods/modussl.c | 10 +-- ports/cc3200/mods/modutime.c | 4 +- ports/esp32/modsocket.c | 4 +- ports/esp32/moduos.c | 10 +-- ports/esp32/modutime.c | 4 +- ports/esp32/mphalport.c | 2 +- ports/esp8266/esp_mphal.c | 6 +- ports/esp8266/main.c | 2 +- ports/esp8266/moduos.c | 12 ++-- ports/esp8266/modutime.c | 4 +- ports/mimxrt/moduos.c | 10 +-- ports/mimxrt/modutime.c | 4 +- ports/mimxrt/mphalport.c | 6 +- ports/nrf/modules/uos/moduos.c | 4 +- ports/renesas-ra/moduos.c | 4 +- ports/renesas-ra/modutime.c | 4 +- ports/renesas-ra/mphalport.c | 6 +- ports/rp2/moduos.c | 4 +- ports/rp2/modutime.c | 4 +- ports/rp2/mphalport.c | 6 +- ports/samd/moduos.c | 12 ++-- ports/samd/modutime.c | 4 +- ports/samd/mphalport.c | 6 +- ports/stm32/modpyb.c | 10 +-- ports/stm32/moduos.c | 8 +-- ports/stm32/modutime.c | 4 +- ports/stm32/mphalport.c | 6 +- ports/stm32/portmodules.h | 4 +- ports/unix/main.c | 2 +- ports/unix/moduos.c | 24 +++---- ports/unix/moduselect.c | 4 +- ports/unix/modutime.c | 4 +- ports/unix/mpconfigport.h | 2 +- ports/unix/unix_mphal.c | 2 +- ports/unix/variants/mpconfigvariant_common.h | 2 +- ports/zephyr/modusocket.c | 10 +-- ports/zephyr/modutime.c | 2 +- py/builtin.h | 2 +- py/modarray.c | 4 +- py/modstruct.c | 4 +- py/moduerrno.c | 16 ++--- py/parse.c | 2 +- 67 files changed, 280 insertions(+), 280 deletions(-) create mode 100644 extmod/utime_mphal.c diff --git a/extmod/misc.h b/extmod/misc.h index a9392aa10b..80e5b59a08 100644 --- a/extmod/misc.h +++ b/extmod/misc.h @@ -32,17 +32,17 @@ #include #include "py/runtime.h" -MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(mp_uos_dupterm_obj); +MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(mp_os_dupterm_obj); #if MICROPY_PY_OS_DUPTERM -bool mp_uos_dupterm_is_builtin_stream(mp_const_obj_t stream); -void mp_uos_dupterm_stream_detached_attached(mp_obj_t stream_detached, mp_obj_t stream_attached); -uintptr_t mp_uos_dupterm_poll(uintptr_t poll_flags); -int mp_uos_dupterm_rx_chr(void); -void mp_uos_dupterm_tx_strn(const char *str, size_t len); -void mp_uos_deactivate(size_t dupterm_idx, const char *msg, mp_obj_t exc); +bool mp_os_dupterm_is_builtin_stream(mp_const_obj_t stream); +void mp_os_dupterm_stream_detached_attached(mp_obj_t stream_detached, mp_obj_t stream_attached); +uintptr_t mp_os_dupterm_poll(uintptr_t poll_flags); +int mp_os_dupterm_rx_chr(void); +void mp_os_dupterm_tx_strn(const char *str, size_t len); +void mp_os_deactivate(size_t dupterm_idx, const char *msg, mp_obj_t exc); #else -#define mp_uos_dupterm_tx_strn(s, l) +#define mp_os_dupterm_tx_strn(s, l) #endif #endif // MICROPY_INCLUDED_EXTMOD_MISC_H diff --git a/extmod/modbluetooth.c b/extmod/modbluetooth.c index 35ba745e31..628c643a58 100644 --- a/extmod/modbluetooth.c +++ b/extmod/modbluetooth.c @@ -999,12 +999,12 @@ STATIC const mp_rom_map_elem_t mp_module_bluetooth_globals_table[] = { STATIC MP_DEFINE_CONST_DICT(mp_module_bluetooth_globals, mp_module_bluetooth_globals_table); -const mp_obj_module_t mp_module_ubluetooth = { +const mp_obj_module_t mp_module_bluetooth = { .base = { &mp_type_module }, .globals = (mp_obj_dict_t *)&mp_module_bluetooth_globals, }; -MP_REGISTER_MODULE(MP_QSTR_bluetooth, mp_module_ubluetooth); +MP_REGISTER_MODULE(MP_QSTR_bluetooth, mp_module_bluetooth); // Helpers diff --git a/extmod/modubinascii.c b/extmod/modubinascii.c index 85205bc3d1..bfb8195d91 100644 --- a/extmod/modubinascii.c +++ b/extmod/modubinascii.c @@ -198,11 +198,11 @@ STATIC const mp_rom_map_elem_t mp_module_binascii_globals_table[] = { STATIC MP_DEFINE_CONST_DICT(mp_module_binascii_globals, mp_module_binascii_globals_table); -const mp_obj_module_t mp_module_ubinascii = { +const mp_obj_module_t mp_module_binascii = { .base = { &mp_type_module }, .globals = (mp_obj_dict_t *)&mp_module_binascii_globals, }; -MP_REGISTER_MODULE(MP_QSTR_binascii, mp_module_ubinascii); +MP_REGISTER_MODULE(MP_QSTR_binascii, mp_module_binascii); #endif // MICROPY_PY_UBINASCII diff --git a/extmod/moducryptolib.c b/extmod/moducryptolib.c index 730ae4c6f5..e727f50548 100644 --- a/extmod/moducryptolib.c +++ b/extmod/moducryptolib.c @@ -356,7 +356,7 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE( locals_dict, &ucryptolib_aes_locals_dict ); -STATIC const mp_rom_map_elem_t mp_module_ucryptolib_globals_table[] = { +STATIC const mp_rom_map_elem_t mp_module_cryptolib_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_cryptolib) }, { MP_ROM_QSTR(MP_QSTR_aes), MP_ROM_PTR(&ucryptolib_aes_type) }, #if MICROPY_PY_UCRYPTOLIB_CONSTS @@ -368,13 +368,13 @@ STATIC const mp_rom_map_elem_t mp_module_ucryptolib_globals_table[] = { #endif }; -STATIC MP_DEFINE_CONST_DICT(mp_module_ucryptolib_globals, mp_module_ucryptolib_globals_table); +STATIC MP_DEFINE_CONST_DICT(mp_module_cryptolib_globals, mp_module_cryptolib_globals_table); -const mp_obj_module_t mp_module_ucryptolib = { +const mp_obj_module_t mp_module_cryptolib = { .base = { &mp_type_module }, - .globals = (mp_obj_dict_t *)&mp_module_ucryptolib_globals, + .globals = (mp_obj_dict_t *)&mp_module_cryptolib_globals, }; -MP_REGISTER_MODULE(MP_QSTR_cryptolib, mp_module_ucryptolib); +MP_REGISTER_MODULE(MP_QSTR_cryptolib, mp_module_cryptolib); #endif // MICROPY_PY_UCRYPTOLIB diff --git a/extmod/moduhashlib.c b/extmod/moduhashlib.c index addf094765..ef1a29fc78 100644 --- a/extmod/moduhashlib.c +++ b/extmod/moduhashlib.c @@ -354,7 +354,7 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE( ); #endif // MICROPY_PY_UHASHLIB_MD5 -STATIC const mp_rom_map_elem_t mp_module_uhashlib_globals_table[] = { +STATIC const mp_rom_map_elem_t mp_module_hashlib_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_hashlib) }, #if MICROPY_PY_UHASHLIB_SHA256 { MP_ROM_QSTR(MP_QSTR_sha256), MP_ROM_PTR(&uhashlib_sha256_type) }, @@ -367,13 +367,13 @@ STATIC const mp_rom_map_elem_t mp_module_uhashlib_globals_table[] = { #endif }; -STATIC MP_DEFINE_CONST_DICT(mp_module_uhashlib_globals, mp_module_uhashlib_globals_table); +STATIC MP_DEFINE_CONST_DICT(mp_module_hashlib_globals, mp_module_hashlib_globals_table); -const mp_obj_module_t mp_module_uhashlib = { +const mp_obj_module_t mp_module_hashlib = { .base = { &mp_type_module }, - .globals = (mp_obj_dict_t *)&mp_module_uhashlib_globals, + .globals = (mp_obj_dict_t *)&mp_module_hashlib_globals, }; -MP_REGISTER_MODULE(MP_QSTR_hashlib, mp_module_uhashlib); +MP_REGISTER_MODULE(MP_QSTR_hashlib, mp_module_hashlib); #endif // MICROPY_PY_UHASHLIB diff --git a/extmod/moduheapq.c b/extmod/moduheapq.c index 9c3df65258..fb6cb81182 100644 --- a/extmod/moduheapq.c +++ b/extmod/moduheapq.c @@ -104,21 +104,21 @@ STATIC mp_obj_t mod_uheapq_heapify(mp_obj_t heap_in) { STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_uheapq_heapify_obj, mod_uheapq_heapify); #if !MICROPY_ENABLE_DYNRUNTIME -STATIC const mp_rom_map_elem_t mp_module_uheapq_globals_table[] = { +STATIC const mp_rom_map_elem_t mp_module_heapq_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_heapq) }, { MP_ROM_QSTR(MP_QSTR_heappush), MP_ROM_PTR(&mod_uheapq_heappush_obj) }, { MP_ROM_QSTR(MP_QSTR_heappop), MP_ROM_PTR(&mod_uheapq_heappop_obj) }, { MP_ROM_QSTR(MP_QSTR_heapify), MP_ROM_PTR(&mod_uheapq_heapify_obj) }, }; -STATIC MP_DEFINE_CONST_DICT(mp_module_uheapq_globals, mp_module_uheapq_globals_table); +STATIC MP_DEFINE_CONST_DICT(mp_module_heapq_globals, mp_module_heapq_globals_table); -const mp_obj_module_t mp_module_uheapq = { +const mp_obj_module_t mp_module_heapq = { .base = { &mp_type_module }, - .globals = (mp_obj_dict_t *)&mp_module_uheapq_globals, + .globals = (mp_obj_dict_t *)&mp_module_heapq_globals, }; -MP_REGISTER_MODULE(MP_QSTR_heapq, mp_module_uheapq); +MP_REGISTER_MODULE(MP_QSTR_heapq, mp_module_heapq); #endif #endif // MICROPY_PY_UHEAPQ diff --git a/extmod/modujson.c b/extmod/modujson.c index 106595aab6..44dd316b69 100644 --- a/extmod/modujson.c +++ b/extmod/modujson.c @@ -366,7 +366,7 @@ STATIC mp_obj_t mod_ujson_loads(mp_obj_t obj) { } STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_ujson_loads_obj, mod_ujson_loads); -STATIC const mp_rom_map_elem_t mp_module_ujson_globals_table[] = { +STATIC const mp_rom_map_elem_t mp_module_json_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_json) }, { MP_ROM_QSTR(MP_QSTR_dump), MP_ROM_PTR(&mod_ujson_dump_obj) }, { MP_ROM_QSTR(MP_QSTR_dumps), MP_ROM_PTR(&mod_ujson_dumps_obj) }, @@ -374,13 +374,13 @@ STATIC const mp_rom_map_elem_t mp_module_ujson_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_loads), MP_ROM_PTR(&mod_ujson_loads_obj) }, }; -STATIC MP_DEFINE_CONST_DICT(mp_module_ujson_globals, mp_module_ujson_globals_table); +STATIC MP_DEFINE_CONST_DICT(mp_module_json_globals, mp_module_json_globals_table); -const mp_obj_module_t mp_module_ujson = { +const mp_obj_module_t mp_module_json = { .base = { &mp_type_module }, - .globals = (mp_obj_dict_t *)&mp_module_ujson_globals, + .globals = (mp_obj_dict_t *)&mp_module_json_globals, }; -MP_REGISTER_MODULE(MP_QSTR_json, mp_module_ujson); +MP_REGISTER_MODULE(MP_QSTR_json, mp_module_json); #endif // MICROPY_PY_UJSON diff --git a/extmod/moduos.c b/extmod/moduos.c index a7d15ef966..8c40f45370 100644 --- a/extmod/moduos.c +++ b/extmod/moduos.c @@ -65,7 +65,7 @@ #if MICROPY_PY_UOS_SYNC // sync() // Sync all filesystems. -STATIC mp_obj_t mp_uos_sync(void) { +STATIC mp_obj_t mp_os_sync(void) { #if MICROPY_VFS_FAT for (mp_vfs_mount_t *vfs = MP_STATE_VM(vfs_mount_table); vfs != NULL; vfs = vfs->next) { // this assumes that vfs->obj is fs_user_mount_t with block device functions @@ -74,7 +74,7 @@ STATIC mp_obj_t mp_uos_sync(void) { #endif return mp_const_none; } -MP_DEFINE_CONST_FUN_OBJ_0(mp_uos_sync_obj, mp_uos_sync); +MP_DEFINE_CONST_FUN_OBJ_0(mp_os_sync_obj, mp_os_sync); #endif #if MICROPY_PY_UOS_UNAME @@ -85,39 +85,39 @@ MP_DEFINE_CONST_FUN_OBJ_0(mp_uos_sync_obj, mp_uos_sync); #define CONST_RELEASE const #endif -STATIC const qstr mp_uos_uname_info_fields[] = { +STATIC const qstr mp_os_uname_info_fields[] = { MP_QSTR_sysname, MP_QSTR_nodename, MP_QSTR_release, MP_QSTR_version, MP_QSTR_machine }; -STATIC const MP_DEFINE_STR_OBJ(mp_uos_uname_info_sysname_obj, MICROPY_PY_SYS_PLATFORM); -STATIC const MP_DEFINE_STR_OBJ(mp_uos_uname_info_nodename_obj, MICROPY_PY_SYS_PLATFORM); -STATIC CONST_RELEASE MP_DEFINE_STR_OBJ(mp_uos_uname_info_release_obj, MICROPY_VERSION_STRING); -STATIC const MP_DEFINE_STR_OBJ(mp_uos_uname_info_version_obj, MICROPY_GIT_TAG " on " MICROPY_BUILD_DATE MICROPY_BUILD_TYPE_PAREN); -STATIC const MP_DEFINE_STR_OBJ(mp_uos_uname_info_machine_obj, MICROPY_HW_BOARD_NAME " with " MICROPY_HW_MCU_NAME); +STATIC const MP_DEFINE_STR_OBJ(mp_os_uname_info_sysname_obj, MICROPY_PY_SYS_PLATFORM); +STATIC const MP_DEFINE_STR_OBJ(mp_os_uname_info_nodename_obj, MICROPY_PY_SYS_PLATFORM); +STATIC CONST_RELEASE MP_DEFINE_STR_OBJ(mp_os_uname_info_release_obj, MICROPY_VERSION_STRING); +STATIC const MP_DEFINE_STR_OBJ(mp_os_uname_info_version_obj, MICROPY_GIT_TAG " on " MICROPY_BUILD_DATE MICROPY_BUILD_TYPE_PAREN); +STATIC const MP_DEFINE_STR_OBJ(mp_os_uname_info_machine_obj, MICROPY_HW_BOARD_NAME " with " MICROPY_HW_MCU_NAME); STATIC MP_DEFINE_ATTRTUPLE( - mp_uos_uname_info_obj, - mp_uos_uname_info_fields, + mp_os_uname_info_obj, + mp_os_uname_info_fields, 5, - MP_ROM_PTR(&mp_uos_uname_info_sysname_obj), - MP_ROM_PTR(&mp_uos_uname_info_nodename_obj), - MP_ROM_PTR(&mp_uos_uname_info_release_obj), - MP_ROM_PTR(&mp_uos_uname_info_version_obj), - MP_ROM_PTR(&mp_uos_uname_info_machine_obj) + MP_ROM_PTR(&mp_os_uname_info_sysname_obj), + MP_ROM_PTR(&mp_os_uname_info_nodename_obj), + MP_ROM_PTR(&mp_os_uname_info_release_obj), + MP_ROM_PTR(&mp_os_uname_info_version_obj), + MP_ROM_PTR(&mp_os_uname_info_machine_obj) ); -STATIC mp_obj_t mp_uos_uname(void) { +STATIC mp_obj_t mp_os_uname(void) { #if MICROPY_PY_UOS_UNAME_RELEASE_DYNAMIC - const char *release = mp_uos_uname_release(); - mp_uos_uname_info_release_obj.len = strlen(release); - mp_uos_uname_info_release_obj.data = (const byte *)release; + const char *release = mp_os_uname_release(); + mp_os_uname_info_release_obj.len = strlen(release); + mp_os_uname_info_release_obj.data = (const byte *)release; #endif - return MP_OBJ_FROM_PTR(&mp_uos_uname_info_obj); + return MP_OBJ_FROM_PTR(&mp_os_uname_info_obj); } -STATIC MP_DEFINE_CONST_FUN_OBJ_0(mp_uos_uname_obj, mp_uos_uname); +STATIC MP_DEFINE_CONST_FUN_OBJ_0(mp_os_uname_obj, mp_os_uname); #endif @@ -125,24 +125,24 @@ STATIC const mp_rom_map_elem_t os_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_os) }, #if MICROPY_PY_UOS_GETENV_PUTENV_UNSETENV - { MP_ROM_QSTR(MP_QSTR_getenv), MP_ROM_PTR(&mp_uos_getenv_obj) }, - { MP_ROM_QSTR(MP_QSTR_putenv), MP_ROM_PTR(&mp_uos_putenv_obj) }, - { MP_ROM_QSTR(MP_QSTR_unsetenv), MP_ROM_PTR(&mp_uos_unsetenv_obj) }, + { MP_ROM_QSTR(MP_QSTR_getenv), MP_ROM_PTR(&mp_os_getenv_obj) }, + { MP_ROM_QSTR(MP_QSTR_putenv), MP_ROM_PTR(&mp_os_putenv_obj) }, + { MP_ROM_QSTR(MP_QSTR_unsetenv), MP_ROM_PTR(&mp_os_unsetenv_obj) }, #endif #if MICROPY_PY_UOS_SEP { MP_ROM_QSTR(MP_QSTR_sep), MP_ROM_QSTR(MP_QSTR__slash_) }, #endif #if MICROPY_PY_UOS_SYNC - { MP_ROM_QSTR(MP_QSTR_sync), MP_ROM_PTR(&mp_uos_sync_obj) }, + { MP_ROM_QSTR(MP_QSTR_sync), MP_ROM_PTR(&mp_os_sync_obj) }, #endif #if MICROPY_PY_UOS_SYSTEM - { MP_ROM_QSTR(MP_QSTR_system), MP_ROM_PTR(&mp_uos_system_obj) }, + { MP_ROM_QSTR(MP_QSTR_system), MP_ROM_PTR(&mp_os_system_obj) }, #endif #if MICROPY_PY_UOS_UNAME - { MP_ROM_QSTR(MP_QSTR_uname), MP_ROM_PTR(&mp_uos_uname_obj) }, + { MP_ROM_QSTR(MP_QSTR_uname), MP_ROM_PTR(&mp_os_uname_obj) }, #endif #if MICROPY_PY_OS_URANDOM - { MP_ROM_QSTR(MP_QSTR_urandom), MP_ROM_PTR(&mp_uos_urandom_obj) }, + { MP_ROM_QSTR(MP_QSTR_urandom), MP_ROM_PTR(&mp_os_urandom_obj) }, #endif #if MICROPY_VFS @@ -161,13 +161,13 @@ STATIC const mp_rom_map_elem_t os_module_globals_table[] = { // The following are MicroPython extensions. #if MICROPY_PY_OS_DUPTERM - { MP_ROM_QSTR(MP_QSTR_dupterm), MP_ROM_PTR(&mp_uos_dupterm_obj) }, + { MP_ROM_QSTR(MP_QSTR_dupterm), MP_ROM_PTR(&mp_os_dupterm_obj) }, #endif #if MICROPY_PY_UOS_DUPTERM_NOTIFY - { MP_ROM_QSTR(MP_QSTR_dupterm_notify), MP_ROM_PTR(&mp_uos_dupterm_notify_obj) }, + { MP_ROM_QSTR(MP_QSTR_dupterm_notify), MP_ROM_PTR(&mp_os_dupterm_notify_obj) }, #endif #if MICROPY_PY_UOS_ERRNO - { MP_ROM_QSTR(MP_QSTR_errno), MP_ROM_PTR(&mp_uos_errno_obj) }, + { MP_ROM_QSTR(MP_QSTR_errno), MP_ROM_PTR(&mp_os_errno_obj) }, #endif #if MICROPY_VFS @@ -190,11 +190,11 @@ STATIC const mp_rom_map_elem_t os_module_globals_table[] = { }; STATIC MP_DEFINE_CONST_DICT(os_module_globals, os_module_globals_table); -const mp_obj_module_t mp_module_uos = { +const mp_obj_module_t mp_module_os = { .base = { &mp_type_module }, .globals = (mp_obj_dict_t *)&os_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR_os, mp_module_uos); +MP_REGISTER_MODULE(MP_QSTR_os, mp_module_os); #endif // MICROPY_PY_UOS diff --git a/extmod/moduplatform.c b/extmod/moduplatform.c index 079e275362..791ae8344d 100644 --- a/extmod/moduplatform.c +++ b/extmod/moduplatform.c @@ -70,11 +70,11 @@ STATIC const mp_rom_map_elem_t modplatform_globals_table[] = { STATIC MP_DEFINE_CONST_DICT(modplatform_globals, modplatform_globals_table); -const mp_obj_module_t mp_module_uplatform = { +const mp_obj_module_t mp_module_platform = { .base = { &mp_type_module }, .globals = (mp_obj_dict_t *)&modplatform_globals, }; -MP_REGISTER_MODULE(MP_QSTR_platform, mp_module_uplatform); +MP_REGISTER_MODULE(MP_QSTR_platform, mp_module_platform); #endif // MICROPY_PY_UPLATFORM diff --git a/extmod/modurandom.c b/extmod/modurandom.c index 6b59c0ae39..86e3a872c5 100644 --- a/extmod/modurandom.c +++ b/extmod/modurandom.c @@ -230,7 +230,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_0(mod_urandom___init___obj, mod_urandom___init__) #endif #if !MICROPY_ENABLE_DYNRUNTIME -STATIC const mp_rom_map_elem_t mp_module_urandom_globals_table[] = { +STATIC const mp_rom_map_elem_t mp_module_random_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_random) }, #if SEED_ON_IMPORT { MP_ROM_QSTR(MP_QSTR___init__), MP_ROM_PTR(&mod_urandom___init___obj) }, @@ -248,14 +248,14 @@ STATIC const mp_rom_map_elem_t mp_module_urandom_globals_table[] = { #endif }; -STATIC MP_DEFINE_CONST_DICT(mp_module_urandom_globals, mp_module_urandom_globals_table); +STATIC MP_DEFINE_CONST_DICT(mp_module_random_globals, mp_module_random_globals_table); -const mp_obj_module_t mp_module_urandom = { +const mp_obj_module_t mp_module_random = { .base = { &mp_type_module }, - .globals = (mp_obj_dict_t *)&mp_module_urandom_globals, + .globals = (mp_obj_dict_t *)&mp_module_random_globals, }; -MP_REGISTER_MODULE(MP_QSTR_random, mp_module_urandom); +MP_REGISTER_MODULE(MP_QSTR_random, mp_module_random); #endif #endif // MICROPY_PY_URANDOM diff --git a/extmod/modure.c b/extmod/modure.c index c27125bf1c..4798f07b0b 100644 --- a/extmod/modure.c +++ b/extmod/modure.c @@ -465,12 +465,12 @@ STATIC const mp_rom_map_elem_t mp_module_re_globals_table[] = { STATIC MP_DEFINE_CONST_DICT(mp_module_re_globals, mp_module_re_globals_table); -const mp_obj_module_t mp_module_ure = { +const mp_obj_module_t mp_module_re = { .base = { &mp_type_module }, .globals = (mp_obj_dict_t *)&mp_module_re_globals, }; -MP_REGISTER_MODULE(MP_QSTR_re, mp_module_ure); +MP_REGISTER_MODULE(MP_QSTR_re, mp_module_re); #endif // Source files #include'd here to make sure they're compiled in diff --git a/extmod/moduselect.c b/extmod/moduselect.c index 4df0f4d561..5bb5f4f48d 100644 --- a/extmod/moduselect.c +++ b/extmod/moduselect.c @@ -368,11 +368,11 @@ STATIC const mp_rom_map_elem_t mp_module_select_globals_table[] = { STATIC MP_DEFINE_CONST_DICT(mp_module_select_globals, mp_module_select_globals_table); -const mp_obj_module_t mp_module_uselect = { +const mp_obj_module_t mp_module_select = { .base = { &mp_type_module }, .globals = (mp_obj_dict_t *)&mp_module_select_globals, }; -MP_REGISTER_MODULE(MP_QSTR_select, mp_module_uselect); +MP_REGISTER_MODULE(MP_QSTR_select, mp_module_select); #endif // MICROPY_PY_USELECT diff --git a/extmod/modusocket.c b/extmod/modusocket.c index 6d14ebdfb0..6c2b4ff06f 100644 --- a/extmod/modusocket.c +++ b/extmod/modusocket.c @@ -615,7 +615,7 @@ STATIC mp_obj_t mod_usocket_getaddrinfo(size_t n_args, const mp_obj_t *args) { } STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_usocket_getaddrinfo_obj, 2, 6, mod_usocket_getaddrinfo); -STATIC const mp_rom_map_elem_t mp_module_usocket_globals_table[] = { +STATIC const mp_rom_map_elem_t mp_module_socket_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_socket) }, { MP_ROM_QSTR(MP_QSTR_socket), MP_ROM_PTR(&socket_type) }, @@ -646,13 +646,13 @@ STATIC const mp_rom_map_elem_t mp_module_usocket_globals_table[] = { */ }; -STATIC MP_DEFINE_CONST_DICT(mp_module_usocket_globals, mp_module_usocket_globals_table); +STATIC MP_DEFINE_CONST_DICT(mp_module_socket_globals, mp_module_socket_globals_table); -const mp_obj_module_t mp_module_usocket = { +const mp_obj_module_t mp_module_socket = { .base = { &mp_type_module }, - .globals = (mp_obj_dict_t *)&mp_module_usocket_globals, + .globals = (mp_obj_dict_t *)&mp_module_socket_globals, }; -MP_REGISTER_MODULE(MP_QSTR_socket, mp_module_usocket); +MP_REGISTER_MODULE(MP_QSTR_socket, mp_module_socket); #endif // MICROPY_PY_NETWORK && MICROPY_PY_USOCKET && !MICROPY_PY_LWIP diff --git a/extmod/modussl_axtls.c b/extmod/modussl_axtls.c index 393a945fac..6e490a594a 100644 --- a/extmod/modussl_axtls.c +++ b/extmod/modussl_axtls.c @@ -352,11 +352,11 @@ STATIC const mp_rom_map_elem_t mp_module_ssl_globals_table[] = { STATIC MP_DEFINE_CONST_DICT(mp_module_ssl_globals, mp_module_ssl_globals_table); -const mp_obj_module_t mp_module_ussl = { +const mp_obj_module_t mp_module_ssl = { .base = { &mp_type_module }, .globals = (mp_obj_dict_t *)&mp_module_ssl_globals, }; -MP_REGISTER_MODULE(MP_QSTR_ssl, mp_module_ussl); +MP_REGISTER_MODULE(MP_QSTR_ssl, mp_module_ssl); #endif // MICROPY_PY_USSL && MICROPY_SSL_AXTLS diff --git a/extmod/modussl_mbedtls.c b/extmod/modussl_mbedtls.c index c12c943d8a..117a06b6b2 100644 --- a/extmod/modussl_mbedtls.c +++ b/extmod/modussl_mbedtls.c @@ -502,11 +502,11 @@ STATIC const mp_rom_map_elem_t mp_module_ssl_globals_table[] = { STATIC MP_DEFINE_CONST_DICT(mp_module_ssl_globals, mp_module_ssl_globals_table); -const mp_obj_module_t mp_module_ussl = { +const mp_obj_module_t mp_module_ssl = { .base = { &mp_type_module }, .globals = (mp_obj_dict_t *)&mp_module_ssl_globals, }; -MP_REGISTER_MODULE(MP_QSTR_ssl, mp_module_ussl); +MP_REGISTER_MODULE(MP_QSTR_ssl, mp_module_ssl); #endif // MICROPY_PY_USSL && MICROPY_SSL_MBEDTLS diff --git a/extmod/modutime.c b/extmod/modutime.c index 5d8148f98a..9731f5ff0b 100644 --- a/extmod/modutime.c +++ b/extmod/modutime.c @@ -55,7 +55,7 @@ STATIC mp_obj_t time_localtime(size_t n_args, const mp_obj_t *args) { if (n_args == 0 || args[0] == mp_const_none) { // Get current date and time. - return mp_utime_localtime_get(); + return mp_time_localtime_get(); } else { // Convert given seconds to tuple. mp_int_t seconds = mp_obj_get_int(args[0]); @@ -74,7 +74,7 @@ STATIC mp_obj_t time_localtime(size_t n_args, const mp_obj_t *args) { return mp_obj_new_tuple(8, tuple); } } -MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_utime_localtime_obj, 0, 1, time_localtime); +MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_time_localtime_obj, 0, 1, time_localtime); // mktime() // This is the inverse function of localtime. Its argument is a full 8-tuple @@ -94,7 +94,7 @@ STATIC mp_obj_t time_mktime(mp_obj_t tuple) { mp_obj_get_int(elem[1]), mp_obj_get_int(elem[2]), mp_obj_get_int(elem[3]), mp_obj_get_int(elem[4]), mp_obj_get_int(elem[5]))); } -MP_DEFINE_CONST_FUN_OBJ_1(mp_utime_mktime_obj, time_mktime); +MP_DEFINE_CONST_FUN_OBJ_1(mp_time_mktime_obj, time_mktime); #endif // MICROPY_PY_UTIME_GMTIME_LOCALTIME_MKTIME @@ -103,22 +103,22 @@ MP_DEFINE_CONST_FUN_OBJ_1(mp_utime_mktime_obj, time_mktime); // time() // Return the number of seconds since the Epoch. STATIC mp_obj_t time_time(void) { - return mp_utime_time_get(); + return mp_time_time_get(); } -STATIC MP_DEFINE_CONST_FUN_OBJ_0(mp_utime_time_obj, time_time); +STATIC MP_DEFINE_CONST_FUN_OBJ_0(mp_time_time_obj, time_time); // time_ns() // Returns the number of nanoseconds since the Epoch, as an integer. STATIC mp_obj_t time_time_ns(void) { return mp_obj_new_int_from_ull(mp_hal_time_ns()); } -MP_DEFINE_CONST_FUN_OBJ_0(mp_utime_time_ns_obj, time_time_ns); +MP_DEFINE_CONST_FUN_OBJ_0(mp_time_time_ns_obj, time_time_ns); #endif // MICROPY_PY_UTIME_TIME_TIME_NS STATIC mp_obj_t time_sleep(mp_obj_t seconds_o) { #ifdef MICROPY_PY_UTIME_CUSTOM_SLEEP - mp_utime_sleep(seconds_o); + mp_time_sleep(seconds_o); #else #if MICROPY_PY_BUILTINS_FLOAT mp_hal_delay_ms((mp_uint_t)(1000 * mp_obj_get_float(seconds_o))); @@ -128,7 +128,7 @@ STATIC mp_obj_t time_sleep(mp_obj_t seconds_o) { #endif return mp_const_none; } -MP_DEFINE_CONST_FUN_OBJ_1(mp_utime_sleep_obj, time_sleep); +MP_DEFINE_CONST_FUN_OBJ_1(mp_time_sleep_obj, time_sleep); STATIC mp_obj_t time_sleep_ms(mp_obj_t arg) { mp_int_t ms = mp_obj_get_int(arg); @@ -137,7 +137,7 @@ STATIC mp_obj_t time_sleep_ms(mp_obj_t arg) { } return mp_const_none; } -MP_DEFINE_CONST_FUN_OBJ_1(mp_utime_sleep_ms_obj, time_sleep_ms); +MP_DEFINE_CONST_FUN_OBJ_1(mp_time_sleep_ms_obj, time_sleep_ms); STATIC mp_obj_t time_sleep_us(mp_obj_t arg) { mp_int_t us = mp_obj_get_int(arg); @@ -146,22 +146,22 @@ STATIC mp_obj_t time_sleep_us(mp_obj_t arg) { } return mp_const_none; } -MP_DEFINE_CONST_FUN_OBJ_1(mp_utime_sleep_us_obj, time_sleep_us); +MP_DEFINE_CONST_FUN_OBJ_1(mp_time_sleep_us_obj, time_sleep_us); STATIC mp_obj_t time_ticks_ms(void) { return MP_OBJ_NEW_SMALL_INT(mp_hal_ticks_ms() & (MICROPY_PY_UTIME_TICKS_PERIOD - 1)); } -MP_DEFINE_CONST_FUN_OBJ_0(mp_utime_ticks_ms_obj, time_ticks_ms); +MP_DEFINE_CONST_FUN_OBJ_0(mp_time_ticks_ms_obj, time_ticks_ms); STATIC mp_obj_t time_ticks_us(void) { return MP_OBJ_NEW_SMALL_INT(mp_hal_ticks_us() & (MICROPY_PY_UTIME_TICKS_PERIOD - 1)); } -MP_DEFINE_CONST_FUN_OBJ_0(mp_utime_ticks_us_obj, time_ticks_us); +MP_DEFINE_CONST_FUN_OBJ_0(mp_time_ticks_us_obj, time_ticks_us); STATIC mp_obj_t time_ticks_cpu(void) { return MP_OBJ_NEW_SMALL_INT(mp_hal_ticks_cpu() & (MICROPY_PY_UTIME_TICKS_PERIOD - 1)); } -MP_DEFINE_CONST_FUN_OBJ_0(mp_utime_ticks_cpu_obj, time_ticks_cpu); +MP_DEFINE_CONST_FUN_OBJ_0(mp_time_ticks_cpu_obj, time_ticks_cpu); STATIC mp_obj_t time_ticks_diff(mp_obj_t end_in, mp_obj_t start_in) { // we assume that the arguments come from ticks_xx so are small ints @@ -173,7 +173,7 @@ STATIC mp_obj_t time_ticks_diff(mp_obj_t end_in, mp_obj_t start_in) { - MICROPY_PY_UTIME_TICKS_PERIOD / 2; return MP_OBJ_NEW_SMALL_INT(diff); } -MP_DEFINE_CONST_FUN_OBJ_2(mp_utime_ticks_diff_obj, time_ticks_diff); +MP_DEFINE_CONST_FUN_OBJ_2(mp_time_ticks_diff_obj, time_ticks_diff); STATIC mp_obj_t time_ticks_add(mp_obj_t ticks_in, mp_obj_t delta_in) { // we assume that first argument come from ticks_xx so is small int @@ -194,31 +194,31 @@ STATIC mp_obj_t time_ticks_add(mp_obj_t ticks_in, mp_obj_t delta_in) { return MP_OBJ_NEW_SMALL_INT((ticks + delta) & (MICROPY_PY_UTIME_TICKS_PERIOD - 1)); } -MP_DEFINE_CONST_FUN_OBJ_2(mp_utime_ticks_add_obj, time_ticks_add); +MP_DEFINE_CONST_FUN_OBJ_2(mp_time_ticks_add_obj, time_ticks_add); STATIC const mp_rom_map_elem_t mp_module_time_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_time) }, #if MICROPY_PY_UTIME_GMTIME_LOCALTIME_MKTIME - { MP_ROM_QSTR(MP_QSTR_gmtime), MP_ROM_PTR(&mp_utime_localtime_obj) }, - { MP_ROM_QSTR(MP_QSTR_localtime), MP_ROM_PTR(&mp_utime_localtime_obj) }, - { MP_ROM_QSTR(MP_QSTR_mktime), MP_ROM_PTR(&mp_utime_mktime_obj) }, + { MP_ROM_QSTR(MP_QSTR_gmtime), MP_ROM_PTR(&mp_time_localtime_obj) }, + { MP_ROM_QSTR(MP_QSTR_localtime), MP_ROM_PTR(&mp_time_localtime_obj) }, + { MP_ROM_QSTR(MP_QSTR_mktime), MP_ROM_PTR(&mp_time_mktime_obj) }, #endif #if MICROPY_PY_UTIME_TIME_TIME_NS - { MP_ROM_QSTR(MP_QSTR_time), MP_ROM_PTR(&mp_utime_time_obj) }, - { MP_ROM_QSTR(MP_QSTR_time_ns), MP_ROM_PTR(&mp_utime_time_ns_obj) }, + { MP_ROM_QSTR(MP_QSTR_time), MP_ROM_PTR(&mp_time_time_obj) }, + { MP_ROM_QSTR(MP_QSTR_time_ns), MP_ROM_PTR(&mp_time_time_ns_obj) }, #endif - { MP_ROM_QSTR(MP_QSTR_sleep), MP_ROM_PTR(&mp_utime_sleep_obj) }, - { MP_ROM_QSTR(MP_QSTR_sleep_ms), MP_ROM_PTR(&mp_utime_sleep_ms_obj) }, - { MP_ROM_QSTR(MP_QSTR_sleep_us), MP_ROM_PTR(&mp_utime_sleep_us_obj) }, + { MP_ROM_QSTR(MP_QSTR_sleep), MP_ROM_PTR(&mp_time_sleep_obj) }, + { MP_ROM_QSTR(MP_QSTR_sleep_ms), MP_ROM_PTR(&mp_time_sleep_ms_obj) }, + { MP_ROM_QSTR(MP_QSTR_sleep_us), MP_ROM_PTR(&mp_time_sleep_us_obj) }, - { MP_ROM_QSTR(MP_QSTR_ticks_ms), MP_ROM_PTR(&mp_utime_ticks_ms_obj) }, - { MP_ROM_QSTR(MP_QSTR_ticks_us), MP_ROM_PTR(&mp_utime_ticks_us_obj) }, - { MP_ROM_QSTR(MP_QSTR_ticks_cpu), MP_ROM_PTR(&mp_utime_ticks_cpu_obj) }, - { MP_ROM_QSTR(MP_QSTR_ticks_add), MP_ROM_PTR(&mp_utime_ticks_add_obj) }, - { MP_ROM_QSTR(MP_QSTR_ticks_diff), MP_ROM_PTR(&mp_utime_ticks_diff_obj) }, + { MP_ROM_QSTR(MP_QSTR_ticks_ms), MP_ROM_PTR(&mp_time_ticks_ms_obj) }, + { MP_ROM_QSTR(MP_QSTR_ticks_us), MP_ROM_PTR(&mp_time_ticks_us_obj) }, + { MP_ROM_QSTR(MP_QSTR_ticks_cpu), MP_ROM_PTR(&mp_time_ticks_cpu_obj) }, + { MP_ROM_QSTR(MP_QSTR_ticks_add), MP_ROM_PTR(&mp_time_ticks_add_obj) }, + { MP_ROM_QSTR(MP_QSTR_ticks_diff), MP_ROM_PTR(&mp_time_ticks_diff_obj) }, #ifdef MICROPY_PY_UTIME_EXTRA_GLOBALS MICROPY_PY_UTIME_EXTRA_GLOBALS @@ -226,11 +226,11 @@ STATIC const mp_rom_map_elem_t mp_module_time_globals_table[] = { }; STATIC MP_DEFINE_CONST_DICT(mp_module_time_globals, mp_module_time_globals_table); -const mp_obj_module_t mp_module_utime = { +const mp_obj_module_t mp_module_time = { .base = { &mp_type_module }, .globals = (mp_obj_dict_t *)&mp_module_time_globals, }; -MP_REGISTER_MODULE(MP_QSTR_time, mp_module_utime); +MP_REGISTER_MODULE(MP_QSTR_time, mp_module_time); #endif // MICROPY_PY_UTIME diff --git a/extmod/modutime.h b/extmod/modutime.h index 2e10afb89b..f5ea6b55bf 100644 --- a/extmod/modutime.h +++ b/extmod/modutime.h @@ -29,15 +29,15 @@ #include "py/obj.h" -MP_DECLARE_CONST_FUN_OBJ_1(mp_utime_mktime_obj); -MP_DECLARE_CONST_FUN_OBJ_1(mp_utime_sleep_obj); -MP_DECLARE_CONST_FUN_OBJ_1(mp_utime_sleep_ms_obj); -MP_DECLARE_CONST_FUN_OBJ_1(mp_utime_sleep_us_obj); -MP_DECLARE_CONST_FUN_OBJ_0(mp_utime_ticks_ms_obj); -MP_DECLARE_CONST_FUN_OBJ_0(mp_utime_ticks_us_obj); -MP_DECLARE_CONST_FUN_OBJ_0(mp_utime_ticks_cpu_obj); -MP_DECLARE_CONST_FUN_OBJ_2(mp_utime_ticks_diff_obj); -MP_DECLARE_CONST_FUN_OBJ_2(mp_utime_ticks_add_obj); -MP_DECLARE_CONST_FUN_OBJ_0(mp_utime_time_ns_obj); +MP_DECLARE_CONST_FUN_OBJ_1(mp_time_mktime_obj); +MP_DECLARE_CONST_FUN_OBJ_1(mp_time_sleep_obj); +MP_DECLARE_CONST_FUN_OBJ_1(mp_time_sleep_ms_obj); +MP_DECLARE_CONST_FUN_OBJ_1(mp_time_sleep_us_obj); +MP_DECLARE_CONST_FUN_OBJ_0(mp_time_ticks_ms_obj); +MP_DECLARE_CONST_FUN_OBJ_0(mp_time_ticks_us_obj); +MP_DECLARE_CONST_FUN_OBJ_0(mp_time_ticks_cpu_obj); +MP_DECLARE_CONST_FUN_OBJ_2(mp_time_ticks_diff_obj); +MP_DECLARE_CONST_FUN_OBJ_2(mp_time_ticks_add_obj); +MP_DECLARE_CONST_FUN_OBJ_0(mp_time_time_ns_obj); #endif // MICROPY_INCLUDED_EXTMOD_MODUTIME_H diff --git a/extmod/modutimeq.c b/extmod/modutimeq.c index 4aa572934f..8187fa2b23 100644 --- a/extmod/modutimeq.c +++ b/extmod/modutimeq.c @@ -218,18 +218,18 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE( locals_dict, &utimeq_locals_dict ); -STATIC const mp_rom_map_elem_t mp_module_utimeq_globals_table[] = { +STATIC const mp_rom_map_elem_t mp_module_timeq_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_timeq) }, { MP_ROM_QSTR(MP_QSTR_timeq), MP_ROM_PTR(&utimeq_type) }, }; -STATIC MP_DEFINE_CONST_DICT(mp_module_utimeq_globals, mp_module_utimeq_globals_table); +STATIC MP_DEFINE_CONST_DICT(mp_module_timeq_globals, mp_module_timeq_globals_table); -const mp_obj_module_t mp_module_utimeq = { +const mp_obj_module_t mp_module_timeq = { .base = { &mp_type_module }, - .globals = (mp_obj_dict_t *)&mp_module_utimeq_globals, + .globals = (mp_obj_dict_t *)&mp_module_timeq_globals, }; -MP_REGISTER_MODULE(MP_QSTR_timeq, mp_module_utimeq); +MP_REGISTER_MODULE(MP_QSTR_timeq, mp_module_timeq); #endif // MICROPY_PY_UTIMEQ diff --git a/extmod/moduwebsocket.c b/extmod/moduwebsocket.c index ca7152bb13..301f72fba0 100644 --- a/extmod/moduwebsocket.c +++ b/extmod/moduwebsocket.c @@ -306,11 +306,11 @@ STATIC const mp_rom_map_elem_t uwebsocket_module_globals_table[] = { STATIC MP_DEFINE_CONST_DICT(uwebsocket_module_globals, uwebsocket_module_globals_table); -const mp_obj_module_t mp_module_uwebsocket = { +const mp_obj_module_t mp_module_websocket = { .base = { &mp_type_module }, .globals = (mp_obj_dict_t *)&uwebsocket_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR_websocket, mp_module_uwebsocket); +MP_REGISTER_MODULE(MP_QSTR_websocket, mp_module_websocket); #endif // MICROPY_PY_UWEBSOCKET diff --git a/extmod/moduzlib.c b/extmod/moduzlib.c index f41ca2b012..504c637c3c 100644 --- a/extmod/moduzlib.c +++ b/extmod/moduzlib.c @@ -210,21 +210,21 @@ error: STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_uzlib_decompress_obj, 1, 3, mod_uzlib_decompress); #if !MICROPY_ENABLE_DYNRUNTIME -STATIC const mp_rom_map_elem_t mp_module_uzlib_globals_table[] = { +STATIC const mp_rom_map_elem_t mp_module_zlib_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_zlib) }, { MP_ROM_QSTR(MP_QSTR_decompress), MP_ROM_PTR(&mod_uzlib_decompress_obj) }, { MP_ROM_QSTR(MP_QSTR_DecompIO), MP_ROM_PTR(&decompio_type) }, }; -STATIC MP_DEFINE_CONST_DICT(mp_module_uzlib_globals, mp_module_uzlib_globals_table); +STATIC MP_DEFINE_CONST_DICT(mp_module_zlib_globals, mp_module_zlib_globals_table); -const mp_obj_module_t mp_module_uzlib = { +const mp_obj_module_t mp_module_zlib = { .base = { &mp_type_module }, - .globals = (mp_obj_dict_t *)&mp_module_uzlib_globals, + .globals = (mp_obj_dict_t *)&mp_module_zlib_globals, }; -MP_REGISTER_MODULE(MP_QSTR_zlib, mp_module_uzlib); +MP_REGISTER_MODULE(MP_QSTR_zlib, mp_module_zlib); #endif // Source files #include'd here to make sure they're compiled in diff --git a/extmod/uos_dupterm.c b/extmod/uos_dupterm.c index 981d05a638..c72b365bea 100644 --- a/extmod/uos_dupterm.c +++ b/extmod/uos_dupterm.c @@ -38,7 +38,7 @@ #include "shared/runtime/interrupt_char.h" -void mp_uos_deactivate(size_t dupterm_idx, const char *msg, mp_obj_t exc) { +void mp_os_deactivate(size_t dupterm_idx, const char *msg, mp_obj_t exc) { mp_obj_t term = MP_STATE_VM(dupterm_objs[dupterm_idx]); MP_STATE_VM(dupterm_objs[dupterm_idx]) = MP_OBJ_NULL; mp_printf(&mp_plat_print, msg); @@ -54,7 +54,7 @@ void mp_uos_deactivate(size_t dupterm_idx, const char *msg, mp_obj_t exc) { } } -uintptr_t mp_uos_dupterm_poll(uintptr_t poll_flags) { +uintptr_t mp_os_dupterm_poll(uintptr_t poll_flags) { uintptr_t poll_flags_out = 0; for (size_t idx = 0; idx < MICROPY_PY_OS_DUPTERM; ++idx) { @@ -67,7 +67,7 @@ uintptr_t mp_uos_dupterm_poll(uintptr_t poll_flags) { mp_uint_t ret = 0; const mp_stream_p_t *stream_p = mp_get_stream(s); #if MICROPY_PY_UOS_DUPTERM_BUILTIN_STREAM - if (mp_uos_dupterm_is_builtin_stream(s)) { + if (mp_os_dupterm_is_builtin_stream(s)) { ret = stream_p->ioctl(s, MP_STREAM_POLL, poll_flags, &errcode); } else #endif @@ -93,14 +93,14 @@ uintptr_t mp_uos_dupterm_poll(uintptr_t poll_flags) { return poll_flags_out; } -int mp_uos_dupterm_rx_chr(void) { +int mp_os_dupterm_rx_chr(void) { for (size_t idx = 0; idx < MICROPY_PY_OS_DUPTERM; ++idx) { if (MP_STATE_VM(dupterm_objs[idx]) == MP_OBJ_NULL) { continue; } #if MICROPY_PY_UOS_DUPTERM_BUILTIN_STREAM - if (mp_uos_dupterm_is_builtin_stream(MP_STATE_VM(dupterm_objs[idx]))) { + if (mp_os_dupterm_is_builtin_stream(MP_STATE_VM(dupterm_objs[idx]))) { byte buf[1]; int errcode = 0; const mp_stream_p_t *stream_p = mp_get_stream(MP_STATE_VM(dupterm_objs[idx])); @@ -121,7 +121,7 @@ int mp_uos_dupterm_rx_chr(void) { mp_uint_t out_sz = stream_p->read(MP_STATE_VM(dupterm_objs[idx]), buf, 1, &errcode); if (out_sz == 0) { nlr_pop(); - mp_uos_deactivate(idx, "dupterm: EOF received, deactivating\n", MP_OBJ_NULL); + mp_os_deactivate(idx, "dupterm: EOF received, deactivating\n", MP_OBJ_NULL); } else if (out_sz == MP_STREAM_ERROR) { // errcode is valid if (mp_is_nonblocking_error(errcode)) { @@ -140,7 +140,7 @@ int mp_uos_dupterm_rx_chr(void) { return buf[0]; } } else { - mp_uos_deactivate(idx, "dupterm: Exception in read() method, deactivating: ", MP_OBJ_FROM_PTR(nlr.ret_val)); + mp_os_deactivate(idx, "dupterm: Exception in read() method, deactivating: ", MP_OBJ_FROM_PTR(nlr.ret_val)); } } @@ -148,14 +148,14 @@ int mp_uos_dupterm_rx_chr(void) { return -1; } -void mp_uos_dupterm_tx_strn(const char *str, size_t len) { +void mp_os_dupterm_tx_strn(const char *str, size_t len) { for (size_t idx = 0; idx < MICROPY_PY_OS_DUPTERM; ++idx) { if (MP_STATE_VM(dupterm_objs[idx]) == MP_OBJ_NULL) { continue; } #if MICROPY_PY_UOS_DUPTERM_BUILTIN_STREAM - if (mp_uos_dupterm_is_builtin_stream(MP_STATE_VM(dupterm_objs[idx]))) { + if (mp_os_dupterm_is_builtin_stream(MP_STATE_VM(dupterm_objs[idx]))) { int errcode = 0; const mp_stream_p_t *stream_p = mp_get_stream(MP_STATE_VM(dupterm_objs[idx])); stream_p->write(MP_STATE_VM(dupterm_objs[idx]), str, len, &errcode); @@ -168,12 +168,12 @@ void mp_uos_dupterm_tx_strn(const char *str, size_t len) { mp_stream_write(MP_STATE_VM(dupterm_objs[idx]), str, len, MP_STREAM_RW_WRITE); nlr_pop(); } else { - mp_uos_deactivate(idx, "dupterm: Exception in write() method, deactivating: ", MP_OBJ_FROM_PTR(nlr.ret_val)); + mp_os_deactivate(idx, "dupterm: Exception in write() method, deactivating: ", MP_OBJ_FROM_PTR(nlr.ret_val)); } } } -STATIC mp_obj_t mp_uos_dupterm(size_t n_args, const mp_obj_t *args) { +STATIC mp_obj_t mp_os_dupterm(size_t n_args, const mp_obj_t *args) { mp_int_t idx = 0; if (n_args == 2) { idx = mp_obj_get_int(args[1]); @@ -195,12 +195,12 @@ STATIC mp_obj_t mp_uos_dupterm(size_t n_args, const mp_obj_t *args) { } #if MICROPY_PY_UOS_DUPTERM_STREAM_DETACHED_ATTACHED - mp_uos_dupterm_stream_detached_attached(previous_obj, args[0]); + mp_os_dupterm_stream_detached_attached(previous_obj, args[0]); #endif return previous_obj; } -MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_uos_dupterm_obj, 1, 2, mp_uos_dupterm); +MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_os_dupterm_obj, 1, 2, mp_os_dupterm); MP_REGISTER_ROOT_POINTER(mp_obj_t dupterm_objs[MICROPY_PY_OS_DUPTERM]); diff --git a/extmod/utime_mphal.c b/extmod/utime_mphal.c new file mode 100644 index 0000000000..e69de29bb2 diff --git a/ports/cc3200/mods/moduhashlib.c b/ports/cc3200/mods/moduhashlib.c index 5424a6c0fb..de56e114af 100644 --- a/ports/cc3200/mods/moduhashlib.c +++ b/ports/cc3200/mods/moduhashlib.c @@ -202,7 +202,7 @@ STATIC const mp_rom_map_elem_t mp_module_hashlib_globals_table[] = { STATIC MP_DEFINE_CONST_DICT(mp_module_hashlib_globals, mp_module_hashlib_globals_table); -const mp_obj_module_t mp_module_uhashlib = { +const mp_obj_module_t mp_module_hashlib = { .base = { &mp_type_module }, .globals = (mp_obj_dict_t*)&mp_module_hashlib_globals, }; diff --git a/ports/cc3200/mods/moduos.c b/ports/cc3200/mods/moduos.c index b3f3bbf8d8..a6e4ef50a7 100644 --- a/ports/cc3200/mods/moduos.c +++ b/ports/cc3200/mods/moduos.c @@ -175,9 +175,9 @@ STATIC const mp_rom_map_elem_t os_module_globals_table[] = { STATIC MP_DEFINE_CONST_DICT(os_module_globals, os_module_globals_table); -const mp_obj_module_t mp_module_uos = { +const mp_obj_module_t mp_module_os = { .base = { &mp_type_module }, .globals = (mp_obj_dict_t*)&os_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR_os, mp_module_uos); +MP_REGISTER_MODULE(MP_QSTR_os, mp_module_os); diff --git a/ports/cc3200/mods/modusocket.c b/ports/cc3200/mods/modusocket.c index 311a4395fb..53682743a9 100644 --- a/ports/cc3200/mods/modusocket.c +++ b/ports/cc3200/mods/modusocket.c @@ -794,7 +794,7 @@ STATIC mp_obj_t mod_usocket_getaddrinfo(mp_obj_t host_in, mp_obj_t port_in) { } STATIC MP_DEFINE_CONST_FUN_OBJ_2(mod_usocket_getaddrinfo_obj, mod_usocket_getaddrinfo); -STATIC const mp_rom_map_elem_t mp_module_usocket_globals_table[] = { +STATIC const mp_rom_map_elem_t mp_module_socket_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_socket) }, { MP_ROM_QSTR(MP_QSTR_socket), MP_ROM_PTR(&socket_type) }, @@ -811,11 +811,11 @@ STATIC const mp_rom_map_elem_t mp_module_usocket_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_IPPROTO_UDP), MP_ROM_INT(SL_IPPROTO_UDP) }, }; -STATIC MP_DEFINE_CONST_DICT(mp_module_usocket_globals, mp_module_usocket_globals_table); +STATIC MP_DEFINE_CONST_DICT(mp_module_socket_globals, mp_module_socket_globals_table); -const mp_obj_module_t mp_module_usocket = { +const mp_obj_module_t mp_module_socket = { .base = { &mp_type_module }, - .globals = (mp_obj_dict_t*)&mp_module_usocket_globals, + .globals = (mp_obj_dict_t*)&mp_module_socket_globals, }; -MP_REGISTER_MODULE(MP_QSTR_socket, mp_module_usocket); +MP_REGISTER_MODULE(MP_QSTR_socket, mp_module_socket); diff --git a/ports/cc3200/mods/modussl.c b/ports/cc3200/mods/modussl.c index e2de7b05cb..dda6725e66 100644 --- a/ports/cc3200/mods/modussl.c +++ b/ports/cc3200/mods/modussl.c @@ -135,7 +135,7 @@ arg_error: } STATIC MP_DEFINE_CONST_FUN_OBJ_KW(mod_ssl_wrap_socket_obj, 0, mod_ssl_wrap_socket); -STATIC const mp_rom_map_elem_t mp_module_ussl_globals_table[] = { +STATIC const mp_rom_map_elem_t mp_module_ssl_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_ssl) }, { MP_ROM_QSTR(MP_QSTR_wrap_socket), MP_ROM_PTR(&mod_ssl_wrap_socket_obj) }, @@ -153,11 +153,11 @@ STATIC const mp_rom_map_elem_t mp_module_ussl_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_PROTOCOL_TLSv1_2), MP_ROM_INT(SL_SO_SEC_METHOD_TLSV1_2) }, }; -STATIC MP_DEFINE_CONST_DICT(mp_module_ussl_globals, mp_module_ussl_globals_table); +STATIC MP_DEFINE_CONST_DICT(mp_module_ssl_globals, mp_module_ssl_globals_table); -const mp_obj_module_t mp_module_ussl = { +const mp_obj_module_t mp_module_ssl = { .base = { &mp_type_module }, - .globals = (mp_obj_dict_t*)&mp_module_ussl_globals, + .globals = (mp_obj_dict_t*)&mp_module_ssl_globals, }; -MP_REGISTER_MODULE(MP_QSTR_ssl, mp_module_ussl); +MP_REGISTER_MODULE(MP_QSTR_ssl, mp_module_ssl); diff --git a/ports/cc3200/mods/modutime.c b/ports/cc3200/mods/modutime.c index 52eb1a6029..6fa98296d2 100644 --- a/ports/cc3200/mods/modutime.c +++ b/ports/cc3200/mods/modutime.c @@ -30,7 +30,7 @@ #include "pybrtc.h" // Return the localtime as an 8-tuple. -STATIC mp_obj_t mp_utime_localtime_get(void) { +STATIC mp_obj_t mp_time_localtime_get(void) { timeutils_struct_time_t tm; // get the seconds from the RTC @@ -49,6 +49,6 @@ STATIC mp_obj_t mp_utime_localtime_get(void) { } // Returns the number of seconds, as an integer, since the Epoch. -STATIC mp_obj_t mp_utime_time_get(void) { +STATIC mp_obj_t mp_time_time_get(void) { return mp_obj_new_int(pyb_rtc_get_seconds()); } diff --git a/ports/esp32/modsocket.c b/ports/esp32/modsocket.c index 5e07d1f4f5..8199304457 100644 --- a/ports/esp32/modsocket.c +++ b/ports/esp32/modsocket.c @@ -864,7 +864,7 @@ STATIC const mp_rom_map_elem_t mp_module_socket_globals_table[] = { STATIC MP_DEFINE_CONST_DICT(mp_module_socket_globals, mp_module_socket_globals_table); -const mp_obj_module_t mp_module_usocket = { +const mp_obj_module_t mp_module_socket = { .base = { &mp_type_module }, .globals = (mp_obj_dict_t *)&mp_module_socket_globals, }; @@ -872,4 +872,4 @@ const mp_obj_module_t mp_module_usocket = { // Note: This port doesn't define MICROPY_PY_USOCKET or MICROPY_PY_LWIP so // this will not conflict with the common implementation provided by // extmod/mod{lwip,usocket}.c. -MP_REGISTER_MODULE(MP_QSTR_socket, mp_module_usocket); +MP_REGISTER_MODULE(MP_QSTR_socket, mp_module_socket); diff --git a/ports/esp32/moduos.c b/ports/esp32/moduos.c index bdfd19c5d2..6a5a26c256 100644 --- a/ports/esp32/moduos.c +++ b/ports/esp32/moduos.c @@ -33,7 +33,7 @@ #include "py/mphal.h" #include "extmod/misc.h" -STATIC mp_obj_t mp_uos_urandom(mp_obj_t num) { +STATIC mp_obj_t mp_os_urandom(mp_obj_t num) { mp_int_t n = mp_obj_get_int(num); vstr_t vstr; vstr_init_len(&vstr, n); @@ -47,13 +47,13 @@ STATIC mp_obj_t mp_uos_urandom(mp_obj_t num) { } return mp_obj_new_bytes_from_vstr(&vstr); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_uos_urandom_obj, mp_uos_urandom); +STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_os_urandom_obj, mp_os_urandom); #if MICROPY_PY_UOS_DUPTERM_NOTIFY -STATIC mp_obj_t mp_uos_dupterm_notify(mp_obj_t obj_in) { +STATIC mp_obj_t mp_os_dupterm_notify(mp_obj_t obj_in) { (void)obj_in; for (;;) { - int c = mp_uos_dupterm_rx_chr(); + int c = mp_os_dupterm_rx_chr(); if (c < 0) { break; } @@ -61,5 +61,5 @@ STATIC mp_obj_t mp_uos_dupterm_notify(mp_obj_t obj_in) { } return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_uos_dupterm_notify_obj, mp_uos_dupterm_notify); +STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_os_dupterm_notify_obj, mp_os_dupterm_notify); #endif diff --git a/ports/esp32/modutime.c b/ports/esp32/modutime.c index 7b833a194d..7a2b215086 100644 --- a/ports/esp32/modutime.c +++ b/ports/esp32/modutime.c @@ -32,7 +32,7 @@ #include "shared/timeutils/timeutils.h" // Return the localtime as an 8-tuple. -STATIC mp_obj_t mp_utime_localtime_get(void) { +STATIC mp_obj_t mp_time_localtime_get(void) { struct timeval tv; gettimeofday(&tv, NULL); timeutils_struct_time_t tm; @@ -51,7 +51,7 @@ STATIC mp_obj_t mp_utime_localtime_get(void) { } // Return the number of seconds since the Epoch. -STATIC mp_obj_t mp_utime_time_get(void) { +STATIC mp_obj_t mp_time_time_get(void) { struct timeval tv; gettimeofday(&tv, NULL); return mp_obj_new_int(tv.tv_sec); diff --git a/ports/esp32/mphalport.c b/ports/esp32/mphalport.c index b187b422d5..61e9fd563e 100644 --- a/ports/esp32/mphalport.c +++ b/ports/esp32/mphalport.c @@ -121,7 +121,7 @@ void mp_hal_stdout_tx_strn(const char *str, size_t len) { if (release_gil) { MP_THREAD_GIL_ENTER(); } - mp_uos_dupterm_tx_strn(str, len); + mp_os_dupterm_tx_strn(str, len); } uint32_t mp_hal_ticks_ms(void) { diff --git a/ports/esp8266/esp_mphal.c b/ports/esp8266/esp_mphal.c index 219e614841..7606bd4f63 100644 --- a/ports/esp8266/esp_mphal.c +++ b/ports/esp8266/esp_mphal.c @@ -63,7 +63,7 @@ uintptr_t mp_hal_stdio_poll(uintptr_t poll_flags) { ret |= MP_STREAM_POLL_RD; } if (poll_flags & MP_STREAM_POLL_WR) { - ret |= mp_uos_dupterm_poll(poll_flags); + ret |= mp_os_dupterm_poll(poll_flags); } return ret; } @@ -95,7 +95,7 @@ void mp_hal_debug_str(const char *str) { #endif void mp_hal_stdout_tx_strn(const char *str, uint32_t len) { - mp_uos_dupterm_tx_strn(str, len); + mp_os_dupterm_tx_strn(str, len); } void mp_hal_debug_tx_strn_cooked(void *env, const char *str, uint32_t len) { @@ -146,7 +146,7 @@ STATIC void dupterm_task_handler(os_event_t *evt) { } lock = 1; while (1) { - int c = mp_uos_dupterm_rx_chr(); + int c = mp_os_dupterm_rx_chr(); if (c < 0) { break; } diff --git a/ports/esp8266/main.c b/ports/esp8266/main.c index 2aa81aba05..3083fe364e 100644 --- a/ports/esp8266/main.c +++ b/ports/esp8266/main.c @@ -74,7 +74,7 @@ STATIC void mp_reset(void) { args[1] = MP_OBJ_NEW_SMALL_INT(115200); args[0] = MP_OBJ_TYPE_GET_SLOT(&pyb_uart_type, make_new)(&pyb_uart_type, 2, 0, args); args[1] = MP_OBJ_NEW_SMALL_INT(1); - mp_uos_dupterm_obj.fun.var(2, args); + mp_os_dupterm_obj.fun.var(2, args); } #if MICROPY_ESPNOW diff --git a/ports/esp8266/moduos.c b/ports/esp8266/moduos.c index a023796fd3..78072d4f44 100644 --- a/ports/esp8266/moduos.c +++ b/ports/esp8266/moduos.c @@ -37,11 +37,11 @@ #include "esp_mphal.h" #include "user_interface.h" -STATIC const char *mp_uos_uname_release(void) { +STATIC const char *mp_os_uname_release(void) { return system_get_sdk_version(); } -STATIC mp_obj_t mp_uos_urandom(mp_obj_t num) { +STATIC mp_obj_t mp_os_urandom(mp_obj_t num) { mp_int_t n = mp_obj_get_int(num); vstr_t vstr; vstr_init_len(&vstr, n); @@ -50,9 +50,9 @@ STATIC mp_obj_t mp_uos_urandom(mp_obj_t num) { } return mp_obj_new_bytes_from_vstr(&vstr); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_uos_urandom_obj, mp_uos_urandom); +STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_os_urandom_obj, mp_os_urandom); -void mp_uos_dupterm_stream_detached_attached(mp_obj_t stream_detached, mp_obj_t stream_attached) { +void mp_os_dupterm_stream_detached_attached(mp_obj_t stream_detached, mp_obj_t stream_attached) { if (mp_obj_get_type(stream_attached) == &pyb_uart_type) { ++uart_attached_to_dupterm; } @@ -61,9 +61,9 @@ void mp_uos_dupterm_stream_detached_attached(mp_obj_t stream_detached, mp_obj_t } } -STATIC mp_obj_t mp_uos_dupterm_notify(mp_obj_t obj_in) { +STATIC mp_obj_t mp_os_dupterm_notify(mp_obj_t obj_in) { (void)obj_in; mp_hal_signal_dupterm_input(); return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_uos_dupterm_notify_obj, mp_uos_dupterm_notify); +STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_os_dupterm_notify_obj, mp_os_dupterm_notify); diff --git a/ports/esp8266/modutime.c b/ports/esp8266/modutime.c index b90763371b..21dd3cbcd9 100644 --- a/ports/esp8266/modutime.c +++ b/ports/esp8266/modutime.c @@ -30,7 +30,7 @@ #include "modmachine.h" // Return the localtime as an 8-tuple. -STATIC mp_obj_t mp_utime_localtime_get(void) { +STATIC mp_obj_t mp_time_localtime_get(void) { mp_int_t seconds = pyb_rtc_get_us_since_epoch() / 1000 / 1000; timeutils_struct_time_t tm; timeutils_seconds_since_epoch_to_struct_time(seconds, &tm); @@ -48,7 +48,7 @@ STATIC mp_obj_t mp_utime_localtime_get(void) { } // Returns the number of seconds, as an integer, since the Epoch. -STATIC mp_obj_t mp_utime_time_get(void) { +STATIC mp_obj_t mp_time_time_get(void) { // get date and time return mp_obj_new_int(pyb_rtc_get_us_since_epoch() / 1000 / 1000); } diff --git a/ports/mimxrt/moduos.c b/ports/mimxrt/moduos.c index b3f97693fa..8ae8019aae 100644 --- a/ports/mimxrt/moduos.c +++ b/ports/mimxrt/moduos.c @@ -96,7 +96,7 @@ uint32_t trng_random_u32(void) { } #if MICROPY_PY_UOS_URANDOM -STATIC mp_obj_t mp_uos_urandom(mp_obj_t num) { +STATIC mp_obj_t mp_os_urandom(mp_obj_t num) { mp_int_t n = mp_obj_get_int(num); vstr_t vstr; vstr_init_len(&vstr, n); @@ -106,14 +106,14 @@ STATIC mp_obj_t mp_uos_urandom(mp_obj_t num) { return mp_obj_new_bytes_from_vstr(&vstr); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_uos_urandom_obj, mp_uos_urandom); +STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_os_urandom_obj, mp_os_urandom); #endif #if MICROPY_PY_UOS_DUPTERM_NOTIFY -STATIC mp_obj_t mp_uos_dupterm_notify(mp_obj_t obj_in) { +STATIC mp_obj_t mp_os_dupterm_notify(mp_obj_t obj_in) { (void)obj_in; for (;;) { - int c = mp_uos_dupterm_rx_chr(); + int c = mp_os_dupterm_rx_chr(); if (c < 0) { break; } @@ -121,5 +121,5 @@ STATIC mp_obj_t mp_uos_dupterm_notify(mp_obj_t obj_in) { } return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_uos_dupterm_notify_obj, mp_uos_dupterm_notify); +STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_os_dupterm_notify_obj, mp_os_dupterm_notify); #endif diff --git a/ports/mimxrt/modutime.c b/ports/mimxrt/modutime.c index 5872e9d8d6..b0c927899f 100644 --- a/ports/mimxrt/modutime.c +++ b/ports/mimxrt/modutime.c @@ -30,7 +30,7 @@ #include "fsl_snvs_lp.h" // Return the localtime as an 8-tuple. -STATIC mp_obj_t mp_utime_localtime_get(void) { +STATIC mp_obj_t mp_time_localtime_get(void) { // Get current date and time. snvs_lp_srtc_datetime_t t; SNVS_LP_SRTC_GetDatetime(SNVS, &t); @@ -48,7 +48,7 @@ STATIC mp_obj_t mp_utime_localtime_get(void) { } // Return the number of seconds since the Epoch. -STATIC mp_obj_t mp_utime_time_get(void) { +STATIC mp_obj_t mp_time_time_get(void) { snvs_lp_srtc_datetime_t t; SNVS_LP_SRTC_GetDatetime(SNVS, &t); // EPOCH is 1970 for this port, which leads to the following trouble: diff --git a/ports/mimxrt/mphalport.c b/ports/mimxrt/mphalport.c index beb471ab80..2114baaae4 100644 --- a/ports/mimxrt/mphalport.c +++ b/ports/mimxrt/mphalport.c @@ -90,7 +90,7 @@ uintptr_t mp_hal_stdio_poll(uintptr_t poll_flags) { ret |= MP_STREAM_POLL_WR; } #if MICROPY_PY_OS_DUPTERM - ret |= mp_uos_dupterm_poll(poll_flags); + ret |= mp_os_dupterm_poll(poll_flags); #endif return ret; } @@ -103,7 +103,7 @@ int mp_hal_stdin_rx_chr(void) { return c; } #if MICROPY_PY_OS_DUPTERM - int dupterm_c = mp_uos_dupterm_rx_chr(); + int dupterm_c = mp_os_dupterm_rx_chr(); if (dupterm_c >= 0) { return dupterm_c; } @@ -134,7 +134,7 @@ void mp_hal_stdout_tx_strn(const char *str, mp_uint_t len) { } } #if MICROPY_PY_OS_DUPTERM - mp_uos_dupterm_tx_strn(str, len); + mp_os_dupterm_tx_strn(str, len); #endif } diff --git a/ports/nrf/modules/uos/moduos.c b/ports/nrf/modules/uos/moduos.c index bb49012707..b718150613 100644 --- a/ports/nrf/modules/uos/moduos.c +++ b/ports/nrf/modules/uos/moduos.c @@ -192,9 +192,9 @@ STATIC const mp_rom_map_elem_t os_module_globals_table[] = { STATIC MP_DEFINE_CONST_DICT(os_module_globals, os_module_globals_table); -const mp_obj_module_t mp_module_uos = { +const mp_obj_module_t mp_module_os = { .base = { &mp_type_module }, .globals = (mp_obj_dict_t*)&os_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR_os, mp_module_uos); +MP_REGISTER_MODULE(MP_QSTR_os, mp_module_os); diff --git a/ports/renesas-ra/moduos.c b/ports/renesas-ra/moduos.c index 6f524f119f..e6aadd9ebc 100644 --- a/ports/renesas-ra/moduos.c +++ b/ports/renesas-ra/moduos.c @@ -28,12 +28,12 @@ #include "py/runtime.h" #include "uart.h" -bool mp_uos_dupterm_is_builtin_stream(mp_const_obj_t stream) { +bool mp_os_dupterm_is_builtin_stream(mp_const_obj_t stream) { const mp_obj_type_t *type = mp_obj_get_type(stream); return type == &machine_uart_type; } -void mp_uos_dupterm_stream_detached_attached(mp_obj_t stream_detached, mp_obj_t stream_attached) { +void mp_os_dupterm_stream_detached_attached(mp_obj_t stream_detached, mp_obj_t stream_attached) { if (mp_obj_get_type(stream_detached) == &machine_uart_type) { uart_attach_to_repl(MP_OBJ_TO_PTR(stream_detached), false); } diff --git a/ports/renesas-ra/modutime.c b/ports/renesas-ra/modutime.c index 49dcfd589d..1ab51e336d 100644 --- a/ports/renesas-ra/modutime.c +++ b/ports/renesas-ra/modutime.c @@ -29,7 +29,7 @@ #include "rtc.h" // Return the localtime as an 8-tuple. -STATIC mp_obj_t mp_utime_localtime_get(void) { +STATIC mp_obj_t mp_time_localtime_get(void) { // get current date and time rtc_init_finalise(); ra_rtc_t time; @@ -48,7 +48,7 @@ STATIC mp_obj_t mp_utime_localtime_get(void) { } // Returns the number of seconds, as an integer, since the Epoch. -STATIC mp_obj_t mp_utime_time_get(void) { +STATIC mp_obj_t mp_time_time_get(void) { // get date and time rtc_init_finalise(); ra_rtc_t time; diff --git a/ports/renesas-ra/mphalport.c b/ports/renesas-ra/mphalport.c index 6e6a83aa26..b35ab75714 100644 --- a/ports/renesas-ra/mphalport.c +++ b/ports/renesas-ra/mphalport.c @@ -54,7 +54,7 @@ MP_WEAK uintptr_t mp_hal_stdio_poll(uintptr_t poll_flags) { const mp_stream_p_t *stream_p = mp_get_stream(pyb_stdio_uart); ret = stream_p->ioctl(pyb_stdio_uart, MP_STREAM_POLL, poll_flags, &errcode); } - return ret | mp_uos_dupterm_poll(poll_flags); + return ret | mp_os_dupterm_poll(poll_flags); } #if MICROPY_HW_ENABLE_INTERNAL_FLASH_STORAGE @@ -69,7 +69,7 @@ MP_WEAK int mp_hal_stdin_rx_chr(void) { if (MP_STATE_PORT(pyb_stdio_uart) != NULL && uart_rx_any(MP_STATE_PORT(pyb_stdio_uart))) { return uart_rx_char(MP_STATE_PORT(pyb_stdio_uart)); } - int dupterm_c = mp_uos_dupterm_rx_chr(); + int dupterm_c = mp_os_dupterm_rx_chr(); if (dupterm_c >= 0) { return dupterm_c; } @@ -81,7 +81,7 @@ MP_WEAK void mp_hal_stdout_tx_strn(const char *str, size_t len) { if (MP_STATE_PORT(pyb_stdio_uart) != NULL) { uart_tx_strn(MP_STATE_PORT(pyb_stdio_uart), str, len); } - mp_uos_dupterm_tx_strn(str, len); + mp_os_dupterm_tx_strn(str, len); } void mp_hal_ticks_cpu_enable(void) { diff --git a/ports/rp2/moduos.c b/ports/rp2/moduos.c index 398ec28d92..77f980a731 100644 --- a/ports/rp2/moduos.c +++ b/ports/rp2/moduos.c @@ -28,7 +28,7 @@ uint8_t rosc_random_u8(size_t cycles); -STATIC mp_obj_t mp_uos_urandom(mp_obj_t num) { +STATIC mp_obj_t mp_os_urandom(mp_obj_t num) { mp_int_t n = mp_obj_get_int(num); vstr_t vstr; vstr_init_len(&vstr, n); @@ -37,4 +37,4 @@ STATIC mp_obj_t mp_uos_urandom(mp_obj_t num) { } return mp_obj_new_bytes_from_vstr(&vstr); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_uos_urandom_obj, mp_uos_urandom); +STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_os_urandom_obj, mp_os_urandom); diff --git a/ports/rp2/modutime.c b/ports/rp2/modutime.c index 9859295d1a..b4120be7c3 100644 --- a/ports/rp2/modutime.c +++ b/ports/rp2/modutime.c @@ -29,7 +29,7 @@ #include "hardware/rtc.h" // Return the localtime as an 8-tuple. -STATIC mp_obj_t mp_utime_localtime_get(void) { +STATIC mp_obj_t mp_time_localtime_get(void) { datetime_t t; rtc_get_datetime(&t); mp_obj_t tuple[8] = { @@ -46,7 +46,7 @@ STATIC mp_obj_t mp_utime_localtime_get(void) { } // Return the number of seconds since the Epoch. -STATIC mp_obj_t mp_utime_time_get(void) { +STATIC mp_obj_t mp_time_time_get(void) { datetime_t t; rtc_get_datetime(&t); return mp_obj_new_int_from_ull(timeutils_seconds_since_epoch(t.year, t.month, t.day, t.hour, t.min, t.sec)); diff --git a/ports/rp2/mphalport.c b/ports/rp2/mphalport.c index 84a34b2a40..52d55198b7 100644 --- a/ports/rp2/mphalport.c +++ b/ports/rp2/mphalport.c @@ -109,7 +109,7 @@ uintptr_t mp_hal_stdio_poll(uintptr_t poll_flags) { } #endif #if MICROPY_PY_OS_DUPTERM - ret |= mp_uos_dupterm_poll(poll_flags); + ret |= mp_os_dupterm_poll(poll_flags); #endif return ret; } @@ -126,7 +126,7 @@ int mp_hal_stdin_rx_chr(void) { return c; } #if MICROPY_PY_OS_DUPTERM - int dupterm_c = mp_uos_dupterm_rx_chr(); + int dupterm_c = mp_os_dupterm_rx_chr(); if (dupterm_c >= 0) { return dupterm_c; } @@ -164,7 +164,7 @@ void mp_hal_stdout_tx_strn(const char *str, mp_uint_t len) { #endif #if MICROPY_PY_OS_DUPTERM - mp_uos_dupterm_tx_strn(str, len); + mp_os_dupterm_tx_strn(str, len); #endif } diff --git a/ports/samd/moduos.c b/ports/samd/moduos.c index 3404919d24..4438bf3c7b 100644 --- a/ports/samd/moduos.c +++ b/ports/samd/moduos.c @@ -70,7 +70,7 @@ uint32_t trng_random_u32(int delay) { #endif #if MICROPY_PY_UOS_URANDOM -STATIC mp_obj_t mp_uos_urandom(mp_obj_t num) { +STATIC mp_obj_t mp_os_urandom(mp_obj_t num) { mp_int_t n = mp_obj_get_int(num); vstr_t vstr; vstr_init_len(&vstr, n); @@ -86,22 +86,22 @@ STATIC mp_obj_t mp_uos_urandom(mp_obj_t num) { } return mp_obj_new_bytes_from_vstr(&vstr); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_uos_urandom_obj, mp_uos_urandom); +STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_os_urandom_obj, mp_os_urandom); #endif // MICROPY_PY_UOS_URANDOM #if MICROPY_PY_UOS_DUPTERM_BUILTIN_STREAM -bool mp_uos_dupterm_is_builtin_stream(mp_const_obj_t stream) { +bool mp_os_dupterm_is_builtin_stream(mp_const_obj_t stream) { const mp_obj_type_t *type = mp_obj_get_type(stream); return type == &machine_uart_type; } #endif #if MICROPY_PY_UOS_DUPTERM_NOTIFY -STATIC mp_obj_t mp_uos_dupterm_notify(mp_obj_t obj_in) { +STATIC mp_obj_t mp_os_dupterm_notify(mp_obj_t obj_in) { (void)obj_in; for (;;) { - int c = mp_uos_dupterm_rx_chr(); + int c = mp_os_dupterm_rx_chr(); if (c < 0) { break; } @@ -109,5 +109,5 @@ STATIC mp_obj_t mp_uos_dupterm_notify(mp_obj_t obj_in) { } return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_uos_dupterm_notify_obj, mp_uos_dupterm_notify); +STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_os_dupterm_notify_obj, mp_os_dupterm_notify); #endif diff --git a/ports/samd/modutime.c b/ports/samd/modutime.c index db90a22822..aa5bd33609 100644 --- a/ports/samd/modutime.c +++ b/ports/samd/modutime.c @@ -29,7 +29,7 @@ #include "modmachine.h" // Return the localtime as an 8-tuple. -STATIC mp_obj_t mp_utime_localtime_get(void) { +STATIC mp_obj_t mp_time_localtime_get(void) { timeutils_struct_time_t tm; rtc_gettime(&tm); tm.tm_wday = timeutils_calc_weekday(tm.tm_year, tm.tm_mon, tm.tm_mday); @@ -48,7 +48,7 @@ STATIC mp_obj_t mp_utime_localtime_get(void) { } // Returns the number of seconds, as an integer, since the Epoch. -STATIC mp_obj_t mp_utime_time_get(void) { +STATIC mp_obj_t mp_time_time_get(void) { timeutils_struct_time_t tm; rtc_gettime(&tm); return mp_obj_new_int_from_uint(timeutils_mktime( diff --git a/ports/samd/mphalport.c b/ports/samd/mphalport.c index 3dc6b70a8d..dc38ea2964 100644 --- a/ports/samd/mphalport.c +++ b/ports/samd/mphalport.c @@ -167,7 +167,7 @@ uintptr_t mp_hal_stdio_poll(uintptr_t poll_flags) { } #if MICROPY_PY_OS_DUPTERM - ret |= mp_uos_dupterm_poll(poll_flags); + ret |= mp_os_dupterm_poll(poll_flags); #endif return ret; } @@ -182,7 +182,7 @@ int mp_hal_stdin_rx_chr(void) { } #if MICROPY_PY_OS_DUPTERM - int dupterm_c = mp_uos_dupterm_rx_chr(); + int dupterm_c = mp_os_dupterm_rx_chr(); if (dupterm_c >= 0) { return dupterm_c; } @@ -212,6 +212,6 @@ void mp_hal_stdout_tx_strn(const char *str, mp_uint_t len) { } } #if MICROPY_PY_OS_DUPTERM - mp_uos_dupterm_tx_strn(str, len); + mp_os_dupterm_tx_strn(str, len); #endif } diff --git a/ports/stm32/modpyb.c b/ports/stm32/modpyb.c index b148898f16..88eafafb0a 100644 --- a/ports/stm32/modpyb.c +++ b/ports/stm32/modpyb.c @@ -178,13 +178,13 @@ STATIC const mp_rom_map_elem_t pyb_module_globals_table[] = { #endif #if MICROPY_PY_PYB_LEGACY - { MP_ROM_QSTR(MP_QSTR_millis), MP_ROM_PTR(&mp_utime_ticks_ms_obj) }, + { MP_ROM_QSTR(MP_QSTR_millis), MP_ROM_PTR(&mp_time_ticks_ms_obj) }, { MP_ROM_QSTR(MP_QSTR_elapsed_millis), MP_ROM_PTR(&pyb_elapsed_millis_obj) }, - { MP_ROM_QSTR(MP_QSTR_micros), MP_ROM_PTR(&mp_utime_ticks_us_obj) }, + { MP_ROM_QSTR(MP_QSTR_micros), MP_ROM_PTR(&mp_time_ticks_us_obj) }, { MP_ROM_QSTR(MP_QSTR_elapsed_micros), MP_ROM_PTR(&pyb_elapsed_micros_obj) }, - { MP_ROM_QSTR(MP_QSTR_delay), MP_ROM_PTR(&mp_utime_sleep_ms_obj) }, - { MP_ROM_QSTR(MP_QSTR_udelay), MP_ROM_PTR(&mp_utime_sleep_us_obj) }, - { MP_ROM_QSTR(MP_QSTR_sync), MP_ROM_PTR(&mp_uos_sync_obj) }, + { MP_ROM_QSTR(MP_QSTR_delay), MP_ROM_PTR(&mp_time_sleep_ms_obj) }, + { MP_ROM_QSTR(MP_QSTR_udelay), MP_ROM_PTR(&mp_time_sleep_us_obj) }, + { MP_ROM_QSTR(MP_QSTR_sync), MP_ROM_PTR(&mp_os_sync_obj) }, { MP_ROM_QSTR(MP_QSTR_mount), MP_ROM_PTR(&mp_vfs_mount_obj) }, #endif diff --git a/ports/stm32/moduos.c b/ports/stm32/moduos.c index 1f41e68bde..bfbb868e2f 100644 --- a/ports/stm32/moduos.c +++ b/ports/stm32/moduos.c @@ -33,7 +33,7 @@ // urandom(n) // Return a bytes object with n random bytes, generated by the hardware // random number generator. -STATIC mp_obj_t mp_uos_urandom(mp_obj_t num) { +STATIC mp_obj_t mp_os_urandom(mp_obj_t num) { mp_int_t n = mp_obj_get_int(num); vstr_t vstr; vstr_init_len(&vstr, n); @@ -42,10 +42,10 @@ STATIC mp_obj_t mp_uos_urandom(mp_obj_t num) { } return mp_obj_new_bytes_from_vstr(&vstr); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_uos_urandom_obj, mp_uos_urandom); +STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_os_urandom_obj, mp_os_urandom); #endif -bool mp_uos_dupterm_is_builtin_stream(mp_const_obj_t stream) { +bool mp_os_dupterm_is_builtin_stream(mp_const_obj_t stream) { const mp_obj_type_t *type = mp_obj_get_type(stream); return type == &pyb_uart_type #if MICROPY_HW_ENABLE_USB @@ -54,7 +54,7 @@ bool mp_uos_dupterm_is_builtin_stream(mp_const_obj_t stream) { ; } -void mp_uos_dupterm_stream_detached_attached(mp_obj_t stream_detached, mp_obj_t stream_attached) { +void mp_os_dupterm_stream_detached_attached(mp_obj_t stream_detached, mp_obj_t stream_attached) { if (mp_obj_get_type(stream_detached) == &pyb_uart_type) { uart_attach_to_repl(MP_OBJ_TO_PTR(stream_detached), false); } diff --git a/ports/stm32/modutime.c b/ports/stm32/modutime.c index 4eda59f81e..e7160cd5b2 100644 --- a/ports/stm32/modutime.c +++ b/ports/stm32/modutime.c @@ -29,7 +29,7 @@ #include "rtc.h" // Return the localtime as an 8-tuple. -STATIC mp_obj_t mp_utime_localtime_get(void) { +STATIC mp_obj_t mp_time_localtime_get(void) { // get current date and time // note: need to call get time then get date to correctly access the registers rtc_init_finalise(); @@ -51,7 +51,7 @@ STATIC mp_obj_t mp_utime_localtime_get(void) { } // Returns the number of seconds, as an integer, since 1/1/2000. -STATIC mp_obj_t mp_utime_time_get(void) { +STATIC mp_obj_t mp_time_time_get(void) { // get date and time // note: need to call get time then get date to correctly access the registers rtc_init_finalise(); diff --git a/ports/stm32/mphalport.c b/ports/stm32/mphalport.c index 092d63e1bb..727517f5bd 100644 --- a/ports/stm32/mphalport.c +++ b/ports/stm32/mphalport.c @@ -28,7 +28,7 @@ MP_WEAK uintptr_t mp_hal_stdio_poll(uintptr_t poll_flags) { const mp_stream_p_t *stream_p = mp_get_stream(pyb_stdio_uart); ret = stream_p->ioctl(pyb_stdio_uart, MP_STREAM_POLL, poll_flags, &errcode); } - return ret | mp_uos_dupterm_poll(poll_flags); + return ret | mp_os_dupterm_poll(poll_flags); } MP_WEAK int mp_hal_stdin_rx_chr(void) { @@ -45,7 +45,7 @@ MP_WEAK int mp_hal_stdin_rx_chr(void) { if (MP_STATE_PORT(pyb_stdio_uart) != NULL && uart_rx_any(MP_STATE_PORT(pyb_stdio_uart))) { return uart_rx_char(MP_STATE_PORT(pyb_stdio_uart)); } - int dupterm_c = mp_uos_dupterm_rx_chr(); + int dupterm_c = mp_os_dupterm_rx_chr(); if (dupterm_c >= 0) { return dupterm_c; } @@ -60,7 +60,7 @@ MP_WEAK void mp_hal_stdout_tx_strn(const char *str, size_t len) { #if 0 && defined(USE_HOST_MODE) && MICROPY_HW_HAS_LCD lcd_print_strn(str, len); #endif - mp_uos_dupterm_tx_strn(str, len); + mp_os_dupterm_tx_strn(str, len); } #if __CORTEX_M >= 0x03 diff --git a/ports/stm32/portmodules.h b/ports/stm32/portmodules.h index f6edef3987..87f97f3170 100644 --- a/ports/stm32/portmodules.h +++ b/ports/stm32/portmodules.h @@ -28,13 +28,13 @@ extern const mp_obj_module_t pyb_module; extern const mp_obj_module_t stm_module; -extern const mp_obj_module_t mp_module_usocket; +extern const mp_obj_module_t mp_module_socket; // additional helper functions exported by the modules MP_DECLARE_CONST_FUN_OBJ_1(time_sleep_ms_obj); MP_DECLARE_CONST_FUN_OBJ_1(time_sleep_us_obj); -MP_DECLARE_CONST_FUN_OBJ_0(mp_uos_sync_obj); +MP_DECLARE_CONST_FUN_OBJ_0(mp_os_sync_obj); #endif // MICROPY_INCLUDED_STM32_PORTMODULES_H diff --git a/ports/unix/main.c b/ports/unix/main.c index fc0f6da7b8..392ce59dde 100644 --- a/ports/unix/main.c +++ b/ports/unix/main.c @@ -73,7 +73,7 @@ STATIC void stderr_print_strn(void *env, const char *str, size_t len) { (void)env; ssize_t ret; MP_HAL_RETRY_SYSCALL(ret, write(STDERR_FILENO, str, len), {}); - mp_uos_dupterm_tx_strn(str, len); + mp_os_dupterm_tx_strn(str, len); } const mp_print_t mp_stderr_print = {NULL, stderr_print_strn}; diff --git a/ports/unix/moduos.c b/ports/unix/moduos.c index e44ceb677b..1d5e2afef4 100644 --- a/ports/unix/moduos.c +++ b/ports/unix/moduos.c @@ -32,7 +32,7 @@ #include "py/runtime.h" #include "py/mphal.h" -STATIC mp_obj_t mp_uos_getenv(size_t n_args, const mp_obj_t *args) { +STATIC mp_obj_t mp_os_getenv(size_t n_args, const mp_obj_t *args) { const char *s = getenv(mp_obj_str_get_str(args[0])); if (s == NULL) { if (n_args == 2) { @@ -42,9 +42,9 @@ STATIC mp_obj_t mp_uos_getenv(size_t n_args, const mp_obj_t *args) { } return mp_obj_new_str(s, strlen(s)); } -STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_uos_getenv_obj, 1, 2, mp_uos_getenv); +STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_os_getenv_obj, 1, 2, mp_os_getenv); -STATIC mp_obj_t mp_uos_putenv(mp_obj_t key_in, mp_obj_t value_in) { +STATIC mp_obj_t mp_os_putenv(mp_obj_t key_in, mp_obj_t value_in) { const char *key = mp_obj_str_get_str(key_in); const char *value = mp_obj_str_get_str(value_in); int ret; @@ -60,9 +60,9 @@ STATIC mp_obj_t mp_uos_putenv(mp_obj_t key_in, mp_obj_t value_in) { } return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_2(mp_uos_putenv_obj, mp_uos_putenv); +STATIC MP_DEFINE_CONST_FUN_OBJ_2(mp_os_putenv_obj, mp_os_putenv); -STATIC mp_obj_t mp_uos_unsetenv(mp_obj_t key_in) { +STATIC mp_obj_t mp_os_unsetenv(mp_obj_t key_in) { const char *key = mp_obj_str_get_str(key_in); int ret; @@ -77,9 +77,9 @@ STATIC mp_obj_t mp_uos_unsetenv(mp_obj_t key_in) { } return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_uos_unsetenv_obj, mp_uos_unsetenv); +STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_os_unsetenv_obj, mp_os_unsetenv); -STATIC mp_obj_t mp_uos_system(mp_obj_t cmd_in) { +STATIC mp_obj_t mp_os_system(mp_obj_t cmd_in) { const char *cmd = mp_obj_str_get_str(cmd_in); MP_THREAD_GIL_EXIT(); @@ -90,18 +90,18 @@ STATIC mp_obj_t mp_uos_system(mp_obj_t cmd_in) { return MP_OBJ_NEW_SMALL_INT(r); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_uos_system_obj, mp_uos_system); +STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_os_system_obj, mp_os_system); -STATIC mp_obj_t mp_uos_urandom(mp_obj_t num) { +STATIC mp_obj_t mp_os_urandom(mp_obj_t num) { mp_int_t n = mp_obj_get_int(num); vstr_t vstr; vstr_init_len(&vstr, n); mp_hal_get_random(n, vstr.buf); return mp_obj_new_bytes_from_vstr(&vstr); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_uos_urandom_obj, mp_uos_urandom); +STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_os_urandom_obj, mp_os_urandom); -STATIC mp_obj_t mp_uos_errno(size_t n_args, const mp_obj_t *args) { +STATIC mp_obj_t mp_os_errno(size_t n_args, const mp_obj_t *args) { if (n_args == 0) { return MP_OBJ_NEW_SMALL_INT(errno); } @@ -109,4 +109,4 @@ STATIC mp_obj_t mp_uos_errno(size_t n_args, const mp_obj_t *args) { errno = mp_obj_get_int(args[0]); return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_uos_errno_obj, 0, 1, mp_uos_errno); +STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_os_errno_obj, 0, 1, mp_os_errno); diff --git a/ports/unix/moduselect.c b/ports/unix/moduselect.c index 9b205d333f..9f7f452a12 100644 --- a/ports/unix/moduselect.c +++ b/ports/unix/moduselect.c @@ -346,11 +346,11 @@ STATIC const mp_rom_map_elem_t mp_module_select_globals_table[] = { STATIC MP_DEFINE_CONST_DICT(mp_module_select_globals, mp_module_select_globals_table); -const mp_obj_module_t mp_module_uselect = { +const mp_obj_module_t mp_module_select = { .base = { &mp_type_module }, .globals = (mp_obj_dict_t *)&mp_module_select_globals, }; -MP_REGISTER_MODULE(MP_QSTR_select, mp_module_uselect); +MP_REGISTER_MODULE(MP_QSTR_select, mp_module_select); #endif // MICROPY_PY_USELECT_POSIX diff --git a/ports/unix/modutime.c b/ports/unix/modutime.c index dade99295d..26c2fbdb90 100644 --- a/ports/unix/modutime.c +++ b/ports/unix/modutime.c @@ -61,7 +61,7 @@ static inline int msec_sleep_tv(struct timeval *tv) { #error Unsupported clock() implementation #endif -STATIC mp_obj_t mp_utime_time_get(void) { +STATIC mp_obj_t mp_time_time_get(void) { #if MICROPY_PY_BUILTINS_FLOAT && MICROPY_FLOAT_IMPL == MICROPY_FLOAT_IMPL_DOUBLE struct timeval tv; gettimeofday(&tv, NULL); @@ -85,7 +85,7 @@ STATIC mp_obj_t mod_time_clock(void) { } STATIC MP_DEFINE_CONST_FUN_OBJ_0(mod_time_clock_obj, mod_time_clock); -STATIC mp_obj_t mp_utime_sleep(mp_obj_t arg) { +STATIC mp_obj_t mp_time_sleep(mp_obj_t arg) { #if MICROPY_PY_BUILTINS_FLOAT struct timeval tv; mp_float_t val = mp_obj_get_float(arg); diff --git a/ports/unix/mpconfigport.h b/ports/unix/mpconfigport.h index 8eafb6119b..0588e100d6 100644 --- a/ports/unix/mpconfigport.h +++ b/ports/unix/mpconfigport.h @@ -184,7 +184,7 @@ void mp_unix_mark_exec(void); #ifdef MICROPY_PY_URANDOM_SEED_INIT_FUNC #include void mp_hal_get_random(size_t n, void *buf); -static inline unsigned long mp_urandom_seed_init(void) { +static inline unsigned long mp_random_seed_init(void) { unsigned long r; mp_hal_get_random(sizeof(r), &r); return r; diff --git a/ports/unix/unix_mphal.c b/ports/unix/unix_mphal.c index 6f2def8903..5478b69ad4 100644 --- a/ports/unix/unix_mphal.c +++ b/ports/unix/unix_mphal.c @@ -187,7 +187,7 @@ main_term:; void mp_hal_stdout_tx_strn(const char *str, size_t len) { ssize_t ret; MP_HAL_RETRY_SYSCALL(ret, write(STDOUT_FILENO, str, len), {}); - mp_uos_dupterm_tx_strn(str, len); + mp_os_dupterm_tx_strn(str, len); } // cooked is same as uncooked because the terminal does some postprocessing diff --git a/ports/unix/variants/mpconfigvariant_common.h b/ports/unix/variants/mpconfigvariant_common.h index e4e0c0c5d3..9a8a524a22 100644 --- a/ports/unix/variants/mpconfigvariant_common.h +++ b/ports/unix/variants/mpconfigvariant_common.h @@ -58,7 +58,7 @@ #endif // Seed random on import. -#define MICROPY_PY_URANDOM_SEED_INIT_FUNC (mp_urandom_seed_init()) +#define MICROPY_PY_URANDOM_SEED_INIT_FUNC (mp_random_seed_init()) // Allow exception details in low-memory conditions. #define MICROPY_ENABLE_EMERGENCY_EXCEPTION_BUF (1) diff --git a/ports/zephyr/modusocket.c b/ports/zephyr/modusocket.c index 98dff7e8e8..c3356189ab 100644 --- a/ports/zephyr/modusocket.c +++ b/ports/zephyr/modusocket.c @@ -448,7 +448,7 @@ STATIC mp_obj_t pkt_get_info(void) { } STATIC MP_DEFINE_CONST_FUN_OBJ_0(pkt_get_info_obj, pkt_get_info); -STATIC const mp_rom_map_elem_t mp_module_usocket_globals_table[] = { +STATIC const mp_rom_map_elem_t mp_module_socket_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_socket) }, // objects { MP_ROM_QSTR(MP_QSTR_socket), MP_ROM_PTR(&socket_type) }, @@ -466,13 +466,13 @@ STATIC const mp_rom_map_elem_t mp_module_usocket_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_pkt_get_info), MP_ROM_PTR(&pkt_get_info_obj) }, }; -STATIC MP_DEFINE_CONST_DICT(mp_module_usocket_globals, mp_module_usocket_globals_table); +STATIC MP_DEFINE_CONST_DICT(mp_module_socket_globals, mp_module_socket_globals_table); -const mp_obj_module_t mp_module_usocket = { +const mp_obj_module_t mp_module_socket = { .base = { &mp_type_module }, - .globals = (mp_obj_dict_t *)&mp_module_usocket_globals, + .globals = (mp_obj_dict_t *)&mp_module_socket_globals, }; -MP_REGISTER_MODULE(MP_QSTR_socket, mp_module_usocket); +MP_REGISTER_MODULE(MP_QSTR_socket, mp_module_socket); #endif // MICROPY_PY_USOCKET diff --git a/ports/zephyr/modutime.c b/ports/zephyr/modutime.c index c02460ba01..65ba1e6e69 100644 --- a/ports/zephyr/modutime.c +++ b/ports/zephyr/modutime.c @@ -29,7 +29,7 @@ #include "py/obj.h" -STATIC mp_obj_t mp_utime_time_get(void) { +STATIC mp_obj_t mp_time_time_get(void) { /* The absence of FP support is deliberate. The Zephyr port uses * single precision floats so the fraction component will start to * lose precision on devices with a long uptime. diff --git a/py/builtin.h b/py/builtin.h index 7232142b77..81d0789802 100644 --- a/py/builtin.h +++ b/py/builtin.h @@ -133,7 +133,7 @@ extern const mp_obj_module_t mp_module_builtins; extern const mp_obj_module_t mp_module_sys; // Modules needed by the parser when MICROPY_COMP_MODULE_CONST is enabled. -extern const mp_obj_module_t mp_module_uerrno; +extern const mp_obj_module_t mp_module_errno; extern const mp_obj_module_t mp_module_uctypes; extern const mp_obj_module_t mp_module_machine; diff --git a/py/modarray.c b/py/modarray.c index c91e92f798..cfed0fbb59 100644 --- a/py/modarray.c +++ b/py/modarray.c @@ -35,11 +35,11 @@ STATIC const mp_rom_map_elem_t mp_module_array_globals_table[] = { STATIC MP_DEFINE_CONST_DICT(mp_module_array_globals, mp_module_array_globals_table); -const mp_obj_module_t mp_module_uarray = { +const mp_obj_module_t mp_module_array = { .base = { &mp_type_module }, .globals = (mp_obj_dict_t *)&mp_module_array_globals, }; -MP_REGISTER_MODULE(MP_QSTR_array, mp_module_uarray); +MP_REGISTER_MODULE(MP_QSTR_array, mp_module_array); #endif diff --git a/py/modstruct.c b/py/modstruct.c index 78c7d53e4b..e908c73e1d 100644 --- a/py/modstruct.c +++ b/py/modstruct.c @@ -261,11 +261,11 @@ STATIC const mp_rom_map_elem_t mp_module_struct_globals_table[] = { STATIC MP_DEFINE_CONST_DICT(mp_module_struct_globals, mp_module_struct_globals_table); -const mp_obj_module_t mp_module_ustruct = { +const mp_obj_module_t mp_module_struct = { .base = { &mp_type_module }, .globals = (mp_obj_dict_t *)&mp_module_struct_globals, }; -MP_REGISTER_MODULE(MP_QSTR_struct, mp_module_ustruct); +MP_REGISTER_MODULE(MP_QSTR_struct, mp_module_struct); #endif diff --git a/py/moduerrno.c b/py/moduerrno.c index e197f921e1..ed172ae4d6 100644 --- a/py/moduerrno.c +++ b/py/moduerrno.c @@ -81,7 +81,7 @@ STATIC const mp_obj_dict_t errorcode_dict = { }; #endif -STATIC const mp_rom_map_elem_t mp_module_uerrno_globals_table[] = { +STATIC const mp_rom_map_elem_t mp_module_errno_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_errno) }, #if MICROPY_PY_UERRNO_ERRORCODE { MP_ROM_QSTR(MP_QSTR_errorcode), MP_ROM_PTR(&errorcode_dict) }, @@ -92,14 +92,14 @@ STATIC const mp_rom_map_elem_t mp_module_uerrno_globals_table[] = { #undef X }; -STATIC MP_DEFINE_CONST_DICT(mp_module_uerrno_globals, mp_module_uerrno_globals_table); +STATIC MP_DEFINE_CONST_DICT(mp_module_errno_globals, mp_module_errno_globals_table); -const mp_obj_module_t mp_module_uerrno = { +const mp_obj_module_t mp_module_errno = { .base = { &mp_type_module }, - .globals = (mp_obj_dict_t *)&mp_module_uerrno_globals, + .globals = (mp_obj_dict_t *)&mp_module_errno_globals, }; -MP_REGISTER_MODULE(MP_QSTR_errno, mp_module_uerrno); +MP_REGISTER_MODULE(MP_QSTR_errno, mp_module_errno); qstr mp_errno_to_str(mp_obj_t errno_val) { #if MICROPY_PY_UERRNO_ERRORCODE @@ -112,9 +112,9 @@ qstr mp_errno_to_str(mp_obj_t errno_val) { } #else // We don't have the errorcode dict so do a simple search in the modules dict - for (size_t i = 0; i < MP_ARRAY_SIZE(mp_module_uerrno_globals_table); ++i) { - if (errno_val == mp_module_uerrno_globals_table[i].value) { - return MP_OBJ_QSTR_VALUE(mp_module_uerrno_globals_table[i].key); + for (size_t i = 0; i < MP_ARRAY_SIZE(mp_module_errno_globals_table); ++i) { + if (errno_val == mp_module_errno_globals_table[i].value) { + return MP_OBJ_QSTR_VALUE(mp_module_errno_globals_table[i].key); } } return MP_QSTRnull; diff --git a/py/parse.c b/py/parse.c index 86198224fd..a271aa0ea3 100644 --- a/py/parse.c +++ b/py/parse.c @@ -637,7 +637,7 @@ STATIC void push_result_token(parser_t *parser, uint8_t rule_id) { #if MICROPY_COMP_MODULE_CONST STATIC const mp_rom_map_elem_t mp_constants_table[] = { #if MICROPY_PY_UERRNO - { MP_ROM_QSTR(MP_QSTR_errno), MP_ROM_PTR(&mp_module_uerrno) }, + { MP_ROM_QSTR(MP_QSTR_errno), MP_ROM_PTR(&mp_module_errno) }, #endif #if MICROPY_PY_UCTYPES { MP_ROM_QSTR(MP_QSTR_uctypes), MP_ROM_PTR(&mp_module_uctypes) },