py: Downcase all MP_OBJ_IS_xxx macros to make a more consistent C API.

These macros could in principle be (inline) functions so it makes sense to
have them lower case, to match the other C API functions.

The remaining macros that are upper case are:
- MP_OBJ_TO_PTR, MP_OBJ_FROM_PTR
- MP_OBJ_NEW_SMALL_INT, MP_OBJ_SMALL_INT_VALUE
- MP_OBJ_NEW_QSTR, MP_OBJ_QSTR_VALUE
- MP_OBJ_FUN_MAKE_SIG
- MP_DECLARE_CONST_xxx
- MP_DEFINE_CONST_xxx

These must remain macros because they are used when defining const data (at
least, MP_OBJ_NEW_SMALL_INT is so it makes sense to have
MP_OBJ_SMALL_INT_VALUE also a macro).

For those macros that have been made lower case, compatibility macros are
provided for the old names so that users do not need to change their code
immediately.
This commit is contained in:
Damien George
2019-01-30 18:49:52 +11:00
parent 019433a17e
commit eee1e8841a
41 changed files with 277 additions and 268 deletions

View File

@@ -357,7 +357,7 @@ STATIC mp_obj_t mp_builtin_ord(mp_obj_t o_in) {
size_t len;
const byte *str = (const byte*)mp_obj_str_get_data(o_in, &len);
#if MICROPY_PY_BUILTINS_STR_UNICODE
if (MP_OBJ_IS_STR(o_in)) {
if (mp_obj_is_str(o_in)) {
len = utf8_charlen(str, len);
if (len == 1) {
return mp_obj_new_int(utf8_get_char(str));
@@ -471,7 +471,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(mp_builtin_repr_obj, mp_builtin_repr);
STATIC mp_obj_t mp_builtin_round(size_t n_args, const mp_obj_t *args) {
mp_obj_t o_in = args[0];
if (MP_OBJ_IS_INT(o_in)) {
if (mp_obj_is_int(o_in)) {
if (n_args <= 1) {
return o_in;
}