Commit ecc88e94 authored by Damien George's avatar Damien George
Browse files

Change some parts of the core API to use mp_uint_t instead of uint/int.

Addressing issue #50, still some way to go yet.
parent 4d3fc463
...@@ -134,7 +134,7 @@ STATIC bool namedtuple_store_attr(mp_obj_t self_in, qstr attr, mp_obj_t value) { ...@@ -134,7 +134,7 @@ STATIC bool namedtuple_store_attr(mp_obj_t self_in, qstr attr, mp_obj_t value) {
nlr_raise(mp_obj_new_exception_msg(&mp_type_AttributeError, "can't set attribute")); nlr_raise(mp_obj_new_exception_msg(&mp_type_AttributeError, "can't set attribute"));
} }
STATIC mp_obj_t namedtuple_make_new(mp_obj_t type_in, uint n_args, uint n_kw, const mp_obj_t *args) { STATIC mp_obj_t namedtuple_make_new(mp_obj_t type_in, mp_uint_t n_args, mp_uint_t n_kw, const mp_obj_t *args) {
mp_obj_namedtuple_type_t *type = type_in; mp_obj_namedtuple_type_t *type = type_in;
uint num_fields = namedtuple_count_fields(type->fields); uint num_fields = namedtuple_count_fields(type->fields);
if (n_args != num_fields) { if (n_args != num_fields) {
......
...@@ -41,7 +41,7 @@ STATIC void none_print(void (*print)(void *env, const char *fmt, ...), void *env ...@@ -41,7 +41,7 @@ STATIC void none_print(void (*print)(void *env, const char *fmt, ...), void *env
print(env, "None"); print(env, "None");
} }
STATIC mp_obj_t none_unary_op(int op, mp_obj_t o_in) { STATIC mp_obj_t none_unary_op(mp_uint_t op, mp_obj_t o_in) {
switch (op) { switch (op) {
case MP_UNARY_OP_BOOL: return mp_const_false; case MP_UNARY_OP_BOOL: return mp_const_false;
default: return MP_OBJ_NULL; // op not supported default: return MP_OBJ_NULL; // op not supported
......
...@@ -33,13 +33,13 @@ ...@@ -33,13 +33,13 @@
#include "obj.h" #include "obj.h"
#include "runtime0.h" #include "runtime0.h"
mp_obj_t instance_make_new(mp_obj_t self_in, uint n_args, uint n_kw, const mp_obj_t *args); mp_obj_t instance_make_new(mp_obj_t self_in, mp_uint_t n_args, mp_uint_t n_kw, const mp_obj_t *args);
typedef struct _mp_obj_object_t { typedef struct _mp_obj_object_t {
mp_obj_base_t base; mp_obj_base_t base;
} mp_obj_object_t; } mp_obj_object_t;
STATIC mp_obj_t object_make_new(mp_obj_t type_in, uint n_args, uint n_kw, const mp_obj_t *args) { STATIC mp_obj_t object_make_new(mp_obj_t type_in, mp_uint_t n_args, mp_uint_t n_kw, const mp_obj_t *args) {
if (n_args != 0 || n_kw != 0) { if (n_args != 0 || n_kw != 0) {
nlr_raise(mp_obj_new_exception_msg(&mp_type_TypeError, "object takes no arguments")); nlr_raise(mp_obj_new_exception_msg(&mp_type_TypeError, "object takes no arguments"));
} }
......
...@@ -41,7 +41,7 @@ typedef struct _mp_obj_property_t { ...@@ -41,7 +41,7 @@ typedef struct _mp_obj_property_t {
mp_obj_t proxy[3]; // getter, setter, deleter mp_obj_t proxy[3]; // getter, setter, deleter
} mp_obj_property_t; } mp_obj_property_t;
STATIC mp_obj_t property_make_new(mp_obj_t type_in, uint n_args, uint n_kw, const mp_obj_t *args) { STATIC mp_obj_t property_make_new(mp_obj_t type_in, mp_uint_t n_args, mp_uint_t n_kw, const mp_obj_t *args) {
mp_arg_check_num(n_args, n_kw, 0, 4, false); mp_arg_check_num(n_args, n_kw, 0, 4, false);
mp_obj_property_t *o = m_new_obj(mp_obj_property_t); mp_obj_property_t *o = m_new_obj(mp_obj_property_t);
......
...@@ -93,7 +93,7 @@ STATIC void range_print(void (*print)(void *env, const char *fmt, ...), void *en ...@@ -93,7 +93,7 @@ STATIC void range_print(void (*print)(void *env, const char *fmt, ...), void *en
} }
} }
STATIC mp_obj_t range_make_new(mp_obj_t type_in, uint n_args, uint n_kw, const mp_obj_t *args) { STATIC mp_obj_t range_make_new(mp_obj_t type_in, mp_uint_t n_args, mp_uint_t n_kw, const mp_obj_t *args) {
mp_arg_check_num(n_args, n_kw, 1, 3, false); mp_arg_check_num(n_args, n_kw, 1, 3, false);
mp_obj_range_t *o = m_new_obj(mp_obj_range_t); mp_obj_range_t *o = m_new_obj(mp_obj_range_t);
...@@ -130,7 +130,7 @@ STATIC mp_int_t range_len(mp_obj_range_t *self) { ...@@ -130,7 +130,7 @@ STATIC mp_int_t range_len(mp_obj_range_t *self) {
return len; return len;
} }
STATIC mp_obj_t range_unary_op(int op, mp_obj_t self_in) { STATIC mp_obj_t range_unary_op(mp_uint_t op, mp_obj_t self_in) {
mp_obj_range_t *self = self_in; mp_obj_range_t *self = self_in;
mp_int_t len = range_len(self); mp_int_t len = range_len(self);
switch (op) { switch (op) {
......
...@@ -40,7 +40,7 @@ typedef struct _mp_obj_reversed_t { ...@@ -40,7 +40,7 @@ typedef struct _mp_obj_reversed_t {
mp_uint_t cur_index; // current index, plus 1; 0=no more, 1=last one (index 0) mp_uint_t cur_index; // current index, plus 1; 0=no more, 1=last one (index 0)
} mp_obj_reversed_t; } mp_obj_reversed_t;
STATIC mp_obj_t reversed_make_new(mp_obj_t type_in, uint n_args, uint n_kw, const mp_obj_t *args) { STATIC mp_obj_t reversed_make_new(mp_obj_t type_in, mp_uint_t n_args, mp_uint_t n_kw, const mp_obj_t *args) {
mp_arg_check_num(n_args, n_kw, 1, 1, false); mp_arg_check_num(n_args, n_kw, 1, 1, false);
mp_obj_reversed_t *o = m_new_obj(mp_obj_reversed_t); mp_obj_reversed_t *o = m_new_obj(mp_obj_reversed_t);
......
...@@ -122,7 +122,7 @@ STATIC void set_print(void (*print)(void *env, const char *fmt, ...), void *env, ...@@ -122,7 +122,7 @@ STATIC void set_print(void (*print)(void *env, const char *fmt, ...), void *env,
} }
STATIC mp_obj_t set_make_new(mp_obj_t type_in, uint n_args, uint n_kw, const mp_obj_t *args) { STATIC mp_obj_t set_make_new(mp_obj_t type_in, mp_uint_t n_args, mp_uint_t n_kw, const mp_obj_t *args) {
mp_arg_check_num(n_args, n_kw, 0, 1, false); mp_arg_check_num(n_args, n_kw, 0, 1, false);
switch (n_args) { switch (n_args) {
...@@ -234,7 +234,7 @@ STATIC mp_obj_t set_discard(mp_obj_t self_in, mp_obj_t item) { ...@@ -234,7 +234,7 @@ STATIC mp_obj_t set_discard(mp_obj_t self_in, mp_obj_t item) {
} }
STATIC MP_DEFINE_CONST_FUN_OBJ_2(set_discard_obj, set_discard); STATIC MP_DEFINE_CONST_FUN_OBJ_2(set_discard_obj, set_discard);
STATIC mp_obj_t set_diff_int(int n_args, const mp_obj_t *args, bool update) { STATIC mp_obj_t set_diff_int(mp_uint_t n_args, const mp_obj_t *args, bool update) {
assert(n_args > 0); assert(n_args > 0);
mp_obj_set_t *self; mp_obj_set_t *self;
...@@ -264,12 +264,12 @@ STATIC mp_obj_t set_diff_int(int n_args, const mp_obj_t *args, bool update) { ...@@ -264,12 +264,12 @@ STATIC mp_obj_t set_diff_int(int n_args, const mp_obj_t *args, bool update) {
return self; return self;
} }
STATIC mp_obj_t set_diff(uint n_args, const mp_obj_t *args) { STATIC mp_obj_t set_diff(mp_uint_t n_args, const mp_obj_t *args) {
return set_diff_int(n_args, args, false); return set_diff_int(n_args, args, false);
} }
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR(set_diff_obj, 1, set_diff); STATIC MP_DEFINE_CONST_FUN_OBJ_VAR(set_diff_obj, 1, set_diff);
STATIC mp_obj_t set_diff_update(uint n_args, const mp_obj_t *args) { STATIC mp_obj_t set_diff_update(mp_uint_t n_args, const mp_obj_t *args) {
set_diff_int(n_args, args, true); set_diff_int(n_args, args, true);
return mp_const_none; return mp_const_none;
} }
...@@ -453,7 +453,7 @@ STATIC void set_update_int(mp_obj_set_t *self, mp_obj_t other_in) { ...@@ -453,7 +453,7 @@ STATIC void set_update_int(mp_obj_set_t *self, mp_obj_t other_in) {
} }
} }
STATIC mp_obj_t set_update(uint n_args, const mp_obj_t *args) { STATIC mp_obj_t set_update(mp_uint_t n_args, const mp_obj_t *args) {
assert(n_args > 0); assert(n_args > 0);
for (int i = 1; i < n_args; i++) { for (int i = 1; i < n_args; i++) {
...@@ -472,7 +472,7 @@ STATIC mp_obj_t set_union(mp_obj_t self_in, mp_obj_t other_in) { ...@@ -472,7 +472,7 @@ STATIC mp_obj_t set_union(mp_obj_t self_in, mp_obj_t other_in) {
} }
STATIC MP_DEFINE_CONST_FUN_OBJ_2(set_union_obj, set_union); STATIC MP_DEFINE_CONST_FUN_OBJ_2(set_union_obj, set_union);
STATIC mp_obj_t set_unary_op(int op, mp_obj_t self_in) { STATIC mp_obj_t set_unary_op(mp_uint_t op, mp_obj_t self_in) {
mp_obj_set_t *self = self_in; mp_obj_set_t *self = self_in;
switch (op) { switch (op) {
case MP_UNARY_OP_BOOL: return MP_BOOL(self->set.used != 0); case MP_UNARY_OP_BOOL: return MP_BOOL(self->set.used != 0);
...@@ -481,7 +481,7 @@ STATIC mp_obj_t set_unary_op(int op, mp_obj_t self_in) { ...@@ -481,7 +481,7 @@ STATIC mp_obj_t set_unary_op(int op, mp_obj_t self_in) {
} }
} }
STATIC mp_obj_t set_binary_op(int op, mp_obj_t lhs, mp_obj_t rhs) { STATIC mp_obj_t set_binary_op(mp_uint_t op, mp_obj_t lhs, mp_obj_t rhs) {
mp_obj_t args[] = {lhs, rhs}; mp_obj_t args[] = {lhs, rhs};
switch (op) { switch (op) {
case MP_BINARY_OP_OR: case MP_BINARY_OP_OR:
......
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
#include "objstr.h" #include "objstr.h"
#include "objlist.h" #include "objlist.h"
STATIC mp_obj_t str_modulo_format(mp_obj_t pattern, uint n_args, const mp_obj_t *args, mp_obj_t dict); STATIC mp_obj_t str_modulo_format(mp_obj_t pattern, mp_uint_t n_args, const mp_obj_t *args, mp_obj_t dict);
const mp_obj_t mp_const_empty_bytes; const mp_obj_t mp_const_empty_bytes;
mp_obj_t mp_obj_new_str_iterator(mp_obj_t str); mp_obj_t mp_obj_new_str_iterator(mp_obj_t str);
...@@ -105,7 +105,7 @@ STATIC void str_print(void (*print)(void *env, const char *fmt, ...), void *env, ...@@ -105,7 +105,7 @@ STATIC void str_print(void (*print)(void *env, const char *fmt, ...), void *env,
} }
} }
STATIC mp_obj_t str_make_new(mp_obj_t type_in, uint n_args, uint n_kw, const mp_obj_t *args) { STATIC mp_obj_t str_make_new(mp_obj_t type_in, mp_uint_t n_args, mp_uint_t n_kw, const mp_obj_t *args) {
#if MICROPY_CPYTHON_COMPAT #if MICROPY_CPYTHON_COMPAT
if (n_kw != 0) { if (n_kw != 0) {
mp_arg_error_unimpl_kw(); mp_arg_error_unimpl_kw();
...@@ -145,7 +145,7 @@ STATIC mp_obj_t str_make_new(mp_obj_t type_in, uint n_args, uint n_kw, const mp_ ...@@ -145,7 +145,7 @@ STATIC mp_obj_t str_make_new(mp_obj_t type_in, uint n_args, uint n_kw, const mp_
} }
} }
STATIC mp_obj_t bytes_make_new(mp_obj_t type_in, uint n_args, uint n_kw, const mp_obj_t *args) { STATIC mp_obj_t bytes_make_new(mp_obj_t type_in, mp_uint_t n_args, mp_uint_t n_kw, const mp_obj_t *args) {
if (n_args == 0) { if (n_args == 0) {
return mp_const_empty_bytes; return mp_const_empty_bytes;
} }
...@@ -250,7 +250,7 @@ STATIC const byte *find_subbytes(const byte *haystack, mp_uint_t hlen, const byt ...@@ -250,7 +250,7 @@ STATIC const byte *find_subbytes(const byte *haystack, mp_uint_t hlen, const byt
// Note: this function is used to check if an object is a str or bytes, which // Note: this function is used to check if an object is a str or bytes, which
// works because both those types use it as their binary_op method. Revisit // works because both those types use it as their binary_op method. Revisit
// MP_OBJ_IS_STR_OR_BYTES if this fact changes. // MP_OBJ_IS_STR_OR_BYTES if this fact changes.
mp_obj_t mp_obj_str_binary_op(int op, mp_obj_t lhs_in, mp_obj_t rhs_in) { mp_obj_t mp_obj_str_binary_op(mp_uint_t op, mp_obj_t lhs_in, mp_obj_t rhs_in) {
GET_STR_DATA_LEN(lhs_in, lhs_data, lhs_len); GET_STR_DATA_LEN(lhs_in, lhs_data, lhs_len);
mp_obj_type_t *lhs_type = mp_obj_get_type(lhs_in); mp_obj_type_t *lhs_type = mp_obj_get_type(lhs_in);
mp_obj_type_t *rhs_type = mp_obj_get_type(rhs_in); mp_obj_type_t *rhs_type = mp_obj_get_type(rhs_in);
...@@ -440,7 +440,7 @@ STATIC mp_obj_t str_join(mp_obj_t self_in, mp_obj_t arg) { ...@@ -440,7 +440,7 @@ STATIC mp_obj_t str_join(mp_obj_t self_in, mp_obj_t arg) {
#define is_ws(c) ((c) == ' ' || (c) == '\t') #define is_ws(c) ((c) == ' ' || (c) == '\t')
STATIC mp_obj_t str_split(uint n_args, const mp_obj_t *args) { STATIC mp_obj_t str_split(mp_uint_t n_args, const mp_obj_t *args) {
const mp_obj_type_t *self_type = mp_obj_get_type(args[0]); const mp_obj_type_t *self_type = mp_obj_get_type(args[0]);
mp_int_t splits = -1; mp_int_t splits = -1;
mp_obj_t sep = mp_const_none; mp_obj_t sep = mp_const_none;
...@@ -515,7 +515,7 @@ STATIC mp_obj_t str_split(uint n_args, const mp_obj_t *args) { ...@@ -515,7 +515,7 @@ STATIC mp_obj_t str_split(uint n_args, const mp_obj_t *args) {
return res; return res;
} }
STATIC mp_obj_t str_rsplit(uint n_args, const mp_obj_t *args) { STATIC mp_obj_t str_rsplit(mp_uint_t n_args, const mp_obj_t *args) {
if (n_args < 3) { if (n_args < 3) {
// If we don't have split limit, it doesn't matter from which side // If we don't have split limit, it doesn't matter from which side
// we split. // we split.
...@@ -576,7 +576,7 @@ STATIC mp_obj_t str_rsplit(uint n_args, const mp_obj_t *args) { ...@@ -576,7 +576,7 @@ STATIC mp_obj_t str_rsplit(uint n_args, const mp_obj_t *args) {
return res; return res;
} }
STATIC mp_obj_t str_finder(uint n_args, const mp_obj_t *args, mp_int_t direction, bool is_index) { STATIC mp_obj_t str_finder(mp_uint_t n_args, const mp_obj_t *args, mp_int_t direction, bool is_index) {
const mp_obj_type_t *self_type = mp_obj_get_type(args[0]); const mp_obj_type_t *self_type = mp_obj_get_type(args[0]);
assert(2 <= n_args && n_args <= 4); assert(2 <= n_args && n_args <= 4);
assert(MP_OBJ_IS_STR(args[0])); assert(MP_OBJ_IS_STR(args[0]));
...@@ -613,24 +613,24 @@ STATIC mp_obj_t str_finder(uint n_args, const mp_obj_t *args, mp_int_t direction ...@@ -613,24 +613,24 @@ STATIC mp_obj_t str_finder(uint n_args, const mp_obj_t *args, mp_int_t direction
} }
} }
STATIC mp_obj_t str_find(uint n_args, const mp_obj_t *args) { STATIC mp_obj_t str_find(mp_uint_t n_args, const mp_obj_t *args) {
return str_finder(n_args, args, 1, false); return str_finder(n_args, args, 1, false);
} }
STATIC mp_obj_t str_rfind(uint n_args, const mp_obj_t *args) { STATIC mp_obj_t str_rfind(mp_uint_t n_args, const mp_obj_t *args) {
return str_finder(n_args, args, -1, false); return str_finder(n_args, args, -1, false);
} }
STATIC mp_obj_t str_index(uint n_args, const mp_obj_t *args) { STATIC mp_obj_t str_index(mp_uint_t n_args, const mp_obj_t *args) {
return str_finder(n_args, args, 1, true); return str_finder(n_args, args, 1, true);
} }
STATIC mp_obj_t str_rindex(uint n_args, const mp_obj_t *args) { STATIC mp_obj_t str_rindex(mp_uint_t n_args, const mp_obj_t *args) {
return str_finder(n_args, args, -1, true); return str_finder(n_args, args, -1, true);
} }
// TODO: (Much) more variety in args // TODO: (Much) more variety in args
STATIC mp_obj_t str_startswith(uint n_args, const mp_obj_t *args) { STATIC mp_obj_t str_startswith(mp_uint_t n_args, const mp_obj_t *args) {
const mp_obj_type_t *self_type = mp_obj_get_type(args[0]); const mp_obj_type_t *self_type = mp_obj_get_type(args[0]);
GET_STR_DATA_LEN(args[0], str, str_len); GET_STR_DATA_LEN(args[0], str, str_len);
GET_STR_DATA_LEN(args[1], prefix, prefix_len); GET_STR_DATA_LEN(args[1], prefix, prefix_len);
...@@ -644,7 +644,7 @@ STATIC mp_obj_t str_startswith(uint n_args, const mp_obj_t *args) { ...@@ -644,7 +644,7 @@ STATIC mp_obj_t str_startswith(uint n_args, const mp_obj_t *args) {
return MP_BOOL(memcmp(start, prefix, prefix_len) == 0); return MP_BOOL(memcmp(start, prefix, prefix_len) == 0);
} }
STATIC mp_obj_t str_endswith(uint n_args, const mp_obj_t *args) { STATIC mp_obj_t str_endswith(mp_uint_t n_args, const mp_obj_t *args) {
GET_STR_DATA_LEN(args[0], str, str_len); GET_STR_DATA_LEN(args[0], str, str_len);
GET_STR_DATA_LEN(args[1], suffix, suffix_len); GET_STR_DATA_LEN(args[1], suffix, suffix_len);
assert(n_args == 2); assert(n_args == 2);
...@@ -657,7 +657,7 @@ STATIC mp_obj_t str_endswith(uint n_args, const mp_obj_t *args) { ...@@ -657,7 +657,7 @@ STATIC mp_obj_t str_endswith(uint n_args, const mp_obj_t *args) {
enum { LSTRIP, RSTRIP, STRIP }; enum { LSTRIP, RSTRIP, STRIP };
STATIC mp_obj_t str_uni_strip(int type, uint n_args, const mp_obj_t *args) { STATIC mp_obj_t str_uni_strip(int type, mp_uint_t n_args, const mp_obj_t *args) {
assert(1 <= n_args && n_args <= 2); assert(1 <= n_args && n_args <= 2);
assert(MP_OBJ_IS_STR_OR_BYTES(args[0])); assert(MP_OBJ_IS_STR_OR_BYTES(args[0]));
const mp_obj_type_t *self_type = mp_obj_get_type(args[0]); const mp_obj_type_t *self_type = mp_obj_get_type(args[0]);
...@@ -725,15 +725,15 @@ STATIC mp_obj_t str_uni_strip(int type, uint n_args, const mp_obj_t *args) { ...@@ -725,15 +725,15 @@ STATIC mp_obj_t str_uni_strip(int type, uint n_args, const mp_obj_t *args) {
return mp_obj_new_str_of_type(self_type, orig_str + first_good_char_pos, stripped_len); return mp_obj_new_str_of_type(self_type, orig_str + first_good_char_pos, stripped_len);
} }
STATIC mp_obj_t str_strip(uint n_args, const mp_obj_t *args) { STATIC mp_obj_t str_strip(mp_uint_t n_args, const mp_obj_t *args) {
return str_uni_strip(STRIP, n_args, args); return str_uni_strip(STRIP, n_args, args);
} }
STATIC mp_obj_t str_lstrip(uint n_args, const mp_obj_t *args) { STATIC mp_obj_t str_lstrip(mp_uint_t n_args, const mp_obj_t *args) {
return str_uni_strip(LSTRIP, n_args, args); return str_uni_strip(LSTRIP, n_args, args);
} }
STATIC mp_obj_t str_rstrip(uint n_args, const mp_obj_t *args) { STATIC mp_obj_t str_rstrip(mp_uint_t n_args, const mp_obj_t *args) {
return str_uni_strip(RSTRIP, n_args, args); return str_uni_strip(RSTRIP, n_args, args);
} }
...@@ -785,7 +785,7 @@ static mp_obj_t arg_as_int(mp_obj_t arg) { ...@@ -785,7 +785,7 @@ static mp_obj_t arg_as_int(mp_obj_t arg) {
return arg; return arg;
} }
mp_obj_t mp_obj_str_format(uint n_args, const mp_obj_t *args) { mp_obj_t mp_obj_str_format(mp_uint_t n_args, const mp_obj_t *args) {
assert(MP_OBJ_IS_STR(args[0])); assert(MP_OBJ_IS_STR(args[0]));
GET_STR_DATA_LEN(args[0], str, len); GET_STR_DATA_LEN(args[0], str, len);
...@@ -1148,7 +1148,7 @@ mp_obj_t mp_obj_str_format(uint n_args, const mp_obj_t *args) { ...@@ -1148,7 +1148,7 @@ mp_obj_t mp_obj_str_format(uint n_args, const mp_obj_t *args) {
return s; return s;
} }
STATIC mp_obj_t str_modulo_format(mp_obj_t pattern, uint n_args, const mp_obj_t *args, mp_obj_t dict) { STATIC mp_obj_t str_modulo_format(mp_obj_t pattern, mp_uint_t n_args, const mp_obj_t *args, mp_obj_t dict) {
assert(MP_OBJ_IS_STR(pattern)); assert(MP_OBJ_IS_STR(pattern));
GET_STR_DATA_LEN(pattern, str, len); GET_STR_DATA_LEN(pattern, str, len);
...@@ -1336,7 +1336,7 @@ not_enough_args: ...@@ -1336,7 +1336,7 @@ not_enough_args:
return s; return s;
} }
STATIC mp_obj_t str_replace(uint n_args, const mp_obj_t *args) { STATIC mp_obj_t str_replace(mp_uint_t n_args, const mp_obj_t *args) {
assert(MP_OBJ_IS_STR(args[0])); assert(MP_OBJ_IS_STR(args[0]));
mp_int_t max_rep = -1; mp_int_t max_rep = -1;
...@@ -1438,7 +1438,7 @@ STATIC mp_obj_t str_replace(uint n_args, const mp_obj_t *args) { ...@@ -1438,7 +1438,7 @@ STATIC mp_obj_t str_replace(uint n_args, const mp_obj_t *args) {
return mp_obj_str_builder_end(replaced_str); return mp_obj_str_builder_end(replaced_str);
} }
STATIC mp_obj_t str_count(uint n_args, const mp_obj_t *args) { STATIC mp_obj_t str_count(mp_uint_t n_args, const mp_obj_t *args) {
const mp_obj_type_t *self_type = mp_obj_get_type(args[0]); const mp_obj_type_t *self_type = mp_obj_get_type(args[0]);
assert(2 <= n_args && n_args <= 4); assert(2 <= n_args && n_args <= 4);
assert(MP_OBJ_IS_STR(args[0])); assert(MP_OBJ_IS_STR(args[0]));
...@@ -1595,7 +1595,7 @@ STATIC mp_obj_t str_islower(mp_obj_t self_in) { ...@@ -1595,7 +1595,7 @@ STATIC mp_obj_t str_islower(mp_obj_t self_in) {
// These methods are superfluous in the presense of str() and bytes() // These methods are superfluous in the presense of str() and bytes()
// constructors. // constructors.
// TODO: should accept kwargs too // TODO: should accept kwargs too
STATIC mp_obj_t bytes_decode(uint n_args, const mp_obj_t *args) { STATIC mp_obj_t bytes_decode(mp_uint_t n_args, const mp_obj_t *args) {
mp_obj_t new_args[2]; mp_obj_t new_args[2];
if (n_args == 1) { if (n_args == 1) {
new_args[0] = args[0]; new_args[0] = args[0];
...@@ -1607,7 +1607,7 @@ STATIC mp_obj_t bytes_decode(uint n_args, const mp_obj_t *args) { ...@@ -1607,7 +1607,7 @@ STATIC mp_obj_t bytes_decode(uint n_args, const mp_obj_t *args) {
} }
// TODO: should accept kwargs too // TODO: should accept kwargs too
STATIC mp_obj_t str_encode(uint n_args, const mp_obj_t *args) { STATIC mp_obj_t str_encode(mp_uint_t n_args, const mp_obj_t *args) {
mp_obj_t new_args[2]; mp_obj_t new_args[2];
if (n_args == 1) { if (n_args == 1) {
new_args[0] = args[0]; new_args[0] = args[0];
......
...@@ -50,10 +50,10 @@ typedef struct _mp_obj_str_t { ...@@ -50,10 +50,10 @@ typedef struct _mp_obj_str_t {
{ str_data = qstr_data(MP_OBJ_QSTR_VALUE(str_obj_in), &str_len); } \ { str_data = qstr_data(MP_OBJ_QSTR_VALUE(str_obj_in), &str_len); } \
else { str_len = ((mp_obj_str_t*)str_obj_in)->len; str_data = ((mp_obj_str_t*)str_obj_in)->data; } else { str_len = ((mp_obj_str_t*)str_obj_in)->len; str_data = ((mp_obj_str_t*)str_obj_in)->data; }
mp_obj_t mp_obj_str_format(uint n_args, const mp_obj_t *args); mp_obj_t mp_obj_str_format(mp_uint_t n_args, const mp_obj_t *args);
mp_obj_t mp_obj_new_str_of_type(const mp_obj_type_t *type, const byte* data, uint len); mp_obj_t mp_obj_new_str_of_type(const mp_obj_type_t *type, const byte* data, uint len);
mp_obj_t mp_obj_str_binary_op(int op, mp_obj_t lhs_in, mp_obj_t rhs_in); mp_obj_t mp_obj_str_binary_op(mp_uint_t op, mp_obj_t lhs_in, mp_obj_t rhs_in);
mp_int_t mp_obj_str_get_buffer(mp_obj_t self_in, mp_buffer_info_t *bufinfo, int flags); mp_int_t mp_obj_str_get_buffer(mp_obj_t self_in, mp_buffer_info_t *bufinfo, int flags);
const byte *str_index_to_ptr(const mp_obj_type_t *type, const byte *self_data, uint self_len, const byte *str_index_to_ptr(const mp_obj_type_t *type, const byte *self_data, uint self_len,
......
...@@ -95,7 +95,7 @@ STATIC mp_obj_t stringio_close(mp_obj_t self_in) { ...@@ -95,7 +95,7 @@ STATIC mp_obj_t stringio_close(mp_obj_t self_in) {
} }
STATIC MP_DEFINE_CONST_FUN_OBJ_1(stringio_close_obj, stringio_close); STATIC MP_DEFINE_CONST_FUN_OBJ_1(stringio_close_obj, stringio_close);
mp_obj_t stringio___exit__(uint n_args, const mp_obj_t *args) { mp_obj_t stringio___exit__(mp_uint_t n_args, const mp_obj_t *args) {
return stringio_close(args[0]); return stringio_close(args[0]);
} }
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(stringio___exit___obj, 4, 4, stringio___exit__); STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(stringio___exit___obj, 4, 4, stringio___exit__);
...@@ -108,7 +108,7 @@ STATIC mp_obj_stringio_t *stringio_new(mp_obj_t type_in) { ...@@ -108,7 +108,7 @@ STATIC mp_obj_stringio_t *stringio_new(mp_obj_t type_in) {
return o; return o;
} }
STATIC mp_obj_t stringio_make_new(mp_obj_t type_in, uint n_args, uint n_kw, const mp_obj_t *args) { STATIC mp_obj_t stringio_make_new(mp_obj_t type_in, mp_uint_t n_args, mp_uint_t n_kw, const mp_obj_t *args) {
mp_obj_stringio_t *o = stringio_new(type_in); mp_obj_stringio_t *o = stringio_new(type_in);
if (n_args > 0) { if (n_args > 0) {
......
...@@ -100,7 +100,7 @@ STATIC void uni_print(void (*print)(void *env, const char *fmt, ...), void *env, ...@@ -100,7 +100,7 @@ STATIC void uni_print(void (*print)(void *env, const char *fmt, ...), void *env,
} }
} }
STATIC mp_obj_t uni_unary_op(int op, mp_obj_t self_in) { STATIC mp_obj_t uni_unary_op(mp_uint_t op, mp_obj_t self_in) {
GET_STR_DATA_LEN(self_in, str_data, str_len); GET_STR_DATA_LEN(self_in, str_data, str_len);
switch (op) { switch (op) {
case MP_UNARY_OP_BOOL: case MP_UNARY_OP_BOOL:
...@@ -112,7 +112,7 @@ STATIC mp_obj_t uni_unary_op(int op, mp_obj_t self_in) { ...@@ -112,7 +112,7 @@ STATIC mp_obj_t uni_unary_op(int op, mp_obj_t self_in) {
} }
} }
STATIC mp_obj_t str_make_new(mp_obj_t type_in, uint n_args, uint n_kw, const mp_obj_t *args) { STATIC mp_obj_t str_make_new(mp_obj_t type_in, mp_uint_t n_args, mp_uint_t n_kw, const mp_obj_t *args) {
#if MICROPY_CPYTHON_COMPAT #if MICROPY_CPYTHON_COMPAT
if (n_kw != 0) { if (n_kw != 0) {
mp_arg_error_unimpl_kw(); mp_arg_error_unimpl_kw();
......
...@@ -56,7 +56,7 @@ void mp_obj_tuple_print(void (*print)(void *env, const char *fmt, ...), void *en ...@@ -56,7 +56,7 @@ void mp_obj_tuple_print(void (*print)(void *env, const char *fmt, ...), void *en
print(env, ")"); print(env, ")");
} }
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) { STATIC mp_obj_t mp_obj_tuple_make_new(mp_obj_t type_in, mp_uint_t n_args, mp_uint_t n_kw, const mp_obj_t *args) {
mp_arg_check_num(n_args, n_kw, 0, 1, false); mp_arg_check_num(n_args, n_kw, 0, 1, false);
switch (n_args) { switch (n_args) {
...@@ -96,7 +96,7 @@ STATIC mp_obj_t mp_obj_tuple_make_new(mp_obj_t type_in, uint n_args, uint n_kw, ...@@ -96,7 +96,7 @@ STATIC mp_obj_t mp_obj_tuple_make_new(mp_obj_t type_in, uint n_args, uint n_kw,
} }
// Don't pass MP_BINARY_OP_NOT_EQUAL here // 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) { STATIC bool tuple_cmp_helper(mp_uint_t op, mp_obj_t self_in, mp_obj_t another_in) {
mp_obj_type_t *self_type = mp_obj_get_type(self_in); mp_obj_type_t *self_type = mp_obj_get_type(self_in);
if (self_type->getiter != mp_obj_tuple_getiter) { if (self_type->getiter != mp_obj_tuple_getiter) {
assert(0); assert(0);
...@@ -115,7 +115,7 @@ STATIC bool tuple_cmp_helper(int op, mp_obj_t self_in, mp_obj_t another_in) { ...@@ -115,7 +115,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); return mp_seq_cmp_objs(op, self->items, self->len, another->items, another->len);
} }
mp_obj_t mp_obj_tuple_unary_op(int op, mp_obj_t self_in) { mp_obj_t mp_obj_tuple_unary_op(mp_uint_t op, mp_obj_t self_in) {
mp_obj_tuple_t *self = self_in; mp_obj_tuple_t *self = self_in;
switch (op) { switch (op) {
case MP_UNARY_OP_BOOL: return MP_BOOL(self->len != 0); case MP_UNARY_OP_BOOL: return MP_BOOL(self->len != 0);
...@@ -124,7 +124,7 @@ mp_obj_t mp_obj_tuple_unary_op(int op, mp_obj_t self_in) { ...@@ -124,7 +124,7 @@ 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_binary_op(mp_uint_t op, mp_obj_t lhs, mp_obj_t rhs) {
mp_obj_tuple_t *o = lhs; mp_obj_tuple_t *o = lhs;
switch (op) { switch (op) {
case MP_BINARY_OP_ADD: { case MP_BINARY_OP_ADD: {
...@@ -194,7 +194,7 @@ STATIC mp_obj_t tuple_count(mp_obj_t self_in, mp_obj_t value) { ...@@ -194,7 +194,7 @@ STATIC mp_obj_t tuple_count(mp_obj_t self_in, mp_obj_t value) {
} }
STATIC MP_DEFINE_CONST_FUN_OBJ_2(tuple_count_obj, tuple_count); STATIC MP_DEFINE_CONST_FUN_OBJ_2(tuple_count_obj, tuple_count);
STATIC mp_obj_t tuple_index(uint n_args, const mp_obj_t *args) { STATIC mp_obj_t tuple_index(mp_uint_t n_args, const mp_obj_t *args) {
assert(MP_OBJ_IS_TYPE(args[0], &mp_type_tuple)); assert(MP_OBJ_IS_TYPE(args[0], &mp_type_tuple));
mp_obj_tuple_t *self = args[0];