comparison ext/clapack/include/f2c.h @ 430:335af74a25b6

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