Change int to uint for n_args in function with variable arguments.

pull/197/head
Damien George 2014-01-19 16:02:09 +00:00
rodzic 136b149e41
commit a11ceca807
9 zmienionych plików z 24 dodań i 24 usunięć

Wyświetl plik

@ -18,7 +18,7 @@
// args[0] is function from class body
// args[1] is class name
// args[2:] are base objects
static mp_obj_t mp_builtin___build_class__(int n_args, const mp_obj_t *args) {
static mp_obj_t mp_builtin___build_class__(uint n_args, const mp_obj_t *args) {
assert(2 <= n_args);
// we differ from CPython: we set the new __locals__ object here
@ -187,7 +187,7 @@ static mp_obj_t mp_builtin_len(mp_obj_t o_in) {
MP_DEFINE_CONST_FUN_OBJ_1(mp_builtin_len_obj, mp_builtin_len);
static mp_obj_t mp_builtin_max(int n_args, const mp_obj_t *args) {
static mp_obj_t mp_builtin_max(uint n_args, const mp_obj_t *args) {
if (n_args == 1) {
// given an iterable
mp_obj_t iterable = rt_getiter(args[0]);
@ -216,7 +216,7 @@ static mp_obj_t mp_builtin_max(int n_args, const mp_obj_t *args) {
MP_DEFINE_CONST_FUN_OBJ_VAR(mp_builtin_max_obj, 1, mp_builtin_max);
static mp_obj_t mp_builtin_min(int n_args, const mp_obj_t *args) {
static mp_obj_t mp_builtin_min(uint n_args, const mp_obj_t *args) {
if (n_args == 1) {
// given an iterable
mp_obj_t iterable = rt_getiter(args[0]);
@ -267,7 +267,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);
static mp_obj_t mp_builtin_pow(int n_args, const mp_obj_t *args) {
static mp_obj_t mp_builtin_pow(uint n_args, const mp_obj_t *args) {
assert(2 <= n_args && n_args <= 3);
switch (n_args) {
case 2: return rt_binary_op(RT_BINARY_OP_POWER, args[0], args[1]);
@ -277,7 +277,7 @@ static mp_obj_t mp_builtin_pow(int n_args, const mp_obj_t *args) {
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_builtin_pow_obj, 2, 3, mp_builtin_pow);
static mp_obj_t mp_builtin_print(int n_args, const mp_obj_t *args) {
static mp_obj_t mp_builtin_print(uint n_args, const mp_obj_t *args) {
for (int i = 0; i < n_args; i++) {
if (i > 0) {
printf(" ");
@ -290,7 +290,7 @@ static mp_obj_t mp_builtin_print(int n_args, const mp_obj_t *args) {
MP_DEFINE_CONST_FUN_OBJ_VAR(mp_builtin_print_obj, 0, mp_builtin_print);
static mp_obj_t mp_builtin_range(int n_args, const mp_obj_t *args) {
static mp_obj_t mp_builtin_range(uint n_args, const mp_obj_t *args) {
assert(1 <= n_args && n_args <= 3);
switch (n_args) {
case 1: return mp_obj_new_range(0, mp_obj_get_int(args[0]), 1);
@ -309,7 +309,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);
static mp_obj_t mp_builtin_sum(int n_args, const mp_obj_t *args) {
static mp_obj_t mp_builtin_sum(uint n_args, const mp_obj_t *args) {
assert(1 <= n_args && n_args <= 2);
mp_obj_t value;
switch (n_args) {

Wyświetl plik

@ -82,7 +82,7 @@ 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_3_t)(mp_obj_t, mp_obj_t, mp_obj_t);
typedef mp_obj_t (*mp_fun_t)(void);
typedef mp_obj_t (*mp_fun_var_t)(int n, const mp_obj_t *);
typedef mp_obj_t (*mp_fun_var_t)(uint n, const mp_obj_t *);
typedef mp_obj_t (*mp_fun_kw_t)(uint n, const mp_obj_t *, struct _mp_map_t *);
typedef enum {

Wyświetl plik

@ -145,7 +145,7 @@ static mp_obj_t dict_copy(mp_obj_t self_in) {
static MP_DEFINE_CONST_FUN_OBJ_1(dict_copy_obj, dict_copy);
// this is a classmethod
static mp_obj_t dict_fromkeys(int n_args, const mp_obj_t *args) {
static mp_obj_t dict_fromkeys(uint n_args, const mp_obj_t *args) {
assert(2 <= n_args && n_args <= 3);
mp_obj_t iter = rt_getiter(args[1]);
mp_obj_t len = mp_obj_len_maybe(iter);
@ -199,7 +199,7 @@ static mp_obj_t dict_get_helper(mp_map_t *self, mp_obj_t key, mp_obj_t deflt, mp
return value;
}
static mp_obj_t dict_get(int n_args, const mp_obj_t *args) {
static mp_obj_t dict_get(uint n_args, const mp_obj_t *args) {
assert(2 <= n_args && n_args <= 3);
assert(MP_OBJ_IS_TYPE(args[0], &dict_type));
@ -210,7 +210,7 @@ static mp_obj_t dict_get(int n_args, const mp_obj_t *args) {
}
static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(dict_get_obj, 2, 3, dict_get);
static mp_obj_t dict_pop(int n_args, const mp_obj_t *args) {
static mp_obj_t dict_pop(uint n_args, const mp_obj_t *args) {
assert(2 <= n_args && n_args <= 3);
assert(MP_OBJ_IS_TYPE(args[0], &dict_type));
@ -222,7 +222,7 @@ static mp_obj_t dict_pop(int n_args, const mp_obj_t *args) {
static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(dict_pop_obj, 2, 3, dict_pop);
static mp_obj_t dict_setdefault(int n_args, const mp_obj_t *args) {
static mp_obj_t dict_setdefault(uint n_args, const mp_obj_t *args) {
assert(2 <= n_args && n_args <= 3);
assert(MP_OBJ_IS_TYPE(args[0], &dict_type));

Wyświetl plik

@ -209,7 +209,7 @@ static mp_obj_t list_extend(mp_obj_t self_in, mp_obj_t arg_in) {
return mp_const_none; // return None, as per CPython
}
static mp_obj_t list_pop(int n_args, const mp_obj_t *args) {
static mp_obj_t list_pop(uint n_args, const mp_obj_t *args) {
assert(1 <= n_args && n_args <= 2);
assert(MP_OBJ_IS_TYPE(args[0], &list_type));
mp_obj_list_t *self = args[0];
@ -296,7 +296,7 @@ static mp_obj_t list_count(mp_obj_t self_in, mp_obj_t value) {
return mp_obj_new_int(count);
}
static mp_obj_t list_index(int n_args, const mp_obj_t *args) {
static mp_obj_t list_index(uint n_args, const mp_obj_t *args) {
assert(2 <= n_args && n_args <= 4);
assert(MP_OBJ_IS_TYPE(args[0], &list_type));
mp_obj_list_t *self = args[0];

Wyświetl plik

@ -172,12 +172,12 @@ static mp_obj_t set_diff_int(int n_args, const mp_obj_t *args, bool update) {
return self;
}
static mp_obj_t set_diff(int n_args, const mp_obj_t *args) {
static mp_obj_t set_diff(uint n_args, const mp_obj_t *args) {
return set_diff_int(n_args, args, false);
}
static MP_DEFINE_CONST_FUN_OBJ_VAR(set_diff_obj, 1, set_diff);
static mp_obj_t set_diff_update(int n_args, const mp_obj_t *args) {
static mp_obj_t set_diff_update(uint n_args, const mp_obj_t *args) {
set_diff_int(n_args, args, true);
return mp_const_none;
}
@ -356,7 +356,7 @@ static void set_update_int(mp_obj_set_t *self, mp_obj_t other_in) {
}
}
static mp_obj_t set_update(int n_args, const mp_obj_t *args) {
static mp_obj_t set_update(uint n_args, const mp_obj_t *args) {
assert(n_args > 0);
assert(MP_OBJ_IS_TYPE(args[0], &set_type));

Wyświetl plik

@ -169,7 +169,7 @@ static bool chr_in_str(const char* const str, const size_t str_len, const char c
return false;
}
static mp_obj_t str_find(int n_args, const mp_obj_t *args) {
static mp_obj_t str_find(uint n_args, const mp_obj_t *args) {
assert(2 <= n_args && n_args <= 4);
assert(MP_OBJ_IS_TYPE(args[0], &str_type));
if (!MP_OBJ_IS_TYPE(args[1], &str_type)) {
@ -209,7 +209,7 @@ static mp_obj_t str_find(int n_args, const mp_obj_t *args) {
}
}
mp_obj_t str_strip(int n_args, const mp_obj_t *args) {
mp_obj_t str_strip(uint n_args, const mp_obj_t *args) {
assert(1 <= n_args && n_args <= 2);
assert(MP_OBJ_IS_TYPE(args[0], &str_type));
const char *chars_to_del;
@ -258,7 +258,7 @@ mp_obj_t str_strip(int n_args, const mp_obj_t *args) {
return mp_obj_new_str(qstr_from_str_take(stripped_str, stripped_len + 1));
}
mp_obj_t str_format(int n_args, const mp_obj_t *args) {
mp_obj_t str_format(uint n_args, const mp_obj_t *args) {
assert(MP_OBJ_IS_TYPE(args[0], &str_type));
mp_obj_str_t *self = args[0];

Wyświetl plik

@ -12,7 +12,7 @@
static mp_obj_t stream_readall(mp_obj_t self_in);
static mp_obj_t stream_read(int n_args, const mp_obj_t *args) {
static mp_obj_t stream_read(uint n_args, const mp_obj_t *args) {
struct _mp_obj_base_t *o = (struct _mp_obj_base_t *)args[0];
if (o->type->stream_p.read == NULL) {
// CPython: io.UnsupportedOperation, OSError subclass
@ -99,7 +99,7 @@ static mp_obj_t stream_readall(mp_obj_t self_in) {
}
// Unbuffered, inefficient implementation of readline() for raw I/O files.
static mp_obj_t stream_unbuffered_readline(int n_args, const mp_obj_t *args) {
static mp_obj_t stream_unbuffered_readline(uint n_args, const mp_obj_t *args) {
struct _mp_obj_base_t *o = (struct _mp_obj_base_t *)args[0];
if (o->type->stream_p.read == NULL) {
// CPython: io.UnsupportedOperation, OSError subclass

Wyświetl plik

@ -526,7 +526,7 @@ mp_obj_t pyb_gc(void) {
return mp_const_none;
}
mp_obj_t pyb_gpio(int n_args, mp_obj_t *args) {
mp_obj_t pyb_gpio(uint n_args, mp_obj_t *args) {
//assert(1 <= n_args && n_args <= 2);
const char *pin_name = qstr_str(mp_obj_get_qstr(args[0]));

Wyświetl plik

@ -212,7 +212,7 @@ static mp_obj_t mod_socket_gethostbyname(mp_obj_t arg) {
static MP_DEFINE_CONST_FUN_OBJ_1(mod_socket_gethostbyname_obj, mod_socket_gethostbyname);
#endif
static mp_obj_t mod_socket_getaddrinfo(int n_args, const mp_obj_t *args) {
static mp_obj_t mod_socket_getaddrinfo(uint n_args, const mp_obj_t *args) {
// TODO: Implement all args
assert(n_args == 2);
assert(MP_OBJ_IS_TYPE(args[0], &str_type));