diff options
author | Damien George <damien.p.george@gmail.com> | 2014-01-04 18:44:46 +0000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2014-01-04 18:44:46 +0000 |
commit | e9906ac3d771a312b05d76e42aee8e806dd0d128 (patch) | |
tree | 95cd30d3a32e715fc2c9553ba1ccb1a72bf86dd8 /py/objslice.c | |
parent | 4d4bc9533edf3f82c5d19b79be9891521b267837 (diff) |
Add ellipsis object.
Diffstat (limited to 'py/objslice.c')
-rw-r--r-- | py/objslice.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/py/objslice.c b/py/objslice.c index 03607e4c3..d99325fd7 100644 --- a/py/objslice.c +++ b/py/objslice.c @@ -9,6 +9,35 @@ #include "obj.h" #include "runtime0.h" +/******************************************************************************/ +/* ellipsis object, a singleton */ + +typedef struct _mp_obj_ellipsis_t { + mp_obj_base_t base; +} mp_obj_ellipsis_t; + +void ellipsis_print(void (*print)(void *env, const char *fmt, ...), void *env, mp_obj_t self_in) { + print(env, "Ellipsis"); +} + +const mp_obj_type_t ellipsis_type = { + { &mp_const_type }, + "ellipsis", + ellipsis_print, // print + NULL, // call_n + NULL, // unary_op + NULL, // binary_op + NULL, // getiter + NULL, // iternext + {{NULL, NULL},}, // method list +}; + +static const mp_obj_ellipsis_t ellipsis_obj = {{&ellipsis_type}}; +const mp_obj_t mp_const_ellipsis = (mp_obj_t)&ellipsis_obj; + +/******************************************************************************/ +/* slice object */ + #if MICROPY_ENABLE_SLICE // TODO: This implements only variant of slice with 2 integer args only. |