@@ -571,7 +571,7 @@ STATIC void emit_native_set_native_type(emit_t *emit, mp_uint_t op, mp_uint_t ar
571571 case MP_QSTR_ptr : type = VTYPE_PTR ; break ;
572572 case MP_QSTR_ptr8 : type = VTYPE_PTR8 ; break ;
573573 case MP_QSTR_ptr16 : type = VTYPE_PTR16 ; break ;
574- default : printf ( "ViperTypeError: unknown type %s\n" , qstr_str (arg2 )); return ;
574+ default : mp_printf ( & mp_plat_print , "ViperTypeError: unknown type %s\n" , qstr_str (arg2 )); return ;
575575 }
576576 if (op == MP_EMIT_NATIVE_TYPE_RETURN ) {
577577 emit -> return_vtype = type ;
@@ -797,7 +797,7 @@ STATIC void emit_native_end_pass(emit_t *emit) {
797797
798798 // check stack is back to zero size
799799 if (emit -> stack_size != 0 ) {
800- printf ( "ERROR: stack size not back to zero; got %d\n" , emit -> stack_size );
800+ mp_printf ( & mp_plat_print , "ERROR: stack size not back to zero; got %d\n" , emit -> stack_size );
801801 }
802802
803803 if (emit -> pass == MP_PASS_EMIT ) {
@@ -1288,7 +1288,7 @@ STATIC void emit_native_load_fast(emit_t *emit, qstr qst, mp_uint_t local_num) {
12881288 DEBUG_printf ("load_fast(%s, " UINT_FMT ")\n" , qstr_str (qst ), local_num );
12891289 vtype_kind_t vtype = emit -> local_vtype [local_num ];
12901290 if (vtype == VTYPE_UNBOUND ) {
1291- printf ( "ViperTypeError: local %s used before type known\n" , qstr_str (qst ));
1291+ mp_printf ( & mp_plat_print , "ViperTypeError: local %s used before type known\n" , qstr_str (qst ));
12921292 }
12931293 emit_native_pre (emit );
12941294 if (local_num == 0 ) {
@@ -1438,7 +1438,7 @@ STATIC void emit_native_load_subscr(emit_t *emit) {
14381438 break ;
14391439 }
14401440 default :
1441- printf ( "ViperTypeError: can't load from type %d\n" , vtype_base );
1441+ mp_printf ( & mp_plat_print , "ViperTypeError: can't load from type %d\n" , vtype_base );
14421442 }
14431443 } else {
14441444 // index is not an immediate
@@ -1464,7 +1464,7 @@ STATIC void emit_native_load_subscr(emit_t *emit) {
14641464 break ;
14651465 }
14661466 default :
1467- printf ( "ViperTypeError: can't load from type %d\n" , vtype_base );
1467+ mp_printf ( & mp_plat_print , "ViperTypeError: can't load from type %d\n" , vtype_base );
14681468 }
14691469 }
14701470 emit_post_push_reg (emit , VTYPE_INT , REG_RET );
@@ -1495,7 +1495,7 @@ STATIC void emit_native_store_fast(emit_t *emit, qstr qst, mp_uint_t local_num)
14951495 emit -> local_vtype [local_num ] = vtype ;
14961496 } else if (emit -> local_vtype [local_num ] != vtype ) {
14971497 // type of local is not the same as object stored in it
1498- printf ( "ViperTypeError: type mismatch, local %s has type %d but source object has type %d\n" , qstr_str (qst ), emit -> local_vtype [local_num ], vtype );
1498+ mp_printf ( & mp_plat_print , "ViperTypeError: type mismatch, local %s has type %d but source object has type %d\n" , qstr_str (qst ), emit -> local_vtype [local_num ], vtype );
14991499 }
15001500}
15011501
@@ -1625,7 +1625,7 @@ STATIC void emit_native_store_subscr(emit_t *emit) {
16251625 break ;
16261626 }
16271627 default :
1628- printf ( "ViperTypeError: can't store to type %d\n" , vtype_base );
1628+ mp_printf ( & mp_plat_print , "ViperTypeError: can't store to type %d\n" , vtype_base );
16291629 }
16301630 } else {
16311631 // index is not an immediate
@@ -1666,7 +1666,7 @@ STATIC void emit_native_store_subscr(emit_t *emit) {
16661666 break ;
16671667 }
16681668 default :
1669- printf ( "ViperTypeError: can't store to type %d\n" , vtype_base );
1669+ mp_printf ( & mp_plat_print , "ViperTypeError: can't store to type %d\n" , vtype_base );
16701670 }
16711671 }
16721672
@@ -1778,7 +1778,7 @@ STATIC void emit_native_jump_helper(emit_t *emit, bool pop) {
17781778 }
17791779 break ;
17801780 default :
1781- printf ( "ViperTypeError: expecting a bool or pyobj, got %d\n" , vtype );
1781+ mp_printf ( & mp_plat_print , "ViperTypeError: expecting a bool or pyobj, got %d\n" , vtype );
17821782 assert (0 );
17831783 }
17841784 // For non-pop need to save the vtype so that emit_native_adjust_stack_size
@@ -2056,7 +2056,7 @@ STATIC void emit_native_binary_op(emit_t *emit, mp_binary_op_t op) {
20562056 }
20572057 emit_post_push_reg (emit , VTYPE_PYOBJ , REG_RET );
20582058 } else {
2059- printf ( "ViperTypeError: can't do binary op between types %d and %d\n" , vtype_lhs , vtype_rhs );
2059+ mp_printf ( & mp_plat_print , "ViperTypeError: can't do binary op between types %d and %d\n" , vtype_lhs , vtype_rhs );
20602060 emit_post_push_reg (emit , VTYPE_PYOBJ , REG_RET );
20612061 }
20622062}
@@ -2302,7 +2302,7 @@ STATIC void emit_native_return_value(emit_t *emit) {
23022302 vtype_kind_t vtype ;
23032303 emit_pre_pop_reg (emit , & vtype , REG_RET );
23042304 if (vtype != emit -> return_vtype ) {
2305- printf ( "ViperTypeError: incompatible return type\n" );
2305+ mp_printf ( & mp_plat_print , "ViperTypeError: incompatible return type\n" );
23062306 }
23072307 }
23082308 } else {
@@ -2320,7 +2320,7 @@ STATIC void emit_native_raise_varargs(emit_t *emit, mp_uint_t n_args) {
23202320 vtype_kind_t vtype_exc ;
23212321 emit_pre_pop_reg (emit , & vtype_exc , REG_ARG_1 ); // arg1 = object to raise
23222322 if (vtype_exc != VTYPE_PYOBJ ) {
2323- printf ( "ViperTypeError: must raise an object\n" );
2323+ mp_printf ( & mp_plat_print , "ViperTypeError: must raise an object\n" );
23242324 }
23252325 // TODO probably make this 1 call to the runtime (which could even call convert, native_raise(obj, type))
23262326 emit_call (emit , MP_F_NATIVE_RAISE );
0 commit comments