From 6ea10b9b11325f51492942bb6fea656357108221 Mon Sep 17 00:00:00 2001 From: Laurens Valk Date: Wed, 26 May 2021 10:17:19 +0200 Subject: [PATCH] pybricks.hubs: Rename SystemHub alias to ThisHub. We use it as a convenient way to share code between hubs, but the name gets a bit confusing if we introduce hub.system later, so rename it. --- pybricks/hubs.h | 2 +- pybricks/hubs/pb_module_hubs.c | 6 +++--- pybricks/hubs/pb_type_cityhub.c | 2 +- pybricks/hubs/pb_type_ev3brick.c | 2 +- pybricks/hubs/pb_type_movehub.c | 2 +- pybricks/hubs/pb_type_nxtbrick.c | 2 +- pybricks/hubs/pb_type_primehub.c | 2 +- pybricks/hubs/pb_type_technichub.c | 2 +- pybricks/pybricks.c | 2 +- 9 files changed, 11 insertions(+), 11 deletions(-) diff --git a/pybricks/hubs.h b/pybricks/hubs.h index bed013041..02ff70bac 100644 --- a/pybricks/hubs.h +++ b/pybricks/hubs.h @@ -13,7 +13,7 @@ MP_DECLARE_CONST_FUN_OBJ_2(pb_hubs_Hub_reset_obj); MP_DECLARE_CONST_FUN_OBJ_1(pb_hubs_Hub_reset_reason_obj); -extern const mp_obj_type_t pb_type_SystemHub; +extern const mp_obj_type_t pb_type_ThisHub; extern const mp_obj_module_t pb_module_hubs; diff --git a/pybricks/hubs/pb_module_hubs.c b/pybricks/hubs/pb_module_hubs.c index 0d0e5fda7..d47474e7c 100644 --- a/pybricks/hubs/pb_module_hubs.c +++ b/pybricks/hubs/pb_module_hubs.c @@ -41,10 +41,10 @@ MP_DEFINE_CONST_FUN_OBJ_1(pb_hubs_Hub_reset_reason_obj, pb_hubs_Hub_reset_reason #endif // PBDRV_CONFIG_RESET STATIC const mp_rom_map_elem_t hubs_globals_table[] = { - { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_hubs) }, - { MP_ROM_QSTR(PYBRICKS_HUB_CLASS_NAME), MP_ROM_PTR(&pb_type_SystemHub) }, + { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_hubs) }, + { MP_ROM_QSTR(PYBRICKS_HUB_CLASS_NAME), MP_ROM_PTR(&pb_type_ThisHub) }, #ifdef PYBRICKS_HUB_CLASS_NAME_ALIAS - { MP_ROM_QSTR(PYBRICKS_HUB_CLASS_NAME_ALIAS), MP_ROM_PTR(&pb_type_SystemHub) }, + { MP_ROM_QSTR(PYBRICKS_HUB_CLASS_NAME_ALIAS), MP_ROM_PTR(&pb_type_ThisHub) }, #endif }; STATIC MP_DEFINE_CONST_DICT(pb_module_hubs_globals, hubs_globals_table); diff --git a/pybricks/hubs/pb_type_cityhub.c b/pybricks/hubs/pb_type_cityhub.c index 5f14e8348..32e180bc6 100644 --- a/pybricks/hubs/pb_type_cityhub.c +++ b/pybricks/hubs/pb_type_cityhub.c @@ -31,7 +31,7 @@ STATIC const mp_rom_map_elem_t hubs_CityHub_locals_dict_table[] = { }; STATIC MP_DEFINE_CONST_DICT(hubs_CityHub_locals_dict, hubs_CityHub_locals_dict_table); -const mp_obj_type_t pb_type_SystemHub = { +const mp_obj_type_t pb_type_ThisHub = { { &mp_type_type }, .name = MP_QSTR_CityHub, .make_new = hubs_CityHub_make_new, diff --git a/pybricks/hubs/pb_type_ev3brick.c b/pybricks/hubs/pb_type_ev3brick.c index b68a6cde0..326b2674a 100644 --- a/pybricks/hubs/pb_type_ev3brick.c +++ b/pybricks/hubs/pb_type_ev3brick.c @@ -55,7 +55,7 @@ STATIC const mp_rom_map_elem_t hubs_EV3Brick_locals_dict_table[] = { }; STATIC MP_DEFINE_CONST_DICT(hubs_EV3Brick_locals_dict, hubs_EV3Brick_locals_dict_table); -const mp_obj_type_t pb_type_SystemHub = { +const mp_obj_type_t pb_type_ThisHub = { { &mp_type_type }, .name = PYBRICKS_HUB_CLASS_NAME, .make_new = hubs_EV3Brick_make_new, diff --git a/pybricks/hubs/pb_type_movehub.c b/pybricks/hubs/pb_type_movehub.c index c75027e9e..01ec56970 100644 --- a/pybricks/hubs/pb_type_movehub.c +++ b/pybricks/hubs/pb_type_movehub.c @@ -268,7 +268,7 @@ STATIC const mp_rom_map_elem_t hubs_MoveHub_locals_dict_table[] = { }; STATIC MP_DEFINE_CONST_DICT(hubs_MoveHub_locals_dict, hubs_MoveHub_locals_dict_table); -const mp_obj_type_t pb_type_SystemHub = { +const mp_obj_type_t pb_type_ThisHub = { { &mp_type_type }, .name = PYBRICKS_HUB_CLASS_NAME, .make_new = hubs_MoveHub_make_new, diff --git a/pybricks/hubs/pb_type_nxtbrick.c b/pybricks/hubs/pb_type_nxtbrick.c index 0f2940ae7..0c454ca52 100644 --- a/pybricks/hubs/pb_type_nxtbrick.c +++ b/pybricks/hubs/pb_type_nxtbrick.c @@ -35,7 +35,7 @@ STATIC const mp_rom_map_elem_t hubs_NXTBrick_locals_dict_table[] = { }; STATIC MP_DEFINE_CONST_DICT(hubs_NXTBrick_locals_dict, hubs_NXTBrick_locals_dict_table); -const mp_obj_type_t pb_type_SystemHub = { +const mp_obj_type_t pb_type_ThisHub = { { &mp_type_type }, .name = PYBRICKS_HUB_CLASS_NAME, .make_new = hubs_NXTBrick_make_new, diff --git a/pybricks/hubs/pb_type_primehub.c b/pybricks/hubs/pb_type_primehub.c index f43bce114..a7b3a9bb8 100644 --- a/pybricks/hubs/pb_type_primehub.c +++ b/pybricks/hubs/pb_type_primehub.c @@ -64,7 +64,7 @@ STATIC const mp_rom_map_elem_t hubs_PrimeHub_locals_dict_table[] = { }; STATIC MP_DEFINE_CONST_DICT(hubs_PrimeHub_locals_dict, hubs_PrimeHub_locals_dict_table); -const mp_obj_type_t pb_type_SystemHub = { +const mp_obj_type_t pb_type_ThisHub = { { &mp_type_type }, .name = PYBRICKS_HUB_CLASS_NAME, .make_new = hubs_PrimeHub_make_new, diff --git a/pybricks/hubs/pb_type_technichub.c b/pybricks/hubs/pb_type_technichub.c index 0a250c437..bf4caa04f 100644 --- a/pybricks/hubs/pb_type_technichub.c +++ b/pybricks/hubs/pb_type_technichub.c @@ -41,7 +41,7 @@ STATIC const mp_rom_map_elem_t hubs_TechnicHub_locals_dict_table[] = { }; STATIC MP_DEFINE_CONST_DICT(hubs_TechnicHub_locals_dict, hubs_TechnicHub_locals_dict_table); -const mp_obj_type_t pb_type_SystemHub = { +const mp_obj_type_t pb_type_ThisHub = { { &mp_type_type }, .name = PYBRICKS_HUB_CLASS_NAME, .make_new = hubs_TechnicHub_make_new, diff --git a/pybricks/pybricks.c b/pybricks/pybricks.c index 2b511bfef..73d937b63 100644 --- a/pybricks/pybricks.c +++ b/pybricks/pybricks.c @@ -112,6 +112,6 @@ void pb_package_import_all(void) { #if PYBRICKS_PY_HUBS // Initialize hub instance const mp_obj_t args; - mp_store_name(MP_QSTR_hub, pb_type_SystemHub.make_new(&pb_type_SystemHub, 0, 0, &args)); + mp_store_name(MP_QSTR_hub, pb_type_ThisHub.make_new(&pb_type_ThisHub, 0, 0, &args)); #endif }