Subversion Repositories tendra.SVN

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 7u83 1
/*
2
    		 Crown Copyright (c) 1997
3
 
4
    This TenDRA(r) Computer Program is subject to Copyright
5
    owned by the United Kingdom Secretary of State for Defence
6
    acting through the Defence Evaluation and Research Agency
7
    (DERA).  It is made available to Recipients with a
8
    royalty-free licence for its use, reproduction, transfer
9
    to other parties and amendment for any purpose not excluding
10
    product development provided that any such use et cetera
11
    shall be deemed to be acceptance of the following conditions:-
12
 
13
        (1) Its Recipients shall ensure that this Notice is
14
        reproduced upon any copies or amended versions of it;
15
 
16
        (2) Any amended version of it shall be clearly marked to
17
        show both the nature of and the organisation responsible
18
        for the relevant amendment or amendments;
19
 
20
        (3) Its onward transfer from a recipient to another
21
        party shall be deemed to be that party's acceptance of
22
        these conditions;
23
 
24
        (4) DERA gives no warranty or assurance as to its
25
        quality or suitability for any purpose and DERA accepts
26
        no liability whatsoever in relation to any use to which
27
        it may be put.
28
*/
29
 
30
 
31
#ifndef TYPES_INCLUDED
32
#define TYPES_INCLUDED
33
 
34
 
35
/*
36
    ELEMENTARY TYPES
37
 
38
    The types boolean, byte and pointer are defined.
39
*/
40
 
41
typedef char boolean ;
42
typedef unsigned char byte ;
43
#if FS_PTR_VOID
44
typedef void *pointer ;
45
#else
46
typedef char *pointer ;
47
#endif
48
 
49
 
50
/*
51
    FORWARD STRUCTURE DECLARATION
52
 
53
    The structure representing a TDF construct is defined recursively.
54
*/
55
 
56
struct x_construct ;
57
 
58
 
59
/*
60
    TYPE REPRESENTING A SORT NAME
61
 
62
    Each TDF construct has an associated sort.  This is represented
63
    by a value of type sortname.  It can take any of the values of
64
    the form sort_* in tags.h.
65
*/
66
 
67
typedef int sortname ;
68
 
69
 
70
/*
71
    TYPE REPRESENTING A TREE NODE
72
 
73
    TDF is represented as a tree structure.  Each node has a corresponding
74
    construct given by the cons field.  The son and bro fields give the
75
    tree its structure.  For shape checking there is also a shape field
76
    which is itself a node.
77
*/
78
 
79
typedef struct x_node {
80
    struct x_construct *cons ;
81
    struct x_node *son ;
82
    struct x_node *bro ;
83
    struct x_node *shape ;
84
} node ;
85
 
86
 
87
/*
88
    TYPE REPRESENTING AN ALIGNMENT TAG
89
 
90
    The only information required about an alignment tag is its
91
    definition (if any).
92
*/
93
 
94
typedef struct x_al_tag_info {
95
    node *def ;
96
} al_tag_info ;
97
 
98
 
99
/*
100
    TYPE REPRESENTING A TAG
101
 
102
    A tag may be a variable or identity (indicated by the var field).
103
    It may also be declared and defined.  The vis field is used to
104
    try to catch variables declared with visible access.
105
*/
106
 
107
typedef struct x_tag_info {
108
    boolean var ;
109
    boolean vis ;
110
    node *dec ;
111
    node *def ;
112
} tag_info ;
113
 
114
 
115
/*
116
    TYPE REPRESENTING A TOKEN
117
 
118
    A token may be declared or defined.  Its result sort is represented
119
    by the res field, and its argument sorts by the args field.  The
120
    formal parameters for a defined token are given as an array of
121
    constructs by the pars field.
122
*/
123
 
124
typedef struct x_tok_info {
125
    boolean dec ;
126
    sortname res ;
127
    char *args ;
128
    node *sig ;
129
    node *def ;
130
    int depth ;
131
    struct x_construct **pars ;
132
} tok_info ;
133
 
134
 
135
/*
136
    TYPE REPRESENTING A TDF CONSTRUCT
137
 
138
    A TDF construct (including user defined tokens and tags as well
139
    as the base constructs) is represented by the type construct.
140
    This consists of its sort, sortnum, its encoding, its internal
141
    and external names, plus space for extra information depending
142
    on its sort.  The next field enables us to form constructs into
143
    lists.
144
*/
145
 
146
typedef struct x_construct {
147
    sortname sortnum ;
148
    long encoding ;
149
    char *name ;
150
    node *ename ;
151
    struct x_construct *alias ;
152
    struct x_construct *next ;
153
    union {
154
	char *char_u ;
155
	al_tag_info al_tag_u ;
156
	tag_info tag_u ;
157
	tok_info tok_u ;
158
    } u ;
159
} construct ;
160
 
161
 
162
/*
163
    MACROS FOR ACCESSING INFO FIELDS OF A CONSTRUCT
164
 
165
    The following macros access the various field of the extra
166
    information union of a construct.  These macros should always
167
    be used - the fields should not be addressed directly.
168
*/
169
 
170
#define get_char_info( X )	( ( X )->u.char_u )
171
#define get_al_tag_info( X )	( &( ( X )->u.al_tag_u ) )
172
#define get_tag_info( X )	( &( ( X )->u.tag_u ) )
173
#define get_tok_info( X )	( &( ( X )->u.tok_u ) )
174
 
175
 
176
/*
177
    TYPE REPRESENTING A DIRECTORY
178
 
179
    In order to search for included files, the directory structure
180
    enables us to form lists of directory names.
181
*/
182
 
183
typedef struct x_directory {
184
    char *dirname ;
185
    struct x_directory *next ;
186
} directory ;
187
 
188
 
189
#endif