Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
uPython-mirror
Commits
a11ceca8
Commit
a11ceca8
authored
Jan 19, 2014
by
Damien George
Browse files
Change int to uint for n_args in function with variable arguments.
parent
136b149e
Changes
9
Hide whitespace changes
Inline
Side-by-side
py/builtin.c
View file @
a11ceca8
...
...
@@ -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__
(
u
int
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
(
u
int
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
(
u
int
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
(
u
int
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
(
u
int
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
(
u
int
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
(
u
int
n_args
,
const
mp_obj_t
*
args
)
{
assert
(
1
<=
n_args
&&
n_args
<=
2
);
mp_obj_t
value
;
switch
(
n_args
)
{
...
...
py/obj.h
View file @
a11ceca8
...
...
@@ -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
)(
u
int
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
{
...
...
py/objdict.c
View file @
a11ceca8
...
...
@@ -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
(
u
int
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
(
u
int
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
(
u
int
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
(
u
int
n_args
,
const
mp_obj_t
*
args
)
{
assert
(
2
<=
n_args
&&
n_args
<=
3
);
assert
(
MP_OBJ_IS_TYPE
(
args
[
0
],
&
dict_type
));
...
...
py/objlist.c
View file @
a11ceca8
...
...
@@ -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
(
u
int
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
(
u
int
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
];
...
...
py/objset.c
View file @
a11ceca8
...
...
@@ -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
(
u
int
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
(
u
int
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
(
u
int
n_args
,
const
mp_obj_t
*
args
)
{
assert
(
n_args
>
0
);
assert
(
MP_OBJ_IS_TYPE
(
args
[
0
],
&
set_type
));
...
...
py/objstr.c
View file @
a11ceca8
...
...
@@ -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
(
u
int
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
(
u
int
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
(
u
int
n_args
,
const
mp_obj_t
*
args
)
{
assert
(
MP_OBJ_IS_TYPE
(
args
[
0
],
&
str_type
));
mp_obj_str_t
*
self
=
args
[
0
];
...
...
py/stream.c
View file @
a11ceca8
...
...
@@ -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
(
u
int
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
(
u
int
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
...
...
stm/main.c
View file @
a11ceca8
...
...
@@ -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
(
u
int
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
]));
...
...
unix/socket.c
View file @
a11ceca8
...
...
@@ -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
(
u
int
n_args
,
const
mp_obj_t
*
args
)
{
// TODO: Implement all args
assert
(
n_args
==
2
);
assert
(
MP_OBJ_IS_TYPE
(
args
[
0
],
&
str_type
));
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment