summaryrefslogtreecommitdiff
path: root/py
diff options
context:
space:
mode:
authorDan Halbert <halbert@halwitz.org>2020-08-30 14:06:48 -0400
committerDan Halbert <halbert@halwitz.org>2020-08-30 14:06:48 -0400
commitb27d51125134b4317b429eb7b015c9f94f22adb0 (patch)
treea7e41afb5f048f98d6dca93e5f70c85216b5e069 /py
parent770c204d5a283add29e03e421490e1d5b9663f3c (diff)
address review; use constructor for HCI Adapter
Diffstat (limited to 'py')
-rw-r--r--py/obj.h25
1 files changed, 24 insertions, 1 deletions
diff --git a/py/obj.h b/py/obj.h
index e9d867f77..943e1a389 100644
--- a/py/obj.h
+++ b/py/obj.h
@@ -303,7 +303,7 @@ typedef struct _mp_rom_obj_t { mp_const_obj_t o; } mp_rom_obj_t;
(mp_obj_t)&mp_const_none_obj, \
(mp_obj_t)&mp_const_none_obj}, }
-// These macros are used to define constant map/dict objects
+// These macros are used to define constant or mutable map/dict objects
// You can put "static" in front of the definition to make it local
#define MP_DEFINE_CONST_MAP(map_name, table_name) \
@@ -329,6 +329,29 @@ typedef struct _mp_rom_obj_t { mp_const_obj_t o; } mp_rom_obj_t;
}, \
}
+#define MP_DEFINE_MUTABLE_MAP(map_name, table_name) \
+ mp_map_t map_name = { \
+ .all_keys_are_qstrs = 1, \
+ .is_fixed = 1, \
+ .is_ordered = 1, \
+ .used = MP_ARRAY_SIZE(table_name), \
+ .alloc = MP_ARRAY_SIZE(table_name), \
+ .table = table_name, \
+ }
+
+#define MP_DEFINE_MUTABLE_DICT(dict_name, table_name) \
+ mp_obj_dict_t dict_name = { \
+ .base = {&mp_type_dict}, \
+ .map = { \
+ .all_keys_are_qstrs = 1, \
+ .is_fixed = 1, \
+ .is_ordered = 1, \
+ .used = MP_ARRAY_SIZE(table_name), \
+ .alloc = MP_ARRAY_SIZE(table_name), \
+ .table = table_name, \
+ }, \
+ }
+
// These macros are used to declare and define constant staticmethond and classmethod objects
// You can put "static" in front of the definitions to make them local