Warning: Attempt to read property "date" on null in /usr/local/www/websvn.planix.org/blame.php on line 247

Warning: Attempt to read property "msg" on null in /usr/local/www/websvn.planix.org/blame.php on line 247
WebSVN – tendra.SVN – Blame – //branches/tendra4/src/tools/pl/analyse_sort.c – Rev 2

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
/**********************************************************************
32
$Author: release $
33
$Date: 1998/01/17 15:57:24 $
34
$Revision: 1.1.1.1 $
35
$Log: analyse_sort.c,v $
36
 * Revision 1.1.1.1  1998/01/17  15:57:24  release
37
 * First version to be checked into rolling release.
38
 *
39
 * Revision 1.2  1995/06/08  09:13:46  currie
40
 * Added sigs to tokdecs/defs
41
 *
42
 * Revision 1.1  1995/04/07  14:29:07  currie
43
 * Initial revision
44
 *
45
 * Revision 1.2  1994/07/21  10:35:53  currie
46
 * Added banner
47
 *
48
***********************************************************************/
49
#include "config.h"
50
#include "util.h"
51
#include "defs.h"
52
#include "syntax.h"
53
#include "analyse_sort.h"
54
#include "encodings.h"
55
#include "enc_nos.h"
56
#include "lex.h"
57
#include "namedecs.h"
58
#include "streams.h"
59
#include "errors.h"
60
 
61
 
62
void read_tdfint
63
    PROTO_Z ()
64
{
65
    fail ( "This shouldn't happen" ) ;
66
}
67
 
68
void read_tdfbool
69
    PROTO_Z ()
70
{
71
    fail ( "This shouldn't happen" ) ;
72
}
73
 
74
 
75
static void out_nontoksort
76
    PROTO_N ( (sort) )
77
    PROTO_T ( int sort )
78
{
79
    switch(sort) {
80
	case access_sort: o_access; return ;
81
	case alignment_sort: o_alignment_sort; return ;
82
	case al_tag_sort: o_al_tag; return ;
83
	case bitfield_variety_sort: o_bitfield_variety; return 	;
84
	case bool_sort: o_bool; return;
85
	case error_treatment_sort: o_error_treatment; return;
86
	case exp_sort: o_exp; return;
87
	case floating_variety_sort: o_floating_variety; return ;
88
	case label_sort: o_label; return ;
89
	case nat_sort: o_nat; return;
90
	case ntest_sort: o_ntest; return ;
91
	case rounding_mode_sort: o_rounding_mode; return;
92
	case shape_sort: o_shape; return;
93
	case signed_nat_sort: o_signed_nat; return ;
94
	case string_sort: o_string; return;
95
	case tag_sort: o_tag; return;
96
	case transfer_mode_sort: o_transfer_mode; return;
97
	case variety_sort: o_variety; return;
98
    }
99
    fail("Not a legal sort");
100
}
101
 
102
void out_sort
103
    PROTO_N ( (s) )
104
    PROTO_T ( Sort * s )
105
{
106
    if (s->sort != token_sort) {
107
	out_nontoksort(s->sort);
108
    } else {
109
	out_toksort(s->toksort);
110
    }
111
}
112
 
113
void out_toksort
114
    PROTO_N ( (ts) )
115
    PROTO_T ( TokSort * ts )
116
{
117
    Tokpar * tp = ts->pars;
118
    o_token(
119
	out_sort(&ts->ressort),
120
	while (tp != (Tokpar *)0) {
121
	    LIST_ELEM(out_sort(&tp->par));
122
	    tp = tp->next;
123
	}
124
    );
125
}
126
 
127
 
128
void analyse_sort
129
    PROTO_N ( (sort) )
130
    PROTO_T ( int sort )
131
{
132
    switch(sort) {
133
	case access_sort: read_access(); return ;
134
	case alignment_sort: read_alignment(); return ;
135
	case al_tag_sort: read_al_tag(); return ;
136
	case bitfield_variety_sort: read_bitfield_variety(); return;
137
	case bool_sort: read_bool(); return;
138
	case error_treatment_sort: read_error_treatment(); return;
139
	case exp_sort: read_exp(); return;
140
	case floating_variety_sort: read_floating_variety(); return;
141
	case label_sort: read_label(); return ;
142
	case nat_sort: read_nat(); return;
143
	case ntest_sort: read_ntest(); return ;
144
	case rounding_mode_sort: read_rounding_mode(); return;
145
	case shape_sort: read_shape(); return;
146
	case signed_nat_sort: read_signed_nat(); return ;
147
	case string_sort: read_string(); return;
148
	case tag_sort: read_tag(); return;
149
	case token_sort: read_token(); return;
150
	case transfer_mode_sort: read_transfer_mode(); return;
151
	case variety_sort: read_variety(); return;
152
    }
153
    fail("Not a legal sort");
154
}
155
 
156
 
157
static void tokp
158
    PROTO_N ( (tp) )
159
    PROTO_T ( Tokpar * tp )
160
{
161
    if (tp == (Tokpar*)0) return;
162
    skip_term (lex_osq);
163
    analyse_sort(tp ->par.sort);
164
    while ((tp=tp->next) != (Tokpar*)0) {
165
	skip_term (lex_comma);
166
	analyse_sort(tp->par.sort);
167
    }
168
    skip_term (lex_csq);
169
}
170
 
171
 
172
static void tok
173
    PROTO_N ( (td) )
174
    PROTO_T ( Tokdec * td )
175
{
176
    if (td->sort.ressort.sort != token_sort) {
177
	make_tok(&td->idname.name);
178
    } else {
179
	o_token_apply_token(make_tok(&td->idname.name), tokp(td->sort.pars));
180
	/* NB this only allow two levels */
181
    }
182
}
183
 
184
void expand_tok
185
    PROTO_N ( (td, ts) )
186
    PROTO_T ( Tokdec * td X TokSort * ts )
187
{
188
    Tokpar * tp = ts->pars;
189
    switch(ts->ressort.sort) {
190
	case access_sort: {
191
	    o_access_apply_token(tok(td),tokp(tp));
192
	    break;
193
	}
194
	case alignment_sort: {
195
	    o_alignment_apply_token(tok(td),tokp(tp));
196
	    break;
197
	}
198
	case al_tag_sort: {
199
	    o_al_tag_apply_token(tok(td),tokp(tp));
200
	    break;
201
	}
202
	case bitfield_variety_sort: {
203
	    o_bfvar_apply_token(tok(td),tokp(tp));
204
	    break;
205
	}
206
	case bool_sort: {
207
	    o_bool_apply_token(tok(td),tokp(tp));
208
	    break;
209
	}
210
	case error_treatment_sort: {
211
	    o_errt_apply_token(tok(td),tokp(tp));
212
	    break;
213
	}
214
	case exp_sort: {
215
	    o_exp_apply_token(tok(td), tokp(tp));
216
	    break;
217
	}
218
	case floating_variety_sort: {
219
	    o_flvar_apply_token(tok(td),tokp(tp));
220
	    break;
221
	}
222
	case label_sort: {
223
	    o_label_apply_token(tok(td),tokp(tp));
224
	    break;
225
	}
226
	case nat_sort: {
227
	    o_nat_apply_token(tok(td),tokp(tp));
228
	    break;
229
	}
230
	case ntest_sort: {
231
	    o_ntest_apply_token(tok(td),tokp(tp));
232
	    break;
233
	}
234
	case rounding_mode_sort: {
235
	    o_rounding_mode_apply_token(tok(td),tokp(tp));
236
	    break;
237
	}
238
	case shape_sort: {
239
	    o_shape_apply_token(tok(td),tokp(tp));
240
	    break;
241
	}
242
	case signed_nat_sort: {
243
	    o_signed_nat_apply_token(tok(td),tokp(tp));
244
	    break;
245
	}
246
	case string_sort: {
247
	    o_string_apply_token(tok(td), tokp(tp));
248
	    break;
249
	}
250
	case tag_sort: {
251
	    o_tag_apply_token(tok(td),tokp(tp));
252
	    break;
253
	}
254
	case token_sort: {
255
	    expand_tok(td, ts->ressort.toksort);
256
	    break;
257
	}
258
	case transfer_mode_sort: {
259
	    o_transfer_mode_apply_token(tok(td),tokp(tp));
260
	    break;
261
	}
262
	case variety_sort: {
263
	    o_var_apply_token(tok(td),tokp(tp));
264
	    break;
265
	}
266
	default: {
267
	    fail("Not a legal sort");
268
	    break;
269
	}
270
    }
271
}