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