ADMB Documentation  11.1.2504
 All Classes Files Functions Variables Typedefs Friends Defines
f2c.h
Go to the documentation of this file.
00001 /*
00002  * $Id: f2c.h 1919 2014-04-22 22:02:01Z johnoel $
00003  *
00004  * Author: David Fournier
00005  * Copyright (c) 2008-2012 Regents of the University of California
00006  *
00007  * ADModelbuilder and associated libraries and documentations are
00008  * provided under the general terms of the "BSD" license.
00009  *
00010  * License:
00011  *
00012  * Redistribution and use in source and binary forms, with or without
00013  * modification, are permitted provided that the following conditions are
00014  * met:
00015  *
00016  * 1. Redistributions of source code must retain the above copyright
00017  * notice, this list of conditions and the following disclaimer.
00018  *
00019  * 2.  Redistributions in binary form must reproduce the above copyright
00020  * notice, this list of conditions and the following disclaimer in the
00021  * documentation and/or other materials provided with the distribution.
00022  *
00023  * 3.  Neither the name of the  University of California, Otter Research,
00024  * nor the ADMB Foundation nor the names of its contributors may be used
00025  * to endorse or promote products derived from this software without
00026  * specific prior written permission.
00027  *
00028  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00029  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00030  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
00031  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
00032  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
00033  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
00034  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
00035  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
00036  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00037  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00038  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00039  *
00040  */
00045 /* f2c.h  --  Standard Fortran to C header file */
00046 
00051 #ifndef F2C_INCLUDE
00052 #define F2C_INCLUDE
00053 
00054 typedef long int integer;
00055 //typedef char *address;
00056 typedef short int shortint;
00057 typedef float real;
00058 typedef double doublereal;
00059 typedef struct { real r, i; } complex;
00060 typedef struct { doublereal r, i; } doublecomplex;
00061 typedef long int logical;
00062 typedef short int shortlogical;
00063 typedef char logical1;
00064 typedef char integer1;
00065 /* typedef long long longint; */ /* system-dependent */
00066 
00067 #define TRUE_ (1)
00068 #define FALSE_ (0)
00069 
00070 /* Extern is for use with -E */
00071 #ifndef Extern
00072 #define Extern extern
00073 #endif
00074 
00075 /* I/O stuff */
00076 
00077 #ifdef f2c_i2
00078 /* for -i2 */
00079 typedef short flag;
00080 typedef short ftnlen;
00081 typedef short ftnint;
00082 #else
00083 typedef long int flag;
00084 typedef long int ftnlen;
00085 typedef long int ftnint;
00086 #endif
00087 
00088 /*external read, write*/
00089 typedef struct
00090 {
00091   flag cierr;
00092   ftnint ciunit;
00093   flag ciend;
00094   char *cifmt;
00095   ftnint cirec;
00096 } cilist;
00097 
00098 /*internal read, write*/
00099 typedef struct
00100 {
00101   flag icierr;
00102   char *iciunit;
00103   flag iciend;
00104   char *icifmt;
00105   ftnint icirlen;
00106   ftnint icirnum;
00107 } icilist;
00108 
00109 /*open*/
00110 typedef struct
00111 {
00112   flag oerr;
00113   ftnint ounit;
00114   char *ofnm;
00115   ftnlen ofnmlen;
00116   char *osta;
00117   char *oacc;
00118   char *ofm;
00119   ftnint orl;
00120   char *oblnk;
00121 } olist;
00122 
00123 /*close*/
00124 typedef struct
00125 {
00126   flag cerr;
00127   ftnint cunit;
00128   char *csta;
00129 } cllist;
00130 
00131 /*rewind, backspace, endfile*/
00132 typedef struct
00133 {
00134   flag aerr;
00135 ftnint aunit;
00136 } alist;
00137 
00138 /* inquire */
00139 typedef struct
00140 {
00141   flag inerr;
00142   ftnint inunit;
00143   char *infile;
00144   ftnlen infilen;
00145   ftnint *inex;/*parameters in standard's order*/
00146   ftnint *inopen;
00147   ftnint *innum;
00148   ftnint *innamed;
00149   char *inname;
00150   ftnlen innamlen;
00151   char *inacc;
00152   ftnlen inacclen;
00153   char *inseq;
00154   ftnlen inseqlen;
00155   char *indir;
00156   ftnlen indirlen;
00157   char *infmt;
00158   ftnlen infmtlen;
00159   char *inform;
00160   ftnint informlen;
00161   char *inunf;
00162   ftnlen inunflen;
00163   ftnint *inrecl;
00164   ftnint *innrec;
00165   char *inblank;
00166   ftnlen inblanklen;
00167 } inlist;
00168 
00169 #define VOID void
00170  //
00171  // union Multitype {/* for multiple entry points */
00172  // integer1 g;
00173  // shortint h;
00174  // integer i;
00175  // /* longint j; */
00176  // real r;
00177  // doublereal d;
00178  // complex c;
00179  // doublecomplex z;
00180  // };
00181  //
00182  // typedef union Multitype Multitype;
00183  //
00184 /*typedef long int Long;*//* No longer used; formerly in Namelist */
00185 
00186 struct Vardesc {/* for Namelist */
00187   char *name;
00188   char *addr;
00189   ftnlen *dims;
00190   int  type;
00191 };
00192 typedef struct Vardesc Vardesc;
00193 
00194 struct Namelist {
00195   char *name;
00196   Vardesc **vars;
00197   int nvars;
00198 };
00199 typedef struct Namelist Namelist;
00200 
00201 #define abs(x) ((x) >= 0 ? (x) : -(x))
00202 #define dabs(x) (doublereal)abs(x)
00203 #define min(a,b) ((a) <= (b) ? (a) : (b))
00204 #define max(a,b) ((a) >= (b) ? (a) : (b))
00205 #define dmin(a,b) (doublereal)min(a,b)
00206 #define dmax(a,b) (doublereal)max(a,b)
00207 
00208 /* procedure parameter types for -A and -C++ */
00209 
00210 #define F2C_proc_par_types 1
00211 #ifdef __cplusplus
00212 typedef int /* Unknown procedure type */ (*U_fp)(...);
00213 typedef shortint (*J_fp)(...);
00214 typedef integer (*I_fp)(...);
00215 typedef real (*R_fp)(...);
00216 typedef doublereal (*D_fp)(...), (*E_fp)(...);
00217 typedef /* Complex */ VOID (*C_fp)(...);
00218 typedef /* Double Complex */ VOID (*Z_fp)(...);
00219 typedef logical (*L_fp)(...);
00220 typedef shortlogical (*K_fp)(...);
00221 typedef /* Character */ VOID (*H_fp)(...);
00222 typedef /* Subroutine */ int (*S_fp)(...);
00223 #else
00224 typedef int /* Unknown procedure type */ (*U_fp)();
00225 typedef shortint (*J_fp)();
00226 typedef integer (*I_fp)();
00227 typedef real (*R_fp)();
00228 typedef doublereal (*D_fp)(), (*E_fp)();
00229 typedef /* Complex */ VOID (*C_fp)();
00230 typedef /* Double Complex */ VOID (*Z_fp)();
00231 typedef logical (*L_fp)();
00232 typedef shortlogical (*K_fp)();
00233 typedef /* Character */ VOID (*H_fp)();
00234 typedef /* Subroutine */ int (*S_fp)();
00235 #endif
00236 /* E_fp is for real functions when -R is not specified */
00237 typedef VOID C_f;/* complex function */
00238 typedef VOID H_f;/* character function */
00239 typedef VOID Z_f;/* double complex function */
00240 typedef doublereal E_f;/* real function with -R not specified */
00241 
00242 /* undef any lower-case symbols that your C compiler predefines, e.g.: */
00243 
00244 #ifndef Skip_f2c_Undefs
00245 #undef cray
00246 #undef gcos
00247 #undef mc68010
00248 #undef mc68020
00249 #undef mips
00250 #undef pdp11
00251 #undef sgi
00252 #undef sparc
00253 #undef sun
00254 #undef sun2
00255 #undef sun3
00256 #undef sun4
00257 #undef u370
00258 #undef u3b
00259 #undef u3b2
00260 #undef u3b5
00261 #undef unix
00262 #undef vax
00263 #endif
00264 #endif