Update Swiss Ephemeris to 2.0

This commit is contained in:
Gergely Polonkai 2014-05-21 17:04:54 +02:00
parent 26dcd74338
commit 45833584b7
29 changed files with 31105 additions and 31926 deletions

View File

@ -3,6 +3,9 @@ m4_define([swe_glib_minor_version], [0])
m4_define([swe_glib_micro_version], [3]) m4_define([swe_glib_micro_version], [3])
m4_define([swe_glib_version], [swe_glib_major_version.swe_glib_minor_version.swe_glib_micro_version]) m4_define([swe_glib_version], [swe_glib_major_version.swe_glib_minor_version.swe_glib_micro_version])
m4_define([swe_glib_api_version], [swe_glib_major_version.0]) m4_define([swe_glib_api_version], [swe_glib_major_version.0])
m4_define([swe_major_version], [2])
m4_define([swe_minor_version], [0])
m4_define([swe_version], [swe_major_version.swe_minor_version])
AC_INIT([SWE-GLib], [swe_glib_version], [gergely@polonkai.eu], [swe-glib]) AC_INIT([SWE-GLib], [swe_glib_version], [gergely@polonkai.eu], [swe-glib])
AM_INIT_AUTOMAKE([-Wall foreign]) AM_INIT_AUTOMAKE([-Wall foreign])
@ -26,6 +29,7 @@ AC_SUBST([SWE_GLIB_MICRO_VERSION], [swe_glib_micro_version])
AC_SUBST([SWE_GLIB_VERSION], [swe_glib_version]) AC_SUBST([SWE_GLIB_VERSION], [swe_glib_version])
AC_SUBST([SWE_GLIB_API_VERSION], [swe_glib_api_version]) AC_SUBST([SWE_GLIB_API_VERSION], [swe_glib_api_version])
AC_SUBST([SWE_GLIB_API_VERSION_U], [AS_TR_SH([swe_glib_api_version])]) AC_SUBST([SWE_GLIB_API_VERSION_U], [AS_TR_SH([swe_glib_api_version])])
AC_SUBST([SWE_VERSION], [swe_version])
AC_PROG_CC AC_PROG_CC
AM_PROG_CC_C_O AM_PROG_CC_C_O
@ -68,7 +72,7 @@ PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.32.0])
PKG_CHECK_MODULES([GOBJECT], [gobject-2.0 >= 2.32.0]) PKG_CHECK_MODULES([GOBJECT], [gobject-2.0 >= 2.32.0])
AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_MACRO_DIR([m4])
LIBSWE_LIBS='$(top_builddir)/swe/src/libswe-1.76.la' LIBSWE_LIBS='$(top_builddir)/swe/src/libswe-$(SWE_VERSION).la'
AC_SUBST(LIBSWE_LIBS) AC_SUBST(LIBSWE_LIBS)
LIBSWE_GLIB_LIBS='$(top_builddir)/src/libswe-glib-$(SWE_GLIB_API_VERSION).la' LIBSWE_GLIB_LIBS='$(top_builddir)/src/libswe-glib-$(SWE_GLIB_API_VERSION).la'

View File

@ -70,7 +70,7 @@ rm -f $RPM_BUILD_ROOT%{_datadir}/locale/hu/LC_MESSAGES/swe-glib.mo
%files %files
%doc ChangeLog %doc ChangeLog
%{_libdir}/libswe-1.76.so.* %{_libdir}/libswe-@SWE_VERSION@.so.*
%{_libdir}/libswe-glib-@SWE_GLIB_API_VERSION@.so.* %{_libdir}/libswe-glib-@SWE_GLIB_API_VERSION@.so.*
%{_libdir}/girepository-1.0/SweGlib-@SWE_GLIB_API_VERSION@.typelib %{_libdir}/girepository-1.0/SweGlib-@SWE_GLIB_API_VERSION@.typelib
@ -84,7 +84,7 @@ rm -f $RPM_BUILD_ROOT%{_datadir}/locale/hu/LC_MESSAGES/swe-glib.mo
%{_includedir}/* %{_includedir}/*
%{_libdir}/pkgconfig/* %{_libdir}/pkgconfig/*
%{_datadir}/gir-1.0/SweGlib-@SWE_GLIB_API_VERSION@.gir %{_datadir}/gir-1.0/SweGlib-@SWE_GLIB_API_VERSION@.gir
%{_libdir}/libswe-1.76.so %{_libdir}/libswe-@SWE_VERSION@.so
%{_libdir}/libswe-glib-@SWE_GLIB_API_VERSION@.so %{_libdir}/libswe-glib-@SWE_GLIB_API_VERSION@.so
%{_datadir}/vala/vapi/SweGlib-@SWE_GLIB_API_VERSION@.vapi %{_datadir}/vala/vapi/SweGlib-@SWE_GLIB_API_VERSION@.vapi

View File

@ -1,6 +1,5 @@
This directory contains version 1.76 of the Swiss Ephemeris programming This directory contains version 2.0 of the Swiss Ephemeris programming library
library in a reduced form, so it can be used in an Autotools project like in a reduced form, so it can be used in an Autotools project like Astrognome.
Astrognome.
If you need the full version, you can download it from If you need the full version, you can download it from
ftp://ftp.astro.com/pub/swisseph/ (as of July, 2013) ftp://ftp.astro.com/pub/swisseph/ (as of July, 2013)

Binary file not shown.

Binary file not shown.

View File

@ -1,7 +1,7 @@
lib_LTLIBRARIES = libswe-1.76.la lib_LTLIBRARIES = libswe-2.0.la
libswe_1_76_la_SOURCES = swedate.c swehouse.c swejpl.c swemmoon.c swemplan.c swepcalc.c sweph.c swepdate.c swephlib.c swecl.c swehel.c libswe_2_0_la_SOURCES = swedate.c swehouse.c swejpl.c swemmoon.c swemplan.c swepcalc.c sweph.c swepdate.c swephlib.c swecl.c swehel.c
libswe_1_76_la_CFLAGS = $(CFLAGS) -Wall libswe_2_0_la_CFLAGS = $(CFLAGS) -Wall
libswe_1_76_la_LIBADD = $(LIBS) libswe_2_0_la_LIBADD = $(LIBS)
EXTRA_DIST = \ EXTRA_DIST = \
LICENSE \ LICENSE \

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,3 @@
/********************************************************* /*********************************************************
$Header: /home/dieter/sweph/RCS/swedate.c,v 1.75 2009/04/08 07:17:29 dieter Exp $ $Header: /home/dieter/sweph/RCS/swedate.c,v 1.75 2009/04/08 07:17:29 dieter Exp $
version 15-feb-89 16:30 version 15-feb-89 16:30
@ -8,7 +7,6 @@
swe_julday() swe_julday()
************************************************************/ ************************************************************/
/* Copyright (C) 1997 - 2008 Astrodienst AG, Switzerland. All rights reserved. /* Copyright (C) 1997 - 2008 Astrodienst AG, Switzerland. All rights reserved.
License conditions License conditions
@ -85,34 +83,34 @@
Return: OK or ERR (for illegal date) Return: OK or ERR (for illegal date)
*********************************************************/ *********************************************************/
#include "swephexp.h" # include "swephexp.h"
#include "sweph.h" # include "sweph.h"
static AS_BOOL init_leapseconds_done = FALSE; static AS_BOOL init_leapseconds_done = FALSE;
int FAR PASCAL_CONV int FAR PASCAL_CONV swe_date_conversion(int y,
swe_date_conversion(int y, int m, int d, /* day, month, year */ int m,
double uttime, /* UT in hours (decimal) */ int d, /* day, month, year */
char c, /* calendar g[regorian]|j[ulian] */ double uttime, /* UT in hours (decimal) */
double *tjd) char c, /* calendar g[regorian]|j[ulian] */
double *tjd)
{ {
int rday, rmon, ryear; int rday, rmon, ryear;
double rut, jd; double rut, jd;
int gregflag = SE_JUL_CAL; int gregflag = SE_JUL_CAL;
if (c == 'g') if (c == 'g')
gregflag = SE_GREG_CAL; gregflag = SE_GREG_CAL;
rut = uttime; /* hours UT */ rut = uttime; /* hours UT */
jd = swe_julday(y, m, d, rut, gregflag); jd = swe_julday(y, m, d, rut, gregflag);
swe_revjul(jd, gregflag, &ryear, &rmon, &rday, &rut); swe_revjul(jd, gregflag, &ryear, &rmon, &rday, &rut);
*tjd = jd; *tjd = jd;
if (rmon == m && rday == d && ryear == y) { if (rmon == m && rday == d && ryear == y) {
return OK; return OK;
} } else {
else { return ERR;
return ERR; }
} } /* end date_conversion */
} /* end date_conversion */
/*************** swe_julday ******************************************** /*************** swe_julday ********************************************
* This function returns the absolute Julian day number (JD) * This function returns the absolute Julian day number (JD)
@ -163,31 +161,26 @@ swe_date_conversion(int y, int m, int d, /* day, month, year */
and notifies errors like 32 January. and notifies errors like 32 January.
****************************************************************/ ****************************************************************/
double FAR PASCAL_CONV double FAR PASCAL_CONV swe_julday(int year, int month, int day, double hour, int gregflag)
swe_julday(int year, int month, int day, double hour, int gregflag)
{ {
double jd; double jd;
double u, u0, u1, u2; double u,u0,u1,u2;
u = year; u = year;
if (month < 3) if (month < 3) u -=1;
u -= 1; u0 = u + 4712.0;
u0 = u + 4712.0; u1 = month + 1.0;
u1 = month + 1.0; if (u1 < 4) u1 += 12.0;
if (u1 < 4) jd = floor(u0*365.25)
u1 += 12.0; + floor(30.6*u1+0.000001)
jd = floor(u0 * 365.25) + day + hour/24.0 - 63.5;
+ floor(30.6 * u1 + 0.000001) if (gregflag == SE_GREG_CAL) {
+ day + hour / 24.0 - 63.5; u2 = floor(fabs(u) / 100) - floor(fabs(u) / 400);
if (gregflag == SE_GREG_CAL) { if (u < 0.0) u2 = -u2;
u2 = floor(fabs(u) / 100) - floor(fabs(u) / 400); jd = jd - u2 + 2;
if (u < 0.0) if ((u < 0.0) && (u/100 == floor(u/100)) && (u/400 != floor(u/400)))
u2 = -u2; jd -=1;
jd = jd - u2 + 2; }
if ((u < 0.0) && (u / 100 == floor(u / 100)) return jd;
&& (u / 400 != floor(u / 400)))
jd -= 1;
}
return jd;
} }
/*** swe_revjul ****************************************************** /*** swe_revjul ******************************************************
@ -209,27 +202,24 @@ swe_julday(int year, int month, int day, double hour, int gregflag)
Original author Mark Pottenger, Los Angeles. Original author Mark Pottenger, Los Angeles.
with bug fix for year < -4711 16-aug-88 Alois Treindl with bug fix for year < -4711 16-aug-88 Alois Treindl
*************************************************************************/ *************************************************************************/
void FAR PASCAL_CONV void FAR PASCAL_CONV swe_revjul (double jd, int gregflag,
swe_revjul(double jd, int gregflag, int *jyear, int *jmon, int *jday, int *jyear, int *jmon, int *jday, double *jut)
double *jut)
{ {
double u0, u1, u2, u3, u4; double u0,u1,u2,u3,u4;
u0 = jd + 32082.5; u0 = jd + 32082.5;
if (gregflag == SE_GREG_CAL) { if (gregflag == SE_GREG_CAL) {
u1 = u0 + floor(u0 / 36525.0) - floor(u0 / 146100.0) - 38.0; u1 = u0 + floor (u0/36525.0) - floor (u0/146100.0) - 38.0;
if (jd >= 1830691.5) if (jd >= 1830691.5) u1 +=1;
u1 += 1; u0 = u0 + floor (u1/36525.0) - floor (u1/146100.0) - 38.0;
u0 = u0 + floor(u1 / 36525.0) - floor(u1 / 146100.0) - 38.0; }
} u2 = floor (u0 + 123.0);
u2 = floor(u0 + 123.0); u3 = floor ( (u2 - 122.2) / 365.25);
u3 = floor((u2 - 122.2) / 365.25); u4 = floor ( (u2 - floor (365.25 * u3) ) / 30.6001);
u4 = floor((u2 - floor(365.25 * u3)) / 30.6001); *jmon = (int) (u4 - 1.0);
*jmon = (int)(u4 - 1.0); if (*jmon > 12) *jmon -= 12;
if (*jmon > 12) *jday = (int) (u2 - floor (365.25 * u3) - floor (30.6001 * u4));
*jmon -= 12; *jyear = (int) (u3 + floor ( (u4 - 2.0) / 12.0) - 4800);
*jday = (int)(u2 - floor(365.25 * u3) - floor(30.6001 * u4)); *jut = (jd - floor (jd + 0.5) + 0.5) * 24.0;
*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 /* transform local time to UTC or UTC to local time
@ -246,37 +236,39 @@ swe_revjul(double jd, int gregflag, int *jyear, int *jmon, int *jday,
* For conversion from local time to utc, use +d_timezone. * For conversion from local time to utc, use +d_timezone.
* For conversion from utc to local time, use -d_timezone. * For conversion from utc to local time, use -d_timezone.
*/ */
void FAR PASCAL_CONV void FAR PASCAL_CONV swe_utc_time_zone(
swe_utc_time_zone(int32 iyear, int32 imonth, int32 iday, int32 ihour, int32 iyear, int32 imonth, int32 iday,
int32 imin, double dsec, double d_timezone, int32 ihour, int32 imin, double dsec,
int32 * iyear_out, int32 * imonth_out, int32 * iday_out, double d_timezone,
int32 * ihour_out, int32 * imin_out, double *dsec_out) int32 *iyear_out, int32 *imonth_out, int32 *iday_out,
int32 *ihour_out, int32 *imin_out, double *dsec_out
)
{ {
double tjd, d; double tjd, d;
AS_BOOL have_leapsec = FALSE; AS_BOOL have_leapsec = FALSE;
double dhour; double dhour;
if (dsec >= 60.0) { if (dsec >= 60.0) {
have_leapsec = TRUE; have_leapsec = TRUE;
dsec -= 1.0; dsec -= 1.0;
} }
dhour = ((double)ihour) + ((double)imin) / 60.0 + dsec / 3600.0; dhour = ((double) ihour) + ((double) imin) / 60.0 + dsec / 3600.0;
tjd = swe_julday(iyear, imonth, iday, 0, SE_GREG_CAL); tjd = swe_julday(iyear, imonth, iday, 0, SE_GREG_CAL);
dhour -= d_timezone; dhour -= d_timezone;
if (dhour < 0.0) { if (dhour < 0.0) {
tjd -= 1.0; tjd -= 1.0;
dhour += 24.0; dhour += 24.0;
} }
if (dhour >= 24.0) { if (dhour >= 24.0) {
tjd += 1.0; tjd += 1.0;
dhour -= 24.0; dhour -= 24.0;
} }
swe_revjul(tjd + 0.001, SE_GREG_CAL, iyear_out, imonth_out, iday_out, &d); swe_revjul(tjd + 0.001, SE_GREG_CAL, iyear_out, imonth_out, iday_out, &d);
*ihour_out = (int)dhour; *ihour_out = (int) dhour;
d = (dhour - (double)*ihour_out) * 60; d = (dhour - (double) *ihour_out) * 60;
*imin_out = (int)d; *imin_out = (int) d;
*dsec_out = (d - (double)*imin_out) * 60; *dsec_out = (d - (double) *imin_out) * 60;
if (have_leapsec) if (have_leapsec)
*dsec_out += 1.0; *dsec_out += 1.0;
} }
/* /*
@ -287,85 +279,80 @@ swe_utc_time_zone(int32 iyear, int32 imonth, int32 iday, int32 ihour,
#define NLEAP_SECONDS 24 #define NLEAP_SECONDS 24
#define NLEAP_SECONDS_SPACE 100 #define NLEAP_SECONDS_SPACE 100
static int leap_seconds[NLEAP_SECONDS_SPACE] = { static int leap_seconds[NLEAP_SECONDS_SPACE] = {
19720630, 19720630,
19721231, 19721231,
19731231, 19731231,
19741231, 19741231,
19751231, 19751231,
19761231, 19761231,
19771231, 19771231,
19781231, 19781231,
19791231, 19791231,
19810630, 19810630,
19820630, 19820630,
19830630, 19830630,
19850630, 19850630,
19871231, 19871231,
19891231, 19891231,
19901231, 19901231,
19920630, 19920630,
19930630, 19930630,
19940630, 19940630,
19951231, 19951231,
19970630, 19970630,
19981231, 19981231,
20051231, 20051231,
20081231, 20081231,
0 /* keep this 0 as end mark */ 0 /* keep this 0 as end mark */
}; };
#define J1972 2441317.5 #define J1972 2441317.5
#define NLEAP_INIT 10 #define NLEAP_INIT 10
/* Read additional leap second dates from external file, if given. /* Read additional leap second dates from external file, if given.
*/ */
static int static int init_leapsec(void)
init_leapsec(void)
{ {
FILE *fp; FILE *fp;
int ndat, ndat_last; int ndat, ndat_last;
int tabsiz = 0; int tabsiz = 0;
int i; int i;
char s[AS_MAXCH]; char s[AS_MAXCH];
char *sp; char *sp;
if (!init_leapseconds_done) { if (!init_leapseconds_done) {
init_leapseconds_done = TRUE; init_leapseconds_done = TRUE;
tabsiz = NLEAP_SECONDS; tabsiz = NLEAP_SECONDS;
ndat_last = leap_seconds[NLEAP_SECONDS - 1]; ndat_last = leap_seconds[NLEAP_SECONDS - 1];
/* no error message if file is missing */ /* no error message if file is missing */
if ((fp = if ((fp = swi_fopen(-1, "seleapsec.txt", swed.ephepath, NULL)) == NULL)
swi_fopen(-1, "seleapsec.txt", swed.ephepath, NULL)) == NULL) return NLEAP_SECONDS;
return NLEAP_SECONDS; while(fgets(s, AS_MAXCH, fp) != NULL) {
while (fgets(s, AS_MAXCH, fp) != NULL) { sp = s;
sp = s; while (*sp == ' ' || *sp == '\t') sp++;
while (*sp == ' ' || *sp == '\t') sp++;
sp++; if (*sp == '#' || *sp == '\n')
sp++; continue;
if (*sp == '#' || *sp == '\n') ndat = atoi(s);
continue; if (ndat <= ndat_last)
ndat = atoi(s); continue;
if (ndat <= ndat_last) /* table space is limited. no error msg, if exceeded */
continue; if (tabsiz >= NLEAP_SECONDS_SPACE)
/* 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; return tabsiz;
leap_seconds[tabsiz] = ndat;
tabsiz++;
} }
/* find table size */ if (tabsiz > NLEAP_SECONDS) leap_seconds[tabsiz] = 0; /* end mark */
tabsiz = 0; fclose(fp);
for (i = 0; i < NLEAP_SECONDS_SPACE; i++) {
if (leap_seconds[i] == 0)
break;
else
tabsiz++;
}
return 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;
} }
/* /*
@ -387,103 +374,100 @@ init_leapsec(void)
* the leap seconds table (or the Swiss Ephemeris version) is not updated * the leap seconds table (or the Swiss Ephemeris version) is not updated
* for a long time. * for a long time.
*/ */
int32 FAR PASCAL_CONV 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)
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; double tjd_ut1, tjd_et, tjd_et_1972, dhour, d;
int iyear2, imonth2, iday2; int iyear2, imonth2, iday2;
int i, j, ndat, nleap, tabsiz_nleap; int i, j, ndat, nleap, tabsiz_nleap;
/* /*
* error handling: invalid iyear etc. * error handling: invalid iyear etc.
*/ */
tjd_ut1 = swe_julday(iyear, imonth, iday, 0, gregflag); tjd_ut1 = swe_julday(iyear, imonth, iday, 0, gregflag);
swe_revjul(tjd_ut1, gregflag, &iyear2, &imonth2, &iday2, &d); swe_revjul(tjd_ut1, gregflag, &iyear2, &imonth2, &iday2, &d);
if (iyear != iyear2 || imonth != imonth2 || iday != iday2) { if (iyear != iyear2 || imonth != imonth2 || iday != iday2) {
if (serr != NULL) if (serr != NULL)
sprintf(serr, "invalid date: year = %d, month = %d, day = %d", sprintf(serr, "invalid date: year = %d, month = %d, day = %d", iyear, imonth, iday);
iyear, imonth, iday); return ERR;
return ERR; }
} if (ihour < 0 || ihour > 23
if (ihour < 0 || ihour > 23 || imin < 0 || imin > 59 || dsec < 0 || imin < 0 || imin > 59
|| dsec >= 61 || (dsec >= 60 || dsec < 0 || dsec >= 61
&& (imin < 59 || ihour < 23 || tjd_ut1 < J1972))) { || (dsec >= 60 && (imin < 59 || ihour < 23 || tjd_ut1 < J1972))) {
if (serr != NULL) if (serr != NULL)
sprintf(serr, "invalid time: %d:%d:%.2f", ihour, imin, dsec); sprintf(serr, "invalid time: %d:%d:%.2f", ihour, imin, dsec);
return ERR; return ERR;
} }
dhour = (double)ihour + ((double)imin) / 60.0 + dsec / 3600.0; dhour = (double) ihour + ((double) imin) / 60.0 + dsec / 3600.0;
/* /*
* before 1972, we treat input date as UT1 * before 1972, we treat input date as UT1
*/ */
if (tjd_ut1 < J1972) { if (tjd_ut1 < J1972) {
dret[1] = swe_julday(iyear, imonth, iday, dhour, gregflag); dret[1] = swe_julday(iyear, imonth, iday, dhour, gregflag);
dret[0] = dret[1] + swe_deltat(dret[1]); 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;
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; 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;
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;
} }
/* /*
@ -500,92 +484,86 @@ swe_utc_to_jd(int32 iyear, int32 imonth, int32 iday, int32 ihour, int32 imin,
* the leap seconds table (or the Swiss Ephemeris version) has not been * the leap seconds table (or the Swiss Ephemeris version) has not been
* updated for a long time. * updated for a long time.
*/ */
void FAR PASCAL_CONV 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)
swe_jdet_to_utc(double tjd_et, int32 gregflag, int32 * iyear, int32 * imonth,
int32 * iday, int32 * ihour, int32 * imin, double *dsec)
{ {
int i; int i;
int second_60 = 0; int second_60 = 0;
int iyear2, imonth2, iday2, nleap, ndat, tabsiz_nleap; int iyear2, imonth2, iday2, nleap, ndat, tabsiz_nleap;
double d, tjd, tjd_et_1972, tjd_ut, dret[10]; double d, tjd, tjd_et_1972, tjd_ut, dret[10];
/* /*
* if tjd_et is before 1 jan 1972 UTC, return UT1 * if tjd_et is before 1 jan 1972 UTC, return UT1
*/ */
tjd_et_1972 = J1972 + (32.184 + NLEAP_INIT) / 86400.0; tjd_et_1972 = J1972 + (32.184 + NLEAP_INIT) / 86400.0;
d = swe_deltat(tjd_et); d = swe_deltat(tjd_et);
tjd_ut = tjd_et - swe_deltat(tjd_et - d); tjd_ut = tjd_et - swe_deltat(tjd_et - d);
if (tjd_et < tjd_et_1972) { if (tjd_et < tjd_et_1972) {
swe_revjul(tjd_ut, gregflag, iyear, imonth, iday, &d); 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;
}
}
/*
* 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; *ihour = (int32) d;
d -= (double)*ihour; d -= (double) *ihour;
d *= 60; d *= 60;
*imin = (int32) d; *imin = (int32) d;
*dsec = (d - (double)*imin) * 60.0 + second_60; *dsec = (d - (double) *imin) * 60.0;
/* return;
* 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? * minimum number of leap seconds since 1972; we may be missing one leap
* Check, if delta_t - nleap - 32.184 > 0.9 * second
*/ */
d = swe_deltat(tjd_et); tabsiz_nleap = init_leapsec();
d = swe_deltat(tjd_et - d); swe_revjul(tjd_ut-1, SE_GREG_CAL, &iyear2, &imonth2, &iday2, &d);
if (d * 86400.0 - (double)(nleap + NLEAP_INIT) - 32.184 >= 1.0) { ndat = iyear2 * 10000 + imonth2 * 100 + iday2;
swe_revjul(tjd_et - d, SE_GREG_CAL, iyear, imonth, iday, &d); nleap = 0;
*ihour = (int32) d; for (i = 0; i < tabsiz_nleap; i++) {
d -= (double)*ihour; if (ndat <= leap_seconds[i])
d *= 60; break;
*imin = (int32) d; nleap++;
*dsec = (d - (double)*imin) * 60.0; }
} /* date of potentially missing leapsecond */
if (gregflag == SE_JUL_CAL) { if (nleap < tabsiz_nleap) {
tjd = swe_julday(*iyear, *imonth, *iday, 0, SE_GREG_CAL); i = leap_seconds[nleap];
swe_revjul(tjd, gregflag, iyear, imonth, iday, &d); 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 *= 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);
*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);
}
} }
/* /*
@ -602,10 +580,8 @@ swe_jdet_to_utc(double tjd_et, int32 gregflag, int32 * iyear, int32 * imonth,
* the leap seconds table (or the Swiss Ephemeris version) has not been * the leap seconds table (or the Swiss Ephemeris version) has not been
* updated for a long time. * updated for a long time.
*/ */
void FAR PASCAL_CONV 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)
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); double tjd_et = tjd_ut + swe_deltat(tjd_ut);
swe_jdet_to_utc(tjd_et, gregflag, iyear, imonth, iday, ihour, imin, dsec); swe_jdet_to_utc(tjd_et, gregflag, iyear, imonth, iday, ihour, imin, dsec);
} }

View File

@ -1,4 +1,3 @@
/********************************************************* /*********************************************************
$Header: /home/dieter/sweph/RCS/swedate.h,v 1.74 2008/06/16 10:07:20 dieter Exp $ $Header: /home/dieter/sweph/RCS/swedate.h,v 1.74 2008/06/16 10:07:20 dieter Exp $
version 15-feb-89 16:30 version 15-feb-89 16:30
@ -59,27 +58,25 @@
*/ */
#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C" {
{
#endif #endif
#ifndef _SWEDLL_H #ifndef _SWEDLL_H
extern EXP32 int FAR PASCAL_CONV EXP16 swe_date_conversion(int y, int m, int d, /* year, month, day */ extern EXP32 int FAR PASCAL_CONV EXP16 swe_date_conversion (
double utime, /* universal time in hours (decimal) */ int y , int m , int d , /* year, month, day */
char c, /* calendar g[regorian]|j[ulian]|a[stro = greg] */ double utime, /* universal time in hours (decimal) */
double *tgmt); 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, extern EXP32 double *FAR PASCAL_CONV EXP16 swe_julday(
int day, int year, int month, int day, double hour,
double hour, int gregflag);
int gregflag);
extern EXP32 void FAR PASCAL_CONV EXP16 swe_revjul(double jd, extern EXP32 void FAR PASCAL_CONV EXP16 swe_revjul (
int gregflag, double jd,
int *jyear, int *jmon, int gregflag,
int *jday, int *jyear, int *jmon, int *jday, double *jut);
double *jut);
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus
} /* extern C */ } /* extern C */
#endif #endif

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,3 @@
/******************************************************* /*******************************************************
$Header: /home/dieter/sweph/RCS/swehouse.h,v 1.74 2008/06/16 10:07:20 dieter Exp $ $Header: /home/dieter/sweph/RCS/swehouse.h,v 1.74 2008/06/16 10:07:20 dieter Exp $
module swehouse.h module swehouse.h
@ -60,17 +59,16 @@ house and (simple) aspect calculation
for promoting such software, products or services. for promoting such software, products or services.
*/ */
struct houses struct houses {
{ double cusp[37];
double cusp[37]; double ac;
double ac; double mc;
double mc; double vertex;
double vertex; double equasc;
double equasc; double coasc1;
double coasc1; double coasc2;
double coasc2; double polasc;
double polasc; };
};
#define HOUSES struct houses #define HOUSES struct houses
#define VERY_SMALL 1E-10 #define VERY_SMALL 1E-10

File diff suppressed because it is too large Load Diff

View File

@ -1,17 +1,14 @@
/* /*
| $Header: /home/dieter/sweph/RCS/swejpl.h,v 1.74 2008/06/16 10:07:20 dieter Exp $ | $Header: /home/dieter/sweph/RCS/swejpl.h,v 1.74 2008/06/16 10:07:20 dieter Exp $
| |
| Subroutines for reading JPL ephemerides. | Subroutines for reading JPL ephemerides.
| derived from testeph.f as contained in DE403 distribution July 1995. | derived from testeph.f as contained in DE403 distribution July 1995.
| works with DE200, DE102, DE403, DE404, DE405, DE406 | works with DE200, DE102, DE403, DE404, DE405, DE406, DE431
| (attention, DE102 has 950 reference frame and also DE403 has slightly | (attention, these ephemerides do not have exactly the same reference frame)
| different reference frame from DE200).
Authors: Dieter Koch and Alois Treindl, Astrodienst Zurich Authors: Dieter Koch and Alois Treindl, Astrodienst Zurich
**************************************************************/ **************************************************************/
/* Copyright (C) 1997 - 2008 Astrodienst AG, Switzerland. All rights reserved. /* Copyright (C) 1997 - 2008 Astrodienst AG, Switzerland. All rights reserved.
License conditions License conditions
@ -69,8 +66,8 @@
#include "sweodef.h" #include "sweodef.h"
#define J_MERCURY 0 /* jpl body indices, modified by Alois */ #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_VENUS 1 /* now they start at 0 and not at 1 */
#define J_EARTH 2 #define J_EARTH 2
#define J_MARS 3 #define J_MARS 3
#define J_JUPITER 4 #define J_JUPITER 4
@ -91,8 +88,7 @@
* ntarg can be all of the above, ncent all except J_NUT and J_LIB. * ntarg can be all of the above, ncent all except J_NUT and J_LIB.
* Librations and Nutations are not affected by ncent. * Librations and Nutations are not affected by ncent.
*/ */
extern int swi_pleph(double et, int ntarg, int ncent, double *rrd, extern int swi_pleph(double et, int ntarg, int ncent, double *rrd, char *serr);
char *serr);
/* /*
* read the ephemeris constants. ss[0..2] returns start, end and granule size. * read the ephemeris constants. ss[0..2] returns start, end and granule size.
@ -100,9 +96,9 @@ extern int swi_pleph(double et, int ntarg, int ncent, double *rrd,
*/ */
extern void swi_close_jpl_file(void); extern void swi_close_jpl_file(void);
extern int swi_open_jpl_file(double *ss, char *fname, char *fpath, extern int swi_open_jpl_file(double *ss, char *fname, char *fpath, char *serr);
char *serr);
extern int32 swi_get_jpl_denum(void); extern int32 swi_get_jpl_denum(void);
extern void swi_IERS_FK5(double *xin, double *xout, int dir); extern void swi_IERS_FK5(double *xin, double *xout, int dir);

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,3 @@
/************************************************************ /************************************************************
$Header: /home/dieter/sweph/RCS/sweodef.h,v 1.74 2008/06/16 10:07:20 dieter Exp $ $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, definitions and constants for all Swiss Ephemeris source files,
@ -69,99 +68,99 @@
for promoting such software, products or services. for promoting such software, products or services.
*/ */
#ifndef _OURDEF_INCLUDED /* ourdef.h is a superset of sweodef.h */ #ifndef _OURDEF_INCLUDED /* ourdef.h is a superset of sweodef.h */
#ifndef _SWEODEF_INCLUDED /* allow multiple #includes */ #ifndef _SWEODEF_INCLUDED /* allow multiple #includes */
#define _SWEODEF_INCLUDED #define _SWEODEF_INCLUDED
#define MY_TRUE 1 /* 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 */ # define MY_FALSE 0 /* for use in other defines, before TRUE is defined */
#ifdef _WIN32 /* Microsoft VC 5.0 does not define MSDOS anymore */ #ifdef _WIN32 /* Microsoft VC 5.0 does not define MSDOS anymore */
#undef MSDOS # undef MSDOS
#define MSDOS MY_TRUE # define MSDOS MY_TRUE
#include <wtypes.h> #include <wtypes.h>
#include <objbase.h> #include <objbase.h>
#include <wincon.h> #include <wincon.h>
#include <winbase.h> #include <winbase.h>
#include <io.h> #include <io.h>
#include <windows.h> #include <windows.h>
#define sleep(x) Sleep((x) * 1000) # define sleep(x) Sleep((x) * 1000)
#endif #endif
#ifdef _MSC_VER #ifdef _MSC_VER
#define MS_VC # define MS_VC
#endif #endif
#ifdef WIN32 /* Microsoft VC 5.0 does not define MSDOS anymore */ #ifdef WIN32 /* Microsoft VC 5.0 does not define MSDOS anymore */
#define MSDOS MY_TRUE # define MSDOS MY_TRUE
#endif #endif
#ifdef MSDOS /* already defined by some DOS compilers */ #ifdef MSDOS /* already defined by some DOS compilers */
#undef MSDOS # undef MSDOS
#define MSDOS MY_TRUE # define MSDOS MY_TRUE
#endif #endif
#ifdef __TURBOC__ /* defined by turboc */ #ifdef __TURBOC__ /* defined by turboc */
#ifndef MSDOS # ifndef MSDOS
#define MSDOS MY_TRUE # define MSDOS MY_TRUE
#endif # endif
#define TURBO_C # define TURBO_C
#endif #endif
#ifdef __SC__ /* defined by Symantec C */ #ifdef __SC__ /* defined by Symantec C */
#ifndef MSDOS # ifndef MSDOS
#define MSDOS MY_TRUE # define MSDOS MY_TRUE
#endif # endif
#define SYMANTEC_C # define SYMANTEC_C
#endif #endif
#ifdef __WATCOMC__ /* defined by WatcomC */ #ifdef __WATCOMC__ /* defined by WatcomC */
#ifndef MSDOS # ifndef MSDOS
#define MSDOS MY_TRUE # define MSDOS MY_TRUE
#endif # endif
#define WATCOMC # define WATCOMC
#endif #endif
#ifdef __MWERKS__ /* defined on Macintosh CodeWarrior */ #ifdef __MWERKS__ /* defined on Macintosh CodeWarrior */
#if macintosh && powerc # if macintosh && powerc
#define MACOS MY_TRUE /* let it undefined otherwise */ # define MACOS MY_TRUE /* let it undefined otherwise */
#define MSDOS MY_FALSE /* in case one above fired falsely */ # define MSDOS MY_FALSE /* in case one above fired falsely */
#endif # endif
#endif #endif
#ifdef MSDOS #ifdef MSDOS
#define HPUNIX MY_FALSE # define HPUNIX MY_FALSE
#define INTEL_BYTE_ORDER 1 # define INTEL_BYTE_ORDER 1
#ifndef TURBO_C # ifndef TURBO_C
#define MS_C /* assume Microsoft C compiler */ # define MS_C /* assume Microsoft C compiler */
#endif # endif
#define MYFAR far # define MYFAR far
#define UNIX_FS MY_FALSE # define UNIX_FS MY_FALSE
#else #else
#ifdef MACOS # ifdef MACOS
#define HPUNIX MY_FALSE # define HPUNIX MY_FALSE
#define MYFAR # define MYFAR
#define UNIX_FS MY_FALSE # define UNIX_FS MY_FALSE
#else # else
#define MSDOS MY_FALSE # define MSDOS MY_FALSE
#define HPUNIX MY_TRUE # define HPUNIX MY_TRUE
#ifndef _HPUX_SOURCE # ifndef _HPUX_SOURCE
#define _HPUX_SOURCE # define _HPUX_SOURCE
#endif # endif
#define MYFAR # define MYFAR
#define UNIX_FS MY_TRUE # define UNIX_FS MY_TRUE
#endif # endif
#endif #endif
#include <math.h> #include <math.h>
#include <stdlib.h> #include <stdlib.h>
#ifndef FILE #ifndef FILE
#include <stdio.h> # include <stdio.h>
#endif #endif
#if HPUNIX #if HPUNIX
#include <unistd.h> # include <unistd.h>
#endif #endif
/* /*
@ -171,63 +170,63 @@
*/ */
#include <limits.h> #include <limits.h>
#if INT_MAX < 40000 #if INT_MAX < 40000
#define INT_16 # define INT_16
#else #else
#if LONG_MAX > INT_MAX # if LONG_MAX > INT_MAX
#define LONG_64 # define LONG_64
#endif # endif
#endif #endif
#ifdef BYTE_ORDER #ifdef BYTE_ORDER
#ifdef LITTLE_ENDIAN #ifdef LITTLE_ENDIAN
#if BYTE_ORDER == LITTLE_ENDIAN # if BYTE_ORDER == LITTLE_ENDIAN
#define INTEL_BYTE_ORDER # define INTEL_BYTE_ORDER
#endif # endif
#endif #endif
#endif #endif
#ifdef INT_16 #ifdef INT_16
typedef long int32; typedef long int32;
typedef unsigned long uint32; typedef unsigned long uint32;
typedef int int16; typedef int int16;
typedef double REAL8; /* real with at least 64 bit precision */ typedef double REAL8; /* real with at least 64 bit precision */
typedef long INT4; /* signed integer with at least 32 bit precision */ typedef long INT4; /* signed integer with at least 32 bit precision */
typedef unsigned long UINT4; typedef unsigned long UINT4;
/* unsigned integer with at least 32 bit precision */ /* unsigned integer with at least 32 bit precision */
typedef int AS_BOOL; typedef int AS_BOOL;
typedef unsigned int UINT2; /* unsigned 16 bits */ typedef unsigned int UINT2; /* unsigned 16 bits */
#define ABS4 labs /* abs function for long */ # define ABS4 labs /* abs function for long */
#else #else
typedef int int32; typedef int int32;
typedef long long int64; typedef long long int64;
typedef unsigned int uint32; typedef unsigned int uint32;
typedef short int16; typedef short int16;
typedef double REAL8; /* real with at least 64 bit precision */ typedef double REAL8; /* real with at least 64 bit precision */
typedef int INT4; /* signed integer with at least 32 bit precision */ typedef int INT4; /* signed integer with at least 32 bit precision */
typedef unsigned int UINT4; typedef unsigned int UINT4;
/* unsigned integer with at least 32 bit precision */ /* unsigned integer with at least 32 bit precision */
typedef int AS_BOOL; typedef int AS_BOOL;
typedef unsigned short UINT2; /* unsigned 16 bits */ typedef unsigned short UINT2; /* unsigned 16 bits */
#define ABS4 abs /* abs function for long */ # define ABS4 abs /* abs function for long */
#endif #endif
#if MSDOS #if MSDOS
#ifdef TURBO_C # ifdef TURBO_C
#include <alloc.h> /* MSC needs malloc ! */ # include <alloc.h> /* MSC needs malloc ! */
#else # else
#include <malloc.h> # include <malloc.h>
#endif # endif
#define SIGALRM SIGINT # define SIGALRM SIGINT
#endif #endif
#ifndef TRUE #ifndef TRUE
#define TRUE 1 # define TRUE 1
#define FALSE 0 # define FALSE 0
#endif #endif
#ifndef OK #ifndef OK
#define OK (0) # define OK (0)
#define ERR (-1) # define ERR (-1)
#endif #endif
/* hack because UCHAR is already used by mingw gcc */ /* hack because UCHAR is already used by mingw gcc */
@ -241,30 +240,30 @@ typedef unsigned char UCHAR;
#define UCP (UCHAR*) #define UCP (UCHAR*)
#define SCP (char*) #define SCP (char*)
#define ODEGREE_STRING "°" /* degree as string, utf8 encoding */ # define ODEGREE_STRING "°" /* degree as string, utf8 encoding */
#ifndef HUGE #ifndef HUGE
#define HUGE 1.7E+308 /* biggest value for REAL8 */ # define HUGE 1.7E+308 /* biggest value for REAL8 */
#endif #endif
#ifndef M_PI #ifndef M_PI
#define M_PI 3.14159265358979323846 # define M_PI 3.14159265358979323846
#endif #endif
#define forward static #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 DEGTORAD 0.0174532925199433
#define RADTODEG 57.2957795130823 #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 */
typedef int32 centisec; /* centiseconds used for angles and times */ #define DEG 360000 /* degree expressed in centiseconds */
#define CS (centisec) /* use for casting */ #define DEG7_30 (2700000) /* 7.5 degrees */
#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 DEG15 (15 * DEG)
#define DEG24 (24 * DEG) #define DEG24 (24 * DEG)
#define DEG30 (30 * DEG) #define DEG30 (30 * DEG)
@ -275,49 +274,48 @@ typedef int32 centisec; /* centiseconds used for angles and times */
#define DEG180 (180 * DEG) #define DEG180 (180 * DEG)
#define DEG270 (270 * DEG) #define DEG270 (270 * DEG)
#define DEG360 (360 * DEG) #define DEG360 (360 * DEG)
#define CSTORAD 4.84813681109536E-08 /* centisec to rad: pi / 180 /3600/100 */ #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 RADTOCS 2.06264806247096E+07 /* rad to centisec 180*3600*100/pi */
#define CS2DEG (1.0/360000.0) /* centisec to degree */ #define CS2DEG (1.0/360000.0) /* centisec to degree */
/* control strings for fopen() */ /* control strings for fopen() */
#if UNIX_FS #if UNIX_FS
#define BFILE_R_ACCESS "r" /* open binary file for reading */ # define BFILE_R_ACCESS "r" /* open binary file for reading */
#define BFILE_RW_ACCESS "r+" /* open binary file for writing and 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_W_CREATE "w" /* create/open binary file for write*/
#define BFILE_A_ACCESS "a+" /* create/open binary file for append */ # define BFILE_A_ACCESS "a+" /* create/open binary file for append*/
#define FILE_R_ACCESS "r" /* open text file for reading */ # define FILE_R_ACCESS "r" /* open text file for reading */
#define FILE_RW_ACCESS "r+" /* open text file for writing and 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_W_CREATE "w" /* create/open text file for write*/
#define FILE_A_ACCESS "a+" /* create/open text file for append */ # define FILE_A_ACCESS "a+" /* create/open text file for append*/
#define O_BINARY 0 /* for open(), not defined in Unix */ # define O_BINARY 0 /* for open(), not defined in Unix */
#define OPEN_MODE 0666 /* default file creation mode */ # define OPEN_MODE 0666 /* default file creation mode */
#define DIR_GLUE "/" /* glue string for directory/file */ # define DIR_GLUE "/" /* glue string for directory/file */
#define PATH_SEPARATOR ";:" /* semicolon or colon may be used */ # define PATH_SEPARATOR ";:" /* semicolon or colon may be used */
#else #else
#define BFILE_R_ACCESS "rb" /* open binary file for reading */ # 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_RW_ACCESS "r+b" /* open binary file for writing and reading */
#define BFILE_W_CREATE "wb" /* create/open binary file for write */ # define BFILE_W_CREATE "wb" /* create/open binary file for write*/
#define BFILE_A_ACCESS "a+b" /* create/open binary file for append */ # define BFILE_A_ACCESS "a+b" /* create/open binary file for append*/
#define PATH_SEPARATOR ";" /* semicolon as PATH separator */ # define PATH_SEPARATOR ";" /* semicolon as PATH separator */
#define OPEN_MODE 0666 /* default file creation mode */ # define OPEN_MODE 0666 /* default file creation mode */
#ifdef MACOS # ifdef MACOS
#define FILE_R_ACCESS "r" /* open text file for reading */ # define FILE_R_ACCESS "r" /* open text file for reading */
#define FILE_RW_ACCESS "r+" /* open text file for writing and 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_W_CREATE "w" /* create/open text file for write*/
#define FILE_A_ACCESS "a+" /* create/open text file for append */ # define FILE_A_ACCESS "a+" /* create/open text file for append*/
#define DIR_GLUE ":" /* glue string for directory/file */ # define DIR_GLUE ":" /* glue string for directory/file */
#else # else
#define FILE_R_ACCESS "rt" /* open text file for reading */ # 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_RW_ACCESS "r+t" /* open text file for writing and reading */
#define FILE_W_CREATE "wt" /* create/open text file for write */ # define FILE_W_CREATE "wt" /* create/open text file for write*/
#define FILE_A_ACCESS "a+t" /* create/open text file for append */ # define FILE_A_ACCESS "a+t" /* create/open text file for append*/
/* attention, all backslashes for msdos directry names must be written as \\, /* attention, all backslashes for msdos directry names must be written as \\,
because it is the C escape character */ because it is the C escape character */
#define DIR_GLUE "\\" /* glue string for directory/file */ # define DIR_GLUE "\\" /* glue string for directory/file */
#endif # endif
#endif #endif
#include <string.h> #include <string.h>

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,3 @@
/************************************************************ /************************************************************
$Header: /home/dieter/sweph/RCS/swepcalc.h,v 1.74 2008/06/16 10:07:20 dieter Exp $ $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 Definitions and constants for Placalc interface to SwissEph
@ -85,15 +84,15 @@
* It is very simple to adapt your code to it. * 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 you want to adapt your source code, turn the next TRUE into FALSE
*/ */
#if TRUE /* replace by if FALSE to deactivate macros */ #if TRUE /* replace by if FALSE to deactivate macros */
#define d2l(x) swe_d2l(x) # define d2l(x) swe_d2l(x)
#define difcsn(x,y) swe_difcsn(x,y) # define difcsn(x,y) swe_difcsn(x,y)
#define difcs2n(x,y) swe_difcs2n(x,y) # define difcs2n(x,y) swe_difcs2n(x,y)
#define difdegn(x,y) swe_difdegn(x,y) # define difdegn(x,y) swe_difdegn(x,y)
#define difdeg2n(x,y) swe_difdeg2n(x,y) # define difdeg2n(x,y) swe_difdeg2n(x,y)
#define csnorm(x) swe_csnorm(x) # define csnorm(x) swe_csnorm(x)
#define degnorm(x) swe_degnorm(x) # define degnorm(x) swe_degnorm(x)
#define roundsec(x) swe_csroundsec(x) # define roundsec(x) swe_csroundsec(x)
#endif #endif
/************************************************************* /*************************************************************
@ -103,24 +102,28 @@
Astrodienst relative julian days, and jd the use of absolute Astrodienst relative julian days, and jd the use of absolute
julian days. 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 int calcserv(int id, double t, int flag, int plalist, char *so);
extern void helup(double jd_ad); extern void helup(double jd_ad);
extern void togeo(double le, double re, double l, double r, double z, extern void togeo(double le, double re, double l, double r, double z, double *alg, double *arg);
double *alg, double *arg); extern int calc(int p,
extern int calc(int p, double jd_ad, int flag, double *alng, double *arad, double jd_ad,
double *alat, double *alngspeed); int flag,
double *alng,
double *arad,
double *alat,
double *alngspeed);
extern int rel_geo(int p, double rau); extern int rel_geo(int p, double rau);
extern int hel(int p, /* planet index as defined by placalc.h */ extern int hel( int p, /* planet index as defined by placalc.h */
double jd_ad, /* relative juliand date, ephemeris time */ double jd_ad, /* relative juliand date, ephemeris time */
/* Now come 6 pointers to return values. */ /* Now come 6 pointers to return values. */
double *al, /* longitude in degrees */ double *al, /* longitude in degrees */
double *ar, /* radius in AU */ double *ar, /* radius in AU */
double *az, /* distance from ecliptic in AU */ double *az, /* distance from ecliptic in AU */
double *alp, /* speed in longitude, degrees per day */ double *alp, /* speed in longitude, degrees per day */
double *arp, /* speed in radius, AU per day */ double *arp, /* speed in radius, AU per day */
double *azp); /* speed in z, AU per day */ double *azp); /* speed in z, AU per day */
extern int moon(double *al, double *ar, double *az); extern int moon(double *al, double *ar, double *az);
extern double fraction(double t); extern double fraction(double t);
extern double sidtime(double jd_ad, double ecl, double nuta); extern double sidtime(double jd_ad, double ecl, double nuta);
extern double smod8360(double x); extern double smod8360(double x);
@ -128,25 +131,24 @@ extern double mod8360(double x);
extern double diff8360(double x, double y); extern double diff8360(double x, double y);
extern double test_near_zero(double x); extern double test_near_zero(double x);
extern double deltat(double jd_ad); 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 void placalc_close_files();
extern int fixstar(char *star, double jd, double *lon, double *lat); extern int fixstar(char *star, double jd, double *lon, double *lat);
extern char *placalc_get_errtext(); extern char *placalc_get_errtext();
extern char *placalc_set_ephepath(char *new_path); /* sets ephepath; extern char *placalc_set_ephepath(char *new_path); /* sets ephepath;
* if called with NULL, returns current path */ if called with NULL, returns current path */
/* /*
* because deltat() required a relative Julian date due to historical reasons, * because deltat() required a relative Julian date due to historical reasons,
* we define a function deltatjd() with absolute Juliand date argument. * 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 * get the planet index for an AFL letter
* returns -1 if the letter does not correspond to a planet. * returns -1 if the letter does not correspond to a planet.
*/ */
extern int afl2planet(int afl); extern int afl2planet(int afl);
/* /*
* get the AFL letter for a planet * get the AFL letter for a planet
* returns -1 if planet has no letter. * returns -1 if planet has no letter.
@ -160,7 +162,7 @@ extern char *planet2abbr3(int planet);
(these cannot be used by DLL clients) (these cannot be used by DLL clients)
*************************************************************/ *************************************************************/
/************************************************************* /*************************************************************
definitions definitions
*************************************************************/ *************************************************************/
@ -169,8 +171,8 @@ extern char *planet2abbr3(int planet);
* planet index numbers, used to identify a planet in calc() and * planet index numbers, used to identify a planet in calc() and
* other related functions. * other related functions.
*/ */
#define CALC_ONLY_ECL_NUT -1 /* pseudo planet index for calls to calc */ #define CALC_ONLY_ECL_NUT (-1) /* pseudo planet index for calls to calc */
#define SUN 0 /* used synonymously for earth too */ #define SUN 0 /* used synonymously for earth too */
#define EARTH 0 #define EARTH 0
#define MOON 1 #define MOON 1
#define MERCURY 2 #define MERCURY 2
@ -185,16 +187,17 @@ extern char *planet2abbr3(int planet);
#define MEAN_NODE 10 #define MEAN_NODE 10
#define TRUE_NODE 11 #define TRUE_NODE 11
#define CHIRON 12 #define CHIRON 12
#define LILITH 13 #define LILITH 13
#define CALC_N 14 /* number of planets in placalc module */ #define CALC_N 14 /* number of planets in placalc module */
#define CERES 14 #define CERES 14
#define PALLAS 15 #define PALLAS 15
#define JUNO 16 #define JUNO 16
#define VESTA 17 #define VESTA 17
#define EARTHHEL 18 /* heliocentric earth */
#define MAXPL_NACALC (LILITH) /* nacalc computes SUN..LILITH */ #define MAXPL_NACALC (LILITH) /* nacalc computes SUN..LILITH */
#define PROG_PLANET_OFFSET 50 /* progressed sun */ # define PROG_PLANET_OFFSET 50 /* progressed sun */
/* /*
* houses and axes get also a 'planet' index number, but they * houses and axes get also a 'planet' index number, but they
@ -204,21 +207,20 @@ extern char *planet2abbr3(int planet);
* Axes and houses cannot be computed with calls to calc(); they must * Axes and houses cannot be computed with calls to calc(); they must
* be computed with the housasp module functions. * be computed with the housasp module functions.
*/ */
#define AC 19 # define AC 19
#define ASC 19 # define ASC 19
#define MC 20 # define MC 20
#define CALC_N_MC 21 /* number of normal natal factors */ # define CALC_N_MC 21 /* number of normal natal factors */
#define FIRST_HSNR 21 # define FIRST_HSNR 21
#define LAST_HSNR 32 # define LAST_HSNR 32
#define NO_OF_HOUSES 12 # define NO_OF_HOUSES 12
#define MAX_PL_INDEX 32 #define MAX_PL_INDEX 32
/* /*
* in a bitlist flag each planet is represented by a bit; * in a bitlist flag each planet is represented by a bit;
* all 14 defined planets can be called at once with * 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. * AFL: Astrological factor letters for use in selections strings.
@ -230,93 +232,92 @@ extern char *planet2abbr3(int planet);
* The function planet2afl translates a planext index into the AFL letter. * The function planet2afl translates a planext index into the AFL letter.
*/ */
#define AFL_SUN '0' # define AFL_SUN '0'
#define AFL_MON '1' # define AFL_MON '1'
#define AFL_MER '2' # define AFL_MER '2'
#define AFL_VEN '3' # define AFL_VEN '3'
#define AFL_MAR '4' # define AFL_MAR '4'
#define AFL_JUP '5' # define AFL_JUP '5'
#define AFL_SAT '6' # define AFL_SAT '6'
#define AFL_URA '7' # define AFL_URA '7'
#define AFL_NEP '8' # define AFL_NEP '8'
#define AFL_PLU '9' # define AFL_PLU '9'
#define AFL_CHI 'c' # define AFL_CHI 'c'
#define AFL_LIL 'i' /* mean Lilith: direction of lunar aphel */ # define AFL_LIL 'i' /* mean Lilith: direction of lunar aphel */
#define AFL_AC 'A' # define AFL_AC 'A'
#define AFL_MC 'M' # define AFL_MC 'M'
#define AFL_TNODE 'N' /* TRUE_NODE */ # define AFL_TNODE 'N' /* TRUE_NODE */
#define AFL_MNODE 'n' /* MEAN_NODE */ # define AFL_MNODE 'n' /* MEAN_NODE */
#define AFL_CER 'C' # define AFL_CER 'C'
#define AFL_PAL 'P' # define AFL_PAL 'P'
#define AFL_JUN 'J' # define AFL_JUN 'J'
#define AFL_VES 'V' # define AFL_VES 'V'
/* /*
* other AFL definitions not recognized by afl2planet() * other AFL definitions not recognized by afl2planet()
*/ */
#define AFL_SIDT 's' /* sidereal time */ # define AFL_SIDT 's' /* sidereal time */
#define AFL_WDAY 'd' /* day of week column */ # define AFL_WDAY 'd' /* day of week column */
#define AFL_HOUSE 'H' /* any house cusp */ # 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 J2000 2451545.0 /* Epoch of JPL ephemeris DE200, absolute */
#define J1950 2433282.423 /* Epoch of JPL ephemeris DE102 */ # define J1950 2433282.423 /* Epoch of JPL ephemeris DE102 */
#define JUL_OFFSET 2433282.0 /* offset of Astrodienst relative Julian date */ # define JUL_OFFSET 2433282.0 /* offset of Astrodienst relative Julian date */
#ifndef GREG_CAL #ifndef GREG_CAL
#define GREG_CAL SE_GREG_CAL # define GREG_CAL SE_GREG_CAL
#define JUL_CAL SE_JUL_CAL # define JUL_CAL SE_JUL_CAL
#endif #endif
/* /*
* flag bits used in calc and calcserv * flag bits used in calc and calcserv
*/ */
#define CALC_BIT_HELIO 1 /* geo/helio */ # define CALC_BIT_HELIO 1 /* geo/helio */
#define CALC_BIT_NOAPP 2 /* apparent/true positions */ # define CALC_BIT_NOAPP 2 /* apparent/true positions */
#define CALC_BIT_NONUT 4 /* true eq. of date/ mean equ. of date */ # define CALC_BIT_NONUT 4 /* true eq. of date/ mean equ. of date */
#define CALC_BIT_EPHE 8 /* universal/ephemeris time */ # define CALC_BIT_EPHE 8 /* universal/ephemeris time */
#define CALC_BIT_SPEED 16 /* without/with speed */ # define CALC_BIT_SPEED 16 /* without/with speed */
#define CALC_BIT_BETA 32 /* without/with latitude */ # define CALC_BIT_BETA 32 /* without/with latitude */
#define CALC_BIT_RGEO 64 /* without/with relative rgeo */ # define CALC_BIT_RGEO 64 /* without/with relative rgeo */
#define CALC_BIT_RAU 128 /* without/with real radius */ # define CALC_BIT_RAU 128 /* without/with real radius */
#define CALC_BIT_MUST_USE_EPHE 256 /* epheserv may not use calc */ # 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_MAY_USE_EPHE 512 /* calcserv may use ephread */
#define CALC_BIT_MUST_CALC 1024 /* ephread must calc */ # define CALC_BIT_MUST_CALC 1024 /* ephread must calc */
/* /*
* stuff from astrolib.h * stuff from astrolib.h
*/ */
#ifndef ADATE /* this must be bracketed because users of swepcalc #ifndef ADATE /* this must be bracketed because users of swepcalc
* may also include astrolib.h for other reasons */ may also include astrolib.h for other reasons */
#define ADATE struct adate #define ADATE struct adate
/* makros for bit operations */ /* makros for bit operations */
#define clear_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 set_bit(v,bit_nr) ((v) | (1L << (bit_nr)))
#define bit(bit_nr) (1L << (bit_nr)) # define bit(bit_nr) (1L << (bit_nr))
#define check_bit(v,bit_nr) ((v) & (1L << (bit_nr))) # define check_bit(v,bit_nr) ((v) & (1L << (bit_nr)))
ADATE { /* date structure used by revjuls and juldays */ ADATE { /* date structure used by revjuls and juldays */
int day, month, year; int day, month, year;
centisec csec; centisec csec;
}; };
#endif /* ADATE */ #endif /* ADATE */
/* /*
* functions exported by swepdate.c * functions exported by swepdate.c
*/ */
extern double julday(int month, int day, int year, double hour, int gregflag); extern double julday(int month, int day, int year, double hour, int gregflag);
extern double juldays(int gregflag, ADATE * adp); extern double juldays(int gregflag, ADATE *adp);
extern void revjul(double u, int gregflag, int *jmon, int *jday, int *jyear, extern void revjul (double u, int gregflag,
double *jut); int *jmon, int *jday, int *jyear, double *jut);
extern void revjuls(double u, int gregflag, ADATE * adp); extern void revjuls(double u, int gregflag, ADATE *adp);
extern int day_of_week(double t); extern int day_of_week(double t);
/* /*
* end swpdate.c * end swpdate.c
*/ */
@ -324,7 +325,7 @@ extern int day_of_week(double t);
/* /*
* stuff from housasp.h * stuff from housasp.h
*/ */
#ifndef ASP_144 /* allow including housasp wihout conflict */ #ifndef ASP_144 /* allow including housasp wihout conflict */
#define MAXPLANETS 16 #define MAXPLANETS 16
/* /*
@ -333,40 +334,40 @@ extern int day_of_week(double t);
* We define three different names for the aspects: * We define three different names for the aspects:
* ASP_CONJ (always 4 letters), ASP_0 and CONJ. * ASP_CONJ (always 4 letters), ASP_0 and CONJ.
*/ */
#define ASP_CONJ 1 # define ASP_CONJ 1
#define ASP_0 1 # define ASP_0 1
#define ASP_OPPO 2 # define ASP_OPPO 2
#define ASP_180 2 # define ASP_180 2
#define ASP_SQUA 3 # define ASP_SQUA 3
#define ASP_90 3 # define ASP_90 3
#define ASP_TRIN 4 # define ASP_TRIN 4
#define ASP_120 4 # define ASP_120 4
#define ASP_SEXT 5 # define ASP_SEXT 5
#define ASP_60 5 # define ASP_60 5
#define ASP_SMSX 6 # define ASP_SMSX 6
#define ASP_30 6 # define ASP_30 6
#define ASP_QCNX 7 # define ASP_QCNX 7
#define ASP_150 7 # define ASP_150 7
#define ASP_SMSQ 8 # define ASP_SMSQ 8
#define ASP_45 8 # define ASP_45 8
#define ASP_SQSQ 9 # define ASP_SQSQ 9
#define ASP_135 9 # define ASP_135 9
#define ASP_QINT 10 # define ASP_QINT 10
#define ASP_72 10 # define ASP_72 10
#define ASP_BQIN 11 # define ASP_BQIN 11
#define ASP_144 11 # define ASP_144 11
#define CONJ ASP_CONJ # define CONJ ASP_CONJ
#define OPPO ASP_OPPO # define OPPO ASP_OPPO
#define SQUA ASP_SQUA # define SQUA ASP_SQUA
#define TRIN ASP_TRIN # define TRIN ASP_TRIN
#define SEXT ASP_SEXT # define SEXT ASP_SEXT
#define SMSX ASP_SMSX # define SMSX ASP_SMSX
#define QCNX ASP_QCNX # define QCNX ASP_QCNX
#define SMSQ ASP_SMSQ # define SMSQ ASP_SMSQ
#define SQSQ ASP_SQSQ # define SQSQ ASP_SQSQ
#define QINT ASP_QINT # define QINT ASP_QINT
#define BQIN ASP_BQIN # define BQIN ASP_BQIN
#define MAXASPECTS ASP_BQIN #define MAXASPECTS ASP_BQIN
@ -374,9 +375,9 @@ extern int day_of_week(double t);
* for compact encoding of aspect lists we set bit 1 for CONJ, bit 2 for OPPO * 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. * and so on. asp_bit(asp) deleivers the mask.
*/ */
#define ALL_ASP_BITS 1022 /* bit mask with all 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 STRONG_ASP_BITS 62 /* bit mask with strong aspect bits set */
#define HARD_ASP_BITS 14 /* bit mask with hard aspect bits set */ #define HARD_ASP_BITS 14 /* bit mask with hard aspect bits set */
#define asp_bit(asp) (1 << (asp)) #define asp_bit(asp) (1 << (asp))
@ -394,71 +395,68 @@ extern int day_of_week(double t);
/* /*
* used to initialize an array centisec angles[MAXASPECTS+1] * 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} 60*DEG, 30*DEG, 150*DEG, 45*DEG, 135*DEG, 72*DEG, 144*DEG}
struct AspectType struct AspectType {
{ AS_BOOL dataValid; /* used as boolean */
AS_BOOL dataValid; /* used as boolean */ int NrOfPlanets,
int NrOfPlanets, NrOfAspects; NrOfAspects;
centisec *PlanetPos; /* pointer to an array of planet positions centisec *PlanetPos; /* pointer to an array of planet positions
* [0..NrOfPlanets-1]; the user of the [0..NrOfPlanets-1]; the user of the
* structure must set this pointer to his structure must set this pointer to his
* array of planet positions */ array of planet positions */
centisec *ppos2; /* second set for mutual aspects only; if centisec *ppos2; /* second set for mutual aspects only; if
* not NULL, interaspects are calculated */ not NULL, interaspects are calculated */
centisec *Maxorb; /* pointer to an array [0..NrOfAspects] of centisec *Maxorb; /* pointer to an array [0..NrOfAspects] of
* maximum orbes; element[0] not used; maximum orbes; element[0] not used;
* the user of the structure must set this the user of the structure must set this
* pointer to his array of maxorbs */ pointer to his array of maxorbs */
centisec *Angle; /* pointer to Angle[0..NrOfAspects] of the centisec *Angle; /* pointer to Angle[0..NrOfAspects] of the
* angles of aspects; [0] not used; the angles of aspects; [0] not used; the
* user must set this pointer to his array user must set this pointer to his array
* of angles */ of angles */
struct aspRec struct aspRec {
{ int index; /* number of the found aspect */
int index; /* number of the found aspect */ centisec orb;
centisec orb; }
} Asp [MAXPLANETS] [MAXPLANETS];
Asp[MAXPLANETS][MAXPLANETS]; };
};
struct houses struct houses {
{ centisec cusp[13];
centisec cusp[13]; centisec ac;
centisec ac; centisec mc;
centisec mc; };
};
#define HOUSES struct houses
#endif /* ifndef ASP_144 */
# define HOUSES struct houses
#endif /* ifndef ASP_144 */
/********************************** /**********************************
functions exported originally from housasp.c 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, return in which house pp is,
* The caller is responsible for proper initialization of cusps 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; /* returns the interpretation-house number, where pp is in;
* an interpretation house is defined differently from a normal * an interpretation house is defined differently from a normal
* house: the cusps are offset, so that it begins and ends * house: the cusps are offset, so that it begins and ends
* a little earlier. * a little earlier.
* cusp[1..12] and cuspoff[1..12] must be initialized * 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 */ /* variation of InpHouseNr(). Comment in swepcalc.c */
extern void CalcHouses(CSEC th, CSEC fi, CSEC ekl, char hsy, int icnt, 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 RecalcAspects(struct AspectType *a);
extern void longreorder(UCHAR * p, int n); extern void longreorder (UCHAR *p, int n);
#endif /* _SWEPCALC_INCLUDED */ #endif /* _SWEPCALC_INCLUDED */

View File

@ -1,11 +1,9 @@
/***************************************************** /*****************************************************
$Header: swepdate.c,v 1.65 2003/06/14 13:02:01 alois Exp $ $Header: swepdate.c,v 1.65 2003/06/14 13:02:01 alois Exp $
Placalc compatibility interface for Swiss Ephemeris. Placalc compatibility interface for Swiss Ephemeris.
date functions date functions
*******************************************************/ *******************************************************/
/* Copyright (C) 1997 - 2008 Astrodienst AG, Switzerland. All rights reserved. /* Copyright (C) 1997 - 2008 Astrodienst AG, Switzerland. All rights reserved.
License conditions License conditions
@ -131,32 +129,28 @@ date functions
and notifies errors like 32 January. and notifies errors like 32 January.
****************************************************************/ ****************************************************************/
double double julday(int month, int day, int year, double hour, int gregflag)
julday(int month, int day, int year, double hour, int gregflag)
{ {
double jd; double jd;
jd = swe_julday(year, month, day, hour, gregflag); jd = swe_julday(year, month, day, hour, gregflag);
return jd; return jd;
} }
/* /*
* monday = 0, ... sunday = 6 * monday = 0, ... sunday = 6
*/ */
int int day_of_week(double jd)
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 ****************** /*************** julday ******************
get absolute julian day number (author: Marc Pottenger) get absolute julian day number (author: Marc Pottenger)
with bug fix for year < -4711 15-aug-88 with bug fix for year < -4711 15-aug-88
*/ */
double double juldays(int gregflag, ADATE *adp )
juldays(int gregflag, ADATE * adp)
{ {
return swe_julday(adp->year, adp->month, adp->day, adp->csec / 360000.0, return swe_julday(adp->year, adp->month, adp->day, adp->csec / 360000.0, gregflag);
gregflag);
} }
/*** revjul ****************************************************** /*** revjul ******************************************************
@ -178,10 +172,10 @@ juldays(int gregflag, ADATE * adp)
Original author Mark Pottenger, Los Angeles. Original author Mark Pottenger, Los Angeles.
with bug fix for year < -4711 16-aug-88 Alois Treindl with bug fix for year < -4711 16-aug-88 Alois Treindl
*************************************************************************/ *************************************************************************/
void void revjul (double jd, int gregflag,
revjul(double jd, int gregflag, int *jmon, int *jday, int *jyear, double *jut) 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 ********* /************************************* revjul *********
@ -189,12 +183,11 @@ revjul(double jd, int gregflag, int *jmon, int *jday, int *jyear, double *jut)
with bug fix for year < -4711 16-aug-88 with bug fix for year < -4711 16-aug-88
arguments are julian day #, calendar flag (0=julian, 1=gregorian) arguments are julian day #, calendar flag (0=julian, 1=gregorian)
*/ */
void void revjuls(double jd, int gregflag, struct adate *adp)
revjuls(double jd, int gregflag, struct adate *adp)
{ {
double jut; double jut;
swe_revjul(jd, gregflag, &adp->year, &adp->month, &adp->day, &jut); swe_revjul(jd, gregflag, &adp->year, &adp->month, &adp->day, &jut);
adp->csec = jut * 360000.0 + 0.5; adp->csec = jut * 360000.0 + 0.5;
} }
/********************************************************* /*********************************************************
@ -222,28 +215,28 @@ revjuls(double jd, int gregflag, struct adate *adp)
Return: OK or ERR (for illegal date) Return: OK or ERR (for illegal date)
*********************************************************/ *********************************************************/
int int date_conversion (int d ,
date_conversion(int d, int m, int y, /* day, month, year */ int m ,
centisec gutime, /* greenwich time in centiseconds */ int y , /* day, month, year */
char c, /* calendar g[regorian]|j[ulian]|a[stro = greg] */ centisec gutime, /* greenwich time in centiseconds */
double *tgmt char c, /* calendar g[regorian]|j[ulian]|a[stro = greg] */
/* julian date relative 0.Jan.1950 12:00 gmt */ double *tgmt
/* shift is 2433282 from absolute Julian date */ /* julian date relative 0.Jan.1950 12:00 gmt */
) /* shift is 2433282 from absolute Julian date */
{ )
int rday, rmon, ryear; {
double rut, jd; int rday, rmon, ryear;
int gregflag = SE_JUL_CAL; double rut, jd;
if (c == 'g' || c == 'a') int gregflag = SE_JUL_CAL;
gregflag = SE_GREG_CAL; if (c == 'g' || c == 'a')
rut = gutime / 360000.0; /* hours GMT */ gregflag = SE_GREG_CAL;
jd = julday(m, d, y, rut, gregflag); rut = gutime / 360000.0; /* hours GMT */
revjul(jd, gregflag, &rmon, &rday, &ryear, &rut); jd = julday(m, d, y, rut, gregflag);
*tgmt = jd - JUL_OFFSET; revjul(jd, gregflag, &rmon, &rday, &ryear, &rut);
if (rmon == m && rday == d && ryear == y) { *tgmt = jd - JUL_OFFSET;
return OK; if (rmon == m && rday == d && ryear == y) {
} return OK;
else { } else {
return ERR; return ERR;
} }
} /* end date_conversion */ } /* end date_conversion */

File diff suppressed because it is too large Load Diff

View File

@ -5,7 +5,6 @@
Authors: Dieter Koch and Alois Treindl, Astrodienst Zurich Authors: Dieter Koch and Alois Treindl, Astrodienst Zurich
************************************************************/ ************************************************************/
/* Copyright (C) 1997 - 2008 Astrodienst AG, Switzerland. All rights reserved. /* Copyright (C) 1997 - 2008 Astrodienst AG, Switzerland. All rights reserved.
License conditions License conditions
@ -64,11 +63,11 @@
* move over from swephexp.h * move over from swephexp.h
*/ */
#define SE_VERSION "1.79.00" #define SE_VERSION "2.00.00"
#define J2000 2451545.0 /* 2000 January 1.5 */ #define J2000 2451545.0 /* 2000 January 1.5 */
#define B1950 2433282.42345905 /* 1950 January 0.923 */ #define B1950 2433282.42345905 /* 1950 January 0.923 */
#define J1900 2415020.0 /* 1900 January 0.5 */ #define J1900 2415020.0 /* 1900 January 0.5 */
#define MPC_CERES 1 #define MPC_CERES 1
#define MPC_PALLAS 2 #define MPC_PALLAS 2
@ -101,7 +100,7 @@
#define SE_NAME_CHIRON "Chiron" #define SE_NAME_CHIRON "Chiron"
#define SE_NAME_PHOLUS "Pholus" #define SE_NAME_PHOLUS "Pholus"
#define SE_NAME_CUPIDO "Cupido" #define SE_NAME_CUPIDO "Cupido"
#define SE_NAME_HADES "Hades" #define SE_NAME_HADES "Hades"
#define SE_NAME_ZEUS "Zeus" #define SE_NAME_ZEUS "Zeus"
@ -125,46 +124,49 @@
* by Chapront/Chapront-Touzé/Francou A&A 387 (2002), p. 705. * by Chapront/Chapront-Touzé/Francou A&A 387 (2002), p. 705.
*/ */
#define SE_TIDAL_DE200 (-23.8946) #define SE_TIDAL_DE200 (-23.8946)
#define SE_TIDAL_DE403 (-25.580) /* was (-25.8) 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_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_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_DE406 (-25.826) /* was (-25.7376) until V. 1.76.2 */
#define SE_TIDAL_DE421 (-25.85) /* JPL Interoffice Memorandum 14-mar-2008 on DE421 Lunar Orbit */
#define SE_TIDAL_DE430 (-25.82) /* JPL Interoffice Memorandum 9-jul-2013 on DE430 Lunar Orbit */
#define SE_TIDAL_DE431 (-25.82) /* waiting for information */
#define SE_TIDAL_26 (-26.0) #define SE_TIDAL_26 (-26.0)
#define SE_TIDAL_DEFAULT SE_TIDAL_DE406 #define SE_TIDAL_DEFAULT SE_TIDAL_DE431
/* /*
* earlier content * earlier content
*/ */
#define PI M_PI /* 3.14159265358979323846, math.h */ #define PI M_PI /* 3.14159265358979323846, math.h */
#define TWOPI (2.0 * PI) #define TWOPI (2.0 * PI)
#define ENDMARK -99 #define ENDMARK -99
#define SEI_EPSILON -2 #define SEI_EPSILON -2
#define SEI_NUTATION -1 #define SEI_NUTATION -1
#define SEI_EMB 0 #define SEI_EMB 0
#define SEI_EARTH 0 #define SEI_EARTH 0
#define SEI_SUN 0 #define SEI_SUN 0
#define SEI_MOON 1 #define SEI_MOON 1
#define SEI_MERCURY 2 #define SEI_MERCURY 2
#define SEI_VENUS 3 #define SEI_VENUS 3
#define SEI_MARS 4 #define SEI_MARS 4
#define SEI_JUPITER 5 #define SEI_JUPITER 5
#define SEI_SATURN 6 #define SEI_SATURN 6
#define SEI_URANUS 7 #define SEI_URANUS 7
#define SEI_NEPTUNE 8 #define SEI_NEPTUNE 8
#define SEI_PLUTO 9 #define SEI_PLUTO 9
#define SEI_SUNBARY 10 /* barycentric sun */ #define SEI_SUNBARY 10 /* barycentric sun */
#define SEI_ANYBODY 11 /* any asteroid */ #define SEI_ANYBODY 11 /* any asteroid */
#define SEI_CHIRON 12 #define SEI_CHIRON 12
#define SEI_PHOLUS 13 #define SEI_PHOLUS 13
#define SEI_CERES 14 #define SEI_CERES 14
#define SEI_PALLAS 15 #define SEI_PALLAS 15
#define SEI_JUNO 16 #define SEI_JUNO 16
#define SEI_VESTA 17 #define SEI_VESTA 17
#define SEI_NPLANETS 18 #define SEI_NPLANETS 18
@ -180,21 +182,21 @@
#define SEI_FLG_HELIO 1 #define SEI_FLG_HELIO 1
#define SEI_FLG_ROTATE 2 #define SEI_FLG_ROTATE 2
#define SEI_FLG_ELLIPSE 4 #define SEI_FLG_ELLIPSE 4
#define SEI_FLG_EMBHEL 8 /* TRUE, if heliocentric earth is given #define SEI_FLG_EMBHEL 8 /* TRUE, if heliocentric earth is given
* instead of barycentric sun * instead of barycentric sun
* i.e. bary sun is computed from * i.e. bary sun is computed from
* barycentric and heliocentric earth */ * barycentric and heliocentric earth */
#define SEI_FILE_PLANET 0 #define SEI_FILE_PLANET 0
#define SEI_FILE_MOON 1 #define SEI_FILE_MOON 1
#define SEI_FILE_MAIN_AST 2 #define SEI_FILE_MAIN_AST 2
#define SEI_FILE_ANY_AST 3 #define SEI_FILE_ANY_AST 3
#define SEI_FILE_FIXSTAR 4 #define SEI_FILE_FIXSTAR 4
#if 0 #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 #endif
#define SEI_FILE_TEST_ENDIAN (0x616263L) /* abc */ #define SEI_FILE_TEST_ENDIAN (0x616263L) /* abc*/
#define SEI_FILE_BIGENDIAN 0 #define SEI_FILE_BIGENDIAN 0
#define SEI_FILE_NOREORD 0 #define SEI_FILE_NOREORD 0
#define SEI_FILE_LITENDIAN 1 #define SEI_FILE_LITENDIAN 1
@ -213,32 +215,36 @@
* with Saturn. Accepting a maximum error of 5 degrees, * with Saturn. Accepting a maximum error of 5 degrees,
* the ephemeris is good between the following dates: * the ephemeris is good between the following dates:
*/ */
#define CHIRON_START 1958470.5 /* 1.1.650 */ #define CHIRON_START 1958470.5 /* 1.1.650 */
#define CHIRON_END 3419437.5 /* 1.1.4650 */ #define CHIRON_END 3419437.5 /* 1.1.4650 */
/* Pholus's orbit is unstable as well, because he sometimes /* Pholus's orbit is unstable as well, because he sometimes
* approaches Saturn. * approaches Saturn.
* Accepting a maximum error of 5 degrees, * Accepting a maximum error of 5 degrees,
* the ephemeris is good after the following date: * 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_START 625000.5
#define MOSHPLEPH_END 2818000.5 #define MOSHPLEPH_END 2818000.5
#define MOSHLUEPH_START 625000.5 #define MOSHLUEPH_START 625000.5
#define MOSHLUEPH_END 2818000.5 #define MOSHLUEPH_END 2818000.5
#define MOSHNDEPH_START -254900.5 /* 14 Feb -5410 00:00 ET jul.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 MOSHNDEPH_END 3697000.5 */ /* 11 Dec 5409 00:00 ET, greg. cal */
#define MOSHNDEPH_START -3100015.5 /* 15 Aug -13200 00:00 ET jul.cal.*/
#define MOSHNDEPH_END 8000016.5 /* 15 Mar 17191 00:00 ET, greg. cal */
/* /*
#define MOSHPLEPH_START -225000.5 #define MOSHPLEPH_START -225000.5
#define MOSHPLEPH_END 3600000.5 #define MOSHPLEPH_END 3600000.5
#define MOSHLUEPH_START -225000.5 #define MOSHLUEPH_START -225000.5
#define MOSHLUEPH_END 3600000.5 #define MOSHLUEPH_END 3600000.5
*/ */
#if FALSE /* Alois commented out, not used anywhere */ #define JPL_DE431_START -3027215.5
#define JPLEPH_START 625307.5 /* about -3000 (DE406) */ #define JPL_DE431_END 7930192.5
#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_START 625614.927151
#define SWIEPH_END 2813641.5 #define SWIEPH_END 2813641.5
#define ALLEPH_START MOSHPLEPH_START #define ALLEPH_START MOSHPLEPH_START
@ -249,7 +255,7 @@
#define MAXORD 40 #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 OK (0)
#define ERR (-1) #define ERR (-1)
@ -260,52 +266,48 @@
#define J2000_TO_J -1 #define J2000_TO_J -1
/* we always use Astronomical Almanac constants, if available */ /* we always use Astronomical Almanac constants, if available */
#define MOON_MEAN_DIST 384400000.0 /* in m, AA 1996, F2 */ #define MOON_MEAN_DIST 384400000.0 /* in m, AA 1996, F2 */
#define MOON_MEAN_INCL 5.1453964 /* AA 1996, D2 */ #define MOON_MEAN_INCL 5.1453964 /* AA 1996, D2 */
#define MOON_MEAN_ECC 0.054900489 /* AA 1996, F2 */ #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 328900.561400 Su/(Ea+Mo) AA 2006 K7 */
#define SUN_EARTH_MRAT 332946.050895 /* Su / (Ea only) 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 */ #define EARTH_MOON_MRAT (1 / 0.0123000383) /* AA 2006, K7 */
#if 0 #if 0
#define EARTH_MOON_MRAT 81.30056 /* de406 */ #define EARTH_MOON_MRAT 81.30056 /* de406 */
#endif #endif
#define AUNIT 1.49597870691e+11 /* au in meters, AA 2006 K6 */ #define AUNIT 1.49597870691e+11 /* au in meters, AA 2006 K6 */
#define CLIGHT 2.99792458e+8 /* m/s, AA 1996 K6 */ #define CLIGHT 2.99792458e+8 /* m/s, AA 1996 K6 */
#if 0 #if 0
#define HELGRAVCONST 1.32712438e+20 /* G * M(sun), m^3/sec^2, AA 1996 K6 */ #define HELGRAVCONST 1.32712438e+20 /* G * M(sun), m^3/sec^2, AA 1996 K6 */
#endif #endif
#define HELGRAVCONST 1.32712440017987e+20 /* G * M(sun), m^3/sec^2, AA 2006 K6 */ #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 GEOGCONST 3.98600448e+14 /* G * M(earth) m^3/sec^2, AA 1996 K6 */
#define KGAUSS 0.01720209895 /* Gaussian gravitational constant K6 */ #define KGAUSS 0.01720209895 /* Gaussian gravitational constant K6 */
#define SUN_RADIUS (959.63 / 3600 * DEGTORAD) /* Meeus germ. p 391 */ #define SUN_RADIUS (959.63 / 3600 * DEGTORAD) /* Meeus germ. p 391 */
#define EARTH_RADIUS 6378136.6 /* AA 2006 K6 */ #define EARTH_RADIUS 6378136.6 /* AA 2006 K6 */
/*#define EARTH_OBLATENESS (1.0/ 298.257223563) * AA 1998 K13 */ /*#define EARTH_OBLATENESS (1.0/ 298.257223563) * AA 1998 K13 */
#define EARTH_OBLATENESS (1.0/ 298.25642) /* AA 2006 K6 */ #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 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 */ #define LIGHTTIME_AUNIT (499.0047838061/3600/24) /* 8.3167 minutes (days), AA 2006 K6 */
/* node of ecliptic measured on ecliptic 2000 */ /* node of ecliptic measured on ecliptic 2000 */
#define SSY_PLANE_NODE_E2000 (107.582569 * DEGTORAD) #define SSY_PLANE_NODE_E2000 (107.582569 * DEGTORAD)
/* node of ecliptic measured on solar system rotation plane */ /* node of ecliptic measured on solar system rotation plane */
#define SSY_PLANE_NODE (107.58883388 * DEGTORAD) #define SSY_PLANE_NODE (107.58883388 * DEGTORAD)
/* inclination of ecliptic against solar system rotation plane */ /* inclination of ecliptic against solar system rotation plane */
#define SSY_PLANE_INCL (1.578701 * DEGTORAD) #define SSY_PLANE_INCL (1.578701 * DEGTORAD)
#define KM_S_TO_AU_CTY 21.095 /* km/s to AU/century */ #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 MOON_SPEED_INTV 0.00005 /* 4.32 seconds (in days) */
#define PLAN_SPEED_INTV 0.0001 /* 8.64 seconds (in days) */ #define PLAN_SPEED_INTV 0.0001 /* 8.64 seconds (in days) */
#define MEAN_NODE_SPEED_INTV 0.001 #define MEAN_NODE_SPEED_INTV 0.001
#define NODE_CALC_INTV 0.0001 #define NODE_CALC_INTV 0.0001
#define NODE_CALC_INTV_MOSH 0.1 #define NODE_CALC_INTV_MOSH 0.1
#define NUT_SPEED_INTV 0.0001 #define NUT_SPEED_INTV 0.0001
#define DEFL_SPEED_INTV 0.0000005 #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 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]) #define dot_prod(x,y) (x[0]*y[0]+x[1]*y[1]+x[2]*y[2])
@ -314,25 +316,25 @@
/* planetary radii in meters */ /* planetary radii in meters */
#define NDIAM (SE_VESTA + 1) #define NDIAM (SE_VESTA + 1)
static const double pla_diam[NDIAM] = { 1392000000.0, /* Sun */ static const double pla_diam[NDIAM] = {1392000000.0, /* Sun */
3476300.0, /* Moon */ 3476300.0, /* Moon */
2439000.0 * 2, /* Mercury */ 2439000.0 * 2, /* Mercury */
6052000.0 * 2, /* Venus */ 6052000.0 * 2, /* Venus */
3397200.0 * 2, /* Mars */ 3397200.0 * 2, /* Mars */
71398000.0 * 2, /* Jupiter */ 71398000.0 * 2, /* Jupiter */
60000000.0 * 2, /* Saturn */ 60000000.0 * 2, /* Saturn */
25400000.0 * 2, /* Uranus */ 25400000.0 * 2, /* Uranus */
24300000.0 * 2, /* Neptune */ 24300000.0 * 2, /* Neptune */
2500000.0 * 2, /* Pluto */ 2500000.0 * 2, /* Pluto */
0, 0, 0, 0, /* nodes and apogees */ 0, 0, 0, 0, /* nodes and apogees */
6378140.0 * 2, /* Earth */ 6378140.0 * 2, /* Earth */
0.0, /* Chiron */ 0.0, /* Chiron */
0.0, /* Pholus */ 0.0, /* Pholus */
913000.0, /* Ceres */ 913000.0, /* Ceres */
523000.0, /* Pallas */ 523000.0, /* Pallas */
244000.0, /* Juno */ 244000.0, /* Juno */
501000.0, /* Vesta */ 501000.0, /* Vesta */
}; };
/* Ayanamsas /* Ayanamsas
@ -340,16 +342,13 @@ static const double pla_diam[NDIAM] = { 1392000000.0, /* Sun */
* t0 epoch of ayanamsa, TDT (ET) * t0 epoch of ayanamsa, TDT (ET)
* ayan_t0 ayanamsa value at epoch * ayan_t0 ayanamsa value at epoch
*/ */
struct aya_init struct aya_init {double t0, ayan_t0;};
{
double t0, ayan_t0;
};
static const struct aya_init ayanamsa[] = { 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) */ /*{J1900, 360 - 337.53953}, * 1: Lahiri (Robert Hand) */
{2435553.5, 23.250182778 - 0.004660222}, /* 1: Lahiri (derived from: {2435553.5, 23.250182778 - 0.004660222}, /* 1: Lahiri (derived from:
* Indian Astronomical Ephemeris 1989, p. 556; * Indian Astronomical Ephemeris 1989, p. 556;
* the subtracted value is nutation) */ * the subtracted value is nutation) */
{J1900, 360 - 333.58695}, /* 2: De Luce (Robert Hand) */ {J1900, 360 - 333.58695}, /* 2: De Luce (Robert Hand) */
{J1900, 360 - 338.98556}, /* 3: Raman (Robert Hand) */ {J1900, 360 - 338.98556}, /* 3: Raman (Robert Hand) */
{J1900, 360 - 341.33904}, /* 4: Ushashashi (Robert Hand) */ {J1900, 360 - 341.33904}, /* 4: Ushashashi (Robert Hand) */
@ -369,33 +368,33 @@ static const struct aya_init ayanamsa[] = {
{1927135.8747793, 0}, /*16: Sassanian */ {1927135.8747793, 0}, /*16: Sassanian */
/*{1746443.513, 0}, *17: Galactic Center at 0 Sagittarius */ /*{1746443.513, 0}, *17: Galactic Center at 0 Sagittarius */
{1746447.518, 0}, /*17: Galactic Center at 0 Sagittarius */ {1746447.518, 0}, /*17: Galactic Center at 0 Sagittarius */
{J2000, 0}, /*18: J2000 */ {J2000, 0}, /*18: J2000 */
{J1900, 0}, /*19: J1900 */ {J1900, 0}, /*19: J1900 */
{B1950, 0}, /*20: B1950 */ {B1950, 0}, /*20: B1950 */
{1903396.8128654, 0}, /*21: Suryasiddhanta, assuming {1903396.8128654, 0}, /*21: Suryasiddhanta, assuming
* ingress of mean Sun into Aries at point ingress of mean Sun into Aries at point
* of mean equinox of date on of mean equinox of date on
* 21.3.499, noon, Ujjain (75.7684565 E) 21.3.499, noon, Ujjain (75.7684565 E)
* = 7:30:31.57 UT */ = 7:30:31.57 UT */
{1903396.8128654, -0.21463395}, /*22: Suryasiddhanta, assuming {1903396.8128654,-0.21463395},/*22: Suryasiddhanta, assuming
* ingress of mean Sun into Aries at ingress of mean Sun into Aries at
* true position of mean Sun at same epoch */ true position of mean Sun at same epoch */
{1903396.7895321, 0}, /*23: Aryabhata, same date, but UT 6:56:55.57 {1903396.7895321, 0}, /*23: Aryabhata, same date, but UT 6:56:55.57
* analogous 21 */ analogous 21 */
{1903396.7895321, -0.23763238}, /*24: Aryabhata, analogous 22 */ {1903396.7895321,-0.23763238},/*24: Aryabhata, analogous 22 */
{0, 0}, /*25: - */ {1903396.8128654,-0.79167046},/*25: SS, Revati/zePsc at polar long. 359°50'*/
{0, 0}, /*26: - */ {1903396.8128654, 2.11070444},/*26: SS, Citra/Spica at polar long. 180° */
{0, 0}, /*27: - */ {0, 0}, /*27: True Citra (Spica always exactly at 0 Libra) */
{0, 0}, /*28: - */ {0, 0}, /*28: True Revati (zeta Psc always exactly at 0 Aries) */
{0, 0}, /*29: - */ {0, 0}, /*29: - */
}; {0, 0}, /*30: - */
};
#define PLAN_DATA struct plan_data #define PLAN_DATA struct plan_data
/* obliquity of ecliptic */ /* obliquity of ecliptic */
struct epsilon struct epsilon {
{ double teps, eps, seps, ceps; /* jd, eps, sin(eps), cos(eps) */
double teps, eps, seps, ceps; /* jd, eps, sin(eps), cos(eps) */
}; };
/* /*
@ -403,53 +402,52 @@ extern struct epsilon oec2000;
extern struct epsilon oec; extern struct epsilon oec;
*/ */
struct plan_data struct plan_data {
{ /* the following data are read from file only once, immediately after
/* the following data are read from file only once, immediately after * file has been opened */
* file has been opened */ int ibdy; /* internal body number */
int ibdy; /* internal body number */ int32 iflg; /* contains several bit flags describing the data:
int32 iflg; /* contains several bit flags describing the data: * SEI_FLG_HELIO: true if helio, false if bary
* SEI_FLG_HELIO: true if helio, false if bary * SEI_FLG_ROTATE: TRUE if coefficients are referred
* SEI_FLG_ROTATE: TRUE if coefficients are referred * to coordinate system of orbital plane
* to coordinate system of orbital plane * SEI_FLG_ELLIPSE: TRUE if reference ellipse */
* SEI_FLG_ELLIPSE: TRUE if reference ellipse */ int ncoe; /* # of coefficients of ephemeris polynomial,
int ncoe; /* # of coefficients of ephemeris polynomial, is polynomial order + 1 */
* is polynomial order + 1 */ /* where is the segment index on the file */
/* where is the segment index on the file */ int32 lndx0; /* file position of begin of planet's index */
int32 lndx0; /* file position of begin of planet's index */ int32 nndx; /* number of index entries on file: computed */
int32 nndx; /* number of index entries on file: computed */ double tfstart; /* file contains ephemeris for tfstart thru tfend */
double tfstart; /* file contains ephemeris for tfstart thru tfend */ double tfend; /* for this particular planet !!! */
double tfend; /* for this particular planet !!! */ double dseg; /* segment size (days covered by a polynomial) */
double dseg; /* segment size (days covered by a polynomial) */ /* orbital elements: */
/* orbital elements: */ double telem; /* epoch of elements */
double telem; /* epoch of elements */ double prot;
double prot; double qrot;
double qrot; double dprot;
double dprot; double dqrot;
double dqrot; double rmax; /* normalisation factor of cheby coefficients */
double rmax; /* normalisation factor of cheby coefficients */ /* in addition, if reference ellipse is used: */
/* in addition, if reference ellipse is used: */ double peri;
double peri; double dperi;
double dperi; double *refep; /* pointer to cheby coeffs of reference ellipse,
double *refep; /* pointer to cheby coeffs of reference ellipse, * size of data is 2 x ncoe */
* size of data is 2 x ncoe */ /* unpacked segment information, only updated when a segment is read: */
/* unpacked segment information, only updated when a segment is read: */ double tseg0, tseg1; /* start and end jd of current segment */
double tseg0, tseg1; /* start and end jd of current segment */ double *segp; /* pointer to unpacked cheby coeffs of segment;
double *segp; /* pointer to unpacked cheby coeffs of segment; * the size is 3 x ncoe */
* the size is 3 x ncoe */ int neval; /* how many coefficients to evaluate. this may
int neval; /* how many coefficients to evaluate. this may * be less than ncoe */
* be less than ncoe */ /* result of most recent data evaluation for this body: */
/* result of most recent data evaluation for this body: */ double teval; /* time for which previous computation was made */
double teval; /* time for which previous computation was made */ int32 iephe; /* which ephemeris was used */
int32 iephe; /* which ephemeris was used */ double x[6]; /* position and speed vectors equatorial J2000 */
double x[6]; /* position and speed vectors equatorial J2000 */ int32 xflgs; /* hel., light-time, aberr., prec. flags etc. */
int32 xflgs; /* hel., light-time, aberr., prec. flags etc. */ double xreturn[24]; /* return positions:
double xreturn[24]; /* return positions: * xreturn+0 ecliptic polar coordinates
* xreturn+0 ecliptic polar coordinates * xreturn+6 ecliptic cartesian coordinates
* xreturn+6 ecliptic cartesian coordinates * xreturn+12 equatorial polar coordinates
* xreturn+12 equatorial polar coordinates * xreturn+18 equatorial cartesian coordinates
* xreturn+18 equatorial cartesian coordinates */
*/
}; };
/* /*
@ -457,141 +455,141 @@ struct plan_data
* and constants used inside these functions. * 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 */ /* moon, s. moshmoon.c */
extern int swi_mean_node(double jd, double *x, char *serr); 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_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_moshmoon2(double jd, double *x);
extern int swi_intp_apsides(double J, double *pol, int ipli); extern int swi_intp_apsides(double J, double *pol, int ipli);
/* planets, s. moshplan.c */ /* planets, s. moshplan.c */
extern int swi_moshplan(double tjd, int ipli, AS_BOOL do_save, double *xpret, extern int swi_moshplan(double tjd, int ipli, AS_BOOL do_save, double *xpret, double *xeret, char *serr);
double *xeret, char *serr);
extern int swi_moshplan2(double J, int iplm, double *pobj); extern int swi_moshplan2(double J, int iplm, double *pobj);
extern int swi_osc_el_plan(double tjd, double *xp, int ipl, int ipli, extern int swi_osc_el_plan(double tjd, double *xp, int ipl, int ipli, double *xearth, double *xsun, char *serr);
double *xearth, double *xsun, char *serr);
extern FILE *swi_fopen(int ifno, char *fname, char *ephepath, char *serr); extern FILE *swi_fopen(int ifno, char *fname, char *ephepath, char *serr);
/* nutation */ /* nutation */
struct nut struct nut {
{ double tnut;
double tnut; double nutlo[2]; /* nutation in longitude and obliquity */
double nutlo[2]; /* nutation in longitude and obliquity */ double snut, cnut; /* sine and cosine of nutation in obliquity */
double snut, cnut; /* sine and cosine of nutation in obliquity */ double matrix[3][3];
double matrix[3][3];
}; };
struct plantbl struct plantbl {
{ char max_harmonic[9];
char max_harmonic[9]; char max_power_of_t;
char max_power_of_t; signed char *arg_tbl;
signed char *arg_tbl; double *lon_tbl;
double *lon_tbl; double *lat_tbl;
double *lat_tbl; double *rad_tbl;
double *rad_tbl; double distance;
double distance;
}; };
struct file_data struct file_data {
{ char fnam[AS_MAXCH]; /* ephemeris file name */
char fnam[AS_MAXCH]; /* ephemeris file name */ int fversion; /* version number of file */
int fversion; /* version number of file */ char astnam[50]; /* asteroid name, if asteroid file */
char astnam[50]; /* asteroid name, if asteroid file */ int32 sweph_denum; /* DE number of JPL ephemeris, which this file
int32 sweph_denum; /* DE number of JPL ephemeris, which this file * is derived from. */
* is derived from. */ FILE *fptr; /* ephemeris file pointer */
FILE *fptr; /* ephemeris file pointer */ double tfstart; /* file may be used from this date */
double tfstart; /* file may be used from this date */ double tfend; /* through this date */
double tfend; /* through this date */ int32 iflg; /* byte reorder flag and little/bigendian flag */
int32 iflg; /* byte reorder flag and little/bigendian flag */ short npl; /* how many planets in file */
short npl; /* how many planets in file */ int ipl[SEI_FILE_NMAXPLAN]; /* planet numbers */
int ipl[SEI_FILE_NMAXPLAN]; /* planet numbers */ };
struct gen_const {
double clight,
aunit,
helgravconst,
ratme,
sunradius;
}; };
struct gen_const struct save_positions {
{ int ipl;
double clight, aunit, helgravconst, ratme, sunradius; 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 save_positions struct node_data {
{ /* result of most recent data evaluation for this body: */
int ipl; double teval; /* time for which last computation was made */
double tsave; int32 iephe; /* which ephemeris was used */
int32 iflgsave; double x[6]; /* position and speed vectors equatorial J2000 */
/* position at t = tsave, int32 xflgs; /* hel., light-time, aberr., prec. flags etc. */
* in ecliptic polar (offset 0), double xreturn[24]; /* return positions:
* ecliptic cartesian (offset 6), * xreturn+0 ecliptic polar coordinates
* equatorial polar (offset 12), * xreturn+6 ecliptic cartesian coordinates
* and equatorial cartesian coordinates (offset 18). * xreturn+12 equatorial polar coordinates
* 6 doubles each for position and speed coordinates. * xreturn+18 equatorial cartesian coordinates
*/ */
double xsaves[24];
}; };
struct node_data struct topo_data {
{ double geolon, geolat, geoalt;
/* result of most recent data evaluation for this body: */ double teval;
double teval; /* time for which last computation was made */ double tjd_ut;
int32 iephe; /* which ephemeris was used */ double xobs[6];
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 topo_data struct sid_data {
{ int32 sid_mode;
double geolon, geolat, geoalt; double ayan_t0;
double teval; double t0;
double tjd_ut;
double xobs[6];
}; };
struct sid_data struct swe_data {
{ AS_BOOL ephe_path_is_set;
int32 sid_mode; short jpl_file_is_open;
double ayan_t0; FILE *fixfp; /* fixed stars file pointer */
double t0; char ephepath[AS_MAXCH];
}; char jplfnam[AS_MAXCH];
short jpldenum;
struct swe_data double eop_tjd_beg;
{ double eop_tjd_beg_horizons;
AS_BOOL ephe_path_is_set; double eop_tjd_end;
short jpl_file_is_open; double eop_tjd_end_add;
FILE *fixfp; /* fixed stars file pointer */ int eop_dpsi_loaded;
char ephepath[AS_MAXCH]; AS_BOOL geopos_is_set;
char jplfnam[AS_MAXCH]; AS_BOOL ayana_is_set;
short jpldenum; AS_BOOL is_old_starfile;
AS_BOOL geopos_is_set; struct file_data fidat[SEI_NEPHFILES];
AS_BOOL ayana_is_set; struct gen_const gcdat;
AS_BOOL is_old_starfile; struct plan_data pldat[SEI_NPLANETS];
struct file_data fidat[SEI_NEPHFILES];
struct gen_const gcdat;
struct plan_data pldat[SEI_NPLANETS];
#if 0 #if 0
struct node_data nddat[SEI_NNODE_ETC]; struct node_data nddat[SEI_NNODE_ETC];
#else #else
struct plan_data nddat[SEI_NNODE_ETC]; struct plan_data nddat[SEI_NNODE_ETC];
#endif #endif
struct save_positions savedat[SE_NPLANETS + 1]; struct save_positions savedat[SE_NPLANETS+1];
struct epsilon oec; struct epsilon oec;
struct epsilon oec2000; struct epsilon oec2000;
struct nut nut; struct nut nut;
struct nut nut2000; struct nut nut2000;
struct nut nutv; struct nut nutv;
struct topo_data topd; struct topo_data topd;
struct sid_data sidd; struct sid_data sidd;
char astelem[AS_MAXCH * 2]; char astelem[AS_MAXCH * 2];
double ast_G; double ast_G;
double ast_H; double ast_H;
double ast_diam; double ast_diam;
int i_saved_planet_name; int i_saved_planet_name;
char saved_planet_name[80]; char saved_planet_name[80];
double dpsi[36525]; /* works for 100 years after 1962 */
double deps[36525];
}; };
extern struct swe_data FAR swed; extern struct swe_data FAR swed;

View File

@ -1,4 +1,3 @@
/************************************************************ /************************************************************
$Header: /home/dieter/sweph/RCS/swephexp.h,v 1.75 2009/04/08 07:19:08 dieter Exp $ $Header: /home/dieter/sweph/RCS/swephexp.h,v 1.75 2009/04/08 07:19:08 dieter Exp $
SWISSEPH: exported definitions and constants SWISSEPH: exported definitions and constants
@ -20,7 +19,6 @@
Authors: Dieter Koch and Alois Treindl, Astrodienst Zurich Authors: Dieter Koch and Alois Treindl, Astrodienst Zurich
************************************************************/ ************************************************************/
/* Copyright (C) 1997 - 2008 Astrodienst AG, Switzerland. All rights reserved. /* Copyright (C) 1997 - 2008 Astrodienst AG, Switzerland. All rights reserved.
License conditions License conditions
@ -76,8 +74,7 @@
*/ */
#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C" {
{
#endif #endif
#ifndef _SWEPHEXP_INCLUDED /* allow multiple #includes of swephexp.h */ #ifndef _SWEPHEXP_INCLUDED /* allow multiple #includes of swephexp.h */
@ -90,46 +87,46 @@ extern "C"
***********************************************************/ ***********************************************************/
/* values for gregflag in swe_julday() and swe_revjul() */ /* values for gregflag in swe_julday() and swe_revjul() */
#define SE_JUL_CAL 0 # define SE_JUL_CAL 0
#define SE_GREG_CAL 1 # define SE_GREG_CAL 1
/* /*
* planet numbers for the ipl parameter in swe_calc() * 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_SUN 0
#define SE_MOON 1 #define SE_MOON 1
#define SE_MERCURY 2 #define SE_MERCURY 2
#define SE_VENUS 3 #define SE_VENUS 3
#define SE_MARS 4 #define SE_MARS 4
#define SE_JUPITER 5 #define SE_JUPITER 5
#define SE_SATURN 6 #define SE_SATURN 6
#define SE_URANUS 7 #define SE_URANUS 7
#define SE_NEPTUNE 8 #define SE_NEPTUNE 8
#define SE_PLUTO 9 #define SE_PLUTO 9
#define SE_MEAN_NODE 10 #define SE_MEAN_NODE 10
#define SE_TRUE_NODE 11 #define SE_TRUE_NODE 11
#define SE_MEAN_APOG 12 #define SE_MEAN_APOG 12
#define SE_OSCU_APOG 13 #define SE_OSCU_APOG 13
#define SE_EARTH 14 #define SE_EARTH 14
#define SE_CHIRON 15 #define SE_CHIRON 15
#define SE_PHOLUS 16 #define SE_PHOLUS 16
#define SE_CERES 17 #define SE_CERES 17
#define SE_PALLAS 18 #define SE_PALLAS 18
#define SE_JUNO 19 #define SE_JUNO 19
#define SE_VESTA 20 #define SE_VESTA 20
#define SE_INTP_APOG 21 #define SE_INTP_APOG 21
#define SE_INTP_PERG 22 #define SE_INTP_PERG 22
#define SE_NPLANETS 23 #define SE_NPLANETS 23
#define SE_AST_OFFSET 10000 #define SE_AST_OFFSET 10000
#define SE_VARUNA (SE_AST_OFFSET + 20000) #define SE_VARUNA (SE_AST_OFFSET + 20000)
#define SE_FICT_OFFSET 40 #define SE_FICT_OFFSET 40
#define SE_FICT_OFFSET_1 39 #define SE_FICT_OFFSET_1 39
#define SE_FICT_MAX 999 #define SE_FICT_MAX 999
#define SE_NFICT_ELEM 15 #define SE_NFICT_ELEM 15
#define SE_COMET_OFFSET 1000 #define SE_COMET_OFFSET 1000
@ -145,7 +142,6 @@ extern "C"
#define SE_ADMETOS 45 #define SE_ADMETOS 45
#define SE_VULKANUS 46 #define SE_VULKANUS 46
#define SE_POSEIDON 47 #define SE_POSEIDON 47
/* other fictitious bodies */ /* other fictitious bodies */
#define SE_ISIS 48 #define SE_ISIS 48
#define SE_NIBIRU 49 #define SE_NIBIRU 49
@ -165,10 +161,10 @@ extern "C"
#define SE_MC 1 #define SE_MC 1
#define SE_ARMC 2 #define SE_ARMC 2
#define SE_VERTEX 3 #define SE_VERTEX 3
#define SE_EQUASC 4 /* "equatorial ascendant" */ #define SE_EQUASC 4 /* "equatorial ascendant" */
#define SE_COASC1 5 /* "co-ascendant" (W. Koch) */ #define SE_COASC1 5 /* "co-ascendant" (W. Koch) */
#define SE_COASC2 6 /* "co-ascendant" (M. Munkasey) */ #define SE_COASC2 6 /* "co-ascendant" (M. Munkasey) */
#define SE_POLASC 7 /* "polar ascendant" (M. Munkasey) */ #define SE_POLASC 7 /* "polar ascendant" (M. Munkasey) */
#define SE_NASCMC 8 #define SE_NASCMC 8
/* /*
@ -187,28 +183,30 @@ extern "C"
#define SEFLG_SWIEPH 2 /* use SWISSEPH ephemeris */ #define SEFLG_SWIEPH 2 /* use SWISSEPH ephemeris */
#define SEFLG_MOSEPH 4 /* use Moshier ephemeris */ #define SEFLG_MOSEPH 4 /* use Moshier ephemeris */
#define SEFLG_HELCTR 8 /* return heliocentric position */ #define SEFLG_HELCTR 8 /* return heliocentric position */
#define SEFLG_TRUEPOS 16 /* return true positions, not apparent */ #define SEFLG_TRUEPOS 16 /* return true positions, not apparent */
#define SEFLG_J2000 32 /* no precession, i.e. give J2000 equinox */ #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_NONUT 64 /* no nutation, i.e. mean equinox of date */
#define SEFLG_SPEED3 128 /* speed from 3 positions (do not use it, #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_SPEED 256 /* high precision speed */
#define SEFLG_NOGDEFL 512 /* turn off gravitational deflection */ #define SEFLG_NOGDEFL 512 /* turn off gravitational deflection */
#define SEFLG_NOABERR 1024 /* turn off 'annual' aberration of light */ #define SEFLG_NOABERR 1024 /* turn off 'annual' aberration of light */
#define SEFLG_EQUATORIAL (2*1024) /* equatorial positions are wanted */ #define SEFLG_EQUATORIAL (2*1024) /* equatorial positions are wanted */
#define SEFLG_XYZ (4*1024) /* cartesian, not polar, coordinates */ #define SEFLG_XYZ (4*1024) /* cartesian, not polar, coordinates */
#define SEFLG_RADIANS (8*1024) /* coordinates in radians, not degrees */ #define SEFLG_RADIANS (8*1024) /* coordinates in radians, not degrees */
#define SEFLG_BARYCTR (16*1024) /* barycentric positions */ #define SEFLG_BARYCTR (16*1024) /* barycentric positions */
#define SEFLG_TOPOCTR (32*1024) /* topocentric positions */ #define SEFLG_TOPOCTR (32*1024) /* topocentric positions */
#define SEFLG_SIDEREAL (64*1024) /* sidereal positions */ #define SEFLG_SIDEREAL (64*1024) /* sidereal positions */
#define SEFLG_ICRS (128*1024) /* ICRS (DE406 reference frame) */ #define SEFLG_ICRS (128*1024) /* ICRS (DE406 reference frame) */
#define SEFLG_DPSIDEPS_1980 (256*1024) /* reproduce JPL Horizons
* 1962 - today to 0.002 arcsec. */
#define SEFLG_JPLHOR SEFLG_DPSIDEPS_1980
#define SEFLG_JPLHOR_APPROX (512*1024) /* approximate JPL Horizons 1962 - today */
#define SE_SIDBITS 256 #define SE_SIDBITS 256
/* for projection onto ecliptic of t0 */ /* for projection onto ecliptic of t0 */
#define SE_SIDBIT_ECL_T0 256 #define SE_SIDBIT_ECL_T0 256
/* for projection onto solar system plane */ /* for projection onto solar system plane */
#define SE_SIDBIT_SSY_PLANE 512 #define SE_SIDBIT_SSY_PLANE 512
@ -238,24 +236,28 @@ extern "C"
#define SE_SIDM_SURYASIDDHANTA_MSUN 22 #define SE_SIDM_SURYASIDDHANTA_MSUN 22
#define SE_SIDM_ARYABHATA 23 #define SE_SIDM_ARYABHATA 23
#define SE_SIDM_ARYABHATA_MSUN 24 #define SE_SIDM_ARYABHATA_MSUN 24
#define SE_SIDM_SS_REVATI 25
#define SE_SIDM_SS_CITRA 26
#define SE_SIDM_TRUE_CITRA 27
#define SE_SIDM_TRUE_REVATI 28
#define SE_SIDM_USER 255 #define SE_SIDM_USER 255
#define SE_NSIDM_PREDEF 27 #define SE_NSIDM_PREDEF 29
/* used for swe_nod_aps(): */ /* used for swe_nod_aps(): */
#define SE_NODBIT_MEAN 1 /* mean nodes/apsides */ #define SE_NODBIT_MEAN 1 /* mean nodes/apsides */
#define SE_NODBIT_OSCU 2 /* osculating 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_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_FOPOINT 256 /* focal point of orbit instead of aphelion */
/* default ephemeris used when no ephemeris flagbit is set */ /* default ephemeris used when no ephemeris flagbit is set */
#define SEFLG_DEFAULTEPH SEFLG_SWIEPH #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 * the parameter star in swe_fixstar
* must allow twice this space for * must allow twice this space for
* the returned star name. * the returned star name.
*/ */
/* defines for eclipse computations */ /* defines for eclipse computations */
@ -268,35 +270,43 @@ extern "C"
#define SE_ECL_PENUMBRAL 64 #define SE_ECL_PENUMBRAL 64
#define SE_ECL_ALLTYPES_SOLAR (SE_ECL_CENTRAL|SE_ECL_NONCENTRAL|SE_ECL_TOTAL|SE_ECL_ANNULAR|SE_ECL_PARTIAL|SE_ECL_ANNULAR_TOTAL) #define SE_ECL_ALLTYPES_SOLAR (SE_ECL_CENTRAL|SE_ECL_NONCENTRAL|SE_ECL_TOTAL|SE_ECL_ANNULAR|SE_ECL_PARTIAL|SE_ECL_ANNULAR_TOTAL)
#define SE_ECL_ALLTYPES_LUNAR (SE_ECL_TOTAL|SE_ECL_PARTIAL|SE_ECL_PENUMBRAL) #define SE_ECL_ALLTYPES_LUNAR (SE_ECL_TOTAL|SE_ECL_PARTIAL|SE_ECL_PENUMBRAL)
#define SE_ECL_VISIBLE 128 #define SE_ECL_VISIBLE 128
#define SE_ECL_MAX_VISIBLE 256 #define SE_ECL_MAX_VISIBLE 256
#define SE_ECL_1ST_VISIBLE 512 #define SE_ECL_1ST_VISIBLE 512 /* begin of partial eclipse */
#define SE_ECL_2ND_VISIBLE 1024 #define SE_ECL_PARTBEG_VISIBLE 512 /* begin of partial eclipse */
#define SE_ECL_3RD_VISIBLE 2048 #define SE_ECL_2ND_VISIBLE 1024 /* begin of total eclipse */
#define SE_ECL_4TH_VISIBLE 4096 #define SE_ECL_TOTBEG_VISIBLE 1024 /* begin of total eclipse */
#define SE_ECL_ONE_TRY (32*1024) #define SE_ECL_3RD_VISIBLE 2048 /* end of total eclipse */
/* check if the next conjunction of the moon with #define SE_ECL_TOTEND_VISIBLE 2048 /* end of total eclipse */
* a planet is an occultation; don't search further */ #define SE_ECL_4TH_VISIBLE 4096 /* end of partial eclipse */
#define SE_ECL_PARTEND_VISIBLE 4096 /* end of partial eclipse */
#define SE_ECL_PENUMBBEG_VISIBLE 8192 /* begin of penumbral eclipse */
#define SE_ECL_PENUMBEND_VISIBLE 16384 /* end of penumbral eclipse */
#define SE_ECL_OCC_BEG_DAYLIGHT 8192 /* occultation begins during the day */
#define SE_ECL_OCC_END_DAYLIGHT 16384 /* occultation ends during the day */
#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() */ /* for swe_rise_transit() */
#define SE_CALC_RISE 1 #define SE_CALC_RISE 1
#define SE_CALC_SET 2 #define SE_CALC_SET 2
#define SE_CALC_MTRANSIT 4 #define SE_CALC_MTRANSIT 4
#define SE_CALC_ITRANSIT 8 #define SE_CALC_ITRANSIT 8
#define SE_BIT_DISC_CENTER 256 /* to be or'ed to SE_CALC_RISE/SET, #define SE_BIT_DISC_CENTER 256 /* to be or'ed to SE_CALC_RISE/SET,
* if rise or set of disc center is * if rise or set of disc center is
* required */ * required */
#define SE_BIT_DISC_BOTTOM 8192 /* to be or'ed to SE_CALC_RISE/SET, #define SE_BIT_DISC_BOTTOM 8192 /* to be or'ed to SE_CALC_RISE/SET,
* if rise or set of lower limb of * if rise or set of lower limb of
* disc is requried */ * disc is requried */
#define SE_BIT_NO_REFRACTION 512 /* to be or'ed to SE_CALC_RISE/SET, #define SE_BIT_NO_REFRACTION 512 /* to be or'ed to SE_CALC_RISE/SET,
* if refraction is to be ignored */ * if refraction is to be ignored */
#define SE_BIT_CIVIL_TWILIGHT 1024 /* to be or'ed to SE_CALC_RISE/SET */ #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_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_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: #define SE_BIT_FIXED_DISC_SIZE (16*1024) /* or'ed to SE_CALC_RISE/SET:
* neglect the effect of distance on * neglect the effect of distance on
* disc size */ * disc size */
/* for swe_azalt() and swe_azalt_rev() */ /* for swe_azalt() and swe_azalt_rev() */
@ -313,13 +323,15 @@ extern "C"
* only used for experimenting with various JPL ephemeris files * only used for experimenting with various JPL ephemeris files
* which are available at Astrodienst's internal network * which are available at Astrodienst's internal network
*/ */
#define SE_DE_NUMBER 406 #define SE_DE_NUMBER 431
#define SE_FNAME_DE200 "de200.eph" #define SE_FNAME_DE200 "de200.eph"
#define SE_FNAME_DE403 "de403.eph" #define SE_FNAME_DE403 "de403.eph"
#define SE_FNAME_DE404 "de404.eph" #define SE_FNAME_DE404 "de404.eph"
#define SE_FNAME_DE405 "de405.eph" #define SE_FNAME_DE405 "de405.eph"
#define SE_FNAME_DE406 "de406.eph" #define SE_FNAME_DE406 "de406.eph"
#define SE_FNAME_DFT SE_FNAME_DE406 #define SE_FNAME_DE431 "de431.eph"
#define SE_FNAME_DFT SE_FNAME_DE431
#define SE_FNAME_DFT2 SE_FNAME_DE406
#define SE_STARFILE_OLD "fixstars.cat" #define SE_STARFILE_OLD "fixstars.cat"
#define SE_STARFILE "sefstars.txt" #define SE_STARFILE "sefstars.txt"
#define SE_ASTNAMFILE "seasnam.txt" #define SE_ASTNAMFILE "seasnam.txt"
@ -336,34 +348,34 @@ extern "C"
#ifndef SE_EPHE_PATH #ifndef SE_EPHE_PATH
#if MSDOS #if MSDOS
#ifdef PAIR_SWEPH #ifdef PAIR_SWEPH
#define SE_EPHE_PATH "\\pair\\ephe\\" # define SE_EPHE_PATH "\\pair\\ephe\\"
#else #else
#define SE_EPHE_PATH "\\sweph\\ephe\\" # define SE_EPHE_PATH "\\sweph\\ephe\\"
#endif #endif
#else #else
#ifdef MACOS # ifdef MACOS
#define SE_EPHE_PATH ":ephe:" # define SE_EPHE_PATH ":ephe:"
#else # else
#define SE_EPHE_PATH ".:/users/ephe2/:/users/ephe/" # define SE_EPHE_PATH ".:/users/ephe2/:/users/ephe/"
/* At Astrodienst, we maintain two ephemeris areas for /* At Astrodienst, we maintain two ephemeris areas for
* the thousands of asteroid files: the thousands of asteroid files:
* the short files in /users/ephe/ast*, the short files in /users/ephe/ast*,
* the long file in /users/ephe2/ast*. */ the long file in /users/ephe2/ast*. */
# endif
#endif #endif
#endif #endif /* SE_EPHE_PATH */
#endif /* SE_EPHE_PATH */
/* defines for function swe_split_deg() (in swephlib.c) */ /* defines for function swe_split_deg() (in swephlib.c) */
#define SE_SPLIT_DEG_ROUND_SEC 1 # define SE_SPLIT_DEG_ROUND_SEC 1
#define SE_SPLIT_DEG_ROUND_MIN 2 # define SE_SPLIT_DEG_ROUND_MIN 2
#define SE_SPLIT_DEG_ROUND_DEG 4 # define SE_SPLIT_DEG_ROUND_DEG 4
#define SE_SPLIT_DEG_ZODIACAL 8 # define SE_SPLIT_DEG_ZODIACAL 8
#define SE_SPLIT_DEG_KEEP_SIGN 16 /* don't round to next sign, # define SE_SPLIT_DEG_KEEP_SIGN 16 /* don't round to next sign,
* e.g. 29.9999999 will be rounded * e.g. 29.9999999 will be rounded
* to 29d59'59" (or 29d59' or 29d) */ * to 29d59'59" (or 29d59' or 29d) */
#define SE_SPLIT_DEG_KEEP_DEG 32 /* don't round to next degree # define SE_SPLIT_DEG_KEEP_DEG 32 /* don't round to next degree
* e.g. 13.9999999 will be rounded * e.g. 13.9999999 will be rounded
* to 13d59'59" (or 13d59' or 13d) */ * to 13d59'59" (or 13d59' or 13d) */
/* for heliacal functions */ /* for heliacal functions */
#define SE_HELIACAL_RISING 1 #define SE_HELIACAL_RISING 1
@ -372,19 +384,20 @@ extern "C"
#define SE_EVENING_LAST SE_HELIACAL_SETTING #define SE_EVENING_LAST SE_HELIACAL_SETTING
#define SE_EVENING_FIRST 3 #define SE_EVENING_FIRST 3
#define SE_MORNING_LAST 4 #define SE_MORNING_LAST 4
#define SE_ACRONYCHAL_RISING 5 /* still not implemented */ #define SE_ACRONYCHAL_RISING 5 /* still not implemented */
#define SE_ACRONYCHAL_SETTING 6 /* still not implemented */ #define SE_ACRONYCHAL_SETTING 6 /* still not implemented */
#define SE_COSMICAL_SETTING SE_ACRONYCHAL_SETTING #define SE_COSMICAL_SETTING SE_ACRONYCHAL_SETTING
#define SE_HELFLAG_LONG_SEARCH 128 #define SE_HELFLAG_LONG_SEARCH 128
#define SE_HELFLAG_HIGH_PRECISION 256 #define SE_HELFLAG_HIGH_PRECISION 256
#define SE_HELFLAG_OPTICAL_PARAMS 512 #define SE_HELFLAG_OPTICAL_PARAMS 512
#define SE_HELFLAG_NO_DETAILS 1024 #define SE_HELFLAG_NO_DETAILS 1024
#define SE_HELFLAG_SEARCH_1_PERIOD (1 << 11) /* 2048 */ #define SE_HELFLAG_SEARCH_1_PERIOD (1 << 11) /* 2048 */
#define SE_HELFLAG_VISLIM_DARK (1 << 12) /* 4096 */ #define SE_HELFLAG_VISLIM_DARK (1 << 12) /* 4096 */
#define SE_HELFLAG_VISLIM_NOMOON (1 << 13) /* 8192 */ #define SE_HELFLAG_VISLIM_NOMOON (1 << 13) /* 8192 */
#define SE_HELFLAG_VISLIM_PHOTOPIC (1 << 14) /* 16384 */ #define SE_HELFLAG_VISLIM_PHOTOPIC (1 << 14) /* 16384 */
#define SE_HELFLAG_AVKIND_VR (1 << 15) /* 32768 */ #define SE_HELFLAG_AV (1 << 15) /* 32768 */
#define SE_HELFLAG_AVKIND_VR (1 << 15) /* 32768 */
#define SE_HELFLAG_AVKIND_PTO (1 << 16) #define SE_HELFLAG_AVKIND_PTO (1 << 16)
#define SE_HELFLAG_AVKIND_MIN7 (1 << 17) #define SE_HELFLAG_AVKIND_MIN7 (1 << 17)
#define SE_HELFLAG_AVKIND_MIN9 (1 << 18) #define SE_HELFLAG_AVKIND_MIN9 (1 << 18)
@ -396,11 +409,11 @@ extern "C"
#define SE_HELIACAL_HIGH_PRECISION 256 #define SE_HELIACAL_HIGH_PRECISION 256
#define SE_HELIACAL_OPTICAL_PARAMS 512 #define SE_HELIACAL_OPTICAL_PARAMS 512
#define SE_HELIACAL_NO_DETAILS 1024 #define SE_HELIACAL_NO_DETAILS 1024
#define SE_HELIACAL_SEARCH_1_PERIOD (1 << 11) /* 2048 */ #define SE_HELIACAL_SEARCH_1_PERIOD (1 << 11) /* 2048 */
#define SE_HELIACAL_VISLIM_DARK (1 << 12) /* 4096 */ #define SE_HELIACAL_VISLIM_DARK (1 << 12) /* 4096 */
#define SE_HELIACAL_VISLIM_NOMOON (1 << 13) /* 8192 */ #define SE_HELIACAL_VISLIM_NOMOON (1 << 13) /* 8192 */
#define SE_HELIACAL_VISLIM_PHOTOPIC (1 << 14) /* 16384 */ #define SE_HELIACAL_VISLIM_PHOTOPIC (1 << 14) /* 16384 */
#define SE_HELIACAL_AVKIND_VR (1 << 15) /* 32768 */ #define SE_HELIACAL_AVKIND_VR (1 << 15) /* 32768 */
#define SE_HELIACAL_AVKIND_PTO (1 << 16) #define SE_HELIACAL_AVKIND_PTO (1 << 16)
#define SE_HELIACAL_AVKIND_MIN7 (1 << 17) #define SE_HELIACAL_AVKIND_MIN7 (1 << 17)
#define SE_HELIACAL_AVKIND_MIN9 (1 << 18) #define SE_HELIACAL_AVKIND_MIN9 (1 << 18)
@ -420,8 +433,8 @@ extern "C"
* The option is called PAIR_SWEPH because it was introduced for * The option is called PAIR_SWEPH because it was introduced for
* Astrodienst's partner software PAIR. * Astrodienst's partner software PAIR.
*/ */
#ifdef PAIR_SWEPH #ifdef PAIR_SWEPH
#define NO_JPL # define NO_JPL
#endif #endif
/************************************************************** /**************************************************************
@ -432,60 +445,60 @@ extern "C"
* and skip to the export function decarations below. * and skip to the export function decarations below.
************************************************************/ ************************************************************/
#if defined(MAKE_DLL) || defined(USE_DLL) || defined(_WINDOWS) #if defined(MAKE_DLL) || defined(USE_DLL) || defined(_WINDOWS)
#include <windows.h> # include <windows.h>
#endif #endif
#ifdef USE_DLL #ifdef USE_DLL
#include "swedll.h" # include "swedll.h"
#endif #endif
#if defined(DOS32) || !MSDOS || defined(WIN32) #if defined(DOS32) || !MSDOS || defined(WIN32)
/* use compiler switch to define DOS32 */ /* use compiler switch to define DOS32 */
#ifndef FAR # ifndef FAR
#define FAR # define FAR
#endif # endif
#define MALLOC malloc # define MALLOC malloc
#define CALLOC calloc # define CALLOC calloc
#define FREE free # define FREE free
#else #else
#ifndef FAR # ifndef FAR
#define FAR far # define FAR far
#endif # endif
#ifdef __BORLANDC__ # ifdef __BORLANDC__
#include <alloc.h> # include <alloc.h>
#define MALLOC farmalloc # define MALLOC farmalloc
#define CALLOC farcalloc # define CALLOC farcalloc
#define FREE farfree # define FREE farfree
#else # else
#define MALLOC _fmalloc # define MALLOC _fmalloc
#define CALLOC _fcalloc # define CALLOC _fcalloc
#define FREE _ffree # define FREE _ffree
#endif # endif
#endif #endif
/* DLL defines */ /* DLL defines */
#ifdef MAKE_DLL #ifdef MAKE_DLL
#if defined (PASCAL) #if defined (PASCAL)
#define PASCAL_CONV PASCAL #define PASCAL_CONV PASCAL
#else #else
#define PASCAL_CONV #define PASCAL_CONV
#endif #endif
#ifdef MAKE_DLL16 /* 16bit DLL */ #ifdef MAKE_DLL16 /* 16bit DLL */
/* We compiled the 16bit DLL for Windows 3.x using Borland C/C++ Ver:3.x /* We compiled the 16bit DLL for Windows 3.x using Borland C/C++ Ver:3.x
* and the -WD or -WDE compiler switch. */ and the -WD or -WDE compiler switch. */
#define EXP16 __export #define EXP16 __export
#define EXP32 #define EXP32
#else /* 32bit DLL */ #else /* 32bit DLL */
/* To export symbols in the new DLL model of Win32, Microsoft /* To export symbols in the new DLL model of Win32, Microsoft
* recommends the following approach */ recommends the following approach */
#define EXP16 #define EXP16
#define EXP32 __declspec( dllexport ) #define EXP32 __declspec( dllexport )
#endif #endif
#else #else
#define PASCAL_CONV #define PASCAL_CONV
#define EXP16 #define EXP16
#define EXP32 #define EXP32
#endif #endif
#ifndef _SWEDLL_H #ifndef _SWEDLL_H
@ -494,240 +507,228 @@ extern "C"
***********************************************************/ ***********************************************************/
#define ext_def(x) extern EXP32 x FAR PASCAL_CONV EXP16 #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' */ /* the following are secret, for Victor Reijs' */
ext_def(int32) swe_heliacal_angle(double tjdut, double *dgeo, 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);
double *datm, double *dobs, 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);
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 * exports from sweph.c
****************************/ ****************************/
ext_def(char *) swe_version(char *); ext_def(char *) swe_version(char *);
/* planets, moon, nodes etc. */ /* planets, moon, nodes etc. */
ext_def(int32) swe_calc(double tjd, int ipl, int32 iflag, double *xx, ext_def( int32 ) swe_calc(
char *serr); double tjd, int ipl, int32 iflag,
double *xx,
char *serr);
ext_def(int32) swe_calc_ut(double tjd_ut, int32 ipl, int32 iflag, ext_def(int32) swe_calc_ut(double tjd_ut, int32 ipl, int32 iflag,
double *xx, char *serr); double *xx, char *serr);
/* fixed stars */ /* fixed stars */
ext_def(int32) swe_fixstar(char *star, double tjd, int32 iflag, ext_def( int32 ) swe_fixstar(
double *xx, char *serr); char *star, double tjd, int32 iflag,
double *xx,
char *serr);
ext_def(int32) swe_fixstar_ut(char *star, double tjd_ut, int32 iflag, ext_def(int32) swe_fixstar_ut(char *star, double tjd_ut, int32 iflag,
double *xx, char *serr); 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 */ /* close Swiss Ephemeris */
ext_def(void) swe_close(void); ext_def( void ) swe_close(void);
/* set directory path of ephemeris files */ /* 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 */ /* 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 */ /* 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 */ /* 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 */ /* set sidereal mode */
ext_def(void) swe_set_sid_mode(int32 sid_mode, double t0, ext_def(void) swe_set_sid_mode(int32 sid_mode, double t0, double ayan_t0);
double ayan_t0);
/* get ayanamsa */ /* 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 * exports from swedate.c
****************************/ ****************************/
ext_def(int) swe_date_conversion(int y, int m, int d, /* year, month, day */ ext_def( int ) swe_date_conversion(
double utime, /* universal time in hours (decimal) */ int y , int m , int d , /* year, month, day */
char c, /* calendar g[regorian]|j[ulian] */ double utime, /* universal time in hours (decimal) */
double *tjd); char c, /* calendar g[regorian]|j[ulian] */
double *tjd);
ext_def(double) swe_julday(int year, int month, int day, double hour, ext_def( double ) swe_julday(
int gregflag); int year, int month, int day, double hour,
int gregflag);
ext_def(void) swe_revjul(double jd, int gregflag, int *jyear, int *jmon, ext_def( void ) swe_revjul (
int *jday, double *jut); 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, ext_def(int32) swe_utc_to_jd(
int32 ihour, int32 imin, double dsec, int32 iyear, int32 imonth, int32 iday,
int32 gregflag, double *dret, char *serr); int32 ihour, int32 imin, double dsec,
int32 gregflag, double *dret, char *serr);
ext_def(void) swe_jdet_to_utc(double tjd_et, int32 gregflag, ext_def(void) swe_jdet_to_utc(
int32 * iyear, int32 * imonth, double tjd_et, int32 gregflag,
int32 * iday, int32 * ihour, int32 * imin, int32 *iyear, int32 *imonth, int32 *iday,
double *dsec); int32 *ihour, int32 *imin, double *dsec);
ext_def(void) swe_jdut1_to_utc(double tjd_ut, int32 gregflag, ext_def(void) swe_jdut1_to_utc(
int32 * iyear, int32 * imonth, double tjd_ut, int32 gregflag,
int32 * iday, int32 * ihour, int32 *iyear, int32 *imonth, int32 *iday,
int32 * imin, double *dsec); int32 *ihour, int32 *imin, double *dsec);
ext_def(void) swe_utc_time_zone(int32 iyear, int32 imonth, int32 iday, ext_def(void) swe_utc_time_zone(
int32 ihour, int32 imin, double dsec, int32 iyear, int32 imonth, int32 iday,
double d_timezone, int32 * iyear_out, int32 ihour, int32 imin, double dsec,
int32 * imonth_out, int32 * iday_out, double d_timezone,
int32 * ihour_out, int32 * imin_out, int32 *iyear_out, int32 *imonth_out, int32 *iday_out,
double *dsec_out); int32 *ihour_out, int32 *imin_out, double *dsec_out);
/**************************** /****************************
* exports from swehouse.c * exports from swehouse.c
****************************/ ****************************/
ext_def(int) swe_houses(double tjd_ut, double geolat, double geolon, ext_def( int ) swe_houses(
int hsys, double *cusps, double *ascmc); 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, ext_def( int ) swe_houses_ex(
double geolon, int hsys, double *cusps, double tjd_ut, int32 iflag, double geolat, double geolon, int hsys,
double *ascmc); 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(char *) swe_house_name(int hsys);
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);
/**************************** /****************************
* exports from swecl.c * exports from swecl.c
****************************/ ****************************/
ext_def(int32) swe_gauquelin_sector(double t_ut, int32 ipl, 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);
char *starname, int32 iflag,
int32 imeth, double *geopos,
double atpress, double attemp,
double *dgsect, char *serr);
/* computes geographic location and attributes of solar /* computes geographic location and attributes of solar
* eclipse at a given tjd */ * eclipse at a given tjd */
ext_def(int32) swe_sol_eclipse_where(double tjd, int32 ifl, ext_def (int32) swe_sol_eclipse_where(double tjd, int32 ifl, double *geopos, double *attr, char *serr);
double *geopos, double *attr,
char *serr);
ext_def(int32) swe_lun_occult_where(double tjd, int32 ipl, ext_def (int32) swe_lun_occult_where(double tjd, int32 ipl, char *starname, int32 ifl, double *geopos, double *attr, char *serr);
char *starname, int32 ifl,
double *geopos, double *attr,
char *serr);
/* computes attributes of a solar eclipse for given tjd, geolon, geolat */ /* computes attributes of a solar eclipse for given tjd, geolon, geolat */
ext_def(int32) swe_sol_eclipse_how(double tjd, int32 ifl, ext_def (int32) swe_sol_eclipse_how(double tjd, int32 ifl, double *geopos, double *attr, char *serr);
double *geopos, double *attr,
char *serr);
/* finds time of next local eclipse */ /* finds time of next local eclipse */
ext_def(int32) swe_sol_eclipse_when_loc(double tjd_start, int32 ifl, ext_def (int32) swe_sol_eclipse_when_loc(double tjd_start, int32 ifl, double *geopos, double *tret, double *attr, int32 backward, char *serr);
double *geopos, double *tret,
double *attr, int32 backward,
char *serr);
ext_def(int32) swe_lun_occult_when_loc(double tjd_start, int32 ipl, ext_def (int32) swe_lun_occult_when_loc(double tjd_start, int32 ipl, char *starname, int32 ifl,
char *starname, int32 ifl, double *geopos, double *tret, double *attr, int32 backward, char *serr);
double *geopos, double *tret,
double *attr, int32 backward,
char *serr);
/* finds time of next eclipse globally */ /* finds time of next eclipse globally */
ext_def(int32) swe_sol_eclipse_when_glob(double tjd_start, int32 ifl, ext_def (int32) swe_sol_eclipse_when_glob(double tjd_start, int32 ifl, int32 ifltype,
int32 ifltype, double *tret, double *tret, int32 backward, char *serr);
int32 backward, char *serr);
/* finds time of next occultation globally */ /* finds time of next occultation globally */
ext_def(int32) swe_lun_occult_when_glob(double tjd_start, int32 ipl, ext_def (int32) swe_lun_occult_when_glob(double tjd_start, int32 ipl, char *starname, int32 ifl, int32 ifltype,
char *starname, int32 ifl, double *tret, int32 backward, char *serr);
int32 ifltype, double *tret,
int32 backward, char *serr);
/* computes attributes of a lunar eclipse for given tjd */ /* computes attributes of a lunar eclipse for given tjd */
ext_def(int32) swe_lun_eclipse_how(double tjd_ut, int32 ifl, ext_def (int32) swe_lun_eclipse_how(
double *geopos, double *attr, double tjd_ut,
char *serr); int32 ifl,
double *geopos,
double *attr,
char *serr);
ext_def(int32) swe_lun_eclipse_when(double tjd_start, int32 ifl, ext_def (int32) swe_lun_eclipse_when(double tjd_start, int32 ifl, int32 ifltype,
int32 ifltype, double *tret, double *tret, int32 backward, char *serr);
int32 backward, char *serr);
ext_def (int32) swe_lun_eclipse_when_loc(double tjd_start, int32 ifl,
double *geopos, double *tret, double *attr, int32 backward, char *serr);
/* planetary phenomena */ /* planetary phenomena */
ext_def(int32) swe_pheno(double tjd, int32 ipl, int32 iflag, ext_def (int32) swe_pheno(double tjd, int32 ipl, int32 iflag, double *attr, char *serr);
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_ut(double tjd_ut, int32 ipl, int32 iflag, ext_def (double) swe_refrac(double inalt, double atpress, double attemp, int32 calc_flag);
double *attr, char *serr);
ext_def(double) swe_refrac(double inalt, double atpress, double attemp, ext_def (double) swe_refrac_extended(double inalt, double geoalt, double atpress, double attemp, double lapse_rate, int32 calc_flag, double *dret);
int32 calc_flag);
ext_def(double) swe_refrac_extended(double inalt, double geoalt, ext_def (void) swe_set_lapse_rate(double lapse_rate);
double atpress, double attemp,
double lapse_rate, int32 calc_flag,
double *dret);
ext_def(void) swe_set_lapse_rate(double lapse_rate); 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_azalt(double tjd_ut, int32 calc_flag, double *geopos, ext_def (void) swe_azalt_rev(
double atpress, double attemp, double *xin, double tjd_ut,
double *xaz); int32 calc_flag,
double *geopos,
double *xin,
double *xout);
ext_def(void) swe_azalt_rev(double tjd_ut, int32 calc_flag, ext_def (int32) swe_rise_trans_true_hor(
double *geopos, double *xin, double *xout); 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_rise_trans_true_hor(double tjd_ut, int32 ipl, ext_def (int32) swe_rise_trans(
char *starname, int32 epheflag, double tjd_ut, int32 ipl, char *starname,
int32 rsmi, double *geopos, int32 epheflag, int32 rsmi,
double atpress, double attemp, double *geopos,
double horhgt, double *tret, double atpress, double attemp,
char *serr); double *tret,
char *serr);
ext_def(int32) swe_rise_trans(double tjd_ut, int32 ipl, char *starname, ext_def (int32) swe_nod_aps(double tjd_et, int32 ipl, int32 iflag,
int32 epheflag, int32 rsmi, int32 method,
double *geopos, double atpress, double *xnasc, double *xndsc,
double attemp, double *tret, char *serr); double *xperi, double *xaphe,
char *serr);
ext_def(int32) swe_nod_aps(double tjd_et, int32 ipl, int32 iflag, ext_def (int32) swe_nod_aps_ut(double tjd_ut, int32 ipl, int32 iflag,
int32 method, double *xnasc, double *xndsc, int32 method,
double *xperi, double *xaphe, char *serr); double *xnasc, double *xndsc,
double *xperi, double *xaphe,
ext_def(int32) swe_nod_aps_ut(double tjd_ut, int32 ipl, int32 iflag, char *serr);
int32 method, double *xnasc,
double *xndsc, double *xperi,
double *xaphe, char *serr);
/**************************** /****************************
@ -735,31 +736,31 @@ extern "C"
****************************/ ****************************/
/* delta t */ /* delta t */
ext_def(double) swe_deltat(double tjd); ext_def( double ) swe_deltat(double tjd);
/* equation of time */ /* equation of time */
ext_def(int) swe_time_equ(double tjd, double *te, char *serr); ext_def(int32) swe_time_equ(double tjd, double *te, char *serr);
ext_def(int32) swe_lmt_to_lat(double tjd_lmt, double geolon, double *tjd_lat, char *serr);
ext_def(int32) swe_lat_to_lmt(double tjd_lat, double geolon, double *tjd_lmt, char *serr);
/* sidereal time */ /* sidereal time */
ext_def(double) swe_sidtime0(double tjd_ut, double eps, double nut); ext_def( double ) swe_sidtime0(double tjd_ut, double eps, double nut);
ext_def(double) swe_sidtime(double tjd_ut); ext_def( double ) swe_sidtime(double tjd_ut);
/* coordinate transformation polar -> polar */ /* coordinate transformation polar -> polar */
ext_def(void) swe_cotrans(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); ext_def( void ) swe_cotrans_sp(double *xpo, double *xpn, double eps);
/* tidal acceleration to be used in swe_deltat() */ /* tidal acceleration to be used in swe_deltat() */
ext_def(double) swe_get_tid_acc(void); ext_def( double ) swe_get_tid_acc(void);
ext_def(void) swe_set_tid_acc(double t_acc); ext_def( void ) swe_set_tid_acc(double t_acc);
ext_def(double) swe_degnorm(double x); ext_def( double ) swe_degnorm(double x);
ext_def(double) swe_radnorm(double x); ext_def( double ) swe_radnorm(double x);
ext_def(double) swe_rad_midp(double x1, double x0); ext_def( double ) swe_rad_midp(double x1, double x0);
ext_def(double) swe_deg_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, ext_def( void ) swe_split_deg(double ddeg, int32 roundflag, int32 *ideg, int32 *imin, int32 *isec, double *dsecfr, int32 *isgn);
int32 * imin, int32 * isec, double *dsecfr,
int32 * isgn);
/******************************************************* /*******************************************************
* other functions from swephlib.c; * other functions from swephlib.c;
@ -768,40 +769,38 @@ extern "C"
********************************************************/ ********************************************************/
/* normalize argument into interval [0..DEG360] */ /* 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[ */ /* 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[ */ /* 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_difdeg2n(double p1, double p2);
ext_def(double) swe_difrad2n(double p1, double p2); ext_def( double ) swe_difrad2n(double p1, double p2);
/* round second, but at 29.5959 always down */ /* 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 */ /* 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 */ /* 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, ext_def( char *) swe_cs2timestr(CSEC t, int sep, AS_BOOL suppressZero, char *a);
char *a);
ext_def(char *) swe_cs2lonlatstr(CSEC t, char pchar, char mchar, ext_def( char *) swe_cs2lonlatstr(CSEC t, char pchar, char mchar, char *s);
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 #ifdef __cplusplus
} /* extern C */ } /* extern C */
#endif #endif

File diff suppressed because it is too large Load Diff

View File

@ -5,7 +5,6 @@
Authors: Dieter Koch and Alois Treindl, Astrodienst Zurich Authors: Dieter Koch and Alois Treindl, Astrodienst Zurich
************************************************************/ ************************************************************/
/* Copyright (C) 1997 - 2008 Astrodienst AG, Switzerland. All rights reserved. /* Copyright (C) 1997 - 2008 Astrodienst AG, Switzerland. All rights reserved.
License conditions License conditions
@ -60,86 +59,153 @@
for promoting such software, products or services. for promoting such software, products or services.
*/ */
#define PREC_IAU_1976 1
/* Set TRUE, to include Herring's (1987) corrections to IAU 1980 #define PREC_IAU_2000 2
* nutation series. AA (1996) neglects them. */ #define PREC_IAU_2006 3
#define NUT_CORR_1987 FALSE #define PREC_BRETAGNON_2003 4
#define PREC_LASKAR_1986 5
#define PREC_SIMON_1994 6
#define PREC_WILLIAMS_1994 7
#define PREC_VONDRAK_2011 8
/* Precession coefficients for remote past and future. /* Precession coefficients for remote past and future.
* One of the following four defines must be true. * One of the following four defines must be true.
*/ */
#define PREC_VONDRAK_2011 TRUE #define USE_PREC_VONDRAK_2011 TRUE
#define PREC_WILLIAMS_1994 FALSE #define USE_PREC_WILLIAMS_1994 FALSE
#define PREC_SIMON_1994 FALSE #define USE_PREC_SIMON_1994 FALSE
#define PREC_LASKAR_1986 FALSE #define USE_PREC_LASKAR_1986 FALSE
#define PREC_BRETAGNON_2003 FALSE #define USE_PREC_BRETAGNON_2003 FALSE
/* IAU precession 1976 or 2003 for recent centuries. /* IAU precession 1976 or 2003 for recent centuries.
* only one of the following two defines may be TRUE */ * only one of the following two defines may be TRUE */
#define PREC_IAU_1976 FALSE #define USE_PREC_IAU_1976 FALSE
#define PREC_IAU_2003 FALSE /* precession model P03 */ #define USE_PREC_IAU_2000 FALSE
#define PREC_IAU_1976_CTIES 2.0 /* J2000 +/- two centuries */ #define USE_PREC_IAU_2006 FALSE /* precession model P03 */
#define PREC_IAU_1976_CTIES 2.0 /* J2000 +/- two centuries */
#define PREC_IAU_2000_CTIES 2.0 /* J2000 +/- two centuries */
/* we use P03 for whole ephemeris */ /* we use P03 for whole ephemeris */
#define PREC_IAU_2003_CTIES 75.0 /* J2000 +/- 75 centuries */ #define PREC_IAU_2006_CTIES 75.0 /* J2000 +/- 75 centuries */
/* choose between the following nutation models */ /* choose between the following nutation models */
#define NUT_IAU_1980 FALSE #define NUT_IAU_1980 FALSE
#define NUT_IAU_2000A FALSE /* very time consuming ! */ #define NUT_IAU_2000A FALSE /* very time consuming ! */
#define NUT_IAU_2000B TRUE /* fast, but precision of milli-arcsec */ #define NUT_IAU_2000B TRUE /* fast, but precision of milli-arcsec */
/* Set TRUE, to include Herring's (1987) corrections to IAU 1980
* nutation series. AA (1996) neglects them. */
#define NUT_CORR_1987 FALSE
/* frame bias */
#define FRAME_BIAS_IAU2006 TRUE /* if false, frame bias iau2000 will be used
* difference is minimal. */
/* For reproducing JPL Horizons to 2 mas (SEFLG_JPLHOR):
* The user has to keep the following files up to date which contain
* the earth orientation parameters related to the IAU 1980 nutation
* theory.
* Download the file
* datacenter.iers.org/eop/-/somos/5Rgv/document/tx13iers.u24/eopc04_08.62-now
* and rename it as eop_1962_today.txt. For current data and estimations for
* the near future, also download maia.usno.navy.mil/ser7/finals.all and
* rename it as eop_finals.txt */
#define DPSI_DEPS_IAU1980_FILE_EOPC04 "eop_1962_today.txt"
#define DPSI_DEPS_IAU1980_FILE_FINALS "eop_finals.txt"
#define DPSI_DEPS_IAU1980_TJD0_HORIZONS 2437684.5
#define HORIZONS_TJD0_DPSI_DEPS_IAU1980 2437684.5
#define INCLUDE_CODE_FOR_DPSI_DEPS_IAU1980 TRUE
/* You can set the latter false if you do not want to compile the
* code required to reproduce JPL Horizons.
* Keep it TRUE in order to reproduce JPL Horizons following
* IERS Conventions 1996 (1992), p. 22. Call swe_calc_ut() with
* iflag|SEFLG_JPLHOR. This options runs only, if the files
* DPSI_DEPS_IAU1980_FILE_EOPC04 and DPSI_DEPS_IAU1980_FILE_FINALS
* are in the ephemeris path.
*/
/* If the above define INCLUDE_CODE_FOR_DPSI_DEPS_IAU1980 is FALSE or
* the software does not find the earth orientation files (see above)
* in the ephemeris path, then SEFLG_JPLHOR will run as
* SEFLG_JPLHOR_APPROX.
* The following define APPROXIMATE_HORIZONS_ASTRODIENST defines
* the handling of SEFLG_JPLHOR_APPROX.
* With this flag, planetary positions are always calculated
* using a recent precession/nutation model.
* If APPROXIMATE_HORIZONS_ASTRODIENST is FALSE, then the
* frame bias as recommended by IERS Conventions 2003 and 2010
* is *not* applied. Instead, dpsi_bias and deps_bias are added to
* nutation. This procedure is found in some older astronomical software.
* Equatorial apparent positions will be close to JPL Horizons
* (within a few mas) beetween 1962 and current years. Ecl. longitude
* will be good, latitude bad.
* If APPROXIMATE_HORIZONS_ASTRODIENST is TRUE, the approximation of
* JPL Horizons is even better. Frame bias matrix is applied with
* some correction to RA and another correction is added to epsilon.
*/
#define APPROXIMATE_HORIZONS_ASTRODIENST TRUE
#define USE_HORIZONS_METHOD_BEFORE_1980 TRUE /* Horizons method before 20-jan-1962 */
/* The latter, if combined with SEFLG_JPLHOR provides good agreement
* with JPL Horizons for 1800 - today. However, Horizons uses correct
* dpsi and deps only after 20-jan-1962. For all dates before that
* it uses dpsi and deps of 20-jan-1962, which provides a continuous
* ephemeris, but does not make sense otherwise.
* Before 1800, even this option does not provide agreement with Horizons,
* because Horizons uses a different precession model (Owen 1986)
* before 1800, which is not included in the Swiss Ephemeris.
* If this macro is FALSE then the program defaults to SEFLG_JPLHOR_APPROX
* outside the time range of correction data dpsi and deps.
* Note that this will result in a non-continuous ephemeris near
* 20-jan-1962 and current years.
*/
/* coordinate transformation */ /* coordinate transformation */
extern void swi_coortrf(double *xpo, double *xpn, double eps); extern void swi_coortrf(double *xpo, double *xpn, double eps);
/* coordinate transformation */ /* coordinate transformation */
extern void swi_coortrf2(double *xpo, double *xpn, double sineps, extern void swi_coortrf2(double *xpo, double *xpn, double sineps, double coseps);
double coseps);
/* cartesian to polar coordinates */ /* cartesian to polar coordinates */
extern void swi_cartpol(double *x, double *l); extern void swi_cartpol(double *x, double *l);
/* cartesian to polar coordinates with velocity */ /* cartesian to polar coordinates with velocity */
extern void swi_cartpol_sp(double *x, double *l); extern void swi_cartpol_sp(double *x, double *l);
extern void swi_polcart_sp(double *l, double *x); extern void swi_polcart_sp(double *l, double *x);
/* polar to cartesian coordinates */ /* polar to cartesian coordinates */
extern void swi_polcart(double *l, double *x); extern void swi_polcart(double *l, double *x);
/* GCRS to J2000 */ /* GCRS to J2000 */
extern void swi_bias(double *x, int32 iflag, AS_BOOL backward); extern void swi_bias(double *x, double tjd, int32 iflag, AS_BOOL backward);
extern void swi_get_eop_time_range(void);
/* GCRS to FK5 */ /* GCRS to FK5 */
extern void swi_icrs2fk5(double *x, int32 iflag, AS_BOOL backward); extern void swi_icrs2fk5(double *x, int32 iflag, AS_BOOL backward);
/* precession */ /* precession */
extern int swi_precess(double *R, double J, int direction); extern int swi_precess(double *R, double J, int32 iflag, int direction );
extern void swi_precess_speed(double *xx, double t, int direction); extern void swi_precess_speed(double *xx, double t, int32 iflag, int direction);
/* from sweph.c, light deflection, aberration, etc. */ /* from sweph.c, light deflection, aberration, etc. */
extern void swi_deflect_light(double *xx, double dt, int32 iflag); extern void swi_deflect_light(double *xx, double dt, int32 iflag);
extern void swi_aberr_light(double *xx, double *xe, 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_plan_for_osc_elem(int32 iflag, double tjd, double *xx);
extern int swi_trop_ra2sid_lon(double *xin, double *xout, double *xoutr, extern int swi_trop_ra2sid_lon(double *xin, double *xout, double *xoutr, int32 iflag, char *serr);
int32 iflag, char *serr); extern int swi_trop_ra2sid_lon_sosy(double *xin, double *xout, double *xoutr, int32 iflag, char *serr);
extern int swi_trop_ra2sid_lon_sosy(double *xin, double *xout, double *xoutr, extern int swi_get_observer(double tjd, int32 iflag,
int32 iflag, char *serr); AS_BOOL do_save, double *xobs, 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(); extern void swi_force_app_pos_etc();
/* obliquity of ecliptic */ /* obliquity of ecliptic */
extern void swi_check_ecliptic(double tjd); extern void swi_check_ecliptic(double tjd, int32 iflag);
extern double swi_epsiln(double J); extern double swi_epsiln(double J, int32 iflag);
extern void swi_ldp_peps(double J, double *dpre, double *deps); extern void swi_ldp_peps(double J, double *dpre, double *deps);
/* nutation */ /* nutation */
extern void swi_check_nutation(double tjd, int32 iflag); extern void swi_check_nutation(double tjd, int32 iflag);
extern int swi_nutation(double J, double *nutlo); extern int swi_nutation(double J, int32 iflag, double *nutlo);
extern void swi_nutate(double *xx, int32 iflag, AS_BOOL backward); extern void swi_nutate(double *xx, int32 iflag, AS_BOOL backward);
extern void swi_mean_lunar_elements(double tjd, double *node, double *dnode, extern void swi_mean_lunar_elements(double tjd,
double *peri, double *dperi); double *node, double *dnode,
double *peri, double *dperi);
/* */ /* */
extern double swi_mod2PI(double x); extern double swi_mod2PI(double x);
@ -149,7 +215,6 @@ extern double swi_edcheb(double x, double *coef, int ncf);
/* cross product of vectors */ /* cross product of vectors */
extern void swi_cross_prod(double *a, double *b, double *x); extern void swi_cross_prod(double *a, double *b, double *x);
/* dot product of vecotrs */ /* dot product of vecotrs */
extern double swi_dot_prod_unit(double *x, double *y); extern double swi_dot_prod_unit(double *x, double *y);
@ -173,15 +238,17 @@ extern void swi_FK4_FK5(double *xp, double tjd);
extern char *swi_strcpy(char *to, char *from); extern char *swi_strcpy(char *to, char *from);
extern char *swi_strncpy(char *to, char *from, size_t n); extern char *swi_strncpy(char *to, char *from, size_t n);
extern double swi_deltat_ephe(double tjd_ut, int32 epheflag);
#ifdef TRACE #ifdef TRACE
#define TRACE_COUNT_MAX 10000 # define TRACE_COUNT_MAX 10000
extern FILE *swi_fp_trace_c; extern FILE *swi_fp_trace_c;
extern FILE *swi_fp_trace_out; extern FILE *swi_fp_trace_out;
extern void swi_open_trace(char *serr); extern void swi_open_trace(char *serr);
extern int32 swi_trace_count; extern int32 swi_trace_count;
static char *fname_trace_c = "swetrace.c"; static char *fname_trace_c = "swetrace.c";
static char *fname_trace_out = "swetrace.txt"; static char *fname_trace_out = "swetrace.txt";
#ifdef FORCE_IFLAG #ifdef FORCE_IFLAG
static char *fname_force_flg = "force.flg"; static char *fname_force_flg = "force.flg";
#endif #endif
#endif /* TRACE */ #endif /* TRACE */

File diff suppressed because it is too large Load Diff