synaps/base/f2c.h

00001 /*
00002 // NOTE: this is a modified file of f2c.h to work with most C++ compilers.
00003 //       f2c.h for example, defines abs() as a macro, casuing parsing
00004 //       problems when it encounters abs() in stdlib.h, and so on.
00005 //       It is needed in Lapack++ because some of the C/Lapack functions, like
00006 //       ilaenv_(), need to know what ftn_len is (system dependent.)
00007 //
00008 //       pow_ri() has been removed, since it collides with
00009 //       sunmath.h on SUN4s.
00010 //
00011 //        "typedef float real" has been removed, due to conflict with
00012 //        AT&T CC with real() for complex.
00013 //
00014 //        "typedef ... complex" has been renamed to f2c_complex to
00015 //        avoid conflicts with C++ complex class.
00016 */
00017 
00018 /* f2c.h  --  Standard Fortran to C header file */
00019 
00020 #ifndef SYNAPS_UTIL_F2C_INCLUDE
00021 #define SYNAPS_UTIL_F2C_INCLUDE
00022 
00023 typedef long int integer;
00024 typedef unsigned long int uinteger;
00025 typedef char *address;
00026 typedef short int shortint;
00027 typedef float f2c_real;
00028 typedef double doublereal;
00029 typedef struct { f2c_real r, i; } f2c_complex;
00030 typedef struct { doublereal r, i; } doublecomplex;
00031 typedef long int logical;
00032 typedef short int shortlogical;
00033 
00034 #define TRUE_ (1)
00035 #define FALSE_ (0)
00036 
00037 /* Extern is for use with -E */
00038 #ifndef Extern
00039 #define Extern extern
00040 #endif
00041 
00042 extern int ungetc();    /* This is not declared in Sun's <stdio.h> */
00043 
00044 /* I/O stuff */
00045 
00046 #ifdef f2c_i2
00047 /* for -i2 */
00048 typedef short flag;
00049 typedef short ftnlen;
00050 typedef short ftnint;
00051 #else
00052 typedef long flag;
00053 typedef long ftnlen;
00054 typedef long ftnint;
00055 #endif
00056 
00057 /*external read, write*/
00058 typedef struct
00059 {   flag cierr;
00060     ftnint ciunit;
00061     flag ciend;
00062     char *cifmt;
00063     ftnint cirec;
00064 } cilist;
00065 
00066 /*internal read, write*/
00067 typedef struct
00068 {   flag icierr;
00069     char *iciunit;
00070     flag iciend;
00071     char *icifmt;
00072     ftnint icirlen;
00073     ftnint icirnum;
00074 } icilist;
00075 
00076 /*open*/
00077 typedef struct
00078 {   flag oerr;
00079     ftnint ounit;
00080     char *ofnm;
00081     ftnlen ofnmlen;
00082     char *osta;
00083     char *oacc;
00084     char *ofm;
00085     ftnint orl;
00086     char *oblnk;
00087 } olist;
00088 
00089 /*close*/
00090 typedef struct
00091 {   flag cerr;
00092     ftnint cunit;
00093     char *csta;
00094 } cllist;
00095 
00096 /*rewind, backspace, endfile*/
00097 typedef struct
00098 {   flag aerr;
00099     ftnint aunit;
00100 } alist;
00101 
00102 /* inquire */
00103 typedef struct
00104 {   flag inerr;
00105     ftnint inunit;
00106     char *infile;
00107     ftnlen infilen;
00108     ftnint  *inex;  /*parameters in standard's order*/
00109     ftnint  *inopen;
00110     ftnint  *innum;
00111     ftnint  *innamed;
00112     char    *inname;
00113     ftnlen  innamlen;
00114     char    *inacc;
00115     ftnlen  inacclen;
00116     char    *inseq;
00117     ftnlen  inseqlen;
00118     char    *indir;
00119     ftnlen  indirlen;
00120     char    *infmt;
00121     ftnlen  infmtlen;
00122     char    *inform;
00123     ftnint  informlen;
00124     char    *inunf;
00125     ftnlen  inunflen;
00126     ftnint  *inrecl;
00127     ftnint  *innrec;
00128     char    *inblank;
00129     ftnlen  inblanklen;
00130 } inlist;
00131 
00132 #define VOID void
00133 
00134 union Multitype {   /* for multiple entry points */
00135     shortint h;
00136     integer i;
00137     f2c_real r;
00138     doublereal d;
00139     f2c_complex c;
00140     doublecomplex z;
00141     };
00142 
00143 typedef union Multitype Multitype;
00144 
00145 typedef long Long;  /* No longer used; formerly in Namelist */
00146 
00147 struct Vardesc {    /* for Namelist */
00148     char *name;
00149     char *addr;
00150     ftnlen *dims;
00151     int  type;
00152     };
00153 typedef struct Vardesc Vardesc;
00154 
00155 struct Namelist {
00156     char *name;
00157     Vardesc **vars;
00158     int nvars;
00159     };
00160 typedef struct Namelist Namelist;
00161 
00162 /* #define abs(x) ((x) >= 0 ? (x) : -(x)) */
00163 #define dabs(x) (doublereal)abs(x)
00164 
00165 //#ifndef min
00166 //#define min(a,b) ((a) <= (b) ? (a) : (b))
00167 //#endif
00168 //#define max(a,b) ((a) >= (b) ? (a) : (b))
00169 #define dmin(a,b) (doublereal)min(a,b)
00170 #define dmax(a,b) (doublereal)max(a,b)
00171 
00172 /* procedure parameter types for -A and -C++ */
00173 
00174 #define F2C_proc_par_ts 1
00175 #ifdef __cplusplus
00176 typedef int /* Unknown procedure type */ (*U_fp)(...);
00177 typedef shortint (*J_fp)(...);
00178 typedef integer (*I_fp)(...);
00179 typedef f2c_real (*R_fp)(...);
00180 typedef doublereal (*D_fp)(...), (*E_fp)(...);
00181 typedef /* Complex */ VOID (*C_fp)(...);
00182 typedef /* Double Complex */ VOID (*Z_fp)(...);
00183 typedef logical (*L_fp)(...);
00184 typedef shortlogical (*K_fp)(...);
00185 typedef /* Character */ VOID (*H_fp)(...);
00186 typedef /* Subroutine */ int (*S_fp)(...);
00187 #else
00188 typedef int /* Unknown procedure type */ (*U_fp)();
00189 typedef shortint (*J_fp)();
00190 typedef integer (*I_fp)();
00191 typedef f2c_real (*R_fp)();
00192 typedef doublereal (*D_fp)(), (*E_fp)();
00193 typedef /* Complex */ VOID (*C_fp)();
00194 typedef /* Double Complex */ VOID (*Z_fp)();
00195 typedef logical (*L_fp)();
00196 typedef shortlogical (*K_fp)();
00197 typedef /* Character */ VOID (*H_fp)();
00198 typedef /* Subroutine */ int (*S_fp)();
00199 #endif
00200 /* E_fp is for real functions when -R is not let */
00201 typedef VOID C_f;   /* (single precision ) complex function */
00202 typedef VOID H_f;   /* character function */
00203 typedef VOID Z_f;   /* double complex function */
00204 typedef doublereal E_f; /* real function with -R not let */
00205 
00206 /* undef any lower-case symbols that your C compiler predefines, e.g.: */
00207 
00208 #ifndef Skip_f2c_Undefs
00209 #undef cray
00210 #undef gcos
00211 #undef mc68010
00212 #undef mc68020
00213 #undef mips
00214 #undef pdp11
00215 #undef sgi
00216 #undef sparc
00217 #undef sun
00218 #undef sun2
00219 #undef sun3
00220 #undef sun4
00221 #undef u370
00222 #undef u3b
00223 #undef u3b2
00224 #undef u3b5
00225 #undef unix
00226 #undef vax
00227 #endif
00228 #endif
00229 
00230 
00231 /* If you are using a C++ compiler, append the following to f2c.h
00232    for compiling libF77 and libI77. */
00233 
00234 #ifdef __cplusplus
00235 
00236 extern "C" {
00237 extern int abort_(void);
00238 extern double c_abs(f2c_complex *);
00239 extern void c_cos(f2c_complex *, f2c_complex *);
00240 extern void c_div(f2c_complex *, f2c_complex *, f2c_complex *);
00241 extern void c_exp(f2c_complex *, f2c_complex *);
00242 extern void c_log(f2c_complex *, f2c_complex *);
00243 extern void c_sin(f2c_complex *, f2c_complex *);
00244 extern void c_sqrt(f2c_complex *, f2c_complex *);
00245 extern double d_abs(double *);
00246 extern double d_acos(double *);
00247 extern double d_asin(double *);
00248 extern double d_atan(double *);
00249 extern double d_atn2(double *, double *);
00250 extern void d_cnjg(doublecomplex *, doublecomplex *);
00251 extern double d_cos(double *);
00252 extern double d_cosh(double *);
00253 extern double d_dim(double *, double *);
00254 extern double d_exp(double *);
00255 extern double d_imag(doublecomplex *);
00256 extern double d_int(double *);
00257 extern double d_lg10(double *);
00258 extern double d_log(double *);
00259 extern double d_mod(double *, double *);
00260 extern double d_nint(double *);
00261 extern double d_prod(float *, float *);
00262 extern double d_sign(double *, double *);
00263 extern double d_sin(double *);
00264 extern double d_sinh(double *);
00265 extern double d_sqrt(double *);
00266 extern double d_tan(double *);
00267 extern double d_tanh(double *);
00268 extern double derf_(double *);
00269 extern double derfc_(double *);
00270   extern integer do_fio(ftnint *, char *, ftnlen);
00271 extern integer do_lio(ftnint *, ftnint *, char *, ftnlen);
00272 extern integer do_uio(ftnint *, char *, ftnlen);
00273 extern integer e_rdfe(void);
00274 extern integer e_rdue(void);
00275 extern integer e_rsfe(void);
00276 extern integer e_rsfi(void);
00277 extern integer e_rsle(void);
00278 extern integer e_rsli(void);
00279 extern integer e_rsue(void);
00280 extern integer e_wdfe(void);
00281 extern integer e_wdue(void);
00282   extern integer e_wsfe(void);
00283 extern integer e_wsfi(void);
00284 extern integer e_wsle(void);
00285 extern integer e_wsli(void);
00286 extern integer e_wsue(void);
00287 extern int ef1asc_(ftnint *, ftnlen *, ftnint *, ftnlen *);
00288 extern integer ef1cmc_(ftnint *, ftnlen *, ftnint *, ftnlen *);
00289 extern double erf(double);
00290 extern double erf_(float *);
00291 extern double erfc(double);
00292 extern double erfc_(float *);
00293 extern integer f_back(alist *);
00294 extern integer f_clos(cllist *);
00295 extern integer f_end(alist *);
00296 extern void f_exit(void);
00297 extern integer f_inqu(inlist *);
00298 extern integer f_open(olist *);
00299 extern integer f_rew(alist *);
00300 extern int flush_(void);
00301 extern void getarg_(integer *, char *, ftnlen);
00302 extern void getenv_(char *, char *, ftnlen, ftnlen);
00303 extern short h_abs(short *);
00304 extern short h_dim(short *, short *);
00305 extern short h_dnnt(double *);
00306 extern short h_indx(char *, char *, ftnlen, ftnlen);
00307 extern short h_len(char *, ftnlen);
00308 extern short h_mod(short *, short *);
00309 extern short h_nint(float *);
00310 extern short h_sign(short *, short *);
00311 extern short hl_ge(char *, char *, ftnlen, ftnlen);
00312 extern short hl_gt(char *, char *, ftnlen, ftnlen);
00313 extern short hl_le(char *, char *, ftnlen, ftnlen);
00314 extern short hl_lt(char *, char *, ftnlen, ftnlen);
00315 extern integer i_abs(integer *);
00316 extern integer i_dim(integer *, integer *);
00317 extern integer i_dnnt(double *);
00318 extern integer i_indx(char *, char *, ftnlen, ftnlen);
00319 extern integer i_len(char *, ftnlen);
00320 extern integer i_mod(integer *, integer *);
00321 extern integer i_nint(float *);
00322 extern integer i_sign(integer *, integer *);
00323 extern integer iargc_(void);
00324 extern ftnlen l_ge(char *, char *, ftnlen, ftnlen);
00325 extern ftnlen l_gt(char *, char *, ftnlen, ftnlen);
00326 extern ftnlen l_le(char *, char *, ftnlen, ftnlen);
00327 extern ftnlen l_lt(char *, char *, ftnlen, ftnlen);
00328 extern void pow_ci(f2c_complex *, f2c_complex *, integer *);
00329 extern double pow_dd(double *, double *);
00330 extern double pow_di(double *, integer *);
00331 extern short pow_hh(short *, shortint *);
00332 extern integer pow_ii(integer *, integer *);
00333 /* extern double pow_ri(float *, integer *); */
00334 extern void pow_zi(doublecomplex *, doublecomplex *, integer *);
00335 extern void pow_zz(doublecomplex *, doublecomplex *, doublecomplex *);
00336 extern double r_abs(float *);
00337 extern double r_acos(float *);
00338 extern double r_asin(float *);
00339 extern double r_atan(float *);
00340 extern double r_atn2(float *, float *);
00341 extern void r_cnjg(f2c_complex *, f2c_complex *);
00342 extern double r_cos(float *);
00343 extern double r_cosh(float *);
00344 extern double r_dim(float *, float *);
00345 extern double r_exp(float *);
00346 extern double r_imag(f2c_complex *);
00347 extern double r_int(float *);
00348 extern double r_lg10(float *);
00349 extern double r_log(float *);
00350 extern double r_mod(float *, float *);
00351 extern double r_nint(float *);
00352 extern double r_sign(float *, float *);
00353 extern double r_sin(float *);
00354 extern double r_sinh(float *);
00355 extern double r_sqrt(float *);
00356 extern double r_tan(float *);
00357 extern double r_tanh(float *);
00358 extern void s_cat(char *, char **, integer *, integer *, ftnlen);
00359 extern integer s_cmp(char *, char *, ftnlen, ftnlen);
00360 extern void s_copy(char *, char *, ftnlen, ftnlen);
00361 extern int s_paus(char *, ftnlen);
00362 extern integer s_rdfe(cilist *);
00363 extern integer s_rdue(cilist *);
00364 extern integer s_rnge(char *, integer, char *, integer);
00365 extern integer s_rsfe(cilist *);
00366 extern integer s_rsfi(icilist *);
00367 extern integer s_rsle(cilist *);
00368 extern integer s_rsli(icilist *);
00369 extern integer s_rsne(cilist *);
00370 extern integer s_rsni(icilist *);
00371 extern integer s_rsue(cilist *);
00372   extern int s_stop(char *, ftnlen);
00373 extern integer s_wdfe(cilist *);
00374 extern integer s_wdue(cilist *);
00375   extern integer s_wsfe(cilist *);
00376   extern integer s_wsfi(icilist *);
00377 extern integer s_wsle(cilist *);
00378 extern integer s_wsli(icilist *);
00379 extern integer s_wsne(cilist *);
00380 extern integer s_wsni(icilist *);
00381 extern integer s_wsue(cilist *);
00382 extern void sig_die(char *, int);
00383 extern integer signal_(integer *, void (*)(int));
00384 extern int system_(char *, ftnlen);
00385 extern double z_abs(doublecomplex *z);
00386   //{return norm(complex<double>(z->r,z->i));}
00387 extern void z_cos(doublecomplex *, doublecomplex *);
00388 extern void z_div(doublecomplex *z, doublecomplex *a, doublecomplex *b);
00389   //{complex<double> xa(a->r,a->i),xb(b->r,b->i);xa/=xb;z->r=(xa.real());z->i=(xa.imag());}
00390 extern void z_exp(doublecomplex *, doublecomplex *);
00391 extern void z_log(doublecomplex *, doublecomplex *);
00392 extern void z_sin(doublecomplex *, doublecomplex *);
00393 extern void z_sqrt(doublecomplex *, doublecomplex *);
00394     }
00395 
00396 #endif // SYNAPS_UTIL_F2C_INCLUDE
00397 

SYNAPS DOCUMENTATION
logo