Reindented Swiss Ephemeris source files for better reabability
This commit is contained in:
parent
b47bc9b4fb
commit
b1b99e0302
8129
swe/src/swecl.c
8129
swe/src/swecl.c
File diff suppressed because it is too large
Load Diff
@ -1,3 +1,4 @@
|
||||
|
||||
/*********************************************************
|
||||
$Header: /home/dieter/sweph/RCS/swedate.c,v 1.75 2009/04/08 07:17:29 dieter Exp $
|
||||
version 15-feb-89 16:30
|
||||
@ -7,6 +8,7 @@
|
||||
swe_julday()
|
||||
|
||||
************************************************************/
|
||||
|
||||
/* Copyright (C) 1997 - 2008 Astrodienst AG, Switzerland. All rights reserved.
|
||||
|
||||
License conditions
|
||||
@ -83,34 +85,34 @@
|
||||
Return: OK or ERR (for illegal date)
|
||||
*********************************************************/
|
||||
|
||||
# include "swephexp.h"
|
||||
# include "sweph.h"
|
||||
#include "swephexp.h"
|
||||
#include "sweph.h"
|
||||
|
||||
static AS_BOOL init_leapseconds_done = FALSE;
|
||||
|
||||
|
||||
int FAR PASCAL_CONV swe_date_conversion(int y,
|
||||
int m,
|
||||
int d, /* day, month, year */
|
||||
double uttime, /* UT in hours (decimal) */
|
||||
char c, /* calendar g[regorian]|j[ulian] */
|
||||
double *tjd)
|
||||
int FAR PASCAL_CONV
|
||||
swe_date_conversion(int y, int m, int d, /* day, month, year */
|
||||
double uttime, /* UT in hours (decimal) */
|
||||
char c, /* calendar g[regorian]|j[ulian] */
|
||||
double *tjd)
|
||||
{
|
||||
int rday, rmon, ryear;
|
||||
double rut, jd;
|
||||
int gregflag = SE_JUL_CAL;
|
||||
if (c == 'g')
|
||||
gregflag = SE_GREG_CAL;
|
||||
rut = uttime; /* hours UT */
|
||||
jd = swe_julday(y, m, d, rut, gregflag);
|
||||
swe_revjul(jd, gregflag, &ryear, &rmon, &rday, &rut);
|
||||
*tjd = jd;
|
||||
if (rmon == m && rday == d && ryear == y) {
|
||||
return OK;
|
||||
} else {
|
||||
return ERR;
|
||||
}
|
||||
} /* end date_conversion */
|
||||
int rday, rmon, ryear;
|
||||
double rut, jd;
|
||||
int gregflag = SE_JUL_CAL;
|
||||
if (c == 'g')
|
||||
gregflag = SE_GREG_CAL;
|
||||
rut = uttime; /* hours UT */
|
||||
jd = swe_julday(y, m, d, rut, gregflag);
|
||||
swe_revjul(jd, gregflag, &ryear, &rmon, &rday, &rut);
|
||||
*tjd = jd;
|
||||
if (rmon == m && rday == d && ryear == y) {
|
||||
return OK;
|
||||
}
|
||||
else {
|
||||
return ERR;
|
||||
}
|
||||
} /* end date_conversion */
|
||||
|
||||
/*************** swe_julday ********************************************
|
||||
* This function returns the absolute Julian day number (JD)
|
||||
@ -161,26 +163,31 @@ int FAR PASCAL_CONV swe_date_conversion(int y,
|
||||
and notifies errors like 32 January.
|
||||
****************************************************************/
|
||||
|
||||
double FAR PASCAL_CONV swe_julday(int year, int month, int day, double hour, int gregflag)
|
||||
double FAR PASCAL_CONV
|
||||
swe_julday(int year, int month, int day, double hour, int gregflag)
|
||||
{
|
||||
double jd;
|
||||
double u,u0,u1,u2;
|
||||
u = year;
|
||||
if (month < 3) u -=1;
|
||||
u0 = u + 4712.0;
|
||||
u1 = month + 1.0;
|
||||
if (u1 < 4) u1 += 12.0;
|
||||
jd = floor(u0*365.25)
|
||||
+ floor(30.6*u1+0.000001)
|
||||
+ day + hour/24.0 - 63.5;
|
||||
if (gregflag == SE_GREG_CAL) {
|
||||
u2 = floor(fabs(u) / 100) - floor(fabs(u) / 400);
|
||||
if (u < 0.0) u2 = -u2;
|
||||
jd = jd - u2 + 2;
|
||||
if ((u < 0.0) && (u/100 == floor(u/100)) && (u/400 != floor(u/400)))
|
||||
jd -=1;
|
||||
}
|
||||
return jd;
|
||||
double jd;
|
||||
double u, u0, u1, u2;
|
||||
u = year;
|
||||
if (month < 3)
|
||||
u -= 1;
|
||||
u0 = u + 4712.0;
|
||||
u1 = month + 1.0;
|
||||
if (u1 < 4)
|
||||
u1 += 12.0;
|
||||
jd = floor(u0 * 365.25)
|
||||
+ floor(30.6 * u1 + 0.000001)
|
||||
+ day + hour / 24.0 - 63.5;
|
||||
if (gregflag == SE_GREG_CAL) {
|
||||
u2 = floor(fabs(u) / 100) - floor(fabs(u) / 400);
|
||||
if (u < 0.0)
|
||||
u2 = -u2;
|
||||
jd = jd - u2 + 2;
|
||||
if ((u < 0.0) && (u / 100 == floor(u / 100))
|
||||
&& (u / 400 != floor(u / 400)))
|
||||
jd -= 1;
|
||||
}
|
||||
return jd;
|
||||
}
|
||||
|
||||
/*** swe_revjul ******************************************************
|
||||
@ -202,24 +209,27 @@ double FAR PASCAL_CONV swe_julday(int year, int month, int day, double hour, int
|
||||
Original author Mark Pottenger, Los Angeles.
|
||||
with bug fix for year < -4711 16-aug-88 Alois Treindl
|
||||
*************************************************************************/
|
||||
void FAR PASCAL_CONV swe_revjul (double jd, int gregflag,
|
||||
int *jyear, int *jmon, int *jday, double *jut)
|
||||
void FAR PASCAL_CONV
|
||||
swe_revjul(double jd, int gregflag, int *jyear, int *jmon, int *jday,
|
||||
double *jut)
|
||||
{
|
||||
double u0,u1,u2,u3,u4;
|
||||
u0 = jd + 32082.5;
|
||||
if (gregflag == SE_GREG_CAL) {
|
||||
u1 = u0 + floor (u0/36525.0) - floor (u0/146100.0) - 38.0;
|
||||
if (jd >= 1830691.5) u1 +=1;
|
||||
u0 = u0 + floor (u1/36525.0) - floor (u1/146100.0) - 38.0;
|
||||
}
|
||||
u2 = floor (u0 + 123.0);
|
||||
u3 = floor ( (u2 - 122.2) / 365.25);
|
||||
u4 = floor ( (u2 - floor (365.25 * u3) ) / 30.6001);
|
||||
*jmon = (int) (u4 - 1.0);
|
||||
if (*jmon > 12) *jmon -= 12;
|
||||
*jday = (int) (u2 - floor (365.25 * u3) - floor (30.6001 * u4));
|
||||
*jyear = (int) (u3 + floor ( (u4 - 2.0) / 12.0) - 4800);
|
||||
*jut = (jd - floor (jd + 0.5) + 0.5) * 24.0;
|
||||
double u0, u1, u2, u3, u4;
|
||||
u0 = jd + 32082.5;
|
||||
if (gregflag == SE_GREG_CAL) {
|
||||
u1 = u0 + floor(u0 / 36525.0) - floor(u0 / 146100.0) - 38.0;
|
||||
if (jd >= 1830691.5)
|
||||
u1 += 1;
|
||||
u0 = u0 + floor(u1 / 36525.0) - floor(u1 / 146100.0) - 38.0;
|
||||
}
|
||||
u2 = floor(u0 + 123.0);
|
||||
u3 = floor((u2 - 122.2) / 365.25);
|
||||
u4 = floor((u2 - floor(365.25 * u3)) / 30.6001);
|
||||
*jmon = (int)(u4 - 1.0);
|
||||
if (*jmon > 12)
|
||||
*jmon -= 12;
|
||||
*jday = (int)(u2 - floor(365.25 * u3) - floor(30.6001 * u4));
|
||||
*jyear = (int)(u3 + floor((u4 - 2.0) / 12.0) - 4800);
|
||||
*jut = (jd - floor(jd + 0.5) + 0.5) * 24.0;
|
||||
}
|
||||
|
||||
/* transform local time to UTC or UTC to local time
|
||||
@ -236,39 +246,37 @@ void FAR PASCAL_CONV swe_revjul (double jd, int gregflag,
|
||||
* For conversion from local time to utc, use +d_timezone.
|
||||
* For conversion from utc to local time, use -d_timezone.
|
||||
*/
|
||||
void FAR PASCAL_CONV swe_utc_time_zone(
|
||||
int32 iyear, int32 imonth, int32 iday,
|
||||
int32 ihour, int32 imin, double dsec,
|
||||
double d_timezone,
|
||||
int32 *iyear_out, int32 *imonth_out, int32 *iday_out,
|
||||
int32 *ihour_out, int32 *imin_out, double *dsec_out
|
||||
)
|
||||
void FAR PASCAL_CONV
|
||||
swe_utc_time_zone(int32 iyear, int32 imonth, int32 iday, int32 ihour,
|
||||
int32 imin, double dsec, double d_timezone,
|
||||
int32 * iyear_out, int32 * imonth_out, int32 * iday_out,
|
||||
int32 * ihour_out, int32 * imin_out, double *dsec_out)
|
||||
{
|
||||
double tjd, d;
|
||||
AS_BOOL have_leapsec = FALSE;
|
||||
double dhour;
|
||||
if (dsec >= 60.0) {
|
||||
have_leapsec = TRUE;
|
||||
dsec -= 1.0;
|
||||
}
|
||||
dhour = ((double) ihour) + ((double) imin) / 60.0 + dsec / 3600.0;
|
||||
tjd = swe_julday(iyear, imonth, iday, 0, SE_GREG_CAL);
|
||||
dhour -= d_timezone;
|
||||
if (dhour < 0.0) {
|
||||
tjd -= 1.0;
|
||||
dhour += 24.0;
|
||||
}
|
||||
if (dhour >= 24.0) {
|
||||
tjd += 1.0;
|
||||
dhour -= 24.0;
|
||||
}
|
||||
swe_revjul(tjd + 0.001, SE_GREG_CAL, iyear_out, imonth_out, iday_out, &d);
|
||||
*ihour_out = (int) dhour;
|
||||
d = (dhour - (double) *ihour_out) * 60;
|
||||
*imin_out = (int) d;
|
||||
*dsec_out = (d - (double) *imin_out) * 60;
|
||||
if (have_leapsec)
|
||||
*dsec_out += 1.0;
|
||||
double tjd, d;
|
||||
AS_BOOL have_leapsec = FALSE;
|
||||
double dhour;
|
||||
if (dsec >= 60.0) {
|
||||
have_leapsec = TRUE;
|
||||
dsec -= 1.0;
|
||||
}
|
||||
dhour = ((double)ihour) + ((double)imin) / 60.0 + dsec / 3600.0;
|
||||
tjd = swe_julday(iyear, imonth, iday, 0, SE_GREG_CAL);
|
||||
dhour -= d_timezone;
|
||||
if (dhour < 0.0) {
|
||||
tjd -= 1.0;
|
||||
dhour += 24.0;
|
||||
}
|
||||
if (dhour >= 24.0) {
|
||||
tjd += 1.0;
|
||||
dhour -= 24.0;
|
||||
}
|
||||
swe_revjul(tjd + 0.001, SE_GREG_CAL, iyear_out, imonth_out, iday_out, &d);
|
||||
*ihour_out = (int)dhour;
|
||||
d = (dhour - (double)*ihour_out) * 60;
|
||||
*imin_out = (int)d;
|
||||
*dsec_out = (d - (double)*imin_out) * 60;
|
||||
if (have_leapsec)
|
||||
*dsec_out += 1.0;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -279,80 +287,85 @@ void FAR PASCAL_CONV swe_utc_time_zone(
|
||||
#define NLEAP_SECONDS 24
|
||||
#define NLEAP_SECONDS_SPACE 100
|
||||
static int leap_seconds[NLEAP_SECONDS_SPACE] = {
|
||||
19720630,
|
||||
19721231,
|
||||
19731231,
|
||||
19741231,
|
||||
19751231,
|
||||
19761231,
|
||||
19771231,
|
||||
19781231,
|
||||
19791231,
|
||||
19810630,
|
||||
19820630,
|
||||
19830630,
|
||||
19850630,
|
||||
19871231,
|
||||
19891231,
|
||||
19901231,
|
||||
19920630,
|
||||
19930630,
|
||||
19940630,
|
||||
19951231,
|
||||
19970630,
|
||||
19981231,
|
||||
20051231,
|
||||
20081231,
|
||||
0 /* keep this 0 as end mark */
|
||||
19720630,
|
||||
19721231,
|
||||
19731231,
|
||||
19741231,
|
||||
19751231,
|
||||
19761231,
|
||||
19771231,
|
||||
19781231,
|
||||
19791231,
|
||||
19810630,
|
||||
19820630,
|
||||
19830630,
|
||||
19850630,
|
||||
19871231,
|
||||
19891231,
|
||||
19901231,
|
||||
19920630,
|
||||
19930630,
|
||||
19940630,
|
||||
19951231,
|
||||
19970630,
|
||||
19981231,
|
||||
20051231,
|
||||
20081231,
|
||||
0 /* keep this 0 as end mark */
|
||||
};
|
||||
|
||||
#define J1972 2441317.5
|
||||
#define NLEAP_INIT 10
|
||||
|
||||
/* Read additional leap second dates from external file, if given.
|
||||
*/
|
||||
static int init_leapsec(void)
|
||||
static int
|
||||
init_leapsec(void)
|
||||
{
|
||||
FILE *fp;
|
||||
int ndat, ndat_last;
|
||||
int tabsiz = 0;
|
||||
int i;
|
||||
char s[AS_MAXCH];
|
||||
char *sp;
|
||||
if (!init_leapseconds_done) {
|
||||
init_leapseconds_done = TRUE;
|
||||
tabsiz = NLEAP_SECONDS;
|
||||
ndat_last = leap_seconds[NLEAP_SECONDS - 1];
|
||||
/* no error message if file is missing */
|
||||
if ((fp = swi_fopen(-1, "seleapsec.txt", swed.ephepath, NULL)) == NULL)
|
||||
return NLEAP_SECONDS;
|
||||
while(fgets(s, AS_MAXCH, fp) != NULL) {
|
||||
sp = s;
|
||||
while (*sp == ' ' || *sp == '\t') sp++;
|
||||
sp++;
|
||||
if (*sp == '#' || *sp == '\n')
|
||||
continue;
|
||||
ndat = atoi(s);
|
||||
if (ndat <= ndat_last)
|
||||
continue;
|
||||
/* table space is limited. no error msg, if exceeded */
|
||||
if (tabsiz >= NLEAP_SECONDS_SPACE)
|
||||
FILE *fp;
|
||||
int ndat, ndat_last;
|
||||
int tabsiz = 0;
|
||||
int i;
|
||||
char s[AS_MAXCH];
|
||||
char *sp;
|
||||
if (!init_leapseconds_done) {
|
||||
init_leapseconds_done = TRUE;
|
||||
tabsiz = NLEAP_SECONDS;
|
||||
ndat_last = leap_seconds[NLEAP_SECONDS - 1];
|
||||
/* no error message if file is missing */
|
||||
if ((fp =
|
||||
swi_fopen(-1, "seleapsec.txt", swed.ephepath, NULL)) == NULL)
|
||||
return NLEAP_SECONDS;
|
||||
while (fgets(s, AS_MAXCH, fp) != NULL) {
|
||||
sp = s;
|
||||
while (*sp == ' ' || *sp == '\t')
|
||||
sp++;
|
||||
sp++;
|
||||
if (*sp == '#' || *sp == '\n')
|
||||
continue;
|
||||
ndat = atoi(s);
|
||||
if (ndat <= ndat_last)
|
||||
continue;
|
||||
/* table space is limited. no error msg, if exceeded */
|
||||
if (tabsiz >= NLEAP_SECONDS_SPACE)
|
||||
return tabsiz;
|
||||
leap_seconds[tabsiz] = ndat;
|
||||
tabsiz++;
|
||||
}
|
||||
if (tabsiz > NLEAP_SECONDS)
|
||||
leap_seconds[tabsiz] = 0; /* end mark */
|
||||
fclose(fp);
|
||||
return tabsiz;
|
||||
leap_seconds[tabsiz] = ndat;
|
||||
tabsiz++;
|
||||
}
|
||||
if (tabsiz > NLEAP_SECONDS) leap_seconds[tabsiz] = 0; /* end mark */
|
||||
fclose(fp);
|
||||
/* find table size */
|
||||
tabsiz = 0;
|
||||
for (i = 0; i < NLEAP_SECONDS_SPACE; i++) {
|
||||
if (leap_seconds[i] == 0)
|
||||
break;
|
||||
else
|
||||
tabsiz++;
|
||||
}
|
||||
return tabsiz;
|
||||
}
|
||||
/* find table size */
|
||||
tabsiz = 0;
|
||||
for (i = 0; i < NLEAP_SECONDS_SPACE; i++) {
|
||||
if (leap_seconds[i] == 0)
|
||||
break;
|
||||
else
|
||||
tabsiz++;
|
||||
}
|
||||
return tabsiz;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -374,100 +387,103 @@ static int init_leapsec(void)
|
||||
* the leap seconds table (or the Swiss Ephemeris version) is not updated
|
||||
* for a long time.
|
||||
*/
|
||||
int32 FAR PASCAL_CONV swe_utc_to_jd(int32 iyear, int32 imonth, int32 iday, int32 ihour, int32 imin, double dsec, int32 gregflag, double *dret, char *serr)
|
||||
int32 FAR PASCAL_CONV
|
||||
swe_utc_to_jd(int32 iyear, int32 imonth, int32 iday, int32 ihour, int32 imin,
|
||||
double dsec, int32 gregflag, double *dret, char *serr)
|
||||
{
|
||||
double tjd_ut1, tjd_et, tjd_et_1972, dhour, d;
|
||||
int iyear2, imonth2, iday2;
|
||||
int i, j, ndat, nleap, tabsiz_nleap;
|
||||
/*
|
||||
* error handling: invalid iyear etc.
|
||||
*/
|
||||
tjd_ut1 = swe_julday(iyear, imonth, iday, 0, gregflag);
|
||||
swe_revjul(tjd_ut1, gregflag, &iyear2, &imonth2, &iday2, &d);
|
||||
if (iyear != iyear2 || imonth != imonth2 || iday != iday2) {
|
||||
if (serr != NULL)
|
||||
sprintf(serr, "invalid date: year = %d, month = %d, day = %d", iyear, imonth, iday);
|
||||
return ERR;
|
||||
}
|
||||
if (ihour < 0 || ihour > 23
|
||||
|| imin < 0 || imin > 59
|
||||
|| dsec < 0 || dsec >= 61
|
||||
|| (dsec >= 60 && (imin < 59 || ihour < 23 || tjd_ut1 < J1972))) {
|
||||
if (serr != NULL)
|
||||
sprintf(serr, "invalid time: %d:%d:%.2f", ihour, imin, dsec);
|
||||
return ERR;
|
||||
}
|
||||
dhour = (double) ihour + ((double) imin) / 60.0 + dsec / 3600.0;
|
||||
/*
|
||||
* before 1972, we treat input date as UT1
|
||||
*/
|
||||
if (tjd_ut1 < J1972) {
|
||||
dret[1] = swe_julday(iyear, imonth, iday, dhour, gregflag);
|
||||
dret[0] = dret[1] + swe_deltat(dret[1]);
|
||||
return OK;
|
||||
}
|
||||
/*
|
||||
* if gregflag = Julian calendar, convert to gregorian calendar
|
||||
*/
|
||||
if (gregflag == SE_JUL_CAL) {
|
||||
gregflag = SE_GREG_CAL;
|
||||
swe_revjul(tjd_ut1, gregflag, &iyear, &imonth, &iday, &d);
|
||||
}
|
||||
/*
|
||||
* number of leap seconds since 1972:
|
||||
*/
|
||||
tabsiz_nleap = init_leapsec();
|
||||
nleap = NLEAP_INIT; /* initial difference between UTC and TAI in 1972 */
|
||||
ndat = iyear * 10000 + imonth * 100 + iday;
|
||||
for (i = 0; i < tabsiz_nleap; i++) {
|
||||
if (ndat <= leap_seconds[i])
|
||||
break;
|
||||
nleap++;
|
||||
}
|
||||
/*
|
||||
* For input dates > today:
|
||||
* If leap seconds table is not up to date, we'd better interpret the
|
||||
* input time as UT1, not as UTC. How do we find out?
|
||||
* Check, if delta_t - nleap - 32.184 > 0.9
|
||||
*/
|
||||
d = swe_deltat(tjd_ut1) * 86400.0;
|
||||
if (d - (double) nleap - 32.184 >= 1.0) {
|
||||
dret[1] = tjd_ut1 + dhour / 24.0;
|
||||
dret[0] = dret[1] + swe_deltat(dret[1]);
|
||||
return OK;
|
||||
}
|
||||
/*
|
||||
* if input second is 60: is it a valid leap second ?
|
||||
*/
|
||||
if (dsec >= 60) {
|
||||
j = 0;
|
||||
double tjd_ut1, tjd_et, tjd_et_1972, dhour, d;
|
||||
int iyear2, imonth2, iday2;
|
||||
int i, j, ndat, nleap, tabsiz_nleap;
|
||||
/*
|
||||
* error handling: invalid iyear etc.
|
||||
*/
|
||||
tjd_ut1 = swe_julday(iyear, imonth, iday, 0, gregflag);
|
||||
swe_revjul(tjd_ut1, gregflag, &iyear2, &imonth2, &iday2, &d);
|
||||
if (iyear != iyear2 || imonth != imonth2 || iday != iday2) {
|
||||
if (serr != NULL)
|
||||
sprintf(serr, "invalid date: year = %d, month = %d, day = %d",
|
||||
iyear, imonth, iday);
|
||||
return ERR;
|
||||
}
|
||||
if (ihour < 0 || ihour > 23 || imin < 0 || imin > 59 || dsec < 0
|
||||
|| dsec >= 61 || (dsec >= 60
|
||||
&& (imin < 59 || ihour < 23 || tjd_ut1 < J1972))) {
|
||||
if (serr != NULL)
|
||||
sprintf(serr, "invalid time: %d:%d:%.2f", ihour, imin, dsec);
|
||||
return ERR;
|
||||
}
|
||||
dhour = (double)ihour + ((double)imin) / 60.0 + dsec / 3600.0;
|
||||
/*
|
||||
* before 1972, we treat input date as UT1
|
||||
*/
|
||||
if (tjd_ut1 < J1972) {
|
||||
dret[1] = swe_julday(iyear, imonth, iday, dhour, gregflag);
|
||||
dret[0] = dret[1] + swe_deltat(dret[1]);
|
||||
return OK;
|
||||
}
|
||||
/*
|
||||
* if gregflag = Julian calendar, convert to gregorian calendar
|
||||
*/
|
||||
if (gregflag == SE_JUL_CAL) {
|
||||
gregflag = SE_GREG_CAL;
|
||||
swe_revjul(tjd_ut1, gregflag, &iyear, &imonth, &iday, &d);
|
||||
}
|
||||
/*
|
||||
* number of leap seconds since 1972:
|
||||
*/
|
||||
tabsiz_nleap = init_leapsec();
|
||||
nleap = NLEAP_INIT; /* initial difference between UTC and TAI in 1972 */
|
||||
ndat = iyear * 10000 + imonth * 100 + iday;
|
||||
for (i = 0; i < tabsiz_nleap; i++) {
|
||||
if (ndat == leap_seconds[i]) {
|
||||
j = 1;
|
||||
break;
|
||||
}
|
||||
if (ndat <= leap_seconds[i])
|
||||
break;
|
||||
nleap++;
|
||||
}
|
||||
if (j != 1) {
|
||||
if (serr != NULL)
|
||||
sprintf(serr, "invalid time (no leap second!): %d:%d:%.2f", ihour, imin, dsec);
|
||||
return ERR;
|
||||
/*
|
||||
* For input dates > today:
|
||||
* If leap seconds table is not up to date, we'd better interpret the
|
||||
* input time as UT1, not as UTC. How do we find out?
|
||||
* Check, if delta_t - nleap - 32.184 > 0.9
|
||||
*/
|
||||
d = swe_deltat(tjd_ut1) * 86400.0;
|
||||
if (d - (double)nleap - 32.184 >= 1.0) {
|
||||
dret[1] = tjd_ut1 + dhour / 24.0;
|
||||
dret[0] = dret[1] + swe_deltat(dret[1]);
|
||||
return OK;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* convert UTC to ET and UT1
|
||||
*/
|
||||
/* the number of days between input date and 1 jan 1972: */
|
||||
d = tjd_ut1 - J1972;
|
||||
/* SI time since 1972, ignoring leap seconds: */
|
||||
d += (double) ihour / 24.0 + (double) imin / 1440.0 + dsec / 86400.0;
|
||||
/* ET (TT) */
|
||||
tjd_et_1972 = J1972 + (32.184 + NLEAP_INIT) / 86400.0;
|
||||
tjd_et = tjd_et_1972 + d + ((double) (nleap - NLEAP_INIT)) / 86400.0;
|
||||
d = swe_deltat(tjd_et);
|
||||
tjd_ut1 = tjd_et - swe_deltat(tjd_et - d);
|
||||
dret[0] = tjd_et;
|
||||
dret[1] = tjd_ut1;
|
||||
return OK;
|
||||
/*
|
||||
* if input second is 60: is it a valid leap second ?
|
||||
*/
|
||||
if (dsec >= 60) {
|
||||
j = 0;
|
||||
for (i = 0; i < tabsiz_nleap; i++) {
|
||||
if (ndat == leap_seconds[i]) {
|
||||
j = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (j != 1) {
|
||||
if (serr != NULL)
|
||||
sprintf(serr, "invalid time (no leap second!): %d:%d:%.2f",
|
||||
ihour, imin, dsec);
|
||||
return ERR;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* convert UTC to ET and UT1
|
||||
*/
|
||||
/* the number of days between input date and 1 jan 1972: */
|
||||
d = tjd_ut1 - J1972;
|
||||
/* SI time since 1972, ignoring leap seconds: */
|
||||
d += (double)ihour / 24.0 + (double)imin / 1440.0 + dsec / 86400.0;
|
||||
/* ET (TT) */
|
||||
tjd_et_1972 = J1972 + (32.184 + NLEAP_INIT) / 86400.0;
|
||||
tjd_et = tjd_et_1972 + d + ((double)(nleap - NLEAP_INIT)) / 86400.0;
|
||||
d = swe_deltat(tjd_et);
|
||||
tjd_ut1 = tjd_et - swe_deltat(tjd_et - d);
|
||||
dret[0] = tjd_et;
|
||||
dret[1] = tjd_ut1;
|
||||
return OK;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -484,86 +500,92 @@ int32 FAR PASCAL_CONV swe_utc_to_jd(int32 iyear, int32 imonth, int32 iday, int32
|
||||
* the leap seconds table (or the Swiss Ephemeris version) has not been
|
||||
* updated for a long time.
|
||||
*/
|
||||
void FAR PASCAL_CONV swe_jdet_to_utc(double tjd_et, int32 gregflag, int32 *iyear, int32 *imonth, int32 *iday, int32 *ihour, int32 *imin, double *dsec)
|
||||
void FAR PASCAL_CONV
|
||||
swe_jdet_to_utc(double tjd_et, int32 gregflag, int32 * iyear, int32 * imonth,
|
||||
int32 * iday, int32 * ihour, int32 * imin, double *dsec)
|
||||
{
|
||||
int i;
|
||||
int second_60 = 0;
|
||||
int iyear2, imonth2, iday2, nleap, ndat, tabsiz_nleap;
|
||||
double d, tjd, tjd_et_1972, tjd_ut, dret[10];
|
||||
/*
|
||||
* if tjd_et is before 1 jan 1972 UTC, return UT1
|
||||
*/
|
||||
tjd_et_1972 = J1972 + (32.184 + NLEAP_INIT) / 86400.0;
|
||||
d = swe_deltat(tjd_et);
|
||||
tjd_ut = tjd_et - swe_deltat(tjd_et - d);
|
||||
if (tjd_et < tjd_et_1972) {
|
||||
swe_revjul(tjd_ut, gregflag, iyear, imonth, iday, &d);
|
||||
*ihour = (int32) d;
|
||||
d -= (double) *ihour;
|
||||
d *= 60;
|
||||
*imin = (int32) d;
|
||||
*dsec = (d - (double) *imin) * 60.0;
|
||||
return;
|
||||
}
|
||||
/*
|
||||
* minimum number of leap seconds since 1972; we may be missing one leap
|
||||
* second
|
||||
*/
|
||||
tabsiz_nleap = init_leapsec();
|
||||
swe_revjul(tjd_ut-1, SE_GREG_CAL, &iyear2, &imonth2, &iday2, &d);
|
||||
ndat = iyear2 * 10000 + imonth2 * 100 + iday2;
|
||||
nleap = 0;
|
||||
for (i = 0; i < tabsiz_nleap; i++) {
|
||||
if (ndat <= leap_seconds[i])
|
||||
break;
|
||||
nleap++;
|
||||
}
|
||||
/* date of potentially missing leapsecond */
|
||||
if (nleap < tabsiz_nleap) {
|
||||
i = leap_seconds[nleap];
|
||||
iyear2 = i / 10000;
|
||||
imonth2 = (i % 10000) / 100;;
|
||||
iday2 = i % 100;
|
||||
tjd = swe_julday(iyear2, imonth2, iday2, 0, SE_GREG_CAL);
|
||||
swe_revjul(tjd+1, SE_GREG_CAL, &iyear2, &imonth2, &iday2, &d);
|
||||
swe_utc_to_jd(iyear2,imonth2,iday2, 0, 0, 0, SE_GREG_CAL, dret, NULL);
|
||||
d = tjd_et - dret[0];
|
||||
if (d >= 0) {
|
||||
nleap++;
|
||||
} else if (d < 0 && d > -1.0/86400.0) {
|
||||
second_60 = 1;
|
||||
int i;
|
||||
int second_60 = 0;
|
||||
int iyear2, imonth2, iday2, nleap, ndat, tabsiz_nleap;
|
||||
double d, tjd, tjd_et_1972, tjd_ut, dret[10];
|
||||
/*
|
||||
* if tjd_et is before 1 jan 1972 UTC, return UT1
|
||||
*/
|
||||
tjd_et_1972 = J1972 + (32.184 + NLEAP_INIT) / 86400.0;
|
||||
d = swe_deltat(tjd_et);
|
||||
tjd_ut = tjd_et - swe_deltat(tjd_et - d);
|
||||
if (tjd_et < tjd_et_1972) {
|
||||
swe_revjul(tjd_ut, gregflag, iyear, imonth, iday, &d);
|
||||
*ihour = (int32) d;
|
||||
d -= (double)*ihour;
|
||||
d *= 60;
|
||||
*imin = (int32) d;
|
||||
*dsec = (d - (double)*imin) * 60.0;
|
||||
return;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* UTC, still unsure about one leap second
|
||||
*/
|
||||
tjd = J1972 + (tjd_et - tjd_et_1972) - ((double) nleap + second_60) / 86400.0;
|
||||
swe_revjul(tjd, SE_GREG_CAL, iyear, imonth, iday, &d);
|
||||
*ihour = (int32) d;
|
||||
d -= (double) *ihour;
|
||||
d *= 60;
|
||||
*imin = (int32) d;
|
||||
*dsec = (d - (double) *imin) * 60.0 + second_60;
|
||||
/*
|
||||
* For input dates > today:
|
||||
* If leap seconds table is not up to date, we'd better interpret the
|
||||
* input time as UT1, not as UTC. How do we find out?
|
||||
* Check, if delta_t - nleap - 32.184 > 0.9
|
||||
*/
|
||||
d = swe_deltat(tjd_et);
|
||||
d = swe_deltat(tjd_et - d);
|
||||
if (d * 86400.0 - (double) (nleap + NLEAP_INIT) - 32.184 >= 1.0) {
|
||||
swe_revjul(tjd_et - d, SE_GREG_CAL, iyear, imonth, iday, &d);
|
||||
/*
|
||||
* minimum number of leap seconds since 1972; we may be missing one leap
|
||||
* second
|
||||
*/
|
||||
tabsiz_nleap = init_leapsec();
|
||||
swe_revjul(tjd_ut - 1, SE_GREG_CAL, &iyear2, &imonth2, &iday2, &d);
|
||||
ndat = iyear2 * 10000 + imonth2 * 100 + iday2;
|
||||
nleap = 0;
|
||||
for (i = 0; i < tabsiz_nleap; i++) {
|
||||
if (ndat <= leap_seconds[i])
|
||||
break;
|
||||
nleap++;
|
||||
}
|
||||
/* date of potentially missing leapsecond */
|
||||
if (nleap < tabsiz_nleap) {
|
||||
i = leap_seconds[nleap];
|
||||
iyear2 = i / 10000;
|
||||
imonth2 = (i % 10000) / 100;;
|
||||
iday2 = i % 100;
|
||||
tjd = swe_julday(iyear2, imonth2, iday2, 0, SE_GREG_CAL);
|
||||
swe_revjul(tjd + 1, SE_GREG_CAL, &iyear2, &imonth2, &iday2, &d);
|
||||
swe_utc_to_jd(iyear2, imonth2, iday2, 0, 0, 0, SE_GREG_CAL, dret,
|
||||
NULL);
|
||||
d = tjd_et - dret[0];
|
||||
if (d >= 0) {
|
||||
nleap++;
|
||||
}
|
||||
else if (d < 0 && d > -1.0 / 86400.0) {
|
||||
second_60 = 1;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* UTC, still unsure about one leap second
|
||||
*/
|
||||
tjd =
|
||||
J1972 + (tjd_et - tjd_et_1972) - ((double)nleap +
|
||||
second_60) / 86400.0;
|
||||
swe_revjul(tjd, SE_GREG_CAL, iyear, imonth, iday, &d);
|
||||
*ihour = (int32) d;
|
||||
d -= (double) *ihour;
|
||||
d -= (double)*ihour;
|
||||
d *= 60;
|
||||
*imin = (int32) d;
|
||||
*dsec = (d - (double) *imin) * 60.0;
|
||||
}
|
||||
if (gregflag == SE_JUL_CAL) {
|
||||
tjd = swe_julday(*iyear, *imonth, *iday, 0, SE_GREG_CAL);
|
||||
swe_revjul(tjd, gregflag, iyear, imonth, iday, &d);
|
||||
}
|
||||
*dsec = (d - (double)*imin) * 60.0 + second_60;
|
||||
/*
|
||||
* For input dates > today:
|
||||
* If leap seconds table is not up to date, we'd better interpret the
|
||||
* input time as UT1, not as UTC. How do we find out?
|
||||
* Check, if delta_t - nleap - 32.184 > 0.9
|
||||
*/
|
||||
d = swe_deltat(tjd_et);
|
||||
d = swe_deltat(tjd_et - d);
|
||||
if (d * 86400.0 - (double)(nleap + NLEAP_INIT) - 32.184 >= 1.0) {
|
||||
swe_revjul(tjd_et - d, SE_GREG_CAL, iyear, imonth, iday, &d);
|
||||
*ihour = (int32) d;
|
||||
d -= (double)*ihour;
|
||||
d *= 60;
|
||||
*imin = (int32) d;
|
||||
*dsec = (d - (double)*imin) * 60.0;
|
||||
}
|
||||
if (gregflag == SE_JUL_CAL) {
|
||||
tjd = swe_julday(*iyear, *imonth, *iday, 0, SE_GREG_CAL);
|
||||
swe_revjul(tjd, gregflag, iyear, imonth, iday, &d);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@ -580,8 +602,10 @@ void FAR PASCAL_CONV swe_jdet_to_utc(double tjd_et, int32 gregflag, int32 *iyear
|
||||
* the leap seconds table (or the Swiss Ephemeris version) has not been
|
||||
* updated for a long time.
|
||||
*/
|
||||
void FAR PASCAL_CONV swe_jdut1_to_utc(double tjd_ut, int32 gregflag, int32 *iyear, int32 *imonth, int32 *iday, int32 *ihour, int32 *imin, double *dsec)
|
||||
void FAR PASCAL_CONV
|
||||
swe_jdut1_to_utc(double tjd_ut, int32 gregflag, int32 * iyear, int32 * imonth,
|
||||
int32 * iday, int32 * ihour, int32 * imin, double *dsec)
|
||||
{
|
||||
double tjd_et = tjd_ut + swe_deltat(tjd_ut);
|
||||
swe_jdet_to_utc(tjd_et, gregflag, iyear, imonth, iday, ihour, imin, dsec);
|
||||
double tjd_et = tjd_ut + swe_deltat(tjd_ut);
|
||||
swe_jdet_to_utc(tjd_et, gregflag, iyear, imonth, iday, ihour, imin, dsec);
|
||||
}
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
/*********************************************************
|
||||
$Header: /home/dieter/sweph/RCS/swedate.h,v 1.74 2008/06/16 10:07:20 dieter Exp $
|
||||
version 15-feb-89 16:30
|
||||
@ -58,25 +59,27 @@
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#ifndef _SWEDLL_H
|
||||
extern EXP32 int FAR PASCAL_CONV EXP16 swe_date_conversion (
|
||||
int y , int m , int d , /* year, month, day */
|
||||
double utime, /* universal time in hours (decimal) */
|
||||
char c, /* calendar g[regorian]|j[ulian]|a[stro = greg] */
|
||||
double *tgmt);
|
||||
extern EXP32 int FAR PASCAL_CONV EXP16 swe_date_conversion(int y, int m, int d, /* year, month, day */
|
||||
double utime, /* universal time in hours (decimal) */
|
||||
char c, /* calendar g[regorian]|j[ulian]|a[stro = greg] */
|
||||
double *tgmt);
|
||||
|
||||
extern EXP32 double *FAR PASCAL_CONV EXP16 swe_julday(
|
||||
int year, int month, int day, double hour,
|
||||
int gregflag);
|
||||
extern EXP32 double *FAR PASCAL_CONV EXP16 swe_julday(int year, int month,
|
||||
int day,
|
||||
double hour,
|
||||
int gregflag);
|
||||
|
||||
extern EXP32 void FAR PASCAL_CONV EXP16 swe_revjul (
|
||||
double jd,
|
||||
int gregflag,
|
||||
int *jyear, int *jmon, int *jday, double *jut);
|
||||
extern EXP32 void FAR PASCAL_CONV EXP16 swe_revjul(double jd,
|
||||
int gregflag,
|
||||
int *jyear, int *jmon,
|
||||
int *jday,
|
||||
double *jut);
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
} /* extern C */
|
||||
} /* extern C */
|
||||
#endif
|
||||
|
975
swe/src/swedll.h
975
swe/src/swedll.h
File diff suppressed because it is too large
Load Diff
5860
swe/src/swehel.c
5860
swe/src/swehel.c
File diff suppressed because it is too large
Load Diff
2965
swe/src/swehouse.c
2965
swe/src/swehouse.c
File diff suppressed because it is too large
Load Diff
@ -1,3 +1,4 @@
|
||||
|
||||
/*******************************************************
|
||||
$Header: /home/dieter/sweph/RCS/swehouse.h,v 1.74 2008/06/16 10:07:20 dieter Exp $
|
||||
module swehouse.h
|
||||
@ -59,16 +60,17 @@ house and (simple) aspect calculation
|
||||
for promoting such software, products or services.
|
||||
*/
|
||||
|
||||
struct houses {
|
||||
double cusp[37];
|
||||
double ac;
|
||||
double mc;
|
||||
double vertex;
|
||||
double equasc;
|
||||
double coasc1;
|
||||
double coasc2;
|
||||
double polasc;
|
||||
};
|
||||
struct houses
|
||||
{
|
||||
double cusp[37];
|
||||
double ac;
|
||||
double mc;
|
||||
double vertex;
|
||||
double equasc;
|
||||
double coasc1;
|
||||
double coasc2;
|
||||
double polasc;
|
||||
};
|
||||
|
||||
#define HOUSES struct houses
|
||||
#define VERY_SMALL 1E-10
|
||||
|
1301
swe/src/swejpl.c
1301
swe/src/swejpl.c
File diff suppressed because it is too large
Load Diff
@ -1,3 +1,4 @@
|
||||
|
||||
/*
|
||||
| $Header: /home/dieter/sweph/RCS/swejpl.h,v 1.74 2008/06/16 10:07:20 dieter Exp $
|
||||
|
|
||||
@ -10,6 +11,7 @@
|
||||
Authors: Dieter Koch and Alois Treindl, Astrodienst Zurich
|
||||
|
||||
**************************************************************/
|
||||
|
||||
/* Copyright (C) 1997 - 2008 Astrodienst AG, Switzerland. All rights reserved.
|
||||
|
||||
License conditions
|
||||
@ -67,8 +69,8 @@
|
||||
|
||||
#include "sweodef.h"
|
||||
|
||||
#define J_MERCURY 0 /* jpl body indices, modified by Alois */
|
||||
#define J_VENUS 1 /* now they start at 0 and not at 1 */
|
||||
#define J_MERCURY 0 /* jpl body indices, modified by Alois */
|
||||
#define J_VENUS 1 /* now they start at 0 and not at 1 */
|
||||
#define J_EARTH 2
|
||||
#define J_MARS 3
|
||||
#define J_JUPITER 4
|
||||
@ -89,7 +91,8 @@
|
||||
* ntarg can be all of the above, ncent all except J_NUT and J_LIB.
|
||||
* Librations and Nutations are not affected by ncent.
|
||||
*/
|
||||
extern int swi_pleph(double et, int ntarg, int ncent, double *rrd, char *serr);
|
||||
extern int swi_pleph(double et, int ntarg, int ncent, double *rrd,
|
||||
char *serr);
|
||||
|
||||
/*
|
||||
* read the ephemeris constants. ss[0..2] returns start, end and granule size.
|
||||
@ -97,9 +100,9 @@ extern int swi_pleph(double et, int ntarg, int ncent, double *rrd, char *serr);
|
||||
*/
|
||||
extern void swi_close_jpl_file(void);
|
||||
|
||||
extern int swi_open_jpl_file(double *ss, char *fname, char *fpath, char *serr);
|
||||
extern int swi_open_jpl_file(double *ss, char *fname, char *fpath,
|
||||
char *serr);
|
||||
|
||||
extern int32 swi_get_jpl_denum(void);
|
||||
|
||||
extern void swi_IERS_FK5(double *xin, double *xout, int dir);
|
||||
|
||||
|
2944
swe/src/swemmoon.c
2944
swe/src/swemmoon.c
File diff suppressed because it is too large
Load Diff
1571
swe/src/swemplan.c
1571
swe/src/swemplan.c
File diff suppressed because it is too large
Load Diff
12593
swe/src/swemptab.c
12593
swe/src/swemptab.c
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,3 +1,4 @@
|
||||
|
||||
/************************************************************
|
||||
$Header: /home/dieter/sweph/RCS/sweodef.h,v 1.74 2008/06/16 10:07:20 dieter Exp $
|
||||
definitions and constants for all Swiss Ephemeris source files,
|
||||
@ -68,99 +69,99 @@
|
||||
for promoting such software, products or services.
|
||||
*/
|
||||
|
||||
#ifndef _OURDEF_INCLUDED /* ourdef.h is a superset of sweodef.h */
|
||||
#ifndef _SWEODEF_INCLUDED /* allow multiple #includes */
|
||||
#ifndef _OURDEF_INCLUDED /* ourdef.h is a superset of sweodef.h */
|
||||
#ifndef _SWEODEF_INCLUDED /* allow multiple #includes */
|
||||
#define _SWEODEF_INCLUDED
|
||||
|
||||
# define MY_TRUE 1 /* for use in other defines, before TRUE is defined */
|
||||
# define MY_FALSE 0 /* for use in other defines, before TRUE is defined */
|
||||
|
||||
#define MY_TRUE 1 /* for use in other defines, before TRUE is defined */
|
||||
#define MY_FALSE 0 /* for use in other defines, before TRUE is defined */
|
||||
|
||||
|
||||
#ifdef _WIN32 /* Microsoft VC 5.0 does not define MSDOS anymore */
|
||||
# undef MSDOS
|
||||
# define MSDOS MY_TRUE
|
||||
#ifdef _WIN32 /* Microsoft VC 5.0 does not define MSDOS anymore */
|
||||
#undef MSDOS
|
||||
#define MSDOS MY_TRUE
|
||||
#include <wtypes.h>
|
||||
#include <objbase.h>
|
||||
#include <wincon.h>
|
||||
#include <winbase.h>
|
||||
#include <io.h>
|
||||
#include <windows.h>
|
||||
# define sleep(x) Sleep((x) * 1000)
|
||||
#define sleep(x) Sleep((x) * 1000)
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# define MS_VC
|
||||
#define MS_VC
|
||||
#endif
|
||||
|
||||
#ifdef WIN32 /* Microsoft VC 5.0 does not define MSDOS anymore */
|
||||
# define MSDOS MY_TRUE
|
||||
#ifdef WIN32 /* Microsoft VC 5.0 does not define MSDOS anymore */
|
||||
#define MSDOS MY_TRUE
|
||||
#endif
|
||||
|
||||
#ifdef MSDOS /* already defined by some DOS compilers */
|
||||
# undef MSDOS
|
||||
# define MSDOS MY_TRUE
|
||||
#ifdef MSDOS /* already defined by some DOS compilers */
|
||||
#undef MSDOS
|
||||
#define MSDOS MY_TRUE
|
||||
#endif
|
||||
|
||||
#ifdef __TURBOC__ /* defined by turboc */
|
||||
# ifndef MSDOS
|
||||
# define MSDOS MY_TRUE
|
||||
# endif
|
||||
# define TURBO_C
|
||||
#ifdef __TURBOC__ /* defined by turboc */
|
||||
#ifndef MSDOS
|
||||
#define MSDOS MY_TRUE
|
||||
#endif
|
||||
#define TURBO_C
|
||||
#endif
|
||||
|
||||
#ifdef __SC__ /* defined by Symantec C */
|
||||
# ifndef MSDOS
|
||||
# define MSDOS MY_TRUE
|
||||
# endif
|
||||
# define SYMANTEC_C
|
||||
#ifdef __SC__ /* defined by Symantec C */
|
||||
#ifndef MSDOS
|
||||
#define MSDOS MY_TRUE
|
||||
#endif
|
||||
#define SYMANTEC_C
|
||||
#endif
|
||||
|
||||
#ifdef __WATCOMC__ /* defined by WatcomC */
|
||||
# ifndef MSDOS
|
||||
# define MSDOS MY_TRUE
|
||||
# endif
|
||||
# define WATCOMC
|
||||
#ifdef __WATCOMC__ /* defined by WatcomC */
|
||||
#ifndef MSDOS
|
||||
#define MSDOS MY_TRUE
|
||||
#endif
|
||||
#define WATCOMC
|
||||
#endif
|
||||
|
||||
#ifdef __MWERKS__ /* defined on Macintosh CodeWarrior */
|
||||
# if macintosh && powerc
|
||||
# define MACOS MY_TRUE /* let it undefined otherwise */
|
||||
# define MSDOS MY_FALSE /* in case one above fired falsely */
|
||||
# endif
|
||||
#ifdef __MWERKS__ /* defined on Macintosh CodeWarrior */
|
||||
#if macintosh && powerc
|
||||
#define MACOS MY_TRUE /* let it undefined otherwise */
|
||||
#define MSDOS MY_FALSE /* in case one above fired falsely */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef MSDOS
|
||||
# define HPUNIX MY_FALSE
|
||||
# define INTEL_BYTE_ORDER 1
|
||||
# ifndef TURBO_C
|
||||
# define MS_C /* assume Microsoft C compiler */
|
||||
# endif
|
||||
# define MYFAR far
|
||||
# define UNIX_FS MY_FALSE
|
||||
#define HPUNIX MY_FALSE
|
||||
#define INTEL_BYTE_ORDER 1
|
||||
#ifndef TURBO_C
|
||||
#define MS_C /* assume Microsoft C compiler */
|
||||
#endif
|
||||
#define MYFAR far
|
||||
#define UNIX_FS MY_FALSE
|
||||
#else
|
||||
# ifdef MACOS
|
||||
# define HPUNIX MY_FALSE
|
||||
# define MYFAR
|
||||
# define UNIX_FS MY_FALSE
|
||||
# else
|
||||
# define MSDOS MY_FALSE
|
||||
# define HPUNIX MY_TRUE
|
||||
# ifndef _HPUX_SOURCE
|
||||
# define _HPUX_SOURCE
|
||||
# endif
|
||||
# define MYFAR
|
||||
# define UNIX_FS MY_TRUE
|
||||
# endif
|
||||
#ifdef MACOS
|
||||
#define HPUNIX MY_FALSE
|
||||
#define MYFAR
|
||||
#define UNIX_FS MY_FALSE
|
||||
#else
|
||||
#define MSDOS MY_FALSE
|
||||
#define HPUNIX MY_TRUE
|
||||
#ifndef _HPUX_SOURCE
|
||||
#define _HPUX_SOURCE
|
||||
#endif
|
||||
#define MYFAR
|
||||
#define UNIX_FS MY_TRUE
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#ifndef FILE
|
||||
# include <stdio.h>
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
#if HPUNIX
|
||||
# include <unistd.h>
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
@ -170,63 +171,63 @@
|
||||
*/
|
||||
#include <limits.h>
|
||||
#if INT_MAX < 40000
|
||||
# define INT_16
|
||||
#define INT_16
|
||||
#else
|
||||
# if LONG_MAX > INT_MAX
|
||||
# define LONG_64
|
||||
# endif
|
||||
#if LONG_MAX > INT_MAX
|
||||
#define LONG_64
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef BYTE_ORDER
|
||||
#ifdef LITTLE_ENDIAN
|
||||
# if BYTE_ORDER == LITTLE_ENDIAN
|
||||
# define INTEL_BYTE_ORDER
|
||||
# endif
|
||||
#if BYTE_ORDER == LITTLE_ENDIAN
|
||||
#define INTEL_BYTE_ORDER
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef INT_16
|
||||
typedef long int32;
|
||||
typedef unsigned long uint32;
|
||||
typedef int int16;
|
||||
typedef double REAL8; /* real with at least 64 bit precision */
|
||||
typedef long INT4; /* signed integer with at least 32 bit precision */
|
||||
typedef unsigned long UINT4;
|
||||
typedef long int32;
|
||||
typedef unsigned long uint32;
|
||||
typedef int int16;
|
||||
typedef double REAL8; /* real with at least 64 bit precision */
|
||||
typedef long INT4; /* signed integer with at least 32 bit precision */
|
||||
typedef unsigned long UINT4;
|
||||
/* unsigned integer with at least 32 bit precision */
|
||||
typedef int AS_BOOL;
|
||||
typedef unsigned int UINT2; /* unsigned 16 bits */
|
||||
# define ABS4 labs /* abs function for long */
|
||||
typedef int AS_BOOL;
|
||||
typedef unsigned int UINT2; /* unsigned 16 bits */
|
||||
#define ABS4 labs /* abs function for long */
|
||||
#else
|
||||
typedef int int32;
|
||||
typedef long long int64;
|
||||
typedef unsigned int uint32;
|
||||
typedef short int16;
|
||||
typedef double REAL8; /* real with at least 64 bit precision */
|
||||
typedef int INT4; /* signed integer with at least 32 bit precision */
|
||||
typedef unsigned int UINT4;
|
||||
/* unsigned integer with at least 32 bit precision */
|
||||
typedef int AS_BOOL;
|
||||
typedef unsigned short UINT2; /* unsigned 16 bits */
|
||||
# define ABS4 abs /* abs function for long */
|
||||
typedef int int32;
|
||||
typedef long long int64;
|
||||
typedef unsigned int uint32;
|
||||
typedef short int16;
|
||||
typedef double REAL8; /* real with at least 64 bit precision */
|
||||
typedef int INT4; /* signed integer with at least 32 bit precision */
|
||||
typedef unsigned int UINT4;
|
||||
/* unsigned integer with at least 32 bit precision */
|
||||
typedef int AS_BOOL;
|
||||
typedef unsigned short UINT2; /* unsigned 16 bits */
|
||||
#define ABS4 abs /* abs function for long */
|
||||
#endif
|
||||
|
||||
#if MSDOS
|
||||
# ifdef TURBO_C
|
||||
# include <alloc.h> /* MSC needs malloc ! */
|
||||
# else
|
||||
# include <malloc.h>
|
||||
# endif
|
||||
# define SIGALRM SIGINT
|
||||
#if MSDOS
|
||||
#ifdef TURBO_C
|
||||
#include <alloc.h> /* MSC needs malloc ! */
|
||||
#else
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
#define SIGALRM SIGINT
|
||||
#endif
|
||||
|
||||
#ifndef TRUE
|
||||
# define TRUE 1
|
||||
# define FALSE 0
|
||||
#ifndef TRUE
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
#endif
|
||||
|
||||
#ifndef OK
|
||||
# define OK (0)
|
||||
# define ERR (-1)
|
||||
#ifndef OK
|
||||
#define OK (0)
|
||||
#define ERR (-1)
|
||||
#endif
|
||||
|
||||
/* hack because UCHAR is already used by mingw gcc */
|
||||
@ -240,30 +241,30 @@ typedef unsigned char UCHAR;
|
||||
#define UCP (UCHAR*)
|
||||
#define SCP (char*)
|
||||
|
||||
# define ODEGREE_STRING "°" /* degree as string, utf8 encoding */
|
||||
|
||||
#define ODEGREE_STRING "°" /* degree as string, utf8 encoding */
|
||||
|
||||
|
||||
|
||||
#ifndef HUGE
|
||||
# define HUGE 1.7E+308 /* biggest value for REAL8 */
|
||||
#define HUGE 1.7E+308 /* biggest value for REAL8 */
|
||||
#endif
|
||||
#ifndef M_PI
|
||||
# define M_PI 3.14159265358979323846
|
||||
#define M_PI 3.14159265358979323846
|
||||
#endif
|
||||
|
||||
|
||||
#define forward static
|
||||
|
||||
#define AS_MAXCH 256 /* used for string declarations, allowing 255 char+\0 */
|
||||
|
||||
#define AS_MAXCH 256 /* used for string declarations, allowing 255 char+\0 */
|
||||
|
||||
#define DEGTORAD 0.0174532925199433
|
||||
#define RADTODEG 57.2957795130823
|
||||
|
||||
typedef int32 centisec; /* centiseconds used for angles and times */
|
||||
#define CS (centisec) /* use for casting */
|
||||
#define CSEC centisec /* use for typing */
|
||||
|
||||
#define DEG 360000 /* degree expressed in centiseconds */
|
||||
#define DEG7_30 (2700000) /* 7.5 degrees */
|
||||
typedef int32 centisec; /* centiseconds used for angles and times */
|
||||
#define CS (centisec) /* use for casting */
|
||||
#define CSEC centisec /* use for typing */
|
||||
|
||||
#define DEG 360000 /* degree expressed in centiseconds */
|
||||
#define DEG7_30 (2700000) /* 7.5 degrees */
|
||||
#define DEG15 (15 * DEG)
|
||||
#define DEG24 (24 * DEG)
|
||||
#define DEG30 (30 * DEG)
|
||||
@ -274,48 +275,49 @@ typedef int32 centisec; /* centiseconds used for angles and times */
|
||||
#define DEG180 (180 * DEG)
|
||||
#define DEG270 (270 * DEG)
|
||||
#define DEG360 (360 * DEG)
|
||||
|
||||
#define CSTORAD 4.84813681109536E-08 /* centisec to rad: pi / 180 /3600/100 */
|
||||
#define RADTOCS 2.06264806247096E+07 /* rad to centisec 180*3600*100/pi */
|
||||
|
||||
#define CS2DEG (1.0/360000.0) /* centisec to degree */
|
||||
|
||||
#define CSTORAD 4.84813681109536E-08 /* centisec to rad: pi / 180 /3600/100 */
|
||||
#define RADTOCS 2.06264806247096E+07 /* rad to centisec 180*3600*100/pi */
|
||||
|
||||
#define CS2DEG (1.0/360000.0) /* centisec to degree */
|
||||
|
||||
/* control strings for fopen() */
|
||||
#if UNIX_FS
|
||||
# define BFILE_R_ACCESS "r" /* open binary file for reading */
|
||||
# define BFILE_RW_ACCESS "r+" /* open binary file for writing and reading */
|
||||
# define BFILE_W_CREATE "w" /* create/open binary file for write*/
|
||||
# define BFILE_A_ACCESS "a+" /* create/open binary file for append*/
|
||||
# define FILE_R_ACCESS "r" /* open text file for reading */
|
||||
# define FILE_RW_ACCESS "r+" /* open text file for writing and reading */
|
||||
# define FILE_W_CREATE "w" /* create/open text file for write*/
|
||||
# define FILE_A_ACCESS "a+" /* create/open text file for append*/
|
||||
# define O_BINARY 0 /* for open(), not defined in Unix */
|
||||
# define OPEN_MODE 0666 /* default file creation mode */
|
||||
# define DIR_GLUE "/" /* glue string for directory/file */
|
||||
# define PATH_SEPARATOR ";:" /* semicolon or colon may be used */
|
||||
#define BFILE_R_ACCESS "r" /* open binary file for reading */
|
||||
#define BFILE_RW_ACCESS "r+" /* open binary file for writing and reading */
|
||||
#define BFILE_W_CREATE "w" /* create/open binary file for write */
|
||||
#define BFILE_A_ACCESS "a+" /* create/open binary file for append */
|
||||
#define FILE_R_ACCESS "r" /* open text file for reading */
|
||||
#define FILE_RW_ACCESS "r+" /* open text file for writing and reading */
|
||||
#define FILE_W_CREATE "w" /* create/open text file for write */
|
||||
#define FILE_A_ACCESS "a+" /* create/open text file for append */
|
||||
#define O_BINARY 0 /* for open(), not defined in Unix */
|
||||
#define OPEN_MODE 0666 /* default file creation mode */
|
||||
#define DIR_GLUE "/" /* glue string for directory/file */
|
||||
#define PATH_SEPARATOR ";:" /* semicolon or colon may be used */
|
||||
#else
|
||||
# define BFILE_R_ACCESS "rb" /* open binary file for reading */
|
||||
# define BFILE_RW_ACCESS "r+b" /* open binary file for writing and reading */
|
||||
# define BFILE_W_CREATE "wb" /* create/open binary file for write*/
|
||||
# define BFILE_A_ACCESS "a+b" /* create/open binary file for append*/
|
||||
# define PATH_SEPARATOR ";" /* semicolon as PATH separator */
|
||||
# define OPEN_MODE 0666 /* default file creation mode */
|
||||
# ifdef MACOS
|
||||
# define FILE_R_ACCESS "r" /* open text file for reading */
|
||||
# define FILE_RW_ACCESS "r+" /* open text file for writing and reading */
|
||||
# define FILE_W_CREATE "w" /* create/open text file for write*/
|
||||
# define FILE_A_ACCESS "a+" /* create/open text file for append*/
|
||||
# define DIR_GLUE ":" /* glue string for directory/file */
|
||||
# else
|
||||
# define FILE_R_ACCESS "rt" /* open text file for reading */
|
||||
# define FILE_RW_ACCESS "r+t" /* open text file for writing and reading */
|
||||
# define FILE_W_CREATE "wt" /* create/open text file for write*/
|
||||
# define FILE_A_ACCESS "a+t" /* create/open text file for append*/
|
||||
#define BFILE_R_ACCESS "rb" /* open binary file for reading */
|
||||
#define BFILE_RW_ACCESS "r+b" /* open binary file for writing and reading */
|
||||
#define BFILE_W_CREATE "wb" /* create/open binary file for write */
|
||||
#define BFILE_A_ACCESS "a+b" /* create/open binary file for append */
|
||||
#define PATH_SEPARATOR ";" /* semicolon as PATH separator */
|
||||
#define OPEN_MODE 0666 /* default file creation mode */
|
||||
#ifdef MACOS
|
||||
#define FILE_R_ACCESS "r" /* open text file for reading */
|
||||
#define FILE_RW_ACCESS "r+" /* open text file for writing and reading */
|
||||
#define FILE_W_CREATE "w" /* create/open text file for write */
|
||||
#define FILE_A_ACCESS "a+" /* create/open text file for append */
|
||||
#define DIR_GLUE ":" /* glue string for directory/file */
|
||||
#else
|
||||
#define FILE_R_ACCESS "rt" /* open text file for reading */
|
||||
#define FILE_RW_ACCESS "r+t" /* open text file for writing and reading */
|
||||
#define FILE_W_CREATE "wt" /* create/open text file for write */
|
||||
#define FILE_A_ACCESS "a+t" /* create/open text file for append */
|
||||
|
||||
/* attention, all backslashes for msdos directry names must be written as \\,
|
||||
because it is the C escape character */
|
||||
# define DIR_GLUE "\\" /* glue string for directory/file */
|
||||
# endif
|
||||
#define DIR_GLUE "\\" /* glue string for directory/file */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
|
1109
swe/src/swepcalc.c
1109
swe/src/swepcalc.c
File diff suppressed because it is too large
Load Diff
@ -1,3 +1,4 @@
|
||||
|
||||
/************************************************************
|
||||
$Header: /home/dieter/sweph/RCS/swepcalc.h,v 1.74 2008/06/16 10:07:20 dieter Exp $
|
||||
Definitions and constants for Placalc interface to SwissEph
|
||||
@ -84,15 +85,15 @@
|
||||
* It is very simple to adapt your code to it.
|
||||
* If you want to adapt your source code, turn the next TRUE into FALSE
|
||||
*/
|
||||
#if TRUE /* replace by if FALSE to deactivate macros */
|
||||
# define d2l(x) swe_d2l(x)
|
||||
# define difcsn(x,y) swe_difcsn(x,y)
|
||||
# define difcs2n(x,y) swe_difcs2n(x,y)
|
||||
# define difdegn(x,y) swe_difdegn(x,y)
|
||||
# define difdeg2n(x,y) swe_difdeg2n(x,y)
|
||||
# define csnorm(x) swe_csnorm(x)
|
||||
# define degnorm(x) swe_degnorm(x)
|
||||
# define roundsec(x) swe_csroundsec(x)
|
||||
#if TRUE /* replace by if FALSE to deactivate macros */
|
||||
#define d2l(x) swe_d2l(x)
|
||||
#define difcsn(x,y) swe_difcsn(x,y)
|
||||
#define difcs2n(x,y) swe_difcs2n(x,y)
|
||||
#define difdegn(x,y) swe_difdegn(x,y)
|
||||
#define difdeg2n(x,y) swe_difdeg2n(x,y)
|
||||
#define csnorm(x) swe_csnorm(x)
|
||||
#define degnorm(x) swe_degnorm(x)
|
||||
#define roundsec(x) swe_csroundsec(x)
|
||||
#endif
|
||||
|
||||
/*************************************************************
|
||||
@ -102,28 +103,24 @@
|
||||
Astrodienst relative julian days, and jd the use of absolute
|
||||
julian days.
|
||||
*************************************************************/
|
||||
extern int nacalc(double jd_ad, centisec *plon, centisec *pspe);
|
||||
extern int nacalc(double jd_ad, centisec * plon, centisec * pspe);
|
||||
extern int calcserv(int id, double t, int flag, int plalist, char *so);
|
||||
extern void helup(double jd_ad);
|
||||
extern void togeo(double le, double re, double l, double r, double z, double *alg, double *arg);
|
||||
extern int calc(int p,
|
||||
double jd_ad,
|
||||
int flag,
|
||||
double *alng,
|
||||
double *arad,
|
||||
double *alat,
|
||||
double *alngspeed);
|
||||
extern void togeo(double le, double re, double l, double r, double z,
|
||||
double *alg, double *arg);
|
||||
extern int calc(int p, double jd_ad, int flag, double *alng, double *arad,
|
||||
double *alat, double *alngspeed);
|
||||
extern int rel_geo(int p, double rau);
|
||||
extern int hel( int p, /* planet index as defined by placalc.h */
|
||||
double jd_ad, /* relative juliand date, ephemeris time */
|
||||
/* Now come 6 pointers to return values. */
|
||||
double *al, /* longitude in degrees */
|
||||
double *ar, /* radius in AU */
|
||||
double *az, /* distance from ecliptic in AU */
|
||||
double *alp, /* speed in longitude, degrees per day */
|
||||
double *arp, /* speed in radius, AU per day */
|
||||
double *azp); /* speed in z, AU per day */
|
||||
extern int moon(double *al, double *ar, double *az);
|
||||
extern int hel(int p, /* planet index as defined by placalc.h */
|
||||
double jd_ad, /* relative juliand date, ephemeris time */
|
||||
/* Now come 6 pointers to return values. */
|
||||
double *al, /* longitude in degrees */
|
||||
double *ar, /* radius in AU */
|
||||
double *az, /* distance from ecliptic in AU */
|
||||
double *alp, /* speed in longitude, degrees per day */
|
||||
double *arp, /* speed in radius, AU per day */
|
||||
double *azp); /* speed in z, AU per day */
|
||||
extern int moon(double *al, double *ar, double *az);
|
||||
extern double fraction(double t);
|
||||
extern double sidtime(double jd_ad, double ecl, double nuta);
|
||||
extern double smod8360(double x);
|
||||
@ -131,24 +128,25 @@ extern double mod8360(double x);
|
||||
extern double diff8360(double x, double y);
|
||||
extern double test_near_zero(double x);
|
||||
extern double deltat(double jd_ad);
|
||||
extern void to_mean_ekl (double jd, double xyz[], double lrz[]);
|
||||
extern void to_mean_ekl(double jd, double xyz[], double lrz[]);
|
||||
extern void placalc_close_files();
|
||||
extern int fixstar(char *star, double jd, double *lon, double *lat);
|
||||
extern char *placalc_get_errtext();
|
||||
extern char *placalc_set_ephepath(char *new_path); /* sets ephepath;
|
||||
if called with NULL, returns current path */
|
||||
extern char *placalc_set_ephepath(char *new_path); /* sets ephepath;
|
||||
* if called with NULL, returns current path */
|
||||
|
||||
/*
|
||||
* because deltat() required a relative Julian date due to historical reasons,
|
||||
* we define a function deltatjd() with absolute Juliand date argument.
|
||||
*/
|
||||
# define deltatjd(x) deltat((x) - JUL_OFFSET)
|
||||
#define deltatjd(x) deltat((x) - JUL_OFFSET)
|
||||
|
||||
/*
|
||||
* get the planet index for an AFL letter
|
||||
* returns -1 if the letter does not correspond to a planet.
|
||||
*/
|
||||
extern int afl2planet(int afl);
|
||||
|
||||
/*
|
||||
* get the AFL letter for a planet
|
||||
* returns -1 if planet has no letter.
|
||||
@ -162,7 +160,7 @@ extern char *planet2abbr3(int planet);
|
||||
(these cannot be used by DLL clients)
|
||||
*************************************************************/
|
||||
|
||||
|
||||
|
||||
/*************************************************************
|
||||
definitions
|
||||
*************************************************************/
|
||||
@ -171,8 +169,8 @@ extern char *planet2abbr3(int planet);
|
||||
* planet index numbers, used to identify a planet in calc() and
|
||||
* other related functions.
|
||||
*/
|
||||
#define CALC_ONLY_ECL_NUT -1 /* pseudo planet index for calls to calc */
|
||||
#define SUN 0 /* used synonymously for earth too */
|
||||
#define CALC_ONLY_ECL_NUT -1 /* pseudo planet index for calls to calc */
|
||||
#define SUN 0 /* used synonymously for earth too */
|
||||
#define EARTH 0
|
||||
#define MOON 1
|
||||
#define MERCURY 2
|
||||
@ -187,16 +185,16 @@ extern char *planet2abbr3(int planet);
|
||||
#define MEAN_NODE 10
|
||||
#define TRUE_NODE 11
|
||||
#define CHIRON 12
|
||||
#define LILITH 13
|
||||
#define CALC_N 14 /* number of planets in placalc module */
|
||||
#define LILITH 13
|
||||
#define CALC_N 14 /* number of planets in placalc module */
|
||||
|
||||
#define CERES 14
|
||||
#define PALLAS 15
|
||||
#define JUNO 16
|
||||
#define VESTA 17
|
||||
|
||||
#define MAXPL_NACALC (LILITH) /* nacalc computes SUN..LILITH */
|
||||
# define PROG_PLANET_OFFSET 50 /* progressed sun */
|
||||
#define MAXPL_NACALC (LILITH) /* nacalc computes SUN..LILITH */
|
||||
#define PROG_PLANET_OFFSET 50 /* progressed sun */
|
||||
|
||||
/*
|
||||
* houses and axes get also a 'planet' index number, but they
|
||||
@ -206,20 +204,21 @@ extern char *planet2abbr3(int planet);
|
||||
* Axes and houses cannot be computed with calls to calc(); they must
|
||||
* be computed with the housasp module functions.
|
||||
*/
|
||||
# define AC 19
|
||||
# define ASC 19
|
||||
# define MC 20
|
||||
# define CALC_N_MC 21 /* number of normal natal factors */
|
||||
#define AC 19
|
||||
#define ASC 19
|
||||
#define MC 20
|
||||
#define CALC_N_MC 21 /* number of normal natal factors */
|
||||
|
||||
# define FIRST_HSNR 21
|
||||
# define LAST_HSNR 32
|
||||
# define NO_OF_HOUSES 12
|
||||
#define FIRST_HSNR 21
|
||||
#define LAST_HSNR 32
|
||||
#define NO_OF_HOUSES 12
|
||||
#define MAX_PL_INDEX 32
|
||||
|
||||
/*
|
||||
* in a bitlist flag each planet is represented by a bit;
|
||||
* all 14 defined planets can be called at once with
|
||||
*/
|
||||
#define CALC_ALL_PLANET_BITS ((1 << CALC_N) - 1) /* bits 0..13 set */
|
||||
#define CALC_ALL_PLANET_BITS ((1 << CALC_N) - 1) /* bits 0..13 set */
|
||||
|
||||
/*
|
||||
* AFL: Astrological factor letters for use in selections strings.
|
||||
@ -231,92 +230,93 @@ extern char *planet2abbr3(int planet);
|
||||
* The function planet2afl translates a planext index into the AFL letter.
|
||||
*/
|
||||
|
||||
# define AFL_SUN '0'
|
||||
# define AFL_MON '1'
|
||||
# define AFL_MER '2'
|
||||
# define AFL_VEN '3'
|
||||
# define AFL_MAR '4'
|
||||
# define AFL_JUP '5'
|
||||
# define AFL_SAT '6'
|
||||
# define AFL_URA '7'
|
||||
# define AFL_NEP '8'
|
||||
# define AFL_PLU '9'
|
||||
# define AFL_CHI 'c'
|
||||
# define AFL_LIL 'i' /* mean Lilith: direction of lunar aphel */
|
||||
# define AFL_AC 'A'
|
||||
# define AFL_MC 'M'
|
||||
# define AFL_TNODE 'N' /* TRUE_NODE */
|
||||
# define AFL_MNODE 'n' /* MEAN_NODE */
|
||||
# define AFL_CER 'C'
|
||||
# define AFL_PAL 'P'
|
||||
# define AFL_JUN 'J'
|
||||
# define AFL_VES 'V'
|
||||
#define AFL_SUN '0'
|
||||
#define AFL_MON '1'
|
||||
#define AFL_MER '2'
|
||||
#define AFL_VEN '3'
|
||||
#define AFL_MAR '4'
|
||||
#define AFL_JUP '5'
|
||||
#define AFL_SAT '6'
|
||||
#define AFL_URA '7'
|
||||
#define AFL_NEP '8'
|
||||
#define AFL_PLU '9'
|
||||
#define AFL_CHI 'c'
|
||||
#define AFL_LIL 'i' /* mean Lilith: direction of lunar aphel */
|
||||
#define AFL_AC 'A'
|
||||
#define AFL_MC 'M'
|
||||
#define AFL_TNODE 'N' /* TRUE_NODE */
|
||||
#define AFL_MNODE 'n' /* MEAN_NODE */
|
||||
#define AFL_CER 'C'
|
||||
#define AFL_PAL 'P'
|
||||
#define AFL_JUN 'J'
|
||||
#define AFL_VES 'V'
|
||||
|
||||
/*
|
||||
* other AFL definitions not recognized by afl2planet()
|
||||
*/
|
||||
# define AFL_SIDT 's' /* sidereal time */
|
||||
# define AFL_WDAY 'd' /* day of week column */
|
||||
# define AFL_HOUSE 'H' /* any house cusp */
|
||||
#define AFL_SIDT 's' /* sidereal time */
|
||||
#define AFL_WDAY 'd' /* day of week column */
|
||||
#define AFL_HOUSE 'H' /* any house cusp */
|
||||
|
||||
# define apl2planet afl2planet /* change of original name */
|
||||
#define apl2planet afl2planet /* change of original name */
|
||||
|
||||
|
||||
# define J2000 2451545.0 /* Epoch of JPL ephemeris DE200, absolute */
|
||||
# define J1950 2433282.423 /* Epoch of JPL ephemeris DE102 */
|
||||
# define JUL_OFFSET 2433282.0 /* offset of Astrodienst relative Julian date */
|
||||
#define J2000 2451545.0 /* Epoch of JPL ephemeris DE200, absolute */
|
||||
#define J1950 2433282.423 /* Epoch of JPL ephemeris DE102 */
|
||||
#define JUL_OFFSET 2433282.0 /* offset of Astrodienst relative Julian date */
|
||||
|
||||
#ifndef GREG_CAL
|
||||
# define GREG_CAL SE_GREG_CAL
|
||||
# define JUL_CAL SE_JUL_CAL
|
||||
#define GREG_CAL SE_GREG_CAL
|
||||
#define JUL_CAL SE_JUL_CAL
|
||||
#endif
|
||||
|
||||
/*
|
||||
* flag bits used in calc and calcserv
|
||||
*/
|
||||
# define CALC_BIT_HELIO 1 /* geo/helio */
|
||||
# define CALC_BIT_NOAPP 2 /* apparent/true positions */
|
||||
# define CALC_BIT_NONUT 4 /* true eq. of date/ mean equ. of date */
|
||||
# define CALC_BIT_EPHE 8 /* universal/ephemeris time */
|
||||
# define CALC_BIT_SPEED 16 /* without/with speed */
|
||||
# define CALC_BIT_BETA 32 /* without/with latitude */
|
||||
# define CALC_BIT_RGEO 64 /* without/with relative rgeo */
|
||||
# define CALC_BIT_RAU 128 /* without/with real radius */
|
||||
# define CALC_BIT_MUST_USE_EPHE 256 /* epheserv may not use calc */
|
||||
# define CALC_BIT_MAY_USE_EPHE 512 /* calcserv may use ephread */
|
||||
# define CALC_BIT_MUST_CALC 1024 /* ephread must calc */
|
||||
#define CALC_BIT_HELIO 1 /* geo/helio */
|
||||
#define CALC_BIT_NOAPP 2 /* apparent/true positions */
|
||||
#define CALC_BIT_NONUT 4 /* true eq. of date/ mean equ. of date */
|
||||
#define CALC_BIT_EPHE 8 /* universal/ephemeris time */
|
||||
#define CALC_BIT_SPEED 16 /* without/with speed */
|
||||
#define CALC_BIT_BETA 32 /* without/with latitude */
|
||||
#define CALC_BIT_RGEO 64 /* without/with relative rgeo */
|
||||
#define CALC_BIT_RAU 128 /* without/with real radius */
|
||||
#define CALC_BIT_MUST_USE_EPHE 256 /* epheserv may not use calc */
|
||||
#define CALC_BIT_MAY_USE_EPHE 512 /* calcserv may use ephread */
|
||||
#define CALC_BIT_MUST_CALC 1024 /* ephread must calc */
|
||||
|
||||
|
||||
/*
|
||||
* stuff from astrolib.h
|
||||
*/
|
||||
|
||||
#ifndef ADATE /* this must be bracketed because users of swepcalc
|
||||
may also include astrolib.h for other reasons */
|
||||
#ifndef ADATE /* this must be bracketed because users of swepcalc
|
||||
* may also include astrolib.h for other reasons */
|
||||
#define ADATE struct adate
|
||||
|
||||
/* makros for bit operations */
|
||||
# define clear_bit(v,bit_nr) ((v) & ~(1L << (bit_nr)))
|
||||
# define set_bit(v,bit_nr) ((v) | (1L << (bit_nr)))
|
||||
# define bit(bit_nr) (1L << (bit_nr))
|
||||
# define check_bit(v,bit_nr) ((v) & (1L << (bit_nr)))
|
||||
#define clear_bit(v,bit_nr) ((v) & ~(1L << (bit_nr)))
|
||||
#define set_bit(v,bit_nr) ((v) | (1L << (bit_nr)))
|
||||
#define bit(bit_nr) (1L << (bit_nr))
|
||||
#define check_bit(v,bit_nr) ((v) & (1L << (bit_nr)))
|
||||
|
||||
ADATE { /* date structure used by revjuls and juldays */
|
||||
int day, month, year;
|
||||
centisec csec;
|
||||
};
|
||||
ADATE { /* date structure used by revjuls and juldays */
|
||||
int day, month, year;
|
||||
centisec csec;
|
||||
};
|
||||
|
||||
#endif /* ADATE */
|
||||
#endif /* ADATE */
|
||||
|
||||
/*
|
||||
* functions exported by swepdate.c
|
||||
*/
|
||||
extern double julday(int month, int day, int year, double hour, int gregflag);
|
||||
extern double juldays(int gregflag, ADATE *adp);
|
||||
extern void revjul (double u, int gregflag,
|
||||
int *jmon, int *jday, int *jyear, double *jut);
|
||||
extern void revjuls(double u, int gregflag, ADATE *adp);
|
||||
extern double juldays(int gregflag, ADATE * adp);
|
||||
extern void revjul(double u, int gregflag, int *jmon, int *jday, int *jyear,
|
||||
double *jut);
|
||||
extern void revjuls(double u, int gregflag, ADATE * adp);
|
||||
extern int day_of_week(double t);
|
||||
|
||||
/*
|
||||
* end swpdate.c
|
||||
*/
|
||||
@ -324,7 +324,7 @@ extern int day_of_week(double t);
|
||||
/*
|
||||
* stuff from housasp.h
|
||||
*/
|
||||
#ifndef ASP_144 /* allow including housasp wihout conflict */
|
||||
#ifndef ASP_144 /* allow including housasp wihout conflict */
|
||||
#define MAXPLANETS 16
|
||||
|
||||
/*
|
||||
@ -333,40 +333,40 @@ extern int day_of_week(double t);
|
||||
* We define three different names for the aspects:
|
||||
* ASP_CONJ (always 4 letters), ASP_0 and CONJ.
|
||||
*/
|
||||
# define ASP_CONJ 1
|
||||
# define ASP_0 1
|
||||
# define ASP_OPPO 2
|
||||
# define ASP_180 2
|
||||
# define ASP_SQUA 3
|
||||
# define ASP_90 3
|
||||
# define ASP_TRIN 4
|
||||
# define ASP_120 4
|
||||
# define ASP_SEXT 5
|
||||
# define ASP_60 5
|
||||
# define ASP_SMSX 6
|
||||
# define ASP_30 6
|
||||
# define ASP_QCNX 7
|
||||
# define ASP_150 7
|
||||
# define ASP_SMSQ 8
|
||||
# define ASP_45 8
|
||||
# define ASP_SQSQ 9
|
||||
# define ASP_135 9
|
||||
# define ASP_QINT 10
|
||||
# define ASP_72 10
|
||||
# define ASP_BQIN 11
|
||||
# define ASP_144 11
|
||||
#define ASP_CONJ 1
|
||||
#define ASP_0 1
|
||||
#define ASP_OPPO 2
|
||||
#define ASP_180 2
|
||||
#define ASP_SQUA 3
|
||||
#define ASP_90 3
|
||||
#define ASP_TRIN 4
|
||||
#define ASP_120 4
|
||||
#define ASP_SEXT 5
|
||||
#define ASP_60 5
|
||||
#define ASP_SMSX 6
|
||||
#define ASP_30 6
|
||||
#define ASP_QCNX 7
|
||||
#define ASP_150 7
|
||||
#define ASP_SMSQ 8
|
||||
#define ASP_45 8
|
||||
#define ASP_SQSQ 9
|
||||
#define ASP_135 9
|
||||
#define ASP_QINT 10
|
||||
#define ASP_72 10
|
||||
#define ASP_BQIN 11
|
||||
#define ASP_144 11
|
||||
|
||||
# define CONJ ASP_CONJ
|
||||
# define OPPO ASP_OPPO
|
||||
# define SQUA ASP_SQUA
|
||||
# define TRIN ASP_TRIN
|
||||
# define SEXT ASP_SEXT
|
||||
# define SMSX ASP_SMSX
|
||||
# define QCNX ASP_QCNX
|
||||
# define SMSQ ASP_SMSQ
|
||||
# define SQSQ ASP_SQSQ
|
||||
# define QINT ASP_QINT
|
||||
# define BQIN ASP_BQIN
|
||||
#define CONJ ASP_CONJ
|
||||
#define OPPO ASP_OPPO
|
||||
#define SQUA ASP_SQUA
|
||||
#define TRIN ASP_TRIN
|
||||
#define SEXT ASP_SEXT
|
||||
#define SMSX ASP_SMSX
|
||||
#define QCNX ASP_QCNX
|
||||
#define SMSQ ASP_SMSQ
|
||||
#define SQSQ ASP_SQSQ
|
||||
#define QINT ASP_QINT
|
||||
#define BQIN ASP_BQIN
|
||||
|
||||
#define MAXASPECTS ASP_BQIN
|
||||
|
||||
@ -374,9 +374,9 @@ extern int day_of_week(double t);
|
||||
* for compact encoding of aspect lists we set bit 1 for CONJ, bit 2 for OPPO
|
||||
* and so on. asp_bit(asp) deleivers the mask.
|
||||
*/
|
||||
#define ALL_ASP_BITS 1022 /* bit mask with all aspect bits set */
|
||||
#define STRONG_ASP_BITS 62 /* bit mask with strong aspect bits set */
|
||||
#define HARD_ASP_BITS 14 /* bit mask with hard aspect bits set */
|
||||
#define ALL_ASP_BITS 1022 /* bit mask with all aspect bits set */
|
||||
#define STRONG_ASP_BITS 62 /* bit mask with strong aspect bits set */
|
||||
#define HARD_ASP_BITS 14 /* bit mask with hard aspect bits set */
|
||||
|
||||
#define asp_bit(asp) (1 << (asp))
|
||||
|
||||
@ -394,68 +394,71 @@ extern int day_of_week(double t);
|
||||
/*
|
||||
* used to initialize an array centisec angles[MAXASPECTS+1]
|
||||
*/
|
||||
# define ASP_ANGLES {0, 0*DEG, 180*DEG, 90*DEG, 120*DEG,\
|
||||
#define ASP_ANGLES {0, 0*DEG, 180*DEG, 90*DEG, 120*DEG,\
|
||||
60*DEG, 30*DEG, 150*DEG, 45*DEG, 135*DEG, 72*DEG, 144*DEG}
|
||||
|
||||
struct AspectType {
|
||||
AS_BOOL dataValid; /* used as boolean */
|
||||
int NrOfPlanets,
|
||||
NrOfAspects;
|
||||
centisec *PlanetPos; /* pointer to an array of planet positions
|
||||
[0..NrOfPlanets-1]; the user of the
|
||||
structure must set this pointer to his
|
||||
array of planet positions */
|
||||
centisec *ppos2; /* second set for mutual aspects only; if
|
||||
not NULL, interaspects are calculated */
|
||||
centisec *Maxorb; /* pointer to an array [0..NrOfAspects] of
|
||||
maximum orbes; element[0] not used;
|
||||
the user of the structure must set this
|
||||
pointer to his array of maxorbs */
|
||||
centisec *Angle; /* pointer to Angle[0..NrOfAspects] of the
|
||||
angles of aspects; [0] not used; the
|
||||
user must set this pointer to his array
|
||||
of angles */
|
||||
struct aspRec {
|
||||
int index; /* number of the found aspect */
|
||||
centisec orb;
|
||||
}
|
||||
Asp [MAXPLANETS] [MAXPLANETS];
|
||||
};
|
||||
struct AspectType
|
||||
{
|
||||
AS_BOOL dataValid; /* used as boolean */
|
||||
int NrOfPlanets, NrOfAspects;
|
||||
centisec *PlanetPos; /* pointer to an array of planet positions
|
||||
* [0..NrOfPlanets-1]; the user of the
|
||||
* structure must set this pointer to his
|
||||
* array of planet positions */
|
||||
centisec *ppos2; /* second set for mutual aspects only; if
|
||||
* not NULL, interaspects are calculated */
|
||||
centisec *Maxorb; /* pointer to an array [0..NrOfAspects] of
|
||||
* maximum orbes; element[0] not used;
|
||||
* the user of the structure must set this
|
||||
* pointer to his array of maxorbs */
|
||||
centisec *Angle; /* pointer to Angle[0..NrOfAspects] of the
|
||||
* angles of aspects; [0] not used; the
|
||||
* user must set this pointer to his array
|
||||
* of angles */
|
||||
struct aspRec
|
||||
{
|
||||
int index; /* number of the found aspect */
|
||||
centisec orb;
|
||||
}
|
||||
Asp[MAXPLANETS][MAXPLANETS];
|
||||
};
|
||||
|
||||
struct houses {
|
||||
centisec cusp[13];
|
||||
centisec ac;
|
||||
centisec mc;
|
||||
};
|
||||
struct houses
|
||||
{
|
||||
centisec cusp[13];
|
||||
centisec ac;
|
||||
centisec mc;
|
||||
};
|
||||
|
||||
#define HOUSES struct houses
|
||||
#endif /* ifndef ASP_144 */
|
||||
|
||||
# define HOUSES struct houses
|
||||
#endif /* ifndef ASP_144 */
|
||||
/**********************************
|
||||
functions exported originally from housasp.c
|
||||
***********************************/
|
||||
|
||||
extern int HouseNr(HOUSES *h, CSEC p);
|
||||
extern int HouseNr(HOUSES * h, CSEC p);
|
||||
/*
|
||||
return in which house pp is,
|
||||
The caller is responsible for proper initialization of cusps
|
||||
*/
|
||||
* return in which house pp is,
|
||||
* The caller is responsible for proper initialization of cusps
|
||||
*/
|
||||
|
||||
extern int InpHouseNr(HOUSES *h, CSEC p, CSEC *cuspoff);
|
||||
extern int InpHouseNr(HOUSES * h, CSEC p, CSEC * cuspoff);
|
||||
/* returns the interpretation-house number, where pp is in;
|
||||
* an interpretation house is defined differently from a normal
|
||||
* house: the cusps are offset, so that it begins and ends
|
||||
* a little earlier.
|
||||
* cusp[1..12] and cuspoff[1..12] must be initialized
|
||||
*/
|
||||
extern int InpHouseNr2(HOUSES *h, CSEC p, CSEC *cuspoff);
|
||||
extern int InpHouseNr2(HOUSES * h, CSEC p, CSEC * cuspoff);
|
||||
/* variation of InpHouseNr(). Comment in swepcalc.c */
|
||||
|
||||
extern void CalcHouses(CSEC th, CSEC fi, CSEC ekl, char hsy, int icnt,
|
||||
struct houses *h);
|
||||
struct houses *h);
|
||||
|
||||
extern void RecalcAspects(struct AspectType *a);
|
||||
|
||||
extern void longreorder (UCHAR *p, int n);
|
||||
extern void longreorder(UCHAR * p, int n);
|
||||
|
||||
|
||||
#endif /* _SWEPCALC_INCLUDED */
|
||||
|
@ -1,9 +1,11 @@
|
||||
|
||||
/*****************************************************
|
||||
$Header: swepdate.c,v 1.65 2003/06/14 13:02:01 alois Exp $
|
||||
Placalc compatibility interface for Swiss Ephemeris.
|
||||
date functions
|
||||
|
||||
*******************************************************/
|
||||
|
||||
/* Copyright (C) 1997 - 2008 Astrodienst AG, Switzerland. All rights reserved.
|
||||
|
||||
License conditions
|
||||
@ -129,28 +131,32 @@ date functions
|
||||
and notifies errors like 32 January.
|
||||
****************************************************************/
|
||||
|
||||
double julday(int month, int day, int year, double hour, int gregflag)
|
||||
double
|
||||
julday(int month, int day, int year, double hour, int gregflag)
|
||||
{
|
||||
double jd;
|
||||
jd = swe_julday(year, month, day, hour, gregflag);
|
||||
return jd;
|
||||
double jd;
|
||||
jd = swe_julday(year, month, day, hour, gregflag);
|
||||
return jd;
|
||||
}
|
||||
|
||||
/*
|
||||
* monday = 0, ... sunday = 6
|
||||
*/
|
||||
int day_of_week(double jd)
|
||||
int
|
||||
day_of_week(double jd)
|
||||
{
|
||||
return (((int) floor (jd - 2433282 - 1.5) %7) + 7) % 7;
|
||||
return (((int)floor(jd - 2433282 - 1.5) % 7) + 7) % 7;
|
||||
}
|
||||
|
||||
/*************** julday ******************
|
||||
get absolute julian day number (author: Marc Pottenger)
|
||||
with bug fix for year < -4711 15-aug-88
|
||||
*/
|
||||
double juldays(int gregflag, ADATE *adp )
|
||||
double
|
||||
juldays(int gregflag, ADATE * adp)
|
||||
{
|
||||
return swe_julday(adp->year, adp->month, adp->day, adp->csec / 360000.0, gregflag);
|
||||
return swe_julday(adp->year, adp->month, adp->day, adp->csec / 360000.0,
|
||||
gregflag);
|
||||
}
|
||||
|
||||
/*** revjul ******************************************************
|
||||
@ -172,10 +178,10 @@ double juldays(int gregflag, ADATE *adp )
|
||||
Original author Mark Pottenger, Los Angeles.
|
||||
with bug fix for year < -4711 16-aug-88 Alois Treindl
|
||||
*************************************************************************/
|
||||
void revjul (double jd, int gregflag,
|
||||
int *jmon, int *jday, int *jyear, double *jut)
|
||||
void
|
||||
revjul(double jd, int gregflag, int *jmon, int *jday, int *jyear, double *jut)
|
||||
{
|
||||
swe_revjul(jd, gregflag, jyear, jmon, jday, jut);
|
||||
swe_revjul(jd, gregflag, jyear, jmon, jday, jut);
|
||||
}
|
||||
|
||||
/************************************* revjul *********
|
||||
@ -183,11 +189,12 @@ void revjul (double jd, int gregflag,
|
||||
with bug fix for year < -4711 16-aug-88
|
||||
arguments are julian day #, calendar flag (0=julian, 1=gregorian)
|
||||
*/
|
||||
void revjuls(double jd, int gregflag, struct adate *adp)
|
||||
void
|
||||
revjuls(double jd, int gregflag, struct adate *adp)
|
||||
{
|
||||
double jut;
|
||||
swe_revjul(jd, gregflag, &adp->year, &adp->month, &adp->day, &jut);
|
||||
adp->csec = jut * 360000.0 + 0.5;
|
||||
double jut;
|
||||
swe_revjul(jd, gregflag, &adp->year, &adp->month, &adp->day, &jut);
|
||||
adp->csec = jut * 360000.0 + 0.5;
|
||||
}
|
||||
|
||||
/*********************************************************
|
||||
@ -215,28 +222,28 @@ void revjuls(double jd, int gregflag, struct adate *adp)
|
||||
Return: OK or ERR (for illegal date)
|
||||
*********************************************************/
|
||||
|
||||
int date_conversion (int d ,
|
||||
int m ,
|
||||
int y , /* day, month, year */
|
||||
centisec gutime, /* greenwich time in centiseconds */
|
||||
char c, /* calendar g[regorian]|j[ulian]|a[stro = greg] */
|
||||
double *tgmt
|
||||
/* julian date relative 0.Jan.1950 12:00 gmt */
|
||||
/* shift is 2433282 from absolute Julian date */
|
||||
)
|
||||
{
|
||||
int rday, rmon, ryear;
|
||||
double rut, jd;
|
||||
int gregflag = SE_JUL_CAL;
|
||||
if (c == 'g' || c == 'a')
|
||||
gregflag = SE_GREG_CAL;
|
||||
rut = gutime / 360000.0; /* hours GMT */
|
||||
jd = julday(m, d, y, rut, gregflag);
|
||||
revjul(jd, gregflag, &rmon, &rday, &ryear, &rut);
|
||||
*tgmt = jd - JUL_OFFSET;
|
||||
if (rmon == m && rday == d && ryear == y) {
|
||||
return OK;
|
||||
} else {
|
||||
return ERR;
|
||||
}
|
||||
} /* end date_conversion */
|
||||
int
|
||||
date_conversion(int d, int m, int y, /* day, month, year */
|
||||
centisec gutime, /* greenwich time in centiseconds */
|
||||
char c, /* calendar g[regorian]|j[ulian]|a[stro = greg] */
|
||||
double *tgmt
|
||||
/* julian date relative 0.Jan.1950 12:00 gmt */
|
||||
/* shift is 2433282 from absolute Julian date */
|
||||
)
|
||||
{
|
||||
int rday, rmon, ryear;
|
||||
double rut, jd;
|
||||
int gregflag = SE_JUL_CAL;
|
||||
if (c == 'g' || c == 'a')
|
||||
gregflag = SE_GREG_CAL;
|
||||
rut = gutime / 360000.0; /* hours GMT */
|
||||
jd = julday(m, d, y, rut, gregflag);
|
||||
revjul(jd, gregflag, &rmon, &rday, &ryear, &rut);
|
||||
*tgmt = jd - JUL_OFFSET;
|
||||
if (rmon == m && rday == d && ryear == y) {
|
||||
return OK;
|
||||
}
|
||||
else {
|
||||
return ERR;
|
||||
}
|
||||
} /* end date_conversion */
|
||||
|
10965
swe/src/sweph.c
10965
swe/src/sweph.c
File diff suppressed because it is too large
Load Diff
546
swe/src/sweph.h
546
swe/src/sweph.h
@ -5,6 +5,7 @@
|
||||
Authors: Dieter Koch and Alois Treindl, Astrodienst Zurich
|
||||
|
||||
************************************************************/
|
||||
|
||||
/* Copyright (C) 1997 - 2008 Astrodienst AG, Switzerland. All rights reserved.
|
||||
|
||||
License conditions
|
||||
@ -65,9 +66,9 @@
|
||||
|
||||
#define SE_VERSION "1.79.00"
|
||||
|
||||
#define J2000 2451545.0 /* 2000 January 1.5 */
|
||||
#define B1950 2433282.42345905 /* 1950 January 0.923 */
|
||||
#define J1900 2415020.0 /* 1900 January 0.5 */
|
||||
#define J2000 2451545.0 /* 2000 January 1.5 */
|
||||
#define B1950 2433282.42345905 /* 1950 January 0.923 */
|
||||
#define J1900 2415020.0 /* 1900 January 0.5 */
|
||||
|
||||
#define MPC_CERES 1
|
||||
#define MPC_PALLAS 2
|
||||
@ -100,7 +101,7 @@
|
||||
#define SE_NAME_CHIRON "Chiron"
|
||||
#define SE_NAME_PHOLUS "Pholus"
|
||||
|
||||
|
||||
|
||||
#define SE_NAME_CUPIDO "Cupido"
|
||||
#define SE_NAME_HADES "Hades"
|
||||
#define SE_NAME_ZEUS "Zeus"
|
||||
@ -124,10 +125,10 @@
|
||||
* by Chapront/Chapront-Touzé/Francou A&A 387 (2002), p. 705.
|
||||
*/
|
||||
#define SE_TIDAL_DE200 (-23.8946)
|
||||
#define SE_TIDAL_DE403 (-25.580) /* was (-25.8) until V. 1.76.2 */
|
||||
#define SE_TIDAL_DE404 (-25.580) /* was (-25.8) until V. 1.76.2 */
|
||||
#define SE_TIDAL_DE405 (-25.826) /* was (-25.7376) until V. 1.76.2 */
|
||||
#define SE_TIDAL_DE406 (-25.826) /* was (-25.7376) until V. 1.76.2 */
|
||||
#define SE_TIDAL_DE403 (-25.580) /* was (-25.8) until V. 1.76.2 */
|
||||
#define SE_TIDAL_DE404 (-25.580) /* was (-25.8) until V. 1.76.2 */
|
||||
#define SE_TIDAL_DE405 (-25.826) /* was (-25.7376) until V. 1.76.2 */
|
||||
#define SE_TIDAL_DE406 (-25.826) /* was (-25.7376) until V. 1.76.2 */
|
||||
|
||||
#define SE_TIDAL_26 (-26.0)
|
||||
|
||||
@ -137,33 +138,33 @@
|
||||
* earlier content
|
||||
*/
|
||||
|
||||
#define PI M_PI /* 3.14159265358979323846, math.h */
|
||||
#define PI M_PI /* 3.14159265358979323846, math.h */
|
||||
#define TWOPI (2.0 * PI)
|
||||
|
||||
#define ENDMARK -99
|
||||
|
||||
#define SEI_EPSILON -2
|
||||
#define SEI_NUTATION -1
|
||||
#define SEI_EMB 0
|
||||
#define SEI_EARTH 0
|
||||
#define SEI_SUN 0
|
||||
#define SEI_MOON 1
|
||||
#define SEI_MERCURY 2
|
||||
#define SEI_VENUS 3
|
||||
#define SEI_MARS 4
|
||||
#define SEI_JUPITER 5
|
||||
#define SEI_SATURN 6
|
||||
#define SEI_URANUS 7
|
||||
#define SEI_NEPTUNE 8
|
||||
#define SEI_PLUTO 9
|
||||
#define SEI_SUNBARY 10 /* barycentric sun */
|
||||
#define SEI_ANYBODY 11 /* any asteroid */
|
||||
#define SEI_CHIRON 12
|
||||
#define SEI_PHOLUS 13
|
||||
#define SEI_CERES 14
|
||||
#define SEI_PALLAS 15
|
||||
#define SEI_JUNO 16
|
||||
#define SEI_VESTA 17
|
||||
#define SEI_EMB 0
|
||||
#define SEI_EARTH 0
|
||||
#define SEI_SUN 0
|
||||
#define SEI_MOON 1
|
||||
#define SEI_MERCURY 2
|
||||
#define SEI_VENUS 3
|
||||
#define SEI_MARS 4
|
||||
#define SEI_JUPITER 5
|
||||
#define SEI_SATURN 6
|
||||
#define SEI_URANUS 7
|
||||
#define SEI_NEPTUNE 8
|
||||
#define SEI_PLUTO 9
|
||||
#define SEI_SUNBARY 10 /* barycentric sun */
|
||||
#define SEI_ANYBODY 11 /* any asteroid */
|
||||
#define SEI_CHIRON 12
|
||||
#define SEI_PHOLUS 13
|
||||
#define SEI_CERES 14
|
||||
#define SEI_PALLAS 15
|
||||
#define SEI_JUNO 16
|
||||
#define SEI_VESTA 17
|
||||
|
||||
#define SEI_NPLANETS 18
|
||||
|
||||
@ -179,21 +180,21 @@
|
||||
#define SEI_FLG_HELIO 1
|
||||
#define SEI_FLG_ROTATE 2
|
||||
#define SEI_FLG_ELLIPSE 4
|
||||
#define SEI_FLG_EMBHEL 8 /* TRUE, if heliocentric earth is given
|
||||
* instead of barycentric sun
|
||||
* i.e. bary sun is computed from
|
||||
* barycentric and heliocentric earth */
|
||||
#define SEI_FLG_EMBHEL 8 /* TRUE, if heliocentric earth is given
|
||||
* instead of barycentric sun
|
||||
* i.e. bary sun is computed from
|
||||
* barycentric and heliocentric earth */
|
||||
|
||||
#define SEI_FILE_PLANET 0
|
||||
#define SEI_FILE_MOON 1
|
||||
#define SEI_FILE_MOON 1
|
||||
#define SEI_FILE_MAIN_AST 2
|
||||
#define SEI_FILE_ANY_AST 3
|
||||
#define SEI_FILE_FIXSTAR 4
|
||||
|
||||
#if 0
|
||||
#define SEI_FILE_TEST_ENDIAN (97L * 65536L + 98L * 256L + 99L) /*abc*/
|
||||
#define SEI_FILE_TEST_ENDIAN (97L * 65536L + 98L * 256L + 99L) /*abc */
|
||||
#endif
|
||||
#define SEI_FILE_TEST_ENDIAN (0x616263L) /* abc*/
|
||||
#define SEI_FILE_TEST_ENDIAN (0x616263L) /* abc */
|
||||
#define SEI_FILE_BIGENDIAN 0
|
||||
#define SEI_FILE_NOREORD 0
|
||||
#define SEI_FILE_LITENDIAN 1
|
||||
@ -212,31 +213,32 @@
|
||||
* with Saturn. Accepting a maximum error of 5 degrees,
|
||||
* the ephemeris is good between the following dates:
|
||||
*/
|
||||
#define CHIRON_START 1958470.5 /* 1.1.650 */
|
||||
#define CHIRON_END 3419437.5 /* 1.1.4650 */
|
||||
#define CHIRON_START 1958470.5 /* 1.1.650 */
|
||||
#define CHIRON_END 3419437.5 /* 1.1.4650 */
|
||||
|
||||
/* Pholus's orbit is unstable as well, because he sometimes
|
||||
* approaches Saturn.
|
||||
* Accepting a maximum error of 5 degrees,
|
||||
* the ephemeris is good after the following date:
|
||||
*/
|
||||
#define PHOLUS_START 314845.5 /* 1.1.-3850 */
|
||||
#define PHOLUS_START 314845.5 /* 1.1.-3850 */
|
||||
|
||||
#define MOSHPLEPH_START 625000.5
|
||||
#define MOSHPLEPH_END 2818000.5
|
||||
#define MOSHLUEPH_START 625000.5
|
||||
#define MOSHLUEPH_END 2818000.5
|
||||
#define MOSHNDEPH_START -254900.5 /* 14 Feb -5410 00:00 ET jul.cal.*/
|
||||
#define MOSHNDEPH_END 3697000.5 /* 11 Dec 5409 00:00 ET, greg. cal */
|
||||
#define MOSHNDEPH_START -254900.5 /* 14 Feb -5410 00:00 ET jul.cal. */
|
||||
#define MOSHNDEPH_END 3697000.5 /* 11 Dec 5409 00:00 ET, greg. cal */
|
||||
|
||||
/*
|
||||
#define MOSHPLEPH_START -225000.5
|
||||
#define MOSHPLEPH_END 3600000.5
|
||||
#define MOSHLUEPH_START -225000.5
|
||||
#define MOSHLUEPH_END 3600000.5
|
||||
*/
|
||||
#if FALSE /* Alois commented out, not used anywhere */
|
||||
#define JPLEPH_START 625307.5 /* about -3000 (DE406) */
|
||||
#define JPLEPH_END 2816848.5 /* about 3000 (DE406) */
|
||||
#if FALSE /* Alois commented out, not used anywhere */
|
||||
#define JPLEPH_START 625307.5 /* about -3000 (DE406) */
|
||||
#define JPLEPH_END 2816848.5 /* about 3000 (DE406) */
|
||||
#define SWIEPH_START 625614.927151
|
||||
#define SWIEPH_END 2813641.5
|
||||
#define ALLEPH_START MOSHPLEPH_START
|
||||
@ -247,7 +249,7 @@
|
||||
|
||||
#define MAXORD 40
|
||||
|
||||
#define NCTIES 6.0 /* number of centuries per eph. file */
|
||||
#define NCTIES 6.0 /* number of centuries per eph. file */
|
||||
|
||||
#define OK (0)
|
||||
#define ERR (-1)
|
||||
@ -258,48 +260,52 @@
|
||||
#define J2000_TO_J -1
|
||||
|
||||
/* we always use Astronomical Almanac constants, if available */
|
||||
#define MOON_MEAN_DIST 384400000.0 /* in m, AA 1996, F2 */
|
||||
#define MOON_MEAN_INCL 5.1453964 /* AA 1996, D2 */
|
||||
#define MOON_MEAN_ECC 0.054900489 /* AA 1996, F2 */
|
||||
/* #define SUN_EARTH_MRAT 328900.561400 Su/(Ea+Mo) AA 2006 K7 */
|
||||
#define SUN_EARTH_MRAT 332946.050895 /* Su / (Ea only) AA 2006 K7 */
|
||||
#define EARTH_MOON_MRAT (1 / 0.0123000383) /* AA 2006, K7 */
|
||||
#if 0
|
||||
#define EARTH_MOON_MRAT 81.30056 /* de406 */
|
||||
#endif
|
||||
#define AUNIT 1.49597870691e+11 /* au in meters, AA 2006 K6 */
|
||||
#define CLIGHT 2.99792458e+8 /* m/s, AA 1996 K6 */
|
||||
#if 0
|
||||
#define HELGRAVCONST 1.32712438e+20 /* G * M(sun), m^3/sec^2, AA 1996 K6 */
|
||||
#endif
|
||||
#define HELGRAVCONST 1.32712440017987e+20 /* G * M(sun), m^3/sec^2, AA 2006 K6 */
|
||||
#define GEOGCONST 3.98600448e+14 /* G * M(earth) m^3/sec^2, AA 1996 K6 */
|
||||
#define KGAUSS 0.01720209895 /* Gaussian gravitational constant K6 */
|
||||
#define SUN_RADIUS (959.63 / 3600 * DEGTORAD) /* Meeus germ. p 391 */
|
||||
#define EARTH_RADIUS 6378136.6 /* AA 2006 K6 */
|
||||
/*#define EARTH_OBLATENESS (1.0/ 298.257223563) * AA 1998 K13 */
|
||||
#define EARTH_OBLATENESS (1.0/ 298.25642) /* AA 2006 K6 */
|
||||
#define EARTH_ROT_SPEED (7.2921151467e-5 * 86400) /* in rad/day, expl. suppl., p 162 */
|
||||
#define MOON_MEAN_DIST 384400000.0 /* in m, AA 1996, F2 */
|
||||
#define MOON_MEAN_INCL 5.1453964 /* AA 1996, D2 */
|
||||
#define MOON_MEAN_ECC 0.054900489 /* AA 1996, F2 */
|
||||
|
||||
#define LIGHTTIME_AUNIT (499.0047838061/3600/24) /* 8.3167 minutes (days), AA 2006 K6 */
|
||||
/* #define SUN_EARTH_MRAT 328900.561400 Su/(Ea+Mo) AA 2006 K7 */
|
||||
#define SUN_EARTH_MRAT 332946.050895 /* Su / (Ea only) AA 2006 K7 */
|
||||
#define EARTH_MOON_MRAT (1 / 0.0123000383) /* AA 2006, K7 */
|
||||
#if 0
|
||||
#define EARTH_MOON_MRAT 81.30056 /* de406 */
|
||||
#endif
|
||||
#define AUNIT 1.49597870691e+11 /* au in meters, AA 2006 K6 */
|
||||
#define CLIGHT 2.99792458e+8 /* m/s, AA 1996 K6 */
|
||||
#if 0
|
||||
#define HELGRAVCONST 1.32712438e+20 /* G * M(sun), m^3/sec^2, AA 1996 K6 */
|
||||
#endif
|
||||
#define HELGRAVCONST 1.32712440017987e+20 /* G * M(sun), m^3/sec^2, AA 2006 K6 */
|
||||
#define GEOGCONST 3.98600448e+14 /* G * M(earth) m^3/sec^2, AA 1996 K6 */
|
||||
#define KGAUSS 0.01720209895 /* Gaussian gravitational constant K6 */
|
||||
#define SUN_RADIUS (959.63 / 3600 * DEGTORAD) /* Meeus germ. p 391 */
|
||||
#define EARTH_RADIUS 6378136.6 /* AA 2006 K6 */
|
||||
|
||||
/*#define EARTH_OBLATENESS (1.0/ 298.257223563) * AA 1998 K13 */
|
||||
#define EARTH_OBLATENESS (1.0/ 298.25642) /* AA 2006 K6 */
|
||||
#define EARTH_ROT_SPEED (7.2921151467e-5 * 86400) /* in rad/day, expl. suppl., p 162 */
|
||||
|
||||
#define LIGHTTIME_AUNIT (499.0047838061/3600/24) /* 8.3167 minutes (days), AA 2006 K6 */
|
||||
|
||||
/* node of ecliptic measured on ecliptic 2000 */
|
||||
#define SSY_PLANE_NODE_E2000 (107.582569 * DEGTORAD)
|
||||
|
||||
/* node of ecliptic measured on solar system rotation plane */
|
||||
#define SSY_PLANE_NODE (107.58883388 * DEGTORAD)
|
||||
|
||||
/* inclination of ecliptic against solar system rotation plane */
|
||||
#define SSY_PLANE_INCL (1.578701 * DEGTORAD)
|
||||
|
||||
#define KM_S_TO_AU_CTY 21.095 /* km/s to AU/century */
|
||||
#define MOON_SPEED_INTV 0.00005 /* 4.32 seconds (in days) */
|
||||
#define PLAN_SPEED_INTV 0.0001 /* 8.64 seconds (in days) */
|
||||
#define MEAN_NODE_SPEED_INTV 0.001
|
||||
#define NODE_CALC_INTV 0.0001
|
||||
#define NODE_CALC_INTV_MOSH 0.1
|
||||
#define KM_S_TO_AU_CTY 21.095 /* km/s to AU/century */
|
||||
#define MOON_SPEED_INTV 0.00005 /* 4.32 seconds (in days) */
|
||||
#define PLAN_SPEED_INTV 0.0001 /* 8.64 seconds (in days) */
|
||||
#define MEAN_NODE_SPEED_INTV 0.001
|
||||
#define NODE_CALC_INTV 0.0001
|
||||
#define NODE_CALC_INTV_MOSH 0.1
|
||||
#define NUT_SPEED_INTV 0.0001
|
||||
#define DEFL_SPEED_INTV 0.0000005
|
||||
|
||||
#define SE_LAPSE_RATE 0.0065 /* deg K / m, for refraction */
|
||||
#define SE_LAPSE_RATE 0.0065 /* deg K / m, for refraction */
|
||||
|
||||
#define square_sum(x) (x[0]*x[0]+x[1]*x[1]+x[2]*x[2])
|
||||
#define dot_prod(x,y) (x[0]*y[0]+x[1]*y[1]+x[2]*y[2])
|
||||
@ -308,25 +314,25 @@
|
||||
|
||||
/* planetary radii in meters */
|
||||
#define NDIAM (SE_VESTA + 1)
|
||||
static const double pla_diam[NDIAM] = {1392000000.0, /* Sun */
|
||||
3476300.0, /* Moon */
|
||||
2439000.0 * 2, /* Mercury */
|
||||
6052000.0 * 2, /* Venus */
|
||||
3397200.0 * 2, /* Mars */
|
||||
71398000.0 * 2, /* Jupiter */
|
||||
60000000.0 * 2, /* Saturn */
|
||||
25400000.0 * 2, /* Uranus */
|
||||
24300000.0 * 2, /* Neptune */
|
||||
2500000.0 * 2, /* Pluto */
|
||||
0, 0, 0, 0, /* nodes and apogees */
|
||||
6378140.0 * 2, /* Earth */
|
||||
0.0, /* Chiron */
|
||||
0.0, /* Pholus */
|
||||
913000.0, /* Ceres */
|
||||
523000.0, /* Pallas */
|
||||
244000.0, /* Juno */
|
||||
501000.0, /* Vesta */
|
||||
};
|
||||
static const double pla_diam[NDIAM] = { 1392000000.0, /* Sun */
|
||||
3476300.0, /* Moon */
|
||||
2439000.0 * 2, /* Mercury */
|
||||
6052000.0 * 2, /* Venus */
|
||||
3397200.0 * 2, /* Mars */
|
||||
71398000.0 * 2, /* Jupiter */
|
||||
60000000.0 * 2, /* Saturn */
|
||||
25400000.0 * 2, /* Uranus */
|
||||
24300000.0 * 2, /* Neptune */
|
||||
2500000.0 * 2, /* Pluto */
|
||||
0, 0, 0, 0, /* nodes and apogees */
|
||||
6378140.0 * 2, /* Earth */
|
||||
0.0, /* Chiron */
|
||||
0.0, /* Pholus */
|
||||
913000.0, /* Ceres */
|
||||
523000.0, /* Pallas */
|
||||
244000.0, /* Juno */
|
||||
501000.0, /* Vesta */
|
||||
};
|
||||
|
||||
|
||||
/* Ayanamsas
|
||||
@ -334,13 +340,16 @@ static const double pla_diam[NDIAM] = {1392000000.0, /* Sun */
|
||||
* t0 epoch of ayanamsa, TDT (ET)
|
||||
* ayan_t0 ayanamsa value at epoch
|
||||
*/
|
||||
struct aya_init {double t0, ayan_t0;};
|
||||
struct aya_init
|
||||
{
|
||||
double t0, ayan_t0;
|
||||
};
|
||||
static const struct aya_init ayanamsa[] = {
|
||||
{2433282.5, 24.042044444}, /* 0: Fagan/Bradley (Default) */
|
||||
{2433282.5, 24.042044444}, /* 0: Fagan/Bradley (Default) */
|
||||
/*{J1900, 360 - 337.53953}, * 1: Lahiri (Robert Hand) */
|
||||
{2435553.5, 23.250182778 - 0.004660222}, /* 1: Lahiri (derived from:
|
||||
* Indian Astronomical Ephemeris 1989, p. 556;
|
||||
* the subtracted value is nutation) */
|
||||
{2435553.5, 23.250182778 - 0.004660222}, /* 1: Lahiri (derived from:
|
||||
* Indian Astronomical Ephemeris 1989, p. 556;
|
||||
* the subtracted value is nutation) */
|
||||
{J1900, 360 - 333.58695}, /* 2: De Luce (Robert Hand) */
|
||||
{J1900, 360 - 338.98556}, /* 3: Raman (Robert Hand) */
|
||||
{J1900, 360 - 341.33904}, /* 4: Ushashashi (Robert Hand) */
|
||||
@ -360,32 +369,33 @@ static const struct aya_init ayanamsa[] = {
|
||||
{1927135.8747793, 0}, /*16: Sassanian */
|
||||
/*{1746443.513, 0}, *17: Galactic Center at 0 Sagittarius */
|
||||
{1746447.518, 0}, /*17: Galactic Center at 0 Sagittarius */
|
||||
{J2000, 0}, /*18: J2000 */
|
||||
{J1900, 0}, /*19: J1900 */
|
||||
{B1950, 0}, /*20: B1950 */
|
||||
{1903396.8128654, 0}, /*21: Suryasiddhanta, assuming
|
||||
ingress of mean Sun into Aries at point
|
||||
of mean equinox of date on
|
||||
21.3.499, noon, Ujjain (75.7684565 E)
|
||||
= 7:30:31.57 UT */
|
||||
{1903396.8128654,-0.21463395},/*22: Suryasiddhanta, assuming
|
||||
ingress of mean Sun into Aries at
|
||||
true position of mean Sun at same epoch */
|
||||
{1903396.7895321, 0}, /*23: Aryabhata, same date, but UT 6:56:55.57
|
||||
analogous 21 */
|
||||
{1903396.7895321,-0.23763238},/*24: Aryabhata, analogous 22 */
|
||||
{J2000, 0}, /*18: J2000 */
|
||||
{J1900, 0}, /*19: J1900 */
|
||||
{B1950, 0}, /*20: B1950 */
|
||||
{1903396.8128654, 0}, /*21: Suryasiddhanta, assuming
|
||||
* ingress of mean Sun into Aries at point
|
||||
* of mean equinox of date on
|
||||
* 21.3.499, noon, Ujjain (75.7684565 E)
|
||||
* = 7:30:31.57 UT */
|
||||
{1903396.8128654, -0.21463395}, /*22: Suryasiddhanta, assuming
|
||||
* ingress of mean Sun into Aries at
|
||||
* true position of mean Sun at same epoch */
|
||||
{1903396.7895321, 0}, /*23: Aryabhata, same date, but UT 6:56:55.57
|
||||
* analogous 21 */
|
||||
{1903396.7895321, -0.23763238}, /*24: Aryabhata, analogous 22 */
|
||||
{0, 0}, /*25: - */
|
||||
{0, 0}, /*26: - */
|
||||
{0, 0}, /*27: - */
|
||||
{0, 0}, /*28: - */
|
||||
{0, 0}, /*29: - */
|
||||
};
|
||||
{0, 0}, /*27: - */
|
||||
{0, 0}, /*28: - */
|
||||
{0, 0}, /*29: - */
|
||||
};
|
||||
|
||||
#define PLAN_DATA struct plan_data
|
||||
|
||||
/* obliquity of ecliptic */
|
||||
struct epsilon {
|
||||
double teps, eps, seps, ceps; /* jd, eps, sin(eps), cos(eps) */
|
||||
struct epsilon
|
||||
{
|
||||
double teps, eps, seps, ceps; /* jd, eps, sin(eps), cos(eps) */
|
||||
};
|
||||
|
||||
/*
|
||||
@ -393,52 +403,53 @@ extern struct epsilon oec2000;
|
||||
extern struct epsilon oec;
|
||||
*/
|
||||
|
||||
struct plan_data {
|
||||
/* the following data are read from file only once, immediately after
|
||||
* file has been opened */
|
||||
int ibdy; /* internal body number */
|
||||
int32 iflg; /* contains several bit flags describing the data:
|
||||
* SEI_FLG_HELIO: true if helio, false if bary
|
||||
* SEI_FLG_ROTATE: TRUE if coefficients are referred
|
||||
* to coordinate system of orbital plane
|
||||
* SEI_FLG_ELLIPSE: TRUE if reference ellipse */
|
||||
int ncoe; /* # of coefficients of ephemeris polynomial,
|
||||
is polynomial order + 1 */
|
||||
/* where is the segment index on the file */
|
||||
int32 lndx0; /* file position of begin of planet's index */
|
||||
int32 nndx; /* number of index entries on file: computed */
|
||||
double tfstart; /* file contains ephemeris for tfstart thru tfend */
|
||||
double tfend; /* for this particular planet !!! */
|
||||
double dseg; /* segment size (days covered by a polynomial) */
|
||||
/* orbital elements: */
|
||||
double telem; /* epoch of elements */
|
||||
double prot;
|
||||
double qrot;
|
||||
double dprot;
|
||||
double dqrot;
|
||||
double rmax; /* normalisation factor of cheby coefficients */
|
||||
/* in addition, if reference ellipse is used: */
|
||||
double peri;
|
||||
double dperi;
|
||||
double *refep; /* pointer to cheby coeffs of reference ellipse,
|
||||
* size of data is 2 x ncoe */
|
||||
/* unpacked segment information, only updated when a segment is read: */
|
||||
double tseg0, tseg1; /* start and end jd of current segment */
|
||||
double *segp; /* pointer to unpacked cheby coeffs of segment;
|
||||
* the size is 3 x ncoe */
|
||||
int neval; /* how many coefficients to evaluate. this may
|
||||
* be less than ncoe */
|
||||
/* result of most recent data evaluation for this body: */
|
||||
double teval; /* time for which previous computation was made */
|
||||
int32 iephe; /* which ephemeris was used */
|
||||
double x[6]; /* position and speed vectors equatorial J2000 */
|
||||
int32 xflgs; /* hel., light-time, aberr., prec. flags etc. */
|
||||
double xreturn[24]; /* return positions:
|
||||
* xreturn+0 ecliptic polar coordinates
|
||||
* xreturn+6 ecliptic cartesian coordinates
|
||||
* xreturn+12 equatorial polar coordinates
|
||||
* xreturn+18 equatorial cartesian coordinates
|
||||
*/
|
||||
struct plan_data
|
||||
{
|
||||
/* the following data are read from file only once, immediately after
|
||||
* file has been opened */
|
||||
int ibdy; /* internal body number */
|
||||
int32 iflg; /* contains several bit flags describing the data:
|
||||
* SEI_FLG_HELIO: true if helio, false if bary
|
||||
* SEI_FLG_ROTATE: TRUE if coefficients are referred
|
||||
* to coordinate system of orbital plane
|
||||
* SEI_FLG_ELLIPSE: TRUE if reference ellipse */
|
||||
int ncoe; /* # of coefficients of ephemeris polynomial,
|
||||
* is polynomial order + 1 */
|
||||
/* where is the segment index on the file */
|
||||
int32 lndx0; /* file position of begin of planet's index */
|
||||
int32 nndx; /* number of index entries on file: computed */
|
||||
double tfstart; /* file contains ephemeris for tfstart thru tfend */
|
||||
double tfend; /* for this particular planet !!! */
|
||||
double dseg; /* segment size (days covered by a polynomial) */
|
||||
/* orbital elements: */
|
||||
double telem; /* epoch of elements */
|
||||
double prot;
|
||||
double qrot;
|
||||
double dprot;
|
||||
double dqrot;
|
||||
double rmax; /* normalisation factor of cheby coefficients */
|
||||
/* in addition, if reference ellipse is used: */
|
||||
double peri;
|
||||
double dperi;
|
||||
double *refep; /* pointer to cheby coeffs of reference ellipse,
|
||||
* size of data is 2 x ncoe */
|
||||
/* unpacked segment information, only updated when a segment is read: */
|
||||
double tseg0, tseg1; /* start and end jd of current segment */
|
||||
double *segp; /* pointer to unpacked cheby coeffs of segment;
|
||||
* the size is 3 x ncoe */
|
||||
int neval; /* how many coefficients to evaluate. this may
|
||||
* be less than ncoe */
|
||||
/* result of most recent data evaluation for this body: */
|
||||
double teval; /* time for which previous computation was made */
|
||||
int32 iephe; /* which ephemeris was used */
|
||||
double x[6]; /* position and speed vectors equatorial J2000 */
|
||||
int32 xflgs; /* hel., light-time, aberr., prec. flags etc. */
|
||||
double xreturn[24]; /* return positions:
|
||||
* xreturn+0 ecliptic polar coordinates
|
||||
* xreturn+6 ecliptic cartesian coordinates
|
||||
* xreturn+12 equatorial polar coordinates
|
||||
* xreturn+18 equatorial cartesian coordinates
|
||||
*/
|
||||
};
|
||||
|
||||
/*
|
||||
@ -446,134 +457,141 @@ struct plan_data {
|
||||
* and constants used inside these functions.
|
||||
************************************************************/
|
||||
|
||||
#define STR 4.8481368110953599359e-6 /* radians per arc second */
|
||||
#define STR 4.8481368110953599359e-6 /* radians per arc second */
|
||||
|
||||
/* moon, s. moshmoon.c */
|
||||
extern int swi_mean_node(double jd, double *x, char *serr);
|
||||
extern int swi_mean_apog(double jd, double *x, char *serr);
|
||||
extern int swi_moshmoon(double tjd, AS_BOOL do_save, double *xpm, char *serr) ;
|
||||
extern int swi_moshmoon(double tjd, AS_BOOL do_save, double *xpm, char *serr);
|
||||
extern int swi_moshmoon2(double jd, double *x);
|
||||
extern int swi_intp_apsides(double J, double *pol, int ipli);
|
||||
|
||||
/* planets, s. moshplan.c */
|
||||
extern int swi_moshplan(double tjd, int ipli, AS_BOOL do_save, double *xpret, double *xeret, char *serr);
|
||||
extern int swi_moshplan(double tjd, int ipli, AS_BOOL do_save, double *xpret,
|
||||
double *xeret, char *serr);
|
||||
extern int swi_moshplan2(double J, int iplm, double *pobj);
|
||||
extern int swi_osc_el_plan(double tjd, double *xp, int ipl, int ipli, double *xearth, double *xsun, char *serr);
|
||||
extern int swi_osc_el_plan(double tjd, double *xp, int ipl, int ipli,
|
||||
double *xearth, double *xsun, char *serr);
|
||||
extern FILE *swi_fopen(int ifno, char *fname, char *ephepath, char *serr);
|
||||
|
||||
/* nutation */
|
||||
struct nut {
|
||||
double tnut;
|
||||
double nutlo[2]; /* nutation in longitude and obliquity */
|
||||
double snut, cnut; /* sine and cosine of nutation in obliquity */
|
||||
double matrix[3][3];
|
||||
struct nut
|
||||
{
|
||||
double tnut;
|
||||
double nutlo[2]; /* nutation in longitude and obliquity */
|
||||
double snut, cnut; /* sine and cosine of nutation in obliquity */
|
||||
double matrix[3][3];
|
||||
};
|
||||
|
||||
struct plantbl {
|
||||
char max_harmonic[9];
|
||||
char max_power_of_t;
|
||||
signed char *arg_tbl;
|
||||
double *lon_tbl;
|
||||
double *lat_tbl;
|
||||
double *rad_tbl;
|
||||
double distance;
|
||||
struct plantbl
|
||||
{
|
||||
char max_harmonic[9];
|
||||
char max_power_of_t;
|
||||
signed char *arg_tbl;
|
||||
double *lon_tbl;
|
||||
double *lat_tbl;
|
||||
double *rad_tbl;
|
||||
double distance;
|
||||
};
|
||||
|
||||
struct file_data {
|
||||
char fnam[AS_MAXCH]; /* ephemeris file name */
|
||||
int fversion; /* version number of file */
|
||||
char astnam[50]; /* asteroid name, if asteroid file */
|
||||
int32 sweph_denum; /* DE number of JPL ephemeris, which this file
|
||||
* is derived from. */
|
||||
FILE *fptr; /* ephemeris file pointer */
|
||||
double tfstart; /* file may be used from this date */
|
||||
double tfend; /* through this date */
|
||||
int32 iflg; /* byte reorder flag and little/bigendian flag */
|
||||
short npl; /* how many planets in file */
|
||||
int ipl[SEI_FILE_NMAXPLAN]; /* planet numbers */
|
||||
};
|
||||
|
||||
struct gen_const {
|
||||
double clight,
|
||||
aunit,
|
||||
helgravconst,
|
||||
ratme,
|
||||
sunradius;
|
||||
struct file_data
|
||||
{
|
||||
char fnam[AS_MAXCH]; /* ephemeris file name */
|
||||
int fversion; /* version number of file */
|
||||
char astnam[50]; /* asteroid name, if asteroid file */
|
||||
int32 sweph_denum; /* DE number of JPL ephemeris, which this file
|
||||
* is derived from. */
|
||||
FILE *fptr; /* ephemeris file pointer */
|
||||
double tfstart; /* file may be used from this date */
|
||||
double tfend; /* through this date */
|
||||
int32 iflg; /* byte reorder flag and little/bigendian flag */
|
||||
short npl; /* how many planets in file */
|
||||
int ipl[SEI_FILE_NMAXPLAN]; /* planet numbers */
|
||||
};
|
||||
|
||||
struct save_positions {
|
||||
int ipl;
|
||||
double tsave;
|
||||
int32 iflgsave;
|
||||
/* position at t = tsave,
|
||||
* in ecliptic polar (offset 0),
|
||||
* ecliptic cartesian (offset 6),
|
||||
* equatorial polar (offset 12),
|
||||
* and equatorial cartesian coordinates (offset 18).
|
||||
* 6 doubles each for position and speed coordinates.
|
||||
*/
|
||||
double xsaves[24];
|
||||
struct gen_const
|
||||
{
|
||||
double clight, aunit, helgravconst, ratme, sunradius;
|
||||
};
|
||||
|
||||
struct node_data {
|
||||
/* result of most recent data evaluation for this body: */
|
||||
double teval; /* time for which last computation was made */
|
||||
int32 iephe; /* which ephemeris was used */
|
||||
double x[6]; /* position and speed vectors equatorial J2000 */
|
||||
int32 xflgs; /* hel., light-time, aberr., prec. flags etc. */
|
||||
double xreturn[24]; /* return positions:
|
||||
* xreturn+0 ecliptic polar coordinates
|
||||
* xreturn+6 ecliptic cartesian coordinates
|
||||
* xreturn+12 equatorial polar coordinates
|
||||
* xreturn+18 equatorial cartesian coordinates
|
||||
*/
|
||||
struct save_positions
|
||||
{
|
||||
int ipl;
|
||||
double tsave;
|
||||
int32 iflgsave;
|
||||
/* position at t = tsave,
|
||||
* in ecliptic polar (offset 0),
|
||||
* ecliptic cartesian (offset 6),
|
||||
* equatorial polar (offset 12),
|
||||
* and equatorial cartesian coordinates (offset 18).
|
||||
* 6 doubles each for position and speed coordinates.
|
||||
*/
|
||||
double xsaves[24];
|
||||
};
|
||||
|
||||
struct topo_data {
|
||||
double geolon, geolat, geoalt;
|
||||
double teval;
|
||||
double tjd_ut;
|
||||
double xobs[6];
|
||||
struct node_data
|
||||
{
|
||||
/* result of most recent data evaluation for this body: */
|
||||
double teval; /* time for which last computation was made */
|
||||
int32 iephe; /* which ephemeris was used */
|
||||
double x[6]; /* position and speed vectors equatorial J2000 */
|
||||
int32 xflgs; /* hel., light-time, aberr., prec. flags etc. */
|
||||
double xreturn[24]; /* return positions:
|
||||
* xreturn+0 ecliptic polar coordinates
|
||||
* xreturn+6 ecliptic cartesian coordinates
|
||||
* xreturn+12 equatorial polar coordinates
|
||||
* xreturn+18 equatorial cartesian coordinates
|
||||
*/
|
||||
};
|
||||
|
||||
struct sid_data {
|
||||
int32 sid_mode;
|
||||
double ayan_t0;
|
||||
double t0;
|
||||
struct topo_data
|
||||
{
|
||||
double geolon, geolat, geoalt;
|
||||
double teval;
|
||||
double tjd_ut;
|
||||
double xobs[6];
|
||||
};
|
||||
|
||||
struct swe_data {
|
||||
AS_BOOL ephe_path_is_set;
|
||||
short jpl_file_is_open;
|
||||
FILE *fixfp; /* fixed stars file pointer */
|
||||
char ephepath[AS_MAXCH];
|
||||
char jplfnam[AS_MAXCH];
|
||||
short jpldenum;
|
||||
AS_BOOL geopos_is_set;
|
||||
AS_BOOL ayana_is_set;
|
||||
AS_BOOL is_old_starfile;
|
||||
struct file_data fidat[SEI_NEPHFILES];
|
||||
struct gen_const gcdat;
|
||||
struct plan_data pldat[SEI_NPLANETS];
|
||||
struct sid_data
|
||||
{
|
||||
int32 sid_mode;
|
||||
double ayan_t0;
|
||||
double t0;
|
||||
};
|
||||
|
||||
struct swe_data
|
||||
{
|
||||
AS_BOOL ephe_path_is_set;
|
||||
short jpl_file_is_open;
|
||||
FILE *fixfp; /* fixed stars file pointer */
|
||||
char ephepath[AS_MAXCH];
|
||||
char jplfnam[AS_MAXCH];
|
||||
short jpldenum;
|
||||
AS_BOOL geopos_is_set;
|
||||
AS_BOOL ayana_is_set;
|
||||
AS_BOOL is_old_starfile;
|
||||
struct file_data fidat[SEI_NEPHFILES];
|
||||
struct gen_const gcdat;
|
||||
struct plan_data pldat[SEI_NPLANETS];
|
||||
#if 0
|
||||
struct node_data nddat[SEI_NNODE_ETC];
|
||||
struct node_data nddat[SEI_NNODE_ETC];
|
||||
#else
|
||||
struct plan_data nddat[SEI_NNODE_ETC];
|
||||
struct plan_data nddat[SEI_NNODE_ETC];
|
||||
#endif
|
||||
struct save_positions savedat[SE_NPLANETS+1];
|
||||
struct epsilon oec;
|
||||
struct epsilon oec2000;
|
||||
struct nut nut;
|
||||
struct nut nut2000;
|
||||
struct nut nutv;
|
||||
struct topo_data topd;
|
||||
struct sid_data sidd;
|
||||
char astelem[AS_MAXCH * 2];
|
||||
double ast_G;
|
||||
double ast_H;
|
||||
double ast_diam;
|
||||
int i_saved_planet_name;
|
||||
char saved_planet_name[80];
|
||||
struct save_positions savedat[SE_NPLANETS + 1];
|
||||
struct epsilon oec;
|
||||
struct epsilon oec2000;
|
||||
struct nut nut;
|
||||
struct nut nut2000;
|
||||
struct nut nutv;
|
||||
struct topo_data topd;
|
||||
struct sid_data sidd;
|
||||
char astelem[AS_MAXCH * 2];
|
||||
double ast_G;
|
||||
double ast_H;
|
||||
double ast_diam;
|
||||
int i_saved_planet_name;
|
||||
char saved_planet_name[80];
|
||||
};
|
||||
|
||||
extern struct swe_data FAR swed;
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
/************************************************************
|
||||
$Header: /home/dieter/sweph/RCS/swephexp.h,v 1.75 2009/04/08 07:19:08 dieter Exp $
|
||||
SWISSEPH: exported definitions and constants
|
||||
@ -19,6 +20,7 @@
|
||||
Authors: Dieter Koch and Alois Treindl, Astrodienst Zurich
|
||||
|
||||
************************************************************/
|
||||
|
||||
/* Copyright (C) 1997 - 2008 Astrodienst AG, Switzerland. All rights reserved.
|
||||
|
||||
License conditions
|
||||
@ -74,7 +76,8 @@
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#ifndef _SWEPHEXP_INCLUDED /* allow multiple #includes of swephexp.h */
|
||||
@ -87,46 +90,46 @@ extern "C" {
|
||||
***********************************************************/
|
||||
|
||||
/* values for gregflag in swe_julday() and swe_revjul() */
|
||||
# define SE_JUL_CAL 0
|
||||
# define SE_GREG_CAL 1
|
||||
#define SE_JUL_CAL 0
|
||||
#define SE_GREG_CAL 1
|
||||
|
||||
/*
|
||||
* planet numbers for the ipl parameter in swe_calc()
|
||||
*/
|
||||
#define SE_ECL_NUT -1
|
||||
#define SE_ECL_NUT -1
|
||||
|
||||
#define SE_SUN 0
|
||||
#define SE_MOON 1
|
||||
#define SE_MERCURY 2
|
||||
#define SE_VENUS 3
|
||||
#define SE_MARS 4
|
||||
#define SE_JUPITER 5
|
||||
#define SE_SATURN 6
|
||||
#define SE_URANUS 7
|
||||
#define SE_NEPTUNE 8
|
||||
#define SE_PLUTO 9
|
||||
#define SE_MEAN_NODE 10
|
||||
#define SE_SUN 0
|
||||
#define SE_MOON 1
|
||||
#define SE_MERCURY 2
|
||||
#define SE_VENUS 3
|
||||
#define SE_MARS 4
|
||||
#define SE_JUPITER 5
|
||||
#define SE_SATURN 6
|
||||
#define SE_URANUS 7
|
||||
#define SE_NEPTUNE 8
|
||||
#define SE_PLUTO 9
|
||||
#define SE_MEAN_NODE 10
|
||||
#define SE_TRUE_NODE 11
|
||||
#define SE_MEAN_APOG 12
|
||||
#define SE_OSCU_APOG 13
|
||||
#define SE_EARTH 14
|
||||
#define SE_CHIRON 15
|
||||
#define SE_PHOLUS 16
|
||||
#define SE_CERES 17
|
||||
#define SE_PALLAS 18
|
||||
#define SE_JUNO 19
|
||||
#define SE_VESTA 20
|
||||
#define SE_INTP_APOG 21
|
||||
#define SE_INTP_PERG 22
|
||||
#define SE_MEAN_APOG 12
|
||||
#define SE_OSCU_APOG 13
|
||||
#define SE_EARTH 14
|
||||
#define SE_CHIRON 15
|
||||
#define SE_PHOLUS 16
|
||||
#define SE_CERES 17
|
||||
#define SE_PALLAS 18
|
||||
#define SE_JUNO 19
|
||||
#define SE_VESTA 20
|
||||
#define SE_INTP_APOG 21
|
||||
#define SE_INTP_PERG 22
|
||||
|
||||
#define SE_NPLANETS 23
|
||||
#define SE_NPLANETS 23
|
||||
|
||||
#define SE_AST_OFFSET 10000
|
||||
#define SE_VARUNA (SE_AST_OFFSET + 20000)
|
||||
|
||||
#define SE_FICT_OFFSET 40
|
||||
#define SE_FICT_OFFSET_1 39
|
||||
#define SE_FICT_MAX 999
|
||||
#define SE_FICT_MAX 999
|
||||
#define SE_NFICT_ELEM 15
|
||||
|
||||
#define SE_COMET_OFFSET 1000
|
||||
@ -142,6 +145,7 @@ extern "C" {
|
||||
#define SE_ADMETOS 45
|
||||
#define SE_VULKANUS 46
|
||||
#define SE_POSEIDON 47
|
||||
|
||||
/* other fictitious bodies */
|
||||
#define SE_ISIS 48
|
||||
#define SE_NIBIRU 49
|
||||
@ -161,10 +165,10 @@ extern "C" {
|
||||
#define SE_MC 1
|
||||
#define SE_ARMC 2
|
||||
#define SE_VERTEX 3
|
||||
#define SE_EQUASC 4 /* "equatorial ascendant" */
|
||||
#define SE_COASC1 5 /* "co-ascendant" (W. Koch) */
|
||||
#define SE_COASC2 6 /* "co-ascendant" (M. Munkasey) */
|
||||
#define SE_POLASC 7 /* "polar ascendant" (M. Munkasey) */
|
||||
#define SE_EQUASC 4 /* "equatorial ascendant" */
|
||||
#define SE_COASC1 5 /* "co-ascendant" (W. Koch) */
|
||||
#define SE_COASC2 6 /* "co-ascendant" (M. Munkasey) */
|
||||
#define SE_POLASC 7 /* "polar ascendant" (M. Munkasey) */
|
||||
#define SE_NASCMC 8
|
||||
|
||||
/*
|
||||
@ -183,26 +187,28 @@ extern "C" {
|
||||
#define SEFLG_SWIEPH 2 /* use SWISSEPH ephemeris */
|
||||
#define SEFLG_MOSEPH 4 /* use Moshier ephemeris */
|
||||
|
||||
#define SEFLG_HELCTR 8 /* return heliocentric position */
|
||||
#define SEFLG_TRUEPOS 16 /* return true positions, not apparent */
|
||||
#define SEFLG_J2000 32 /* no precession, i.e. give J2000 equinox */
|
||||
#define SEFLG_NONUT 64 /* no nutation, i.e. mean equinox of date */
|
||||
#define SEFLG_HELCTR 8 /* return heliocentric position */
|
||||
#define SEFLG_TRUEPOS 16 /* return true positions, not apparent */
|
||||
#define SEFLG_J2000 32 /* no precession, i.e. give J2000 equinox */
|
||||
#define SEFLG_NONUT 64 /* no nutation, i.e. mean equinox of date */
|
||||
#define SEFLG_SPEED3 128 /* speed from 3 positions (do not use it,
|
||||
SEFLG_SPEED is faster and more precise.) */
|
||||
* SEFLG_SPEED is faster and more precise.) */
|
||||
#define SEFLG_SPEED 256 /* high precision speed */
|
||||
#define SEFLG_NOGDEFL 512 /* turn off gravitational deflection */
|
||||
#define SEFLG_NOABERR 1024 /* turn off 'annual' aberration of light */
|
||||
#define SEFLG_EQUATORIAL (2*1024) /* equatorial positions are wanted */
|
||||
#define SEFLG_XYZ (4*1024) /* cartesian, not polar, coordinates */
|
||||
#define SEFLG_RADIANS (8*1024) /* coordinates in radians, not degrees */
|
||||
#define SEFLG_BARYCTR (16*1024) /* barycentric positions */
|
||||
#define SEFLG_TOPOCTR (32*1024) /* topocentric positions */
|
||||
#define SEFLG_SIDEREAL (64*1024) /* sidereal positions */
|
||||
#define SEFLG_ICRS (128*1024) /* ICRS (DE406 reference frame) */
|
||||
#define SEFLG_EQUATORIAL (2*1024) /* equatorial positions are wanted */
|
||||
#define SEFLG_XYZ (4*1024) /* cartesian, not polar, coordinates */
|
||||
#define SEFLG_RADIANS (8*1024) /* coordinates in radians, not degrees */
|
||||
#define SEFLG_BARYCTR (16*1024) /* barycentric positions */
|
||||
#define SEFLG_TOPOCTR (32*1024) /* topocentric positions */
|
||||
#define SEFLG_SIDEREAL (64*1024) /* sidereal positions */
|
||||
#define SEFLG_ICRS (128*1024) /* ICRS (DE406 reference frame) */
|
||||
|
||||
#define SE_SIDBITS 256
|
||||
|
||||
/* for projection onto ecliptic of t0 */
|
||||
#define SE_SIDBIT_ECL_T0 256
|
||||
|
||||
/* for projection onto solar system plane */
|
||||
#define SE_SIDBIT_SSY_PLANE 512
|
||||
|
||||
@ -237,19 +243,19 @@ extern "C" {
|
||||
#define SE_NSIDM_PREDEF 27
|
||||
|
||||
/* used for swe_nod_aps(): */
|
||||
#define SE_NODBIT_MEAN 1 /* mean nodes/apsides */
|
||||
#define SE_NODBIT_OSCU 2 /* osculating nodes/apsides */
|
||||
#define SE_NODBIT_OSCU_BAR 4 /* same, but motion about solar system barycenter is considered */
|
||||
#define SE_NODBIT_FOPOINT 256 /* focal point of orbit instead of aphelion */
|
||||
#define SE_NODBIT_MEAN 1 /* mean nodes/apsides */
|
||||
#define SE_NODBIT_OSCU 2 /* osculating nodes/apsides */
|
||||
#define SE_NODBIT_OSCU_BAR 4 /* same, but motion about solar system barycenter is considered */
|
||||
#define SE_NODBIT_FOPOINT 256 /* focal point of orbit instead of aphelion */
|
||||
|
||||
/* default ephemeris used when no ephemeris flagbit is set */
|
||||
#define SEFLG_DEFAULTEPH SEFLG_SWIEPH
|
||||
|
||||
#define SE_MAX_STNAME 256 /* maximum size of fixstar name;
|
||||
#define SE_MAX_STNAME 256 /* maximum size of fixstar name;
|
||||
* the parameter star in swe_fixstar
|
||||
* must allow twice this space for
|
||||
* the returned star name.
|
||||
*/
|
||||
* must allow twice this space for
|
||||
* the returned star name.
|
||||
*/
|
||||
|
||||
/* defines for eclipse computations */
|
||||
|
||||
@ -268,29 +274,29 @@ extern "C" {
|
||||
#define SE_ECL_2ND_VISIBLE 1024
|
||||
#define SE_ECL_3RD_VISIBLE 2048
|
||||
#define SE_ECL_4TH_VISIBLE 4096
|
||||
#define SE_ECL_ONE_TRY (32*1024)
|
||||
/* check if the next conjunction of the moon with
|
||||
* a planet is an occultation; don't search further */
|
||||
#define SE_ECL_ONE_TRY (32*1024)
|
||||
/* check if the next conjunction of the moon with
|
||||
* a planet is an occultation; don't search further */
|
||||
|
||||
/* for swe_rise_transit() */
|
||||
#define SE_CALC_RISE 1
|
||||
#define SE_CALC_SET 2
|
||||
#define SE_CALC_MTRANSIT 4
|
||||
#define SE_CALC_ITRANSIT 8
|
||||
#define SE_BIT_DISC_CENTER 256 /* to be or'ed to SE_CALC_RISE/SET,
|
||||
* if rise or set of disc center is
|
||||
* required */
|
||||
#define SE_BIT_DISC_BOTTOM 8192 /* to be or'ed to SE_CALC_RISE/SET,
|
||||
* if rise or set of lower limb of
|
||||
* disc is requried */
|
||||
#define SE_BIT_NO_REFRACTION 512 /* to be or'ed to SE_CALC_RISE/SET,
|
||||
* if refraction is to be ignored */
|
||||
#define SE_BIT_CIVIL_TWILIGHT 1024 /* to be or'ed to SE_CALC_RISE/SET */
|
||||
#define SE_BIT_NAUTIC_TWILIGHT 2048 /* to be or'ed to SE_CALC_RISE/SET */
|
||||
#define SE_BIT_ASTRO_TWILIGHT 4096 /* to be or'ed to SE_CALC_RISE/SET */
|
||||
#define SE_BIT_FIXED_DISC_SIZE (16*1024) /* or'ed to SE_CALC_RISE/SET:
|
||||
* neglect the effect of distance on
|
||||
* disc size */
|
||||
#define SE_BIT_DISC_CENTER 256 /* to be or'ed to SE_CALC_RISE/SET,
|
||||
* if rise or set of disc center is
|
||||
* required */
|
||||
#define SE_BIT_DISC_BOTTOM 8192 /* to be or'ed to SE_CALC_RISE/SET,
|
||||
* if rise or set of lower limb of
|
||||
* disc is requried */
|
||||
#define SE_BIT_NO_REFRACTION 512 /* to be or'ed to SE_CALC_RISE/SET,
|
||||
* if refraction is to be ignored */
|
||||
#define SE_BIT_CIVIL_TWILIGHT 1024 /* to be or'ed to SE_CALC_RISE/SET */
|
||||
#define SE_BIT_NAUTIC_TWILIGHT 2048 /* to be or'ed to SE_CALC_RISE/SET */
|
||||
#define SE_BIT_ASTRO_TWILIGHT 4096 /* to be or'ed to SE_CALC_RISE/SET */
|
||||
#define SE_BIT_FIXED_DISC_SIZE (16*1024) /* or'ed to SE_CALC_RISE/SET:
|
||||
* neglect the effect of distance on
|
||||
* disc size */
|
||||
|
||||
|
||||
/* for swe_azalt() and swe_azalt_rev() */
|
||||
@ -330,34 +336,34 @@ extern "C" {
|
||||
#ifndef SE_EPHE_PATH
|
||||
#if MSDOS
|
||||
#ifdef PAIR_SWEPH
|
||||
# define SE_EPHE_PATH "\\pair\\ephe\\"
|
||||
#define SE_EPHE_PATH "\\pair\\ephe\\"
|
||||
#else
|
||||
# define SE_EPHE_PATH "\\sweph\\ephe\\"
|
||||
#define SE_EPHE_PATH "\\sweph\\ephe\\"
|
||||
#endif
|
||||
#else
|
||||
# ifdef MACOS
|
||||
# define SE_EPHE_PATH ":ephe:"
|
||||
# else
|
||||
# define SE_EPHE_PATH ".:/users/ephe2/:/users/ephe/"
|
||||
/* At Astrodienst, we maintain two ephemeris areas for
|
||||
the thousands of asteroid files:
|
||||
the short files in /users/ephe/ast*,
|
||||
the long file in /users/ephe2/ast*. */
|
||||
# endif
|
||||
#ifdef MACOS
|
||||
#define SE_EPHE_PATH ":ephe:"
|
||||
#else
|
||||
#define SE_EPHE_PATH ".:/users/ephe2/:/users/ephe/"
|
||||
/* At Astrodienst, we maintain two ephemeris areas for
|
||||
* the thousands of asteroid files:
|
||||
* the short files in /users/ephe/ast*,
|
||||
* the long file in /users/ephe2/ast*. */
|
||||
#endif
|
||||
#endif /* SE_EPHE_PATH */
|
||||
#endif
|
||||
#endif /* SE_EPHE_PATH */
|
||||
|
||||
/* defines for function swe_split_deg() (in swephlib.c) */
|
||||
# define SE_SPLIT_DEG_ROUND_SEC 1
|
||||
# define SE_SPLIT_DEG_ROUND_MIN 2
|
||||
# define SE_SPLIT_DEG_ROUND_DEG 4
|
||||
# define SE_SPLIT_DEG_ZODIACAL 8
|
||||
# define SE_SPLIT_DEG_KEEP_SIGN 16 /* don't round to next sign,
|
||||
* e.g. 29.9999999 will be rounded
|
||||
* to 29d59'59" (or 29d59' or 29d) */
|
||||
# define SE_SPLIT_DEG_KEEP_DEG 32 /* don't round to next degree
|
||||
* e.g. 13.9999999 will be rounded
|
||||
* to 13d59'59" (or 13d59' or 13d) */
|
||||
#define SE_SPLIT_DEG_ROUND_SEC 1
|
||||
#define SE_SPLIT_DEG_ROUND_MIN 2
|
||||
#define SE_SPLIT_DEG_ROUND_DEG 4
|
||||
#define SE_SPLIT_DEG_ZODIACAL 8
|
||||
#define SE_SPLIT_DEG_KEEP_SIGN 16 /* don't round to next sign,
|
||||
* e.g. 29.9999999 will be rounded
|
||||
* to 29d59'59" (or 29d59' or 29d) */
|
||||
#define SE_SPLIT_DEG_KEEP_DEG 32 /* don't round to next degree
|
||||
* e.g. 13.9999999 will be rounded
|
||||
* to 13d59'59" (or 13d59' or 13d) */
|
||||
|
||||
/* for heliacal functions */
|
||||
#define SE_HELIACAL_RISING 1
|
||||
@ -366,19 +372,19 @@ extern "C" {
|
||||
#define SE_EVENING_LAST SE_HELIACAL_SETTING
|
||||
#define SE_EVENING_FIRST 3
|
||||
#define SE_MORNING_LAST 4
|
||||
#define SE_ACRONYCHAL_RISING 5 /* still not implemented */
|
||||
#define SE_ACRONYCHAL_SETTING 6 /* still not implemented */
|
||||
#define SE_ACRONYCHAL_RISING 5 /* still not implemented */
|
||||
#define SE_ACRONYCHAL_SETTING 6 /* still not implemented */
|
||||
#define SE_COSMICAL_SETTING SE_ACRONYCHAL_SETTING
|
||||
|
||||
#define SE_HELFLAG_LONG_SEARCH 128
|
||||
#define SE_HELFLAG_HIGH_PRECISION 256
|
||||
#define SE_HELFLAG_OPTICAL_PARAMS 512
|
||||
#define SE_HELFLAG_NO_DETAILS 1024
|
||||
#define SE_HELFLAG_SEARCH_1_PERIOD (1 << 11) /* 2048 */
|
||||
#define SE_HELFLAG_VISLIM_DARK (1 << 12) /* 4096 */
|
||||
#define SE_HELFLAG_VISLIM_NOMOON (1 << 13) /* 8192 */
|
||||
#define SE_HELFLAG_VISLIM_PHOTOPIC (1 << 14) /* 16384 */
|
||||
#define SE_HELFLAG_AVKIND_VR (1 << 15) /* 32768 */
|
||||
#define SE_HELFLAG_SEARCH_1_PERIOD (1 << 11) /* 2048 */
|
||||
#define SE_HELFLAG_VISLIM_DARK (1 << 12) /* 4096 */
|
||||
#define SE_HELFLAG_VISLIM_NOMOON (1 << 13) /* 8192 */
|
||||
#define SE_HELFLAG_VISLIM_PHOTOPIC (1 << 14) /* 16384 */
|
||||
#define SE_HELFLAG_AVKIND_VR (1 << 15) /* 32768 */
|
||||
#define SE_HELFLAG_AVKIND_PTO (1 << 16)
|
||||
#define SE_HELFLAG_AVKIND_MIN7 (1 << 17)
|
||||
#define SE_HELFLAG_AVKIND_MIN9 (1 << 18)
|
||||
@ -390,11 +396,11 @@ extern "C" {
|
||||
#define SE_HELIACAL_HIGH_PRECISION 256
|
||||
#define SE_HELIACAL_OPTICAL_PARAMS 512
|
||||
#define SE_HELIACAL_NO_DETAILS 1024
|
||||
#define SE_HELIACAL_SEARCH_1_PERIOD (1 << 11) /* 2048 */
|
||||
#define SE_HELIACAL_VISLIM_DARK (1 << 12) /* 4096 */
|
||||
#define SE_HELIACAL_VISLIM_NOMOON (1 << 13) /* 8192 */
|
||||
#define SE_HELIACAL_VISLIM_PHOTOPIC (1 << 14) /* 16384 */
|
||||
#define SE_HELIACAL_AVKIND_VR (1 << 15) /* 32768 */
|
||||
#define SE_HELIACAL_SEARCH_1_PERIOD (1 << 11) /* 2048 */
|
||||
#define SE_HELIACAL_VISLIM_DARK (1 << 12) /* 4096 */
|
||||
#define SE_HELIACAL_VISLIM_NOMOON (1 << 13) /* 8192 */
|
||||
#define SE_HELIACAL_VISLIM_PHOTOPIC (1 << 14) /* 16384 */
|
||||
#define SE_HELIACAL_AVKIND_VR (1 << 15) /* 32768 */
|
||||
#define SE_HELIACAL_AVKIND_PTO (1 << 16)
|
||||
#define SE_HELIACAL_AVKIND_MIN7 (1 << 17)
|
||||
#define SE_HELIACAL_AVKIND_MIN9 (1 << 18)
|
||||
@ -414,8 +420,8 @@ extern "C" {
|
||||
* The option is called PAIR_SWEPH because it was introduced for
|
||||
* Astrodienst's partner software PAIR.
|
||||
*/
|
||||
#ifdef PAIR_SWEPH
|
||||
# define NO_JPL
|
||||
#ifdef PAIR_SWEPH
|
||||
#define NO_JPL
|
||||
#endif
|
||||
|
||||
/**************************************************************
|
||||
@ -426,60 +432,60 @@ extern "C" {
|
||||
* and skip to the export function decarations below.
|
||||
************************************************************/
|
||||
#if defined(MAKE_DLL) || defined(USE_DLL) || defined(_WINDOWS)
|
||||
# include <windows.h>
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#ifdef USE_DLL
|
||||
# include "swedll.h"
|
||||
#include "swedll.h"
|
||||
#endif
|
||||
|
||||
#if defined(DOS32) || !MSDOS || defined(WIN32)
|
||||
/* use compiler switch to define DOS32 */
|
||||
# ifndef FAR
|
||||
# define FAR
|
||||
# endif
|
||||
# define MALLOC malloc
|
||||
# define CALLOC calloc
|
||||
# define FREE free
|
||||
/* use compiler switch to define DOS32 */
|
||||
#ifndef FAR
|
||||
#define FAR
|
||||
#endif
|
||||
#define MALLOC malloc
|
||||
#define CALLOC calloc
|
||||
#define FREE free
|
||||
#else
|
||||
# ifndef FAR
|
||||
# define FAR far
|
||||
# endif
|
||||
# ifdef __BORLANDC__
|
||||
# include <alloc.h>
|
||||
# define MALLOC farmalloc
|
||||
# define CALLOC farcalloc
|
||||
# define FREE farfree
|
||||
# else
|
||||
# define MALLOC _fmalloc
|
||||
# define CALLOC _fcalloc
|
||||
# define FREE _ffree
|
||||
# endif
|
||||
#ifndef FAR
|
||||
#define FAR far
|
||||
#endif
|
||||
#ifdef __BORLANDC__
|
||||
#include <alloc.h>
|
||||
#define MALLOC farmalloc
|
||||
#define CALLOC farcalloc
|
||||
#define FREE farfree
|
||||
#else
|
||||
#define MALLOC _fmalloc
|
||||
#define CALLOC _fcalloc
|
||||
#define FREE _ffree
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* DLL defines */
|
||||
#ifdef MAKE_DLL
|
||||
#if defined (PASCAL)
|
||||
#define PASCAL_CONV PASCAL
|
||||
#else
|
||||
#define PASCAL_CONV
|
||||
#endif
|
||||
#ifdef MAKE_DLL16 /* 16bit DLL */
|
||||
#if defined (PASCAL)
|
||||
#define PASCAL_CONV PASCAL
|
||||
#else
|
||||
#define PASCAL_CONV
|
||||
#endif
|
||||
#ifdef MAKE_DLL16 /* 16bit DLL */
|
||||
/* We compiled the 16bit DLL for Windows 3.x using Borland C/C++ Ver:3.x
|
||||
and the -WD or -WDE compiler switch. */
|
||||
#define EXP16 __export
|
||||
#define EXP32
|
||||
#else /* 32bit DLL */
|
||||
* and the -WD or -WDE compiler switch. */
|
||||
#define EXP16 __export
|
||||
#define EXP32
|
||||
#else /* 32bit DLL */
|
||||
/* To export symbols in the new DLL model of Win32, Microsoft
|
||||
recommends the following approach */
|
||||
#define EXP16
|
||||
#define EXP32 __declspec( dllexport )
|
||||
#endif
|
||||
#else
|
||||
#define PASCAL_CONV
|
||||
#define EXP16
|
||||
#define EXP32
|
||||
#endif
|
||||
* recommends the following approach */
|
||||
#define EXP16
|
||||
#define EXP32 __declspec( dllexport )
|
||||
#endif
|
||||
#else
|
||||
#define PASCAL_CONV
|
||||
#define EXP16
|
||||
#define EXP32
|
||||
#endif
|
||||
|
||||
#ifndef _SWEDLL_H
|
||||
|
||||
@ -488,221 +494,240 @@ extern "C" {
|
||||
***********************************************************/
|
||||
|
||||
#define ext_def(x) extern EXP32 x FAR PASCAL_CONV EXP16
|
||||
/* ext_def(x) evaluates to x on Unix */
|
||||
/* ext_def(x) evaluates to x on Unix */
|
||||
|
||||
ext_def(int32) swe_heliacal_ut(double tjdstart_ut, double *geopos,
|
||||
double *datm, double *dobs,
|
||||
char *ObjectName, int32 TypeEvent,
|
||||
int32 iflag, double *dret, char *serr);
|
||||
ext_def(int32) swe_heliacal_pheno_ut(double tjd_ut, double *geopos,
|
||||
double *datm, double *dobs,
|
||||
char *ObjectName, int32 TypeEvent,
|
||||
int32 helflag, double *darr,
|
||||
char *serr);
|
||||
ext_def(int32) swe_vis_limit_mag(double tjdut, double *geopos,
|
||||
double *datm, double *dobs,
|
||||
char *ObjectName, int32 helflag,
|
||||
double *dret, char *serr);
|
||||
|
||||
ext_def(int32) swe_heliacal_ut(double tjdstart_ut, double *geopos, double *datm, double *dobs, char *ObjectName, int32 TypeEvent, int32 iflag, double *dret, char *serr);
|
||||
ext_def(int32) swe_heliacal_pheno_ut(double tjd_ut, double *geopos, double *datm, double *dobs, char *ObjectName, int32 TypeEvent, int32 helflag, double *darr, char *serr);
|
||||
ext_def(int32) swe_vis_limit_mag(double tjdut, double *geopos, double *datm, double *dobs, char *ObjectName, int32 helflag, double *dret, char *serr);
|
||||
/* the following are secret, for Victor Reijs' */
|
||||
ext_def(int32) swe_heliacal_angle(double tjdut, double *dgeo, double *datm, double *dobs, int32 helflag, double mag, double azi_obj, double azi_sun, double azi_moon, double alt_moon, double *dret, char *serr);
|
||||
ext_def(int32) swe_topo_arcus_visionis(double tjdut, double *dgeo, double *datm, double *dobs, int32 helflag, double mag, double azi_obj, double alt_obj, double azi_sun, double azi_moon, double alt_moon, double *dret, char *serr);
|
||||
ext_def(int32) swe_heliacal_angle(double tjdut, double *dgeo,
|
||||
double *datm, double *dobs,
|
||||
int32 helflag, double mag,
|
||||
double azi_obj, double azi_sun,
|
||||
double azi_moon, double alt_moon,
|
||||
double *dret, char *serr);
|
||||
ext_def(int32) swe_topo_arcus_visionis(double tjdut, double *dgeo,
|
||||
double *datm, double *dobs,
|
||||
int32 helflag, double mag,
|
||||
double azi_obj, double alt_obj,
|
||||
double azi_sun, double azi_moon,
|
||||
double alt_moon, double *dret,
|
||||
char *serr);
|
||||
|
||||
/****************************
|
||||
* exports from sweph.c
|
||||
****************************/
|
||||
|
||||
ext_def(char *) swe_version(char *);
|
||||
ext_def(char *) swe_version(char *);
|
||||
|
||||
/* planets, moon, nodes etc. */
|
||||
ext_def( int32 ) swe_calc(
|
||||
double tjd, int ipl, int32 iflag,
|
||||
double *xx,
|
||||
char *serr);
|
||||
ext_def(int32) swe_calc(double tjd, int ipl, int32 iflag, double *xx,
|
||||
char *serr);
|
||||
|
||||
ext_def(int32) swe_calc_ut(double tjd_ut, int32 ipl, int32 iflag,
|
||||
double *xx, char *serr);
|
||||
ext_def(int32) swe_calc_ut(double tjd_ut, int32 ipl, int32 iflag,
|
||||
double *xx, char *serr);
|
||||
|
||||
/* fixed stars */
|
||||
ext_def( int32 ) swe_fixstar(
|
||||
char *star, double tjd, int32 iflag,
|
||||
double *xx,
|
||||
char *serr);
|
||||
ext_def(int32) swe_fixstar(char *star, double tjd, int32 iflag,
|
||||
double *xx, char *serr);
|
||||
|
||||
ext_def(int32) swe_fixstar_ut(char *star, double tjd_ut, int32 iflag,
|
||||
double *xx, char *serr);
|
||||
ext_def(int32) swe_fixstar_ut(char *star, double tjd_ut, int32 iflag,
|
||||
double *xx, char *serr);
|
||||
|
||||
ext_def(int32) swe_fixstar_mag(char *star, double *mag, char *serr);
|
||||
ext_def(int32) swe_fixstar_mag(char *star, double *mag, char *serr);
|
||||
|
||||
/* close Swiss Ephemeris */
|
||||
ext_def( void ) swe_close(void);
|
||||
ext_def(void) swe_close(void);
|
||||
|
||||
/* set directory path of ephemeris files */
|
||||
ext_def( void ) swe_set_ephe_path(char *path);
|
||||
ext_def(void) swe_set_ephe_path(char *path);
|
||||
|
||||
/* set file name of JPL file */
|
||||
ext_def( void ) swe_set_jpl_file(char *fname);
|
||||
ext_def(void) swe_set_jpl_file(char *fname);
|
||||
|
||||
/* get planet name */
|
||||
ext_def( char *) swe_get_planet_name(int ipl, char *spname);
|
||||
ext_def(char *) swe_get_planet_name(int ipl, char *spname);
|
||||
|
||||
/* set geographic position of observer */
|
||||
ext_def (void) swe_set_topo(double geolon, double geolat, double geoalt);
|
||||
ext_def(void) swe_set_topo(double geolon, double geolat, double geoalt);
|
||||
|
||||
/* set sidereal mode */
|
||||
ext_def(void) swe_set_sid_mode(int32 sid_mode, double t0, double ayan_t0);
|
||||
ext_def(void) swe_set_sid_mode(int32 sid_mode, double t0,
|
||||
double ayan_t0);
|
||||
|
||||
/* get ayanamsa */
|
||||
ext_def(double) swe_get_ayanamsa(double tjd_et);
|
||||
ext_def(double) swe_get_ayanamsa(double tjd_et);
|
||||
|
||||
ext_def(double) swe_get_ayanamsa_ut(double tjd_ut);
|
||||
ext_def(double) swe_get_ayanamsa_ut(double tjd_ut);
|
||||
|
||||
ext_def( char *) swe_get_ayanamsa_name(int32 isidmode);
|
||||
ext_def(char *) swe_get_ayanamsa_name(int32 isidmode);
|
||||
|
||||
/****************************
|
||||
* exports from swedate.c
|
||||
****************************/
|
||||
|
||||
ext_def( int ) swe_date_conversion(
|
||||
int y , int m , int d , /* year, month, day */
|
||||
double utime, /* universal time in hours (decimal) */
|
||||
char c, /* calendar g[regorian]|j[ulian] */
|
||||
double *tjd);
|
||||
ext_def(int) swe_date_conversion(int y, int m, int d, /* year, month, day */
|
||||
double utime, /* universal time in hours (decimal) */
|
||||
char c, /* calendar g[regorian]|j[ulian] */
|
||||
double *tjd);
|
||||
|
||||
ext_def( double ) swe_julday(
|
||||
int year, int month, int day, double hour,
|
||||
int gregflag);
|
||||
ext_def(double) swe_julday(int year, int month, int day, double hour,
|
||||
int gregflag);
|
||||
|
||||
ext_def( void ) swe_revjul (
|
||||
double jd,
|
||||
int gregflag,
|
||||
int *jyear, int *jmon, int *jday, double *jut);
|
||||
ext_def(void) swe_revjul(double jd, int gregflag, int *jyear, int *jmon,
|
||||
int *jday, double *jut);
|
||||
|
||||
ext_def(int32) swe_utc_to_jd(
|
||||
int32 iyear, int32 imonth, int32 iday,
|
||||
int32 ihour, int32 imin, double dsec,
|
||||
int32 gregflag, double *dret, char *serr);
|
||||
ext_def(int32) swe_utc_to_jd(int32 iyear, int32 imonth, int32 iday,
|
||||
int32 ihour, int32 imin, double dsec,
|
||||
int32 gregflag, double *dret, char *serr);
|
||||
|
||||
ext_def(void) swe_jdet_to_utc(
|
||||
double tjd_et, int32 gregflag,
|
||||
int32 *iyear, int32 *imonth, int32 *iday,
|
||||
int32 *ihour, int32 *imin, double *dsec);
|
||||
ext_def(void) swe_jdet_to_utc(double tjd_et, int32 gregflag,
|
||||
int32 * iyear, int32 * imonth,
|
||||
int32 * iday, int32 * ihour, int32 * imin,
|
||||
double *dsec);
|
||||
|
||||
ext_def(void) swe_jdut1_to_utc(
|
||||
double tjd_ut, int32 gregflag,
|
||||
int32 *iyear, int32 *imonth, int32 *iday,
|
||||
int32 *ihour, int32 *imin, double *dsec);
|
||||
ext_def(void) swe_jdut1_to_utc(double tjd_ut, int32 gregflag,
|
||||
int32 * iyear, int32 * imonth,
|
||||
int32 * iday, int32 * ihour,
|
||||
int32 * imin, double *dsec);
|
||||
|
||||
ext_def(void) swe_utc_time_zone(
|
||||
int32 iyear, int32 imonth, int32 iday,
|
||||
int32 ihour, int32 imin, double dsec,
|
||||
double d_timezone,
|
||||
int32 *iyear_out, int32 *imonth_out, int32 *iday_out,
|
||||
int32 *ihour_out, int32 *imin_out, double *dsec_out);
|
||||
ext_def(void) swe_utc_time_zone(int32 iyear, int32 imonth, int32 iday,
|
||||
int32 ihour, int32 imin, double dsec,
|
||||
double d_timezone, int32 * iyear_out,
|
||||
int32 * imonth_out, int32 * iday_out,
|
||||
int32 * ihour_out, int32 * imin_out,
|
||||
double *dsec_out);
|
||||
|
||||
/****************************
|
||||
* exports from swehouse.c
|
||||
****************************/
|
||||
|
||||
ext_def( int ) swe_houses(
|
||||
double tjd_ut, double geolat, double geolon, int hsys,
|
||||
double *cusps, double *ascmc);
|
||||
ext_def(int) swe_houses(double tjd_ut, double geolat, double geolon,
|
||||
int hsys, double *cusps, double *ascmc);
|
||||
|
||||
ext_def( int ) swe_houses_ex(
|
||||
double tjd_ut, int32 iflag, double geolat, double geolon, int hsys,
|
||||
double *cusps, double *ascmc);
|
||||
ext_def(int) swe_houses_ex(double tjd_ut, int32 iflag, double geolat,
|
||||
double geolon, int hsys, double *cusps,
|
||||
double *ascmc);
|
||||
|
||||
ext_def( int ) swe_houses_armc(
|
||||
double armc, double geolat, double eps, int hsys,
|
||||
double *cusps, double *ascmc);
|
||||
ext_def(int) swe_houses_armc(double armc, double geolat, double eps,
|
||||
int hsys, double *cusps, double *ascmc);
|
||||
|
||||
ext_def(double) swe_house_pos(
|
||||
double armc, double geolat, double eps, int hsys, double *xpin, char *serr);
|
||||
ext_def(double) swe_house_pos(double armc, double geolat, double eps,
|
||||
int hsys, double *xpin, char *serr);
|
||||
|
||||
/****************************
|
||||
* exports from swecl.c
|
||||
****************************/
|
||||
|
||||
ext_def(int32) swe_gauquelin_sector(double t_ut, int32 ipl, char *starname, int32 iflag, int32 imeth, double *geopos, double atpress, double attemp, double *dgsect, char *serr);
|
||||
ext_def(int32) swe_gauquelin_sector(double t_ut, int32 ipl,
|
||||
char *starname, int32 iflag,
|
||||
int32 imeth, double *geopos,
|
||||
double atpress, double attemp,
|
||||
double *dgsect, char *serr);
|
||||
|
||||
/* computes geographic location and attributes of solar
|
||||
* eclipse at a given tjd */
|
||||
ext_def (int32) swe_sol_eclipse_where(double tjd, int32 ifl, double *geopos, double *attr, char *serr);
|
||||
ext_def(int32) swe_sol_eclipse_where(double tjd, int32 ifl,
|
||||
double *geopos, double *attr,
|
||||
char *serr);
|
||||
|
||||
ext_def (int32) swe_lun_occult_where(double tjd, int32 ipl, char *starname, int32 ifl, double *geopos, double *attr, char *serr);
|
||||
ext_def(int32) swe_lun_occult_where(double tjd, int32 ipl,
|
||||
char *starname, int32 ifl,
|
||||
double *geopos, double *attr,
|
||||
char *serr);
|
||||
|
||||
/* computes attributes of a solar eclipse for given tjd, geolon, geolat */
|
||||
ext_def (int32) swe_sol_eclipse_how(double tjd, int32 ifl, double *geopos, double *attr, char *serr);
|
||||
ext_def(int32) swe_sol_eclipse_how(double tjd, int32 ifl,
|
||||
double *geopos, double *attr,
|
||||
char *serr);
|
||||
|
||||
/* finds time of next local eclipse */
|
||||
ext_def (int32) swe_sol_eclipse_when_loc(double tjd_start, int32 ifl, double *geopos, double *tret, double *attr, int32 backward, char *serr);
|
||||
ext_def(int32) swe_sol_eclipse_when_loc(double tjd_start, int32 ifl,
|
||||
double *geopos, double *tret,
|
||||
double *attr, int32 backward,
|
||||
char *serr);
|
||||
|
||||
ext_def (int32) swe_lun_occult_when_loc(double tjd_start, int32 ipl, char *starname, int32 ifl,
|
||||
double *geopos, double *tret, double *attr, int32 backward, char *serr);
|
||||
ext_def(int32) swe_lun_occult_when_loc(double tjd_start, int32 ipl,
|
||||
char *starname, int32 ifl,
|
||||
double *geopos, double *tret,
|
||||
double *attr, int32 backward,
|
||||
char *serr);
|
||||
|
||||
/* finds time of next eclipse globally */
|
||||
ext_def (int32) swe_sol_eclipse_when_glob(double tjd_start, int32 ifl, int32 ifltype,
|
||||
double *tret, int32 backward, char *serr);
|
||||
ext_def(int32) swe_sol_eclipse_when_glob(double tjd_start, int32 ifl,
|
||||
int32 ifltype, double *tret,
|
||||
int32 backward, char *serr);
|
||||
|
||||
/* finds time of next occultation globally */
|
||||
ext_def (int32) swe_lun_occult_when_glob(double tjd_start, int32 ipl, char *starname, int32 ifl, int32 ifltype,
|
||||
double *tret, int32 backward, char *serr);
|
||||
ext_def(int32) swe_lun_occult_when_glob(double tjd_start, int32 ipl,
|
||||
char *starname, int32 ifl,
|
||||
int32 ifltype, double *tret,
|
||||
int32 backward, char *serr);
|
||||
|
||||
/* computes attributes of a lunar eclipse for given tjd */
|
||||
ext_def (int32) swe_lun_eclipse_how(
|
||||
double tjd_ut,
|
||||
int32 ifl,
|
||||
double *geopos,
|
||||
double *attr,
|
||||
char *serr);
|
||||
ext_def(int32) swe_lun_eclipse_how(double tjd_ut, int32 ifl,
|
||||
double *geopos, double *attr,
|
||||
char *serr);
|
||||
|
||||
ext_def (int32) swe_lun_eclipse_when(double tjd_start, int32 ifl, int32 ifltype,
|
||||
double *tret, int32 backward, char *serr);
|
||||
ext_def(int32) swe_lun_eclipse_when(double tjd_start, int32 ifl,
|
||||
int32 ifltype, double *tret,
|
||||
int32 backward, char *serr);
|
||||
|
||||
/* planetary phenomena */
|
||||
ext_def (int32) swe_pheno(double tjd, int32 ipl, int32 iflag, double *attr, char *serr);
|
||||
|
||||
ext_def(int32) swe_pheno_ut(double tjd_ut, int32 ipl, int32 iflag, double *attr, char *serr);
|
||||
ext_def(int32) swe_pheno(double tjd, int32 ipl, int32 iflag,
|
||||
double *attr, char *serr);
|
||||
|
||||
ext_def (double) swe_refrac(double inalt, double atpress, double attemp, int32 calc_flag);
|
||||
ext_def(int32) swe_pheno_ut(double tjd_ut, int32 ipl, int32 iflag,
|
||||
double *attr, char *serr);
|
||||
|
||||
ext_def (double) swe_refrac_extended(double inalt, double geoalt, double atpress, double attemp, double lapse_rate, int32 calc_flag, double *dret);
|
||||
ext_def(double) swe_refrac(double inalt, double atpress, double attemp,
|
||||
int32 calc_flag);
|
||||
|
||||
ext_def (void) swe_set_lapse_rate(double lapse_rate);
|
||||
ext_def(double) swe_refrac_extended(double inalt, double geoalt,
|
||||
double atpress, double attemp,
|
||||
double lapse_rate, int32 calc_flag,
|
||||
double *dret);
|
||||
|
||||
ext_def (void) swe_azalt(
|
||||
double tjd_ut,
|
||||
int32 calc_flag,
|
||||
double *geopos,
|
||||
double atpress,
|
||||
double attemp,
|
||||
double *xin,
|
||||
double *xaz);
|
||||
ext_def(void) swe_set_lapse_rate(double lapse_rate);
|
||||
|
||||
ext_def (void) swe_azalt_rev(
|
||||
double tjd_ut,
|
||||
int32 calc_flag,
|
||||
double *geopos,
|
||||
double *xin,
|
||||
double *xout);
|
||||
ext_def(void) swe_azalt(double tjd_ut, int32 calc_flag, double *geopos,
|
||||
double atpress, double attemp, double *xin,
|
||||
double *xaz);
|
||||
|
||||
ext_def (int32) swe_rise_trans_true_hor(
|
||||
double tjd_ut, int32 ipl, char *starname,
|
||||
int32 epheflag, int32 rsmi,
|
||||
double *geopos,
|
||||
double atpress, double attemp,
|
||||
double horhgt,
|
||||
double *tret,
|
||||
char *serr);
|
||||
ext_def(void) swe_azalt_rev(double tjd_ut, int32 calc_flag,
|
||||
double *geopos, double *xin, double *xout);
|
||||
|
||||
ext_def (int32) swe_rise_trans(
|
||||
double tjd_ut, int32 ipl, char *starname,
|
||||
int32 epheflag, int32 rsmi,
|
||||
double *geopos,
|
||||
double atpress, double attemp,
|
||||
double *tret,
|
||||
char *serr);
|
||||
ext_def(int32) swe_rise_trans_true_hor(double tjd_ut, int32 ipl,
|
||||
char *starname, int32 epheflag,
|
||||
int32 rsmi, double *geopos,
|
||||
double atpress, double attemp,
|
||||
double horhgt, double *tret,
|
||||
char *serr);
|
||||
|
||||
ext_def (int32) swe_nod_aps(double tjd_et, int32 ipl, int32 iflag,
|
||||
int32 method,
|
||||
double *xnasc, double *xndsc,
|
||||
double *xperi, double *xaphe,
|
||||
char *serr);
|
||||
ext_def(int32) swe_rise_trans(double tjd_ut, int32 ipl, char *starname,
|
||||
int32 epheflag, int32 rsmi,
|
||||
double *geopos, double atpress,
|
||||
double attemp, double *tret, char *serr);
|
||||
|
||||
ext_def (int32) swe_nod_aps_ut(double tjd_ut, int32 ipl, int32 iflag,
|
||||
int32 method,
|
||||
double *xnasc, double *xndsc,
|
||||
double *xperi, double *xaphe,
|
||||
char *serr);
|
||||
ext_def(int32) swe_nod_aps(double tjd_et, int32 ipl, int32 iflag,
|
||||
int32 method, double *xnasc, double *xndsc,
|
||||
double *xperi, double *xaphe, char *serr);
|
||||
|
||||
ext_def(int32) swe_nod_aps_ut(double tjd_ut, int32 ipl, int32 iflag,
|
||||
int32 method, double *xnasc,
|
||||
double *xndsc, double *xperi,
|
||||
double *xaphe, char *serr);
|
||||
|
||||
|
||||
/****************************
|
||||
@ -710,29 +735,31 @@ ext_def (int32) swe_nod_aps_ut(double tjd_ut, int32 ipl, int32 iflag,
|
||||
****************************/
|
||||
|
||||
/* delta t */
|
||||
ext_def( double ) swe_deltat(double tjd);
|
||||
ext_def(double) swe_deltat(double tjd);
|
||||
|
||||
/* equation of time */
|
||||
ext_def( int ) swe_time_equ(double tjd, double *te, char *serr);
|
||||
ext_def(int) swe_time_equ(double tjd, double *te, char *serr);
|
||||
|
||||
/* sidereal time */
|
||||
ext_def( double ) swe_sidtime0(double tjd_ut, double eps, double nut);
|
||||
ext_def( double ) swe_sidtime(double tjd_ut);
|
||||
ext_def(double) swe_sidtime0(double tjd_ut, double eps, double nut);
|
||||
ext_def(double) swe_sidtime(double tjd_ut);
|
||||
|
||||
/* coordinate transformation polar -> polar */
|
||||
ext_def( void ) swe_cotrans(double *xpo, double *xpn, double eps);
|
||||
ext_def( void ) swe_cotrans_sp(double *xpo, double *xpn, double eps);
|
||||
ext_def(void) swe_cotrans(double *xpo, double *xpn, double eps);
|
||||
ext_def(void) swe_cotrans_sp(double *xpo, double *xpn, double eps);
|
||||
|
||||
/* tidal acceleration to be used in swe_deltat() */
|
||||
ext_def( double ) swe_get_tid_acc(void);
|
||||
ext_def( void ) swe_set_tid_acc(double t_acc);
|
||||
ext_def(double) swe_get_tid_acc(void);
|
||||
ext_def(void) swe_set_tid_acc(double t_acc);
|
||||
|
||||
ext_def( double ) swe_degnorm(double x);
|
||||
ext_def( double ) swe_radnorm(double x);
|
||||
ext_def( double ) swe_rad_midp(double x1, double x0);
|
||||
ext_def( double ) swe_deg_midp(double x1, double x0);
|
||||
ext_def(double) swe_degnorm(double x);
|
||||
ext_def(double) swe_radnorm(double x);
|
||||
ext_def(double) swe_rad_midp(double x1, double x0);
|
||||
ext_def(double) swe_deg_midp(double x1, double x0);
|
||||
|
||||
ext_def( void ) swe_split_deg(double ddeg, int32 roundflag, int32 *ideg, int32 *imin, int32 *isec, double *dsecfr, int32 *isgn);
|
||||
ext_def(void) swe_split_deg(double ddeg, int32 roundflag, int32 * ideg,
|
||||
int32 * imin, int32 * isec, double *dsecfr,
|
||||
int32 * isgn);
|
||||
|
||||
/*******************************************************
|
||||
* other functions from swephlib.c;
|
||||
@ -741,38 +768,40 @@ ext_def( void ) swe_split_deg(double ddeg, int32 roundflag, int32 *ideg, int32 *
|
||||
********************************************************/
|
||||
|
||||
/* normalize argument into interval [0..DEG360] */
|
||||
ext_def( centisec ) swe_csnorm(centisec p);
|
||||
ext_def(centisec) swe_csnorm(centisec p);
|
||||
|
||||
/* distance in centisecs p1 - p2 normalized to [0..360[ */
|
||||
ext_def( centisec ) swe_difcsn (centisec p1, centisec p2);
|
||||
ext_def(centisec) swe_difcsn(centisec p1, centisec p2);
|
||||
|
||||
ext_def( double ) swe_difdegn (double p1, double p2);
|
||||
ext_def(double) swe_difdegn(double p1, double p2);
|
||||
|
||||
/* distance in centisecs p1 - p2 normalized to [-180..180[ */
|
||||
ext_def( centisec ) swe_difcs2n(centisec p1, centisec p2);
|
||||
ext_def(centisec) swe_difcs2n(centisec p1, centisec p2);
|
||||
|
||||
ext_def( double ) swe_difdeg2n(double p1, double p2);
|
||||
ext_def( double ) swe_difrad2n(double p1, double p2);
|
||||
ext_def(double) swe_difdeg2n(double p1, double p2);
|
||||
ext_def(double) swe_difrad2n(double p1, double p2);
|
||||
|
||||
/* round second, but at 29.5959 always down */
|
||||
ext_def( centisec ) swe_csroundsec(centisec x);
|
||||
ext_def(centisec) swe_csroundsec(centisec x);
|
||||
|
||||
/* double to int32 with rounding, no overflow check */
|
||||
ext_def( int32 ) swe_d2l(double x);
|
||||
ext_def(int32) swe_d2l(double x);
|
||||
|
||||
/* monday = 0, ... sunday = 6 */
|
||||
ext_def( int ) swe_day_of_week(double jd);
|
||||
ext_def(int) swe_day_of_week(double jd);
|
||||
|
||||
ext_def( char *) swe_cs2timestr(CSEC t, int sep, AS_BOOL suppressZero, char *a);
|
||||
ext_def(char *) swe_cs2timestr(CSEC t, int sep, AS_BOOL suppressZero,
|
||||
char *a);
|
||||
|
||||
ext_def( char *) swe_cs2lonlatstr(CSEC t, char pchar, char mchar, char *s);
|
||||
ext_def(char *) swe_cs2lonlatstr(CSEC t, char pchar, char mchar,
|
||||
char *s);
|
||||
|
||||
ext_def( char *) swe_cs2degstr(CSEC t, char *a);
|
||||
ext_def(char *) swe_cs2degstr(CSEC t, char *a);
|
||||
|
||||
#endif /* #ifndef _SWEDLL_H */
|
||||
#endif /* #ifndef _SWEDLL_H */
|
||||
|
||||
#endif /* #ifndef _SWEPHEXP_INCLUDED */
|
||||
#endif /* #ifndef _SWEPHEXP_INCLUDED */
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern C */
|
||||
} /* extern C */
|
||||
#endif
|
||||
|
4031
swe/src/swephlib.c
4031
swe/src/swephlib.c
File diff suppressed because it is too large
Load Diff
@ -5,6 +5,7 @@
|
||||
Authors: Dieter Koch and Alois Treindl, Astrodienst Zurich
|
||||
|
||||
************************************************************/
|
||||
|
||||
/* Copyright (C) 1997 - 2008 Astrodienst AG, Switzerland. All rights reserved.
|
||||
|
||||
License conditions
|
||||
@ -67,57 +68,63 @@
|
||||
/* Precession coefficients for remote past and future.
|
||||
* One of the following four defines must be true.
|
||||
*/
|
||||
#define PREC_VONDRAK_2011 TRUE
|
||||
#define PREC_WILLIAMS_1994 FALSE
|
||||
#define PREC_VONDRAK_2011 TRUE
|
||||
#define PREC_WILLIAMS_1994 FALSE
|
||||
#define PREC_SIMON_1994 FALSE
|
||||
#define PREC_LASKAR_1986 FALSE
|
||||
#define PREC_BRETAGNON_2003 FALSE
|
||||
#define PREC_BRETAGNON_2003 FALSE
|
||||
|
||||
/* IAU precession 1976 or 2003 for recent centuries.
|
||||
* only one of the following two defines may be TRUE */
|
||||
#define PREC_IAU_1976 FALSE
|
||||
#define PREC_IAU_2003 FALSE /* precession model P03 */
|
||||
#define PREC_IAU_1976_CTIES 2.0 /* J2000 +/- two centuries */
|
||||
#define PREC_IAU_1976 FALSE
|
||||
#define PREC_IAU_2003 FALSE /* precession model P03 */
|
||||
#define PREC_IAU_1976_CTIES 2.0 /* J2000 +/- two centuries */
|
||||
|
||||
/* we use P03 for whole ephemeris */
|
||||
#define PREC_IAU_2003_CTIES 75.0 /* J2000 +/- 75 centuries */
|
||||
#define PREC_IAU_2003_CTIES 75.0 /* J2000 +/- 75 centuries */
|
||||
|
||||
/* choose between the following nutation models */
|
||||
#define NUT_IAU_1980 FALSE
|
||||
#define NUT_IAU_2000A FALSE /* very time consuming ! */
|
||||
#define NUT_IAU_2000B TRUE /* fast, but precision of milli-arcsec */
|
||||
|
||||
#define NUT_IAU_2000A FALSE /* very time consuming ! */
|
||||
#define NUT_IAU_2000B TRUE /* fast, but precision of milli-arcsec */
|
||||
|
||||
/* coordinate transformation */
|
||||
extern void swi_coortrf(double *xpo, double *xpn, double eps);
|
||||
|
||||
/* coordinate transformation */
|
||||
extern void swi_coortrf2(double *xpo, double *xpn, double sineps, double coseps);
|
||||
extern void swi_coortrf2(double *xpo, double *xpn, double sineps,
|
||||
double coseps);
|
||||
|
||||
/* cartesian to polar coordinates */
|
||||
extern void swi_cartpol(double *x, double *l);
|
||||
|
||||
|
||||
/* cartesian to polar coordinates with velocity */
|
||||
extern void swi_cartpol_sp(double *x, double *l);
|
||||
extern void swi_polcart_sp(double *l, double *x);
|
||||
|
||||
|
||||
/* polar to cartesian coordinates */
|
||||
extern void swi_polcart(double *l, double *x);
|
||||
|
||||
/* GCRS to J2000 */
|
||||
extern void swi_bias(double *x, int32 iflag, AS_BOOL backward);
|
||||
|
||||
/* GCRS to FK5 */
|
||||
extern void swi_icrs2fk5(double *x, int32 iflag, AS_BOOL backward);
|
||||
|
||||
/* precession */
|
||||
extern int swi_precess(double *R, double J, int direction );
|
||||
extern int swi_precess(double *R, double J, int direction);
|
||||
extern void swi_precess_speed(double *xx, double t, int direction);
|
||||
|
||||
/* from sweph.c, light deflection, aberration, etc. */
|
||||
extern void swi_deflect_light(double *xx, double dt, int32 iflag);
|
||||
extern void swi_aberr_light(double *xx, double *xe, int32 iflag);
|
||||
extern int swi_plan_for_osc_elem(int32 iflag, double tjd, double *xx);
|
||||
extern int swi_trop_ra2sid_lon(double *xin, double *xout, double *xoutr, int32 iflag, char *serr);
|
||||
extern int swi_trop_ra2sid_lon_sosy(double *xin, double *xout, double *xoutr, int32 iflag, char *serr);
|
||||
extern int swi_get_observer(double tjd, int32 iflag,
|
||||
AS_BOOL do_save, double *xobs, char *serr);
|
||||
extern int swi_trop_ra2sid_lon(double *xin, double *xout, double *xoutr,
|
||||
int32 iflag, char *serr);
|
||||
extern int swi_trop_ra2sid_lon_sosy(double *xin, double *xout, double *xoutr,
|
||||
int32 iflag, char *serr);
|
||||
extern int swi_get_observer(double tjd, int32 iflag, AS_BOOL do_save,
|
||||
double *xobs, char *serr);
|
||||
extern void swi_force_app_pos_etc();
|
||||
|
||||
/* obliquity of ecliptic */
|
||||
@ -130,9 +137,9 @@ extern void swi_check_nutation(double tjd, int32 iflag);
|
||||
extern int swi_nutation(double J, double *nutlo);
|
||||
extern void swi_nutate(double *xx, int32 iflag, AS_BOOL backward);
|
||||
|
||||
extern void swi_mean_lunar_elements(double tjd,
|
||||
double *node, double *dnode,
|
||||
double *peri, double *dperi);
|
||||
extern void swi_mean_lunar_elements(double tjd, double *node, double *dnode,
|
||||
double *peri, double *dperi);
|
||||
|
||||
/* */
|
||||
extern double swi_mod2PI(double x);
|
||||
|
||||
@ -142,6 +149,7 @@ extern double swi_edcheb(double x, double *coef, int ncf);
|
||||
|
||||
/* cross product of vectors */
|
||||
extern void swi_cross_prod(double *a, double *b, double *x);
|
||||
|
||||
/* dot product of vecotrs */
|
||||
extern double swi_dot_prod_unit(double *x, double *y);
|
||||
|
||||
@ -166,14 +174,14 @@ extern char *swi_strcpy(char *to, char *from);
|
||||
extern char *swi_strncpy(char *to, char *from, size_t n);
|
||||
|
||||
#ifdef TRACE
|
||||
# define TRACE_COUNT_MAX 10000
|
||||
extern FILE *swi_fp_trace_c;
|
||||
extern FILE *swi_fp_trace_out;
|
||||
extern void swi_open_trace(char *serr);
|
||||
extern int32 swi_trace_count;
|
||||
static char *fname_trace_c = "swetrace.c";
|
||||
static char *fname_trace_out = "swetrace.txt";
|
||||
#define TRACE_COUNT_MAX 10000
|
||||
extern FILE *swi_fp_trace_c;
|
||||
extern FILE *swi_fp_trace_out;
|
||||
extern void swi_open_trace(char *serr);
|
||||
extern int32 swi_trace_count;
|
||||
static char *fname_trace_c = "swetrace.c";
|
||||
static char *fname_trace_out = "swetrace.txt";
|
||||
#ifdef FORCE_IFLAG
|
||||
static char *fname_force_flg = "force.flg";
|
||||
static char *fname_force_flg = "force.flg";
|
||||
#endif
|
||||
#endif /* TRACE */
|
||||
|
Loading…
Reference in New Issue
Block a user