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 B:
|
|
|
32 |
This might be a capsule which defines how array descriptors are laid
|
|
|
33 |
out - could vary from platform to platform - bound by TDF linking
|
|
|
34 |
to capsules produced from Fortran.
|
|
|
35 |
*/
|
|
|
36 |
|
|
|
37 |
Struct Desc (BASE:Ptr Double, LB:Int, UB:Int,
|
|
|
38 |
STRIDE:offset(alignment(Double), alignment(Double)));
|
|
|
39 |
/* Desc is a token giving the shape of of a 1-d array pointer;
|
|
|
40 |
BASE is token which extracts the base pointer from a Desc EXP
|
|
|
41 |
.BASE is the offset of the base pointer from the start of a Desc
|
|
|
42 |
etc for LB,UB and STRIDE
|
|
|
43 |
*/
|
|
|
44 |
|
|
|
45 |
Tokdef SIZE = [e:EXP]EXP
|
|
|
46 |
( STRIDE[e] .* ((UB[e] - LB[e])+ 1(Int)) );
|
|
|
47 |
/* SIZE is a token which evaluates the "size" of an array from its descriptor
|
|
|
48 |
*/
|
|
|
49 |
|
|
|
50 |
Tokdef Make_Desc = [base:EXP, l:EXP, u:EXP, s:EXP]EXP
|
|
|
51 |
Cons[shape_offset(Desc)]
|
|
|
52 |
( .BASE:base, .LB:l, .UB:u, .STRIDE:s);
|
|
|
53 |
/* constructs a descriptor from its components */
|
|
|
54 |
|
|
|
55 |
Tokdef Local_array = [l:EXP, u:EXP, s:SHAPE]EXP
|
|
|
56 |
EXP: Make_Desc[local_alloc( Sizeof(s) .* ((u - l)+ 1(Int))),
|
|
|
57 |
l, u, Sizeof(s)];
|
|
|
58 |
/* define a 1-d array of shape s */
|
|
|
59 |
|
|
|
60 |
Keep (Desc, BASE, LB, UB, STRIDE, SIZE, Make_Desc, Local_array)
|