py: Change uint to mp_uint_t in runtime.h, stackctrl.h, binary.h.

Part of code cleanup, working towards resolving issue #50.
This commit is contained in:
Damien George 2014-08-30 14:59:21 +01:00
parent 4d91723587
commit 4abff7500f
21 changed files with 62 additions and 63 deletions

View File

@ -34,7 +34,7 @@
#include "obj.h"
#include "runtime.h"
void mp_arg_check_num(uint n_args, uint n_kw, uint n_args_min, uint n_args_max, bool takes_kw) {
void mp_arg_check_num(mp_uint_t n_args, mp_uint_t n_kw, mp_uint_t n_args_min, mp_uint_t n_args_max, bool takes_kw) {
// TODO maybe take the function name as an argument so we can print nicer error messages
if (n_kw && !takes_kw) {
@ -60,9 +60,9 @@ void mp_arg_check_num(uint n_args, uint n_kw, uint n_args_min, uint n_args_max,
}
}
void mp_arg_parse_all(uint n_pos, const mp_obj_t *pos, mp_map_t *kws, uint n_allowed, const mp_arg_t *allowed, mp_arg_val_t *out_vals) {
uint pos_found = 0, kws_found = 0;
for (uint i = 0; i < n_allowed; i++) {
void mp_arg_parse_all(mp_uint_t n_pos, const mp_obj_t *pos, mp_map_t *kws, mp_uint_t n_allowed, const mp_arg_t *allowed, mp_arg_val_t *out_vals) {
mp_uint_t pos_found = 0, kws_found = 0;
for (mp_uint_t i = 0; i < n_allowed; i++) {
mp_obj_t given_arg;
if (i < n_pos) {
if (allowed[i].flags & MP_ARG_KW_ONLY) {
@ -104,7 +104,7 @@ void mp_arg_parse_all(uint n_pos, const mp_obj_t *pos, mp_map_t *kws, uint n_all
}
}
void mp_arg_parse_all_kw_array(uint n_pos, uint n_kw, const mp_obj_t *args, uint n_allowed, const mp_arg_t *allowed, mp_arg_val_t *out_vals) {
void mp_arg_parse_all_kw_array(mp_uint_t n_pos, mp_uint_t n_kw, const mp_obj_t *args, mp_uint_t n_allowed, const mp_arg_t *allowed, mp_arg_val_t *out_vals) {
mp_map_t kw_args;
mp_map_init_fixed_table(&kw_args, n_kw, args + n_pos);
mp_arg_parse_all(n_pos, args, &kw_args, n_allowed, allowed, out_vals);

View File

@ -42,7 +42,7 @@
#define alignof(type) offsetof(struct { char c; type t; }, t)
#endif
int mp_binary_get_size(char struct_type, char val_type, uint *palign) {
int mp_binary_get_size(char struct_type, char val_type, mp_uint_t *palign) {
int size = 0;
int align = 1;
switch (struct_type) {
@ -134,7 +134,7 @@ mp_obj_t mp_binary_get_val_array(char typecode, void *p, int index) {
return MP_OBJ_NEW_SMALL_INT(val);
}
mp_int_t mp_binary_get_int(uint size, bool is_signed, bool big_endian, byte *p) {
mp_int_t mp_binary_get_int(mp_uint_t size, bool is_signed, bool big_endian, byte *p) {
int delta;
if (!big_endian) {
delta = -1;
@ -159,7 +159,7 @@ mp_int_t mp_binary_get_int(uint size, bool is_signed, bool big_endian, byte *p)
#define is_signed(typecode) (typecode > 'Z')
mp_obj_t mp_binary_get_val(char struct_type, char val_type, byte **ptr) {
byte *p = *ptr;
uint align;
mp_uint_t align;
int size = mp_binary_get_size(struct_type, val_type, &align);
if (struct_type == '@') {
@ -186,7 +186,7 @@ mp_obj_t mp_binary_get_val(char struct_type, char val_type, byte **ptr) {
}
}
void mp_binary_set_int(uint val_sz, bool big_endian, byte *p, byte *val_ptr) {
void mp_binary_set_int(mp_uint_t val_sz, bool big_endian, byte *p, byte *val_ptr) {
int in_delta, out_delta;
if (big_endian) {
in_delta = -1;
@ -205,7 +205,7 @@ void mp_binary_set_int(uint val_sz, bool big_endian, byte *p, byte *val_ptr) {
void mp_binary_set_val(char struct_type, char val_type, mp_obj_t val_in, byte **ptr) {
byte *p = *ptr;
uint align;
mp_uint_t align;
int size = mp_binary_get_size(struct_type, val_type, &align);
if (struct_type == '@') {

View File

@ -28,11 +28,11 @@
// (underlyingly they're same).
#define BYTEARRAY_TYPECODE 0
int mp_binary_get_size(char struct_type, char val_type, uint *palign);
int mp_binary_get_size(char struct_type, char val_type, mp_uint_t *palign);
mp_obj_t mp_binary_get_val_array(char typecode, void *p, int index);
void mp_binary_set_val_array(char typecode, void *p, int index, mp_obj_t val_in);
void mp_binary_set_val_array_from_int(char typecode, void *p, int index, mp_int_t val);
mp_obj_t mp_binary_get_val(char struct_type, char val_type, byte **ptr);
void mp_binary_set_val(char struct_type, char val_type, mp_obj_t val_in, byte **ptr);
mp_int_t mp_binary_get_int(uint size, bool is_signed, bool big_endian, byte *p);
void mp_binary_set_int(uint val_sz, bool big_endian, byte *p, byte *val_ptr);
mp_int_t mp_binary_get_int(mp_uint_t size, bool is_signed, bool big_endian, byte *p);
void mp_binary_set_int(mp_uint_t val_sz, bool big_endian, byte *p, byte *val_ptr);

View File

@ -401,7 +401,7 @@ STATIC mp_obj_t mp_builtin_print(mp_uint_t n_args, const mp_obj_t *args, mp_map_
#if MICROPY_PY_IO
mp_stream_write(stream_obj, sep_data, sep_len);
#else
printf("%.*s", sep_len, sep_data);
printf("%.*s", (int)sep_len, sep_data);
#endif
}
#if MICROPY_PY_IO
@ -413,7 +413,7 @@ STATIC mp_obj_t mp_builtin_print(mp_uint_t n_args, const mp_obj_t *args, mp_map_
#if MICROPY_PY_IO
mp_stream_write(stream_obj, end_data, end_len);
#else
printf("%.*s", end_len, end_data);
printf("%.*s", (int)end_len, end_data);
#endif
return mp_const_none;
}

View File

@ -24,9 +24,8 @@
* THE SOFTWARE.
*/
mp_obj_t mp_builtin___import__(uint n_args, mp_obj_t *args);
mp_obj_t mp_builtin_open(uint n_args, const mp_obj_t *args);
mp_obj_t mp_builtin_len(mp_obj_t o);
mp_obj_t mp_builtin___import__(mp_uint_t n_args, mp_obj_t *args);
mp_obj_t mp_builtin_open(mp_uint_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___import___obj);

View File

@ -165,7 +165,7 @@ STATIC void do_load(mp_obj_t module_obj, vstr_t *file) {
mp_globals_set(old_globals);
}
mp_obj_t mp_builtin___import__(uint n_args, mp_obj_t *args) {
mp_obj_t mp_builtin___import__(mp_uint_t n_args, mp_obj_t *args) {
#if DEBUG_PRINT
printf("__import__:\n");
for (int i = 0; i < n_args; i++) {

View File

@ -101,7 +101,7 @@ STATIC mp_obj_t struct_calcsize(mp_obj_t fmt_in) {
char fmt_type = get_fmt_type(&fmt);
mp_uint_t size;
for (size = 0; *fmt; fmt++) {
uint align = 1;
mp_uint_t align = 1;
mp_uint_t cnt = 1;
if (unichar_isdigit(*fmt)) {
cnt = get_fmt_num(&fmt);

View File

@ -71,7 +71,7 @@ mp_obj_t mp_convert_native_to_obj(mp_uint_t val, mp_uint_t type) {
// wrapper that accepts n_args and n_kw in one argument
// (native emitter can only pass at most 3 arguments to a function)
mp_obj_t mp_native_call_function_n_kw(mp_obj_t fun_in, uint n_args_kw, const mp_obj_t *args) {
mp_obj_t mp_native_call_function_n_kw(mp_obj_t fun_in, mp_uint_t n_args_kw, const mp_obj_t *args) {
return mp_call_function_n_kw(fun_in, n_args_kw & 0xff, (n_args_kw >> 8) & 0xff, args);
}

View File

@ -50,7 +50,7 @@ typedef struct _mp_obj_array_t {
} mp_obj_array_t;
STATIC mp_obj_t array_iterator_new(mp_obj_t array_in);
STATIC mp_obj_array_t *array_new(char typecode, uint n);
STATIC mp_obj_array_t *array_new(char typecode, mp_uint_t n);
STATIC mp_obj_t array_append(mp_obj_t self_in, mp_obj_t arg);
STATIC mp_int_t array_get_buffer(mp_obj_t o_in, mp_buffer_info_t *bufinfo, mp_uint_t flags);
@ -263,7 +263,7 @@ const mp_obj_type_t mp_type_bytearray = {
.locals_dict = (mp_obj_t)&array_locals_dict,
};
STATIC mp_obj_array_t *array_new(char typecode, uint n) {
STATIC mp_obj_array_t *array_new(char typecode, mp_uint_t n) {
int typecode_size = mp_binary_get_size('@', typecode, NULL);
if (typecode_size <= 0) {
nlr_raise(mp_obj_new_exception_msg(&mp_type_ValueError, "bad typecode"));
@ -281,7 +281,7 @@ mp_uint_t mp_obj_array_len(mp_obj_t self_in) {
return ((mp_obj_array_t *)self_in)->len;
}
mp_obj_t mp_obj_new_bytearray(uint n, void *items) {
mp_obj_t mp_obj_new_bytearray(mp_uint_t n, void *items) {
mp_obj_array_t *o = array_new(BYTEARRAY_TYPECODE, n);
memcpy(o->items, items, n);
return o;

View File

@ -24,4 +24,4 @@
* THE SOFTWARE.
*/
mp_obj_t mp_obj_new_bytearray(uint n, void *items);
mp_obj_t mp_obj_new_bytearray(mp_uint_t n, void *items);

View File

@ -235,7 +235,7 @@ mp_obj_t mp_obj_int_binary_op(mp_uint_t op, mp_obj_t lhs_in, mp_obj_t rhs_in) {
}
// This is called only with strings whose value doesn't fit in SMALL_INT
mp_obj_t mp_obj_new_int_from_str_len(const char **str, uint len, bool neg, uint base) {
mp_obj_t mp_obj_new_int_from_str_len(const char **str, mp_uint_t len, bool neg, mp_uint_t base) {
nlr_raise(mp_obj_new_exception_msg(&mp_type_OverflowError, "long int not supported in this build"));
return mp_const_none;
}

View File

@ -351,7 +351,7 @@ uncomparable:
#if !MICROPY_PY_BUILTINS_STR_UNICODE
// objstrunicode defines own version
const byte *str_index_to_ptr(const mp_obj_type_t *type, const byte *self_data, uint self_len,
const byte *str_index_to_ptr(const mp_obj_type_t *type, const byte *self_data, mp_uint_t self_len,
mp_obj_t index, bool is_slice) {
mp_uint_t index_val = mp_get_index(type, self_len, index, is_slice);
return self_data + index_val;
@ -1763,7 +1763,7 @@ mp_obj_t mp_obj_str_builder_end_with_len(mp_obj_t o_in, mp_uint_t len) {
return o;
}
mp_obj_t mp_obj_new_str_of_type(const mp_obj_type_t *type, const byte* data, uint len) {
mp_obj_t mp_obj_new_str_of_type(const mp_obj_type_t *type, const byte* data, mp_uint_t len) {
mp_obj_str_t *o = m_new_obj(mp_obj_str_t);
o->base.type = type;
o->len = len;

View File

@ -51,12 +51,12 @@ typedef struct _mp_obj_str_t {
else { str_len = ((mp_obj_str_t*)str_obj_in)->len; str_data = ((mp_obj_str_t*)str_obj_in)->data; }
mp_obj_t mp_obj_str_format(mp_uint_t n_args, const mp_obj_t *args);
mp_obj_t mp_obj_new_str_of_type(const mp_obj_type_t *type, const byte* data, uint len);
mp_obj_t mp_obj_new_str_of_type(const mp_obj_type_t *type, const byte* data, mp_uint_t len);
mp_obj_t mp_obj_str_binary_op(mp_uint_t op, mp_obj_t lhs_in, mp_obj_t rhs_in);
mp_int_t mp_obj_str_get_buffer(mp_obj_t self_in, mp_buffer_info_t *bufinfo, mp_uint_t flags);
const byte *str_index_to_ptr(const mp_obj_type_t *type, const byte *self_data, uint self_len,
const byte *str_index_to_ptr(const mp_obj_type_t *type, const byte *self_data, mp_uint_t self_len,
mp_obj_t index, bool is_slice);
MP_DECLARE_CONST_FUN_OBJ(str_encode_obj);

View File

@ -154,7 +154,7 @@ STATIC mp_obj_t str_make_new(mp_obj_t type_in, mp_uint_t n_args, mp_uint_t n_kw,
// Convert an index into a pointer to its lead byte. Out of bounds indexing will raise IndexError or
// be capped to the first/last character of the string, depending on is_slice.
const byte *str_index_to_ptr(const mp_obj_type_t *type, const byte *self_data, uint self_len,
const byte *str_index_to_ptr(const mp_obj_type_t *type, const byte *self_data, mp_uint_t self_len,
mp_obj_t index, bool is_slice) {
mp_int_t i;
// Copied from mp_get_index; I don't want bounds checking, just give me

View File

@ -188,7 +188,7 @@ void mp_delete_global(qstr qstr) {
mp_obj_dict_delete(dict_globals, MP_OBJ_NEW_QSTR(qstr));
}
mp_obj_t mp_unary_op(int op, mp_obj_t arg) {
mp_obj_t mp_unary_op(mp_uint_t op, mp_obj_t arg) {
DEBUG_OP_printf("unary %d %p\n", op, arg);
if (MP_OBJ_IS_SMALL_INT(arg)) {
@ -224,7 +224,7 @@ mp_obj_t mp_unary_op(int op, mp_obj_t arg) {
}
}
mp_obj_t mp_binary_op(int op, mp_obj_t lhs, mp_obj_t rhs) {
mp_obj_t mp_binary_op(mp_uint_t op, mp_obj_t lhs, mp_obj_t rhs) {
DEBUG_OP_printf("binary %d %p %p\n", op, lhs, rhs);
// TODO correctly distinguish inplace operators for mutable objects
@ -518,7 +518,7 @@ mp_obj_t mp_call_function_2(mp_obj_t fun, mp_obj_t arg1, mp_obj_t arg2) {
}
// args contains, eg: arg0 arg1 key0 value0 key1 value1
mp_obj_t mp_call_function_n_kw(mp_obj_t fun_in, uint n_args, uint n_kw, const mp_obj_t *args) {
mp_obj_t mp_call_function_n_kw(mp_obj_t fun_in, mp_uint_t n_args, mp_uint_t n_kw, const mp_obj_t *args) {
// TODO improve this: fun object can specify its type and we parse here the arguments,
// passing to the function arrays of fixed and keyword arguments
@ -537,13 +537,13 @@ mp_obj_t mp_call_function_n_kw(mp_obj_t fun_in, uint n_args, uint n_kw, const mp
// args contains: fun self/NULL arg(0) ... arg(n_args-2) arg(n_args-1) kw_key(0) kw_val(0) ... kw_key(n_kw-1) kw_val(n_kw-1)
// if n_args==0 and n_kw==0 then there are only fun and self/NULL
mp_obj_t mp_call_method_n_kw(uint n_args, uint n_kw, const mp_obj_t *args) {
mp_obj_t mp_call_method_n_kw(mp_uint_t n_args, mp_uint_t n_kw, const mp_obj_t *args) {
DEBUG_OP_printf("call method (fun=%p, self=%p, n_args=%u, n_kw=%u, args=%p)\n", args[0], args[1], n_args, n_kw, args);
int adjust = (args[1] == NULL) ? 0 : 1;
return mp_call_function_n_kw(args[0], n_args + adjust, n_kw, args + 2 - adjust);
}
mp_obj_t mp_call_method_n_kw_var(bool have_self, uint n_args_n_kw, const mp_obj_t *args) {
mp_obj_t mp_call_method_n_kw_var(bool have_self, mp_uint_t n_args_n_kw, const mp_obj_t *args) {
mp_obj_t fun = *args++;
mp_obj_t self = MP_OBJ_NULL;
if (have_self) {
@ -688,7 +688,7 @@ mp_obj_t mp_call_method_n_kw_var(bool have_self, uint n_args_n_kw, const mp_obj_
}
// unpacked items are stored in reverse order into the array pointed to by items
void mp_unpack_sequence(mp_obj_t seq_in, uint num, mp_obj_t *items) {
void mp_unpack_sequence(mp_obj_t seq_in, mp_uint_t num, mp_obj_t *items) {
mp_uint_t seq_len;
if (MP_OBJ_IS_TYPE(seq_in, &mp_type_tuple) || MP_OBJ_IS_TYPE(seq_in, &mp_type_list)) {
mp_obj_t *seq_items;
@ -702,7 +702,7 @@ void mp_unpack_sequence(mp_obj_t seq_in, uint num, mp_obj_t *items) {
} else if (seq_len > num) {
goto too_long;
}
for (uint i = 0; i < num; i++) {
for (mp_uint_t i = 0; i < num; i++) {
items[i] = seq_items[num - 1 - i];
}
} else {
@ -728,9 +728,9 @@ too_long:
}
// unpacked items are stored in reverse order into the array pointed to by items
void mp_unpack_ex(mp_obj_t seq_in, uint num_in, mp_obj_t *items) {
uint num_left = num_in & 0xff;
uint num_right = (num_in >> 8) & 0xff;
void mp_unpack_ex(mp_obj_t seq_in, mp_uint_t num_in, mp_obj_t *items) {
mp_uint_t num_left = num_in & 0xff;
mp_uint_t num_right = (num_in >> 8) & 0xff;
DEBUG_OP_printf("unpack ex %d %d\n", num_left, num_right);
mp_uint_t seq_len;
if (MP_OBJ_IS_TYPE(seq_in, &mp_type_tuple) || MP_OBJ_IS_TYPE(seq_in, &mp_type_list)) {
@ -748,11 +748,11 @@ void mp_unpack_ex(mp_obj_t seq_in, uint num_in, mp_obj_t *items) {
if (seq_len < num_left + num_right) {
goto too_short;
}
for (uint i = 0; i < num_right; i++) {
for (mp_uint_t i = 0; i < num_right; i++) {
items[i] = seq_items[seq_len - 1 - i];
}
items[num_right] = mp_obj_new_list(seq_len - num_left - num_right, seq_items + num_left);
for (uint i = 0; i < num_left; i++) {
for (mp_uint_t i = 0; i < num_left; i++) {
items[num_right + 1 + i] = seq_items[num_left - 1 - i];
}
} else {
@ -780,7 +780,7 @@ void mp_unpack_ex(mp_obj_t seq_in, uint num_in, mp_obj_t *items) {
goto too_short;
}
items[num_right] = rest;
for (uint i = 0; i < num_right; i++) {
for (mp_uint_t i = 0; i < num_right; i++) {
items[num_right - 1 - i] = rest_items[rest_len - num_right + i];
}
mp_obj_list_set_len(rest, rest_len - num_right);

View File

@ -54,9 +54,9 @@ typedef struct _mp_arg_t {
void mp_init(void);
void mp_deinit(void);
void mp_arg_check_num(uint n_args, uint n_kw, uint n_args_min, uint n_args_max, bool takes_kw);
void mp_arg_parse_all(uint n_pos, const mp_obj_t *pos, mp_map_t *kws, uint n_allowed, const mp_arg_t *allowed, mp_arg_val_t *out_vals);
void mp_arg_parse_all_kw_array(uint n_pos, uint n_kw, const mp_obj_t *args, uint n_allowed, const mp_arg_t *allowed, mp_arg_val_t *out_vals);
void mp_arg_check_num(mp_uint_t n_args, mp_uint_t n_kw, mp_uint_t n_args_min, mp_uint_t n_args_max, bool takes_kw);
void mp_arg_parse_all(mp_uint_t n_pos, const mp_obj_t *pos, mp_map_t *kws, mp_uint_t n_allowed, const mp_arg_t *allowed, mp_arg_val_t *out_vals);
void mp_arg_parse_all_kw_array(mp_uint_t n_pos, mp_uint_t n_kw, const mp_obj_t *args, mp_uint_t n_allowed, const mp_arg_t *allowed, mp_arg_val_t *out_vals);
NORETURN void mp_arg_error_unimpl_kw(void);
mp_obj_dict_t *mp_locals_get(void);
@ -72,8 +72,8 @@ void mp_store_global(qstr qstr, mp_obj_t obj);
void mp_delete_name(qstr qstr);
void mp_delete_global(qstr qstr);
mp_obj_t mp_unary_op(int op, mp_obj_t arg);
mp_obj_t mp_binary_op(int op, mp_obj_t lhs, mp_obj_t rhs);
mp_obj_t mp_unary_op(mp_uint_t op, mp_obj_t arg);
mp_obj_t mp_binary_op(mp_uint_t op, mp_obj_t lhs, mp_obj_t rhs);
mp_obj_t mp_load_const_int(qstr qstr);
mp_obj_t mp_load_const_dec(qstr qstr);
@ -83,12 +83,12 @@ mp_obj_t mp_load_const_bytes(qstr qstr);
mp_obj_t mp_call_function_0(mp_obj_t fun);
mp_obj_t mp_call_function_1(mp_obj_t fun, mp_obj_t arg);
mp_obj_t mp_call_function_2(mp_obj_t fun, mp_obj_t arg1, mp_obj_t arg2);
mp_obj_t mp_call_function_n_kw(mp_obj_t fun, uint n_args, uint n_kw, const mp_obj_t *args);
mp_obj_t mp_call_method_n_kw(uint n_args, uint n_kw, const mp_obj_t *args);
mp_obj_t mp_call_method_n_kw_var(bool have_self, uint n_args_n_kw, const mp_obj_t *args);
mp_obj_t mp_call_function_n_kw(mp_obj_t fun, mp_uint_t n_args, mp_uint_t n_kw, const mp_obj_t *args);
mp_obj_t mp_call_method_n_kw(mp_uint_t n_args, mp_uint_t n_kw, const mp_obj_t *args);
mp_obj_t mp_call_method_n_kw_var(bool have_self, mp_uint_t n_args_n_kw, const mp_obj_t *args);
void mp_unpack_sequence(mp_obj_t seq, uint num, mp_obj_t *items);
void mp_unpack_ex(mp_obj_t seq, uint num, mp_obj_t *items);
void mp_unpack_sequence(mp_obj_t seq, mp_uint_t num, mp_obj_t *items);
void mp_unpack_ex(mp_obj_t seq, mp_uint_t num, mp_obj_t *items);
mp_obj_t mp_store_map(mp_obj_t map, mp_obj_t key, mp_obj_t value);
mp_obj_t mp_load_attr(mp_obj_t base, qstr attr);
void mp_load_method(mp_obj_t base, qstr attr, mp_obj_t *dest);
@ -113,7 +113,7 @@ NORETURN void mp_not_implemented(const char *msg);
// helper functions for native/viper code
mp_uint_t mp_convert_obj_to_native(mp_obj_t obj, mp_uint_t type);
mp_obj_t mp_convert_native_to_obj(mp_uint_t val, mp_uint_t type);
mp_obj_t mp_native_call_function_n_kw(mp_obj_t fun_in, uint n_args_kw, const mp_obj_t *args);
mp_obj_t mp_native_call_function_n_kw(mp_obj_t fun_in, mp_uint_t n_args_kw, const mp_obj_t *args);
NORETURN void mp_native_raise(mp_obj_t o);
extern struct _mp_obj_list_t mp_sys_path_obj;

View File

@ -37,7 +37,7 @@
#include "emitglue.h"
#include "scope.h"
scope_t *scope_new(scope_kind_t kind, mp_parse_node_t pn, qstr source_file, uint emit_options) {
scope_t *scope_new(scope_kind_t kind, mp_parse_node_t pn, qstr source_file, mp_uint_t emit_options) {
scope_t *scope = m_new0(scope_t, 1);
scope->kind = kind;
scope->pn = pn;

View File

@ -69,7 +69,7 @@ typedef struct _scope_t {
id_info_t *id_info;
} scope_t;
scope_t *scope_new(scope_kind_t kind, mp_parse_node_t pn, qstr source_file, uint emit_options);
scope_t *scope_new(scope_kind_t kind, mp_parse_node_t pn, qstr source_file, mp_uint_t emit_options);
void scope_free(scope_t *scope);
id_info_t *scope_find_or_add_id(scope_t *scope, qstr qstr, bool *added);
id_info_t *scope_find(scope_t *scope, qstr qstr);

View File

@ -40,7 +40,7 @@ void mp_stack_ctrl_init() {
stack_top = (char*)&stack_dummy;
}
uint mp_stack_usage() {
mp_uint_t mp_stack_usage() {
// Assumes descending stack
volatile int stack_dummy;
return stack_top - (char*)&stack_dummy;
@ -48,9 +48,9 @@ uint mp_stack_usage() {
#if MICROPY_STACK_CHECK
static uint stack_limit = 10240;
static mp_uint_t stack_limit = 10240;
void mp_stack_set_limit(uint limit) {
void mp_stack_set_limit(mp_uint_t limit) {
stack_limit = limit;
}

View File

@ -25,11 +25,11 @@
*/
void mp_stack_ctrl_init();
uint mp_stack_usage();
mp_uint_t mp_stack_usage();
#if MICROPY_STACK_CHECK
void mp_stack_set_limit(uint limit);
void mp_stack_set_limit(mp_uint_t limit);
void mp_stack_check();
#define MP_STACK_CHECK() mp_stack_check()

View File

@ -224,7 +224,7 @@ int usage(char **argv) {
STATIC mp_obj_t mem_info(void) {
printf("mem: total=%d, current=%d, peak=%d\n",
m_get_total_bytes_allocated(), m_get_current_bytes_allocated(), m_get_peak_bytes_allocated());
printf("stack: %u\n", mp_stack_usage());
printf("stack: " UINT_FMT "\n", mp_stack_usage());
#if MICROPY_ENABLE_GC
gc_dump_info();
#endif