diff options
author | Damien <damien.p.george@gmail.com> | 2013-11-02 23:58:14 +0000 |
---|---|---|
committer | Damien <damien.p.george@gmail.com> | 2013-11-02 23:58:14 +0000 |
commit | d57eba51e520ddc7d57ffa3c67a10e5d0d73d4ce (patch) | |
tree | 1b4766d34eaec2eb6a089d5cd89f802c7c635523 /py/runtime.h | |
parent | 6ba1314265e07f79e18d52f04435c5c846cb9405 (diff) | |
download | micropython-d57eba51e520ddc7d57ffa3c67a10e5d0d73d4ce.tar.gz micropython-d57eba51e520ddc7d57ffa3c67a10e5d0d73d4ce.zip |
Add user object to runtime.
Diffstat (limited to 'py/runtime.h')
-rw-r--r-- | py/runtime.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/py/runtime.h b/py/runtime.h index a867378838..24df44abf5 100644 --- a/py/runtime.h +++ b/py/runtime.h @@ -139,3 +139,21 @@ py_obj_t rt_iternext(py_obj_t o); // temporary way of making C modules py_obj_t py_module_new(void); + +// user defined objects + +typedef struct _py_user_method_t { + const char *name; + machine_uint_t kind; + void *fun; +} py_user_method_t; + +typedef struct _py_user_info_t { + const char *type_name; + void (*print)(py_obj_t); + const py_user_method_t methods[]; +} py_user_info_t; + +py_obj_t py_obj_new_user(const py_user_info_t *info, machine_uint_t data1, machine_uint_t data2); +void py_user_get_data(py_obj_t o, machine_uint_t *data1, machine_uint_t *data2); +void py_user_set_data(py_obj_t o, machine_uint_t data1, machine_uint_t data2); |