summaryrefslogtreecommitdiff
path: root/py/runtime.h
diff options
context:
space:
mode:
authorPaul Sokolovsky <pfalcon@users.sourceforge.net>2015-03-28 01:14:45 +0200
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2015-04-03 00:03:07 +0300
commite6c6fe3275ba8d405e566548a277fa7eaea416b9 (patch)
tree95244b8337beeda991ce58ab33bf2580eb0af21b /py/runtime.h
parent390e92688c4fc70dea4998f0298a9f1bea90d24f (diff)
runtime: Split mp_call_prepare_args_n_kw_var() from mp_call_method_n_kw_var().
Allow for reuse for stackless design, where preparing args is separate from calling.
Diffstat (limited to 'py/runtime.h')
-rw-r--r--py/runtime.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/py/runtime.h b/py/runtime.h
index bead02831..8666ce107 100644
--- a/py/runtime.h
+++ b/py/runtime.h
@@ -97,6 +97,17 @@ mp_obj_t mp_call_function_n_kw(mp_obj_t fun, mp_uint_t n_args, mp_uint_t n_kw, c
mp_obj_t mp_call_method_n_kw(mp_uint_t n_args, mp_uint_t n_kw, const mp_obj_t *args);
mp_obj_t mp_call_method_n_kw_var(bool have_self, mp_uint_t n_args_n_kw, const mp_obj_t *args);
+typedef struct _call_args_t {
+ mp_obj_t fun;
+ mp_uint_t n_args, n_kw, n_alloc;
+ mp_obj_t *args;
+} call_args_t;
+
+// Takes arguments which are the most general mix of Python arg types, and
+// prepares argument array suitable for passing to ->call() method of a
+// function object (and mp_call_function_n_kw()).
+void mp_call_prepare_args_n_kw_var(bool have_self, mp_uint_t n_args_n_kw, const mp_obj_t *args, call_args_t *out_args);
+
void mp_unpack_sequence(mp_obj_t seq, mp_uint_t num, mp_obj_t *items);
void mp_unpack_ex(mp_obj_t seq, mp_uint_t num, mp_obj_t *items);
mp_obj_t mp_store_map(mp_obj_t map, mp_obj_t key, mp_obj_t value);