Subversion Repositories tendra.SVN

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
6 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
/* CAPSULE A:
32
 This might be the kind of capsule produced by the Fortran producer
33
*/
34
 
35
Tokdec A1_EXP: [NAT, SHAPE,TOKEN[NAT]EXP,TOKEN[TOKEN[NAT]EXP]EXP]EXP;
36
Tokdec Local_array: [EXP, EXP, SHAPE]EXP;
37
Tokdec Desc:[]SHAPE;
38
	/* These are token declaration which will be bound to 
39
		definitions which may vary from platform to platform;
40
		See CAPSULEs B & C
41
	*/
42
Iddec printf:proc;	
43
 
44
Var a:Desc;
45
Var b:Desc;
46
Var c:Desc;
47
/* a, b and c will correspond to pointers to Fortran arrays */
48
 
49
String s = "%g\n";
50
 
51
Proc main = top()
52
{
53
a = Local_array[1(Int), 10(Int), Double];
54
b = Local_array[1(Int), 10(Int), Double];
55
c = Local_array[1(Int), 10(Int), Double];
56
 
57
A1_EXP[2, Double, 
58
  	Use [n:NAT]EXP
59
	  EXP ? ( + n(Int) - 1(Int), * b, * c),
60
	Use [Elem:TOKEN[NAT]EXP]EXP
61
		{ Elem[1] = 1.0(Double);
62
		  Elem[2] = 2.0(Double);
63
		}
64
	];
65
	/* i.e set all elements of b to 2.0 and c to 1.0 */	 
66
 
67
 
68
A1_EXP[3, Double, 
69
	Use [n:NAT]EXP
70
	  EXP ? ( + n(Int) - 1(Int),
71
		  EXP ? ( + n(Int) - 2(Int),
72
			  EXP ? ( + n(Int) - 3(Int),
73
				  #"NOT A PARAMETER",
74
				  * b
75
			  ),
76
			  * c
77
		  ),
78
		  * a
79
	  ),
80
	Use [Elem:TOKEN[NAT]EXP]EXP 
81
		( Elem[1] = (*(Double)Elem[2] F+ *(Double)Elem[3]))
82
	];
83
	/* This would be the translation of the Fortran array assignment:
84
		a = b + c;
85
	*/
86
 
87
A1_EXP[1, Double,
88
	Use [n:NAT]EXP (* a),
89
	Use [Elem:TOKEN[NAT]EXP]EXP
90
		( printf[top](s, *(Double)Elem[1]) )
91
	];
92
 
93
	return(make_top)
94
 
95
};
96
 
97
Keep (main)