summaryrefslogtreecommitdiff
path: root/py/bc.h
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2014-02-15 22:55:00 +0000
committerDamien George <damien.p.george@gmail.com>2014-02-15 22:55:00 +0000
commitc8f78bc280447a06802d6456e8e759872e82246d (patch)
tree2faf58e60132f9f936e0274226987bda33ee5c91 /py/bc.h
parent36109d246fc5396c38bedfc240ddbe60a3c718fc (diff)
py: VM never throws an exception, instead returns a status and value.
Addresses issue #290, and hopefully sets up things to allow generators throwing exceptions, etc.
Diffstat (limited to 'py/bc.h')
-rw-r--r--py/bc.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/py/bc.h b/py/bc.h
index 814201160..aac35954d 100644
--- a/py/bc.h
+++ b/py/bc.h
@@ -1,3 +1,9 @@
-mp_obj_t mp_execute_byte_code(const byte *code, const mp_obj_t *args, uint n_args, const mp_obj_t *args2, uint n_args2, uint n_state);
-bool mp_execute_byte_code_2(const byte *code_info, const byte **ip_in_out, mp_obj_t *fastn, mp_obj_t **sp_in_out);
+typedef enum {
+ MP_VM_RETURN_NORMAL,
+ MP_VM_RETURN_YIELD,
+ MP_VM_RETURN_EXCEPTION,
+} mp_vm_return_kind_t;
+
+mp_vm_return_kind_t mp_execute_byte_code(const byte *code, const mp_obj_t *args, uint n_args, const mp_obj_t *args2, uint n_args2, uint n_state, mp_obj_t *ret);
+mp_vm_return_kind_t mp_execute_byte_code_2(const byte *code_info, const byte **ip_in_out, mp_obj_t *fastn, mp_obj_t **sp_in_out);
void mp_byte_code_print(const byte *code, int len);