
/* header for use by the skycalc library files, not needed for external calls */

# include <skycalc.h>
# include <stdio.h>
# include <math.h>
# include <ctype.h>
# include <stdarg.h>
# include <string.h>
# include <time.h>

/* a couple of the system-dependent magic numbers are defined here */

#define SYS_CLOCK_OK 1    /* 1 means ANSI-standard time libraries do work,
   2 means they don't.  This is used by compiler switches in file 5 and
   the main program.  */

#define LOG_FILES_OK 1  /* 1 means that log files are enabled.
			Any other value means they're not.  */

#define MAX_OBJECTS 500
#define MINSHORT -32767   /* min, max short integers and double precision */
#define MAXSHORT 32767
#define MAXDOUBLE 1.0e38
#define MINDOUBLE -1.0e38
#define BUFSIZE 150

/* some (not all) physical, mathematical, and astronomical constants
   used are defined here. */

#define  PI                3.14159265358979
#define  ARCSEC_IN_RADIAN  206264.8062471
#define  DEG_IN_RADIAN     57.2957795130823
#define  HRS_IN_RADIAN     3.819718634205
#define  KMS_AUDAY         1731.45683633   /* km per sec in 1 AU/day */
#define  SS_MASS           1.00134198      /* solar system mass in solar units */
#define  J2000             2451545.        /* Julian date at standard epoch */
#define  SEC_IN_DAY        86400.
#define  FLATTEN           0.003352813   /* flattening of earth, 1/298.257 */
#define  EQUAT_RAD         6378137.    /* equatorial radius of earth, meters */
#define  ASTRO_UNIT        1.4959787066e11 /* 1 AU in meters */
#define  RSUN              6.96000e8  /* IAU 1976 recom. solar radius, meters */
#define  RMOON             1.738e6    /* IAU 1976 recom. lunar radius, meters */
#define  PLANET_TOL        3.          /* flag if nearer than 3 degrees
						to a major planet ... */
#define  KZEN              0.172       /* zenith extinction, mag, for use
				     in lunar sky brightness calculations. */
#define FIRSTJD            2415387.  /* 1901 Jan 1 -- calendrical limit */
#define LASTJD             2488070.  /* 2099 Dec 31 */

/* MAGIC NUMBERS which might depend on how accurately double-
   precision floating point is handled on your machine ... */

#define  EARTH_DIFF        0.05            /* used in numerical
   differentiation to find earth velocity -- this value gives
   about 8 digits of numerical accuracy on the VAX, but is
   about 3 orders of magnitude larger than the value where roundoff
   errors become apparent. */

#define  MIDN_TOL          0.00001         /* this is no longer
   used -- it was formerly
   how close (in days) a julian date has to be to midnight
   before a warning flag is printed for the reader.  VAX
   double precision renders a Julian date considerably
   more accurately than this.  The day and date are now based
   on the same rounding of the julian date, so they should
   always agree. */

/** prototypes **/
int    get_sys_date (struct SC_date_time *date);
double date_to_jd (struct SC_date_time date);
void   jd_to_date (double jdin, struct SC_date_time *date);
double lst (double jd, double longit);
double adj_time (double x);
void   xyz_cel (double x, double y, double z, double *r, double *d);
double atan_circ (double x, double y);
double altit (double dec, double ha, double lat, double *az);
double ha_alt (double dec, double lat, double alt);
void   min_max_alt (double lat, double dec, double *min, double *max);
double circulo (double x);
void   precrot (double rorig, double dorig, double orig_epoch, double final_epoch, double *rf, double *df);
void   geocent (double geolong, double geolat, double height, double *x_geo, double *y_geo, double *z_geo);
void   eclrot(double jd, double *x, double *y, double *z);
double etcorr (double jd);
void   set_zenith (struct SC_date_time date, double lat, double longit, double epoch, double *ra, double *dec);
void   lpsun (double jd, double *ra, double *dec);
double jd_sun_alt (double alt, double jdguess, double lat, double longit);
void   accumoon (double jd, double geolat, double lst, double elevsea, 
       double *geora, double *geodec, double *geodist, 
       double *topora, double *topodec, double *topodist);
double jd_moon_alt (double alt, double jdguess, double lat, double longit, double elevsea);
