Add Bocfel interpreter
[projects/chimara/chimara.git] / interpreters / bocfel / stack.h
1 #ifndef ZTERP_STACK_H
2 #define ZTERP_STACK_H
3
4 #include <stdint.h>
5
6 #include "io.h"
7
8 #define DEFAULT_STACK_SIZE      0x4000
9 #define DEFAULT_CALL_DEPTH      0x400
10
11 void init_stack(void);
12
13 uint16_t variable(uint16_t);
14 void store_variable(uint16_t, uint16_t);
15 uint16_t *stack_top_element(void);
16
17 void call(int);
18 #ifdef ZTERP_GLK
19 uint16_t direct_call(uint16_t);
20 #endif
21 void do_return(uint16_t);
22
23 int save_quetzal(zterp_io *, int);
24 int restore_quetzal(zterp_io *, int);
25
26 int do_save(int);
27 int do_restore(int);
28
29 int push_save(void);
30 int pop_save(void);
31
32 void zpush(void);
33 void zpull(void);
34 void zload(void);
35 void zstore(void);
36 void zret_popped(void);
37 void zpop(void);
38 void zcatch(void);
39 void zthrow(void);
40 void zret(void);
41 void zrtrue(void);
42 void zrfalse(void);
43 void zcheck_arg_count(void);
44 void zpop_stack(void);
45 void zpush_stack(void);
46 void zsave_undo(void);
47 void zrestore_undo(void);
48 void zsave(void);
49 void zrestore(void);
50
51 void zcall_store(void);
52 void zcall_nostore(void);
53
54 #define zcall           zcall_store
55 #define zcall_1n        zcall_nostore
56 #define zcall_1s        zcall_store
57 #define zcall_2n        zcall_nostore
58 #define zcall_2s        zcall_store
59 #define zcall_vn        zcall_nostore
60 #define zcall_vn2       zcall_nostore
61 #define zcall_vs2       zcall_store
62
63 #endif