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
...@@ -119,7 +119,7 @@ STATIC NORETURN void syntax_error() { ...@@ -119,7 +119,7 @@ STATIC NORETURN void syntax_error() {
nlr_raise(mp_obj_new_exception_msg(&mp_type_TypeError, "syntax error in uctypes descriptor")); nlr_raise(mp_obj_new_exception_msg(&mp_type_TypeError, "syntax error in uctypes descriptor"));
} }
STATIC mp_obj_t uctypes_struct_make_new(mp_obj_t type_in, uint n_args, uint n_kw, const mp_obj_t *args) { STATIC mp_obj_t uctypes_struct_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 < 2 || n_args > 3) { if (n_args < 2 || n_args > 3) {
syntax_error(); syntax_error();
} }
......
...@@ -180,8 +180,8 @@ typedef mp_obj_t (*mp_fun_0_t)(void); ...@@ -180,8 +180,8 @@ typedef mp_obj_t (*mp_fun_0_t)(void);
typedef mp_obj_t (*mp_fun_1_t)(mp_obj_t); typedef mp_obj_t (*mp_fun_1_t)(mp_obj_t);
typedef mp_obj_t (*mp_fun_2_t)(mp_obj_t, mp_obj_t); typedef mp_obj_t (*mp_fun_2_t)(mp_obj_t, mp_obj_t);
typedef mp_obj_t (*mp_fun_3_t)(mp_obj_t, mp_obj_t, mp_obj_t); typedef mp_obj_t (*mp_fun_3_t)(mp_obj_t, mp_obj_t, mp_obj_t);
typedef mp_obj_t (*mp_fun_var_t)(uint n, const mp_obj_t *); typedef mp_obj_t (*mp_fun_var_t)(mp_uint_t n, const mp_obj_t *);
typedef mp_obj_t (*mp_fun_kw_t)(uint n, const mp_obj_t *, mp_map_t *); typedef mp_obj_t (*mp_fun_kw_t)(mp_uint_t n, const mp_obj_t *, mp_map_t *);
typedef enum { typedef enum {
PRINT_STR = 0, PRINT_STR = 0,
...@@ -191,10 +191,10 @@ typedef enum { ...@@ -191,10 +191,10 @@ typedef enum {
} mp_print_kind_t; } mp_print_kind_t;
typedef void (*mp_print_fun_t)(void (*print)(void *env, const char *fmt, ...), void *env, mp_obj_t o, mp_print_kind_t kind); typedef void (*mp_print_fun_t)(void (*print)(void *env, const char *fmt, ...), void *env, mp_obj_t o, mp_print_kind_t kind);
typedef mp_obj_t (*mp_make_new_fun_t)(mp_obj_t type_in, uint n_args, uint n_kw, const mp_obj_t *args); typedef mp_obj_t (*mp_make_new_fun_t)(mp_obj_t type_in, mp_uint_t n_args, mp_uint_t n_kw, const mp_obj_t *args);
typedef mp_obj_t (*mp_call_fun_t)(mp_obj_t fun, uint n_args, uint n_kw, const mp_obj_t *args); typedef mp_obj_t (*mp_call_fun_t)(mp_obj_t fun, mp_uint_t n_args, mp_uint_t n_kw, const mp_obj_t *args);
typedef mp_obj_t (*mp_unary_op_fun_t)(int op, mp_obj_t); typedef mp_obj_t (*mp_unary_op_fun_t)(mp_uint_t op, mp_obj_t);
typedef mp_obj_t (*mp_binary_op_fun_t)(int op, mp_obj_t, mp_obj_t); typedef mp_obj_t (*mp_binary_op_fun_t)(mp_uint_t op, mp_obj_t, mp_obj_t);
typedef void (*mp_load_attr_fun_t)(mp_obj_t self_in, qstr attr, mp_obj_t *dest); // for fail, do nothing; for attr, dest[0] = value; for method, dest[0] = method, dest[1] = self typedef void (*mp_load_attr_fun_t)(mp_obj_t self_in, qstr attr, mp_obj_t *dest); // for fail, do nothing; for attr, dest[0] = value; for method, dest[0] = method, dest[1] = self
typedef bool (*mp_store_attr_fun_t)(mp_obj_t self_in, qstr attr, mp_obj_t value); // return true if store succeeded; if value==MP_OBJ_NULL then delete typedef bool (*mp_store_attr_fun_t)(mp_obj_t self_in, qstr attr, mp_obj_t value); // return true if store succeeded; if value==MP_OBJ_NULL then delete
typedef mp_obj_t (*mp_subscr_fun_t)(mp_obj_t self_in, mp_obj_t index, mp_obj_t value); typedef mp_obj_t (*mp_subscr_fun_t)(mp_obj_t self_in, mp_obj_t index, mp_obj_t value);
...@@ -458,7 +458,7 @@ void mp_obj_exception_clear_traceback(mp_obj_t self_in); ...@@ -458,7 +458,7 @@ void mp_obj_exception_clear_traceback(mp_obj_t self_in);
void mp_obj_exception_add_traceback(mp_obj_t self_in, qstr file, mp_uint_t line, qstr block); void mp_obj_exception_add_traceback(mp_obj_t self_in, qstr file, mp_uint_t line, qstr block);
void mp_obj_exception_get_traceback(mp_obj_t self_in, mp_uint_t *n, mp_uint_t **values); void mp_obj_exception_get_traceback(mp_obj_t self_in, mp_uint_t *n, mp_uint_t **values);
mp_obj_t mp_obj_exception_get_value(mp_obj_t self_in); mp_obj_t mp_obj_exception_get_value(mp_obj_t self_in);
mp_obj_t mp_obj_exception_make_new(mp_obj_t type_in, uint n_args, uint n_kw, const mp_obj_t *args); mp_obj_t mp_obj_exception_make_new(mp_obj_t type_in, mp_uint_t n_args, mp_uint_t n_kw, const mp_obj_t *args);
mp_obj_t mp_alloc_emergency_exception_buf(mp_obj_t size_in); mp_obj_t mp_alloc_emergency_exception_buf(mp_obj_t size_in);
void mp_init_emergency_exception_buf(void); void mp_init_emergency_exception_buf(void);
...@@ -482,11 +482,11 @@ typedef struct _mp_obj_float_t { ...@@ -482,11 +482,11 @@ typedef struct _mp_obj_float_t {
mp_float_t value; mp_float_t value;
} mp_obj_float_t; } mp_obj_float_t;
mp_float_t mp_obj_float_get(mp_obj_t self_in); mp_float_t mp_obj_float_get(mp_obj_t self_in);
mp_obj_t mp_obj_float_binary_op(int op, mp_float_t lhs_val, mp_obj_t rhs); // can return MP_OBJ_NULL if op not supported mp_obj_t mp_obj_float_binary_op(mp_uint_t op, mp_float_t lhs_val, mp_obj_t rhs); // can return MP_OBJ_NULL if op not supported
// complex // complex
void mp_obj_complex_get(mp_obj_t self_in, mp_float_t *real, mp_float_t *imag); void mp_obj_complex_get(mp_obj_t self_in, mp_float_t *real, mp_float_t *imag);
mp_obj_t mp_obj_complex_binary_op(int op, mp_float_t lhs_real, mp_float_t lhs_imag, mp_obj_t rhs_in); // can return MP_OBJ_NULL if op not supported mp_obj_t mp_obj_complex_binary_op(mp_uint_t op, mp_float_t lhs_real, mp_float_t lhs_imag, mp_obj_t rhs_in); // can return MP_OBJ_NULL if op not supported
#endif #endif
// tuple // tuple
...@@ -501,7 +501,7 @@ mp_obj_t mp_obj_list_append(mp_obj_t self_in, mp_obj_t arg); ...@@ -501,7 +501,7 @@ mp_obj_t mp_obj_list_append(mp_obj_t self_in, mp_obj_t arg);
void mp_obj_list_get(mp_obj_t self_in, uint *len, mp_obj_t **items); void mp_obj_list_get(mp_obj_t self_in, uint *len, mp_obj_t **items);
void mp_obj_list_set_len(mp_obj_t self_in, uint len); void mp_obj_list_set_len(mp_obj_t self_in, uint len);
void mp_obj_list_store(mp_obj_t self_in, mp_obj_t index, mp_obj_t value); void mp_obj_list_store(mp_obj_t self_in, mp_obj_t index, mp_obj_t value);
mp_obj_t mp_obj_list_sort(uint n_args, const mp_obj_t *args, mp_map_t *kwargs); mp_obj_t mp_obj_list_sort(mp_uint_t n_args, const mp_obj_t *args, mp_map_t *kwargs);
// dict // dict
typedef struct _mp_obj_dict_t { typedef struct _mp_obj_dict_t {
...@@ -535,7 +535,7 @@ typedef struct _mp_obj_fun_builtin_t { // use this to make const objects that go ...@@ -535,7 +535,7 @@ typedef struct _mp_obj_fun_builtin_t { // use this to make const objects that go
void *fun; // must be a pointer to a callable function in ROM void *fun; // must be a pointer to a callable function in ROM
} mp_obj_fun_builtin_t; } mp_obj_fun_builtin_t;
mp_obj_t mp_obj_fun_binary_op(int op, mp_obj_t lhs_in, mp_obj_t rhs_in); mp_obj_t mp_obj_fun_binary_op(mp_uint_t op, mp_obj_t lhs_in, mp_obj_t rhs_in);
const char *mp_obj_fun_get_name(mp_const_obj_t fun); const char *mp_obj_fun_get_name(mp_const_obj_t fun);
const char *mp_obj_code_get_name(const byte *code_info); const char *mp_obj_code_get_name(const byte *code_info);
......
...@@ -104,7 +104,7 @@ STATIC mp_obj_t array_construct(char typecode, mp_obj_t initializer) { ...@@ -104,7 +104,7 @@ STATIC mp_obj_t array_construct(char typecode, mp_obj_t initializer) {
return array; return array;
} }
STATIC mp_obj_t array_make_new(mp_obj_t type_in, uint n_args, uint n_kw, const mp_obj_t *args) { STATIC mp_obj_t array_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, 2, false); mp_arg_check_num(n_args, n_kw, 1, 2, false);
// get typecode // get typecode
...@@ -120,7 +120,7 @@ STATIC mp_obj_t array_make_new(mp_obj_t type_in, uint n_args, uint n_kw, const m ...@@ -120,7 +120,7 @@ STATIC mp_obj_t array_make_new(mp_obj_t type_in, uint n_args, uint n_kw, const m
} }
} }
STATIC mp_obj_t bytearray_make_new(mp_obj_t type_in, uint n_args, uint n_kw, const mp_obj_t *args) { STATIC mp_obj_t bytearray_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);
if (n_args == 0) { if (n_args == 0) {
...@@ -138,7 +138,7 @@ STATIC mp_obj_t bytearray_make_new(mp_obj_t type_in, uint n_args, uint n_kw, con ...@@ -138,7 +138,7 @@ STATIC mp_obj_t bytearray_make_new(mp_obj_t type_in, uint n_args, uint n_kw, con
} }
} }
STATIC mp_obj_t array_unary_op(int op, mp_obj_t o_in) { STATIC mp_obj_t array_unary_op(mp_uint_t op, mp_obj_t o_in) {
mp_obj_array_t *o = o_in; mp_obj_array_t *o = o_in;
switch (op) { switch (op) {
case MP_UNARY_OP_BOOL: return MP_BOOL(o->len != 0); case MP_UNARY_OP_BOOL: return MP_BOOL(o->len != 0);
...@@ -147,7 +147,7 @@ STATIC mp_obj_t array_unary_op(int op, mp_obj_t o_in) { ...@@ -147,7 +147,7 @@ STATIC mp_obj_t array_unary_op(int op, mp_obj_t o_in) {
} }
} }
STATIC mp_obj_t array_binary_op(int op, mp_obj_t lhs_in, mp_obj_t rhs_in) { STATIC mp_obj_t array_binary_op(mp_uint_t op, mp_obj_t lhs_in, mp_obj_t rhs_in) {
switch (op) { switch (op) {
case MP_BINARY_OP_EQUAL: { case MP_BINARY_OP_EQUAL: {
mp_buffer_info_t lhs_bufinfo; mp_buffer_info_t lhs_bufinfo;
......
...@@ -48,7 +48,7 @@ STATIC void bool_print(void (*print)(void *env, const char *fmt, ...), void *env ...@@ -48,7 +48,7 @@ STATIC void bool_print(void (*print)(void *env, const char *fmt, ...), void *env
} }
} }
STATIC mp_obj_t bool_make_new(mp_obj_t type_in, uint n_args, uint n_kw, const mp_obj_t *args) { STATIC mp_obj_t bool_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) {
...@@ -60,7 +60,7 @@ STATIC mp_obj_t bool_make_new(mp_obj_t type_in, uint n_args, uint n_kw, const mp ...@@ -60,7 +60,7 @@ STATIC mp_obj_t bool_make_new(mp_obj_t type_in, uint n_args, uint n_kw, const mp
} }
} }
STATIC mp_obj_t bool_unary_op(int op, mp_obj_t o_in) { STATIC mp_obj_t bool_unary_op(mp_uint_t op, mp_obj_t o_in) {
mp_int_t value = ((mp_obj_bool_t*)o_in)->value; mp_int_t value = ((mp_obj_bool_t*)o_in)->value;
switch (op) { switch (op) {
case MP_UNARY_OP_BOOL: return o_in; case MP_UNARY_OP_BOOL: return o_in;
...@@ -72,7 +72,7 @@ STATIC mp_obj_t bool_unary_op(int op, mp_obj_t o_in) { ...@@ -72,7 +72,7 @@ STATIC mp_obj_t bool_unary_op(int op, mp_obj_t o_in) {
} }
} }
STATIC mp_obj_t bool_binary_op(int op, mp_obj_t lhs_in, mp_obj_t rhs_in) { STATIC mp_obj_t bool_binary_op(mp_uint_t op, mp_obj_t lhs_in, mp_obj_t rhs_in) {
if (MP_BINARY_OP_OR <= op && op <= MP_BINARY_OP_NOT_EQUAL) { if (MP_BINARY_OP_OR <= op && op <= MP_BINARY_OP_NOT_EQUAL) {
return mp_binary_op(op, MP_OBJ_NEW_SMALL_INT(mp_obj_is_true(lhs_in)), rhs_in); return mp_binary_op(op, MP_OBJ_NEW_SMALL_INT(mp_obj_is_true(lhs_in)), rhs_in);
} }
......
...@@ -50,7 +50,7 @@ STATIC void bound_meth_print(void (*print)(void *env, const char *fmt, ...), voi ...@@ -50,7 +50,7 @@ STATIC void bound_meth_print(void (*print)(void *env, const char *fmt, ...), voi
} }
#endif #endif
mp_obj_t bound_meth_call(mp_obj_t self_in, uint n_args, uint n_kw, const mp_obj_t *args) { mp_obj_t bound_meth_call(mp_obj_t self_in, mp_uint_t n_args, mp_uint_t n_kw, const mp_obj_t *args) {
mp_obj_bound_meth_t *self = self_in; mp_obj_bound_meth_t *self = self_in;
// need to insert self->self before all other args and then call self->meth // need to insert self->self before all other args and then call self->meth
......
...@@ -41,7 +41,7 @@ typedef struct _mp_obj_closure_t { ...@@ -41,7 +41,7 @@ typedef struct _mp_obj_closure_t {
mp_obj_t closed[]; mp_obj_t closed[];
} mp_obj_closure_t; } mp_obj_closure_t;
mp_obj_t closure_call(mp_obj_t self_in, uint n_args, uint n_kw, const mp_obj_t *args) { mp_obj_t closure_call(mp_obj_t self_in, mp_uint_t n_args, mp_uint_t n_kw, const mp_obj_t *args) {
mp_obj_closure_t *self = self_in; mp_obj_closure_t *self = self_in;
// need to concatenate closed-over-vars and args // need to concatenate closed-over-vars and args
......
...@@ -74,7 +74,7 @@ STATIC void complex_print(void (*print)(void *env, const char *fmt, ...), void * ...@@ -74,7 +74,7 @@ STATIC void complex_print(void (*print)(void *env, const char *fmt, ...), void *
#endif #endif
} }
STATIC mp_obj_t complex_make_new(mp_obj_t type_in, uint n_args, uint n_kw, const mp_obj_t *args) { STATIC mp_obj_t complex_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, 2, false); mp_arg_check_num(n_args, n_kw, 0, 2, false);
switch (n_args) { switch (n_args) {
...@@ -117,7 +117,7 @@ STATIC mp_obj_t complex_make_new(mp_obj_t type_in, uint n_args, uint n_kw, const ...@@ -117,7 +117,7 @@ STATIC mp_obj_t complex_make_new(mp_obj_t type_in, uint n_args, uint n_kw, const
} }
} }
STATIC mp_obj_t complex_unary_op(int op, mp_obj_t o_in) { STATIC mp_obj_t complex_unary_op(mp_uint_t op, mp_obj_t o_in) {
mp_obj_complex_t *o = o_in; mp_obj_complex_t *o = o_in;
switch (op) { switch (op) {
case MP_UNARY_OP_BOOL: return MP_BOOL(o->real != 0 || o->imag != 0); case MP_UNARY_OP_BOOL: return MP_BOOL(o->real != 0 || o->imag != 0);
...@@ -127,7 +127,7 @@ STATIC mp_obj_t complex_unary_op(int op, mp_obj_t o_in) { ...@@ -127,7 +127,7 @@ STATIC mp_obj_t complex_unary_op(int op, mp_obj_t o_in) {
} }
} }
STATIC mp_obj_t complex_binary_op(int op, mp_obj_t lhs_in, mp_obj_t rhs_in) { STATIC mp_obj_t complex_binary_op(mp_uint_t op, mp_obj_t lhs_in, mp_obj_t rhs_in) {
mp_obj_complex_t *lhs = lhs_in; mp_obj_complex_t *lhs = lhs_in;
return mp_obj_complex_binary_op(op, lhs->real, lhs->imag, rhs_in); return mp_obj_complex_binary_op(op, lhs->real, lhs->imag, rhs_in);
} }
...@@ -166,7 +166,7 @@ void mp_obj_complex_get(mp_obj_t self_in, mp_float_t *real, mp_float_t *imag) { ...@@ -166,7 +166,7 @@ void mp_obj_complex_get(mp_obj_t self_in, mp_float_t *real, mp_float_t *imag) {
*imag = self->imag; *imag = self->imag;
} }
mp_obj_t mp_obj_complex_binary_op(int op, mp_float_t lhs_real, mp_float_t lhs_imag, mp_obj_t rhs_in) { mp_obj_t mp_obj_complex_binary_op(mp_uint_t op, mp_float_t lhs_real, mp_float_t lhs_imag, mp_obj_t rhs_in) {
mp_float_t rhs_real, rhs_imag; mp_float_t rhs_real, rhs_imag;
mp_obj_get_complex(rhs_in, &rhs_real, &rhs_imag); // can be any type, this function will convert to float (if possible) mp_obj_get_complex(rhs_in, &rhs_real, &rhs_imag); // can be any type, this function will convert to float (if possible)
switch (op) { switch (op) {
......
...@@ -60,7 +60,7 @@ STATIC void dict_print(void (*print)(void *env, const char *fmt, ...), void *env ...@@ -60,7 +60,7 @@ STATIC void dict_print(void (*print)(void *env, const char *fmt, ...), void *env
print(env, "}"); print(env, "}");
} }
STATIC mp_obj_t dict_make_new(mp_obj_t type_in, uint n_args, uint n_kw, const mp_obj_t *args) { STATIC mp_obj_t dict_make_new(mp_obj_t type_in, mp_uint_t n_args, mp_uint_t n_kw, const mp_obj_t *args) {
mp_obj_t dict = mp_obj_new_dict(0); mp_obj_t dict = mp_obj_new_dict(0);
if (n_args > 0 || n_kw > 0) { if (n_args > 0 || n_kw > 0) {
mp_obj_t args2[2] = {dict, args[0]}; // args[0] is always valid, even if it's not a positional arg mp_obj_t args2[2] = {dict, args[0]}; // args[0] is always valid, even if it's not a positional arg
...@@ -71,7 +71,7 @@ STATIC mp_obj_t dict_make_new(mp_obj_t type_in, uint n_args, uint n_kw, const mp ...@@ -71,7 +71,7 @@ STATIC mp_obj_t dict_make_new(mp_obj_t type_in, uint n_args, uint n_kw, const mp
return dict; return dict;
} }
STATIC mp_obj_t dict_unary_op(int op, mp_obj_t self_in) { STATIC mp_obj_t dict_unary_op(mp_uint_t op, mp_obj_t self_in) {
mp_obj_dict_t *self = self_in; mp_obj_dict_t *self = self_in;
switch (op) { switch (op) {
case MP_UNARY_OP_BOOL: return MP_BOOL(self->map.used != 0); case MP_UNARY_OP_BOOL: return MP_BOOL(self->map.used != 0);
...@@ -80,7 +80,7 @@ STATIC mp_obj_t dict_unary_op(int op, mp_obj_t self_in) { ...@@ -80,7 +80,7 @@ STATIC mp_obj_t dict_unary_op(int op, mp_obj_t self_in) {
} }
} }
STATIC mp_obj_t dict_binary_op(int op, mp_obj_t lhs_in, mp_obj_t rhs_in) { STATIC mp_obj_t dict_binary_op(mp_uint_t op, mp_obj_t lhs_in, mp_obj_t rhs_in) {
mp_obj_dict_t *o = lhs_in; mp_obj_dict_t *o = lhs_in;
switch (op) { switch (op) {
case MP_BINARY_OP_IN: { case MP_BINARY_OP_IN: {
...@@ -472,7 +472,7 @@ STATIC void dict_view_print(void (*print)(void *env, const char *fmt, ...), void ...@@ -472,7 +472,7 @@ STATIC void dict_view_print(void (*print)(void *env, const char *fmt, ...), void
print(env, "])"); print(env, "])");
} }
STATIC mp_obj_t dict_view_binary_op(int op, mp_obj_t lhs_in, mp_obj_t rhs_in) { STATIC mp_obj_t dict_view_binary_op(mp_uint_t op, mp_obj_t lhs_in, mp_obj_t rhs_in) {
// only supported for the 'keys' kind until sets and dicts are refactored // only supported for the 'keys' kind until sets and dicts are refactored
mp_obj_dict_view_t *o = lhs_in; mp_obj_dict_view_t *o = lhs_in;
if (o->kind != MP_DICT_VIEW_KEYS) { if (o->kind != MP_DICT_VIEW_KEYS) {
......
...@@ -47,7 +47,7 @@ STATIC const mp_arg_t enumerate_make_new_args[] = { ...@@ -47,7 +47,7 @@ STATIC const mp_arg_t enumerate_make_new_args[] = {
}; };
#define ENUMERATE_MAKE_NEW_NUM_ARGS MP_ARRAY_SIZE(enumerate_make_new_args) #define ENUMERATE_MAKE_NEW_NUM_ARGS MP_ARRAY_SIZE(enumerate_make_new_args)
STATIC mp_obj_t enumerate_make_new(mp_obj_t type_in, uint n_args, uint n_kw, const mp_obj_t *args) { STATIC mp_obj_t enumerate_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
// parse args // parse args
mp_arg_val_t vals[ENUMERATE_MAKE_NEW_NUM_ARGS]; mp_arg_val_t vals[ENUMERATE_MAKE_NEW_NUM_ARGS];
......
...@@ -130,7 +130,7 @@ STATIC void mp_obj_exception_print(void (*print)(void *env, const char *fmt, ... ...@@ -130,7 +130,7 @@ STATIC void mp_obj_exception_print(void (*print)(void *env, const char *fmt, ...
mp_obj_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) { mp_obj_t mp_obj_exception_make_new(mp_obj_t type_in, mp_uint_t n_args, mp_uint_t n_kw, const mp_obj_t *args) {
mp_obj_type_t *type = type_in; mp_obj_type_t *type = type_in;
if (n_kw != 0) { if (n_kw != 0) {
...@@ -171,7 +171,7 @@ STATIC void exception_load_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) { ...@@ -171,7 +171,7 @@ STATIC void exception_load_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) {
} }
} }
STATIC mp_obj_t exc___init__(uint n_args, const mp_obj_t *args) { STATIC mp_obj_t exc___init__(mp_uint_t n_args, const mp_obj_t *args) {
mp_obj_exception_t *self = args[0]; mp_obj_exception_t *self = args[0];
mp_obj_t argst = mp_obj_new_tuple(n_args - 1, args + 1); mp_obj_t argst = mp_obj_new_tuple(n_args - 1, args + 1);
self->args = argst; self->args = argst;
......
...@@ -40,7 +40,7 @@ typedef struct _mp_obj_filter_t { ...@@ -40,7 +40,7 @@ typedef struct _mp_obj_filter_t {
mp_obj_t iter; mp_obj_t iter;
} mp_obj_filter_t; } mp_obj_filter_t;
STATIC mp_obj_t filter_make_new(mp_obj_t type_in, uint n_args, uint n_kw, const mp_obj_t *args) { STATIC mp_obj_t filter_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 != 2 || n_kw != 0) { if (n_args != 2 || n_kw != 0) {
nlr_raise(mp_obj_new_exception_msg(&mp_type_TypeError, "filter expected 2 arguments")); nlr_raise(mp_obj_new_exception_msg(&mp_type_TypeError, "filter expected 2 arguments"));
} }
......
...@@ -66,7 +66,7 @@ STATIC void float_print(void (*print)(void *env, const char *fmt, ...), void *en ...@@ -66,7 +66,7 @@ STATIC void float_print(void (*print)(void *env, const char *fmt, ...), void *en
#endif #endif
} }
STATIC mp_obj_t float_make_new(mp_obj_t type_in, uint n_args, uint n_kw, const mp_obj_t *args) { STATIC mp_obj_t float_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) {
...@@ -90,7 +90,7 @@ STATIC mp_obj_t float_make_new(mp_obj_t type_in, uint n_args, uint n_kw, const m ...@@ -90,7 +90,7 @@ STATIC mp_obj_t float_make_new(mp_obj_t type_in, uint n_args, uint n_kw, const m
} }
} }
STATIC mp_obj_t float_unary_op(int op, mp_obj_t o_in) { STATIC mp_obj_t float_unary_op(mp_uint_t op, mp_obj_t o_in) {
mp_obj_float_t *o = o_in; mp_obj_float_t *o = o_in;
switch (op) { switch (op) {
case MP_UNARY_OP_BOOL: return MP_BOOL(o->value != 0); case MP_UNARY_OP_BOOL: return MP_BOOL(o->value != 0);
...@@ -100,7 +100,7 @@ STATIC mp_obj_t float_unary_op(int op, mp_obj_t o_in) { ...@@ -100,7 +100,7 @@ STATIC mp_obj_t float_unary_op(int op, mp_obj_t o_in) {
} }
} }
STATIC mp_obj_t float_binary_op(int op, mp_obj_t lhs_in, mp_obj_t rhs_in) { STATIC mp_obj_t float_binary_op(mp_uint_t op, mp_obj_t lhs_in, mp_obj_t rhs_in) {
mp_obj_float_t *lhs = lhs_in; mp_obj_float_t *lhs = lhs_in;
#if MICROPY_PY_BUILTINS_COMPLEX #if MICROPY_PY_BUILTINS_COMPLEX
if (MP_OBJ_IS_TYPE(rhs_in, &mp_type_complex)) { if (MP_OBJ_IS_TYPE(rhs_in, &mp_type_complex)) {
...@@ -134,7 +134,7 @@ mp_float_t mp_obj_float_get(mp_obj_t self_in) { ...@@ -134,7 +134,7 @@ mp_float_t mp_obj_float_get(mp_obj_t self_in) {
return self->value; return self->value;
} }
mp_obj_t mp_obj_float_binary_op(int op, mp_float_t lhs_val, mp_obj_t rhs_in) { mp_obj_t mp_obj_float_binary_op(mp_uint_t op, mp_float_t lhs_val, mp_obj_t rhs_in) {
mp_float_t rhs_val = mp_obj_get_float(rhs_in); // can be any type, this function will convert to float (if possible) mp_float_t rhs_val = mp_obj_get_float(rhs_in); // can be any type, this function will convert to float (if possible)
switch (op) { switch (op) {
case MP_BINARY_OP_ADD: case MP_BINARY_OP_ADD:
......
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
// This binary_op method is used for all function types, and is also // This binary_op method is used for all function types, and is also
// used to determine if an object is of generic function type. // used to determine if an object is of generic function type.
mp_obj_t mp_obj_fun_binary_op(int op, mp_obj_t lhs_in, mp_obj_t rhs_in) { mp_obj_t mp_obj_fun_binary_op(mp_uint_t op, mp_obj_t lhs_in, mp_obj_t rhs_in) {
switch (op) { switch (op) {
case MP_BINARY_OP_EQUAL: case MP_BINARY_OP_EQUAL:
// These objects can be equal only if it's the same underlying structure, // These objects can be equal only if it's the same underlying structure,
...@@ -64,7 +64,7 @@ mp_obj_t mp_obj_fun_binary_op(int op, mp_obj_t lhs_in, mp_obj_t rhs_in) { ...@@ -64,7 +64,7 @@ mp_obj_t mp_obj_fun_binary_op(int op, mp_obj_t lhs_in, mp_obj_t rhs_in) {
// mp_obj_fun_builtin_t defined in obj.h // mp_obj_fun_builtin_t defined in obj.h
STATIC mp_obj_t fun_builtin_call(mp_obj_t self_in, uint n_args, uint n_kw, const mp_obj_t *args) { STATIC mp_obj_t fun_builtin_call(mp_obj_t self_in, mp_uint_t n_args, mp_uint_t n_kw, const mp_obj_t *args) {
assert(MP_OBJ_IS_TYPE(self_in, &mp_type_fun_builtin)); assert(MP_OBJ_IS_TYPE(self_in, &mp_type_fun_builtin));
mp_obj_fun_builtin_t *self = self_in; mp_obj_fun_builtin_t *self = self_in;
...@@ -348,7 +348,7 @@ continue2:; ...@@ -348,7 +348,7 @@ continue2:;
} }
STATIC mp_obj_t fun_bc_call(mp_obj_t self_in, uint n_args, uint n_kw, const mp_obj_t *args) { STATIC mp_obj_t fun_bc_call(mp_obj_t self_in, mp_uint_t n_args, mp_uint_t n_kw, const mp_obj_t *args) {
MP_STACK_CHECK(); MP_STACK_CHECK();
DEBUG_printf("Input n_args: %d, n_kw: %d\n", n_args, n_kw); DEBUG_printf("Input n_args: %d, n_kw: %d\n", n_args, n_kw);
...@@ -510,7 +510,7 @@ typedef mp_obj_t (*native_fun_1_t)(mp_obj_t); ...@@ -510,7 +510,7 @@ typedef mp_obj_t (*native_fun_1_t)(mp_obj_t);
typedef mp_obj_t (*native_fun_2_t)(mp_obj_t, mp_obj_t); typedef mp_obj_t (*native_fun_2_t)(mp_obj_t, mp_obj_t);
typedef mp_obj_t (*native_fun_3_t)(mp_obj_t, mp_obj_t, mp_obj_t); typedef mp_obj_t (*native_fun_3_t)(mp_obj_t, mp_obj_t, mp_obj_t);
STATIC mp_obj_t fun_native_call(mp_obj_t self_in, uint n_args, uint n_kw, const mp_obj_t *args) { STATIC mp_obj_t fun_native_call(mp_obj_t self_in, mp_uint_t n_args, mp_uint_t n_kw, const mp_obj_t *args) {
mp_obj_fun_native_t *self = self_in; mp_obj_fun_native_t *self = self_in;
mp_arg_check_num(n_args, n_kw, self->n_args, self->n_args, false); mp_arg_check_num(n_args, n_kw, self->n_args, self->n_args, false);
...@@ -571,7 +571,7 @@ typedef mp_uint_t (*viper_fun_1_t)(mp_uint_t); ...@@ -571,7 +571,7 @@ typedef mp_uint_t (*viper_fun_1_t)(mp_uint_t);
typedef mp_uint_t (*viper_fun_2_t)(mp_uint_t, mp_uint_t); typedef mp_uint_t (*viper_fun_2_t)(mp_uint_t, mp_uint_t);
typedef mp_uint_t (*viper_fun_3_t)(mp_uint_t, mp_uint_t, mp_uint_t); typedef mp_uint_t (*viper_fun_3_t)(mp_uint_t, mp_uint_t, mp_uint_t);
STATIC mp_obj_t fun_viper_call(mp_obj_t self_in, uint n_args, uint n_kw, const mp_obj_t *args) { STATIC mp_obj_t fun_viper_call(mp_obj_t self_in, mp_uint_t n_args, mp_uint_t n_kw, const mp_obj_t *args) {
mp_obj_fun_viper_t *self = self_in; mp_obj_fun_viper_t *self = self_in;
mp_arg_check_num(n_args, n_kw, self->n_args, self->n_args, false); mp_arg_check_num(n_args, n_kw, self->n_args, self->n_args, false);
...@@ -682,7 +682,7 @@ STATIC mp_obj_t convert_val_from_inline_asm(mp_uint_t val) { ...@@ -682,7 +682,7 @@ STATIC mp_obj_t convert_val_from_inline_asm(mp_uint_t val) {
return MP_OBJ_NEW_SMALL_INT(val); return MP_OBJ_NEW_SMALL_INT(val);
} }
STATIC mp_obj_t fun_asm_call(mp_obj_t self_in, uint n_args, uint n_kw, const mp_obj_t *args) { STATIC mp_obj_t fun_asm_call(mp_obj_t self_in, mp_uint_t n_args, mp_uint_t n_kw, const mp_obj_t *args) {
mp_obj_fun_asm_t *self = self_in; mp_obj_fun_asm_t *self = self_in;
mp_arg_check_num(n_args, n_kw, self->n_args, self->n_args, false); mp_arg_check_num(n_args, n_kw, self->n_args, self->n_args, false);
......
...@@ -52,7 +52,7 @@ typedef struct _mp_obj_gen_instance_t { ...@@ -52,7 +52,7 @@ typedef struct _mp_obj_gen_instance_t {
mp_code_state code_state; mp_code_state code_state;
} mp_obj_gen_instance_t; } mp_obj_gen_instance_t;
STATIC mp_obj_t gen_wrap_call(mp_obj_t self_in, uint n_args, uint n_kw, const mp_obj_t *args) { STATIC mp_obj_t gen_wrap_call(mp_obj_t self_in, mp_uint_t n_args, mp_uint_t n_kw, const mp_obj_t *args) {
mp_obj_gen_wrap_t *self = self_in; mp_obj_gen_wrap_t *self = self_in;
mp_obj_fun_bc_t *self_fun = (mp_obj_fun_bc_t*)self->fun; mp_obj_fun_bc_t *self_fun = (mp_obj_fun_bc_t*)self->fun;
assert(MP_OBJ_IS_TYPE(self_fun, &mp_type_fun_bc)); assert(MP_OBJ_IS_TYPE(self_fun, &mp_type_fun_bc));
...@@ -197,7 +197,7 @@ STATIC mp_obj_t gen_instance_send(mp_obj_t self_in, mp_obj_t send_value) { ...@@ -197,7 +197,7 @@ STATIC mp_obj_t gen_instance_send(mp_obj_t self_in, mp_obj_t send_value) {
STATIC MP_DEFINE_CONST_FUN_OBJ_2(gen_instance_send_obj, gen_instance_send); STATIC MP_DEFINE_CONST_FUN_OBJ_2(gen_instance_send_obj, gen_instance_send);
STATIC mp_obj_t gen_instance_close(mp_obj_t self_in); STATIC mp_obj_t gen_instance_close(mp_obj_t self_in);
STATIC mp_obj_t gen_instance_throw(uint n_args, const mp_obj_t *args) { STATIC mp_obj_t gen_instance_throw(mp_uint_t n_args, const mp_obj_t *args) {
mp_obj_t exc = (n_args == 2) ? args[1] : args[2]; mp_obj_t exc = (n_args == 2) ? args[1] : args[2];
exc = mp_make_raise_obj(exc); exc = mp_make_raise_obj(exc);
......
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
#endif #endif
// This dispatcher function is expected to be independent of the implementation of long int // This dispatcher function is expected to be independent of the implementation of long int
STATIC mp_obj_t mp_obj_int_make_new(mp_obj_t type_in, uint n_args, uint n_kw, const mp_obj_t *args) { STATIC mp_obj_t mp_obj_int_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, 2, false); mp_arg_check_num(n_args, n_kw, 0, 2, false);
switch (n_args) { switch (n_args) {
...@@ -225,12 +225,12 @@ bool mp_obj_int_is_positive(mp_obj_t self_in) { ...@@ -225,12 +225,12 @@ bool mp_obj_int_is_positive(mp_obj_t self_in) {
} }
// This is called for operations on SMALL_INT that are not handled by mp_unary_op // This is called for operations on SMALL_INT that are not handled by mp_unary_op
mp_obj_t mp_obj_int_unary_op(int op, mp_obj_t o_in) { mp_obj_t mp_obj_int_unary_op(mp_uint_t op, mp_obj_t o_in) {
return MP_OBJ_NULL; // op not supported return MP_OBJ_NULL; // op not supported
} }
// This is called for operations on SMALL_INT that are not handled by mp_binary_op // This is called for operations on SMALL_INT that are not handled by mp_binary_op
mp_obj_t mp_obj_int_binary_op(int op, mp_obj_t lhs_in, mp_obj_t rhs_in) { mp_obj_t mp_obj_int_binary_op(mp_uint_t op, mp_obj_t lhs_in, mp_obj_t rhs_in) {
return mp_obj_int_binary_op_extra_cases(op, lhs_in, rhs_in); return mp_obj_int_binary_op_extra_cases(op, lhs_in, rhs_in);
} }
...@@ -282,7 +282,7 @@ mp_float_t mp_obj_int_as_float(mp_obj_t self_in) { ...@@ -282,7 +282,7 @@ mp_float_t mp_obj_int_as_float(mp_obj_t self_in) {
// This dispatcher function is expected to be independent of the implementation of long int // This dispatcher function is expected to be independent of the implementation of long int
// It handles the extra cases for integer-like arithmetic // It handles the extra cases for integer-like arithmetic
mp_obj_t mp_obj_int_binary_op_extra_cases(int op, mp_obj_t lhs_in, mp_obj_t rhs_in) { mp_obj_t mp_obj_int_binary_op_extra_cases(mp_uint_t op, mp_obj_t lhs_in, mp_obj_t rhs_in) {