summaryrefslogtreecommitdiffstatshomepage
path: root/py/objtuple.c
diff options
context:
space:
mode:
authorPaul Sokolovsky <pfalcon@users.sourceforge.net>2014-01-12 23:23:10 +0200
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2014-01-14 23:59:18 +0200
commit8eec8bcad95d5e60485635a2dbfd97886698d954 (patch)
tree08a86efc0e38d1a50d15f2c88c9a6e6b6fb90d93 /py/objtuple.c
parentca318bba0d97c66d8fb14a089d8fa269a0e1b424 (diff)
downloadmicropython-8eec8bcad95d5e60485635a2dbfd97886698d954.tar.gz
micropython-8eec8bcad95d5e60485635a2dbfd97886698d954.zip
Add objtuple.h to allow embedding of tuples inside other objects.
This is useful because tuple is closest analog of C static array.
Diffstat (limited to 'py/objtuple.c')
-rw-r--r--py/objtuple.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/py/objtuple.c b/py/objtuple.c
index 7685cc449f..9821dd2fbb 100644
--- a/py/objtuple.c
+++ b/py/objtuple.c
@@ -9,19 +9,14 @@
#include "obj.h"
#include "runtime0.h"
#include "runtime.h"
-
-typedef struct _mp_obj_tuple_t {
- mp_obj_base_t base;
- machine_uint_t len;
- mp_obj_t items[];
-} mp_obj_tuple_t;
+#include "objtuple.h"
static mp_obj_t mp_obj_new_tuple_iterator(mp_obj_tuple_t *tuple, int cur);
/******************************************************************************/
/* tuple */
-static void tuple_print(void (*print)(void *env, const char *fmt, ...), void *env, mp_obj_t o_in) {
+void tuple_print(void (*print)(void *env, const char *fmt, ...), void *env, mp_obj_t o_in) {
mp_obj_tuple_t *o = o_in;
print(env, "(");
for (int i = 0; i < o->len; i++) {