home *** CD-ROM | disk | FTP | other *** search
/ Photo CD Demo 1 / Demo.bin / gle / gle / f2c.h < prev    next >
C/C++ Source or Header  |  1992-11-29  |  4KB  |  225 lines

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