Pristine Ack-5.5
[Ack-5.5.git] / mach / proto / top / top.h
1 /* $Id: top.h,v 1.5 1994/06/24 13:29:13 ceriel Exp $ */
2 /*
3  * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
4  * See the copyright notice in the ACK home directory, in the file "Copyright".
5  */
6 /* Tunable constants; may be overruled by machine descriptor table */
7
8 #ifndef OP_SEPARATOR
9 #define OP_SEPARATOR ','
10 #endif
11 #ifndef LABEL_TERMINATOR
12 #define LABEL_TERMINATOR        ':'
13 #endif
14 #ifndef LABEL_STARTER
15 #define LABEL_STARTER   'I'
16 #endif
17 #ifndef OPC_TERMINATOR
18 #define OPC_TERMINATOR  ' '
19 #endif
20
21 #ifndef MAX_OPC_LEN
22 #define MAX_OPC_LEN     10
23 #endif
24 #ifndef MAXOPLEN
25 #define MAXOPLEN        25
26 #endif
27 #ifndef MAXOP
28 #define MAXOP           2
29 #endif
30 #ifndef MAXLINELEN
31 #define MAXLINELEN      100
32 #endif
33 #ifndef MAXVARLEN
34 #define MAXVARLEN       25
35 #endif
36
37
38 typedef struct instruction *instr_p;
39 typedef struct pattern_descr *patdescr_p;
40 typedef struct instr_descr *idescr_p;
41 typedef struct templat *templ_p;
42
43 struct instruction {
44         instr_p fw;
45         instr_p bw;
46         char    line[MAXLINELEN+1];
47         char    *rest_line;
48         char    opc[MAX_OPC_LEN+1];
49         char    op[MAXOP][MAXOPLEN+1];
50         short   state;
51 };
52
53 /* state: */
54 #define ONLY_OPC        0
55 #define JUNK            1
56 #define DONE            2
57
58 struct variable {
59         int     vstate;
60         char    value[MAXVARLEN];
61 };
62
63 /* vstate: */
64 #define UNINSTANTIATED  0
65 #define INSTANTIATED    1
66
67 struct pattern_descr {
68         int     patlen;
69         idescr_p pat;
70         int     replen;
71         idescr_p repl;
72 };
73
74 struct templat {
75         char    *lctxt;
76         int     varno;
77         char    *rctxt;
78 };
79
80 struct instr_descr {
81         char            *opcode;
82         struct templat templates[MAXOP];
83 };
84
85 typedef int bool;
86
87 #define TRUE    1
88 #define FALSE   0
89
90 #define NIL (instr_p) 0
91 #define NULLSTRING (char *) 0
92
93 #define assert(x) if(!(x)) badassertion(__FILE__,__LINE__)