2 /********************************************
4 copyright 1991, Michael D. Brennan
6 This is a source file for mawk, an implementation of
7 the AWK programming language.
9 Mawk is distributed without warranty under the terms of
10 the GNU General Public License, version 2, 1991.
11 ********************************************/
15 * Revision 1.5 1995/06/18 19:42:15 mike
16 * Remove some redundant declarations and add some prototypes
18 * Revision 1.4 1994/12/13 00:13:01 mike
19 * delete A statement to delete all of A at once
21 * Revision 1.3 1993/12/01 14:25:06 mike
22 * reentrant array loops
24 * Revision 1.2 1993/07/22 00:04:01 mike
25 * new op code _LJZ _LJNZ
27 * Revision 1.1.1.1 1993/07/03 18:58:10 mike
30 * Revision 5.3 1993/01/14 13:11:11 mike
33 * Revision 5.2 1993/01/07 02:50:33 mike
34 * relative vs absolute code
36 * Revision 5.1 1991/12/05 07:59:07 brennan
50 /* number of code instructions allocated at one time */
61 INST *base, *limit, *warn, *ptr ;
64 extern CODEBLOCK active_code ;
65 extern CODEBLOCK *main_code_p, *begin_code_p, *end_code_p ;
67 extern INST *main_start, *begin_start, *end_start ;
68 extern unsigned main_size, begin_size ;
69 extern INST *execution_start ;
70 extern INST *next_label ; /* next statements jump to here */
71 extern int dump_code_flag ;
73 #define code_ptr active_code.ptr
74 #define code_base active_code.base
75 #define code_warn active_code.warn
76 #define code_limit active_code.limit
77 #define code_offset (code_ptr-code_base)
79 #define INST_BYTES(x) (sizeof(INST)*(unsigned)(x))
81 extern CELL eval_stack[] ;
82 extern int exit_code ;
85 #define code1(x) code_ptr++ -> op = (x)
86 /* shutup picky compilers */
87 #define code2(x,p) xcode2(x,(PTR)(p))
89 void PROTO(xcode2, (int, PTR)) ;
90 void PROTO(code2op, (int, int)) ;
91 INST *PROTO(code_shrink, (CODEBLOCK*, unsigned*)) ;
92 void PROTO(code_grow, (void)) ;
93 void PROTO(set_code, (void)) ;
94 void PROTO(be_setup, (int)) ;
95 void PROTO(dump_code, (void)) ;
98 /* the machine opcodes */
99 /* to avoid confusion with a ptr FE_PUSHA must have op code 0 */
100 /* unfortunately enums are less portable than defines */
159 #define F_POST_INC 57
160 #define F_POST_DEC 58