Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
uPython-mirror
Commits
42f3de92
Commit
42f3de92
authored
Oct 03, 2014
by
Damien George
Browse files
py: Convert [u]int to mp_[u]int_t where appropriate.
Addressing issue #50.
parent
877dba3e
Changes
25
Hide whitespace changes
Inline
Side-by-side
py/pfenv.h
View file @
42f3de92
...
...
@@ -38,12 +38,12 @@
typedef
struct
_pfenv_t
{
void
*
data
;
void
(
*
print_strn
)(
void
*
,
const
char
*
str
,
unsigned
in
t
len
);
void
(
*
print_strn
)(
void
*
,
const
char
*
str
,
mp_uint_
t
len
);
}
pfenv_t
;
void
pfenv_vstr_add_strn
(
void
*
data
,
const
char
*
str
,
unsigned
in
t
len
);
void
pfenv_vstr_add_strn
(
void
*
data
,
const
char
*
str
,
mp_uint_
t
len
);
int
pfenv_print_strn
(
const
pfenv_t
*
pfenv
,
const
char
*
str
,
unsigned
in
t
len
,
int
flags
,
char
fill
,
int
width
);
int
pfenv_print_strn
(
const
pfenv_t
*
pfenv
,
const
char
*
str
,
mp_uint_
t
len
,
int
flags
,
char
fill
,
int
width
);
int
pfenv_print_int
(
const
pfenv_t
*
pfenv
,
mp_uint_t
x
,
int
sgn
,
int
base
,
int
base_char
,
int
flags
,
char
fill
,
int
width
);
int
pfenv_print_mp_int
(
const
pfenv_t
*
pfenv
,
mp_obj_t
x
,
int
sgn
,
int
base
,
int
base_char
,
int
flags
,
char
fill
,
int
width
,
int
prec
);
#if MICROPY_PY_BUILTINS_FLOAT
...
...
py/repl.c
View file @
42f3de92
...
...
@@ -31,7 +31,7 @@
#if MICROPY_HELPER_REPL
bool
str_startswith_word
(
const
char
*
str
,
const
char
*
head
)
{
in
t
i
;
mp_uint_
t
i
;
for
(
i
=
0
;
str
[
i
]
&&
head
[
i
];
i
++
)
{
if
(
str
[
i
]
!=
head
[
i
])
{
return
false
;
...
...
py/sequence.c
View file @
42f3de92
...
...
@@ -44,7 +44,7 @@
// Implements backend of sequence * integer operation. Assumes elements are
// memory-adjacent in sequence.
void
mp_seq_multiply
(
const
void
*
items
,
mp_uint_t
item_sz
,
mp_uint_t
len
,
mp_uint_t
times
,
void
*
dest
)
{
for
(
in
t
i
=
0
;
i
<
times
;
i
++
)
{
for
(
mp_uint_
t
i
=
0
;
i
<
times
;
i
++
)
{
uint
copy_sz
=
item_sz
*
len
;
memcpy
(
dest
,
items
,
copy_sz
);
dest
=
(
char
*
)
dest
+
copy_sz
;
...
...
@@ -185,8 +185,8 @@ bool mp_seq_cmp_objs(mp_uint_t op, const mp_obj_t *items1, mp_uint_t len1, const
}
}
in
t
len
=
len1
<
len2
?
len1
:
len2
;
for
(
in
t
i
=
0
;
i
<
len
;
i
++
)
{
mp_uint_
t
len
=
len1
<
len2
?
len1
:
len2
;
for
(
mp_uint_
t
i
=
0
;
i
<
len
;
i
++
)
{
// If current elements equal, can't decide anything - go on
if
(
mp_obj_equal
(
items1
[
i
],
items2
[
i
]))
{
continue
;
...
...
py/showbc.c
View file @
42f3de92
...
...
@@ -57,9 +57,7 @@
ip += sizeof(mp_uint_t); \
} while (0)
void
mp_bytecode_print2
(
const
byte
*
ip
,
int
len
);
void
mp_bytecode_print
(
const
void
*
descr
,
const
byte
*
ip
,
int
len
)
{
void
mp_bytecode_print
(
const
void
*
descr
,
const
byte
*
ip
,
mp_uint_t
len
)
{
const
byte
*
ip_start
=
ip
;
// get code info size
...
...
@@ -115,14 +113,13 @@ void mp_bytecode_print(const void *descr, const byte *ip, int len) {
mp_bytecode_print2
(
ip
,
len
-
0
);
}
void
mp_bytecode_print2
(
const
byte
*
ip
,
in
t
len
)
{
void
mp_bytecode_print2
(
const
byte
*
ip
,
mp_uint_
t
len
)
{
const
byte
*
ip_start
=
ip
;
mp_uint_t
unum
;
qstr
qstr
;
while
(
ip
-
ip_start
<
len
)
{
printf
(
"%02u "
,
(
uint
)(
ip
-
ip_start
));
int
op
=
*
ip
++
;
switch
(
op
)
{
switch
(
*
ip
++
)
{
case
MP_BC_LOAD_CONST_FALSE
:
printf
(
"LOAD_CONST_FALSE"
);
break
;
...
...
@@ -520,7 +517,7 @@ void mp_bytecode_print2(const byte *ip, int len) {
break
;
default:
printf
(
"code %p, byte code 0x%02x not implemented
\n
"
,
ip
,
op
);
printf
(
"code %p, byte code 0x%02x not implemented
\n
"
,
ip
,
ip
[
-
1
]
);
assert
(
0
);
return
;
}
...
...
py/vstr.c
View file @
42f3de92
...
...
@@ -263,24 +263,6 @@ copy:
vstr
->
buf
[
vstr
->
len
]
=
0
;
}
/*
void vstr_add_le16(vstr_t *vstr, unsigned short v) {
byte *buf = (byte*)vstr_add_len(vstr, 2);
if (buf == NULL) {
return;
}
encode_le16(buf, v);
}
void vstr_add_le32(vstr_t *vstr, unsigned int v) {
byte *buf = (byte*)vstr_add_len(vstr, 4);
if (buf == NULL) {
return;
}
encode_le32(buf, v);
}
*/
char
*
vstr_ins_blank_bytes
(
vstr_t
*
vstr
,
size_t
byte_pos
,
size_t
byte_len
)
{
if
(
vstr
->
had_error
)
{
return
NULL
;
...
...
Prev
1
2
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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