py: Add native json printing using existing print framework.

Also add start of ujson module with dumps implemented.  Enabled in unix
and stmhal ports.  Test passes on both.
This commit is contained in:
Damien George
2014-09-17 22:56:34 +01:00
parent 8a9b999f1c
commit 612045f53f
18 changed files with 227 additions and 15 deletions

View File

@@ -38,7 +38,11 @@ typedef struct _mp_obj_none_t {
} mp_obj_none_t;
STATIC void none_print(void (*print)(void *env, const char *fmt, ...), void *env, mp_obj_t self_in, mp_print_kind_t kind) {
print(env, "None");
if (MICROPY_PY_UJSON && kind == PRINT_JSON) {
print(env, "null");
} else {
print(env, "None");
}
}
STATIC mp_obj_t none_unary_op(mp_uint_t op, mp_obj_t o_in) {