diff options
author | Damien George <damien.p.george@gmail.com> | 2014-01-05 15:59:00 -0800 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2014-01-05 15:59:00 -0800 |
commit | aa35fc60d77085781ab862fa9a048d3c35823d83 (patch) | |
tree | a3553cff33606547e5f2492cb51a36b2806f3ee8 /py/objfun.c | |
parent | 17f4497d6d16eafb00aa4ca62e9ab24ec6cf6775 (diff) | |
parent | 8428b8f3c94fb4adab6b094c1e0718168ebd8cbd (diff) | |
download | micropython-aa35fc60d77085781ab862fa9a048d3c35823d83.tar.gz micropython-aa35fc60d77085781ab862fa9a048d3c35823d83.zip |
Merge pull request #92 from chipaca/list_insert
List insert. Fixes issue #61.
Diffstat (limited to 'py/objfun.c')
-rw-r--r-- | py/objfun.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/py/objfun.c b/py/objfun.c index 2d81f8f5c1..0db6459a39 100644 --- a/py/objfun.c +++ b/py/objfun.c @@ -39,6 +39,9 @@ mp_obj_t fun_native_call_n(mp_obj_t self_in, int n_args, const mp_obj_t *args) { case 2: return ((mp_fun_2_t)self->fun)(args[1], args[0]); + case 3: + return ((mp_fun_3_t)self->fun)(args[2], args[1], args[0]); + default: assert(0); return mp_const_none; @@ -108,6 +111,15 @@ mp_obj_t rt_make_function_2(mp_fun_2_t fun) { return o; } +mp_obj_t rt_make_function_3(mp_fun_3_t fun) { + mp_obj_fun_native_t *o = m_new_obj(mp_obj_fun_native_t); + o->base.type = &fun_native_type; + o->n_args_min = 3; + o->n_args_max = 3; + o->fun = fun; + return o; +} + mp_obj_t rt_make_function_var(int n_args_min, mp_fun_var_t fun) { mp_obj_fun_native_t *o = m_new_obj(mp_obj_fun_native_t); o->base.type = &fun_native_type; |