py: Combine native emitters to 1 glue function; distinguish viper.

This patch simplifies the glue between native emitter and runtime,
and handles viper code like inline assember: return values are
converted to Python objects.

Fixes issue #531.
This commit is contained in:
Damien George
2014-05-10 13:40:46 +01:00
parent 04b7cc4df0
commit ccc85ea0da
5 changed files with 26 additions and 53 deletions

View File

@@ -506,12 +506,7 @@ STATIC mp_obj_t convert_val_from_inline_asm(machine_uint_t val) {
STATIC mp_obj_t fun_asm_call(mp_obj_t self_in, uint n_args, uint n_kw, const mp_obj_t *args) {
mp_obj_fun_asm_t *self = self_in;
if (n_args != self->n_args) {
nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_TypeError, "function takes %d positional arguments but %d were given", self->n_args, n_args));
}
if (n_kw != 0) {
nlr_raise(mp_obj_new_exception_msg(&mp_type_TypeError, "function does not take keyword arguments"));
}
mp_arg_check_num(n_args, n_kw, self->n_args, self->n_args, false);
machine_uint_t ret;
if (n_args == 0) {