From 0b2bd9edd13cfff1605e7d5813f4817503d4ccc7 Mon Sep 17 00:00:00 2001 From: Dario Izzo Date: Sat, 11 Apr 2020 19:07:16 +0200 Subject: [PATCH] complex type changed as to not be in conflict with win compilers --- .../third_party/cspice/f2c.h | 517 +++++++++--------- src/third_party/cspice/c_abs.c | 4 +- src/third_party/cspice/c_cos.c | 4 +- src/third_party/cspice/c_div.c | 4 +- src/third_party/cspice/c_exp.c | 4 +- src/third_party/cspice/c_log.c | 4 +- src/third_party/cspice/c_sin.c | 4 +- src/third_party/cspice/c_sqrt.c | 4 +- src/third_party/cspice/f2c.h | 517 +++++++++--------- src/third_party/cspice/pow_ci.c | 4 +- src/third_party/cspice/r_cnjg.c | 4 +- src/third_party/cspice/r_imag.c | 4 +- src/third_party/cspice/typesize.c | 2 +- 13 files changed, 529 insertions(+), 547 deletions(-) diff --git a/include/keplerian_toolbox/third_party/cspice/f2c.h b/include/keplerian_toolbox/third_party/cspice/f2c.h index bc831d8c..80d21344 100644 --- a/include/keplerian_toolbox/third_party/cspice/f2c.h +++ b/include/keplerian_toolbox/third_party/cspice/f2c.h @@ -4,9 +4,9 @@ -Abstract - Perform standard f2c declarations, customized for the host + Perform standard f2c declarations, customized for the host environment. - + -Disclaimer THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE @@ -35,21 +35,21 @@ -Required_Reading None. - + -Particulars - The standard f2c header file f2c.h must be included by every function - generated by running f2c on Fortran source code. The header f2c.h - includes typedefs used to provide a level of indirection in mapping + The standard f2c header file f2c.h must be included by every function + generated by running f2c on Fortran source code. The header f2c.h + includes typedefs used to provide a level of indirection in mapping Fortran data types to native C data types. For example, Fortran INTEGER variables are mapped to variables of type integer, where integer is a C typedef. In the standard f2c.h header, the typedef - integer translates to the C type long. - + integer translates to the C type long. + Because the standard version of f2c.h does not work on all platforms, this header file contains two platform-dependent versions of it, meant to be selected at build time via precompiler switches. The - precompiler switches reference macros defined in SpiceZpl.h to + precompiler switches reference macros defined in SpiceZpl.h to determine for which host platform the code is targeted. The first version of f2c.h, which works on most platforms, is copied directly from the standard version of f2c.h. The second version is intended @@ -60,34 +60,34 @@ INTEGERS should be mapped to 4-byte ints rather than 8-byte longs on the platforms having 8-byte longs. In order to achieve this, the header f2c.h was transformed using the sed command - + sed 's/long //' f2c.h - + The high-level structure of this file is then: - + # if ( defined(CSPICE_ALPHA_DIGITAL_UNIX ) \ || defined(CSPICE_SUN_SOLARIS_64BIT_GCC ) ) - - + + [ Alpha/Digital Unix and Sun Solaris 64 bit mode/gcc version of f2c.h source code ] - + # else - + [ Standard version of f2c.h source code ] - - # endif - + + # endif + -Restrictions 1) This header file must be updated whenever the f2c processor or the f2c libraries libI77 and libF77 are updated. - + 2) This header may need to be updated to support new platforms. The supported platforms at the time of the 31-JAN-1999 release are: - + ALPHA-DIGITAL-UNIX HP NEXT @@ -95,8 +95,8 @@ PC-MS SGI-IRIX-N32 SGI-IRIX-NO2 - SUN-SOLARIS - + SUN-SOLARIS + -Literature_References None. @@ -106,44 +106,44 @@ N.J. Bachman (JPL) B.V. Semenov (JPL) E.D. Wright (JPL) - + -Version -CSPICE Version 4.2.0, 09-APR-2014 (EDW) (BVS) Added include for SpiceZrnm.h to eliminate symbol conflict encountered from Icy and JNISpice under OS X 10.7. - + Minor text format correction to eliminate error signal from OS X cpp. The edit removes leading whitespace from the final "#endif". Updated for: - + PC-CYGWIN-64BIT-GCC_C - + environment. Added the corresponding tag: - + CSPICE_PC_CYGWIN_64BIT_GCC tag to the #ifdefs set. - + -CSPICE Version 4.1.0, 14-MAY-2010 (EDW)(BVS) Updated for: - + MAC-OSX-64BIT-INTEL_C SUN-SOLARIS-64BIT-NATIVE_C SUN-SOLARIS-INTEL-64BIT-CC_C - + environments. Added the corresponding tags: - + CSPICE_MAC_OSX_INTEL_64BIT_GCC CSPICE_SUN_SOLARIS_64BIT_NATIVE CSPICE_SUN_SOLARIS_INTEL_64BIT_CC tag to the #ifdefs set. - + -CSPICE Version 4.0.0, 21-FEB-2006 (NJB) Updated to support the PC Linux 64 bit mode/gcc platform. @@ -160,28 +160,26 @@ one defines the preprocessor flag MIX_C_AND_FORTRAN - + This macro is undefined by default, since the action it invokes - is usually not desirable. See the header + is usually not desirable. See the header f2cMang.h for further information. - -CSPICE Version 1.0.0, 07-FEB-1999 (NJB) + -CSPICE Version 1.0.0, 07-FEB-1999 (NJB) */ - /* Include those rename assignments for routines whose symbols will collide with other libraries. */ -#ifndef HAVE_SPICERENAME_H +#ifndef HAVE_SPICERENAME_H #include "SpiceZrnm.h" #endif - /* Optionally include name-mangling macros for f2c external symbols. */ @@ -189,37 +187,27 @@ Optionally include name-mangling macros for f2c external symbols. #include "f2cMang.h" #endif +/* +Include CSPICE platform macro definitions. +*/ +#include "SpiceZpl.h" - /* - Include CSPICE platform macro definitions. - */ - #include "SpiceZpl.h" - - -#if ( defined(CSPICE_ALPHA_DIGITAL_UNIX ) \ - || defined(CSPICE_SUN_SOLARIS_64BIT_GCC ) \ - || defined(CSPICE_SUN_SOLARIS_64BIT_NATIVE ) \ - || defined(CSPICE_MAC_OSX_INTEL_64BIT_GCC ) \ - || defined(CSPICE_SUN_SOLARIS_INTEL_64BIT_CC ) \ - || defined(CSPICE_PC_CYGWIN_64BIT_GCC ) \ - || defined(CSPICE_PC_LINUX_64BIT_GCC ) ) - - - /* - MODIFICATION - - The following code is intended to be used on the platforms where - a long is the size of a double and an int is half the - size of a double. - - Note that the comment line below indicating that the header is - "Standard" has been retained from the original, but is no longer - true. - */ - +#if (defined(CSPICE_ALPHA_DIGITAL_UNIX) || defined(CSPICE_SUN_SOLARIS_64BIT_GCC) \ + || defined(CSPICE_SUN_SOLARIS_64BIT_NATIVE) || defined(CSPICE_MAC_OSX_INTEL_64BIT_GCC) \ + || defined(CSPICE_SUN_SOLARIS_INTEL_64BIT_CC) || defined(CSPICE_PC_CYGWIN_64BIT_GCC) \ + || defined(CSPICE_PC_LINUX_64BIT_GCC)) +/* +MODIFICATION +The following code is intended to be used on the platforms where +a long is the size of a double and an int is half the +size of a double. +Note that the comment line below indicating that the header is +"Standard" has been retained from the original, but is no longer +true. +*/ /* f2c.h -- Standard Fortran to C header file */ @@ -232,8 +220,12 @@ typedef char *address; typedef short int shortint; typedef float real; typedef double doublereal; -typedef struct { real r, i; } complex; -typedef struct { doublereal r, i; } doublecomplex; +typedef struct { + real r, i; +} complex_type; +typedef struct { + doublereal r, i; +} doublecomplex; typedef int logical; typedef short int shortlogical; typedef char logical1; @@ -241,8 +233,8 @@ typedef char integer1; #if 0 /* Adjust for integer*8. */ typedef long longint; /* system-dependent */ typedef unsigned long ulongint; /* system-dependent */ -#define qbit_clear(a,b) ((a) & ~((ulongint)1 << (b))) -#define qbit_set(a,b) ((a) | ((ulongint)1 << (b))) +#define qbit_clear(a, b) ((a) & ~((ulongint)1 << (b))) +#define qbit_set(a, b) ((a) | ((ulongint)1 << (b))) #endif #define TRUE_ (1) @@ -267,121 +259,121 @@ typedef int ftnint; #endif /*external read, write*/ -typedef struct -{ flag cierr; - ftnint ciunit; - flag ciend; - char *cifmt; - ftnint cirec; +typedef struct { + flag cierr; + ftnint ciunit; + flag ciend; + char *cifmt; + ftnint cirec; } cilist; /*internal read, write*/ -typedef struct -{ flag icierr; - char *iciunit; - flag iciend; - char *icifmt; - ftnint icirlen; - ftnint icirnum; +typedef struct { + flag icierr; + char *iciunit; + flag iciend; + char *icifmt; + ftnint icirlen; + ftnint icirnum; } icilist; /*open*/ -typedef struct -{ flag oerr; - ftnint ounit; - char *ofnm; - ftnlen ofnmlen; - char *osta; - char *oacc; - char *ofm; - ftnint orl; - char *oblnk; +typedef struct { + flag oerr; + ftnint ounit; + char *ofnm; + ftnlen ofnmlen; + char *osta; + char *oacc; + char *ofm; + ftnint orl; + char *oblnk; } olist; /*close*/ -typedef struct -{ flag cerr; - ftnint cunit; - char *csta; +typedef struct { + flag cerr; + ftnint cunit; + char *csta; } cllist; /*rewind, backspace, endfile*/ -typedef struct -{ flag aerr; - ftnint aunit; +typedef struct { + flag aerr; + ftnint aunit; } alist; /* inquire */ -typedef struct -{ flag inerr; - ftnint inunit; - char *infile; - ftnlen infilen; - ftnint *inex; /*parameters in standard's order*/ - ftnint *inopen; - ftnint *innum; - ftnint *innamed; - char *inname; - ftnlen innamlen; - char *inacc; - ftnlen inacclen; - char *inseq; - ftnlen inseqlen; - char *indir; - ftnlen indirlen; - char *infmt; - ftnlen infmtlen; - char *inform; - ftnint informlen; - char *inunf; - ftnlen inunflen; - ftnint *inrecl; - ftnint *innrec; - char *inblank; - ftnlen inblanklen; +typedef struct { + flag inerr; + ftnint inunit; + char *infile; + ftnlen infilen; + ftnint *inex; /*parameters in standard's order*/ + ftnint *inopen; + ftnint *innum; + ftnint *innamed; + char *inname; + ftnlen innamlen; + char *inacc; + ftnlen inacclen; + char *inseq; + ftnlen inseqlen; + char *indir; + ftnlen indirlen; + char *infmt; + ftnlen infmtlen; + char *inform; + ftnint informlen; + char *inunf; + ftnlen inunflen; + ftnint *inrecl; + ftnint *innrec; + char *inblank; + ftnlen inblanklen; } inlist; #define VOID void union Multitype { /* for multiple entry points */ - integer1 g; - shortint h; - integer i; - /* longint j; */ - real r; - doublereal d; - complex c; - doublecomplex z; - }; + integer1 g; + shortint h; + integer i; + /* longint j; */ + real r; + doublereal d; + complex_type c; + doublecomplex z; +}; typedef union Multitype Multitype; -/*typedef int Long;*/ /* No longer used; formerly in Namelist */ +/*typedef int Long;*/ /* No longer used; formerly in Namelist */ -struct Vardesc { /* for Namelist */ - char *name; - char *addr; - ftnlen *dims; - int type; - }; +struct Vardesc { /* for Namelist */ + char *name; + char *addr; + ftnlen *dims; + int type; +}; typedef struct Vardesc Vardesc; struct Namelist { - char *name; - Vardesc **vars; - int nvars; - }; + char *name; + Vardesc **vars; + int nvars; +}; typedef struct Namelist Namelist; #define abs(x) ((x) >= 0 ? (x) : -(x)) -#define dabs(x) (doublereal)abs(x) -#define min(a,b) ((a) <= (b) ? (a) : (b)) -#define max(a,b) ((a) >= (b) ? (a) : (b)) -#define dmin(a,b) (doublereal)min(a,b) -#define dmax(a,b) (doublereal)max(a,b) -#define bit_test(a,b) ((a) >> (b) & 1) -#define bit_clear(a,b) ((a) & ~((uinteger)1 << (b))) -#define bit_set(a,b) ((a) | ((uinteger)1 << (b))) +#define dabs(x) (doublereal) abs(x) +#define min(a, b) ((a) <= (b) ? (a) : (b)) +#define max(a, b) ((a) >= (b) ? (a) : (b)) +#define dmin(a, b) (doublereal) min(a, b) +#define dmax(a, b) (doublereal) max(a, b) +#define bit_test(a, b) ((a) >> (b)&1) +#define bit_clear(a, b) ((a) & ~((uinteger)1 << (b))) +#define bit_set(a, b) ((a) | ((uinteger)1 << (b))) /* procedure parameter types for -A and -C++ */ @@ -412,9 +404,9 @@ typedef /* Character */ VOID (*H_fp)(); typedef /* Subroutine */ int (*S_fp)(); #endif /* E_fp is for real functions when -R is not specified */ -typedef VOID C_f; /* complex function */ -typedef VOID H_f; /* character function */ -typedef VOID Z_f; /* double complex function */ +typedef VOID C_f; /* complex function */ +typedef VOID H_f; /* character function */ +typedef VOID Z_f; /* double complex function */ typedef doublereal E_f; /* real function with -R not specified */ /* undef any lower-case symbols that your C compiler predefines, e.g.: */ @@ -441,25 +433,22 @@ typedef doublereal E_f; /* real function with -R not specified */ #endif #endif - - /* - This marks the end of the MODIFICATION section version of f2c.h. - */ +/* +This marks the end of the MODIFICATION section version of f2c.h. +*/ #else - /* - The following code is the standard f2c.h header. In this - header, an "integer" is defined to be of type long. - - Because the code is copied verbatim, it does not follow the usual - CSPICE indentation pattern. - */ +/* +The following code is the standard f2c.h header. In this +header, an "integer" is defined to be of type long. +Because the code is copied verbatim, it does not follow the usual +CSPICE indentation pattern. +*/ /* f2c.h -- Standard Fortran to C header file */ - #ifndef F2C_INCLUDE #define F2C_INCLUDE @@ -469,8 +458,12 @@ typedef char *address; typedef short int shortint; typedef float real; typedef double doublereal; -typedef struct { real r, i; } complex; -typedef struct { doublereal r, i; } doublecomplex; +typedef struct { + real r, i; +} complex_type; +typedef struct { + doublereal r, i; +} doublecomplex; typedef long int logical; typedef short int shortlogical; typedef char logical1; @@ -478,8 +471,8 @@ typedef char integer1; #if 0 /* Adjust for integer*8. */ typedef long long longint; /* system-dependent */ typedef unsigned long long ulongint; /* system-dependent */ -#define qbit_clear(a,b) ((a) & ~((ulongint)1 << (b))) -#define qbit_set(a,b) ((a) | ((ulongint)1 << (b))) +#define qbit_clear(a, b) ((a) & ~((ulongint)1 << (b))) +#define qbit_set(a, b) ((a) | ((ulongint)1 << (b))) #endif #define TRUE_ (1) @@ -504,121 +497,121 @@ typedef long int ftnint; #endif /*external read, write*/ -typedef struct -{ flag cierr; - ftnint ciunit; - flag ciend; - char *cifmt; - ftnint cirec; +typedef struct { + flag cierr; + ftnint ciunit; + flag ciend; + char *cifmt; + ftnint cirec; } cilist; /*internal read, write*/ -typedef struct -{ flag icierr; - char *iciunit; - flag iciend; - char *icifmt; - ftnint icirlen; - ftnint icirnum; +typedef struct { + flag icierr; + char *iciunit; + flag iciend; + char *icifmt; + ftnint icirlen; + ftnint icirnum; } icilist; /*open*/ -typedef struct -{ flag oerr; - ftnint ounit; - char *ofnm; - ftnlen ofnmlen; - char *osta; - char *oacc; - char *ofm; - ftnint orl; - char *oblnk; +typedef struct { + flag oerr; + ftnint ounit; + char *ofnm; + ftnlen ofnmlen; + char *osta; + char *oacc; + char *ofm; + ftnint orl; + char *oblnk; } olist; /*close*/ -typedef struct -{ flag cerr; - ftnint cunit; - char *csta; +typedef struct { + flag cerr; + ftnint cunit; + char *csta; } cllist; /*rewind, backspace, endfile*/ -typedef struct -{ flag aerr; - ftnint aunit; +typedef struct { + flag aerr; + ftnint aunit; } alist; /* inquire */ -typedef struct -{ flag inerr; - ftnint inunit; - char *infile; - ftnlen infilen; - ftnint *inex; /*parameters in standard's order*/ - ftnint *inopen; - ftnint *innum; - ftnint *innamed; - char *inname; - ftnlen innamlen; - char *inacc; - ftnlen inacclen; - char *inseq; - ftnlen inseqlen; - char *indir; - ftnlen indirlen; - char *infmt; - ftnlen infmtlen; - char *inform; - ftnint informlen; - char *inunf; - ftnlen inunflen; - ftnint *inrecl; - ftnint *innrec; - char *inblank; - ftnlen inblanklen; +typedef struct { + flag inerr; + ftnint inunit; + char *infile; + ftnlen infilen; + ftnint *inex; /*parameters in standard's order*/ + ftnint *inopen; + ftnint *innum; + ftnint *innamed; + char *inname; + ftnlen innamlen; + char *inacc; + ftnlen inacclen; + char *inseq; + ftnlen inseqlen; + char *indir; + ftnlen indirlen; + char *infmt; + ftnlen infmtlen; + char *inform; + ftnint informlen; + char *inunf; + ftnlen inunflen; + ftnint *inrecl; + ftnint *innrec; + char *inblank; + ftnlen inblanklen; } inlist; #define VOID void union Multitype { /* for multiple entry points */ - integer1 g; - shortint h; - integer i; - /* longint j; */ - real r; - doublereal d; - complex c; - doublecomplex z; - }; + integer1 g; + shortint h; + integer i; + /* longint j; */ + real r; + doublereal d; + complex_type c; + doublecomplex z; +}; typedef union Multitype Multitype; /*typedef long int Long;*/ /* No longer used; formerly in Namelist */ -struct Vardesc { /* for Namelist */ - char *name; - char *addr; - ftnlen *dims; - int type; - }; +struct Vardesc { /* for Namelist */ + char *name; + char *addr; + ftnlen *dims; + int type; +}; typedef struct Vardesc Vardesc; struct Namelist { - char *name; - Vardesc **vars; - int nvars; - }; + char *name; + Vardesc **vars; + int nvars; +}; typedef struct Namelist Namelist; #define abs(x) ((x) >= 0 ? (x) : -(x)) -#define dabs(x) (doublereal)abs(x) -#define min(a,b) ((a) <= (b) ? (a) : (b)) -#define max(a,b) ((a) >= (b) ? (a) : (b)) -#define dmin(a,b) (doublereal)min(a,b) -#define dmax(a,b) (doublereal)max(a,b) -#define bit_test(a,b) ((a) >> (b) & 1) -#define bit_clear(a,b) ((a) & ~((uinteger)1 << (b))) -#define bit_set(a,b) ((a) | ((uinteger)1 << (b))) +#define dabs(x) (doublereal) abs(x) +#define min(a, b) ((a) <= (b) ? (a) : (b)) +#define max(a, b) ((a) >= (b) ? (a) : (b)) +#define dmin(a, b) (doublereal) min(a, b) +#define dmax(a, b) (doublereal) max(a, b) +#define bit_test(a, b) ((a) >> (b)&1) +#define bit_clear(a, b) ((a) & ~((uinteger)1 << (b))) +#define bit_set(a, b) ((a) | ((uinteger)1 << (b))) /* procedure parameter types for -A and -C++ */ @@ -649,9 +642,9 @@ typedef /* Character */ VOID (*H_fp)(); typedef /* Subroutine */ int (*S_fp)(); #endif /* E_fp is for real functions when -R is not specified */ -typedef VOID C_f; /* complex function */ -typedef VOID H_f; /* character function */ -typedef VOID Z_f; /* double complex function */ +typedef VOID C_f; /* complex function */ +typedef VOID H_f; /* character function */ +typedef VOID Z_f; /* double complex function */ typedef doublereal E_f; /* real function with -R not specified */ /* undef any lower-case symbols that your C compiler predefines, e.g.: */ @@ -678,6 +671,4 @@ typedef doublereal E_f; /* real function with -R not specified */ #endif #endif - #endif - diff --git a/src/third_party/cspice/c_abs.c b/src/third_party/cspice/c_abs.c index 041fbd3d..b26a64b4 100644 --- a/src/third_party/cspice/c_abs.c +++ b/src/third_party/cspice/c_abs.c @@ -3,11 +3,11 @@ #ifdef KR_headers extern double f__cabs(); -double c_abs(z) complex *z; +double c_abs(z) complex_type *z; #else extern double f__cabs(double, double); -double c_abs(complex *z) +double c_abs(complex_type *z) #endif { return( f__cabs( z->r, z->i ) ); diff --git a/src/third_party/cspice/c_cos.c b/src/third_party/cspice/c_cos.c index 4aea0c3c..b276dbef 100644 --- a/src/third_party/cspice/c_cos.c +++ b/src/third_party/cspice/c_cos.c @@ -3,12 +3,12 @@ #ifdef KR_headers extern double sin(), cos(), sinh(), cosh(); -VOID c_cos(r, z) complex *r, *z; +VOID c_cos(r, z) complex_type *r, *z; #else #undef abs #include "math.h" -void c_cos(complex *r, complex *z) +void c_cos(complex_type *r, complex_type *z) #endif { double zr = z->r; diff --git a/src/third_party/cspice/c_div.c b/src/third_party/cspice/c_div.c index ac963079..9a0c0706 100644 --- a/src/third_party/cspice/c_div.c +++ b/src/third_party/cspice/c_div.c @@ -3,10 +3,10 @@ #ifdef KR_headers extern VOID sig_die(); VOID c_div(c, a, b) -complex *a, *b, *c; +complex_type *a, *b, *c; #else extern void sig_die(char*,int); -void c_div(complex *c, complex *a, complex *b) +void c_div(complex_type *c, complex_type *a, complex_type *b) #endif { double ratio, den; diff --git a/src/third_party/cspice/c_exp.c b/src/third_party/cspice/c_exp.c index 8252c7f7..67fba1e0 100644 --- a/src/third_party/cspice/c_exp.c +++ b/src/third_party/cspice/c_exp.c @@ -3,12 +3,12 @@ #ifdef KR_headers extern double exp(), cos(), sin(); - VOID c_exp(r, z) complex *r, *z; + VOID c_exp(r, z) complex_type *r, *z; #else #undef abs #include "math.h" -void c_exp(complex *r, complex *z) +void c_exp(complex_type *r, complex_type *z) #endif { double expx; diff --git a/src/third_party/cspice/c_log.c b/src/third_party/cspice/c_log.c index 6ac990ca..988424d9 100644 --- a/src/third_party/cspice/c_log.c +++ b/src/third_party/cspice/c_log.c @@ -2,13 +2,13 @@ #ifdef KR_headers extern double log(), f__cabs(), atan2(); -VOID c_log(r, z) complex *r, *z; +VOID c_log(r, z) complex_type *r, *z; #else #undef abs #include "math.h" extern double f__cabs(double, double); -void c_log(complex *r, complex *z) +void c_log(complex_type *r, complex_type *z) #endif { double zi; diff --git a/src/third_party/cspice/c_sin.c b/src/third_party/cspice/c_sin.c index 15acccc5..78acff0f 100644 --- a/src/third_party/cspice/c_sin.c +++ b/src/third_party/cspice/c_sin.c @@ -3,12 +3,12 @@ #ifdef KR_headers extern double sin(), cos(), sinh(), cosh(); -VOID c_sin(r, z) complex *r, *z; +VOID c_sin(r, z) complex_type *r, *z; #else #undef abs #include "math.h" -void c_sin(complex *r, complex *z) +void c_sin(complex_type *r, complex_type *z) #endif { double zr = z->r; diff --git a/src/third_party/cspice/c_sqrt.c b/src/third_party/cspice/c_sqrt.c index 8481ee48..f4905a63 100644 --- a/src/third_party/cspice/c_sqrt.c +++ b/src/third_party/cspice/c_sqrt.c @@ -3,13 +3,13 @@ #ifdef KR_headers extern double sqrt(), f__cabs(); -VOID c_sqrt(r, z) complex *r, *z; +VOID c_sqrt(r, z) complex_type *r, *z; #else #undef abs #include "math.h" extern double f__cabs(double, double); -void c_sqrt(complex *r, complex *z) +void c_sqrt(complex_type *r, complex_type *z) #endif { double mag, t; diff --git a/src/third_party/cspice/f2c.h b/src/third_party/cspice/f2c.h index bc831d8c..80d21344 100644 --- a/src/third_party/cspice/f2c.h +++ b/src/third_party/cspice/f2c.h @@ -4,9 +4,9 @@ -Abstract - Perform standard f2c declarations, customized for the host + Perform standard f2c declarations, customized for the host environment. - + -Disclaimer THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE @@ -35,21 +35,21 @@ -Required_Reading None. - + -Particulars - The standard f2c header file f2c.h must be included by every function - generated by running f2c on Fortran source code. The header f2c.h - includes typedefs used to provide a level of indirection in mapping + The standard f2c header file f2c.h must be included by every function + generated by running f2c on Fortran source code. The header f2c.h + includes typedefs used to provide a level of indirection in mapping Fortran data types to native C data types. For example, Fortran INTEGER variables are mapped to variables of type integer, where integer is a C typedef. In the standard f2c.h header, the typedef - integer translates to the C type long. - + integer translates to the C type long. + Because the standard version of f2c.h does not work on all platforms, this header file contains two platform-dependent versions of it, meant to be selected at build time via precompiler switches. The - precompiler switches reference macros defined in SpiceZpl.h to + precompiler switches reference macros defined in SpiceZpl.h to determine for which host platform the code is targeted. The first version of f2c.h, which works on most platforms, is copied directly from the standard version of f2c.h. The second version is intended @@ -60,34 +60,34 @@ INTEGERS should be mapped to 4-byte ints rather than 8-byte longs on the platforms having 8-byte longs. In order to achieve this, the header f2c.h was transformed using the sed command - + sed 's/long //' f2c.h - + The high-level structure of this file is then: - + # if ( defined(CSPICE_ALPHA_DIGITAL_UNIX ) \ || defined(CSPICE_SUN_SOLARIS_64BIT_GCC ) ) - - + + [ Alpha/Digital Unix and Sun Solaris 64 bit mode/gcc version of f2c.h source code ] - + # else - + [ Standard version of f2c.h source code ] - - # endif - + + # endif + -Restrictions 1) This header file must be updated whenever the f2c processor or the f2c libraries libI77 and libF77 are updated. - + 2) This header may need to be updated to support new platforms. The supported platforms at the time of the 31-JAN-1999 release are: - + ALPHA-DIGITAL-UNIX HP NEXT @@ -95,8 +95,8 @@ PC-MS SGI-IRIX-N32 SGI-IRIX-NO2 - SUN-SOLARIS - + SUN-SOLARIS + -Literature_References None. @@ -106,44 +106,44 @@ N.J. Bachman (JPL) B.V. Semenov (JPL) E.D. Wright (JPL) - + -Version -CSPICE Version 4.2.0, 09-APR-2014 (EDW) (BVS) Added include for SpiceZrnm.h to eliminate symbol conflict encountered from Icy and JNISpice under OS X 10.7. - + Minor text format correction to eliminate error signal from OS X cpp. The edit removes leading whitespace from the final "#endif". Updated for: - + PC-CYGWIN-64BIT-GCC_C - + environment. Added the corresponding tag: - + CSPICE_PC_CYGWIN_64BIT_GCC tag to the #ifdefs set. - + -CSPICE Version 4.1.0, 14-MAY-2010 (EDW)(BVS) Updated for: - + MAC-OSX-64BIT-INTEL_C SUN-SOLARIS-64BIT-NATIVE_C SUN-SOLARIS-INTEL-64BIT-CC_C - + environments. Added the corresponding tags: - + CSPICE_MAC_OSX_INTEL_64BIT_GCC CSPICE_SUN_SOLARIS_64BIT_NATIVE CSPICE_SUN_SOLARIS_INTEL_64BIT_CC tag to the #ifdefs set. - + -CSPICE Version 4.0.0, 21-FEB-2006 (NJB) Updated to support the PC Linux 64 bit mode/gcc platform. @@ -160,28 +160,26 @@ one defines the preprocessor flag MIX_C_AND_FORTRAN - + This macro is undefined by default, since the action it invokes - is usually not desirable. See the header + is usually not desirable. See the header f2cMang.h for further information. - -CSPICE Version 1.0.0, 07-FEB-1999 (NJB) + -CSPICE Version 1.0.0, 07-FEB-1999 (NJB) */ - /* Include those rename assignments for routines whose symbols will collide with other libraries. */ -#ifndef HAVE_SPICERENAME_H +#ifndef HAVE_SPICERENAME_H #include "SpiceZrnm.h" #endif - /* Optionally include name-mangling macros for f2c external symbols. */ @@ -189,37 +187,27 @@ Optionally include name-mangling macros for f2c external symbols. #include "f2cMang.h" #endif +/* +Include CSPICE platform macro definitions. +*/ +#include "SpiceZpl.h" - /* - Include CSPICE platform macro definitions. - */ - #include "SpiceZpl.h" - - -#if ( defined(CSPICE_ALPHA_DIGITAL_UNIX ) \ - || defined(CSPICE_SUN_SOLARIS_64BIT_GCC ) \ - || defined(CSPICE_SUN_SOLARIS_64BIT_NATIVE ) \ - || defined(CSPICE_MAC_OSX_INTEL_64BIT_GCC ) \ - || defined(CSPICE_SUN_SOLARIS_INTEL_64BIT_CC ) \ - || defined(CSPICE_PC_CYGWIN_64BIT_GCC ) \ - || defined(CSPICE_PC_LINUX_64BIT_GCC ) ) - - - /* - MODIFICATION - - The following code is intended to be used on the platforms where - a long is the size of a double and an int is half the - size of a double. - - Note that the comment line below indicating that the header is - "Standard" has been retained from the original, but is no longer - true. - */ - +#if (defined(CSPICE_ALPHA_DIGITAL_UNIX) || defined(CSPICE_SUN_SOLARIS_64BIT_GCC) \ + || defined(CSPICE_SUN_SOLARIS_64BIT_NATIVE) || defined(CSPICE_MAC_OSX_INTEL_64BIT_GCC) \ + || defined(CSPICE_SUN_SOLARIS_INTEL_64BIT_CC) || defined(CSPICE_PC_CYGWIN_64BIT_GCC) \ + || defined(CSPICE_PC_LINUX_64BIT_GCC)) +/* +MODIFICATION +The following code is intended to be used on the platforms where +a long is the size of a double and an int is half the +size of a double. +Note that the comment line below indicating that the header is +"Standard" has been retained from the original, but is no longer +true. +*/ /* f2c.h -- Standard Fortran to C header file */ @@ -232,8 +220,12 @@ typedef char *address; typedef short int shortint; typedef float real; typedef double doublereal; -typedef struct { real r, i; } complex; -typedef struct { doublereal r, i; } doublecomplex; +typedef struct { + real r, i; +} complex_type; +typedef struct { + doublereal r, i; +} doublecomplex; typedef int logical; typedef short int shortlogical; typedef char logical1; @@ -241,8 +233,8 @@ typedef char integer1; #if 0 /* Adjust for integer*8. */ typedef long longint; /* system-dependent */ typedef unsigned long ulongint; /* system-dependent */ -#define qbit_clear(a,b) ((a) & ~((ulongint)1 << (b))) -#define qbit_set(a,b) ((a) | ((ulongint)1 << (b))) +#define qbit_clear(a, b) ((a) & ~((ulongint)1 << (b))) +#define qbit_set(a, b) ((a) | ((ulongint)1 << (b))) #endif #define TRUE_ (1) @@ -267,121 +259,121 @@ typedef int ftnint; #endif /*external read, write*/ -typedef struct -{ flag cierr; - ftnint ciunit; - flag ciend; - char *cifmt; - ftnint cirec; +typedef struct { + flag cierr; + ftnint ciunit; + flag ciend; + char *cifmt; + ftnint cirec; } cilist; /*internal read, write*/ -typedef struct -{ flag icierr; - char *iciunit; - flag iciend; - char *icifmt; - ftnint icirlen; - ftnint icirnum; +typedef struct { + flag icierr; + char *iciunit; + flag iciend; + char *icifmt; + ftnint icirlen; + ftnint icirnum; } icilist; /*open*/ -typedef struct -{ flag oerr; - ftnint ounit; - char *ofnm; - ftnlen ofnmlen; - char *osta; - char *oacc; - char *ofm; - ftnint orl; - char *oblnk; +typedef struct { + flag oerr; + ftnint ounit; + char *ofnm; + ftnlen ofnmlen; + char *osta; + char *oacc; + char *ofm; + ftnint orl; + char *oblnk; } olist; /*close*/ -typedef struct -{ flag cerr; - ftnint cunit; - char *csta; +typedef struct { + flag cerr; + ftnint cunit; + char *csta; } cllist; /*rewind, backspace, endfile*/ -typedef struct -{ flag aerr; - ftnint aunit; +typedef struct { + flag aerr; + ftnint aunit; } alist; /* inquire */ -typedef struct -{ flag inerr; - ftnint inunit; - char *infile; - ftnlen infilen; - ftnint *inex; /*parameters in standard's order*/ - ftnint *inopen; - ftnint *innum; - ftnint *innamed; - char *inname; - ftnlen innamlen; - char *inacc; - ftnlen inacclen; - char *inseq; - ftnlen inseqlen; - char *indir; - ftnlen indirlen; - char *infmt; - ftnlen infmtlen; - char *inform; - ftnint informlen; - char *inunf; - ftnlen inunflen; - ftnint *inrecl; - ftnint *innrec; - char *inblank; - ftnlen inblanklen; +typedef struct { + flag inerr; + ftnint inunit; + char *infile; + ftnlen infilen; + ftnint *inex; /*parameters in standard's order*/ + ftnint *inopen; + ftnint *innum; + ftnint *innamed; + char *inname; + ftnlen innamlen; + char *inacc; + ftnlen inacclen; + char *inseq; + ftnlen inseqlen; + char *indir; + ftnlen indirlen; + char *infmt; + ftnlen infmtlen; + char *inform; + ftnint informlen; + char *inunf; + ftnlen inunflen; + ftnint *inrecl; + ftnint *innrec; + char *inblank; + ftnlen inblanklen; } inlist; #define VOID void union Multitype { /* for multiple entry points */ - integer1 g; - shortint h; - integer i; - /* longint j; */ - real r; - doublereal d; - complex c; - doublecomplex z; - }; + integer1 g; + shortint h; + integer i; + /* longint j; */ + real r; + doublereal d; + complex_type c; + doublecomplex z; +}; typedef union Multitype Multitype; -/*typedef int Long;*/ /* No longer used; formerly in Namelist */ +/*typedef int Long;*/ /* No longer used; formerly in Namelist */ -struct Vardesc { /* for Namelist */ - char *name; - char *addr; - ftnlen *dims; - int type; - }; +struct Vardesc { /* for Namelist */ + char *name; + char *addr; + ftnlen *dims; + int type; +}; typedef struct Vardesc Vardesc; struct Namelist { - char *name; - Vardesc **vars; - int nvars; - }; + char *name; + Vardesc **vars; + int nvars; +}; typedef struct Namelist Namelist; #define abs(x) ((x) >= 0 ? (x) : -(x)) -#define dabs(x) (doublereal)abs(x) -#define min(a,b) ((a) <= (b) ? (a) : (b)) -#define max(a,b) ((a) >= (b) ? (a) : (b)) -#define dmin(a,b) (doublereal)min(a,b) -#define dmax(a,b) (doublereal)max(a,b) -#define bit_test(a,b) ((a) >> (b) & 1) -#define bit_clear(a,b) ((a) & ~((uinteger)1 << (b))) -#define bit_set(a,b) ((a) | ((uinteger)1 << (b))) +#define dabs(x) (doublereal) abs(x) +#define min(a, b) ((a) <= (b) ? (a) : (b)) +#define max(a, b) ((a) >= (b) ? (a) : (b)) +#define dmin(a, b) (doublereal) min(a, b) +#define dmax(a, b) (doublereal) max(a, b) +#define bit_test(a, b) ((a) >> (b)&1) +#define bit_clear(a, b) ((a) & ~((uinteger)1 << (b))) +#define bit_set(a, b) ((a) | ((uinteger)1 << (b))) /* procedure parameter types for -A and -C++ */ @@ -412,9 +404,9 @@ typedef /* Character */ VOID (*H_fp)(); typedef /* Subroutine */ int (*S_fp)(); #endif /* E_fp is for real functions when -R is not specified */ -typedef VOID C_f; /* complex function */ -typedef VOID H_f; /* character function */ -typedef VOID Z_f; /* double complex function */ +typedef VOID C_f; /* complex function */ +typedef VOID H_f; /* character function */ +typedef VOID Z_f; /* double complex function */ typedef doublereal E_f; /* real function with -R not specified */ /* undef any lower-case symbols that your C compiler predefines, e.g.: */ @@ -441,25 +433,22 @@ typedef doublereal E_f; /* real function with -R not specified */ #endif #endif - - /* - This marks the end of the MODIFICATION section version of f2c.h. - */ +/* +This marks the end of the MODIFICATION section version of f2c.h. +*/ #else - /* - The following code is the standard f2c.h header. In this - header, an "integer" is defined to be of type long. - - Because the code is copied verbatim, it does not follow the usual - CSPICE indentation pattern. - */ +/* +The following code is the standard f2c.h header. In this +header, an "integer" is defined to be of type long. +Because the code is copied verbatim, it does not follow the usual +CSPICE indentation pattern. +*/ /* f2c.h -- Standard Fortran to C header file */ - #ifndef F2C_INCLUDE #define F2C_INCLUDE @@ -469,8 +458,12 @@ typedef char *address; typedef short int shortint; typedef float real; typedef double doublereal; -typedef struct { real r, i; } complex; -typedef struct { doublereal r, i; } doublecomplex; +typedef struct { + real r, i; +} complex_type; +typedef struct { + doublereal r, i; +} doublecomplex; typedef long int logical; typedef short int shortlogical; typedef char logical1; @@ -478,8 +471,8 @@ typedef char integer1; #if 0 /* Adjust for integer*8. */ typedef long long longint; /* system-dependent */ typedef unsigned long long ulongint; /* system-dependent */ -#define qbit_clear(a,b) ((a) & ~((ulongint)1 << (b))) -#define qbit_set(a,b) ((a) | ((ulongint)1 << (b))) +#define qbit_clear(a, b) ((a) & ~((ulongint)1 << (b))) +#define qbit_set(a, b) ((a) | ((ulongint)1 << (b))) #endif #define TRUE_ (1) @@ -504,121 +497,121 @@ typedef long int ftnint; #endif /*external read, write*/ -typedef struct -{ flag cierr; - ftnint ciunit; - flag ciend; - char *cifmt; - ftnint cirec; +typedef struct { + flag cierr; + ftnint ciunit; + flag ciend; + char *cifmt; + ftnint cirec; } cilist; /*internal read, write*/ -typedef struct -{ flag icierr; - char *iciunit; - flag iciend; - char *icifmt; - ftnint icirlen; - ftnint icirnum; +typedef struct { + flag icierr; + char *iciunit; + flag iciend; + char *icifmt; + ftnint icirlen; + ftnint icirnum; } icilist; /*open*/ -typedef struct -{ flag oerr; - ftnint ounit; - char *ofnm; - ftnlen ofnmlen; - char *osta; - char *oacc; - char *ofm; - ftnint orl; - char *oblnk; +typedef struct { + flag oerr; + ftnint ounit; + char *ofnm; + ftnlen ofnmlen; + char *osta; + char *oacc; + char *ofm; + ftnint orl; + char *oblnk; } olist; /*close*/ -typedef struct -{ flag cerr; - ftnint cunit; - char *csta; +typedef struct { + flag cerr; + ftnint cunit; + char *csta; } cllist; /*rewind, backspace, endfile*/ -typedef struct -{ flag aerr; - ftnint aunit; +typedef struct { + flag aerr; + ftnint aunit; } alist; /* inquire */ -typedef struct -{ flag inerr; - ftnint inunit; - char *infile; - ftnlen infilen; - ftnint *inex; /*parameters in standard's order*/ - ftnint *inopen; - ftnint *innum; - ftnint *innamed; - char *inname; - ftnlen innamlen; - char *inacc; - ftnlen inacclen; - char *inseq; - ftnlen inseqlen; - char *indir; - ftnlen indirlen; - char *infmt; - ftnlen infmtlen; - char *inform; - ftnint informlen; - char *inunf; - ftnlen inunflen; - ftnint *inrecl; - ftnint *innrec; - char *inblank; - ftnlen inblanklen; +typedef struct { + flag inerr; + ftnint inunit; + char *infile; + ftnlen infilen; + ftnint *inex; /*parameters in standard's order*/ + ftnint *inopen; + ftnint *innum; + ftnint *innamed; + char *inname; + ftnlen innamlen; + char *inacc; + ftnlen inacclen; + char *inseq; + ftnlen inseqlen; + char *indir; + ftnlen indirlen; + char *infmt; + ftnlen infmtlen; + char *inform; + ftnint informlen; + char *inunf; + ftnlen inunflen; + ftnint *inrecl; + ftnint *innrec; + char *inblank; + ftnlen inblanklen; } inlist; #define VOID void union Multitype { /* for multiple entry points */ - integer1 g; - shortint h; - integer i; - /* longint j; */ - real r; - doublereal d; - complex c; - doublecomplex z; - }; + integer1 g; + shortint h; + integer i; + /* longint j; */ + real r; + doublereal d; + complex_type c; + doublecomplex z; +}; typedef union Multitype Multitype; /*typedef long int Long;*/ /* No longer used; formerly in Namelist */ -struct Vardesc { /* for Namelist */ - char *name; - char *addr; - ftnlen *dims; - int type; - }; +struct Vardesc { /* for Namelist */ + char *name; + char *addr; + ftnlen *dims; + int type; +}; typedef struct Vardesc Vardesc; struct Namelist { - char *name; - Vardesc **vars; - int nvars; - }; + char *name; + Vardesc **vars; + int nvars; +}; typedef struct Namelist Namelist; #define abs(x) ((x) >= 0 ? (x) : -(x)) -#define dabs(x) (doublereal)abs(x) -#define min(a,b) ((a) <= (b) ? (a) : (b)) -#define max(a,b) ((a) >= (b) ? (a) : (b)) -#define dmin(a,b) (doublereal)min(a,b) -#define dmax(a,b) (doublereal)max(a,b) -#define bit_test(a,b) ((a) >> (b) & 1) -#define bit_clear(a,b) ((a) & ~((uinteger)1 << (b))) -#define bit_set(a,b) ((a) | ((uinteger)1 << (b))) +#define dabs(x) (doublereal) abs(x) +#define min(a, b) ((a) <= (b) ? (a) : (b)) +#define max(a, b) ((a) >= (b) ? (a) : (b)) +#define dmin(a, b) (doublereal) min(a, b) +#define dmax(a, b) (doublereal) max(a, b) +#define bit_test(a, b) ((a) >> (b)&1) +#define bit_clear(a, b) ((a) & ~((uinteger)1 << (b))) +#define bit_set(a, b) ((a) | ((uinteger)1 << (b))) /* procedure parameter types for -A and -C++ */ @@ -649,9 +642,9 @@ typedef /* Character */ VOID (*H_fp)(); typedef /* Subroutine */ int (*S_fp)(); #endif /* E_fp is for real functions when -R is not specified */ -typedef VOID C_f; /* complex function */ -typedef VOID H_f; /* character function */ -typedef VOID Z_f; /* double complex function */ +typedef VOID C_f; /* complex function */ +typedef VOID H_f; /* character function */ +typedef VOID Z_f; /* double complex function */ typedef doublereal E_f; /* real function with -R not specified */ /* undef any lower-case symbols that your C compiler predefines, e.g.: */ @@ -678,6 +671,4 @@ typedef doublereal E_f; /* real function with -R not specified */ #endif #endif - #endif - diff --git a/src/third_party/cspice/pow_ci.c b/src/third_party/cspice/pow_ci.c index 37e2ce0f..3d882e56 100644 --- a/src/third_party/cspice/pow_ci.c +++ b/src/third_party/cspice/pow_ci.c @@ -2,10 +2,10 @@ #ifdef KR_headers VOID pow_ci(p, a, b) /* p = a**b */ - complex *p, *a; integer *b; + complex_type *p, *a; integer *b; #else extern void pow_zi(doublecomplex*, doublecomplex*, integer*); -void pow_ci(complex *p, complex *a, integer *b) /* p = a**b */ +void pow_ci(complex_type *p, complex_type *a, integer *b) /* p = a**b */ #endif { doublecomplex p1, a1; diff --git a/src/third_party/cspice/r_cnjg.c b/src/third_party/cspice/r_cnjg.c index e127ca96..57c261fd 100644 --- a/src/third_party/cspice/r_cnjg.c +++ b/src/third_party/cspice/r_cnjg.c @@ -1,9 +1,9 @@ #include "f2c.h" #ifdef KR_headers -VOID r_cnjg(r, z) complex *r, *z; +VOID r_cnjg(r, z) complex_type *r, *z; #else -VOID r_cnjg(complex *r, complex *z) +VOID r_cnjg(complex_type *r, complex_type *z) #endif { r->r = z->r; diff --git a/src/third_party/cspice/r_imag.c b/src/third_party/cspice/r_imag.c index d51252bb..0af02323 100644 --- a/src/third_party/cspice/r_imag.c +++ b/src/third_party/cspice/r_imag.c @@ -1,9 +1,9 @@ #include "f2c.h" #ifdef KR_headers -double r_imag(z) complex *z; +double r_imag(z) complex_type *z; #else -double r_imag(complex *z) +double r_imag(complex_type *z) #endif { return(z->i); diff --git a/src/third_party/cspice/typesize.c b/src/third_party/cspice/typesize.c index 1cb20ff2..ffc4f15a 100644 --- a/src/third_party/cspice/typesize.c +++ b/src/third_party/cspice/typesize.c @@ -2,7 +2,7 @@ ftnlen f__typesize[] = { 0, 0, sizeof(shortint), sizeof(integer), sizeof(real), sizeof(doublereal), - sizeof(complex), sizeof(doublecomplex), + sizeof(complex_type), sizeof(doublecomplex), sizeof(logical), sizeof(char), 0, sizeof(integer1), sizeof(logical1), sizeof(shortlogical),