From 2eb844e0b4e649034115dd6ca77dcdecd92ef547 Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Fri, 18 Dec 2015 02:35:33 +0200 Subject: [PATCH] ports: Rename "machine" module to "umachine". To let unix port implement "machine" functionality on Python level, and keep consistent naming in other ports (baremetal ports will use magic module "symlinking" to still load it on "import machine"). Fixes #1701. --- cc3200/mods/modmachine.c | 4 ++-- cc3200/mpconfigport.h | 4 ++-- cc3200/qstrdefsport.h | 2 +- py/qstrdefs.h | 2 +- stmhal/modmachine.c | 4 ++-- stmhal/mpconfigport.h | 4 ++-- stmhal/qstrdefsport.h | 2 +- unix/modmachine.c | 4 ++-- unix/mpconfigport.h | 2 +- 9 files changed, 14 insertions(+), 14 deletions(-) diff --git a/cc3200/mods/modmachine.c b/cc3200/mods/modmachine.c index ed24951a60..704defb337 100644 --- a/cc3200/mods/modmachine.c +++ b/cc3200/mods/modmachine.c @@ -165,7 +165,7 @@ STATIC mp_obj_t machine_wake_reason (void) { STATIC MP_DEFINE_CONST_FUN_OBJ_0(machine_wake_reason_obj, machine_wake_reason); STATIC const mp_map_elem_t machine_module_globals_table[] = { - { MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_machine) }, + { MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_umachine) }, { MP_OBJ_NEW_QSTR(MP_QSTR_reset), (mp_obj_t)&machine_reset_obj }, #ifdef DEBUG @@ -212,6 +212,6 @@ STATIC MP_DEFINE_CONST_DICT(machine_module_globals, machine_module_globals_table const mp_obj_module_t machine_module = { .base = { &mp_type_module }, - .name = MP_QSTR_machine, + .name = MP_QSTR_umachine, .globals = (mp_obj_dict_t*)&machine_module_globals, }; diff --git a/cc3200/mpconfigport.h b/cc3200/mpconfigport.h index 28c29cf358..83f3aaf75c 100644 --- a/cc3200/mpconfigport.h +++ b/cc3200/mpconfigport.h @@ -134,7 +134,7 @@ extern const struct _mp_obj_module_t mp_module_ubinascii; extern const struct _mp_obj_module_t mp_module_ussl; #define MICROPY_PORT_BUILTIN_MODULES \ - { MP_OBJ_NEW_QSTR(MP_QSTR_machine), (mp_obj_t)&machine_module }, \ + { MP_OBJ_NEW_QSTR(MP_QSTR_umachine), (mp_obj_t)&machine_module }, \ { MP_OBJ_NEW_QSTR(MP_QSTR_wipy), (mp_obj_t)&wipy_module }, \ { MP_OBJ_NEW_QSTR(MP_QSTR_uos), (mp_obj_t)&mp_module_uos }, \ { MP_OBJ_NEW_QSTR(MP_QSTR_utime), (mp_obj_t)&mp_module_utime }, \ @@ -157,7 +157,7 @@ extern const struct _mp_obj_module_t mp_module_ussl; // extra constants #define MICROPY_PORT_CONSTANTS \ - { MP_OBJ_NEW_QSTR(MP_QSTR_machine), (mp_obj_t)&machine_module }, \ + { MP_OBJ_NEW_QSTR(MP_QSTR_umachine), (mp_obj_t)&machine_module }, \ // vm state and root pointers for the gc #define MP_STATE_PORT MP_STATE_VM diff --git a/cc3200/qstrdefsport.h b/cc3200/qstrdefsport.h index d88c05a0f7..cf460dfdc0 100644 --- a/cc3200/qstrdefsport.h +++ b/cc3200/qstrdefsport.h @@ -26,7 +26,7 @@ */ // for machine module -Q(machine) +Q(umachine) #ifdef DEBUG Q(info) #endif diff --git a/py/qstrdefs.h b/py/qstrdefs.h index c515450b9a..4df444d5f3 100644 --- a/py/qstrdefs.h +++ b/py/qstrdefs.h @@ -613,7 +613,7 @@ Q(b2a_base64) #endif #if MICROPY_PY_MACHINE -Q(machine) +Q(umachine) Q(mem) Q(mem8) Q(mem16) diff --git a/stmhal/modmachine.c b/stmhal/modmachine.c index 7b2c1b6851..e9a4613909 100644 --- a/stmhal/modmachine.c +++ b/stmhal/modmachine.c @@ -419,7 +419,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_0(machine_reset_cause_obj, machine_reset_cause); #endif STATIC const mp_map_elem_t machine_module_globals_table[] = { - { MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_machine) }, + { MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_umachine) }, { MP_OBJ_NEW_QSTR(MP_QSTR_info), (mp_obj_t)&machine_info_obj }, { MP_OBJ_NEW_QSTR(MP_QSTR_unique_id), (mp_obj_t)&machine_unique_id_obj }, { MP_OBJ_NEW_QSTR(MP_QSTR_reset), (mp_obj_t)&machine_reset_obj }, @@ -475,7 +475,7 @@ STATIC MP_DEFINE_CONST_DICT(machine_module_globals, machine_module_globals_table const mp_obj_module_t machine_module = { .base = { &mp_type_module }, - .name = MP_QSTR_machine, + .name = MP_QSTR_umachine, .globals = (mp_obj_dict_t*)&machine_module_globals, }; diff --git a/stmhal/mpconfigport.h b/stmhal/mpconfigport.h index b8d992c6f0..3f5caeca98 100644 --- a/stmhal/mpconfigport.h +++ b/stmhal/mpconfigport.h @@ -115,7 +115,7 @@ extern const struct _mp_obj_module_t mp_module_usocket; extern const struct _mp_obj_module_t mp_module_network; #define MICROPY_PORT_BUILTIN_MODULES \ - { MP_OBJ_NEW_QSTR(MP_QSTR_machine), (mp_obj_t)&machine_module }, \ + { MP_OBJ_NEW_QSTR(MP_QSTR_umachine), (mp_obj_t)&machine_module }, \ { MP_OBJ_NEW_QSTR(MP_QSTR_pyb), (mp_obj_t)&pyb_module }, \ { MP_OBJ_NEW_QSTR(MP_QSTR_stm), (mp_obj_t)&stm_module }, \ { MP_OBJ_NEW_QSTR(MP_QSTR_uos), (mp_obj_t)&mp_module_uos }, \ @@ -139,7 +139,7 @@ extern const struct _mp_obj_module_t mp_module_network; // extra constants #define MICROPY_PORT_CONSTANTS \ - { MP_OBJ_NEW_QSTR(MP_QSTR_machine), (mp_obj_t)&machine_module }, \ + { MP_OBJ_NEW_QSTR(MP_QSTR_umachine), (mp_obj_t)&machine_module }, \ { MP_OBJ_NEW_QSTR(MP_QSTR_pyb), (mp_obj_t)&pyb_module }, \ { MP_OBJ_NEW_QSTR(MP_QSTR_stm), (mp_obj_t)&stm_module }, \ diff --git a/stmhal/qstrdefsport.h b/stmhal/qstrdefsport.h index 5cb2557a7a..4f7499fe83 100644 --- a/stmhal/qstrdefsport.h +++ b/stmhal/qstrdefsport.h @@ -28,7 +28,7 @@ Q(help) Q(pyb) -Q(machine) +Q(umachine) Q(unique_id) Q(bootloader) Q(hard_reset) diff --git a/unix/modmachine.c b/unix/modmachine.c index cada0e0b69..6039ddfd3d 100644 --- a/unix/modmachine.c +++ b/unix/modmachine.c @@ -77,7 +77,7 @@ uintptr_t machine_mem_get_write_addr(mp_obj_t addr_o, uint align) { } STATIC const mp_rom_map_elem_t machine_module_globals_table[] = { - { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_machine) }, + { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_umachine) }, { MP_ROM_QSTR(MP_QSTR_mem8), MP_ROM_PTR(&machine_mem8_obj) }, { MP_ROM_QSTR(MP_QSTR_mem16), MP_ROM_PTR(&machine_mem16_obj) }, @@ -88,7 +88,7 @@ STATIC MP_DEFINE_CONST_DICT(machine_module_globals, machine_module_globals_table const mp_obj_module_t mp_module_machine = { .base = { &mp_type_module }, - .name = MP_QSTR_machine, + .name = MP_QSTR_umachine, .globals = (mp_obj_dict_t*)&machine_module_globals, }; diff --git a/unix/mpconfigport.h b/unix/mpconfigport.h index 49f8794048..e2016317db 100644 --- a/unix/mpconfigport.h +++ b/unix/mpconfigport.h @@ -172,7 +172,7 @@ extern const struct _mp_obj_module_t mp_module_jni; MICROPY_PY_JNI_DEF \ MICROPY_PY_TIME_DEF \ MICROPY_PY_SOCKET_DEF \ - { MP_ROM_QSTR(MP_QSTR_machine), MP_ROM_PTR(&mp_module_machine) }, \ + { MP_ROM_QSTR(MP_QSTR_umachine), MP_ROM_PTR(&mp_module_machine) }, \ { MP_ROM_QSTR(MP_QSTR_uos), MP_ROM_PTR(&mp_module_os) }, \ MICROPY_PY_USELECT_DEF \ MICROPY_PY_TERMIOS_DEF \