diff options
author | John R. Lenton <jlenton@gmail.com> | 2014-01-05 22:27:11 +0000 |
---|---|---|
committer | John R. Lenton <jlenton@gmail.com> | 2014-01-05 22:27:11 +0000 |
commit | d52a0318ce266e1d9ce0d877f64a8fe097cef080 (patch) | |
tree | 9c57f2bd169754c56679b25dd41c003a046c1137 /py/objslice.c | |
parent | 49fb6e53b35f991d79caadbb6320a39452944b4d (diff) | |
parent | 12e2656472bf53e467c066eda6f3e177a97210ca (diff) | |
download | micropython-d52a0318ce266e1d9ce0d877f64a8fe097cef080.tar.gz micropython-d52a0318ce266e1d9ce0d877f64a8fe097cef080.zip |
Merge remote-tracking branch 'upstream/master' into list_remove
Diffstat (limited to 'py/objslice.c')
-rw-r--r-- | py/objslice.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/py/objslice.c b/py/objslice.c index 03607e4c3e..a624be9631 100644 --- a/py/objslice.c +++ b/py/objslice.c @@ -9,6 +9,36 @@ #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, // make_new + 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. @@ -29,6 +59,7 @@ const mp_obj_type_t slice_type = { "slice", slice_print, NULL, // call_n + NULL, // make_new NULL, // unary_op NULL, // binary_op NULL, // getiter |