1 /* 2 * Copyright (c) 1995-2019, 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 - runtime Data type code definitions 21 */ 22 23 #ifndef _PGHPF_TYPES_H_ 24 #define _PGHPF_TYPES_H_ 25 26 /** \typedef _DIST_TYPE 27 * 28 * \brief Data type codes. 29 * 30 * These must correspond to the compiler's codes. 31 * 32 * Any changes to the intrinsic types must get reflected in the 33 * F2003 type descriptors defined in type.c (see I8(__f03_ty_to_id)[] array). 34 * (see also \ref __NTYPES below). 35 */ 36 typedef enum { 37 __NONE = 0, /**< no type (absent optional argument) */ 38 __SHORT = 1, /**< C signed short */ 39 __USHORT = 2, /**< C unsigned short */ 40 __CINT = 3, /**< C signed int */ 41 __UINT = 4, /**< C unsigned int */ 42 __LONG = 5, /**< C signed long int */ 43 __ULONG = 6, /**< C unsigned long int */ 44 __FLOAT = 7, /**< C float */ 45 __DOUBLE = 8, /**< C double */ 46 __CPLX8 = 9, /**< Fortran complex*8 (2x real*4) */ 47 __CPLX16 = 10, /**< Fortran complex*16 (2x real*8) */ 48 __CHAR = 11, /**< C signed char */ 49 __UCHAR = 12, /**< C unsigned char */ 50 __LONGDOUBLE = 13, /**< C long double */ 51 __STR = 14, /**< Fortran character */ 52 __LONGLONG = 15, /**< C long long */ 53 __ULONGLONG = 16, /**< C unsigned long long */ 54 __LOG1 = 17, /**< Fortran logical*1 */ 55 __LOG2 = 18, /**< Fortran logical*2 */ 56 __LOG4 = 19, /**< Fortran logical*4 */ 57 __LOG8 = 20, /**< Fortran logical*8 */ 58 __WORD4 = 21, /**< Fortran typeless */ 59 __WORD8 = 22, /**< Fortran double typeless */ 60 __NCHAR = 23, /**< Fortran ncharacter - kanji */ 61 62 __INT2 = 24, /**< Fortran integer*2 */ 63 __INT4 = 25, /**< Fortran integer*4, integer */ 64 __INT8 = 26, /**< Fortran integer*8 */ 65 __REAL2 = 45, /**< Fortran real*2, half */ 66 __REAL4 = 27, /**< Fortran real*4, real */ 67 __REAL8 = 28, /**< Fortran real*8, double precision */ 68 __REAL16 = 29, /**< Fortran real*16 */ 69 __CPLX32 = 30, /**< Fortran complex*32 (2x real*16) */ 70 __WORD16 = 31, /**< Fortran quad typeless */ 71 __INT1 = 32, /**< Fortran integer*1 */ 72 __DERIVED = 33, /**< Fortran derived-type */ 73 74 /* runtime descriptor types (not scalar data types) */ 75 __PROC = 34, /**< processors descriptor */ 76 __DESC = 35, /**< template/array/section descriptor */ 77 __SKED = 36, /**< communication schedule */ 78 79 __M128 = 37, /**< 128-bit type */ 80 __M256 = 38, /**< 256-bit type */ 81 __INT16 = 39, /**< Fortran integer(16) */ 82 __LOG16 = 40, /**< Fortran logical(16) */ 83 __QREAL16 = 41, /**< Fortran real(16) */ 84 __QCPLX32 = 42, /**< Fortran complex(32) */ 85 __POLY = 43, /**< Fortran polymorphic variable */ 86 __PROCPTR = 44, /**< Fortran Procedure Ptr Descriptor */ 87 88 /** \def __NTYPES 89 * 90 * Number of data types (for sizing arrays). This used to be the 91 * number of scalar data types for. Unfortunately, the values of the 92 * runtime descriptor types cannot change. Therefore, new values will 93 * be added after any current values. 94 */ 95 #define __NTYPES 46 96 97 } _DIST_TYPE; 98 99 /* typedefs for all of the scalar data types. Arbitrary substitutions 100 are made where the C compiler doesn't support an equivalent type. 101 The compiler promises not to generate those types unless the C 102 compiler also supports them. typedefs ending in _UT are unsigned 103 versions of the corresponding Fortran _T type (they don't have a 104 separate enumeration.) */ 105 106 typedef short __SHORT_T; /* 1 __SHORT signed short */ 107 108 typedef unsigned short __USHORT_T; /* 2 __USHORT unsigned short */ 109 110 typedef int __CINT_T; /* 3 __CINT C signed int */ 111 112 typedef unsigned int __UINT_T; /* 4 __UINT unsigned int */ 113 114 typedef long __LONG_T; /* 5 __LONG signed long int */ 115 116 typedef unsigned long __ULONG_T; /* 6 __ULONG unsigned long int */ 117 118 typedef float __FLOAT_T; /* 7 __FLOAT float */ 119 120 typedef double __DOUBLE_T; /* 8 __DOUBLE double */ 121 122 typedef char __CHAR_T; /* 11 __CHAR signed char */ 123 124 typedef unsigned char __UCHAR_T; /* 12 __UCHAR unsigned char */ 125 126 typedef double __LONGDOUBLE_T; /* 13 __LONGDOUBLE long double */ 127 128 typedef char __STR_T; /* 14 __STR character */ 129 130 typedef long long __LONGLONG_T; /* 15 __LONGLONG long long */ 131 typedef unsigned long long 132 __ULONGLONG_T; /* 16 __ULONGLONG unsigned long long */ 133 134 typedef signed char __LOG1_T; /* 17 __LOG1 logical*1 */ 135 typedef short __LOG2_T; /* 18 __LOG2 logical*2 */ 136 137 typedef int __LOG4_T; /* 19 __LOG4 logical*4 */ 138 139 typedef long long __LOG8_T; /* 20 __LOG8 logical*8 */ 140 141 /* lfm -- these two are wrong, hopefully not used */ 142 typedef int __WORD4_T; /* 21 __WORD4 typeless */ 143 144 typedef double __WORD8_T; /* 22 __WORD8 double typeless */ 145 146 typedef short __NCHAR_T; /* 23 __NCHAR ncharacter - kanji */ 147 typedef short __INT2_T; /* 24 __INT2 integer*2 */ 148 typedef unsigned short __INT2_UT; 149 150 typedef int __INT4_T; /* 25 __INT4 integer*4 */ 151 typedef unsigned int __INT4_UT; 152 153 typedef long __INT8_T; /* 26 __INT8 integer*8 */ 154 typedef unsigned long __INT8_UT; 155 156 typedef unsigned short __REAL2_T; /* 45 __REAL2 real*2 */ 157 158 typedef float __REAL4_T; /* 27 __REAL4 real*4 */ 159 160 typedef double __REAL8_T; /* 28 __REAL8 real*8 */ 161 162 typedef double __REAL16_T; /* 29 __REAL16 real*16 */ 163 164 typedef struct { 165 __REAL4_T r, i; 166 } __CPLX8_T; /* 9 __CPLX8 complex*8 */ 167 168 typedef struct { 169 __REAL8_T r, i; 170 } __CPLX16_T; /* 10 __CPLX16 complex*16 */ 171 172 typedef struct { 173 __REAL16_T r, i; 174 } __CPLX32_T; /* 30 __CPLX32 complex*32 */ 175 176 typedef double __WORD16_T; /* 31 __WORD16 quad typeless */ 177 178 typedef signed char __INT1_T; /* 32 __INT1 integer*1 */ 179 typedef unsigned char __INT1_UT; 180 181 typedef char __DERIVED_T; /* 33 __DERIVED derived type */ 182 183 typedef char __PROC_T; /* 34 __PROC */ 184 185 typedef char __DESC_T; /* 35 __DESC */ 186 187 typedef char __SKED_T; /* 36 __SKED */ 188 189 typedef char __POLY_T; /* 43 __POLY polymorphic derived type */ 190 191 typedef char __PROCPTR_T; /* 44 __PROCPTR */ 192 193 /* double and quad type component views */ 194 195 typedef union { 196 __REAL8_T d; 197 __INT8_T ll; 198 struct { 199 __INT4_T l, h; 200 } i; 201 } __REAL8_SPLIT; 202 203 typedef union { 204 __REAL16_T q; 205 struct { 206 __INT8_T l, h; 207 } ll; 208 struct { 209 __INT4_T l, k, j, h; 210 } i; 211 } __REAL16_SPLIT; 212 213 /* default fortran types (type you get if you just say integer, real, 214 etc. */ 215 216 #if defined(C90) || defined(T3D) || defined(T3E64) 217 #define __INT __INT8 218 #define __LOG __LOG8 219 #define __REAL __REAL8 220 #define __DBLE __REAL16 221 #define __CPLX __CPLX16 222 #define __DCPLX __CPLX32 223 typedef __INT8_T __INT_T; 224 typedef __INT8_T __STAT_T; 225 typedef __INT8_UT __INT_UT; 226 typedef __LOG8_T __LOG_T; 227 typedef __REAL8_T __REAL_T; 228 typedef __REAL16_T __DBLE_T; 229 typedef __CPLX16_T __CPLX_T; 230 typedef __CPLX32_T __DCPLX_T; 231 232 #else 233 234 #define __INT __INT4 235 #define __LOG __LOG4 236 #if defined(DESC_I8) 237 typedef __INT8_T __INT_T; 238 #else 239 typedef __INT4_T __INT_T; 240 #endif 241 typedef __INT4_T __STAT_T; 242 typedef __INT4_UT __INT_UT; 243 typedef __LOG4_T __LOG_T; 244 245 #define __REAL __REAL4 246 #define __DBLE __REAL8 247 #define __CPLX __CPLX8 248 #define __DCPLX __CPLX16 249 typedef __REAL4_T __REAL_T; 250 typedef __REAL8_T __DBLE_T; 251 typedef __CPLX8_T __CPLX_T; 252 typedef __CPLX16_T __DCPLX_T; 253 #endif 254 255 /* __BIG's are defined to hold the biggest integer or floating point value 256 * likely to be seen during list-directed/namelist/fmt read 257 * 258 * NOTE: changes here may require changes in format.h for BIGREALs 259 * 260 * BIGREAL_IS_LONGDOUBLE is used to decide between %f and %Lf in 261 * debug print statements. This is dependent on definition of underlying 262 * c type used in pghpft.h 263 */ 264 265 #define __BIGINT __INT4 266 #define __BIGLOG __LOG4 267 typedef __INT4_T __BIGINT_T; 268 typedef __LOG4_T __BIGLOG_T; 269 270 #define __BIGREAL __REAL8 271 #define __BIGCPLX __CPLX16 272 typedef __REAL8_T __BIGREAL_T; 273 typedef __CPLX16_T __BIGCPLX_T; 274 #define BIGREAL_IS_LONGDOUBLE 0 275 276 /* pointer-sized integer */ 277 278 #if defined(WIN64) 279 280 typedef long long __POINT_T; 281 282 /** \def POINT(type, name) 283 * \brief Pointer macro 284 */ 285 #define POINT(type, name) type *name 286 287 #else 288 289 typedef __LONG_T __POINT_T; 290 /** \def POINT(type, name) 291 * \brief Pointer macro 292 */ 293 #define POINT(type, name) type *name 294 295 #endif 296 297 #define Is_complex(parm) ((parm) == __CPLX8 || (parm) == __CPLX16) 298 #define Is_real(parm) ((parm) == __REAL8 || (parm) == __REAL16) 299 300 #define REAL_ALLOWED(param) ((Is_complex(param)) || Is_real(param)) 301 302 /* data type code */ 303 304 typedef __INT_T dtype; 305 306 307 /* 308 * data type representing the number of elements passed to 309 * ENTF90(ALLOC04, alloc04), etc. 310 */ 311 312 #define __NELEM_T __INT8_T 313 314 #endif /*_PGHPF_TYPES_H_*/ 315