Subversion Repositories tendra.SVN

Rev

Rev 2 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2 Rev 7
Line -... Line 1...
-
 
1
/*
-
 
2
 * Copyright (c) 2002-2005 The TenDRA Project <http://www.tendra.org/>.
-
 
3
 * All rights reserved.
-
 
4
 *
-
 
5
 * Redistribution and use in source and binary forms, with or without
-
 
6
 * modification, are permitted provided that the following conditions are met:
-
 
7
 *
-
 
8
 * 1. Redistributions of source code must retain the above copyright notice,
-
 
9
 *    this list of conditions and the following disclaimer.
-
 
10
 * 2. Redistributions in binary form must reproduce the above copyright notice,
-
 
11
 *    this list of conditions and the following disclaimer in the documentation
-
 
12
 *    and/or other materials provided with the distribution.
-
 
13
 * 3. Neither the name of The TenDRA Project nor the names of its contributors
-
 
14
 *    may be used to endorse or promote products derived from this software
-
 
15
 *    without specific, prior written permission.
-
 
16
 *
-
 
17
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
-
 
18
 * IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-
 
19
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-
 
20
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
-
 
21
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-
 
22
 * EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-
 
23
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-
 
24
 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-
 
25
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-
 
26
 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-
 
27
 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
 
28
 *
-
 
29
 * $Id$
-
 
30
 */
1
/*
31
/*
2
    		 Crown Copyright (c) 1997
32
    		 Crown Copyright (c) 1997
3
    
33
 
4
    This TenDRA(r) Computer Program is subject to Copyright
34
    This TenDRA(r) Computer Program is subject to Copyright
5
    owned by the United Kingdom Secretary of State for Defence
35
    owned by the United Kingdom Secretary of State for Defence
6
    acting through the Defence Evaluation and Research Agency
36
    acting through the Defence Evaluation and Research Agency
7
    (DERA).  It is made available to Recipients with a
37
    (DERA).  It is made available to Recipients with a
8
    royalty-free licence for its use, reproduction, transfer
38
    royalty-free licence for its use, reproduction, transfer
9
    to other parties and amendment for any purpose not excluding
39
    to other parties and amendment for any purpose not excluding
10
    product development provided that any such use et cetera
40
    product development provided that any such use et cetera
11
    shall be deemed to be acceptance of the following conditions:-
41
    shall be deemed to be acceptance of the following conditions:-
12
    
42
 
13
        (1) Its Recipients shall ensure that this Notice is
43
        (1) Its Recipients shall ensure that this Notice is
14
        reproduced upon any copies or amended versions of it;
44
        reproduced upon any copies or amended versions of it;
15
    
45
 
16
        (2) Any amended version of it shall be clearly marked to
46
        (2) Any amended version of it shall be clearly marked to
17
        show both the nature of and the organisation responsible
47
        show both the nature of and the organisation responsible
18
        for the relevant amendment or amendments;
48
        for the relevant amendment or amendments;
19
    
49
 
20
        (3) Its onward transfer from a recipient to another
50
        (3) Its onward transfer from a recipient to another
21
        party shall be deemed to be that party's acceptance of
51
        party shall be deemed to be that party's acceptance of
22
        these conditions;
52
        these conditions;
23
    
53
 
24
        (4) DERA gives no warranty or assurance as to its
54
        (4) DERA gives no warranty or assurance as to its
25
        quality or suitability for any purpose and DERA accepts
55
        quality or suitability for any purpose and DERA accepts
26
        no liability whatsoever in relation to any use to which
56
        no liability whatsoever in relation to any use to which
27
        it may be put.
57
        it may be put.
28
*/
58
*/
Line 36... Line 66...
36
    ELEMENTARY TYPES
66
    ELEMENTARY TYPES
37
 
67
 
38
    The types boolean, byte and pointer are defined.
68
    The types boolean, byte and pointer are defined.
39
*/
69
*/
40
 
70
 
41
typedef char boolean ;
71
typedef char boolean;
42
typedef unsigned char byte ;
72
typedef unsigned char byte;
43
#if FS_PTR_VOID
-
 
44
typedef void *pointer ;
73
typedef void *pointer;
45
#else
-
 
46
typedef char *pointer ;
-
 
47
#endif
-
 
48
 
74
 
49
 
75
 
50
/*
76
/*
51
    FORWARD STRUCTURE DECLARATION
77
    FORWARD STRUCTURE DECLARATION
52
 
78
 
53
    The structure representing a TDF construct is defined recursively.
79
    The structure representing a TDF construct is defined recursively.
54
*/
80
*/
55
 
81
 
56
struct x_construct ;
82
struct x_construct;
57
 
83
 
58
 
84
 
59
/*
85
/*
60
    TYPE REPRESENTING A SORT NAME
86
    TYPE REPRESENTING A SORT NAME
61
 
87
 
62
    Each TDF construct has an associated sort.  This is represented
88
    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
89
    by a value of type sortname.  It can take any of the values of
64
    the form sort_* in tags.h.
90
    the form sort_* in tags.h.
65
*/
91
*/
66
 
92
 
67
typedef int sortname ;
93
typedef int sortname;
68
 
94
 
69
 
95
 
70
/*
96
/*
71
    TYPE REPRESENTING A TREE NODE
97
    TYPE REPRESENTING A TREE NODE
72
 
98
 
Line 75... Line 101...
75
    tree its structure.  For shape checking there is also a shape field
101
    tree its structure.  For shape checking there is also a shape field
76
    which is itself a node.
102
    which is itself a node.
77
*/
103
*/
78
 
104
 
79
typedef struct x_node {
105
typedef struct x_node {
80
    struct x_construct *cons ;
106
    struct x_construct *cons;
81
    struct x_node *son ;
107
    struct x_node *son;
82
    struct x_node *bro ;
108
    struct x_node *bro;
83
    struct x_node *shape ;
109
    struct x_node *shape;
84
} node ;
110
} node;
85
 
111
 
86
 
112
 
87
/*
113
/*
88
    TYPE REPRESENTING AN ALIGNMENT TAG
114
    TYPE REPRESENTING AN ALIGNMENT TAG
89
 
115
 
90
    The only information required about an alignment tag is its
116
    The only information required about an alignment tag is its
91
    definition (if any).
117
    definition (if any).
92
*/
118
*/
93
 
119
 
94
typedef struct x_al_tag_info {
120
typedef struct x_al_tag_info {
95
    node *def ;
121
    node *def;
96
} al_tag_info ;
122
} al_tag_info;
97
 
123
 
98
 
124
 
99
/*
125
/*
100
    TYPE REPRESENTING A TAG
126
    TYPE REPRESENTING A TAG
101
 
127
 
Line 103... Line 129...
103
    It may also be declared and defined.  The vis field is used to
129
    It may also be declared and defined.  The vis field is used to
104
    try to catch variables declared with visible access.
130
    try to catch variables declared with visible access.
105
*/
131
*/
106
 
132
 
107
typedef struct x_tag_info {
133
typedef struct x_tag_info {
108
    boolean var ;
134
    boolean var;
109
    boolean vis ;
135
    boolean vis;
110
    node *dec ;
136
    node *dec;
111
    node *def ;
137
    node *def;
112
} tag_info ;
138
} tag_info;
113
 
139
 
114
 
140
 
115
/*
141
/*
116
    TYPE REPRESENTING A TOKEN
142
    TYPE REPRESENTING A TOKEN
117
 
143
 
Line 120... Line 146...
120
    formal parameters for a defined token are given as an array of
146
    formal parameters for a defined token are given as an array of
121
    constructs by the pars field.
147
    constructs by the pars field.
122
*/
148
*/
123
 
149
 
124
typedef struct x_tok_info {
150
typedef struct x_tok_info {
125
    boolean dec ;
151
    boolean dec;
126
    sortname res ;
152
    sortname res;
127
    char *args ;
153
    char *args;
128
    node *sig ;
154
    node *sig;
129
    node *def ;
155
    node *def;
130
    int depth ;
156
    int depth;
131
    struct x_construct **pars ;
157
    struct x_construct **pars;
132
} tok_info ;
158
} tok_info;
133
 
159
 
134
 
160
 
135
/*
161
/*
136
    TYPE REPRESENTING A TDF CONSTRUCT
162
    TYPE REPRESENTING A TDF CONSTRUCT
137
 
163
 
Line 142... Line 168...
142
    on its sort.  The next field enables us to form constructs into
168
    on its sort.  The next field enables us to form constructs into
143
    lists.
169
    lists.
144
*/
170
*/
145
 
171
 
146
typedef struct x_construct {
172
typedef struct x_construct {
147
    sortname sortnum ;
173
    sortname sortnum;
148
    long encoding ;
174
    long encoding;
149
    char *name ;
175
    char *name;
150
    node *ename ;
176
    node *ename;
151
    struct x_construct *alias ;
177
    struct x_construct *alias;
152
    struct x_construct *next ;
178
    struct x_construct *next;
153
    union {
179
    union {
154
	char *char_u ;
180
	char *char_u;
155
	al_tag_info al_tag_u ;
181
	al_tag_info al_tag_u;
156
	tag_info tag_u ;
182
	tag_info tag_u;
157
	tok_info tok_u ;
183
	tok_info tok_u;
158
    } u ;
184
    } u;
159
} construct ;
185
} construct;
160
 
186
 
161
 
187
 
162
/*
188
/*
163
    MACROS FOR ACCESSING INFO FIELDS OF A CONSTRUCT
189
    MACROS FOR ACCESSING INFO FIELDS OF A CONSTRUCT
164
 
190
 
165
    The following macros access the various field of the extra
191
    The following macros access the various field of the extra
166
    information union of a construct.  These macros should always
192
    information union of a construct.  These macros should always
167
    be used - the fields should not be addressed directly.
193
    be used - the fields should not be addressed directly.
168
*/
194
*/
169
 
195
 
170
#define get_char_info( X )	( ( X )->u.char_u )
196
#define get_char_info(X)	((X) ->u.char_u)
171
#define get_al_tag_info( X )	( &( ( X )->u.al_tag_u ) )
197
#define get_al_tag_info(X)	(&((X) ->u.al_tag_u))
172
#define get_tag_info( X )	( &( ( X )->u.tag_u ) )
198
#define get_tag_info(X)		(&((X) ->u.tag_u))
173
#define get_tok_info( X )	( &( ( X )->u.tok_u ) )
199
#define get_tok_info(X)		(&((X) ->u.tok_u))
174
 
200
 
175
 
201
 
176
/*
202
/*
177
    TYPE REPRESENTING A DIRECTORY
203
    TYPE REPRESENTING A DIRECTORY
178
 
204
 
179
    In order to search for included files, the directory structure
205
    In order to search for included files, the directory structure
180
    enables us to form lists of directory names.
206
    enables us to form lists of directory names.
181
*/
207
*/
182
 
208
 
183
typedef struct x_directory {
209
typedef struct x_directory {
184
    char *dirname ;
210
    char *dirname;
185
    struct x_directory *next ;
211
    struct x_directory *next;
186
} directory ;
212
} directory;
187
 
213
 
188
 
214
 
189
#endif
215
#endif