summaryrefslogtreecommitdiffstatshomepage
path: root/py/obj.h
diff options
context:
space:
mode:
authorPaul Sokolovsky <pfalcon@users.sourceforge.net>2014-01-03 02:41:17 +0200
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2014-01-04 02:35:48 +0200
commit1c6de11f772afae9b4155f8a654cadd05125a2de (patch)
tree91773ad883e3ab1ccf513a5f9b2233461f295572 /py/obj.h
parent98adccf7acb52a0cf9169a78e3af1a8958f7ab36 (diff)
downloadmicropython-1c6de11f772afae9b4155f8a654cadd05125a2de.tar.gz
micropython-1c6de11f772afae9b4155f8a654cadd05125a2de.zip
Add basic implementation of slice object.
So far, only start and stop integer indexes are supported. Step is not supported, as well as objects of arbitrary types.
Diffstat (limited to 'py/obj.h')
-rw-r--r--py/obj.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/py/obj.h b/py/obj.h
index 7b4b0656f2..16c7c36dd1 100644
--- a/py/obj.h
+++ b/py/obj.h
@@ -144,6 +144,7 @@ mp_obj_t mp_obj_new_list(uint n, mp_obj_t *items);
mp_obj_t mp_obj_new_list_reverse(uint n, mp_obj_t *items);
mp_obj_t mp_obj_new_dict(int n_args);
mp_obj_t mp_obj_new_set(int n_args, mp_obj_t *items);
+mp_obj_t mp_obj_new_slice(mp_obj_t start, mp_obj_t stop, mp_obj_t step);
mp_obj_t mp_obj_new_bound_meth(mp_obj_t self, mp_obj_t meth);
mp_obj_t mp_obj_new_class(struct _mp_map_t *class_locals);
mp_obj_t mp_obj_new_instance(mp_obj_t clas);
@@ -214,6 +215,10 @@ mp_obj_t mp_obj_dict_store(mp_obj_t self_in, mp_obj_t key, mp_obj_t value);
// set
void mp_obj_set_store(mp_obj_t self_in, mp_obj_t item);
+// slice
+extern const mp_obj_type_t slice_type;
+void mp_obj_slice_get(mp_obj_t self_in, machine_int_t *start, machine_int_t *stop, machine_int_t *step);
+
// functions
typedef struct _mp_obj_fun_native_t { // need this so we can define const objects (to go in ROM)
mp_obj_base_t base;