Lines Matching refs:arg

151 bool mp_obj_is_true(mp_obj_t arg) {  in mp_obj_is_true()  argument
152 if (arg == mp_const_false) { in mp_obj_is_true()
154 } else if (arg == mp_const_true) { in mp_obj_is_true()
156 } else if (arg == mp_const_none) { in mp_obj_is_true()
158 } else if (mp_obj_is_small_int(arg)) { in mp_obj_is_true()
159 if (arg == MP_OBJ_NEW_SMALL_INT(0)) { in mp_obj_is_true()
165 const mp_obj_type_t *type = mp_obj_get_type(arg); in mp_obj_is_true()
167 mp_obj_t result = type->unary_op(MP_UNARY_OP_BOOL, arg); in mp_obj_is_true()
173 mp_obj_t len = mp_obj_len_maybe(arg); in mp_obj_is_true()
290 mp_int_t mp_obj_get_int(mp_const_obj_t arg) { in mp_obj_get_int() argument
294 if (arg == mp_const_false) { in mp_obj_get_int()
296 } else if (arg == mp_const_true) { in mp_obj_get_int()
298 } else if (mp_obj_is_small_int(arg)) { in mp_obj_get_int()
299 return MP_OBJ_SMALL_INT_VALUE(arg); in mp_obj_get_int()
300 } else if (mp_obj_is_type(arg, &mp_type_int)) { in mp_obj_get_int()
301 return mp_obj_int_get_checked(arg); in mp_obj_get_int()
303 mp_obj_t res = mp_unary_op(MP_UNARY_OP_INT, (mp_obj_t)arg); in mp_obj_get_int()
308 mp_int_t mp_obj_get_int_truncated(mp_const_obj_t arg) { in mp_obj_get_int_truncated() argument
309 if (mp_obj_is_int(arg)) { in mp_obj_get_int_truncated()
310 return mp_obj_int_get_truncated(arg); in mp_obj_get_int_truncated()
312 return mp_obj_get_int(arg); in mp_obj_get_int_truncated()
319 bool mp_obj_get_int_maybe(mp_const_obj_t arg, mp_int_t *value) { in mp_obj_get_int_maybe() argument
320 if (arg == mp_const_false) { in mp_obj_get_int_maybe()
322 } else if (arg == mp_const_true) { in mp_obj_get_int_maybe()
324 } else if (mp_obj_is_small_int(arg)) { in mp_obj_get_int_maybe()
325 *value = MP_OBJ_SMALL_INT_VALUE(arg); in mp_obj_get_int_maybe()
326 } else if (mp_obj_is_type(arg, &mp_type_int)) { in mp_obj_get_int_maybe()
327 *value = mp_obj_int_get_checked(arg); in mp_obj_get_int_maybe()
335 bool mp_obj_get_float_maybe(mp_obj_t arg, mp_float_t *value) { in mp_obj_get_float_maybe() argument
338 if (arg == mp_const_false) { in mp_obj_get_float_maybe()
340 } else if (arg == mp_const_true) { in mp_obj_get_float_maybe()
342 } else if (mp_obj_is_small_int(arg)) { in mp_obj_get_float_maybe()
343 val = (mp_float_t)MP_OBJ_SMALL_INT_VALUE(arg); in mp_obj_get_float_maybe()
345 } else if (mp_obj_is_type(arg, &mp_type_int)) { in mp_obj_get_float_maybe()
346 val = mp_obj_int_as_float_impl(arg); in mp_obj_get_float_maybe()
348 } else if (mp_obj_is_float(arg)) { in mp_obj_get_float_maybe()
349 val = mp_obj_float_get(arg); in mp_obj_get_float_maybe()
358 mp_float_t mp_obj_get_float(mp_obj_t arg) { in mp_obj_get_float() argument
361 if (!mp_obj_get_float_maybe(arg, &val)) { in mp_obj_get_float()
366 MP_ERROR_TEXT("can't convert %s to float"), mp_obj_get_type_str(arg)); in mp_obj_get_float()
374 bool mp_obj_get_complex_maybe(mp_obj_t arg, mp_float_t *real, mp_float_t *imag) { in mp_obj_get_complex_maybe() argument
375 if (arg == mp_const_false) { in mp_obj_get_complex_maybe()
378 } else if (arg == mp_const_true) { in mp_obj_get_complex_maybe()
381 } else if (mp_obj_is_small_int(arg)) { in mp_obj_get_complex_maybe()
382 *real = (mp_float_t)MP_OBJ_SMALL_INT_VALUE(arg); in mp_obj_get_complex_maybe()
385 } else if (mp_obj_is_type(arg, &mp_type_int)) { in mp_obj_get_complex_maybe()
386 *real = mp_obj_int_as_float_impl(arg); in mp_obj_get_complex_maybe()
389 } else if (mp_obj_is_float(arg)) { in mp_obj_get_complex_maybe()
390 *real = mp_obj_float_get(arg); in mp_obj_get_complex_maybe()
392 } else if (mp_obj_is_type(arg, &mp_type_complex)) { in mp_obj_get_complex_maybe()
393 mp_obj_complex_get(arg, real, imag); in mp_obj_get_complex_maybe()
400 void mp_obj_get_complex(mp_obj_t arg, mp_float_t *real, mp_float_t *imag) { in mp_obj_get_complex() argument
401 if (!mp_obj_get_complex_maybe(arg, real, imag)) { in mp_obj_get_complex()
406 MP_ERROR_TEXT("can't convert %s to complex"), mp_obj_get_type_str(arg)); in mp_obj_get_complex()