1 /****************************************************************************** 2 * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other 3 * HYPRE Project Developers. See the top-level COPYRIGHT file for details. 4 * 5 * SPDX-License-Identifier: (Apache-2.0 OR MIT) 6 ******************************************************************************/ 7 8 /* f2c.h -- Standard Fortran to C header file */ 9 10 /** barf [ba:rf] 2. "He suggested using FORTRAN, and everybody barfed." 11 12 - From The Shogakukan DICTIONARY OF NEW ENGLISH (Second edition) */ 13 14 #ifndef F2C_INCLUDE 15 #define F2C_INCLUDE 16 17 /* MPI is not needed here, so don't include mpi.h */ 18 #include "HYPRE_config.h" 19 #ifndef HYPRE_SEQUENTIAL 20 #define HYPRE_SEQUENTIAL 21 #endif 22 #include "_hypre_utilities.h" 23 #include "math.h" 24 25 #if defined(HYPRE_SINGLE) 26 #define sqrt sqrtf 27 #elif defined(HYPRE_LONG_DOUBLE) 28 #define sqrt sqrtl 29 #endif 30 31 #ifdef HYPRE_BIGINT 32 typedef long long int HYPRE_LongInt; 33 typedef unsigned long long int HYPRE_ULongInt; 34 #else 35 typedef long int HYPRE_LongInt; 36 typedef unsigned long int HYPRE_ULongInt; 37 #endif 38 39 /* F2C_INTEGER will normally be `HYPRE_Int' but would be `long' on 16-bit systems */ 40 /* we assume short, float are OK */ 41 42 /* integer changed to HYPRE_Int - edmond 1/12/00 */ 43 44 typedef HYPRE_Int integer; 45 typedef HYPRE_ULongInt uinteger; 46 typedef char *address; 47 typedef short int shortint; 48 typedef float real; 49 typedef HYPRE_Real doublereal; 50 typedef struct { real r, i; } complex; 51 typedef struct { doublereal r, i; } doublecomplex; 52 typedef HYPRE_LongInt logical; 53 typedef short int shortlogical; 54 typedef char logical1; 55 typedef char integer1; 56 /* integer*8 support from f2c not currently supported: */ 57 #if 0 58 typedef @F2C_LONGINT@ /* long long */ longint; /* system-dependent */ 59 typedef unsigned @F2C_LONGINT@ ulongint; /* system-dependent */ 60 #define qbit_clear(a,b) ((a) & ~((ulongint)1 << (b))) 61 #define qbit_set(a,b) ((a) | ((ulongint)1 << (b))) 62 #endif 63 /* typedef long long HYPRE_Int longint; */ /* RDF: removed */ 64 65 #define TRUE_ (1) 66 #define FALSE_ (0) 67 68 /* Extern is for use with -E */ 69 #ifndef Extern 70 #define Extern extern 71 #endif 72 73 /* I/O stuff */ 74 75 #ifdef f2c_i2 76 #error f2c_i2 will not work with g77!!!! 77 /* for -i2 */ 78 typedef short flag; 79 typedef short ftnlen; 80 typedef short ftnint; 81 #else 82 typedef HYPRE_LongInt /* HYPRE_Int or long HYPRE_Int */ flag; 83 typedef HYPRE_Int /* HYPRE_Int or long HYPRE_Int */ ftnlen; /* changed by edmond */ 84 typedef HYPRE_LongInt /* HYPRE_Int or long HYPRE_Int */ ftnint; 85 #endif 86 87 /*external read, write*/ 88 typedef struct 89 { flag cierr; 90 ftnint ciunit; 91 flag ciend; 92 char *cifmt; 93 ftnint cirec; 94 } cilist; 95 96 /*internal read, write*/ 97 typedef struct 98 { flag icierr; 99 char *iciunit; 100 flag iciend; 101 char *icifmt; 102 ftnint icirlen; 103 ftnint icirnum; 104 } icilist; 105 106 /*open*/ 107 typedef struct 108 { flag oerr; 109 ftnint ounit; 110 char *ofnm; 111 ftnlen ofnmlen; 112 char *osta; 113 char *oacc; 114 char *ofm; 115 ftnint orl; 116 char *oblnk; 117 } olist; 118 119 /*close*/ 120 typedef struct 121 { flag cerr; 122 ftnint cunit; 123 char *csta; 124 } cllist; 125 126 /*rewind, backspace, endfile*/ 127 typedef struct 128 { flag aerr; 129 ftnint aunit; 130 } alist; 131 132 /* inquire */ 133 typedef struct 134 { flag inerr; 135 ftnint inunit; 136 char *infile; 137 ftnlen infilen; 138 ftnint *inex; /*parameters in standard's order*/ 139 ftnint *inopen; 140 ftnint *innum; 141 ftnint *innamed; 142 char *inname; 143 ftnlen innamlen; 144 char *inacc; 145 ftnlen inacclen; 146 char *inseq; 147 ftnlen inseqlen; 148 char *indir; 149 ftnlen indirlen; 150 char *infmt; 151 ftnlen infmtlen; 152 char *inform; 153 ftnint informlen; 154 char *inunf; 155 ftnlen inunflen; 156 ftnint *inrecl; 157 ftnint *innrec; 158 char *inblank; 159 ftnlen inblanklen; 160 } inlist; 161 162 #define VOID void 163 164 union Multitype { /* for multiple entry points */ 165 integer1 g; 166 shortint h; 167 integer i; 168 /* longint j; */ 169 real r; 170 doublereal d; 171 complex c; 172 doublecomplex z; 173 }; 174 175 typedef union Multitype Multitype; 176 177 /*typedef long HYPRE_Int Long;*/ /* No longer used; formerly in Namelist */ 178 179 struct Vardesc { /* for Namelist */ 180 char *name; 181 char *addr; 182 ftnlen *dims; 183 HYPRE_Int type; 184 }; 185 typedef struct Vardesc Vardesc; 186 187 struct Namelist { 188 char *name; 189 Vardesc **vars; 190 HYPRE_Int nvars; 191 }; 192 typedef struct Namelist Namelist; 193 194 /* The following undefs are to prevent conflicts with external libraries */ 195 #undef abs 196 #define abs(x) ((x) >= 0 ? (x) : -(x)) 197 #define dabs(x) (doublereal)abs(x) 198 #ifndef min 199 #define min(a,b) ((a) <= (b) ? (a) : (b)) 200 #define max(a,b) ((a) >= (b) ? (a) : (b)) 201 #endif 202 #define dmin(a,b) (doublereal)min(a,b) 203 #define dmax(a,b) (doublereal)max(a,b) 204 #define bit_test(a,b) ((a) >> (b) & 1) 205 #define bit_clear(a,b) ((a) & ~((uinteger)1 << (b))) 206 #define bit_set(a,b) ((a) | ((uinteger)1 << (b))) 207 208 /* procedure parameter types for -A and -C++ */ 209 210 #define F2C_proc_par_types 1 211 #ifdef __cplusplus 212 typedef HYPRE_Int /* Unknown procedure type */ (*U_fp)(...); 213 typedef shortint (*J_fp)(...); 214 typedef integer (*I_fp)(...); 215 typedef real (*R_fp)(...); 216 typedef doublereal (*D_fp)(...), (*E_fp)(...); 217 typedef /* Complex */ VOID (*C_fp)(...); 218 typedef /* Double Complex */ VOID (*Z_fp)(...); 219 typedef logical (*L_fp)(...); 220 typedef shortlogical (*K_fp)(...); 221 typedef /* Character */ VOID (*H_fp)(...); 222 typedef /* Subroutine */ HYPRE_Int (*S_fp)(...); 223 #else 224 typedef HYPRE_Int /* Unknown procedure type */ (*U_fp)(); 225 typedef shortint (*J_fp)(); 226 typedef integer (*I_fp)(); 227 typedef real (*R_fp)(); 228 typedef doublereal (*D_fp)(), (*E_fp)(); 229 typedef /* Complex */ VOID (*C_fp)(); 230 typedef /* Double Complex */ VOID (*Z_fp)(); 231 typedef logical (*L_fp)(); 232 typedef shortlogical (*K_fp)(); 233 typedef /* Character */ VOID (*H_fp)(); 234 typedef /* Subroutine */ HYPRE_Int (*S_fp)(); 235 #endif 236 /* E_fp is for real functions when -R is not specified */ 237 typedef VOID C_f; /* complex function */ 238 typedef VOID H_f; /* character function */ 239 typedef VOID Z_f; /* HYPRE_Real complex function */ 240 typedef doublereal E_f; /* real function with -R not specified */ 241 242 /* undef any lower-case symbols that your C compiler predefines, e.g.: */ 243 244 #ifndef Skip_f2c_Undefs 245 /* (No such symbols should be defined in a strict ANSI C compiler. 246 We can avoid trouble with f2c-translated code by using 247 gcc -ansi [-traditional].) */ 248 #undef cray 249 #undef gcos 250 #undef mc68010 251 #undef mc68020 252 #undef mips 253 #undef pdp11 254 #undef sgi 255 #undef sparc 256 #undef sun 257 #undef sun2 258 #undef sun3 259 #undef sun4 260 #undef u370 261 #undef u3b 262 #undef u3b2 263 #undef u3b5 264 #undef unix 265 #undef vax 266 #endif 267 #endif 268