| 1 |
/* f2c.h -- Standard Fortran to C header file */ |
| 2 |
|
| 3 |
/** barf [ba:rf] 2. "He suggested using FORTRAN, and everybody barfed." |
| 4 |
|
| 5 |
- From The Shogakukan DICTIONARY OF NEW ENGLISH (Second edition) */ |
| 6 |
|
| 7 |
#ifndef F2C_INCLUDE |
| 8 |
#define F2C_INCLUDE |
| 9 |
|
| 10 |
/* set integer to int not to long */ |
| 11 |
typedef int integer; |
| 12 |
typedef unsigned int uinteger; |
| 13 |
typedef int logical; |
| 14 |
|
| 15 |
typedef char *address; |
| 16 |
typedef short int shortint; |
| 17 |
typedef float real; |
| 18 |
typedef double doublereal; |
| 19 |
typedef struct { real r, i; } complex; |
| 20 |
typedef struct { doublereal r, i; } doublecomplex; |
| 21 |
typedef short int shortlogical; |
| 22 |
typedef char logical1; |
| 23 |
typedef char integer1; |
| 24 |
#ifdef INTEGER_STAR_8 /* Adjust for integer*8. */ |
| 25 |
typedef long long longint; /* system-dependent */ |
| 26 |
typedef unsigned long long ulongint; /* system-dependent */ |
| 27 |
#define qbit_clear(a,b) ((a) & ~((ulongint)1 << (b))) |
| 28 |
#define qbit_set(a,b) ((a) | ((ulongint)1 << (b))) |
| 29 |
#endif |
| 30 |
|
| 31 |
#define TRUE_ (1) |
| 32 |
#define FALSE_ (0) |
| 33 |
|
| 34 |
/* Extern is for use with -E */ |
| 35 |
#ifndef Extern |
| 36 |
#define Extern extern |
| 37 |
#endif |
| 38 |
|
| 39 |
/* I/O stuff */ |
| 40 |
|
| 41 |
#ifdef f2c_i2 |
| 42 |
/* for -i2 */ |
| 43 |
typedef short flag; |
| 44 |
typedef short ftnlen; |
| 45 |
typedef short ftnint; |
| 46 |
#else |
| 47 |
typedef long int flag; |
| 48 |
typedef long int ftnlen; |
| 49 |
typedef long int ftnint; |
| 50 |
#endif |
| 51 |
|
| 52 |
/*external read, write*/ |
| 53 |
typedef struct |
| 54 |
{ flag cierr; |
| 55 |
ftnint ciunit; |
| 56 |
flag ciend; |
| 57 |
char *cifmt; |
| 58 |
ftnint cirec; |
| 59 |
} cilist; |
| 60 |
|
| 61 |
/*internal read, write*/ |
| 62 |
typedef struct |
| 63 |
{ flag icierr; |
| 64 |
char *iciunit; |
| 65 |
flag iciend; |
| 66 |
char *icifmt; |
| 67 |
ftnint icirlen; |
| 68 |
ftnint icirnum; |
| 69 |
} icilist; |
| 70 |
|
| 71 |
/*open*/ |
| 72 |
typedef struct |
| 73 |
{ flag oerr; |
| 74 |
ftnint ounit; |
| 75 |
char *ofnm; |
| 76 |
ftnlen ofnmlen; |
| 77 |
char *osta; |
| 78 |
char *oacc; |
| 79 |
char *ofm; |
| 80 |
ftnint orl; |
| 81 |
char *oblnk; |
| 82 |
} olist; |
| 83 |
|
| 84 |
/*close*/ |
| 85 |
typedef struct |
| 86 |
{ flag cerr; |
| 87 |
ftnint cunit; |
| 88 |
char *csta; |
| 89 |
} cllist; |
| 90 |
|
| 91 |
/*rewind, backspace, endfile*/ |
| 92 |
typedef struct |
| 93 |
{ flag aerr; |
| 94 |
ftnint aunit; |
| 95 |
} alist; |
| 96 |
|
| 97 |
/* inquire */ |
| 98 |
typedef struct |
| 99 |
{ flag inerr; |
| 100 |
ftnint inunit; |
| 101 |
char *infile; |
| 102 |
ftnlen infilen; |
| 103 |
ftnint *inex; /*parameters in standard's order*/ |
| 104 |
ftnint *inopen; |
| 105 |
ftnint *innum; |
| 106 |
ftnint *innamed; |
| 107 |
char *inname; |
| 108 |
ftnlen innamlen; |
| 109 |
char *inacc; |
| 110 |
ftnlen inacclen; |
| 111 |
char *inseq; |
| 112 |
ftnlen inseqlen; |
| 113 |
char *indir; |
| 114 |
ftnlen indirlen; |
| 115 |
char *infmt; |
| 116 |
ftnlen infmtlen; |
| 117 |
char *inform; |
| 118 |
ftnint informlen; |
| 119 |
char *inunf; |
| 120 |
ftnlen inunflen; |
| 121 |
ftnint *inrecl; |
| 122 |
ftnint *innrec; |
| 123 |
char *inblank; |
| 124 |
ftnlen inblanklen; |
| 125 |
} inlist; |
| 126 |
|
| 127 |
#define VOID void |
| 128 |
|
| 129 |
union Multitype { /* for multiple entry points */ |
| 130 |
integer1 g; |
| 131 |
shortint h; |
| 132 |
integer i; |
| 133 |
/* longint j; */ |
| 134 |
real r; |
| 135 |
doublereal d; |
| 136 |
complex c; |
| 137 |
doublecomplex z; |
| 138 |
}; |
| 139 |
|
| 140 |
typedef union Multitype Multitype; |
| 141 |
|
| 142 |
/*typedef long int Long;*/ /* No longer used; formerly in Namelist */ |
| 143 |
|
| 144 |
struct Vardesc { /* for Namelist */ |
| 145 |
char *name; |
| 146 |
char *addr; |
| 147 |
ftnlen *dims; |
| 148 |
int type; |
| 149 |
}; |
| 150 |
typedef struct Vardesc Vardesc; |
| 151 |
|
| 152 |
struct Namelist { |
| 153 |
char *name; |
| 154 |
Vardesc **vars; |
| 155 |
int nvars; |
| 156 |
}; |
| 157 |
typedef struct Namelist Namelist; |
| 158 |
|
| 159 |
#define abs(x) ((x) >= 0 ? (x) : -(x)) |
| 160 |
#define dabs(x) (doublereal)abs(x) |
| 161 |
#define min(a,b) ((a) <= (b) ? (a) : (b)) |
| 162 |
#define max(a,b) ((a) >= (b) ? (a) : (b)) |
| 163 |
#define dmin(a,b) (doublereal)min(a,b) |
| 164 |
#define dmax(a,b) (doublereal)max(a,b) |
| 165 |
#define bit_test(a,b) ((a) >> (b) & 1) |
| 166 |
#define bit_clear(a,b) ((a) & ~((uinteger)1 << (b))) |
| 167 |
#define bit_set(a,b) ((a) | ((uinteger)1 << (b))) |
| 168 |
|
| 169 |
/* procedure parameter types for -A and -C++ */ |
| 170 |
|
| 171 |
#define F2C_proc_par_types 1 |
| 172 |
#ifdef __cplusplus |
| 173 |
typedef int /* Unknown procedure type */ (*U_fp)(...); |
| 174 |
typedef shortint (*J_fp)(...); |
| 175 |
typedef integer (*I_fp)(...); |
| 176 |
typedef real (*R_fp)(...); |
| 177 |
typedef doublereal (*D_fp)(...), (*E_fp)(...); |
| 178 |
typedef /* Complex */ VOID (*C_fp)(...); |
| 179 |
typedef /* Double Complex */ VOID (*Z_fp)(...); |
| 180 |
typedef logical (*L_fp)(...); |
| 181 |
typedef shortlogical (*K_fp)(...); |
| 182 |
typedef /* Character */ VOID (*H_fp)(...); |
| 183 |
typedef /* Subroutine */ int (*S_fp)(...); |
| 184 |
#else |
| 185 |
typedef int /* Unknown procedure type */ (*U_fp)(); |
| 186 |
typedef shortint (*J_fp)(); |
| 187 |
typedef integer (*I_fp)(); |
| 188 |
typedef real (*R_fp)(); |
| 189 |
typedef doublereal (*D_fp)(), (*E_fp)(); |
| 190 |
typedef /* Complex */ VOID (*C_fp)(); |
| 191 |
typedef /* Double Complex */ VOID (*Z_fp)(); |
| 192 |
typedef logical (*L_fp)(); |
| 193 |
typedef shortlogical (*K_fp)(); |
| 194 |
typedef /* Character */ VOID (*H_fp)(); |
| 195 |
typedef /* Subroutine */ int (*S_fp)(); |
| 196 |
#endif |
| 197 |
/* E_fp is for real functions when -R is not specified */ |
| 198 |
typedef VOID C_f; /* complex function */ |
| 199 |
typedef VOID H_f; /* character function */ |
| 200 |
typedef VOID Z_f; /* double complex function */ |
| 201 |
typedef doublereal E_f; /* real function with -R not specified */ |
| 202 |
|
| 203 |
/* undef any lower-case symbols that your C compiler predefines, e.g.: */ |
| 204 |
|
| 205 |
#ifndef Skip_f2c_Undefs |
| 206 |
#undef cray |
| 207 |
#undef gcos |
| 208 |
#undef mc68010 |
| 209 |
#undef mc68020 |
| 210 |
#undef mips |
| 211 |
#undef pdp11 |
| 212 |
#undef sgi |
| 213 |
#undef sparc |
| 214 |
#undef sun |
| 215 |
#undef sun2 |
| 216 |
#undef sun3 |
| 217 |
#undef sun4 |
| 218 |
#undef u370 |
| 219 |
#undef u3b |
| 220 |
#undef u3b2 |
| 221 |
#undef u3b5 |
| 222 |
#undef unix |
| 223 |
#undef vax |
| 224 |
#endif |
| 225 |
#endif |