f2c.h 4.8 KB

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