Subversion Repositories tendra.SVN

Rev

Rev 2 | Go to most recent revision | Details | Compare with Previous | 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
    A byte is used to represent a single 8-bit number read from the
39
    input file.  A pointer is a generic pointer.
40
*/
41
 
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
    INPUT FILE POSITION
52
 
53
    A place is used to record positions in the input file.  It consists
54
    of the byte number within the file, the bit number within that byte,
55
    and an 8-bit input buffer.
56
*/
57
 
58
typedef struct {
59
    long byte ;
60
    int bit ;
61
    unsigned worksp ;
62
} place ;
63
 
64
 
65
/*
66
    IDENTIFIER TYPES
67
 
68
    A string is used to represent TDF strings.  A unique is a null-terminated
69
    array of strings.  An external is either a string or a unique.
70
*/
71
 
72
typedef char *string ;
73
typedef string *unique ;
74
 
75
typedef struct {
76
    char simple ;
77
    union {
78
	string str ;
79
	unique uniq ;
80
    } val ;
81
} external ;
82
 
83
 
84
/*
85
    TYPES REPRESENTING SORTS
86
 
87
    Each TDF sort name is represented by an identifying integer.  A sort
88
    identifier consists of a name and a decode letter.  A foreign sort may
89
    also have an associated foreign sort name.
90
*/
91
 
92
typedef int sortname ;
93
 
94
typedef struct {
95
    char *name ;
96
    char *fname ;
97
    char decode ;
98
    sortname res ;
99
    char *args ;
100
} sortid ;
101
 
102
 
103
/*
104
    TYPE REPRESENTING TOKEN INFORMATION
105
 
106
    A token is represented by a structure giving the result sort,
107
    the argument sorts (if any) in the form of a decode string, and the
108
    implicit sort (for tokens which are used before they are declared
109
    or defined).
110
*/
111
 
112
typedef struct {
113
    sortname tok_res_sort ;
114
    char *tok_arg_sorts ;
115
    sortname tok_implicit_sort ;
116
} token_info ;
117
 
118
 
119
/*
120
    TYPE REPRESENTING VARIABLE SORTS
121
 
122
    All variable sorts, in particular tags and tokens, are represented
123
    by the same data structure.  This gives its external name (if any),
124
    its internal identifying number, plus extra information depending
125
    on the type of object represented (see below).
126
*/
127
 
128
typedef struct object_tag {
129
    int flag ;
130
    int named ;
131
    external name ;
132
    long id ;
133
    long order ;
134
    union {
135
	token_info tok ;
136
    } extra ;
137
    struct object_tag *aux ;
138
} object ;
139
 
140
 
141
/*
142
    TRANSLATIONS FOR TAGS
143
 
144
    These macros give the interpretation for the field of an object
145
    when that object represents a tag.
146
*/
147
 
148
#define var( X )		( ( X )->flag )
149
 
150
 
151
/*
152
    TRANSLATIONS FOR TOKENS
153
 
154
    These macros give the interpretation for the field of an object
155
    when that object represents a token.
156
*/
157
 
158
#define is_foreign( X )		( ( X )->flag )
159
#define res_sort( X )		( ( X )->extra.tok.tok_res_sort )
160
#define arg_sorts( X )		( ( X )->extra.tok.tok_arg_sorts )
161
#define implicit_sort( X )	( ( X )->extra.tok.tok_implicit_sort )
162
 
163
 
164
 
165
/*
166
    TYPE REPRESENTING BINDINGS
167
 
168
    A binding consists of a table of pointers to objects.  A binding table
169
    is an array of bindings.
170
*/
171
 
172
typedef struct {
173
    long max_no ;
174
    long sz ;
175
    object **table ;
176
} binding ;
177
 
178
 
179
#endif