1 /*
2  *  Eukleides version 1.5.4
3  *  Copyright (c) Christian Obrecht 2004-2010
4  *
5  *  This program is free software; you can redistribute it and/or modify
6  *  it under the terms of the GNU General Public License as published by
7  *  the Free Software Foundation; either version 3 of the License, or
8  *  (at your option) any later version.
9  *
10  *  This program is distributed in the hope that it will be useful,
11  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  *  GNU General Public License for more details.
14  *
15  *  You should have received a copy of the GNU General Public License
16  *  along with this program; if not, write to the Free Software
17  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18  */
19 
20 #ifdef __debug__
21 
22 void add_instr(const char* inst, int arg, void (*f)(), _param p);
23 
24 #define instruction(arg, fct, param) add_instr(#fct, arg, fct, param)
25 
26 #else
27 
28 void add_instr(void (*f)(), _param p);
29 
30 #define instruction(arg, fct, param) add_instr(fct, param)
31 
32 #endif
33 
34 int get_addr(void);
35 
36 void store_mark(void);
37 
38 int pop_mark(void);
39 
40 void back_patch(void);
41 
42 void set_type(_symbol *symbol, int type);
43 
44 void lift_type(_symbol *symbol, int type);
45 
46 #define PSH_(arg)	instruction(2, push_param, (_param)(arg))
47 #define INC(ptr)	instruction(1, increment, (_param)(void *)ptr)
48 #define GTO(addr)	instruction(3, goto_addr, (_param)(addr))
49 #define GSB(addr)	instruction(3, gosub_addr, (_param)(addr))
50 #define JPZ(addr)	instruction(3, jump_if_zero, (_param)(addr))
51 #define RTN		instruction(0, go_back, (_param)NULL)
52 #define STP		instruction(0, stop, (_param)NULL)
53 #define XEQ_(fct)	instruction(0, fct, (_param)NULL)
54 #define XEQ(fct,ptr)    instruction(1, fct, (_param)(void *)ptr)
55 #define SET_(fct,lbl)   instruction(3, fct, (_param)(lbl))
56