RDCode: f2c.h Source File

- Main Page
- Namespaces
- Classes
- Files
- Directories

# f2c.h

Go to the documentation of this file.

    00001 /* f2c.h  --  Standard Fortran to C header file */
    00002
    00003 /**  barf  [ba:rf]  2.  "He suggested using FORTRAN, and everybody barfed."
    00004
    00005         - From The Shogakukan DICTIONARY OF NEW ENGLISH (Second edition) */
    00006
    00007 #ifndef F2C_INCLUDE
    00008 #define F2C_INCLUDE
    00009
    00010 typedef long int integer;
    00011 typedef unsigned long int uinteger;
    00012 typedef char *address;
    00013 typedef short int shortint;
    00014 typedef float real;
    00015 typedef double doublereal;
    00016 typedef struct { real r, i; } complex;
    00017 typedef struct { doublereal r, i; } doublecomplex;
    00018 typedef long int logical;
    00019 typedef short int shortlogical;
    00020 typedef char logical1;
    00021 typedef char integer1;
    00022 #ifdef INTEGER_STAR_8   /* Adjust for integer*8. */
    00023 typedef long long longint;              /* system-dependent */
    00024 typedef unsigned long long ulongint;    /* system-dependent */
    00025 #define qbit_clear(a,b) ((a) & ~((ulongint)1 << (b)))
    00026 #define qbit_set(a,b)   ((a) |  ((ulongint)1 << (b)))
    00027 #endif
    00028
    00029 #define TRUE_ (1)
    00030 #define FALSE_ (0)
    00031
    00032 /* Extern is for use with -E */
    00033 #ifndef Extern
    00034 #define Extern extern
    00035 #endif
    00036
    00037 /* I/O stuff */
    00038
    00039 #ifdef f2c_i2
    00040 /* for -i2 */
    00041 typedef short flag;
    00042 typedef short ftnlen;
    00043 typedef short ftnint;
    00044 #else
    00045 typedef long int flag;
    00046 typedef long int ftnlen;
    00047 typedef long int ftnint;
    00048 #endif
    00049
    00050 /*external read, write*/
    00051 typedef struct
    00052 {       flag cierr;
    00053         ftnint ciunit;
    00054         flag ciend;
    00055         char *cifmt;
    00056         ftnint cirec;
    00057 } cilist;
    00058
    00059 /*internal read, write*/
    00060 typedef struct
    00061 {       flag icierr;
    00062         char *iciunit;
    00063         flag iciend;
    00064         char *icifmt;
    00065         ftnint icirlen;
    00066         ftnint icirnum;
    00067 } icilist;
    00068
    00069 /*open*/
    00070 typedef struct
    00071 {       flag oerr;
    00072         ftnint ounit;
    00073         char *ofnm;
    00074         ftnlen ofnmlen;
    00075         char *osta;
    00076         char *oacc;
    00077         char *ofm;
    00078         ftnint orl;
    00079         char *oblnk;
    00080 } olist;
    00081
    00082 /*close*/
    00083 typedef struct
    00084 {       flag cerr;
    00085         ftnint cunit;
    00086         char *csta;
    00087 } cllist;
    00088
    00089 /*rewind, backspace, endfile*/
    00090 typedef struct
    00091 {       flag aerr;
    00092         ftnint aunit;
    00093 } alist;
    00094
    00095 /* inquire */
    00096 typedef struct
    00097 {       flag inerr;
    00098         ftnint inunit;
    00099         char *infile;
    00100         ftnlen infilen;
    00101         ftnint  *inex;  /*parameters in standard's order*/
    00102         ftnint  *inopen;
    00103         ftnint  *innum;
    00104         ftnint  *innamed;
    00105         char    *inname;
    00106         ftnlen  innamlen;
    00107         char    *inacc;
    00108         ftnlen  inacclen;
    00109         char    *inseq;
    00110         ftnlen  inseqlen;
    00111         char    *indir;
    00112         ftnlen  indirlen;
    00113         char    *infmt;
    00114         ftnlen  infmtlen;
    00115         char    *inform;
    00116         ftnint  informlen;
    00117         char    *inunf;
    00118         ftnlen  inunflen;
    00119         ftnint  *inrecl;
    00120         ftnint  *innrec;
    00121         char    *inblank;
    00122         ftnlen  inblanklen;
    00123 } inlist;
    00124
    00125 #define VOID void
    00126
    00127 union Multitype {       /* for multiple entry points */
    00128         integer1 g;
    00129         shortint h;
    00130         integer i;
    00131         /* longint j; */
    00132         real r;
    00133         doublereal d;
    00134         complex c;
    00135         doublecomplex z;
    00136         };
    00137
    00138 typedef union Multitype Multitype;
    00139
    00140 /*typedef long int Long;*/      /* No longer used; formerly in Namelist */
    00141
    00142 struct Vardesc {        /* for Namelist */
    00143         char *name;
    00144         char *addr;
    00145         ftnlen *dims;
    00146         int  type;
    00147         };
    00148 typedef struct Vardesc Vardesc;
    00149
    00150 struct Namelist {
    00151         char *name;
    00152         Vardesc **vars;
    00153         int nvars;
    00154         };
    00155 typedef struct Namelist Namelist;
    00156
    00157 #define abs(x) ((x) >= 0 ? (x) : -(x))
    00158 #define dabs(x) (doublereal)abs(x)
    00159 #define min(a,b) ((a) <= (b) ? (a) : (b))
    00160 #define max(a,b) ((a) >= (b) ? (a) : (b))
    00161 #define dmin(a,b) (doublereal)min(a,b)
    00162 #define dmax(a,b) (doublereal)max(a,b)
    00163 #define bit_test(a,b)   ((a) >> (b) & 1)
    00164 #define bit_clear(a,b)  ((a) & ~((uinteger)1 << (b)))
    00165 #define bit_set(a,b)    ((a) |  ((uinteger)1 << (b)))
    00166
    00167 /* procedure parameter types for -A and -C++ */
    00168
    00169 #define F2C_proc_par_types 1
    00170 #ifdef __cplusplus
    00171 typedef int /* Unknown procedure type */ (*U_fp)(...);
    00172 typedef shortint (*J_fp)(...);
    00173 typedef integer (*I_fp)(...);
    00174 typedef real (*R_fp)(...);
    00175 typedef doublereal (*D_fp)(...), (*E_fp)(...);
    00176 typedef /* Complex */ VOID (*C_fp)(...);
    00177 typedef /* Double Complex */ VOID (*Z_fp)(...);
    00178 typedef logical (*L_fp)(...);
    00179 typedef shortlogical (*K_fp)(...);
    00180 typedef /* Character */ VOID (*H_fp)(...);
    00181 typedef /* Subroutine */ int (*S_fp)(...);
    00182 #else
    00183 typedef int /* Unknown procedure type */ (*U_fp)();
    00184 typedef shortint (*J_fp)();
    00185 typedef integer (*I_fp)();
    00186 typedef real (*R_fp)();
    00187 typedef doublereal (*D_fp)(), (*E_fp)();
    00188 typedef /* Complex */ VOID (*C_fp)();
    00189 typedef /* Double Complex */ VOID (*Z_fp)();
    00190 typedef logical (*L_fp)();
    00191 typedef shortlogical (*K_fp)();
    00192 typedef /* Character */ VOID (*H_fp)();
    00193 typedef /* Subroutine */ int (*S_fp)();
    00194 #endif
    00195 /* E_fp is for real functions when -R is not specified */
    00196 typedef VOID C_f;       /* complex function */
    00197 typedef VOID H_f;       /* character function */
    00198 typedef VOID Z_f;       /* double complex function */
    00199 typedef doublereal E_f; /* real function with -R not specified */
    00200
    00201 /* undef any lower-case symbols that your C compiler predefines, e.g.: */
    00202
    00203 #ifndef Skip_f2c_Undefs
    00204 #undef cray
    00205 #undef gcos
    00206 #undef mc68010
    00207 #undef mc68020
    00208 #undef mips
    00209 #undef pdp11
    00210 #undef sgi
    00211 #undef sparc
    00212 #undef sun
    00213 #undef sun2
    00214 #undef sun3
    00215 #undef sun4
    00216 #undef u370
    00217 #undef u3b
    00218 #undef u3b2
    00219 #undef u3b5
    00220 #undef unix
    00221 #undef vax
    00222 #endif
    00223 #endif