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 translates 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 -Restrictions
83 
84   1) This header file must be updated whenever the f2c processor
85      or the f2c libraries libI77 and libF77 are updated.
86 
87   2) This header may need to be updated to support new platforms.
88      The supported platforms at the time of the 31-JAN-1999 release
89      are:
90 
91         ALPHA-DIGITAL-UNIX
92         HP
93         NEXT
94         PC-LINUX
95         PC-MS
96         SGI-IRIX-N32
97         SGI-IRIX-NO2
98         SUN-SOLARIS
99 
100 -Literature_References
101 
102    None.
103 
104 -Author_and_Institution
105 
106    N.J. Bachman       (JPL)
107    B.V. Semenov       (JPL)
108    E.D. Wright        (JPL)
109 
110 -Version
111 
112    -CSPICE Version 4.2.0, 09-APR-2014 (EDW) (BVS)
113 
114       Added include for SpiceZrnm.h to eliminate symbol conflict
115       encountered from Icy and JNISpice under OS X 10.7.
116 
117       Minor text format correction to eliminate error signal from
118       OS X cpp. The edit removes leading whitespace from the
119       final "#endif".
120 
121       Updated for:
122 
123          PC-CYGWIN-64BIT-GCC_C
124 
125       environment. Added the corresponding tag:
126 
127          CSPICE_PC_CYGWIN_64BIT_GCC
128 
129       tag to the #ifdefs set.
130 
131    -CSPICE Version 4.1.0, 14-MAY-2010 (EDW)(BVS)
132 
133        Updated for:
134 
135           MAC-OSX-64BIT-INTEL_C
136           SUN-SOLARIS-64BIT-NATIVE_C
137           SUN-SOLARIS-INTEL-64BIT-CC_C
138 
139        environments. Added the corresponding tags:
140 
141           CSPICE_MAC_OSX_INTEL_64BIT_GCC
142           CSPICE_SUN_SOLARIS_64BIT_NATIVE
143           CSPICE_SUN_SOLARIS_INTEL_64BIT_CC
144 
145        tag to the #ifdefs set.
146 
147    -CSPICE Version 4.0.0, 21-FEB-2006 (NJB)
148 
149        Updated to support the PC Linux 64 bit mode/gcc platform.
150 
151    -CSPICE Version 3.0.0, 27-JAN-2003 (NJB)
152 
153        Updated to support the Sun Solaris 64 bit mode/gcc platform.
154 
155    -CSPICE Version 2.0.0, 19-DEC-2001 (NJB)
156 
157       Updated to support linking CSPICE into executables that
158       also link in objects compiled from Fortran, in particular
159       ones that perform Fortran I/O.  To enable this odd mix,
160       one defines the  preprocessor flag
161 
162          MIX_C_AND_FORTRAN
163 
164       This macro is undefined by default, since the action it invokes
165       is usually not desirable.  See the header
166 
167          f2cMang.h
168 
169       for further information.
170 
171    -CSPICE Version 1.0.0, 07-FEB-1999 (NJB)
172 
173 */
174 
175 /*
176 Include those rename assignments for routines whose symbols will
177 collide with other libraries.
178 */
179 #ifndef HAVE_SPICERENAME_H
180 #include "SpiceZrnm.h"
181 #endif
182 
183 /*
184 Optionally include name-mangling macros for f2c external symbols.
185 */
186 #ifdef MIX_C_AND_FORTRAN
187 #include "f2cMang.h"
188 #endif
189 
190 /*
191 Include CSPICE platform macro definitions.
192 */
193 #include "SpiceZpl.h"
194 
195 #if (defined(CSPICE_ALPHA_DIGITAL_UNIX) || defined(CSPICE_SUN_SOLARIS_64BIT_GCC)                                       \
196      || defined(CSPICE_SUN_SOLARIS_64BIT_NATIVE) || defined(CSPICE_MAC_OSX_INTEL_64BIT_GCC)                            \
197      || defined(CSPICE_SUN_SOLARIS_INTEL_64BIT_CC) || defined(CSPICE_PC_CYGWIN_64BIT_GCC)                              \
198      || defined(CSPICE_PC_LINUX_64BIT_GCC))
199 
200 /*
201 MODIFICATION
202 
203 The following code is intended to be used on the platforms where
204 a long is the size of a double and an int is half the
205 size of a double.
206 
207 Note that the comment line below indicating that the header is
208 "Standard" has been retained from the original, but is no longer
209 true.
210 */
211 
212 /* f2c.h  --  Standard Fortran to C header file */
213 
214 #ifndef F2C_INCLUDE
215 #define F2C_INCLUDE
216 
217 typedef int integer;
218 typedef unsigned uinteger;
219 typedef char *address;
220 typedef short int shortint;
221 typedef float real;
222 typedef double doublereal;
223 typedef struct {
224     real r, i;
225 } complex_type;
226 typedef struct {
227     doublereal r, i;
228 } doublecomplex;
229 typedef int logical;
230 typedef short int shortlogical;
231 typedef char logical1;
232 typedef char integer1;
233 #if 0 /* Adjust for integer*8. */
234 typedef long longint;      /* system-dependent */
235 typedef unsigned long ulongint;  /* system-dependent */
236 #define qbit_clear(a, b) ((a) & ~((ulongint)1 << (b)))
237 #define qbit_set(a, b) ((a) | ((ulongint)1 << (b)))
238 #endif
239 
240 #define TRUE_ (1)
241 #define FALSE_ (0)
242 
243 /* Extern is for use with -E */
244 #ifndef Extern
245 #define Extern extern
246 #endif
247 
248 /* I/O stuff */
249 
250 #ifdef f2c_i2
251 /* for -i2 */
252 typedef short flag;
253 typedef short ftnlen;
254 typedef short ftnint;
255 #else
256 typedef int flag;
257 typedef int ftnlen;
258 typedef int ftnint;
259 #endif
260 
261 /*external read, write*/
262 typedef struct {
263     flag cierr;
264     ftnint ciunit;
265     flag ciend;
266     char *cifmt;
267     ftnint cirec;
268 } cilist;
269 
270 /*internal read, write*/
271 typedef struct {
272     flag icierr;
273     char *iciunit;
274     flag iciend;
275     char *icifmt;
276     ftnint icirlen;
277     ftnint icirnum;
278 } icilist;
279 
280 /*open*/
281 typedef struct {
282     flag oerr;
283     ftnint ounit;
284     char *ofnm;
285     ftnlen ofnmlen;
286     char *osta;
287     char *oacc;
288     char *ofm;
289     ftnint orl;
290     char *oblnk;
291 } olist;
292 
293 /*close*/
294 typedef struct {
295     flag cerr;
296     ftnint cunit;
297     char *csta;
298 } cllist;
299 
300 /*rewind, backspace, endfile*/
301 typedef struct {
302     flag aerr;
303     ftnint aunit;
304 } alist;
305 
306 /* inquire */
307 typedef struct {
308     flag inerr;
309     ftnint inunit;
310     char *infile;
311     ftnlen infilen;
312     ftnint *inex; /*parameters in standard's order*/
313     ftnint *inopen;
314     ftnint *innum;
315     ftnint *innamed;
316     char *inname;
317     ftnlen innamlen;
318     char *inacc;
319     ftnlen inacclen;
320     char *inseq;
321     ftnlen inseqlen;
322     char *indir;
323     ftnlen indirlen;
324     char *infmt;
325     ftnlen infmtlen;
326     char *inform;
327     ftnint informlen;
328     char *inunf;
329     ftnlen inunflen;
330     ftnint *inrecl;
331     ftnint *innrec;
332     char *inblank;
333     ftnlen inblanklen;
334 } inlist;
335 
336 #define VOID void
337 
338 union Multitype { /* for multiple entry points */
339     integer1 g;
340     shortint h;
341     integer i;
342     /* longint j; */
343     real r;
344     doublereal d;
345     complex_type c;
346     doublecomplex z;
347 };
348 
349 typedef union Multitype Multitype;
350 
351 /*typedef int Long;*/ /* No longer used; formerly in Namelist */
352 
353 struct Vardesc { /* for Namelist */
354     char *name;
355     char *addr;
356     ftnlen *dims;
357     int type;
358 };
359 typedef struct Vardesc Vardesc;
360 
361 struct Namelist {
362     char *name;
363     Vardesc **vars;
364     int nvars;
365 };
366 typedef struct Namelist Namelist;
367 
368 #define abs(x) ((x) >= 0 ? (x) : -(x))
369 #define dabs(x) (doublereal) abs(x)
370 #define min(a, b) ((a) <= (b) ? (a) : (b))
371 #define max(a, b) ((a) >= (b) ? (a) : (b))
372 #define dmin(a, b) (doublereal) min(a, b)
373 #define dmax(a, b) (doublereal) max(a, b)
374 #define bit_test(a, b) ((a) >> (b)&1)
375 #define bit_clear(a, b) ((a) & ~((uinteger)1 << (b)))
376 #define bit_set(a, b) ((a) | ((uinteger)1 << (b)))
377 
378 /* procedure parameter types for -A and -C++ */
379 
380 #define F2C_proc_par_types 1
381 #ifdef __cplusplus
382 typedef int /* Unknown procedure type */ (*U_fp)(...);
383 typedef shortint (*J_fp)(...);
384 typedef integer (*I_fp)(...);
385 typedef real (*R_fp)(...);
386 typedef doublereal (*D_fp)(...), (*E_fp)(...);
387 typedef /* Complex */ VOID (*C_fp)(...);
388 typedef /* Double Complex */ VOID (*Z_fp)(...);
389 typedef logical (*L_fp)(...);
390 typedef shortlogical (*K_fp)(...);
391 typedef /* Character */ VOID (*H_fp)(...);
392 typedef /* Subroutine */ int (*S_fp)(...);
393 #else
394 typedef int /* Unknown procedure type */ (*U_fp)();
395 typedef shortint (*J_fp)();
396 typedef integer (*I_fp)();
397 typedef real (*R_fp)();
398 typedef doublereal (*D_fp)(), (*E_fp)();
399 typedef /* Complex */ VOID (*C_fp)();
400 typedef /* Double Complex */ VOID (*Z_fp)();
401 typedef logical (*L_fp)();
402 typedef shortlogical (*K_fp)();
403 typedef /* Character */ VOID (*H_fp)();
404 typedef /* Subroutine */ int (*S_fp)();
405 #endif
406 /* E_fp is for real functions when -R is not specified */
407 typedef VOID C_f;       /* complex function */
408 typedef VOID H_f;       /* character function */
409 typedef VOID Z_f;       /* double complex function */
410 typedef doublereal E_f; /* real function with -R not specified */
411 
412 /* undef any lower-case symbols that your C compiler predefines, e.g.: */
413 
414 #ifndef Skip_f2c_Undefs
415 #undef cray
416 #undef gcos
417 #undef mc68010
418 #undef mc68020
419 #undef mips
420 #undef pdp11
421 #undef sgi
422 #undef sparc
423 #undef sun
424 #undef sun2
425 #undef sun3
426 #undef sun4
427 #undef u370
428 #undef u3b
429 #undef u3b2
430 #undef u3b5
431 #undef unix
432 #undef vax
433 #endif
434 #endif
435 
436 /*
437 This marks the end of the MODIFICATION section version of f2c.h.
438 */
439 
440 #else
441 
442 /*
443 The following code is the standard f2c.h header.  In this
444 header, an "integer" is defined to be of type long.
445 
446 Because the code is copied verbatim, it does not follow the usual
447 CSPICE indentation pattern.
448 */
449 
450 /* f2c.h  --  Standard Fortran to C header file */
451 
452 #ifndef F2C_INCLUDE
453 #define F2C_INCLUDE
454 
455 typedef long int integer;
456 typedef unsigned long uinteger;
457 typedef char *address;
458 typedef short int shortint;
459 typedef float real;
460 typedef double doublereal;
461 typedef struct {
462     real r, i;
463 } complex_type;
464 typedef struct {
465     doublereal r, i;
466 } doublecomplex;
467 typedef long int logical;
468 typedef short int shortlogical;
469 typedef char logical1;
470 typedef char integer1;
471 #if 0 /* Adjust for integer*8. */
472 typedef long long longint;    /* system-dependent */
473 typedef unsigned long long ulongint;   /* system-dependent */
474 #define qbit_clear(a, b) ((a) & ~((ulongint)1 << (b)))
475 #define qbit_set(a, b) ((a) | ((ulongint)1 << (b)))
476 #endif
477 
478 #define TRUE_ (1)
479 #define FALSE_ (0)
480 
481 /* Extern is for use with -E */
482 #ifndef Extern
483 #define Extern extern
484 #endif
485 
486 /* I/O stuff */
487 
488 #ifdef f2c_i2
489 /* for -i2 */
490 typedef short flag;
491 typedef short ftnlen;
492 typedef short ftnint;
493 #else
494 typedef long int flag;
495 typedef long int ftnlen;
496 typedef long int ftnint;
497 #endif
498 
499 /*external read, write*/
500 typedef struct {
501     flag cierr;
502     ftnint ciunit;
503     flag ciend;
504     char *cifmt;
505     ftnint cirec;
506 } cilist;
507 
508 /*internal read, write*/
509 typedef struct {
510     flag icierr;
511     char *iciunit;
512     flag iciend;
513     char *icifmt;
514     ftnint icirlen;
515     ftnint icirnum;
516 } icilist;
517 
518 /*open*/
519 typedef struct {
520     flag oerr;
521     ftnint ounit;
522     char *ofnm;
523     ftnlen ofnmlen;
524     char *osta;
525     char *oacc;
526     char *ofm;
527     ftnint orl;
528     char *oblnk;
529 } olist;
530 
531 /*close*/
532 typedef struct {
533     flag cerr;
534     ftnint cunit;
535     char *csta;
536 } cllist;
537 
538 /*rewind, backspace, endfile*/
539 typedef struct {
540     flag aerr;
541     ftnint aunit;
542 } alist;
543 
544 /* inquire */
545 typedef struct {
546     flag inerr;
547     ftnint inunit;
548     char *infile;
549     ftnlen infilen;
550     ftnint *inex; /*parameters in standard's order*/
551     ftnint *inopen;
552     ftnint *innum;
553     ftnint *innamed;
554     char *inname;
555     ftnlen innamlen;
556     char *inacc;
557     ftnlen inacclen;
558     char *inseq;
559     ftnlen inseqlen;
560     char *indir;
561     ftnlen indirlen;
562     char *infmt;
563     ftnlen infmtlen;
564     char *inform;
565     ftnint informlen;
566     char *inunf;
567     ftnlen inunflen;
568     ftnint *inrecl;
569     ftnint *innrec;
570     char *inblank;
571     ftnlen inblanklen;
572 } inlist;
573 
574 #define VOID void
575 
576 union Multitype { /* for multiple entry points */
577     integer1 g;
578     shortint h;
579     integer i;
580     /* longint j; */
581     real r;
582     doublereal d;
583     complex_type c;
584     doublecomplex z;
585 };
586 
587 typedef union Multitype Multitype;
588 
589 /*typedef long int Long;*/ /* No longer used; formerly in Namelist */
590 
591 struct Vardesc { /* for Namelist */
592     char *name;
593     char *addr;
594     ftnlen *dims;
595     int type;
596 };
597 typedef struct Vardesc Vardesc;
598 
599 struct Namelist {
600     char *name;
601     Vardesc **vars;
602     int nvars;
603 };
604 typedef struct Namelist Namelist;
605 
606 #define abs(x) ((x) >= 0 ? (x) : -(x))
607 #define dabs(x) (doublereal) abs(x)
608 #define min(a, b) ((a) <= (b) ? (a) : (b))
609 #define max(a, b) ((a) >= (b) ? (a) : (b))
610 #define dmin(a, b) (doublereal) min(a, b)
611 #define dmax(a, b) (doublereal) max(a, b)
612 #define bit_test(a, b) ((a) >> (b)&1)
613 #define bit_clear(a, b) ((a) & ~((uinteger)1 << (b)))
614 #define bit_set(a, b) ((a) | ((uinteger)1 << (b)))
615 
616 /* procedure parameter types for -A and -C++ */
617 
618 #define F2C_proc_par_types 1
619 #ifdef __cplusplus
620 typedef int /* Unknown procedure type */ (*U_fp)(...);
621 typedef shortint (*J_fp)(...);
622 typedef integer (*I_fp)(...);
623 typedef real (*R_fp)(...);
624 typedef doublereal (*D_fp)(...), (*E_fp)(...);
625 typedef /* Complex */ VOID (*C_fp)(...);
626 typedef /* Double Complex */ VOID (*Z_fp)(...);
627 typedef logical (*L_fp)(...);
628 typedef shortlogical (*K_fp)(...);
629 typedef /* Character */ VOID (*H_fp)(...);
630 typedef /* Subroutine */ int (*S_fp)(...);
631 #else
632 typedef int /* Unknown procedure type */ (*U_fp)();
633 typedef shortint (*J_fp)();
634 typedef integer (*I_fp)();
635 typedef real (*R_fp)();
636 typedef doublereal (*D_fp)(), (*E_fp)();
637 typedef /* Complex */ VOID (*C_fp)();
638 typedef /* Double Complex */ VOID (*Z_fp)();
639 typedef logical (*L_fp)();
640 typedef shortlogical (*K_fp)();
641 typedef /* Character */ VOID (*H_fp)();
642 typedef /* Subroutine */ int (*S_fp)();
643 #endif
644 /* E_fp is for real functions when -R is not specified */
645 typedef VOID C_f;       /* complex function */
646 typedef VOID H_f;       /* character function */
647 typedef VOID Z_f;       /* double complex function */
648 typedef doublereal E_f; /* real function with -R not specified */
649 
650 /* undef any lower-case symbols that your C compiler predefines, e.g.: */
651 
652 #ifndef Skip_f2c_Undefs
653 #undef cray
654 #undef gcos
655 #undef mc68010
656 #undef mc68020
657 #undef mips
658 #undef pdp11
659 #undef sgi
660 #undef sparc
661 #undef sun
662 #undef sun2
663 #undef sun3
664 #undef sun4
665 #undef u370
666 #undef u3b
667 #undef u3b2
668 #undef u3b5
669 #undef unix
670 #undef vax
671 #endif
672 #endif
673 
674 #endif
675