diff options
| author | Dan Halbert <halbert@halwitz.org> | 2020-08-30 14:06:48 -0400 |
|---|---|---|
| committer | Dan Halbert <halbert@halwitz.org> | 2020-08-30 14:06:48 -0400 |
| commit | b27d51125134b4317b429eb7b015c9f94f22adb0 (patch) | |
| tree | a7e41afb5f048f98d6dca93e5f70c85216b5e069 /py | |
| parent | 770c204d5a283add29e03e421490e1d5b9663f3c (diff) | |
address review; use constructor for HCI Adapter
Diffstat (limited to 'py')
| -rw-r--r-- | py/obj.h | 25 |
1 files changed, 24 insertions, 1 deletions
@@ -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 |
