diff options
author | Damien George <damien.p.george@gmail.com> | 2014-01-04 20:21:15 +0000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2014-01-04 20:21:15 +0000 |
commit | 71c5181a8dfa69ba9f5ca322a3aba0660be2e166 (patch) | |
tree | 77aae5a9008f269276bda9c433235f7e11b57ed4 /py/objdict.c | |
parent | e9906ac3d771a312b05d76e42aee8e806dd0d128 (diff) | |
download | micropython-71c5181a8dfa69ba9f5ca322a3aba0660be2e166.tar.gz micropython-71c5181a8dfa69ba9f5ca322a3aba0660be2e166.zip |
Convert Python types to proper Python type hierarchy.
Now much more inline with how CPython does types.
Diffstat (limited to 'py/objdict.c')
-rw-r--r-- | py/objdict.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/py/objdict.c b/py/objdict.c index acf1a9f801..3737f5eab0 100644 --- a/py/objdict.c +++ b/py/objdict.c @@ -17,7 +17,7 @@ typedef struct _mp_obj_dict_t { mp_map_t map; } mp_obj_dict_t; -void dict_print(void (*print)(void *env, const char *fmt, ...), void *env, mp_obj_t self_in) { +static void dict_print(void (*print)(void *env, const char *fmt, ...), void *env, mp_obj_t self_in) { mp_obj_dict_t *self = self_in; bool first = true; print(env, "{"); @@ -35,7 +35,13 @@ void dict_print(void (*print)(void *env, const char *fmt, ...), void *env, mp_ob print(env, "}"); } -mp_obj_t dict_binary_op(int op, mp_obj_t lhs_in, mp_obj_t rhs_in) { +// args are reverse in the array +static mp_obj_t dict_make_new(mp_obj_t type_in, int n_args, const mp_obj_t *args) { + // TODO create from an iterable! + return rt_build_map(0); +} + +static mp_obj_t dict_binary_op(int op, mp_obj_t lhs_in, mp_obj_t rhs_in) { mp_obj_dict_t *o = lhs_in; switch (op) { case RT_BINARY_OP_SUBSCR: @@ -58,6 +64,7 @@ const mp_obj_type_t dict_type = { { &mp_const_type }, "dict", dict_print, // print + dict_make_new, // make_new NULL, // call_n NULL, // unary_op dict_binary_op, // binary_op |