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