Subversion Repositories tendra.SVN

Rev

Rev 2 | 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
/* AUTOMATICALLY GENERATED BY %ZX VERSION %ZV FROM TDF %VA.%VB */
62
 
63
#include "config.h"
64
#include "common_types.h"
65
#include "basicread.h"
66
#include "ecodes.h"
67
#include "externs.h"
68
#include "messages_r.h"
69
#include "main_reads.h"
70
#include "check.h"
71
 
72
 
73
/* REPORT AN ERROR */
74
 
7 7u83 75
static void
76
decode_error(char *s)
2 7u83 77
{
7 7u83 78
    failer(s);
79
    exit(EXIT_FAILURE);
2 7u83 80
}
81
@use all
82
@special exp
83
@special nat computed_nat
84
@special signed_nat computed_signed_nat
85
@special tagdef make_var_tagdef
86
@special tagdef common_tagdef
87
@loop sort
88
@if !sort.builtin
89
 
90
 
91
/* DECODE %ST */
92
 
7 7u83 93
%SN
94
d_%SN(void)
2 7u83 95
{
96
@if sort.basic
97
@if sort.extends
7 7u83 98
    int code = get_big_code(%SB);
2 7u83 99
@else
7 7u83 100
    int code = getcode(%SB);
2 7u83 101
@endif
7 7u83 102
    switch (code) {
2 7u83 103
@loop sort.cons
7 7u83 104
	case e_%CN: {
2 7u83 105
@if cons.params
106
@loop cons.param
7 7u83 107
	    %PSN p%PE;
2 7u83 108
@end
109
@loop cons.param
110
@if param.align
7 7u83 111
	    to_boundary();
2 7u83 112
@endif
113
@if param.break
114
@if param.first
7 7u83 115
	    start_%CN();
2 7u83 116
@else
7 7u83 117
	    start_%CN(%
2 7u83 118
@loop param.prev
119
 p%PE,%
120
@end
7 7u83 121
%b);
2 7u83 122
@endif
123
@endif
124
@if param.sort.special
125
@if cons.cond
7 7u83 126
	    p%PE = hold_const_check(d_%PSN());
2 7u83 127
@else
128
@if cons.special
7 7u83 129
	    p%PE = hold_const_check(d_%PSN());
2 7u83 130
@else
7 7u83 131
	    p%PE = hold_check(d_%PSN());
2 7u83 132
@endif
133
@endif
134
@else
7 7u83 135
	    p%PE = d_%PSN();
2 7u83 136
@endif
137
@end
7 7u83 138
	    return(f_%CN(%
2 7u83 139
@loop cons.param
140
 p%PE,%
141
@end
7 7u83 142
%b));
2 7u83 143
@else
144
@if sort.special
7 7u83 145
	    return(f_%CN());
2 7u83 146
@else
7 7u83 147
	    return(f_%CN);
2 7u83 148
@endif
149
@endif
150
	}
151
@end
152
    }
7 7u83 153
    decode_error(ILLEGAL_CODE_%SN);
154
    return(f_dummy_%SN);
2 7u83 155
@else
156
@if sort.dummy
157
@loop sort.cons
158
@loop cons.param
7 7u83 159
    %PSN p%PE;
2 7u83 160
@end
161
@loop cons.param
162
@if param.align
7 7u83 163
    to_boundary();
2 7u83 164
@endif
165
@if param.break
7 7u83 166
    start_%CN(%
2 7u83 167
@loop param.prev
168
 p%PE,%
169
@end
7 7u83 170
%b);
2 7u83 171
@endif
172
@if param.sort.special
7 7u83 173
    p%PE = hold_check(d_%PSN());
2 7u83 174
@else
7 7u83 175
    p%PE = d_%PSN();
2 7u83 176
@endif
177
@end
7 7u83 178
    return(f_%CN(%
2 7u83 179
@loop cons.param
180
 p%PE,%
181
@end
7 7u83 182
%b));
2 7u83 183
@end
184
@else
185
@if sort.option
7 7u83 186
    if (getcode(1)) {
187
	%SSN e;
2 7u83 188
@if sort.sub.special
7 7u83 189
	e = hold_check(d_%SSN());
2 7u83 190
@else
7 7u83 191
	e = d_%SSN();
2 7u83 192
@endif
7 7u83 193
	return(yes_%SN(e));
2 7u83 194
    }
7 7u83 195
    return(no_%SN);
2 7u83 196
@else
7 7u83 197
    int i, n;
198
    %SN temp;
2 7u83 199
@if sort.list
7 7u83 200
    IGNORE getcode(1);
2 7u83 201
@endif
7 7u83 202
    n = small_dtdfint();
203
    temp = new_%SN(n);
204
    for (i = 0; i < n; i++) {
205
	%SSN e;
2 7u83 206
@if sort.sub.special
7 7u83 207
	e = hold_check(d_%SSN());
2 7u83 208
@else
7 7u83 209
	e = d_%SSN();
2 7u83 210
@endif
7 7u83 211
	temp = add_%SN(temp, e, i);
2 7u83 212
    }
7 7u83 213
    return(temp);
2 7u83 214
@endif
215
@endif
216
@endif
217
}
218
@endif
219
@end