Subversion Repositories tendra.SVN

Rev

Rev 7 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 7u83 1
/*
7 7u83 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
 */
31
/*
2 7u83 32
    		 Crown Copyright (c) 1997
7 7u83 33
 
2 7u83 34
    This TenDRA(r) Computer Program is subject to Copyright
35
    owned by the United Kingdom Secretary of State for Defence
36
    acting through the Defence Evaluation and Research Agency
37
    (DERA).  It is made available to Recipients with a
38
    royalty-free licence for its use, reproduction, transfer
39
    to other parties and amendment for any purpose not excluding
40
    product development provided that any such use et cetera
41
    shall be deemed to be acceptance of the following conditions:-
7 7u83 42
 
2 7u83 43
        (1) Its Recipients shall ensure that this Notice is
44
        reproduced upon any copies or amended versions of it;
7 7u83 45
 
2 7u83 46
        (2) Any amended version of it shall be clearly marked to
47
        show both the nature of and the organisation responsible
48
        for the relevant amendment or amendments;
7 7u83 49
 
2 7u83 50
        (3) Its onward transfer from a recipient to another
51
        party shall be deemed to be that party's acceptance of
52
        these conditions;
7 7u83 53
 
2 7u83 54
        (4) DERA gives no warranty or assurance as to its
55
        quality or suitability for any purpose and DERA accepts
56
        no liability whatsoever in relation to any use to which
57
        it may be put.
58
*/
59
 
60
 
61
/**********************************************************************
62
$Author: release $
63
$Date: 1998/01/17 15:55:45 $
64
$Revision: 1.1.1.1 $
65
$Log: toktypes.h,v $
66
 * Revision 1.1.1.1  1998/01/17  15:55:45  release
67
 * First version to be checked into rolling release.
68
 *
69
 * Revision 1.3  1997/08/23  13:31:10  pwe
70
 * no invert order, and initial ANDF-DE
71
 *
72
 * Revision 1.2  1995/06/22  09:21:11  currie
73
 * Signatures on tokens
74
 *
75
 * Revision 1.1  1995/04/06  10:43:34  currie
76
 * Initial revision
77
 *
78
***********************************************************************/
79
#ifndef toktypes_key
80
#define toktypes_key 1
81
 
82
/* definitions of types used in read_fns.c */
83
 
84
struct place_t {
7 7u83 85
	int   flag;	/* false if reading from stream, true if reading from
86
			   pl_mem */
87
	char *pl_mem;	/* pointer to the characters */
88
	int   bits_on;	/* bit_index displacement of the start */
2 7u83 89
};
90
 
7 7u83 91
typedef struct place_t place;
2 7u83 92
typedef place bitstream;
93
typedef place bytestream;
94
 
7 7u83 95
typedef struct sortname_t {
96
	int code;	/* code number for the sort - see sortmacs.h */
97
	int result;	/* if code is TOKEN this is the code for the result */
98
	struct sortname_list_t {
99
		struct sortname_t *elems;
100
		int number;
101
	} pars;
102
	/* pars.elems is an array of pars.number parameter sorts if the code
103
	   is TOKEN */
104
} sortname;
2 7u83 105
 
106
typedef struct sortname_list_t sortname_list;
107
 
7 7u83 108
/* dummy definition types */
2 7u83 109
typedef int token_defn;
110
typedef int capsule;
111
typedef int tokextern_list;
112
typedef int tagextern_list;
113
typedef int tokdef_list;
114
typedef int tagdec_list;
115
typedef int tagdef_list;
116
typedef int al_tagdef_list;
117
typedef int unit;
118
typedef int info;
119
typedef int info_list;
120
typedef int linkunit;
121
typedef int linkunit_list;
122
typedef int toklink_list;
123
typedef int taglink_list;
124
typedef int allink_list;
125
typedef int tokdec_list;
126
typedef int tokdec_unit;
127
typedef int tokdef_unit;
128
typedef int tagdec_unit;
129
typedef int tagdef_unit;
130
typedef int aldef_unit;
131
typedef int tokdec_unit_list;
132
typedef int tokdef_unit_list;
133
typedef int tagdec_unit_list;
134
typedef int tagdef_unit_list;
135
typedef int linkinfo_props;
136
 
137
typedef char usage;
138
 
139
#include "sort_union.h"
140
 
141
#define LOCAL_TOKS 4
142
 
7 7u83 143
struct tag_con_t {
144
	dec *namet;
2 7u83 145
	exp e;
7 7u83 146
	struct tag_con_t *rest;
147
};
148
typedef struct tag_con_t tag_con;
2 7u83 149
 
7 7u83 150
struct lab_con_t {
2 7u83 151
	label namel;
152
	exp e;
7 7u83 153
	struct lab_con_t *rest;
154
};
155
typedef struct lab_con_t lab_con;
2 7u83 156
 
157
 
158
typedef union tokval_u tokval;
159
 
7 7u83 160
/* struct holding a token definition */
2 7u83 161
struct tok_define_t {
7 7u83 162
	dec **my_tagtab;	/* the tagtab current at the definition */
163
	aldef **my_altab;	/* the altab current at the definition */
164
	exp *my_labtab;		/* the labtab current at the definition */
165
	struct tok_define_t **my_toktab;
166
				/* the toktab current at the definition */
167
	diag_tagdef **my_diagtab;	/* OLD DIAGS */
168
				/* the diagtab current at the definition */
169
	dgtag_struct **my_dgtab;	/* NEW DIAGS */
170
				/* the dgtab current at the definition */
171
	char *tok_name;		/* the identifier (if any) for the token */
172
	struct tokformals_list_t {	/* description of formal parameters */
173
		sortname *par_sorts;	/* sorts of parameters */
174
		int *par_names;		/* token index for parameters */
175
		int number;		/* total number of parameters */
176
	} params;
177
	sortname tdsort;	/* sort of token result */
178
	place tdplace;		/* place to read definition from */
179
	int unit_number;	/* number of unit in which defined */
180
	union tokval_u tdvalue;	/* preserved value if valpresent */
181
	int tok_index;		/* index number of this token */
182
	int tdtoken;		/* the token */
183
	struct context_t *tok_context;	/* context at the token definition */
184
	char *signature;
185
	unsigned int re_evaluate:1;	/* needs to be reevaluated */
186
	unsigned int defined:1;
2 7u83 187
         /* for diagnostic purposes, remove later */
7 7u83 188
	unsigned int is_capsule_token:1;/* it is a capsule level token */
189
	unsigned int recursive:1;	/* used to check against recursion */
190
	unsigned int valpresent:1;	/* the value is constant and has been
191
				   	   computed already */
192
	unsigned int tok_special:1;	/* locally defined token */
193
};
194
typedef struct tok_define_t tok_define;
2 7u83 195
 
7 7u83 196
typedef tok_define *token;
2 7u83 197
 
7 7u83 198
struct context_t {
199
        tok_define loctoks[LOCAL_TOKS];
200
	tok_define *othertoks; /* most tokens have <=LOCAL_TOKS parameters and
201
				  are not recursive so use of local space in
202
				  apply_tok for 'tok_context' to avoid lots of
203
				  mallocs ....*/
2 7u83 204
	short no_toks;
205
	short recursive;
7 7u83 206
	tag_con *tags;		/* ... don't know how many tag & labs defined
207
				   in token so have to keep list; NB used only
208
				   if recursive */
209
	lab_con *labs;
210
	struct context_t *outer;
211
};
212
typedef struct context_t context;
2 7u83 213
 
7 7u83 214
extern context *crt_context;
2 7u83 215
 
7 7u83 216
/* dummy definitions */
2 7u83 217
typedef int taglink;
218
typedef int allink;
219
typedef int toklink;
220
 
221
 
222
typedef int tokextern;
223
 
224
typedef int tagextern;
225
typedef int alextern;
226
 
227
typedef int tokdec;
228
 
7 7u83 229
typedef struct tokformals_t {
230
	sortname sn;
231
	int tk;
232
} tokformals;	/* formal parameter during reading */
2 7u83 233
 
7 7u83 234
typedef struct tokformals_list_t tokformals_list;
2 7u83 235
 
236
typedef int tokdef;
237
 
7 7u83 238
typedef struct tagdec_t {
239
	tag tg;			/* identifying tag */
240
	shape sha;		/* the shape of the tag */
241
	access_option acc;	/* its access_options */
242
	bool is_variable;	/* 1 for variable, 0 for identity */
243
	bool is_common;		/* 1 for common_tagdec */
244
} tagdec;
2 7u83 245
 
7 7u83 246
typedef struct tagdef_t {
247
	tag tg;			/* identifying tag */
248
	exp def;		/* the associated exp definition */
249
	bool var;		/* 1 for variable, 0 for identity */
250
	bool is_common;		/* 1 for common_tagdef */
251
} tagdef;
2 7u83 252
 
253
typedef int al_tagdef;
254
 
7 7u83 255
typedef struct tdfstring_list_t {
256
	int number;
257
	tdfstring *elems;
258
} tdfstring_list;		/* number tdfstrings */
2 7u83 259
 
260
typedef tdfstring tdfident;
261
 
262
typedef tdfstring_list tdfident_list;
263
 
264
typedef tdfident_list unique;
265
 
7 7u83 266
union external_u {
267
	unique u;
268
	tdfstring id;
269
};
2 7u83 270
 
7 7u83 271
typedef struct external_t {
272
	union external_u ex;
273
	bool isstring;
274
} external;
2 7u83 275
 
7 7u83 276
typedef struct capsule_link_t {
277
	char *id;	/* name */
278
	tdfint n;	/* index */
279
} capsule_link;
2 7u83 280
 
7 7u83 281
typedef struct capsule_link_list_t {
282
	int number;
283
	capsule_link *members; 
284
} capsule_link_list;	/* number capsule_links */
2 7u83 285
 
7 7u83 286
typedef struct tdfint_list_t {
287
	int number;
288
	tdfint *members; 
289
} tdfint_list;		/* number tdfints */
2 7u83 290
 
7 7u83 291
/* dummy definitions */
2 7u83 292
typedef int group_list;
293
typedef int extern_link_list;
294
typedef int linkextern_list;
295
typedef int extern_link;
296
typedef int group;
297
typedef int unit_list;
298
typedef int link;
299
typedef int linkextern;
300
typedef int links;
301
typedef int link_list;
302
typedef int tokdec_props;
303
typedef int tokdef_props;
304
typedef int tagdec_props;
305
typedef int tagdef_props;
306
typedef int al_tagdef_props;
307
typedef int tokdef_bd;
308
typedef int links_list;
309
 
7 7u83 310
typedef struct capsule_frees_t {
311
	void *ptr;
312
	struct capsule_frees_t *next;
313
} capsule_frees;
2 7u83 314
 
315
#endif