Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitecc88e9

Browse files
committed
Change some parts of the core API to use mp_uint_t instead of uint/int.
Addressing issueadafruit#50, still some way to go yet.
1 parent4d3fc46 commitecc88e9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+212
-212
lines changed

‎extmod/moductypes.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ STATIC NORETURN void syntax_error() {
119119
nlr_raise(mp_obj_new_exception_msg(&mp_type_TypeError,"syntax error in uctypes descriptor"));
120120
}
121121

122-
STATICmp_obj_tuctypes_struct_make_new(mp_obj_ttype_in,uintn_args,uintn_kw,constmp_obj_t*args) {
122+
STATICmp_obj_tuctypes_struct_make_new(mp_obj_ttype_in,mp_uint_tn_args,mp_uint_tn_kw,constmp_obj_t*args) {
123123
if (n_args<2||n_args>3) {
124124
syntax_error();
125125
}

‎py/obj.h‎

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,8 @@ typedef mp_obj_t (*mp_fun_0_t)(void);
180180
typedefmp_obj_t (*mp_fun_1_t)(mp_obj_t);
181181
typedefmp_obj_t (*mp_fun_2_t)(mp_obj_t,mp_obj_t);
182182
typedefmp_obj_t (*mp_fun_3_t)(mp_obj_t,mp_obj_t,mp_obj_t);
183-
typedefmp_obj_t (*mp_fun_var_t)(uintn,constmp_obj_t*);
184-
typedefmp_obj_t (*mp_fun_kw_t)(uintn,constmp_obj_t*,mp_map_t*);
183+
typedefmp_obj_t (*mp_fun_var_t)(mp_uint_tn,constmp_obj_t*);
184+
typedefmp_obj_t (*mp_fun_kw_t)(mp_uint_tn,constmp_obj_t*,mp_map_t*);
185185

186186
typedefenum {
187187
PRINT_STR=0,
@@ -191,10 +191,10 @@ typedef enum {
191191
}mp_print_kind_t;
192192

193193
typedefvoid (*mp_print_fun_t)(void (*print)(void*env,constchar*fmt, ...),void*env,mp_obj_to,mp_print_kind_tkind);
194-
typedefmp_obj_t (*mp_make_new_fun_t)(mp_obj_ttype_in,uintn_args,uintn_kw,constmp_obj_t*args);
195-
typedefmp_obj_t (*mp_call_fun_t)(mp_obj_tfun,uintn_args,uintn_kw,constmp_obj_t*args);
196-
typedefmp_obj_t (*mp_unary_op_fun_t)(intop,mp_obj_t);
197-
typedefmp_obj_t (*mp_binary_op_fun_t)(intop,mp_obj_t,mp_obj_t);
194+
typedefmp_obj_t (*mp_make_new_fun_t)(mp_obj_ttype_in,mp_uint_tn_args,mp_uint_tn_kw,constmp_obj_t*args);
195+
typedefmp_obj_t (*mp_call_fun_t)(mp_obj_tfun,mp_uint_tn_args,mp_uint_tn_kw,constmp_obj_t*args);
196+
typedefmp_obj_t (*mp_unary_op_fun_t)(mp_uint_top,mp_obj_t);
197+
typedefmp_obj_t (*mp_binary_op_fun_t)(mp_uint_top,mp_obj_t,mp_obj_t);
198198
typedefvoid (*mp_load_attr_fun_t)(mp_obj_tself_in,qstrattr,mp_obj_t*dest);// for fail, do nothing; for attr, dest[0] = value; for method, dest[0] = method, dest[1] = self
199199
typedefbool (*mp_store_attr_fun_t)(mp_obj_tself_in,qstrattr,mp_obj_tvalue);// return true if store succeeded; if value==MP_OBJ_NULL then delete
200200
typedefmp_obj_t (*mp_subscr_fun_t)(mp_obj_tself_in,mp_obj_tindex,mp_obj_tvalue);
@@ -458,7 +458,7 @@ void mp_obj_exception_clear_traceback(mp_obj_t self_in);
458458
voidmp_obj_exception_add_traceback(mp_obj_tself_in,qstrfile,mp_uint_tline,qstrblock);
459459
voidmp_obj_exception_get_traceback(mp_obj_tself_in,mp_uint_t*n,mp_uint_t**values);
460460
mp_obj_tmp_obj_exception_get_value(mp_obj_tself_in);
461-
mp_obj_tmp_obj_exception_make_new(mp_obj_ttype_in,uintn_args,uintn_kw,constmp_obj_t*args);
461+
mp_obj_tmp_obj_exception_make_new(mp_obj_ttype_in,mp_uint_tn_args,mp_uint_tn_kw,constmp_obj_t*args);
462462
mp_obj_tmp_alloc_emergency_exception_buf(mp_obj_tsize_in);
463463
voidmp_init_emergency_exception_buf(void);
464464

@@ -482,11 +482,11 @@ typedef struct _mp_obj_float_t {
482482
mp_float_tvalue;
483483
}mp_obj_float_t;
484484
mp_float_tmp_obj_float_get(mp_obj_tself_in);
485-
mp_obj_tmp_obj_float_binary_op(intop,mp_float_tlhs_val,mp_obj_trhs);// can return MP_OBJ_NULL if op not supported
485+
mp_obj_tmp_obj_float_binary_op(mp_uint_top,mp_float_tlhs_val,mp_obj_trhs);// can return MP_OBJ_NULL if op not supported
486486

487487
// complex
488488
voidmp_obj_complex_get(mp_obj_tself_in,mp_float_t*real,mp_float_t*imag);
489-
mp_obj_tmp_obj_complex_binary_op(intop,mp_float_tlhs_real,mp_float_tlhs_imag,mp_obj_trhs_in);// can return MP_OBJ_NULL if op not supported
489+
mp_obj_tmp_obj_complex_binary_op(mp_uint_top,mp_float_tlhs_real,mp_float_tlhs_imag,mp_obj_trhs_in);// can return MP_OBJ_NULL if op not supported
490490
#endif
491491

492492
// tuple
@@ -501,7 +501,7 @@ mp_obj_t mp_obj_list_append(mp_obj_t self_in, mp_obj_t arg);
501501
voidmp_obj_list_get(mp_obj_tself_in,uint*len,mp_obj_t**items);
502502
voidmp_obj_list_set_len(mp_obj_tself_in,uintlen);
503503
voidmp_obj_list_store(mp_obj_tself_in,mp_obj_tindex,mp_obj_tvalue);
504-
mp_obj_tmp_obj_list_sort(uintn_args,constmp_obj_t*args,mp_map_t*kwargs);
504+
mp_obj_tmp_obj_list_sort(mp_uint_tn_args,constmp_obj_t*args,mp_map_t*kwargs);
505505

506506
// dict
507507
typedefstruct_mp_obj_dict_t {
@@ -535,7 +535,7 @@ typedef struct _mp_obj_fun_builtin_t { // use this to make const objects that go
535535
void*fun;// must be a pointer to a callable function in ROM
536536
}mp_obj_fun_builtin_t;
537537

538-
mp_obj_tmp_obj_fun_binary_op(intop,mp_obj_tlhs_in,mp_obj_trhs_in);
538+
mp_obj_tmp_obj_fun_binary_op(mp_uint_top,mp_obj_tlhs_in,mp_obj_trhs_in);
539539
constchar*mp_obj_fun_get_name(mp_const_obj_tfun);
540540
constchar*mp_obj_code_get_name(constbyte*code_info);
541541

‎py/objarray.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ STATIC mp_obj_t array_construct(char typecode, mp_obj_t initializer) {
104104
returnarray;
105105
}
106106

107-
STATICmp_obj_tarray_make_new(mp_obj_ttype_in,uintn_args,uintn_kw,constmp_obj_t*args) {
107+
STATICmp_obj_tarray_make_new(mp_obj_ttype_in,mp_uint_tn_args,mp_uint_tn_kw,constmp_obj_t*args) {
108108
mp_arg_check_num(n_args,n_kw,1,2, false);
109109

110110
// get typecode
@@ -120,7 +120,7 @@ STATIC mp_obj_t array_make_new(mp_obj_t type_in, uint n_args, uint n_kw, const m
120120
}
121121
}
122122

123-
STATICmp_obj_tbytearray_make_new(mp_obj_ttype_in,uintn_args,uintn_kw,constmp_obj_t*args) {
123+
STATICmp_obj_tbytearray_make_new(mp_obj_ttype_in,mp_uint_tn_args,mp_uint_tn_kw,constmp_obj_t*args) {
124124
mp_arg_check_num(n_args,n_kw,0,1, false);
125125

126126
if (n_args==0) {
@@ -138,7 +138,7 @@ STATIC mp_obj_t bytearray_make_new(mp_obj_t type_in, uint n_args, uint n_kw, con
138138
}
139139
}
140140

141-
STATICmp_obj_tarray_unary_op(intop,mp_obj_to_in) {
141+
STATICmp_obj_tarray_unary_op(mp_uint_top,mp_obj_to_in) {
142142
mp_obj_array_t*o=o_in;
143143
switch (op) {
144144
caseMP_UNARY_OP_BOOL:returnMP_BOOL(o->len!=0);
@@ -147,7 +147,7 @@ STATIC mp_obj_t array_unary_op(int op, mp_obj_t o_in) {
147147
}
148148
}
149149

150-
STATICmp_obj_tarray_binary_op(intop,mp_obj_tlhs_in,mp_obj_trhs_in) {
150+
STATICmp_obj_tarray_binary_op(mp_uint_top,mp_obj_tlhs_in,mp_obj_trhs_in) {
151151
switch (op) {
152152
caseMP_BINARY_OP_EQUAL: {
153153
mp_buffer_info_tlhs_bufinfo;

‎py/objbool.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ STATIC void bool_print(void (*print)(void *env, const char *fmt, ...), void *env
4848
}
4949
}
5050

51-
STATICmp_obj_tbool_make_new(mp_obj_ttype_in,uintn_args,uintn_kw,constmp_obj_t*args) {
51+
STATICmp_obj_tbool_make_new(mp_obj_ttype_in,mp_uint_tn_args,mp_uint_tn_kw,constmp_obj_t*args) {
5252
mp_arg_check_num(n_args,n_kw,0,1, false);
5353

5454
switch (n_args) {
@@ -60,7 +60,7 @@ STATIC mp_obj_t bool_make_new(mp_obj_t type_in, uint n_args, uint n_kw, const mp
6060
}
6161
}
6262

63-
STATICmp_obj_tbool_unary_op(intop,mp_obj_to_in) {
63+
STATICmp_obj_tbool_unary_op(mp_uint_top,mp_obj_to_in) {
6464
mp_int_tvalue= ((mp_obj_bool_t*)o_in)->value;
6565
switch (op) {
6666
caseMP_UNARY_OP_BOOL:returno_in;
@@ -72,7 +72,7 @@ STATIC mp_obj_t bool_unary_op(int op, mp_obj_t o_in) {
7272
}
7373
}
7474

75-
STATICmp_obj_tbool_binary_op(intop,mp_obj_tlhs_in,mp_obj_trhs_in) {
75+
STATICmp_obj_tbool_binary_op(mp_uint_top,mp_obj_tlhs_in,mp_obj_trhs_in) {
7676
if (MP_BINARY_OP_OR <=op&&op <=MP_BINARY_OP_NOT_EQUAL) {
7777
returnmp_binary_op(op,MP_OBJ_NEW_SMALL_INT(mp_obj_is_true(lhs_in)),rhs_in);
7878
}

‎py/objboundmeth.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ STATIC void bound_meth_print(void (*print)(void *env, const char *fmt, ...), voi
5050
}
5151
#endif
5252

53-
mp_obj_tbound_meth_call(mp_obj_tself_in,uintn_args,uintn_kw,constmp_obj_t*args) {
53+
mp_obj_tbound_meth_call(mp_obj_tself_in,mp_uint_tn_args,mp_uint_tn_kw,constmp_obj_t*args) {
5454
mp_obj_bound_meth_t*self=self_in;
5555

5656
// need to insert self->self before all other args and then call self->meth

‎py/objclosure.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ typedef struct _mp_obj_closure_t {
4141
mp_obj_tclosed[];
4242
}mp_obj_closure_t;
4343

44-
mp_obj_tclosure_call(mp_obj_tself_in,uintn_args,uintn_kw,constmp_obj_t*args) {
44+
mp_obj_tclosure_call(mp_obj_tself_in,mp_uint_tn_args,mp_uint_tn_kw,constmp_obj_t*args) {
4545
mp_obj_closure_t*self=self_in;
4646

4747
// need to concatenate closed-over-vars and args

‎py/objcomplex.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ STATIC void complex_print(void (*print)(void *env, const char *fmt, ...), void *
7474
#endif
7575
}
7676

77-
STATICmp_obj_tcomplex_make_new(mp_obj_ttype_in,uintn_args,uintn_kw,constmp_obj_t*args) {
77+
STATICmp_obj_tcomplex_make_new(mp_obj_ttype_in,mp_uint_tn_args,mp_uint_tn_kw,constmp_obj_t*args) {
7878
mp_arg_check_num(n_args,n_kw,0,2, false);
7979

8080
switch (n_args) {
@@ -117,7 +117,7 @@ STATIC mp_obj_t complex_make_new(mp_obj_t type_in, uint n_args, uint n_kw, const
117117
}
118118
}
119119

120-
STATICmp_obj_tcomplex_unary_op(intop,mp_obj_to_in) {
120+
STATICmp_obj_tcomplex_unary_op(mp_uint_top,mp_obj_to_in) {
121121
mp_obj_complex_t*o=o_in;
122122
switch (op) {
123123
caseMP_UNARY_OP_BOOL:returnMP_BOOL(o->real!=0||o->imag!=0);
@@ -127,7 +127,7 @@ STATIC mp_obj_t complex_unary_op(int op, mp_obj_t o_in) {
127127
}
128128
}
129129

130-
STATICmp_obj_tcomplex_binary_op(intop,mp_obj_tlhs_in,mp_obj_trhs_in) {
130+
STATICmp_obj_tcomplex_binary_op(mp_uint_top,mp_obj_tlhs_in,mp_obj_trhs_in) {
131131
mp_obj_complex_t*lhs=lhs_in;
132132
returnmp_obj_complex_binary_op(op,lhs->real,lhs->imag,rhs_in);
133133
}
@@ -166,7 +166,7 @@ void mp_obj_complex_get(mp_obj_t self_in, mp_float_t *real, mp_float_t *imag) {
166166
*imag=self->imag;
167167
}
168168

169-
mp_obj_tmp_obj_complex_binary_op(intop,mp_float_tlhs_real,mp_float_tlhs_imag,mp_obj_trhs_in) {
169+
mp_obj_tmp_obj_complex_binary_op(mp_uint_top,mp_float_tlhs_real,mp_float_tlhs_imag,mp_obj_trhs_in) {
170170
mp_float_trhs_real,rhs_imag;
171171
mp_obj_get_complex(rhs_in,&rhs_real,&rhs_imag);// can be any type, this function will convert to float (if possible)
172172
switch (op) {

‎py/objdict.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ STATIC void dict_print(void (*print)(void *env, const char *fmt, ...), void *env
6060
print(env,"}");
6161
}
6262

63-
STATICmp_obj_tdict_make_new(mp_obj_ttype_in,uintn_args,uintn_kw,constmp_obj_t*args) {
63+
STATICmp_obj_tdict_make_new(mp_obj_ttype_in,mp_uint_tn_args,mp_uint_tn_kw,constmp_obj_t*args) {
6464
mp_obj_tdict=mp_obj_new_dict(0);
6565
if (n_args>0||n_kw>0) {
6666
mp_obj_targs2[2]= {dict,args[0]};// args[0] is always valid, even if it's not a positional arg
@@ -71,7 +71,7 @@ STATIC mp_obj_t dict_make_new(mp_obj_t type_in, uint n_args, uint n_kw, const mp
7171
returndict;
7272
}
7373

74-
STATICmp_obj_tdict_unary_op(intop,mp_obj_tself_in) {
74+
STATICmp_obj_tdict_unary_op(mp_uint_top,mp_obj_tself_in) {
7575
mp_obj_dict_t*self=self_in;
7676
switch (op) {
7777
caseMP_UNARY_OP_BOOL:returnMP_BOOL(self->map.used!=0);
@@ -80,7 +80,7 @@ STATIC mp_obj_t dict_unary_op(int op, mp_obj_t self_in) {
8080
}
8181
}
8282

83-
STATICmp_obj_tdict_binary_op(intop,mp_obj_tlhs_in,mp_obj_trhs_in) {
83+
STATICmp_obj_tdict_binary_op(mp_uint_top,mp_obj_tlhs_in,mp_obj_trhs_in) {
8484
mp_obj_dict_t*o=lhs_in;
8585
switch (op) {
8686
caseMP_BINARY_OP_IN: {
@@ -472,7 +472,7 @@ STATIC void dict_view_print(void (*print)(void *env, const char *fmt, ...), void
472472
print(env,"])");
473473
}
474474

475-
STATICmp_obj_tdict_view_binary_op(intop,mp_obj_tlhs_in,mp_obj_trhs_in) {
475+
STATICmp_obj_tdict_view_binary_op(mp_uint_top,mp_obj_tlhs_in,mp_obj_trhs_in) {
476476
// only supported for the 'keys' kind until sets and dicts are refactored
477477
mp_obj_dict_view_t*o=lhs_in;
478478
if (o->kind!=MP_DICT_VIEW_KEYS) {

‎py/objenumerate.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ STATIC const mp_arg_t enumerate_make_new_args[] = {
4747
};
4848
#defineENUMERATE_MAKE_NEW_NUM_ARGS MP_ARRAY_SIZE(enumerate_make_new_args)
4949

50-
STATICmp_obj_tenumerate_make_new(mp_obj_ttype_in,uintn_args,uintn_kw,constmp_obj_t*args) {
50+
STATICmp_obj_tenumerate_make_new(mp_obj_ttype_in,mp_uint_tn_args,mp_uint_tn_kw,constmp_obj_t*args) {
5151
#ifMICROPY_CPYTHON_COMPAT
5252
// parse args
5353
mp_arg_val_tvals[ENUMERATE_MAKE_NEW_NUM_ARGS];

‎py/objexcept.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ STATIC void mp_obj_exception_print(void (*print)(void *env, const char *fmt, ...
130130
mp_obj_tuple_print(print,env,o->args,kind);
131131
}
132132

133-
mp_obj_tmp_obj_exception_make_new(mp_obj_ttype_in,uintn_args,uintn_kw,constmp_obj_t*args) {
133+
mp_obj_tmp_obj_exception_make_new(mp_obj_ttype_in,mp_uint_tn_args,mp_uint_tn_kw,constmp_obj_t*args) {
134134
mp_obj_type_t*type=type_in;
135135

136136
if (n_kw!=0) {
@@ -171,7 +171,7 @@ STATIC void exception_load_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) {
171171
}
172172
}
173173

174-
STATICmp_obj_texc___init__(uintn_args,constmp_obj_t*args) {
174+
STATICmp_obj_texc___init__(mp_uint_tn_args,constmp_obj_t*args) {
175175
mp_obj_exception_t*self=args[0];
176176
mp_obj_targst=mp_obj_new_tuple(n_args-1,args+1);
177177
self->args=argst;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp