Commit 4b72b3a1 authored by Damien George's avatar Damien George
Browse files

py: Change type signature of builtin funs that take variable or kw args.

With this patch the n_args parameter is changed type from mp_uint_t to
size_t.
parent a0c97814
...@@ -45,7 +45,7 @@ mp_import_stat_t mp_import_stat(const char *path) { ...@@ -45,7 +45,7 @@ mp_import_stat_t mp_import_stat(const char *path) {
return MP_IMPORT_STAT_NO_EXIST; return MP_IMPORT_STAT_NO_EXIST;
} }
mp_obj_t mp_builtin_open(mp_uint_t n_args, const mp_obj_t *args, mp_map_t *kwargs) { mp_obj_t mp_builtin_open(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs) {
return mp_const_none; return mp_const_none;
} }
MP_DEFINE_CONST_FUN_OBJ_KW(mp_builtin_open_obj, 1, mp_builtin_open); MP_DEFINE_CONST_FUN_OBJ_KW(mp_builtin_open_obj, 1, mp_builtin_open);
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
#include "modubinascii.h" #include "modubinascii.h"
mp_obj_t mod_binascii_hexlify(mp_uint_t n_args, const mp_obj_t *args) { mp_obj_t mod_binascii_hexlify(size_t n_args, const mp_obj_t *args) {
// Second argument is for an extension to allow a separator to be used // Second argument is for an extension to allow a separator to be used
// between values. // between values.
const char *sep = NULL; const char *sep = NULL;
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
#ifndef MICROPY_EXTMOD_MODUBINASCII #ifndef MICROPY_EXTMOD_MODUBINASCII
#define MICROPY_EXTMOD_MODUBINASCII #define MICROPY_EXTMOD_MODUBINASCII
extern mp_obj_t mod_binascii_hexlify(mp_uint_t n_args, const mp_obj_t *args); extern mp_obj_t mod_binascii_hexlify(size_t n_args, const mp_obj_t *args);
extern mp_obj_t mod_binascii_unhexlify(mp_obj_t data); extern mp_obj_t mod_binascii_unhexlify(mp_obj_t data);
extern mp_obj_t mod_binascii_a2b_base64(mp_obj_t data); extern mp_obj_t mod_binascii_a2b_base64(mp_obj_t data);
extern mp_obj_t mod_binascii_b2a_base64(mp_obj_t data); extern mp_obj_t mod_binascii_b2a_base64(mp_obj_t data);
......
...@@ -115,17 +115,17 @@ STATIC mp_obj_t re_exec(bool is_anchored, uint n_args, const mp_obj_t *args) { ...@@ -115,17 +115,17 @@ STATIC mp_obj_t re_exec(bool is_anchored, uint n_args, const mp_obj_t *args) {
return MP_OBJ_FROM_PTR(match); return MP_OBJ_FROM_PTR(match);
} }
STATIC mp_obj_t re_match(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t re_match(size_t n_args, const mp_obj_t *args) {
return re_exec(true, n_args, args); return re_exec(true, n_args, args);
} }
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(re_match_obj, 2, 4, re_match); MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(re_match_obj, 2, 4, re_match);
STATIC mp_obj_t re_search(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t re_search(size_t n_args, const mp_obj_t *args) {
return re_exec(false, n_args, args); return re_exec(false, n_args, args);
} }
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(re_search_obj, 2, 4, re_search); MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(re_search_obj, 2, 4, re_search);
STATIC mp_obj_t re_split(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t re_split(size_t n_args, const mp_obj_t *args) {
mp_obj_re_t *self = MP_OBJ_TO_PTR(args[0]); mp_obj_re_t *self = MP_OBJ_TO_PTR(args[0]);
Subject subj; Subject subj;
mp_uint_t len; mp_uint_t len;
...@@ -182,7 +182,7 @@ STATIC const mp_obj_type_t re_type = { ...@@ -182,7 +182,7 @@ STATIC const mp_obj_type_t re_type = {
.locals_dict = (void*)&re_locals_dict, .locals_dict = (void*)&re_locals_dict,
}; };
STATIC mp_obj_t mod_re_compile(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t mod_re_compile(size_t n_args, const mp_obj_t *args) {
const char *re_str = mp_obj_str_get_str(args[0]); const char *re_str = mp_obj_str_get_str(args[0]);
int size = re1_5_sizecode(re_str); int size = re1_5_sizecode(re_str);
if (size == -1) { if (size == -1) {
...@@ -215,12 +215,12 @@ STATIC mp_obj_t mod_re_exec(bool is_anchored, uint n_args, const mp_obj_t *args) ...@@ -215,12 +215,12 @@ STATIC mp_obj_t mod_re_exec(bool is_anchored, uint n_args, const mp_obj_t *args)
return match; return match;
} }
STATIC mp_obj_t mod_re_match(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t mod_re_match(size_t n_args, const mp_obj_t *args) {
return mod_re_exec(true, n_args, args); return mod_re_exec(true, n_args, args);
} }
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_re_match_obj, 2, 4, mod_re_match); MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_re_match_obj, 2, 4, mod_re_match);
STATIC mp_obj_t mod_re_search(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t mod_re_search(size_t n_args, const mp_obj_t *args) {
return mod_re_exec(false, n_args, args); return mod_re_exec(false, n_args, args);
} }
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_re_search_obj, 2, 4, mod_re_search); MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_re_search_obj, 2, 4, mod_re_search);
......
...@@ -49,7 +49,7 @@ STATIC int mod_uzlib_grow_buf(TINF_DATA *d, unsigned alloc_req) { ...@@ -49,7 +49,7 @@ STATIC int mod_uzlib_grow_buf(TINF_DATA *d, unsigned alloc_req) {
return 0; return 0;
} }
STATIC mp_obj_t mod_uzlib_decompress(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t mod_uzlib_decompress(size_t n_args, const mp_obj_t *args) {
(void)n_args; (void)n_args;
mp_obj_t data = args[0]; mp_obj_t data = args[0];
mp_buffer_info_t bufinfo; mp_buffer_info_t bufinfo;
......
...@@ -28,9 +28,9 @@ ...@@ -28,9 +28,9 @@
#include "py/obj.h" #include "py/obj.h"
mp_obj_t mp_builtin___import__(mp_uint_t n_args, const mp_obj_t *args); mp_obj_t mp_builtin___import__(size_t n_args, const mp_obj_t *args);
mp_obj_t mp_builtin_open(mp_uint_t n_args, const mp_obj_t *args, mp_map_t *kwargs); mp_obj_t mp_builtin_open(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs);
mp_obj_t mp_micropython_mem_info(mp_uint_t n_args, const mp_obj_t *args); mp_obj_t mp_micropython_mem_info(size_t n_args, const mp_obj_t *args);
MP_DECLARE_CONST_FUN_OBJ(mp_builtin___build_class___obj); MP_DECLARE_CONST_FUN_OBJ(mp_builtin___build_class___obj);
MP_DECLARE_CONST_FUN_OBJ(mp_builtin___import___obj); MP_DECLARE_CONST_FUN_OBJ(mp_builtin___import___obj);
......
...@@ -74,7 +74,7 @@ STATIC mp_obj_t code_execute(mp_obj_code_t *self, mp_obj_dict_t *globals, mp_obj ...@@ -74,7 +74,7 @@ STATIC mp_obj_t code_execute(mp_obj_code_t *self, mp_obj_dict_t *globals, mp_obj
} }
} }
STATIC mp_obj_t mp_builtin_compile(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t mp_builtin_compile(size_t n_args, const mp_obj_t *args) {
(void)n_args; (void)n_args;
// get the source // get the source
...@@ -109,7 +109,7 @@ MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_builtin_compile_obj, 3, 6, mp_builtin_com ...@@ -109,7 +109,7 @@ MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_builtin_compile_obj, 3, 6, mp_builtin_com
#if MICROPY_PY_BUILTINS_EVAL_EXEC #if MICROPY_PY_BUILTINS_EVAL_EXEC
STATIC mp_obj_t eval_exec_helper(mp_uint_t n_args, const mp_obj_t *args, mp_parse_input_kind_t parse_input_kind) { STATIC mp_obj_t eval_exec_helper(size_t n_args, const mp_obj_t *args, mp_parse_input_kind_t parse_input_kind) {
// work out the context // work out the context
mp_obj_dict_t *globals = mp_globals_get(); mp_obj_dict_t *globals = mp_globals_get();
mp_obj_dict_t *locals = mp_locals_get(); mp_obj_dict_t *locals = mp_locals_get();
...@@ -147,12 +147,12 @@ STATIC mp_obj_t eval_exec_helper(mp_uint_t n_args, const mp_obj_t *args, mp_pars ...@@ -147,12 +147,12 @@ STATIC mp_obj_t eval_exec_helper(mp_uint_t n_args, const mp_obj_t *args, mp_pars
return mp_parse_compile_execute(lex, parse_input_kind, globals, locals); return mp_parse_compile_execute(lex, parse_input_kind, globals, locals);
} }
STATIC mp_obj_t mp_builtin_eval(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t mp_builtin_eval(size_t n_args, const mp_obj_t *args) {
return eval_exec_helper(n_args, args, MP_PARSE_EVAL_INPUT); return eval_exec_helper(n_args, args, MP_PARSE_EVAL_INPUT);
} }
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_builtin_eval_obj, 1, 3, mp_builtin_eval); MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_builtin_eval_obj, 1, 3, mp_builtin_eval);
STATIC mp_obj_t mp_builtin_exec(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t mp_builtin_exec(size_t n_args, const mp_obj_t *args) {
return eval_exec_helper(n_args, args, MP_PARSE_FILE_INPUT); return eval_exec_helper(n_args, args, MP_PARSE_FILE_INPUT);
} }
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_builtin_exec_obj, 1, 3, mp_builtin_exec); MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_builtin_exec_obj, 1, 3, mp_builtin_exec);
...@@ -160,7 +160,7 @@ MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_builtin_exec_obj, 1, 3, mp_builtin_exec); ...@@ -160,7 +160,7 @@ MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_builtin_exec_obj, 1, 3, mp_builtin_exec);
#endif // MICROPY_PY_BUILTINS_EVAL_EXEC #endif // MICROPY_PY_BUILTINS_EVAL_EXEC
#if MICROPY_PY_BUILTINS_EXECFILE #if MICROPY_PY_BUILTINS_EXECFILE
STATIC mp_obj_t mp_builtin_execfile(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t mp_builtin_execfile(size_t n_args, const mp_obj_t *args) {
// MP_PARSE_SINGLE_INPUT is used to indicate a file input // MP_PARSE_SINGLE_INPUT is used to indicate a file input
return eval_exec_helper(n_args, args, MP_PARSE_SINGLE_INPUT); return eval_exec_helper(n_args, args, MP_PARSE_SINGLE_INPUT);
} }
......
...@@ -215,7 +215,7 @@ STATIC void chop_component(const char *start, const char **end) { ...@@ -215,7 +215,7 @@ STATIC void chop_component(const char *start, const char **end) {
*end = p; *end = p;
} }
mp_obj_t mp_builtin___import__(mp_uint_t n_args, const mp_obj_t *args) { mp_obj_t mp_builtin___import__(size_t n_args, const mp_obj_t *args) {
#if DEBUG_PRINT #if DEBUG_PRINT
DEBUG_printf("__import__:\n"); DEBUG_printf("__import__:\n");
for (mp_uint_t i = 0; i < n_args; i++) { for (mp_uint_t i = 0; i < n_args; i++) {
......
...@@ -48,7 +48,7 @@ extern struct _mp_dummy_t mp_sys_stdout_obj; // type is irrelevant, just need po ...@@ -48,7 +48,7 @@ extern struct _mp_dummy_t mp_sys_stdout_obj; // type is irrelevant, just need po
// args[0] is function from class body // args[0] is function from class body
// args[1] is class name // args[1] is class name
// args[2:] are base objects // args[2:] are base objects
STATIC mp_obj_t mp_builtin___build_class__(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t mp_builtin___build_class__(size_t n_args, const mp_obj_t *args) {
assert(2 <= n_args); assert(2 <= n_args);
// set the new classes __locals__ object // set the new classes __locals__ object
...@@ -193,7 +193,7 @@ STATIC mp_obj_t mp_builtin_chr(mp_obj_t o_in) { ...@@ -193,7 +193,7 @@ STATIC mp_obj_t mp_builtin_chr(mp_obj_t o_in) {
} }
MP_DEFINE_CONST_FUN_OBJ_1(mp_builtin_chr_obj, mp_builtin_chr); MP_DEFINE_CONST_FUN_OBJ_1(mp_builtin_chr_obj, mp_builtin_chr);
STATIC mp_obj_t mp_builtin_dir(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t mp_builtin_dir(size_t n_args, const mp_obj_t *args) {
// TODO make this function more general and less of a hack // TODO make this function more general and less of a hack
mp_obj_dict_t *dict = NULL; mp_obj_dict_t *dict = NULL;
...@@ -264,7 +264,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(mp_builtin_iter_obj, mp_builtin_iter); ...@@ -264,7 +264,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(mp_builtin_iter_obj, mp_builtin_iter);
#if MICROPY_PY_BUILTINS_MIN_MAX #if MICROPY_PY_BUILTINS_MIN_MAX
STATIC mp_obj_t mp_builtin_min_max(mp_uint_t n_args, const mp_obj_t *args, mp_map_t *kwargs, mp_uint_t op) { STATIC mp_obj_t mp_builtin_min_max(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs, mp_uint_t op) {
mp_map_elem_t *key_elem = mp_map_lookup(kwargs, MP_OBJ_NEW_QSTR(MP_QSTR_key), MP_MAP_LOOKUP); mp_map_elem_t *key_elem = mp_map_lookup(kwargs, MP_OBJ_NEW_QSTR(MP_QSTR_key), MP_MAP_LOOKUP);
mp_map_elem_t *default_elem; mp_map_elem_t *default_elem;
mp_obj_t key_fn = key_elem == NULL ? MP_OBJ_NULL : key_elem->value; mp_obj_t key_fn = key_elem == NULL ? MP_OBJ_NULL : key_elem->value;
...@@ -305,12 +305,12 @@ STATIC mp_obj_t mp_builtin_min_max(mp_uint_t n_args, const mp_obj_t *args, mp_ma ...@@ -305,12 +305,12 @@ STATIC mp_obj_t mp_builtin_min_max(mp_uint_t n_args, const mp_obj_t *args, mp_ma
} }
} }
STATIC mp_obj_t mp_builtin_max(mp_uint_t n_args, const mp_obj_t *args, mp_map_t *kwargs) { STATIC mp_obj_t mp_builtin_max(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs) {
return mp_builtin_min_max(n_args, args, kwargs, MP_BINARY_OP_MORE); return mp_builtin_min_max(n_args, args, kwargs, MP_BINARY_OP_MORE);
} }
MP_DEFINE_CONST_FUN_OBJ_KW(mp_builtin_max_obj, 1, mp_builtin_max); MP_DEFINE_CONST_FUN_OBJ_KW(mp_builtin_max_obj, 1, mp_builtin_max);
STATIC mp_obj_t mp_builtin_min(mp_uint_t n_args, const mp_obj_t *args, mp_map_t *kwargs) { STATIC mp_obj_t mp_builtin_min(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs) {
return mp_builtin_min_max(n_args, args, kwargs, MP_BINARY_OP_LESS); return mp_builtin_min_max(n_args, args, kwargs, MP_BINARY_OP_LESS);
} }
MP_DEFINE_CONST_FUN_OBJ_KW(mp_builtin_min_obj, 1, mp_builtin_min); MP_DEFINE_CONST_FUN_OBJ_KW(mp_builtin_min_obj, 1, mp_builtin_min);
...@@ -375,7 +375,7 @@ STATIC mp_obj_t mp_builtin_ord(mp_obj_t o_in) { ...@@ -375,7 +375,7 @@ STATIC mp_obj_t mp_builtin_ord(mp_obj_t o_in) {
} }
MP_DEFINE_CONST_FUN_OBJ_1(mp_builtin_ord_obj, mp_builtin_ord); MP_DEFINE_CONST_FUN_OBJ_1(mp_builtin_ord_obj, mp_builtin_ord);
STATIC mp_obj_t mp_builtin_pow(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t mp_builtin_pow(size_t n_args, const mp_obj_t *args) {
assert(2 <= n_args && n_args <= 3); assert(2 <= n_args && n_args <= 3);
switch (n_args) { switch (n_args) {
case 2: return mp_binary_op(MP_BINARY_OP_POWER, args[0], args[1]); case 2: return mp_binary_op(MP_BINARY_OP_POWER, args[0], args[1]);
...@@ -384,7 +384,7 @@ STATIC mp_obj_t mp_builtin_pow(mp_uint_t n_args, const mp_obj_t *args) { ...@@ -384,7 +384,7 @@ STATIC mp_obj_t mp_builtin_pow(mp_uint_t n_args, const mp_obj_t *args) {
} }
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_builtin_pow_obj, 2, 3, mp_builtin_pow); MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_builtin_pow_obj, 2, 3, mp_builtin_pow);
STATIC mp_obj_t mp_builtin_print(mp_uint_t n_args, const mp_obj_t *args, mp_map_t *kwargs) { STATIC mp_obj_t mp_builtin_print(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs) {
mp_map_elem_t *sep_elem = mp_map_lookup(kwargs, MP_OBJ_NEW_QSTR(MP_QSTR_sep), MP_MAP_LOOKUP); mp_map_elem_t *sep_elem = mp_map_lookup(kwargs, MP_OBJ_NEW_QSTR(MP_QSTR_sep), MP_MAP_LOOKUP);
mp_map_elem_t *end_elem = mp_map_lookup(kwargs, MP_OBJ_NEW_QSTR(MP_QSTR_end), MP_MAP_LOOKUP); mp_map_elem_t *end_elem = mp_map_lookup(kwargs, MP_OBJ_NEW_QSTR(MP_QSTR_end), MP_MAP_LOOKUP);
const char *sep_data = " "; const char *sep_data = " ";
...@@ -456,7 +456,7 @@ STATIC mp_obj_t mp_builtin_repr(mp_obj_t o_in) { ...@@ -456,7 +456,7 @@ STATIC mp_obj_t mp_builtin_repr(mp_obj_t o_in) {
} }
MP_DEFINE_CONST_FUN_OBJ_1(mp_builtin_repr_obj, mp_builtin_repr); MP_DEFINE_CONST_FUN_OBJ_1(mp_builtin_repr_obj, mp_builtin_repr);
STATIC mp_obj_t mp_builtin_round(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t mp_builtin_round(size_t n_args, const mp_obj_t *args) {
mp_obj_t o_in = args[0]; mp_obj_t o_in = args[0];
if (MP_OBJ_IS_INT(o_in)) { if (MP_OBJ_IS_INT(o_in)) {
return o_in; return o_in;
...@@ -490,7 +490,7 @@ STATIC mp_obj_t mp_builtin_round(mp_uint_t n_args, const mp_obj_t *args) { ...@@ -490,7 +490,7 @@ STATIC mp_obj_t mp_builtin_round(mp_uint_t n_args, const mp_obj_t *args) {
} }
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_builtin_round_obj, 1, 2, mp_builtin_round); MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_builtin_round_obj, 1, 2, mp_builtin_round);
STATIC mp_obj_t mp_builtin_sum(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t mp_builtin_sum(size_t n_args, const mp_obj_t *args) {
assert(1 <= n_args && n_args <= 2); assert(1 <= n_args && n_args <= 2);
mp_obj_t value; mp_obj_t value;
switch (n_args) { switch (n_args) {
...@@ -506,7 +506,7 @@ STATIC mp_obj_t mp_builtin_sum(mp_uint_t n_args, const mp_obj_t *args) { ...@@ -506,7 +506,7 @@ STATIC mp_obj_t mp_builtin_sum(mp_uint_t n_args, const mp_obj_t *args) {
} }
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_builtin_sum_obj, 1, 2, mp_builtin_sum); MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_builtin_sum_obj, 1, 2, mp_builtin_sum);
STATIC mp_obj_t mp_builtin_sorted(mp_uint_t n_args, const mp_obj_t *args, mp_map_t *kwargs) { STATIC mp_obj_t mp_builtin_sorted(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs) {
assert(n_args >= 1); assert(n_args >= 1);
if (n_args > 1) { if (n_args > 1) {
nlr_raise(mp_obj_new_exception_msg(&mp_type_TypeError, nlr_raise(mp_obj_new_exception_msg(&mp_type_TypeError,
...@@ -535,7 +535,7 @@ STATIC inline mp_obj_t mp_load_attr_default(mp_obj_t base, qstr attr, mp_obj_t d ...@@ -535,7 +535,7 @@ STATIC inline mp_obj_t mp_load_attr_default(mp_obj_t base, qstr attr, mp_obj_t d
} }
} }
STATIC mp_obj_t mp_builtin_getattr(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t mp_builtin_getattr(size_t n_args, const mp_obj_t *args) {
mp_obj_t defval = MP_OBJ_NULL; mp_obj_t defval = MP_OBJ_NULL;
if (n_args > 2) { if (n_args > 2) {
defval = args[2]; defval = args[2];
......
...@@ -152,7 +152,7 @@ MATH_FUN_1(lgamma, lgamma) ...@@ -152,7 +152,7 @@ MATH_FUN_1(lgamma, lgamma)
// Function that takes a variable number of arguments // Function that takes a variable number of arguments
// log(x[, base]) // log(x[, base])
STATIC mp_obj_t mp_math_log(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t mp_math_log(size_t n_args, const mp_obj_t *args) {
mp_float_t x = mp_obj_get_float(args[0]); mp_float_t x = mp_obj_get_float(args[0]);
if (x <= (mp_float_t)0.0) { if (x <= (mp_float_t)0.0) {
math_error(); math_error();
......
...@@ -53,7 +53,7 @@ STATIC mp_obj_t mp_micropython_mem_peak(void) { ...@@ -53,7 +53,7 @@ STATIC mp_obj_t mp_micropython_mem_peak(void) {
STATIC MP_DEFINE_CONST_FUN_OBJ_0(mp_micropython_mem_peak_obj, mp_micropython_mem_peak); STATIC MP_DEFINE_CONST_FUN_OBJ_0(mp_micropython_mem_peak_obj, mp_micropython_mem_peak);
#endif #endif
mp_obj_t mp_micropython_mem_info(mp_uint_t n_args, const mp_obj_t *args) { mp_obj_t mp_micropython_mem_info(size_t n_args, const mp_obj_t *args) {
(void)args; (void)args;
#if MICROPY_MEM_STATS #if MICROPY_MEM_STATS
mp_printf(&mp_plat_print, "mem: total=" UINT_FMT ", current=" UINT_FMT ", peak=" UINT_FMT "\n", mp_printf(&mp_plat_print, "mem: total=" UINT_FMT ", current=" UINT_FMT ", peak=" UINT_FMT "\n",
...@@ -77,7 +77,7 @@ mp_obj_t mp_micropython_mem_info(mp_uint_t n_args, const mp_obj_t *args) { ...@@ -77,7 +77,7 @@ mp_obj_t mp_micropython_mem_info(mp_uint_t n_args, const mp_obj_t *args) {
} }
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_micropython_mem_info_obj, 0, 1, mp_micropython_mem_info); STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_micropython_mem_info_obj, 0, 1, mp_micropython_mem_info);
STATIC mp_obj_t mp_micropython_qstr_info(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t mp_micropython_qstr_info(size_t n_args, const mp_obj_t *args) {
(void)args; (void)args;
size_t n_pool, n_qstr, n_str_data_bytes, n_total_bytes; size_t n_pool, n_qstr, n_str_data_bytes, n_total_bytes;
qstr_pool_info(&n_pool, &n_qstr, &n_str_data_bytes, &n_total_bytes); qstr_pool_info(&n_pool, &n_qstr, &n_str_data_bytes, &n_total_bytes);
......
...@@ -165,7 +165,7 @@ STATIC mp_obj_t struct_unpack(mp_obj_t fmt_in, mp_obj_t data_in) { ...@@ -165,7 +165,7 @@ STATIC mp_obj_t struct_unpack(mp_obj_t fmt_in, mp_obj_t data_in) {
} }
MP_DEFINE_CONST_FUN_OBJ_2(struct_unpack_obj, struct_unpack); MP_DEFINE_CONST_FUN_OBJ_2(struct_unpack_obj, struct_unpack);
STATIC mp_obj_t struct_pack(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t struct_pack(size_t n_args, const mp_obj_t *args) {
// TODO: "The arguments must match the values required by the format exactly." // TODO: "The arguments must match the values required by the format exactly."
const char *fmt = mp_obj_str_get_str(args[0]); const char *fmt = mp_obj_str_get_str(args[0]);
char fmt_type = get_fmt_type(&fmt); char fmt_type = get_fmt_type(&fmt);
......
...@@ -93,7 +93,7 @@ STATIC const MP_DEFINE_STR_OBJ(platform_obj, MICROPY_PY_SYS_PLATFORM); ...@@ -93,7 +93,7 @@ STATIC const MP_DEFINE_STR_OBJ(platform_obj, MICROPY_PY_SYS_PLATFORM);
/// \function exit([retval]) /// \function exit([retval])
/// Raise a `SystemExit` exception. If an argument is given, it is the /// Raise a `SystemExit` exception. If an argument is given, it is the
/// value given to `SystemExit`. /// value given to `SystemExit`.
STATIC mp_obj_t mp_sys_exit(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t mp_sys_exit(size_t n_args, const mp_obj_t *args) {
mp_obj_t exc; mp_obj_t exc;
if (n_args == 0) { if (n_args == 0) {
exc = mp_obj_new_exception(&mp_type_SystemExit); exc = mp_obj_new_exception(&mp_type_SystemExit);
...@@ -104,7 +104,7 @@ STATIC mp_obj_t mp_sys_exit(mp_uint_t n_args, const mp_obj_t *args) { ...@@ -104,7 +104,7 @@ STATIC mp_obj_t mp_sys_exit(mp_uint_t n_args, const mp_obj_t *args) {
} }
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_sys_exit_obj, 0, 1, mp_sys_exit); MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_sys_exit_obj, 0, 1, mp_sys_exit);
STATIC mp_obj_t mp_sys_print_exception(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t mp_sys_print_exception(size_t n_args, const mp_obj_t *args) {
#if MICROPY_PY_IO #if MICROPY_PY_IO
void *stream_obj = &mp_sys_stdout_obj; void *stream_obj = &mp_sys_stdout_obj;
if (n_args > 1) { if (n_args > 1) {
......
...@@ -395,8 +395,8 @@ typedef mp_obj_t (*mp_fun_0_t)(void); ...@@ -395,8 +395,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)(mp_uint_t n, const mp_obj_t *); typedef mp_obj_t (*mp_fun_var_t)(size_t n, const mp_obj_t *);
typedef mp_obj_t (*mp_fun_kw_t)(mp_uint_t n, const mp_obj_t *, mp_map_t *); typedef mp_obj_t (*mp_fun_kw_t)(size_t n, const mp_obj_t *, mp_map_t *);
typedef enum { typedef enum {
PRINT_STR = 0, PRINT_STR = 0,
...@@ -725,7 +725,7 @@ mp_obj_t mp_obj_list_remove(mp_obj_t self_in, mp_obj_t value); ...@@ -725,7 +725,7 @@ mp_obj_t mp_obj_list_remove(mp_obj_t self_in, mp_obj_t value);
void mp_obj_list_get(mp_obj_t self_in, mp_uint_t *len, mp_obj_t **items); void mp_obj_list_get(mp_obj_t self_in, mp_uint_t *len, mp_obj_t **items);
void mp_obj_list_set_len(mp_obj_t self_in, mp_uint_t len); void mp_obj_list_set_len(mp_obj_t self_in, mp_uint_t 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(mp_uint_t n_args, const mp_obj_t *args, mp_map_t *kwargs); mp_obj_t mp_obj_list_sort(size_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 {
......
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
#define MP_OBJ_IS_DICT_TYPE(o) (MP_OBJ_IS_OBJ(o) && ((mp_obj_base_t*)MP_OBJ_TO_PTR(o))->type->make_new == dict_make_new) #define MP_OBJ_IS_DICT_TYPE(o) (MP_OBJ_IS_OBJ(o) && ((mp_obj_base_t*)MP_OBJ_TO_PTR(o))->type->make_new == dict_make_new)
STATIC mp_obj_t dict_update(mp_uint_t n_args, const mp_obj_t *args, mp_map_t *kwargs); STATIC mp_obj_t dict_update(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs);
// This is a helper function to iterate through a dictionary. The state of // This is a helper function to iterate through a dictionary. The state of
// the iteration is held in *cur and should be initialised with zero for the // the iteration is held in *cur and should be initialised with zero for the
...@@ -240,7 +240,7 @@ STATIC mp_obj_t dict_copy(mp_obj_t self_in) { ...@@ -240,7 +240,7 @@ STATIC mp_obj_t dict_copy(mp_obj_t self_in) {
STATIC MP_DEFINE_CONST_FUN_OBJ_1(dict_copy_obj, dict_copy); STATIC MP_DEFINE_CONST_FUN_OBJ_1(dict_copy_obj, dict_copy);
// this is a classmethod // this is a classmethod
STATIC mp_obj_t dict_fromkeys(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t dict_fromkeys(size_t n_args, const mp_obj_t *args) {
assert(2 <= n_args && n_args <= 3); assert(2 <= n_args && n_args <= 3);
mp_obj_t iter = mp_getiter(args[1]); mp_obj_t iter = mp_getiter(args[1]);
mp_obj_t len = mp_obj_len_maybe(iter); mp_obj_t len = mp_obj_len_maybe(iter);
...@@ -294,7 +294,7 @@ STATIC mp_obj_t dict_get_helper(mp_map_t *self, mp_obj_t key, mp_obj_t deflt, mp ...@@ -294,7 +294,7 @@ STATIC mp_obj_t dict_get_helper(mp_map_t *self, mp_obj_t key, mp_obj_t deflt, mp
return value; return value;
} }
STATIC mp_obj_t dict_get(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t dict_get(size_t n_args, const mp_obj_t *args) {
assert(2 <= n_args && n_args <= 3); assert(2 <= n_args && n_args <= 3);
assert(MP_OBJ_IS_DICT_TYPE(args[0])); assert(MP_OBJ_IS_DICT_TYPE(args[0]));
mp_obj_dict_t *self = MP_OBJ_TO_PTR(args[0]); mp_obj_dict_t *self = MP_OBJ_TO_PTR(args[0]);
...@@ -306,7 +306,7 @@ STATIC mp_obj_t dict_get(mp_uint_t n_args, const mp_obj_t *args) { ...@@ -306,7 +306,7 @@ STATIC mp_obj_t dict_get(mp_uint_t n_args, const mp_obj_t *args) {
} }
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(dict_get_obj, 2, 3, dict_get); STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(dict_get_obj, 2, 3, dict_get);
STATIC mp_obj_t dict_pop(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t dict_pop(size_t n_args, const mp_obj_t *args) {
assert(2 <= n_args && n_args <= 3); assert(2 <= n_args && n_args <= 3);
assert(MP_OBJ_IS_DICT_TYPE(args[0])); assert(MP_OBJ_IS_DICT_TYPE(args[0]));
mp_obj_dict_t *self = MP_OBJ_TO_PTR(args[0]); mp_obj_dict_t *self = MP_OBJ_TO_PTR(args[0]);
...@@ -319,7 +319,7 @@ STATIC mp_obj_t dict_pop(mp_uint_t n_args, const mp_obj_t *args) { ...@@ -319,7 +319,7 @@ STATIC mp_obj_t dict_pop(mp_uint_t n_args, const mp_obj_t *args) {
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(dict_pop_obj, 2, 3, dict_pop); STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(dict_pop_obj, 2, 3, dict_pop);
STATIC mp_obj_t dict_setdefault(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t dict_setdefault(size_t n_args, const mp_obj_t *args) {
assert(2 <= n_args && n_args <= 3); assert(2 <= n_args && n_args <= 3);
assert(MP_OBJ_IS_DICT_TYPE(args[0])); assert(MP_OBJ_IS_DICT_TYPE(args[0]));
mp_obj_dict_t *self = MP_OBJ_TO_PTR(args[0]); mp_obj_dict_t *self = MP_OBJ_TO_PTR(args[0]);
...@@ -350,7 +350,7 @@ STATIC mp_obj_t dict_popitem(mp_obj_t self_in) { ...@@ -350,7 +350,7 @@ STATIC mp_obj_t dict_popitem(mp_obj_t self_in) {
} }
STATIC MP_DEFINE_CONST_FUN_OBJ_1(dict_popitem_obj, dict_popitem); STATIC MP_DEFINE_CONST_FUN_OBJ_1(dict_popitem_obj, dict_popitem);
STATIC mp_obj_t dict_update(mp_uint_t n_args, const mp_obj_t *args, mp_map_t *kwargs) { STATIC mp_obj_t dict_update(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs) {
assert(MP_OBJ_IS_DICT_TYPE(args[0])); assert(MP_OBJ_IS_DICT_TYPE(args[0]));
mp_obj_dict_t *self = MP_OBJ_TO_PTR(args[0]); mp_obj_dict_t *self = MP_OBJ_TO_PTR(args[0]);
......
...@@ -153,7 +153,7 @@ STATIC void exception_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) { ...@@ -153,7 +153,7 @@ STATIC void exception_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) {
} }
} }
STATIC mp_obj_t exc___init__(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t exc___init__(size_t n_args, const mp_obj_t *args) {
mp_obj_exception_t *self = MP_OBJ_TO_PTR(args[0]); mp_obj_exception_t *self = MP_OBJ_TO_PTR(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 = MP_OBJ_TO_PTR(argst); self->args = MP_OBJ_TO_PTR(argst);
......
...@@ -190,7 +190,7 @@ STATIC mp_obj_t gen_instance_send(mp_obj_t self_in, mp_obj_t send_value) { ...@@ -190,7 +190,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(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t gen_instance_throw(size_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);
......
...@@ -381,7 +381,7 @@ mp_obj_t mp_obj_int_binary_op_extra_cases(mp_uint_t op, mp_obj_t lhs_in, mp_obj_ ...@@ -381,7 +381,7 @@ mp_obj_t mp_obj_int_binary_op_extra_cases(mp_uint_t op, mp_obj_t lhs_in, mp_obj_
} }
// this is a classmethod // this is a classmethod
STATIC mp_obj_t int_from_bytes(mp_uint_t n_args, const mp_obj_t *args) { STATIC mp_obj_t int_from_bytes(size_t n_args, const mp_obj_t *args) {
// TODO: Support long ints // TODO: Support long ints
// TODO: Support byteorder param (assumes 'little' at the moment) // TODO: Support byteorder param (assumes 'little' at the moment)