1 /*
2  * Copyright (c) 1995-2018, NVIDIA CORPORATION.  All rights reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17 
18 /**
19  * \file
20  * \brief Fortran IO related structs
21  */
22 
23 /* TODO FOR FLANG: is this needed/used, looks like HPF stuff */
24 
25 struct ent {
26   char *adr; /* adr of first data item */
27   long cnt;  /* number of data items */
28   long str;  /* stride between items */
29   int typ;   /* data item type (see pghpf.h) */
30   long len;  /* total length of data items (bytes) */
31   long ilen; /* length of a single data item (bytes) */
32 };
33 
34 /* vector of data item entries */
35 
36 struct ents {
37   struct ent *beg; /* adr of first allocated entry */
38   struct ent *end; /* adr of first unallocated entry */
39   struct ent *avl; /* adr of next available entry */
40   struct ent *wrk; /* adr of next working entry */
41 };
42 
43 /* cpu entry */
44 
45 struct ccpu {
46   int op;          /* operation */
47   int cpu;         /* cpu id for send/recv, # cpus for bcst */
48   struct ents *sp; /* send pointer */
49   struct ents *rp; /* recv pointer */
50   char *opt;       /* address of optional structure */
51   int spare[3];    /* spare words */
52 };
53 
54 #define CPU_RECV 0x1
55 #define CPU_SEND 0x2
56 #define CPU_BCST 0x4
57 #define CPU_COPY 0x8
58 
59 /* channel */
60 
61 struct chdr {
62   struct chdr *next; /* next struct in list */
63   struct chdr *last; /* last struct in list (valid only in first) */
64   struct ccpu *cp;   /* adr of cpu entries */
65   int cn;            /* number of cpu entries */
66   struct ents *sp;   /* adr of entries to send */
67   int sn;            /* number of entries to send */
68   struct ents *rp;   /* adr of entries to receive */
69   int rn;            /* number of entries of receive */
70   char *bases;       /* send base address */
71   char *baser;       /* recv base address */
72   int typ;           /* data type */
73   long flags;        /* flags (see below) */
74   long ilen;         /* data item length */
75   long spare[3];     /* spare words */
76 };
77 typedef struct chdr chdr;
78 
79 #define CHDR_1INT 0x01 /* all data items are 1 int */
80 #define CHDR_1DBL 0x02 /* all data items are 1 double */
81 #define CHDR_BASE 0x10 /* setbase called and valid */
82