1 /* 2 3 -Header_File f2c.h ( CSPICE version of the f2c standard header file ) 4 5 -Abstract 6 7 Perform standard f2c declarations, customized for the host 8 environment. 9 10 -Disclaimer 11 12 THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE 13 CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. 14 GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE 15 ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE 16 PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" 17 TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY 18 WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A 19 PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC 20 SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE 21 SOFTWARE AND RELATED MATERIALS, HOWEVER USED. 22 23 IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA 24 BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT 25 LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, 26 INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, 27 REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE 28 REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. 29 30 RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF 31 THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY 32 CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE 33 ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. 34 35 -Required_Reading 36 37 None. 38 39 -Particulars 40 41 The standard f2c header file f2c.h must be included by every function 42 generated by running f2c on Fortran source code. The header f2c.h 43 includes typedefs used to provide a level of indirection in mapping 44 Fortran data types to native C data types. For example, Fortran 45 INTEGER variables are mapped to variables of type integer, where 46 integer is a C typedef. In the standard f2c.h header, the typedef 47 integer tranlates to the C type long. 48 49 Because the standard version of f2c.h does not work on all platforms, 50 this header file contains two platform-dependent versions of it, 51 meant to be selected at build time via precompiler switches. The 52 precompiler switches reference macros defined in SpiceZpl.h to 53 determine for which host platform the code is targeted. The first 54 version of f2c.h, which works on most platforms, is copied directly 55 from the standard version of f2c.h. The second version is intended 56 for use on the DEC Alpha running Digital Unix and the Sun/Solaris 57 platform using 64 bit mode and running gcc. On those systems, longs 58 occupy 8 bytes, as do doubles. Because the Fortran standard requires 59 that INTEGERS occupy half the storage of DOUBLE PRECISION numbers, 60 INTEGERS should be mapped to 4-byte ints rather than 8-byte longs 61 on the platforms having 8-byte longs. In order to achieve this, the 62 header f2c.h was transformed using the sed command 63 64 sed 's/long //' f2c.h 65 66 The high-level structure of this file is then: 67 68 # if ( defined(CSPICE_ALPHA_DIGITAL_UNIX ) \ 69 || defined(CSPICE_SUN_SOLARIS_64BIT_GCC ) ) 70 71 72 [ Alpha/Digital Unix and Sun Solaris 64 bit mode/gcc 73 version of f2c.h source code ] 74 75 # else 76 77 [ Standard version of f2c.h source code ] 78 79 # endif 80 81 82 -Literature_References 83 84 None. 85 86 -Author_and_Institution 87 88 N.J. Bachman (JPL) 89 90 -Restrictions 91 92 1) This header file must be updated whenever the f2c processor 93 or the f2c libraries libI77 and libF77 are updated. 94 95 2) This header may need to be updated to support new platforms. 96 The supported platforms at the time of the 31-JAN-1999 release 97 are: 98 99 ALPHA-DIGITAL-UNIX 100 HP 101 NEXT 102 PC-LINUX 103 PC-MS 104 SGI-IRIX-N32 105 SGI-IRIX-NO2 106 SUN-SOLARIS 107 108 -Version 109 110 -CSPICE Version 1.2.0, 27-JAN-2003 (NJB) 111 112 Updated to support the Sun Solaris 64 bit mode/gcc platform. 113 114 -CSPICE Version 2.0.0, 19-DEC-2001 (NJB) 115 116 Updated to support linking CSPICE into executables that 117 also link in objects compiled from Fortran, in particular 118 ones that perform Fortran I/O. To enable this odd mix, 119 one defines the preprocessor flag 120 121 MIX_C_AND_FORTRAN 122 123 This macro is undefined by default, since the action it invokes 124 is usually not desirable. See the header 125 126 f2cMang.h 127 128 for further information. 129 130 -CSPICE Version 1.0.0, 07-FEB-1999 (NJB) 131 132 */ 133 134 135 /* 136 Optionally include name-mangling macros for f2c external symbols. 137 */ 138 #ifdef MIX_C_AND_FORTRAN 139 #include "f2cMang.h" 140 #endif 141 142 143 /* 144 Include CSPICE platform macro definitions. 145 */ 146 #include "SpiceZpl.h" 147 148 149 150 # if ( defined(CSPICE_ALPHA_DIGITAL_UNIX ) \ 151 || defined(CSPICE_SUN_SOLARIS_64BIT_GCC ) ) 152 153 154 155 /* 156 The following code is intended to be used on the Alpha/Digital Unix 157 platform, where a long is the size of a double and an int is half the 158 size of a double. 159 160 Note that the comment line below indicating that the header is 161 "Standard" has been retained from the original, but is no longer 162 true. 163 */ 164 165 166 167 168 169 /* f2c.h -- Standard Fortran to C header file */ 170 171 /** barf [ba:rf] 2. "He suggested using FORTRAN, and everybody barfed." 172 173 - From The Shogakukan DICTIONARY OF NEW ENGLISH (Second edition) */ 174 175 #ifndef F2C_INCLUDE 176 #define F2C_INCLUDE 177 178 typedef int integer; 179 typedef unsigned uinteger; 180 typedef char *address; 181 typedef short int shortint; 182 typedef float real; 183 typedef double doublereal; 184 typedef struct { real r, i; } complex; 185 typedef struct { doublereal r, i; } doublecomplex; 186 typedef int logical; 187 typedef short int shortlogical; 188 typedef char logical1; 189 typedef char integer1; 190 #if 0 /* Adjust for integer*8. */ 191 typedef long longint; /* system-dependent */ 192 typedef unsigned long ulongint; /* system-dependent */ 193 #define qbit_clear(a,b) ((a) & ~((ulongint)1 << (b))) 194 #define qbit_set(a,b) ((a) | ((ulongint)1 << (b))) 195 #endif 196 197 #define TRUE_ (1) 198 #define FALSE_ (0) 199 200 /* Extern is for use with -E */ 201 #ifndef Extern 202 #define Extern extern 203 #endif 204 205 /* I/O stuff */ 206 207 #ifdef f2c_i2 208 /* for -i2 */ 209 typedef short flag; 210 typedef short ftnlen; 211 typedef short ftnint; 212 #else 213 typedef int flag; 214 typedef int ftnlen; 215 typedef int ftnint; 216 #endif 217 218 /*external read, write*/ 219 typedef struct 220 { flag cierr; 221 ftnint ciunit; 222 flag ciend; 223 char *cifmt; 224 ftnint cirec; 225 } cilist; 226 227 /*internal read, write*/ 228 typedef struct 229 { flag icierr; 230 char *iciunit; 231 flag iciend; 232 char *icifmt; 233 ftnint icirlen; 234 ftnint icirnum; 235 } icilist; 236 237 /*open*/ 238 typedef struct 239 { flag oerr; 240 ftnint ounit; 241 char *ofnm; 242 ftnlen ofnmlen; 243 char *osta; 244 char *oacc; 245 char *ofm; 246 ftnint orl; 247 char *oblnk; 248 } olist; 249 250 /*close*/ 251 typedef struct 252 { flag cerr; 253 ftnint cunit; 254 char *csta; 255 } cllist; 256 257 /*rewind, backspace, endfile*/ 258 typedef struct 259 { flag aerr; 260 ftnint aunit; 261 } alist; 262 263 /* inquire */ 264 typedef struct 265 { flag inerr; 266 ftnint inunit; 267 char *infile; 268 ftnlen infilen; 269 ftnint *inex; /*parameters in standard's order*/ 270 ftnint *inopen; 271 ftnint *innum; 272 ftnint *innamed; 273 char *inname; 274 ftnlen innamlen; 275 char *inacc; 276 ftnlen inacclen; 277 char *inseq; 278 ftnlen inseqlen; 279 char *indir; 280 ftnlen indirlen; 281 char *infmt; 282 ftnlen infmtlen; 283 char *inform; 284 ftnint informlen; 285 char *inunf; 286 ftnlen inunflen; 287 ftnint *inrecl; 288 ftnint *innrec; 289 char *inblank; 290 ftnlen inblanklen; 291 } inlist; 292 293 #define VOID void 294 295 union Multitype { /* for multiple entry points */ 296 integer1 g; 297 shortint h; 298 integer i; 299 /* longint j; */ 300 real r; 301 doublereal d; 302 complex c; 303 doublecomplex z; 304 }; 305 306 typedef union Multitype Multitype; 307 308 /*typedef int Long;*/ /* No longer used; formerly in Namelist */ 309 310 struct Vardesc { /* for Namelist */ 311 char *name; 312 char *addr; 313 ftnlen *dims; 314 int type; 315 }; 316 typedef struct Vardesc Vardesc; 317 318 struct Namelist { 319 char *name; 320 Vardesc **vars; 321 int nvars; 322 }; 323 typedef struct Namelist Namelist; 324 325 #define abs(x) ((x) >= 0 ? (x) : -(x)) 326 #define dabs(x) (doublereal)abs(x) 327 #define min(a,b) ((a) <= (b) ? (a) : (b)) 328 #define max(a,b) ((a) >= (b) ? (a) : (b)) 329 #define dmin(a,b) (doublereal)min(a,b) 330 #define dmax(a,b) (doublereal)max(a,b) 331 #define bit_test(a,b) ((a) >> (b) & 1) 332 #define bit_clear(a,b) ((a) & ~((uinteger)1 << (b))) 333 #define bit_set(a,b) ((a) | ((uinteger)1 << (b))) 334 335 /* procedure parameter types for -A and -C++ */ 336 337 #define F2C_proc_par_types 1 338 #ifdef __cplusplus 339 typedef int /* Unknown procedure type */ (*U_fp)(...); 340 typedef shortint (*J_fp)(...); 341 typedef integer (*I_fp)(...); 342 typedef real (*R_fp)(...); 343 typedef doublereal (*D_fp)(...), (*E_fp)(...); 344 typedef /* Complex */ VOID (*C_fp)(...); 345 typedef /* Double Complex */ VOID (*Z_fp)(...); 346 typedef logical (*L_fp)(...); 347 typedef shortlogical (*K_fp)(...); 348 typedef /* Character */ VOID (*H_fp)(...); 349 typedef /* Subroutine */ int (*S_fp)(...); 350 #else 351 typedef int /* Unknown procedure type */ (*U_fp)(); 352 typedef shortint (*J_fp)(); 353 typedef integer (*I_fp)(); 354 typedef real (*R_fp)(); 355 typedef doublereal (*D_fp)(), (*E_fp)(); 356 typedef /* Complex */ VOID (*C_fp)(); 357 typedef /* Double Complex */ VOID (*Z_fp)(); 358 typedef logical (*L_fp)(); 359 typedef shortlogical (*K_fp)(); 360 typedef /* Character */ VOID (*H_fp)(); 361 typedef /* Subroutine */ int (*S_fp)(); 362 #endif 363 /* E_fp is for real functions when -R is not specified */ 364 typedef VOID C_f; /* complex function */ 365 typedef VOID H_f; /* character function */ 366 typedef VOID Z_f; /* double complex function */ 367 typedef doublereal E_f; /* real function with -R not specified */ 368 369 /* undef any lower-case symbols that your C compiler predefines, e.g.: */ 370 371 #ifndef Skip_f2c_Undefs 372 #undef cray 373 #undef gcos 374 #undef mc68010 375 #undef mc68020 376 #undef mips 377 #undef pdp11 378 #undef sgi 379 #undef sparc 380 #undef sun 381 #undef sun2 382 #undef sun3 383 #undef sun4 384 #undef u370 385 #undef u3b 386 #undef u3b2 387 #undef u3b5 388 #undef unix 389 #undef vax 390 #endif 391 #endif 392 393 394 /* 395 This marks the end of the Alpha/Digital Unix version of f2c.h. 396 */ 397 398 399 400 #else 401 402 /* 403 The following code is the standard f2c.h header. In this 404 header, an "integer" is defined to be of type long. 405 406 Because the code is copied verbatim, it does not follow the usual 407 CSPICE indentation pattern. 408 */ 409 410 411 412 /* f2c.h -- Standard Fortran to C header file */ 413 414 /** barf [ba:rf] 2. "He suggested using FORTRAN, and everybody barfed." 415 416 - From The Shogakukan DICTIONARY OF NEW ENGLISH (Second edition) */ 417 418 #ifndef F2C_INCLUDE 419 #define F2C_INCLUDE 420 421 typedef long int integer; 422 typedef unsigned long uinteger; 423 typedef char *address; 424 typedef short int shortint; 425 typedef float real; 426 typedef double doublereal; 427 typedef struct { real r, i; } complex; 428 typedef struct { doublereal r, i; } doublecomplex; 429 typedef long int logical; 430 typedef short int shortlogical; 431 typedef char logical1; 432 typedef char integer1; 433 #if 0 /* Adjust for integer*8. */ 434 typedef long long longint; /* system-dependent */ 435 typedef unsigned long long ulongint; /* system-dependent */ 436 #define qbit_clear(a,b) ((a) & ~((ulongint)1 << (b))) 437 #define qbit_set(a,b) ((a) | ((ulongint)1 << (b))) 438 #endif 439 440 #define TRUE_ (1) 441 #define FALSE_ (0) 442 443 /* Extern is for use with -E */ 444 #ifndef Extern 445 #define Extern extern 446 #endif 447 448 /* I/O stuff */ 449 450 #ifdef f2c_i2 451 /* for -i2 */ 452 typedef short flag; 453 typedef short ftnlen; 454 typedef short ftnint; 455 #else 456 typedef long int flag; 457 typedef long int ftnlen; 458 typedef long int ftnint; 459 #endif 460 461 /*external read, write*/ 462 typedef struct 463 { flag cierr; 464 ftnint ciunit; 465 flag ciend; 466 char *cifmt; 467 ftnint cirec; 468 } cilist; 469 470 /*internal read, write*/ 471 typedef struct 472 { flag icierr; 473 char *iciunit; 474 flag iciend; 475 char *icifmt; 476 ftnint icirlen; 477 ftnint icirnum; 478 } icilist; 479 480 /*open*/ 481 typedef struct 482 { flag oerr; 483 ftnint ounit; 484 char *ofnm; 485 ftnlen ofnmlen; 486 char *osta; 487 char *oacc; 488 char *ofm; 489 ftnint orl; 490 char *oblnk; 491 } olist; 492 493 /*close*/ 494 typedef struct 495 { flag cerr; 496 ftnint cunit; 497 char *csta; 498 } cllist; 499 500 /*rewind, backspace, endfile*/ 501 typedef struct 502 { flag aerr; 503 ftnint aunit; 504 } alist; 505 506 /* inquire */ 507 typedef struct 508 { flag inerr; 509 ftnint inunit; 510 char *infile; 511 ftnlen infilen; 512 ftnint *inex; /*parameters in standard's order*/ 513 ftnint *inopen; 514 ftnint *innum; 515 ftnint *innamed; 516 char *inname; 517 ftnlen innamlen; 518 char *inacc; 519 ftnlen inacclen; 520 char *inseq; 521 ftnlen inseqlen; 522 char *indir; 523 ftnlen indirlen; 524 char *infmt; 525 ftnlen infmtlen; 526 char *inform; 527 ftnint informlen; 528 char *inunf; 529 ftnlen inunflen; 530 ftnint *inrecl; 531 ftnint *innrec; 532 char *inblank; 533 ftnlen inblanklen; 534 } inlist; 535 536 #define VOID void 537 538 union Multitype { /* for multiple entry points */ 539 integer1 g; 540 shortint h; 541 integer i; 542 /* longint j; */ 543 real r; 544 doublereal d; 545 complex c; 546 doublecomplex z; 547 }; 548 549 typedef union Multitype Multitype; 550 551 /*typedef long int Long;*/ /* No longer used; formerly in Namelist */ 552 553 struct Vardesc { /* for Namelist */ 554 char *name; 555 char *addr; 556 ftnlen *dims; 557 int type; 558 }; 559 typedef struct Vardesc Vardesc; 560 561 struct Namelist { 562 char *name; 563 Vardesc **vars; 564 int nvars; 565 }; 566 typedef struct Namelist Namelist; 567 568 #define abs(x) ((x) >= 0 ? (x) : -(x)) 569 #define dabs(x) (doublereal)abs(x) 570 #define min(a,b) ((a) <= (b) ? (a) : (b)) 571 #define max(a,b) ((a) >= (b) ? (a) : (b)) 572 #define dmin(a,b) (doublereal)min(a,b) 573 #define dmax(a,b) (doublereal)max(a,b) 574 #define bit_test(a,b) ((a) >> (b) & 1) 575 #define bit_clear(a,b) ((a) & ~((uinteger)1 << (b))) 576 #define bit_set(a,b) ((a) | ((uinteger)1 << (b))) 577 578 /* procedure parameter types for -A and -C++ */ 579 580 #define F2C_proc_par_types 1 581 #ifdef __cplusplus 582 typedef int /* Unknown procedure type */ (*U_fp)(...); 583 typedef shortint (*J_fp)(...); 584 typedef integer (*I_fp)(...); 585 typedef real (*R_fp)(...); 586 typedef doublereal (*D_fp)(...), (*E_fp)(...); 587 typedef /* Complex */ VOID (*C_fp)(...); 588 typedef /* Double Complex */ VOID (*Z_fp)(...); 589 typedef logical (*L_fp)(...); 590 typedef shortlogical (*K_fp)(...); 591 typedef /* Character */ VOID (*H_fp)(...); 592 typedef /* Subroutine */ int (*S_fp)(...); 593 #else 594 typedef int /* Unknown procedure type */ (*U_fp)(); 595 typedef shortint (*J_fp)(); 596 typedef integer (*I_fp)(); 597 typedef real (*R_fp)(); 598 typedef doublereal (*D_fp)(), (*E_fp)(); 599 typedef /* Complex */ VOID (*C_fp)(); 600 typedef /* Double Complex */ VOID (*Z_fp)(); 601 typedef logical (*L_fp)(); 602 typedef shortlogical (*K_fp)(); 603 typedef /* Character */ VOID (*H_fp)(); 604 typedef /* Subroutine */ int (*S_fp)(); 605 #endif 606 /* E_fp is for real functions when -R is not specified */ 607 typedef VOID C_f; /* complex function */ 608 typedef VOID H_f; /* character function */ 609 typedef VOID Z_f; /* double complex function */ 610 typedef doublereal E_f; /* real function with -R not specified */ 611 612 /* undef any lower-case symbols that your C compiler predefines, e.g.: */ 613 614 #ifndef Skip_f2c_Undefs 615 #undef cray 616 #undef gcos 617 #undef mc68010 618 #undef mc68020 619 #undef mips 620 #undef pdp11 621 #undef sgi 622 #undef sparc 623 #undef sun 624 #undef sun2 625 #undef sun3 626 #undef sun4 627 #undef u370 628 #undef u3b 629 #undef u3b2 630 #undef u3b5 631 #undef unix 632 #undef vax 633 #endif 634 #endif 635 636 637 #endif 638 639