diff --git a/py/obj.h b/py/obj.h index 30a60b77d0..b34581c8bf 100644 --- a/py/obj.h +++ b/py/obj.h @@ -492,7 +492,6 @@ mp_obj_t mp_obj_complex_binary_op(int op, mp_float_t lhs_real, mp_float_t lhs_im void mp_obj_tuple_get(mp_obj_t self_in, uint *len, mp_obj_t **items); void mp_obj_tuple_del(mp_obj_t self_in); machine_int_t mp_obj_tuple_hash(mp_obj_t self_in); -mp_obj_t mp_obj_tuple_make_new(mp_obj_t type_in, uint n_args, uint n_kw, const mp_obj_t *args); // list struct _mp_obj_list_t; diff --git a/py/objexcept.c b/py/objexcept.c index 26997ef835..60b3565f6d 100644 --- a/py/objexcept.c +++ b/py/objexcept.c @@ -76,7 +76,7 @@ STATIC void mp_obj_exception_print(void (*print)(void *env, const char *fmt, ... return; } } - tuple_print(print, env, o->args, kind); + mp_obj_tuple_print(print, env, o->args, kind); } mp_obj_t mp_obj_exception_make_new(mp_obj_t type_in, uint n_args, uint n_kw, const mp_obj_t *args) { diff --git a/py/objnamedtuple.c b/py/objnamedtuple.c index 0874eea85f..212cf131c8 100644 --- a/py/objnamedtuple.c +++ b/py/objnamedtuple.c @@ -155,12 +155,12 @@ mp_obj_t mp_obj_new_namedtuple_type(qstr name, const char *fields) { o->base.name = name; o->base.print = namedtuple_print; o->base.make_new = namedtuple_make_new; - o->base.unary_op = tuple_unary_op; - o->base.binary_op = tuple_binary_op; + o->base.unary_op = mp_obj_tuple_unary_op; + o->base.binary_op = mp_obj_tuple_binary_op; o->base.load_attr = namedtuple_load_attr; o->base.store_attr = namedtuple_store_attr; - o->base.subscr = tuple_subscr; - o->base.getiter = tuple_getiter; + o->base.subscr = mp_obj_tuple_subscr; + o->base.getiter = mp_obj_tuple_getiter; o->base.bases_tuple = (mp_obj_t)&namedtuple_base_tuple; o->fields = fields; return o; diff --git a/py/objtuple.c b/py/objtuple.c index ca65b28e31..1ec75239bd 100644 --- a/py/objtuple.c +++ b/py/objtuple.c @@ -41,7 +41,7 @@ STATIC mp_obj_t mp_obj_new_tuple_iterator(mp_obj_tuple_t *tuple, int cur); /******************************************************************************/ /* tuple */ -void tuple_print(void (*print)(void *env, const char *fmt, ...), void *env, mp_obj_t o_in, mp_print_kind_t kind) { +void mp_obj_tuple_print(void (*print)(void *env, const char *fmt, ...), void *env, mp_obj_t o_in, mp_print_kind_t kind) { mp_obj_tuple_t *o = o_in; print(env, "("); for (int i = 0; i < o->len; i++) { @@ -56,7 +56,7 @@ void tuple_print(void (*print)(void *env, const char *fmt, ...), void *env, mp_o print(env, ")"); } -mp_obj_t mp_obj_tuple_make_new(mp_obj_t type_in, uint n_args, uint n_kw, const mp_obj_t *args) { +STATIC mp_obj_t mp_obj_tuple_make_new(mp_obj_t type_in, uint n_args, uint n_kw, const mp_obj_t *args) { // TODO check n_kw == 0 switch (n_args) { @@ -100,13 +100,13 @@ mp_obj_t mp_obj_tuple_make_new(mp_obj_t type_in, uint n_args, uint n_kw, const m // Don't pass MP_BINARY_OP_NOT_EQUAL here STATIC bool tuple_cmp_helper(int op, mp_obj_t self_in, mp_obj_t another_in) { mp_obj_type_t *self_type = mp_obj_get_type(self_in); - if (self_type->getiter != tuple_getiter) { + if (self_type->getiter != mp_obj_tuple_getiter) { assert(0); } mp_obj_type_t *another_type = mp_obj_get_type(another_in); mp_obj_tuple_t *self = self_in; mp_obj_tuple_t *another = another_in; - if (another_type->getiter != tuple_getiter) { + if (another_type->getiter != mp_obj_tuple_getiter) { // Slow path for user subclasses another = mp_instance_cast_to_native_base(another, &mp_type_tuple); if (another == MP_OBJ_NULL) { @@ -117,7 +117,7 @@ STATIC bool tuple_cmp_helper(int op, mp_obj_t self_in, mp_obj_t another_in) { return mp_seq_cmp_objs(op, self->items, self->len, another->items, another->len); } -mp_obj_t tuple_unary_op(int op, mp_obj_t self_in) { +mp_obj_t mp_obj_tuple_unary_op(int op, mp_obj_t self_in) { mp_obj_tuple_t *self = self_in; switch (op) { case MP_UNARY_OP_BOOL: return MP_BOOL(self->len != 0); @@ -126,7 +126,7 @@ mp_obj_t tuple_unary_op(int op, mp_obj_t self_in) { } } -mp_obj_t tuple_binary_op(int op, mp_obj_t lhs, mp_obj_t rhs) { +mp_obj_t mp_obj_tuple_binary_op(int op, mp_obj_t lhs, mp_obj_t rhs) { mp_obj_tuple_t *o = lhs; switch (op) { case MP_BINARY_OP_ADD: { @@ -160,7 +160,7 @@ mp_obj_t tuple_binary_op(int op, mp_obj_t lhs, mp_obj_t rhs) { } } -mp_obj_t tuple_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value) { +mp_obj_t mp_obj_tuple_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value) { if (value == MP_OBJ_SENTINEL) { // load mp_obj_tuple_t *self = self_in; @@ -182,7 +182,7 @@ mp_obj_t tuple_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value) { } } -mp_obj_t tuple_getiter(mp_obj_t o_in) { +mp_obj_t mp_obj_tuple_getiter(mp_obj_t o_in) { return mp_obj_new_tuple_iterator(o_in, 0); } @@ -210,12 +210,12 @@ STATIC MP_DEFINE_CONST_DICT(tuple_locals_dict, tuple_locals_dict_table); const mp_obj_type_t mp_type_tuple = { { &mp_type_type }, .name = MP_QSTR_tuple, - .print = tuple_print, + .print = mp_obj_tuple_print, .make_new = mp_obj_tuple_make_new, - .unary_op = tuple_unary_op, - .binary_op = tuple_binary_op, - .subscr = tuple_subscr, - .getiter = tuple_getiter, + .unary_op = mp_obj_tuple_unary_op, + .binary_op = mp_obj_tuple_binary_op, + .subscr = mp_obj_tuple_subscr, + .getiter = mp_obj_tuple_getiter, .locals_dict = (mp_obj_t)&tuple_locals_dict, }; diff --git a/py/objtuple.h b/py/objtuple.h index 9c33ed09f5..cabe63f80f 100644 --- a/py/objtuple.h +++ b/py/objtuple.h @@ -30,8 +30,8 @@ typedef struct _mp_obj_tuple_t { mp_obj_t items[]; } mp_obj_tuple_t; -void tuple_print(void (*print)(void *env, const char *fmt, ...), void *env, mp_obj_t o_in, mp_print_kind_t kind); -mp_obj_t tuple_unary_op(int op, mp_obj_t self_in); -mp_obj_t tuple_binary_op(int op, mp_obj_t lhs, mp_obj_t rhs); -mp_obj_t tuple_subscr(mp_obj_t base, mp_obj_t index, mp_obj_t value); -mp_obj_t tuple_getiter(mp_obj_t o_in); +void mp_obj_tuple_print(void (*print)(void *env, const char *fmt, ...), void *env, mp_obj_t o_in, mp_print_kind_t kind); +mp_obj_t mp_obj_tuple_unary_op(int op, mp_obj_t self_in); +mp_obj_t mp_obj_tuple_binary_op(int op, mp_obj_t lhs, mp_obj_t rhs); +mp_obj_t mp_obj_tuple_subscr(mp_obj_t base, mp_obj_t index, mp_obj_t value); +mp_obj_t mp_obj_tuple_getiter(mp_obj_t o_in);