diff options
author | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2014-05-03 14:10:34 +0300 |
---|---|---|
committer | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2014-05-03 14:16:11 +0300 |
commit | 418aca976c33db443c2bfed69ff2a38e79320259 (patch) | |
tree | 27b574f105b0e5014b9d5fdf54d15afc7a4cc578 /py/objcell.c | |
parent | 8f472ad5778876d3d8abcfec9459c0a106f629af (diff) | |
download | micropython-418aca976c33db443c2bfed69ff2a38e79320259.tar.gz micropython-418aca976c33db443c2bfed69ff2a38e79320259.zip |
objclosure, objcell: Print detailed representation if was requested.
Well, it is bound to "detailed error reporting", but that's closest what we
have now without creating new entities.
Diffstat (limited to 'py/objcell.c')
-rw-r--r-- | py/objcell.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/py/objcell.c b/py/objcell.c index 488a737971..35b44e996d 100644 --- a/py/objcell.c +++ b/py/objcell.c @@ -20,14 +20,13 @@ void mp_obj_cell_set(mp_obj_t self_in, mp_obj_t obj) { self->obj = obj; } -#if 0 +#if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_DETAILED STATIC void cell_print(void (*print)(void *env, const char *fmt, ...), void *env, mp_obj_t o_in, mp_print_kind_t kind) { mp_obj_cell_t *o = o_in; - print(env, "<cell "); + print(env, "<cell %p ", o->obj); if (o->obj == MP_OBJ_NULL) { print(env, "(nil)"); } else { - //print(env, "%p", o->obj); mp_obj_print_helper(print, env, o->obj, PRINT_REPR); } print(env, ">"); @@ -36,8 +35,10 @@ STATIC void cell_print(void (*print)(void *env, const char *fmt, ...), void *env const mp_obj_type_t cell_type = { { &mp_type_type }, - .name = MP_QSTR_, // should never need to print cell type - //.print = cell_print, + .name = MP_QSTR_, // cell representation is just value in < > +#if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_DETAILED + .print = cell_print, +#endif }; mp_obj_t mp_obj_new_cell(mp_obj_t obj) { |