Skip to content

Commit f036017

Browse files
committed
extmod: Convert legacy uppercase macro names to lowercase.
1 parent 054dd33 commit f036017

File tree

8 files changed

+30
-30
lines changed

8 files changed

+30
-30
lines changed

extmod/machine_signal.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ STATIC mp_obj_t signal_make_new(const mp_obj_type_t *type, size_t n_args, size_t
4949
#if defined(MICROPY_PY_MACHINE_PIN_MAKE_NEW)
5050
mp_pin_p_t *pin_p = NULL;
5151

52-
if (MP_OBJ_IS_OBJ(pin)) {
52+
if (mp_obj_is_obj(pin)) {
5353
mp_obj_base_t *pin_base = (mp_obj_base_t*)MP_OBJ_TO_PTR(args[0]);
5454
pin_p = (mp_pin_p_t*)pin_base->type->protocol;
5555
}

extmod/moductypes.c

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -137,13 +137,13 @@ STATIC void uctypes_struct_print(const mp_print_t *print, mp_obj_t self_in, mp_p
137137
(void)kind;
138138
mp_obj_uctypes_struct_t *self = MP_OBJ_TO_PTR(self_in);
139139
const char *typen = "unk";
140-
if (MP_OBJ_IS_TYPE(self->desc, &mp_type_dict)
140+
if (mp_obj_is_type(self->desc, &mp_type_dict)
141141
#if MICROPY_PY_COLLECTIONS_ORDEREDDICT
142-
|| MP_OBJ_IS_TYPE(self->desc, &mp_type_ordereddict)
142+
|| mp_obj_is_type(self->desc, &mp_type_ordereddict)
143143
#endif
144144
) {
145145
typen = "STRUCT";
146-
} else if (MP_OBJ_IS_TYPE(self->desc, &mp_type_tuple)) {
146+
} else if (mp_obj_is_type(self->desc, &mp_type_tuple)) {
147147
mp_obj_tuple_t *t = MP_OBJ_TO_PTR(self->desc);
148148
mp_int_t offset = MP_OBJ_SMALL_INT_VALUE(t->items[0]);
149149
uint agg_type = GET_TYPE(offset, AGG_TYPE_BITS);
@@ -210,14 +210,14 @@ STATIC mp_uint_t uctypes_struct_agg_size(mp_obj_tuple_t *t, int layout_type, mp_
210210
}
211211

212212
STATIC mp_uint_t uctypes_struct_size(mp_obj_t desc_in, int layout_type, mp_uint_t *max_field_size) {
213-
if (!MP_OBJ_IS_TYPE(desc_in, &mp_type_dict)
213+
if (!mp_obj_is_type(desc_in, &mp_type_dict)
214214
#if MICROPY_PY_COLLECTIONS_ORDEREDDICT
215-
&& !MP_OBJ_IS_TYPE(desc_in, &mp_type_ordereddict)
215+
&& !mp_obj_is_type(desc_in, &mp_type_ordereddict)
216216
#endif
217217
) {
218-
if (MP_OBJ_IS_TYPE(desc_in, &mp_type_tuple)) {
218+
if (mp_obj_is_type(desc_in, &mp_type_tuple)) {
219219
return uctypes_struct_agg_size((mp_obj_tuple_t*)MP_OBJ_TO_PTR(desc_in), layout_type, max_field_size);
220-
} else if (MP_OBJ_IS_SMALL_INT(desc_in)) {
220+
} else if (mp_obj_is_small_int(desc_in)) {
221221
// We allow sizeof on both type definitions and structures/structure fields,
222222
// but scalar structure field is lowered into native Python int, so all
223223
// type info is lost. So, we cannot say if it's scalar type description,
@@ -231,9 +231,9 @@ STATIC mp_uint_t uctypes_struct_size(mp_obj_t desc_in, int layout_type, mp_uint_
231231
mp_uint_t total_size = 0;
232232

233233
for (mp_uint_t i = 0; i < d->map.alloc; i++) {
234-
if (MP_MAP_SLOT_IS_FILLED(&d->map, i)) {
234+
if (mp_map_slot_is_filled(&d->map, i)) {
235235
mp_obj_t v = d->map.table[i].value;
236-
if (MP_OBJ_IS_SMALL_INT(v)) {
236+
if (mp_obj_is_small_int(v)) {
237237
mp_uint_t offset = MP_OBJ_SMALL_INT_VALUE(v);
238238
mp_uint_t val_type = GET_TYPE(offset, VAL_TYPE_BITS);
239239
offset &= VALUE_MASK(VAL_TYPE_BITS);
@@ -248,7 +248,7 @@ STATIC mp_uint_t uctypes_struct_size(mp_obj_t desc_in, int layout_type, mp_uint_
248248
total_size = offset + s;
249249
}
250250
} else {
251-
if (!MP_OBJ_IS_TYPE(v, &mp_type_tuple)) {
251+
if (!mp_obj_is_type(v, &mp_type_tuple)) {
252252
syntax_error();
253253
}
254254
mp_obj_tuple_t *t = MP_OBJ_TO_PTR(v);
@@ -272,13 +272,13 @@ STATIC mp_uint_t uctypes_struct_size(mp_obj_t desc_in, int layout_type, mp_uint_
272272
STATIC mp_obj_t uctypes_struct_sizeof(size_t n_args, const mp_obj_t *args) {
273273
mp_obj_t obj_in = args[0];
274274
mp_uint_t max_field_size = 0;
275-
if (MP_OBJ_IS_TYPE(obj_in, &mp_type_bytearray)) {
275+
if (mp_obj_is_type(obj_in, &mp_type_bytearray)) {
276276
return mp_obj_len(obj_in);
277277
}
278278
int layout_type = LAYOUT_NATIVE;
279279
// We can apply sizeof either to structure definition (a dict)
280280
// or to instantiated structure
281-
if (MP_OBJ_IS_TYPE(obj_in, &uctypes_struct_type)) {
281+
if (mp_obj_is_type(obj_in, &uctypes_struct_type)) {
282282
if (n_args != 1) {
283283
mp_raise_TypeError(NULL);
284284
}
@@ -406,16 +406,16 @@ STATIC void set_aligned(uint val_type, void *p, mp_int_t index, mp_obj_t val) {
406406
STATIC mp_obj_t uctypes_struct_attr_op(mp_obj_t self_in, qstr attr, mp_obj_t set_val) {
407407
mp_obj_uctypes_struct_t *self = MP_OBJ_TO_PTR(self_in);
408408

409-
if (!MP_OBJ_IS_TYPE(self->desc, &mp_type_dict)
409+
if (!mp_obj_is_type(self->desc, &mp_type_dict)
410410
#if MICROPY_PY_COLLECTIONS_ORDEREDDICT
411-
&& !MP_OBJ_IS_TYPE(self->desc, &mp_type_ordereddict)
411+
&& !mp_obj_is_type(self->desc, &mp_type_ordereddict)
412412
#endif
413413
) {
414414
mp_raise_TypeError("struct: no fields");
415415
}
416416

417417
mp_obj_t deref = mp_obj_dict_get(self->desc, MP_OBJ_NEW_QSTR(attr));
418-
if (MP_OBJ_IS_SMALL_INT(deref)) {
418+
if (mp_obj_is_small_int(deref)) {
419419
mp_int_t offset = MP_OBJ_SMALL_INT_VALUE(deref);
420420
mp_uint_t val_type = GET_TYPE(offset, VAL_TYPE_BITS);
421421
offset &= VALUE_MASK(VAL_TYPE_BITS);
@@ -476,7 +476,7 @@ STATIC mp_obj_t uctypes_struct_attr_op(mp_obj_t self_in, qstr attr, mp_obj_t set
476476
return MP_OBJ_NULL;
477477
}
478478

479-
if (!MP_OBJ_IS_TYPE(deref, &mp_type_tuple)) {
479+
if (!mp_obj_is_type(deref, &mp_type_tuple)) {
480480
syntax_error();
481481
}
482482

@@ -543,7 +543,7 @@ STATIC mp_obj_t uctypes_struct_subscr(mp_obj_t self_in, mp_obj_t index_in, mp_ob
543543
return MP_OBJ_NULL; // op not supported
544544
} else {
545545
// load / store
546-
if (!MP_OBJ_IS_TYPE(self->desc, &mp_type_tuple)) {
546+
if (!mp_obj_is_type(self->desc, &mp_type_tuple)) {
547547
mp_raise_TypeError("struct: cannot index");
548548
}
549549

@@ -594,7 +594,7 @@ STATIC mp_obj_t uctypes_struct_subscr(mp_obj_t self_in, mp_obj_t index_in, mp_ob
594594

595595
} else if (agg_type == PTR) {
596596
byte *p = *(void**)self->addr;
597-
if (MP_OBJ_IS_SMALL_INT(t->items[1])) {
597+
if (mp_obj_is_small_int(t->items[1])) {
598598
uint val_type = GET_TYPE(MP_OBJ_SMALL_INT_VALUE(t->items[1]), VAL_TYPE_BITS);
599599
return get_aligned(val_type, p, index);
600600
} else {
@@ -618,7 +618,7 @@ STATIC mp_obj_t uctypes_struct_unary_op(mp_unary_op_t op, mp_obj_t self_in) {
618618
mp_obj_uctypes_struct_t *self = MP_OBJ_TO_PTR(self_in);
619619
switch (op) {
620620
case MP_UNARY_OP_INT:
621-
if (MP_OBJ_IS_TYPE(self->desc, &mp_type_tuple)) {
621+
if (mp_obj_is_type(self->desc, &mp_type_tuple)) {
622622
mp_obj_tuple_t *t = MP_OBJ_TO_PTR(self->desc);
623623
mp_int_t offset = MP_OBJ_SMALL_INT_VALUE(t->items[0]);
624624
uint agg_type = GET_TYPE(offset, AGG_TYPE_BITS);

extmod/moduheapq.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
// the algorithm here is modelled on CPython's heapq.py
3333

3434
STATIC mp_obj_list_t *get_heap(mp_obj_t heap_in) {
35-
if (!MP_OBJ_IS_TYPE(heap_in, &mp_type_list)) {
35+
if (!mp_obj_is_type(heap_in, &mp_type_list)) {
3636
mp_raise_TypeError("heap must be a list");
3737
}
3838
return MP_OBJ_TO_PTR(heap_in);

extmod/moduselect.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ STATIC void poll_map_add(mp_map_t *poll_map, const mp_obj_t *obj, mp_uint_t obj_
7777
STATIC mp_uint_t poll_map_poll(mp_map_t *poll_map, size_t *rwx_num) {
7878
mp_uint_t n_ready = 0;
7979
for (mp_uint_t i = 0; i < poll_map->alloc; ++i) {
80-
if (!MP_MAP_SLOT_IS_FILLED(poll_map, i)) {
80+
if (!mp_map_slot_is_filled(poll_map, i)) {
8181
continue;
8282
}
8383

@@ -155,7 +155,7 @@ STATIC mp_obj_t select_select(uint n_args, const mp_obj_t *args) {
155155
list_array[2] = mp_obj_new_list(rwx_len[2], NULL);
156156
rwx_len[0] = rwx_len[1] = rwx_len[2] = 0;
157157
for (mp_uint_t i = 0; i < poll_map.alloc; ++i) {
158-
if (!MP_MAP_SLOT_IS_FILLED(&poll_map, i)) {
158+
if (!mp_map_slot_is_filled(&poll_map, i)) {
159159
continue;
160160
}
161161
poll_obj_t *poll_obj = MP_OBJ_TO_PTR(poll_map.table[i].value);
@@ -266,7 +266,7 @@ STATIC mp_obj_t poll_poll(size_t n_args, const mp_obj_t *args) {
266266
mp_obj_list_t *ret_list = MP_OBJ_TO_PTR(mp_obj_new_list(n_ready, NULL));
267267
n_ready = 0;
268268
for (mp_uint_t i = 0; i < self->poll_map.alloc; ++i) {
269-
if (!MP_MAP_SLOT_IS_FILLED(&self->poll_map, i)) {
269+
if (!mp_map_slot_is_filled(&self->poll_map, i)) {
270270
continue;
271271
}
272272
poll_obj_t *poll_obj = MP_OBJ_TO_PTR(self->poll_map.table[i].value);
@@ -309,7 +309,7 @@ STATIC mp_obj_t poll_iternext(mp_obj_t self_in) {
309309

310310
for (mp_uint_t i = self->iter_idx; i < self->poll_map.alloc; ++i) {
311311
self->iter_idx++;
312-
if (!MP_MAP_SLOT_IS_FILLED(&self->poll_map, i)) {
312+
if (!mp_map_slot_is_filled(&self->poll_map, i)) {
313313
continue;
314314
}
315315
poll_obj_t *poll_obj = MP_OBJ_TO_PTR(self->poll_map.table[i].value);

extmod/modutimeq.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ STATIC mp_obj_t mod_utimeq_heappop(mp_obj_t heap_in, mp_obj_t list_ref) {
145145
nlr_raise(mp_obj_new_exception_msg(&mp_type_IndexError, "empty heap"));
146146
}
147147
mp_obj_list_t *ret = MP_OBJ_TO_PTR(list_ref);
148-
if (!MP_OBJ_IS_TYPE(list_ref, &mp_type_list) || ret->len < 3) {
148+
if (!mp_obj_is_type(list_ref, &mp_type_list) || ret->len < 3) {
149149
mp_raise_TypeError(NULL);
150150
}
151151

extmod/vfs.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ mp_obj_t mp_vfs_umount(mp_obj_t mnt_in) {
227227
mp_vfs_mount_t *vfs = NULL;
228228
size_t mnt_len;
229229
const char *mnt_str = NULL;
230-
if (MP_OBJ_IS_STR(mnt_in)) {
230+
if (mp_obj_is_str(mnt_in)) {
231231
mnt_str = mp_obj_str_get_data(mnt_in, &mnt_len);
232232
}
233233
for (mp_vfs_mount_t **vfsp = &MP_STATE_VM(vfs_mount_table); *vfsp != NULL; vfsp = &(*vfsp)->next) {
@@ -270,7 +270,7 @@ mp_obj_t mp_vfs_open(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args)
270270

271271
#if MICROPY_VFS_POSIX
272272
// If the file is an integer then delegate straight to the POSIX handler
273-
if (MP_OBJ_IS_SMALL_INT(args[ARG_file].u_obj)) {
273+
if (mp_obj_is_small_int(args[ARG_file].u_obj)) {
274274
return mp_vfs_posix_file_open(&mp_type_textio, args[ARG_file].u_obj, args[ARG_mode].u_obj);
275275
}
276276
#endif

extmod/vfs_posix.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ STATIC mp_obj_t vfs_posix_open(mp_obj_t self_in, mp_obj_t path_in, mp_obj_t mode
130130
&& (strchr(mode, 'w') != NULL || strchr(mode, 'a') != NULL || strchr(mode, '+') != NULL)) {
131131
mp_raise_OSError(MP_EROFS);
132132
}
133-
if (!MP_OBJ_IS_SMALL_INT(path_in)) {
133+
if (!mp_obj_is_small_int(path_in)) {
134134
path_in = vfs_posix_get_path_obj(self, path_in);
135135
}
136136
return mp_vfs_posix_file_open(&mp_type_textio, path_in, mode_in);

extmod/vfs_posix_file.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ mp_obj_t mp_vfs_posix_file_open(const mp_obj_type_t *type, mp_obj_t file_in, mp_
9494

9595
mp_obj_t fid = file_in;
9696

97-
if (MP_OBJ_IS_SMALL_INT(fid)) {
97+
if (mp_obj_is_small_int(fid)) {
9898
o->fd = MP_OBJ_SMALL_INT_VALUE(fid);
9999
return MP_OBJ_FROM_PTR(o);
100100
}

0 commit comments

Comments
 (0)