Subversion Repositories tendra.SVN

Rev

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

Rev 5 Rev 6
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 40... Line 70...
40
@special alignment
70
@special alignment
41
@special exp_list
71
@special exp_list
42
@special exp_option
72
@special exp_option
43
/* AUTOMATICALLY GENERATED BY %ZX VERSION %ZV FROM TDF %VA.%VB */
73
/* AUTOMATICALLY GENERATED BY %ZX VERSION %ZV FROM TDF %VA.%VB */
44
 
74
 
45
#define sub0( X )	( ( X )->son )
75
#define sub0(X)	((X)->son)
46
#define sub1( X )	( ( X )->son->bro )
76
#define sub1(X)	((X)->son->bro)
47
#define sub2( X )	( ( X )->son->bro->bro )
77
#define sub2(X)	((X)->son->bro->bro)
48
#define sub3( X )	( ( X )->son->bro->bro->bro )
78
#define sub3(X)	((X)->son->bro->bro->bro)
49
#define sub4( X )	( ( X )->son->bro->bro->bro->bro )
79
#define sub4(X)	((X)->son->bro->bro->bro->bro)
50
#define sub5( X )	( ( X )->son->bro->bro->bro->bro->bro )
80
#define sub5(X)	((X)->son->bro->bro->bro->bro->bro)
51
#define sub6( X )	( ( X )->son->bro->bro->bro->bro->bro->bro )
81
#define sub6(X)	((X)->son->bro->bro->bro->bro->bro->bro)
52
#define sub7( X )	( ( X )->son->bro->bro->bro->bro->bro->bro->bro )
82
#define sub7(X)	((X)->son->bro->bro->bro->bro->bro->bro->bro)
53
 
83
 
54
 
84
 
55
/*
85
/*
56
    SET THE SHAPE OF AN EXPRESSION
86
    SET THE SHAPE OF AN EXPRESSION
57
 
87
 
58
    The shape of the expression exp is calculated and assigned.  Most of
88
    The shape of the expression exp is calculated and assigned.  Most of
59
    the work is done by the check routines above, as selected by an
89
    the work is done by the check routines above, as selected by an
60
    automatically generated switch statement.
90
    automatically generated switch statement.
61
*/
91
*/
62
 
92
 
63
void check_exp_fn
93
void
64
    PROTO_N ( ( exp ) )
-
 
65
    PROTO_T ( node *exp )
94
check_exp_fn(node *exp)
66
{
95
{
67
    long m ;
96
    long m;
68
    if ( exp == null ) return ;
97
    if (exp == null) {
69
    m = exp->cons->encoding ;
-
 
70
    if ( m == ENC_labelled ) {
-
 
71
	node *placelabs_intro = sub0 ( exp ) ;
-
 
72
	node *places = sub2 ( exp ) ;
-
 
73
	if ( placelabs_intro->cons->encoding != places->cons->encoding ) {
-
 
74
	    input_error ( "Labels don't match exps in labelled" ) ;
-
 
75
	}
98
	return;
76
    }
99
    }
-
 
100
    m = exp->cons->encoding;
-
 
101
    if (m == ENC_labelled) {
-
 
102
	node *placelabs_intro = sub0(exp);
-
 
103
	node *places = sub2(exp);
-
 
104
	if (placelabs_intro->cons->encoding != places->cons->encoding) {
-
 
105
	    input_error("Labels don't match exps in labelled");
-
 
106
	}
-
 
107
    }
77
    if ( do_check ) {
108
    if (do_check) {
78
	if ( exp->shape ) return ;
109
	if (exp->shape) {
-
 
110
	    return;
-
 
111
	}
79
	checking = exp->cons->name ;
112
	checking = exp->cons->name;
80
	switch ( m ) {
113
	switch (m) {
81
@loop sort
114
@loop sort
82
@if sort.eq.exp
115
@if sort.eq.exp
83
@loop sort.cons
116
@loop sort.cons
84
	    case ENC_%27CN : {
117
	    case ENC_%27CN: {
85
@loop cons.param
118
@loop cons.param
86
@if param.sort.special
119
@if param.sort.special
87
		node *%PN = sub%PE ( exp ) ;
120
		node *%PN = sub%PE(exp);
88
@else
121
@else
89
@if param.sort.dummy
122
@if param.sort.dummy
90
		%PSN parameter, %PN, messes things up!
123
		%PSN parameter, %PN, messes things up!
91
@endif
124
@endif
92
@endif
125
@endif
93
@end
126
@end
94
		CHECK_%25CN
127
		CHECK_%25CN
95
		break ;
128
		break;
96
	    }
129
	    }
97
@end
130
@end
98
@endif
131
@endif
99
@end
132
@end
100
	}
133
	}
101
	exp->shape = expand_fully ( exp->shape ) ;
134
	exp->shape = expand_fully(exp->shape);
102
    }
135
    }
103
    return ;
136
    return;
104
}
137
}