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_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_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])
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_API_VERSION], [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
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])
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)
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
%doc ChangeLog
%{_libdir}/libswe-1.76.so.*
%{_libdir}/libswe-@SWE_VERSION@.so.*
%{_libdir}/libswe-glib-@SWE_GLIB_API_VERSION@.so.*
%{_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}/*
%{_libdir}/pkgconfig/*
%{_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
%{_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
library in a reduced form, so it can be used in an Autotools project like
Astrognome.
This directory contains version 2.0 of the Swiss Ephemeris programming library
in a reduced form, so it can be used in an Autotools project like Astrognome.
If you need the full version, you can download it from
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
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_1_76_la_CFLAGS = $(CFLAGS) -Wall
libswe_1_76_la_LIBADD = $(LIBS)
lib_LTLIBRARIES = libswe-2.0.la
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_2_0_la_CFLAGS = $(CFLAGS) -Wall
libswe_2_0_la_LIBADD = $(LIBS)
EXTRA_DIST = \
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 $
version 15-feb-89 16:30
@ -8,7 +7,6 @@
swe_julday()
************************************************************/
/* Copyright (C) 1997 - 2008 Astrodienst AG, Switzerland. All rights reserved.
License conditions
@ -85,14 +83,15 @@
Return: OK or ERR (for illegal date)
*********************************************************/
#include "swephexp.h"
#include "sweph.h"
# include "swephexp.h"
# include "sweph.h"
static AS_BOOL init_leapseconds_done = FALSE;
int FAR PASCAL_CONV
swe_date_conversion(int y, int m, int d, /* day, month, year */
int FAR PASCAL_CONV swe_date_conversion(int y,
int m,
int d, /* day, month, year */
double uttime, /* UT in hours (decimal) */
char c, /* calendar g[regorian]|j[ulian] */
double *tjd)
@ -108,8 +107,7 @@ swe_date_conversion(int y, int m, int d, /* day, month, year */
*tjd = jd;
if (rmon == m && rday == d && ryear == y) {
return OK;
}
else {
} else {
return ERR;
}
} /* end date_conversion */
@ -163,29 +161,24 @@ swe_date_conversion(int y, int m, int d, /* day, month, year */
and notifies errors like 32 January.
****************************************************************/
double FAR PASCAL_CONV
swe_julday(int year, int month, int day, double hour, int gregflag)
double FAR PASCAL_CONV swe_julday(int year, int month, int day, double hour, int gregflag)
{
double jd;
double u, u0, u1, u2;
double u,u0,u1,u2;
u = year;
if (month < 3)
u -= 1;
if (month < 3) u -=1;
u0 = u + 4712.0;
u1 = month + 1.0;
if (u1 < 4)
u1 += 12.0;
jd = floor(u0 * 365.25)
+ floor(30.6 * u1 + 0.000001)
+ day + hour / 24.0 - 63.5;
if (u1 < 4) u1 += 12.0;
jd = floor(u0*365.25)
+ floor(30.6*u1+0.000001)
+ day + hour/24.0 - 63.5;
if (gregflag == SE_GREG_CAL) {
u2 = floor(fabs(u) / 100) - floor(fabs(u) / 400);
if (u < 0.0)
u2 = -u2;
if (u < 0.0) u2 = -u2;
jd = jd - u2 + 2;
if ((u < 0.0) && (u / 100 == floor(u / 100))
&& (u / 400 != floor(u / 400)))
jd -= 1;
if ((u < 0.0) && (u/100 == floor(u/100)) && (u/400 != floor(u/400)))
jd -=1;
}
return jd;
}
@ -209,27 +202,24 @@ swe_julday(int year, int month, int day, double hour, int gregflag)
Original author Mark Pottenger, Los Angeles.
with bug fix for year < -4711 16-aug-88 Alois Treindl
*************************************************************************/
void FAR PASCAL_CONV
swe_revjul(double jd, int gregflag, int *jyear, int *jmon, int *jday,
double *jut)
void FAR PASCAL_CONV swe_revjul (double jd, int gregflag,
int *jyear, int *jmon, int *jday, double *jut)
{
double u0, u1, u2, u3, u4;
double u0,u1,u2,u3,u4;
u0 = jd + 32082.5;
if (gregflag == SE_GREG_CAL) {
u1 = u0 + floor(u0 / 36525.0) - floor(u0 / 146100.0) - 38.0;
if (jd >= 1830691.5)
u1 += 1;
u0 = u0 + floor(u1 / 36525.0) - floor(u1 / 146100.0) - 38.0;
u1 = u0 + floor (u0/36525.0) - floor (u0/146100.0) - 38.0;
if (jd >= 1830691.5) u1 +=1;
u0 = u0 + floor (u1/36525.0) - floor (u1/146100.0) - 38.0;
}
u2 = floor(u0 + 123.0);
u3 = floor((u2 - 122.2) / 365.25);
u4 = floor((u2 - floor(365.25 * u3)) / 30.6001);
*jmon = (int)(u4 - 1.0);
if (*jmon > 12)
*jmon -= 12;
*jday = (int)(u2 - floor(365.25 * u3) - floor(30.6001 * u4));
*jyear = (int)(u3 + floor((u4 - 2.0) / 12.0) - 4800);
*jut = (jd - floor(jd + 0.5) + 0.5) * 24.0;
u2 = floor (u0 + 123.0);
u3 = floor ( (u2 - 122.2) / 365.25);
u4 = floor ( (u2 - floor (365.25 * u3) ) / 30.6001);
*jmon = (int) (u4 - 1.0);
if (*jmon > 12) *jmon -= 12;
*jday = (int) (u2 - floor (365.25 * u3) - floor (30.6001 * u4));
*jyear = (int) (u3 + floor ( (u4 - 2.0) / 12.0) - 4800);
*jut = (jd - floor (jd + 0.5) + 0.5) * 24.0;
}
/* transform local time to UTC or UTC to local time
@ -246,11 +236,13 @@ 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 utc to local time, use -d_timezone.
*/
void FAR PASCAL_CONV
swe_utc_time_zone(int32 iyear, int32 imonth, int32 iday, int32 ihour,
int32 imin, double dsec, double d_timezone,
int32 * iyear_out, int32 * imonth_out, int32 * iday_out,
int32 * ihour_out, int32 * imin_out, double *dsec_out)
void FAR PASCAL_CONV swe_utc_time_zone(
int32 iyear, int32 imonth, int32 iday,
int32 ihour, int32 imin, double dsec,
double d_timezone,
int32 *iyear_out, int32 *imonth_out, int32 *iday_out,
int32 *ihour_out, int32 *imin_out, double *dsec_out
)
{
double tjd, d;
AS_BOOL have_leapsec = FALSE;
@ -259,7 +251,7 @@ swe_utc_time_zone(int32 iyear, int32 imonth, int32 iday, int32 ihour,
have_leapsec = TRUE;
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);
dhour -= d_timezone;
if (dhour < 0.0) {
@ -271,10 +263,10 @@ swe_utc_time_zone(int32 iyear, int32 imonth, int32 iday, int32 ihour,
dhour -= 24.0;
}
swe_revjul(tjd + 0.001, SE_GREG_CAL, iyear_out, imonth_out, iday_out, &d);
*ihour_out = (int)dhour;
d = (dhour - (double)*ihour_out) * 60;
*imin_out = (int)d;
*dsec_out = (d - (double)*imin_out) * 60;
*ihour_out = (int) dhour;
d = (dhour - (double) *ihour_out) * 60;
*imin_out = (int) d;
*dsec_out = (d - (double) *imin_out) * 60;
if (have_leapsec)
*dsec_out += 1.0;
}
@ -287,40 +279,38 @@ swe_utc_time_zone(int32 iyear, int32 imonth, int32 iday, int32 ihour,
#define NLEAP_SECONDS 24
#define NLEAP_SECONDS_SPACE 100
static int leap_seconds[NLEAP_SECONDS_SPACE] = {
19720630,
19721231,
19731231,
19741231,
19751231,
19761231,
19771231,
19781231,
19791231,
19810630,
19820630,
19830630,
19850630,
19871231,
19891231,
19901231,
19920630,
19930630,
19940630,
19951231,
19970630,
19981231,
20051231,
20081231,
0 /* keep this 0 as end mark */
19720630,
19721231,
19731231,
19741231,
19751231,
19761231,
19771231,
19781231,
19791231,
19810630,
19820630,
19830630,
19850630,
19871231,
19891231,
19901231,
19920630,
19930630,
19940630,
19951231,
19970630,
19981231,
20051231,
20081231,
0 /* keep this 0 as end mark */
};
#define J1972 2441317.5
#define NLEAP_INIT 10
/* Read additional leap second dates from external file, if given.
*/
static int
init_leapsec(void)
static int init_leapsec(void)
{
FILE *fp;
int ndat, ndat_last;
@ -333,13 +323,11 @@ init_leapsec(void)
tabsiz = NLEAP_SECONDS;
ndat_last = leap_seconds[NLEAP_SECONDS - 1];
/* no error message if file is missing */
if ((fp =
swi_fopen(-1, "seleapsec.txt", swed.ephepath, NULL)) == NULL)
if ((fp = swi_fopen(-1, "seleapsec.txt", swed.ephepath, NULL)) == NULL)
return NLEAP_SECONDS;
while (fgets(s, AS_MAXCH, fp) != NULL) {
while(fgets(s, AS_MAXCH, fp) != NULL) {
sp = s;
while (*sp == ' ' || *sp == '\t')
sp++;
while (*sp == ' ' || *sp == '\t') sp++;
sp++;
if (*sp == '#' || *sp == '\n')
continue;
@ -352,8 +340,7 @@ init_leapsec(void)
leap_seconds[tabsiz] = ndat;
tabsiz++;
}
if (tabsiz > NLEAP_SECONDS)
leap_seconds[tabsiz] = 0; /* end mark */
if (tabsiz > NLEAP_SECONDS) leap_seconds[tabsiz] = 0; /* end mark */
fclose(fp);
return tabsiz;
}
@ -387,9 +374,7 @@ init_leapsec(void)
* the leap seconds table (or the Swiss Ephemeris version) is not updated
* for a long time.
*/
int32 FAR PASCAL_CONV
swe_utc_to_jd(int32 iyear, int32 imonth, int32 iday, int32 ihour, int32 imin,
double dsec, int32 gregflag, double *dret, char *serr)
int32 FAR PASCAL_CONV swe_utc_to_jd(int32 iyear, int32 imonth, int32 iday, int32 ihour, int32 imin, double dsec, int32 gregflag, double *dret, char *serr)
{
double tjd_ut1, tjd_et, tjd_et_1972, dhour, d;
int iyear2, imonth2, iday2;
@ -401,18 +386,18 @@ swe_utc_to_jd(int32 iyear, int32 imonth, int32 iday, int32 ihour, int32 imin,
swe_revjul(tjd_ut1, gregflag, &iyear2, &imonth2, &iday2, &d);
if (iyear != iyear2 || imonth != imonth2 || iday != iday2) {
if (serr != NULL)
sprintf(serr, "invalid date: year = %d, month = %d, day = %d",
iyear, imonth, iday);
sprintf(serr, "invalid date: year = %d, month = %d, day = %d", iyear, imonth, iday);
return ERR;
}
if (ihour < 0 || ihour > 23 || imin < 0 || imin > 59 || dsec < 0
|| dsec >= 61 || (dsec >= 60
&& (imin < 59 || ihour < 23 || tjd_ut1 < J1972))) {
if (ihour < 0 || ihour > 23
|| imin < 0 || imin > 59
|| dsec < 0 || dsec >= 61
|| (dsec >= 60 && (imin < 59 || ihour < 23 || tjd_ut1 < J1972))) {
if (serr != NULL)
sprintf(serr, "invalid time: %d:%d:%.2f", ihour, imin, dsec);
return ERR;
}
dhour = (double)ihour + ((double)imin) / 60.0 + dsec / 3600.0;
dhour = (double) ihour + ((double) imin) / 60.0 + dsec / 3600.0;
/*
* before 1972, we treat input date as UT1
*/
@ -446,7 +431,7 @@ swe_utc_to_jd(int32 iyear, int32 imonth, int32 iday, int32 ihour, int32 imin,
* Check, if delta_t - nleap - 32.184 > 0.9
*/
d = swe_deltat(tjd_ut1) * 86400.0;
if (d - (double)nleap - 32.184 >= 1.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;
@ -464,8 +449,7 @@ swe_utc_to_jd(int32 iyear, int32 imonth, int32 iday, int32 ihour, int32 imin,
}
if (j != 1) {
if (serr != NULL)
sprintf(serr, "invalid time (no leap second!): %d:%d:%.2f",
ihour, imin, dsec);
sprintf(serr, "invalid time (no leap second!): %d:%d:%.2f", ihour, imin, dsec);
return ERR;
}
}
@ -475,10 +459,10 @@ swe_utc_to_jd(int32 iyear, int32 imonth, int32 iday, int32 ihour, int32 imin,
/* 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;
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;
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;
@ -500,9 +484,7 @@ 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
* updated for a long time.
*/
void FAR PASCAL_CONV
swe_jdet_to_utc(double tjd_et, int32 gregflag, int32 * iyear, int32 * imonth,
int32 * iday, int32 * ihour, int32 * imin, double *dsec)
void FAR PASCAL_CONV swe_jdet_to_utc(double tjd_et, int32 gregflag, int32 *iyear, int32 *imonth, int32 *iday, int32 *ihour, int32 *imin, double *dsec)
{
int i;
int second_60 = 0;
@ -517,10 +499,10 @@ swe_jdet_to_utc(double tjd_et, int32 gregflag, int32 * iyear, int32 * imonth,
if (tjd_et < tjd_et_1972) {
swe_revjul(tjd_ut, gregflag, iyear, imonth, iday, &d);
*ihour = (int32) d;
d -= (double)*ihour;
d -= (double) *ihour;
d *= 60;
*imin = (int32) d;
*dsec = (d - (double)*imin) * 60.0;
*dsec = (d - (double) *imin) * 60.0;
return;
}
/*
@ -528,7 +510,7 @@ swe_jdet_to_utc(double tjd_et, int32 gregflag, int32 * iyear, int32 * imonth,
* second
*/
tabsiz_nleap = init_leapsec();
swe_revjul(tjd_ut - 1, SE_GREG_CAL, &iyear2, &imonth2, &iday2, &d);
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++) {
@ -543,29 +525,25 @@ swe_jdet_to_utc(double tjd_et, int32 gregflag, int32 * iyear, int32 * imonth,
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);
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) {
} 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;
tjd = J1972 + (tjd_et - tjd_et_1972) - ((double) nleap + second_60) / 86400.0;
swe_revjul(tjd, SE_GREG_CAL, iyear, imonth, iday, &d);
*ihour = (int32) d;
d -= (double)*ihour;
d -= (double) *ihour;
d *= 60;
*imin = (int32) d;
*dsec = (d - (double)*imin) * 60.0 + second_60;
*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
@ -574,13 +552,13 @@ swe_jdet_to_utc(double tjd_et, int32 gregflag, int32 * iyear, int32 * imonth,
*/
d = swe_deltat(tjd_et);
d = swe_deltat(tjd_et - d);
if (d * 86400.0 - (double)(nleap + NLEAP_INIT) - 32.184 >= 1.0) {
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 -= (double) *ihour;
d *= 60;
*imin = (int32) d;
*dsec = (d - (double)*imin) * 60.0;
*dsec = (d - (double) *imin) * 60.0;
}
if (gregflag == SE_JUL_CAL) {
tjd = swe_julday(*iyear, *imonth, *iday, 0, SE_GREG_CAL);
@ -602,9 +580,7 @@ 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
* updated for a long time.
*/
void FAR PASCAL_CONV
swe_jdut1_to_utc(double tjd_ut, int32 gregflag, int32 * iyear, int32 * imonth,
int32 * iday, int32 * ihour, int32 * imin, double *dsec)
void FAR PASCAL_CONV swe_jdut1_to_utc(double tjd_ut, int32 gregflag, int32 *iyear, int32 *imonth, int32 *iday, int32 *ihour, int32 *imin, double *dsec)
{
double tjd_et = tjd_ut + swe_deltat(tjd_ut);
swe_jdet_to_utc(tjd_et, gregflag, iyear, imonth, iday, ihour, imin, dsec);

View File

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

View File

@ -1,4 +1,3 @@
/* SWISSEPH
* $Header: /home/dieter/sweph/RCS/swedll.h,v 1.75 2009/04/08 07:19:08 dieter Exp $
*
@ -6,7 +5,6 @@
*
**************************************************************/
/* Copyright (C) 1997 - 2008 Astrodienst AG, Switzerland. All rights reserved.
License conditions
@ -61,359 +59,281 @@
for promoting such software, products or services.
*/
/* $Id: swedll.h,v 1.75 2009/04/08 07:19:08 dieter Exp $ */
#ifdef __cplusplus
extern "C"
{
#endif /* */
extern "C" {
#endif
#ifndef _SWEDLL_H
#define _SWEDLL_H
#ifndef _SWEPHEXP_INCLUDED
#include "swephexp.h"
#endif /* */
#endif
#ifdef USE_DLL16 /* 16bit DLL */
#define DllImport extern
#else /* */
#ifdef __cplusplus
#else
# ifdef __cplusplus
#define DllImport extern "C" __declspec( dllimport )
#else /* */
# else
#define DllImport __declspec( dllimport )
#endif /* */
#endif /* */
DllImport int32 FAR PASCAL swe_heliacal_ut(double JDNDaysUTStart,
double *geopos, double *datm,
double *dobs,
char *ObjectName,
int32 TypeEvent, int32 iflag,
double *dret, char *serr);
DllImport int32 FAR PASCAL swe_heliacal_pheno_ut(double JDNDaysUT,
double *geopos,
double *datm,
double *dobs,
char *ObjectName,
int32 TypeEvent,
int32 helflag,
double *darr,
char *serr);
DllImport int32 FAR PASCAL swe_vis_limit_mag(double tjdut,
double *geopos,
double *datm, double *dobs,
char *ObjectName,
int32 helflag,
double *dret, char *serr);
# endif
#endif
DllImport int32 FAR PASCAL swe_heliacal_ut(double JDNDaysUTStart, double *geopos, double *datm, double *dobs, char *ObjectName, int32 TypeEvent, int32 iflag, double *dret, char *serr);
DllImport int32 FAR PASCAL swe_heliacal_pheno_ut(double JDNDaysUT, double *geopos, double *datm, double *dobs, char *ObjectName, int32 TypeEvent, int32 helflag, double *darr, char *serr);
DllImport int32 FAR PASCAL 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' */
DllImport int32 FAR PASCAL 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);
DllImport int32 FAR PASCAL 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,
DllImport int32 FAR PASCAL 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);
DllImport int32 FAR PASCAL 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);
DllImport double FAR PASCAL swe_degnorm(double deg);
DllImport char * FAR PASCAL swe_version(char *);
DllImport int32 FAR PASCAL swe_calc(
double tjd, int ipl, int32 iflag,
double *xx,
char *serr);
DllImport double FAR PASCAL swe_degnorm(double deg);
DllImport char *FAR PASCAL swe_version(char *);
DllImport int32 FAR PASCAL swe_calc( double tjd, int ipl, int32 iflag,
double *xx, char *serr);
DllImport int32 FAR PASCAL swe_calc_ut( double tjd_ut, int32 ipl,
int32 iflag, double *xx,
DllImport int32 FAR PASCAL swe_calc_ut(
double tjd_ut, int32 ipl, int32 iflag,
double *xx,
char *serr);
DllImport int32 FAR PASCAL swe_fixstar( char *star, double tjd,
int32 iflag, double *xx,
DllImport int32 FAR PASCAL swe_fixstar(
char *star, double tjd, int32 iflag,
double *xx,
char *serr);
DllImport int32 FAR PASCAL swe_fixstar_ut( char *star, double tjd_ut,
int32 iflag, double *xx,
DllImport int32 FAR PASCAL swe_fixstar_ut(
char *star, double tjd_ut, int32 iflag,
double *xx,
char *serr);
DllImport int32 FAR PASCAL swe_fixstar_mag( char *star, double *xx,
char *serr);
DllImport double FAR PASCAL swe_sidtime0(double tjd_ut, double ecl,
double nut);
DllImport double FAR PASCAL swe_sidtime(double tjd_ut);
DllImport double FAR PASCAL swe_deltat(double tjd);
DllImport int FAR PASCAL swe_houses( double tjd_ut, double geolat,
double geolon, int hsys,
DllImport int32 FAR PASCAL swe_fixstar_mag(
char *star, double *xx, char *serr);
DllImport double FAR PASCAL swe_sidtime0(double tjd_ut, double ecl, double nut);
DllImport double FAR PASCAL swe_sidtime(double tjd_ut);
DllImport double FAR PASCAL swe_deltat(double tjd);
DllImport int FAR PASCAL swe_houses(
double tjd_ut, double geolat, double geolon, int hsys,
double *hcusps, double *ascmc);
DllImport int FAR PASCAL swe_houses_ex( double tjd_ut, int32 iflag,
double geolat, double geolon,
int hsys, double *hcusps,
double *ascmc);
DllImport int FAR PASCAL swe_houses_armc( double armc, double geolat,
double eps, int hsys,
double *hcusps,
double *ascmc);
DllImport double FAR PASCAL swe_house_pos( double armc, double geolon,
double eps, int hsys,
double *xpin, char *serr);
DllImport int32 FAR PASCAL swe_gauquelin_sector( double t_ut, int32 ipl,
char *starname,
int32 iflag,
int32 imeth,
double *geopos,
double atpress,
double attemp,
double *dgsect,
char *serr);
DllImport void FAR PASCAL swe_set_sid_mode( int32 sid_mode, double t0,
double ayan_t0);
DllImport double FAR PASCAL swe_get_ayanamsa(double tjd_et);
DllImport double FAR PASCAL swe_get_ayanamsa_ut(double tjd_ut);
DllImport char *FAR PASCAL swe_get_ayanamsa_name(int32 isidmode);
DllImport int FAR PASCAL swe_date_conversion( int y, int m, int d, /* year, month, day */
DllImport int FAR PASCAL swe_houses_ex(
double tjd_ut, int32 iflag, double geolat, double geolon, int hsys,
double *hcusps, double *ascmc);
DllImport int FAR PASCAL swe_houses_armc(
double armc, double geolat, double eps, int hsys,
double *hcusps, double *ascmc);
DllImport double FAR PASCAL swe_house_pos(
double armc, double geolon, double eps, int hsys, double *xpin, char *serr);
DllImport char * FAR PASCAL swe_house_name(int hsys);
DllImport int32 FAR PASCAL swe_gauquelin_sector(
double t_ut, int32 ipl, char *starname, int32 iflag, int32 imeth, double *geopos, double atpress, double attemp, double *dgsect, char *serr);
DllImport void FAR PASCAL swe_set_sid_mode(
int32 sid_mode, double t0, double ayan_t0);
DllImport double FAR PASCAL swe_get_ayanamsa(double tjd_et);
DllImport double FAR PASCAL swe_get_ayanamsa_ut(double tjd_ut);
DllImport char *FAR PASCAL swe_get_ayanamsa_name(int32 isidmode);
DllImport int FAR PASCAL swe_date_conversion(
int y , int m , int d , /* year, month, day */
double utime, /* universal time in hours (decimal) */
char c, /* calendar g[regorian]|j[ulian]|a[stro = greg] */
double *tjd);
DllImport double FAR PASCAL swe_julday( int year, int mon, int mday,
double hour, int gregflag);
DllImport void FAR PASCAL swe_revjul( double jd, int gregflag,
DllImport double FAR PASCAL swe_julday(
int year, int mon, int mday,
double hour,
int gregflag);
DllImport void FAR PASCAL swe_revjul(
double jd, int gregflag,
int *year, int *mon, int *mday,
double *hour);
DllImport void FAR PASCAL swe_utc_time_zone( int32 iyear, int32 imonth,
int32 iday, int32 ihour,
int32 imin, double dsec,
double d_timezone,
int32 * iyear_out,
int32 * imonth_out,
int32 * iday_out,
int32 * ihour_out,
int32 * imin_out,
double *dsec_out);
DllImport int32 FAR PASCAL swe_utc_to_jd( int32 iyear, int32 imonth,
int32 iday, int32 ihour,
int32 imin, double dsec,
int32 gregflag, double *dret,
char *serr);
DllImport void FAR PASCAL swe_jdet_to_utc( double tjd_et,
int32 gregflag,
int32 * iyear,
int32 * imonth, int32 * iday,
int32 * ihour, int32 * imin,
double *dsec);
DllImport void FAR PASCAL swe_jdut1_to_utc( double tjd_ut,
int32 gregflag,
int32 * iyear,
int32 * imonth, int32 * iday,
int32 * ihour, int32 * imin,
double *dsec);
DllImport int FAR PASCAL swe_time_equ( double tjd, double *e,
char *serr);
DllImport double FAR PASCAL swe_get_tid_acc(void);
DllImport void FAR PASCAL swe_set_tid_acc(double tidacc);
DllImport void FAR PASCAL swe_set_ephe_path(char *path);
DllImport void FAR PASCAL swe_set_jpl_file(char *fname);
DllImport void FAR PASCAL swe_close(void);
DllImport char *FAR PASCAL swe_get_planet_name(int ipl, char *spname);
DllImport void FAR PASCAL swe_cotrans(double *xpo, double *xpn,
double eps);
DllImport void FAR PASCAL swe_cotrans_sp(double *xpo, double *xpn,
double eps);
DllImport void FAR PASCAL swe_set_topo(double geolon, double geolat,
double height);
DllImport void FAR PASCAL swe_utc_time_zone(
int32 iyear, int32 imonth, int32 iday,
int32 ihour, int32 imin, double dsec,
double d_timezone,
int32 *iyear_out, int32 *imonth_out, int32 *iday_out,
int32 *ihour_out, int32 *imin_out, double *dsec_out);
DllImport int32 FAR PASCAL swe_utc_to_jd(
int32 iyear, int32 imonth, int32 iday,
int32 ihour, int32 imin, double dsec,
int32 gregflag, double *dret, char *serr);
DllImport void FAR PASCAL swe_jdet_to_utc(
double tjd_et, int32 gregflag,
int32 *iyear, int32 *imonth, int32 *iday,
int32 *ihour, int32 *imin, double *dsec);
DllImport void FAR PASCAL swe_jdut1_to_utc(
double tjd_ut, int32 gregflag,
int32 *iyear, int32 *imonth, int32 *iday,
int32 *ihour, int32 *imin, double *dsec);
DllImport int FAR PASCAL swe_time_equ(
double tjd, double *e, char *serr);
DllImport int FAR PASCAL swe_lmt_to_lat(double tjd_lmt, double geolon, double *tjd_lat, char *serr);
DllImport int FAR PASCAL swe_lat_to_lmt(double tjd_lat, double geolon, double *tjd_lmt, char *serr);
DllImport double FAR PASCAL swe_get_tid_acc(void);
DllImport void FAR PASCAL swe_set_tid_acc(double tidacc);
DllImport void FAR PASCAL swe_set_ephe_path(char *path);
DllImport void FAR PASCAL swe_set_jpl_file(char *fname);
DllImport void FAR PASCAL swe_close(void);
DllImport char *FAR PASCAL swe_get_planet_name(int ipl, char *spname);
DllImport void FAR PASCAL swe_cotrans(double *xpo, double *xpn, double eps);
DllImport void FAR PASCAL swe_cotrans_sp(double *xpo, double *xpn, double eps);
DllImport void FAR PASCAL swe_set_topo(double geolon, double geolat, double height);
/****************************
* from swecl.c
****************************/
/* computes geographic location and attributes of solar
* eclipse at a given tjd */
DllImport int32 FAR PASCAL swe_sol_eclipse_where(double tjd, int32 ifl,
double *geopos,
double *attr,
char *serr);
DllImport int32 FAR PASCAL swe_lun_occult_where(double tjd, int32 ipl,
char *starname,
int32 ifl,
double *geopos,
double *attr,
char *serr);
DllImport int32 FAR PASCAL swe_sol_eclipse_where(double tjd, int32 ifl, double *geopos, double *attr, char *serr);
DllImport int32 FAR PASCAL swe_lun_occult_where(double tjd, int32 ipl, char *starname, int32 ifl, double *geopos, double *attr, char *serr);
/* computes attributes of a solar eclipse for given tjd, geolon, geolat */
DllImport int32 FAR PASCAL swe_sol_eclipse_how(double tjd, int32 ifl,
double *geopos,
double *attr,
char *serr);
DllImport int32 FAR PASCAL swe_sol_eclipse_how(double tjd, int32 ifl, double *geopos, double *attr, char *serr);
/* finds time of next local eclipse */
DllImport int32 FAR PASCAL swe_sol_eclipse_when_loc(double tjd_start,
int32 ifl,
double *geopos,
double *tret,
double *attr,
int32 backward,
char *serr);
DllImport int32 FAR PASCAL swe_lun_occult_when_loc(double tjd_start,
int32 ipl,
char *starname,
int32 ifl,
double *geopos,
double *tret,
double *attr,
int32 backward,
char *serr);
DllImport int32 FAR PASCAL swe_sol_eclipse_when_loc(double tjd_start, int32 ifl, double *geopos, double *tret, double *attr, int32 backward, char *serr);
DllImport int32 FAR PASCAL swe_lun_occult_when_loc(double tjd_start, int32 ipl, char *starname, int32 ifl, double *geopos, double *tret, double *attr, int32 backward, char *serr);
/* finds time of next eclipse globally */
DllImport int32 FAR PASCAL swe_sol_eclipse_when_glob(double tjd_start,
int32 ifl,
int32 ifltype,
double *tret,
int32 backward,
char *serr);
DllImport int32 FAR PASCAL swe_sol_eclipse_when_glob(double tjd_start, int32 ifl, int32 ifltype, double *tret, int32 backward, char *serr);
/* finds time of next occultation globally */
DllImport int32 FAR PASCAL swe_lun_occult_when_glob(double tjd_start,
int32 ipl,
char *starname,
int32 ifl,
int32 ifltype,
double *tret,
int32 backward,
char *serr);
DllImport int32 FAR PASCAL swe_lun_occult_when_glob(double tjd_start, int32 ipl, char *starname, int32 ifl, int32 ifltype, double *tret, int32 backward, char *serr);
/* computes attributes of a lunar eclipse for given tjd */
DllImport int32 FAR PASCAL swe_lun_eclipse_how( double tjd_ut,
DllImport int32 FAR PASCAL swe_lun_eclipse_how(
double tjd_ut,
int32 ifl,
double *geopos,
double *attr,
char *serr);
DllImport int32 FAR PASCAL swe_lun_eclipse_when(double tjd_start,
int32 ifl,
int32 ifltype,
double *tret,
int32 backward,
char *serr);
DllImport int32 FAR PASCAL swe_lun_eclipse_when(double tjd_start, int32 ifl, int32 ifltype, double *tret, int32 backward, char *serr);
DllImport int32 FAR PASCAL swe_lun_eclipse_when_loc(double tjd_start, int32 ifl, double *geopos, double *tret, double *attr, int32 backward, char *serr);
/* planetary phenomena */
DllImport int32 FAR PASCAL swe_pheno(double tjd, int32 ipl, int32 iflag,
double *attr, char *serr);
DllImport int32 FAR PASCAL swe_pheno_ut(double tjd_ut, int32 ipl,
int32 iflag, double *attr,
char *serr);
DllImport double FAR PASCAL swe_refrac(double inalt, double atpress,
double attemp, int32 calc_flag);
DllImport double FAR PASCAL swe_refrac_extended(double inalt,
double geoalt,
DllImport int32 FAR PASCAL swe_pheno(double tjd, int32 ipl, int32 iflag, double *attr, char *serr);
DllImport int32 FAR PASCAL swe_pheno_ut(double tjd_ut, int32 ipl, int32 iflag, double *attr, char *serr);
DllImport double FAR PASCAL swe_refrac(double inalt, double atpress, double attemp, int32 calc_flag);
DllImport double FAR PASCAL swe_refrac_extended(double inalt, double geoalt, double atpress, double attemp, double lapse_rate, int32 calc_flag, double *dret);
DllImport void FAR PASCAL swe_set_lapse_rate(double lapse_rate);
DllImport void FAR PASCAL swe_azalt(
double tjd_ut,
int32 calc_flag,
double *geopos,
double atpress,
double attemp,
double lapse_rate,
int32 calc_flag,
double *dret);
DllImport void FAR PASCAL swe_set_lapse_rate(double lapse_rate);
DllImport void FAR PASCAL swe_azalt( double tjd_ut, int32 calc_flag,
double *geopos, double atpress,
double attemp, double *xin,
double *xin,
double *xaz);
DllImport void FAR PASCAL swe_azalt_rev( double tjd_ut,
DllImport void FAR PASCAL swe_azalt_rev(
double tjd_ut,
int32 calc_flag,
double *geopos, double *xin,
double *geopos,
double *xin,
double *xout);
DllImport int32 FAR PASCAL swe_rise_trans( double tjd_ut, int32 ipl,
char *starname,
DllImport int32 FAR PASCAL swe_rise_trans(
double tjd_ut, int32 ipl, char *starname,
int32 epheflag, int32 rsmi,
double *geopos,
double atpress,
double attemp, double *tret,
double atpress, double attemp,
double *tret,
char *serr);
DllImport int32 FAR PASCAL swe_rise_trans_true_hor( double tjd_ut,
int32 ipl,
char *starname,
int32 epheflag,
int32 rsmi,
DllImport int32 FAR PASCAL swe_rise_trans_true_hor(
double tjd_ut, int32 ipl, char *starname,
int32 epheflag, int32 rsmi,
double *geopos,
double atpress,
double attemp,
double atpress, double attemp,
double horhgt,
double *tret,
char *serr);
DllImport int32 FAR PASCAL swe_nod_aps(double tjd_et, int32 ipl,
int32 iflag, int32 method,
double *xnasc, double *xndsc,
double *xperi, double *xaphe,
char *serr);
DllImport int32 FAR PASCAL swe_nod_aps_ut(double tjd_ut, int32 ipl,
int32 iflag, int32 method,
DllImport int32 FAR PASCAL swe_nod_aps(double tjd_et, int32 ipl, int32 iflag,
int32 method,
double *xnasc, double *xndsc,
double *xperi, double *xaphe,
char *serr);
DllImport int32 FAR PASCAL swe_nod_aps_ut(double tjd_ut, int32 ipl, int32 iflag,
int32 method,
double *xnasc, double *xndsc,
double *xperi, double *xaphe,
char *serr);
/*DllImport int32 FAR PASCAL HeliacalAngle(double Magn, double Age, int SN, double AziO, double AltM, double AziM, double JDNDaysUT, double AziS, double Lat, double HeightEye, double Temperature, double Pressure, double RH, double VR, double *dangret, char *serr);
DllImport int32 FAR PASCAL HeliacalJDut(double JDNDaysUTStart, double Age, int SN, double Lat, double Longitude, double HeightEye, double Temperature, double Pressure, double RH, double VR, char *ObjectName, int TypeEvent, char *AVkind, double *dret, char *serr);*/
/*******************************************************
* other functions from swephlib.c;
* they are not needed for Swiss Ephemeris,
* but may be useful to former Placalc users.
********************************************************/
/* normalize argument into interval [0..DEG360] */
DllImport centisec FAR PASCAL swe_csnorm(centisec p);
DllImport centisec FAR PASCAL swe_csnorm(centisec p);
/* distance in centisecs p1 - p2 normalized to [0..360[ */
DllImport centisec FAR PASCAL swe_difcsn(centisec p1, centisec p2);
DllImport double FAR PASCAL swe_difdegn(double p1, double p2);
DllImport centisec FAR PASCAL swe_difcsn (centisec p1, centisec p2);
DllImport double FAR PASCAL swe_difdegn (double p1, double p2);
/* distance in centisecs p1 - p2 normalized to [-180..180[ */
DllImport centisec FAR PASCAL swe_difcs2n(centisec p1, centisec p2);
DllImport double FAR PASCAL swe_difdeg2n(double p1, double p2);
DllImport double FAR PASCAL swe_difdeg2n(double p1, double p2);
DllImport double FAR PASCAL swe_difrad2n(double p1, double p2);
DllImport double FAR PASCAL swe_rad_midp(double x1, double x0);
DllImport double FAR PASCAL swe_deg_midp(double x1, double x0);
DllImport centisec FAR PASCAL swe_difcs2n(centisec p1, centisec p2);
DllImport double FAR PASCAL swe_difdeg2n(double p1, double p2);
DllImport double FAR PASCAL swe_difdeg2n(double p1, double p2);
DllImport double FAR PASCAL swe_difrad2n(double p1, double p2);
DllImport double FAR PASCAL swe_rad_midp(double x1, double x0);
DllImport double FAR PASCAL swe_deg_midp(double x1, double x0);
/* round second, but at 29.5959 always down */
DllImport centisec FAR PASCAL swe_csroundsec(centisec x);
DllImport centisec FAR PASCAL swe_csroundsec(centisec x);
/* double to int32 with rounding, no overflow check */
DllImport int32 FAR PASCAL swe_d2l(double x);
DllImport void FAR PASCAL swe_split_deg(double ddeg, int32 roundflag,
int32 * ideg, int32 * imin,
int32 * isec, double *dsecfr,
int32 * isgn);
DllImport int32 FAR PASCAL swe_d2l(double x);
DllImport void FAR PASCAL swe_split_deg(double ddeg, int32 roundflag, int32 *ideg, int32 *imin, int32 *isec, double *dsecfr, int32 *isgn);
/* monday = 0, ... sunday = 6 */
DllImport int FAR PASCAL swe_day_of_week(double jd);
DllImport char *FAR PASCAL swe_cs2timestr(CSEC t, int sep,
AS_BOOL suppressZero,
char *a);
DllImport char *FAR PASCAL swe_cs2lonlatstr(CSEC t, char pchar,
char mchar, char *s);
DllImport char *FAR PASCAL swe_cs2degstr(CSEC t, char *a);
DllImport int FAR PASCAL swe_day_of_week(double jd);
DllImport char *FAR PASCAL swe_cs2timestr(CSEC t, int sep, AS_BOOL suppressZero, char *a);
DllImport char *FAR PASCAL swe_cs2lonlatstr(CSEC t, char pchar, char mchar, char *s);
DllImport char *FAR PASCAL swe_cs2degstr(CSEC t, char *a);
/* additional functions for antiquated GFA basic DLL interface.
@ -421,198 +341,188 @@ DllImport int32 FAR PASCAL HeliacalJDut(double JDNDaysUTStart, double Age, int S
* char -> char *
* void -> int
*/
DllImport int32 FAR PASCAL swe_calc_d( double *tjd, int ipl,
int32 iflag, double *x,
DllImport int32 FAR PASCAL swe_calc_d(
double *tjd, int ipl, int32 iflag,
double *x,
char *serr);
DllImport int32 FAR PASCAL swe_calc_ut_d( double *tjd, int16 ipl,
int32 iflag, double *x,
DllImport int32 FAR PASCAL swe_calc_ut_d(
double *tjd, int16 ipl, int32 iflag,
double *x,
char *serr);
DllImport int32 FAR PASCAL swe_fixstar_d( char *star, double *tjd,
int32 iflag, double *x,
DllImport int32 FAR PASCAL swe_fixstar_d(
char *star, double *tjd, int32 iflag,
double *x,
char *serr);
DllImport int32 FAR PASCAL swe_fixstar_ut_d( char *star, double *tjd,
int32 iflag, double *x,
DllImport int32 FAR PASCAL swe_fixstar_ut_d(
char *star, double *tjd, int32 iflag,
double *x,
char *serr);
DllImport int FAR PASCAL swe_close_d(int ivoid);
DllImport int FAR PASCAL swe_set_ephe_path_d(char *path);
DllImport int FAR PASCAL swe_set_jpl_file_d(char *fname);
DllImport char *FAR PASCAL swe_get_planet_name_d(int ipl, char *spname);
DllImport int FAR PASCAL swe_deltat_d(double *tjd, double *deltat);
DllImport int FAR PASCAL swe_sidtime0_d(double *tjd_ut, double *eps,
double *nut, double *sidt);
DllImport int FAR PASCAL swe_sidtime_d(double *tjd_ut, double *sidt);
DllImport int FAR PASCAL swe_set_sid_mode_d( int32 sid_mode, double *t0,
double *ayan_t0);
DllImport int FAR PASCAL swe_get_ayanamsa_d(double *tjd_et,
double *ayan);
DllImport int FAR PASCAL swe_get_ayanamsa_ut_d(double *tjd_et,
double *ayan);
DllImport int FAR PASCAL swe_cotrans_d(double *xpo, double *xpn,
double *eps);
DllImport int FAR PASCAL swe_cotrans_sp_d(double *xpo, double *xpn,
double *eps);
DllImport int FAR PASCAL swe_set_topo_d(double *geolon, double *geolat,
double *height);
DllImport int FAR PASCAL swe_get_tid_acc_d(double *t_acc);
DllImport int FAR PASCAL swe_set_tid_acc_d(double *t_acc);
DllImport int FAR PASCAL swe_degnorm_d(double *x);
DllImport int FAR PASCAL swe_date_conversion_d( int y, int m, int d, /* year, month, day */
DllImport int FAR PASCAL swe_close_d(int ivoid);
DllImport int FAR PASCAL swe_set_ephe_path_d(char *path);
DllImport int FAR PASCAL swe_set_jpl_file_d(char *fname);
DllImport char *FAR PASCAL swe_get_planet_name_d(int ipl, char *spname);
DllImport int FAR PASCAL swe_deltat_d(double *tjd, double *deltat);
DllImport int FAR PASCAL swe_sidtime0_d(double *tjd_ut, double *eps,
double *nut, double *sidt);
DllImport int FAR PASCAL swe_sidtime_d(double *tjd_ut, double *sidt);
DllImport int FAR PASCAL swe_set_sid_mode_d(
int32 sid_mode, double *t0, double *ayan_t0);
DllImport int FAR PASCAL swe_get_ayanamsa_d(double *tjd_et, double *ayan);
DllImport int FAR PASCAL swe_get_ayanamsa_ut_d(double *tjd_et, double *ayan);
DllImport int FAR PASCAL swe_cotrans_d(double *xpo, double *xpn, double *eps);
DllImport int FAR PASCAL swe_cotrans_sp_d(double *xpo, double *xpn, double *eps);
DllImport int FAR PASCAL swe_set_topo_d(double *geolon, double *geolat, double *height);
DllImport int FAR PASCAL swe_get_tid_acc_d(double *t_acc);
DllImport int FAR PASCAL swe_set_tid_acc_d(double *t_acc);
DllImport int FAR PASCAL swe_degnorm_d(double *x);
DllImport int FAR PASCAL swe_date_conversion_d(
int y , int m , int d , /* year, month, day */
double *utime, /* universal time in hours (decimal) */
char *c, /* calendar g[regorian]|j[ulian]|a[stro = greg] */
double *tjd);
DllImport int FAR PASCAL swe_julday_d( int year, int month, int day,
double *hour, int gregflag,
double *tjd);
DllImport int FAR PASCAL swe_revjul_d( double *tjd, int gregflag,
int *jyear, int *jmon, int *jday,
double *jut);
DllImport int FAR PASCAL swe_houses_d( double *tjd, double *geolat,
double *geolon, int hsys,
double *hcusps, double *ascmc);
DllImport int FAR PASCAL swe_houses_ex_d( double *tjd_ut, int32 iflag,
double *geolat, double *geolon,
int hsys, double *hcusps,
double *ascmc);
DllImport int FAR PASCAL swe_houses_armc_d( double *armc,
double *geolat, double *eps,
int hsys, double *hcusps,
double *ascmc);
DllImport int FAR PASCAL swe_house_pos_d( double *armc, double *geolon,
double *eps, int hsys,
double *xpin, double *hpos,
char *serr);
DllImport int FAR PASCAL swe_julday_d(
int year, int month, int day, double *hour,
int gregflag, double *tjd);
DllImport int FAR PASCAL swe_revjul_d(
double *tjd,
int gregflag,
int *jyear, int *jmon, int *jday, double *jut);
DllImport int FAR PASCAL swe_houses_d(
double *tjd, double *geolat, double *geolon, int hsys,
double *hcusps, double *ascmc);
DllImport int FAR PASCAL swe_houses_ex_d(
double *tjd_ut, int32 iflag, double *geolat, double *geolon, int hsys,
double *hcusps, double *ascmc);
DllImport int FAR PASCAL swe_houses_armc_d(
double *armc, double *geolat, double *eps, int hsys,
double *hcusps, double *ascmc);
DllImport int FAR PASCAL swe_house_pos_d(
double *armc, double *geolon, double *eps, int hsys, double *xpin, double *hpos, char *serr);
/* normalize argument into interval [0..DEG360] */
DllImport centisec FAR PASCAL swe_csnorm_d(centisec p);
DllImport centisec FAR PASCAL swe_csnorm_d(centisec p);
/* distance in centisecs p1 - p2 normalized to [0..360[ */
DllImport centisec FAR PASCAL swe_difcsn_d(centisec p1, centisec p2);
DllImport int FAR PASCAL swe_difdegn_d(double *p1, double *p2,
double *diff);
DllImport centisec FAR PASCAL swe_difcsn_d(centisec p1, centisec p2);
DllImport int FAR PASCAL swe_difdegn_d(double *p1, double *p2, double *diff);
/* distance in centisecs p1 - p2 normalized to [-180..180[ */
DllImport centisec FAR PASCAL swe_difcs2n_d(centisec p1, centisec p2);
DllImport int FAR PASCAL swe_difdeg2n_d(double *p1, double *p2,
double *diff);
DllImport centisec FAR PASCAL swe_difcs2n_d(centisec p1, centisec p2);
DllImport int FAR PASCAL swe_difdeg2n_d(double *p1, double *p2, double *diff);
/* round second, but at 29.5959 always down */
DllImport centisec FAR PASCAL swe_csroundsec_d(centisec x);
DllImport centisec FAR PASCAL swe_csroundsec_d(centisec x);
/* double to int32 with rounding, no overflow check */
DllImport int32 FAR PASCAL swe_d2l_d(double *x);
DllImport int FAR PASCAL swe_split_deg_d(double *ddeg, int32 roundflag,
int32 * ideg, int32 * imin,
int32 * isec, double *dsecfr,
int32 * isgn);
DllImport int32 FAR PASCAL swe_d2l_d(double *x);
DllImport int FAR PASCAL swe_split_deg_d(double *ddeg, int32 roundflag, int32 *ideg, int32 *imin, int32 *isec, double *dsecfr, int32 *isgn);
/* monday = 0, ... sunday = 6 */
DllImport int FAR PASCAL swe_day_of_week_d(double *jd);
DllImport char *FAR PASCAL swe_cs2timestr_d(CSEC t, int sep,
AS_BOOL suppressZero,
char *a);
DllImport char *FAR PASCAL swe_cs2lonlatstr_d(CSEC t, char *pchar,
char *mchar, char *s);
DllImport char *FAR PASCAL swe_cs2degstr_d(CSEC t, char *a);
DllImport int FAR PASCAL swe_day_of_week_d(double *jd);
DllImport char *FAR PASCAL swe_cs2timestr_d(CSEC t, int sep, AS_BOOL suppressZero, char *a);
DllImport char *FAR PASCAL swe_cs2lonlatstr_d(CSEC t, char *pchar, char *mchar, char *s);
DllImport char *FAR PASCAL swe_cs2degstr_d(CSEC t, char *a);
/****************************
* from swecl.c
****************************/
/* computes geographic location and attributes of solar
* eclipse at a given tjd */
DllImport int32 FAR PASCAL swe_sol_eclipse_where_d(double *tjd_ut,
int32 ifl,
double *geopos,
double *attr,
char *serr);
DllImport int32 FAR PASCAL swe_sol_eclipse_where_d(double *tjd_ut, int32 ifl, double *geopos, double *attr, char *serr);
/* computes attributes of a solar eclipse for given tjd, geolon, geolat */
DllImport int32 FAR PASCAL swe_sol_eclipse_how_d(double *tjd_ut,
int32 ifl,
double geolon,
double geolat,
double geohgt,
double *attr,
char *serr);
DllImport int32 FAR PASCAL swe_sol_eclipse_how_d(double *tjd_ut, int32 ifl, double geolon, double geolat, double geohgt, double *attr, char *serr);
/* finds time of next local eclipse */
DllImport int32 FAR PASCAL swe_sol_eclipse_when_loc_d(double *tjd_start,
int32 ifl,
double *geopos,
double *tret,
double *attr,
AS_BOOL backward,
char *serr);
DllImport int32 FAR PASCAL swe_sol_eclipse_when_loc_d(double *tjd_start, int32 ifl, double *geopos, double *tret, double *attr, AS_BOOL backward, char *serr);
/* finds time of next eclipse globally */
DllImport int32 FAR PASCAL swe_sol_eclipse_when_glob_d(double
*tjd_start,
int32 ifl,
int32 ifltype,
double *tret,
AS_BOOL backward,
char *serr);
DllImport int32 FAR PASCAL swe_sol_eclipse_when_glob_d(double *tjd_start, int32 ifl, int32 ifltype,
double *tret, AS_BOOL backward, char *serr);
/* computes attributes of a lunar eclipse for given tjd */
DllImport int32 FAR PASCAL swe_lun_eclipse_how_d( double *tjd_ut,
DllImport int32 FAR PASCAL swe_lun_eclipse_how_d(
double *tjd_ut,
int32 ifl,
double *attr,
char *serr);
DllImport int32 FAR PASCAL swe_lun_eclipse_when_d(double *tjd_start,
int32 ifl,
int32 ifltype,
double *tret,
AS_BOOL backward,
char *serr);
DllImport int32 FAR PASCAL swe_pheno_d(double *tjd, int32 ipl,
int32 iflag, double *attr,
char *serr);
DllImport int32 FAR PASCAL swe_pheno_ut_d(double *tjd_ut, int32 ipl,
int32 iflag, double *attr,
char *serr);
DllImport int FAR PASCAL swe_refrac_d(double *inalt, double *atpress,
double *attemp, int32 calc_flag,
double *retalt);
DllImport int FAR PASCAL swe_azalt_d( double *tjd_ut, int32 calc_flag,
double *geopos, double *atpress,
double *attemp, double *xin,
double *xaz);
DllImport int FAR PASCAL swe_azalt_rev_d( double *tjd_ut,
DllImport int32 FAR PASCAL swe_lun_eclipse_when_d(double *tjd_start, int32 ifl, int32 ifltype,
double *tret, AS_BOOL backward, char *serr);
DllImport int32 FAR PASCAL swe_pheno_d(double *tjd, int32 ipl, int32 iflag,
double *attr, char *serr);
DllImport int32 FAR PASCAL swe_pheno_ut_d(double *tjd_ut, int32 ipl, int32 iflag, double *attr, char *serr);
DllImport int FAR PASCAL swe_refrac_d(double *inalt, double *atpress, double *attemp, int32 calc_flag, double *retalt);
DllImport int FAR PASCAL swe_azalt_d(
double *tjd_ut,
int32 calc_flag,
double *geopos, double *xin,
double *xout);
DllImport int32 FAR PASCAL swe_rise_trans_d( double *tjd_ut, int32 ipl,
char *starname,
int32 epheflag, int32 rsmi,
double *geopos,
double *atpress,
double *attemp,
double *tret, char *serr);
DllImport int32 FAR PASCAL swe_nod_aps_d(double *tjd_et, int32 ipl,
int32 iflag, int32 method,
double *xin,
double *xaz);
DllImport int FAR PASCAL swe_azalt_rev_d(
double *tjd_ut,
int32 calc_flag,
double *geopos,
double *xin,
double *xout);
DllImport int32 FAR PASCAL swe_rise_trans_d(
double *tjd_ut, int32 ipl, char *starname,
int32 epheflag, int32 rsmi,
double *geopos,
double *atpress, double *attemp,
double *tret,
char *serr);
DllImport int32 FAR PASCAL swe_nod_aps_d(double *tjd_et, int32 ipl, int32 iflag,
int32 method,
double *xnasc, double *xndsc,
double *xperi, double *xaphe,
char *serr);
DllImport int32 FAR PASCAL swe_nod_aps_ut_d(double *tjd_ut, int32 ipl, int32 iflag,
int32 method,
double *xnasc, double *xndsc,
double *xperi, double *xaphe,
char *serr);
DllImport int32 FAR PASCAL swe_nod_aps_ut_d(double *tjd_ut, int32 ipl,
int32 iflag, int32 method,
double *xnasc,
double *xndsc,
double *xperi,
double *xaphe, char *serr);
#endif /* !_SWEDLL_H */
#ifdef __cplusplus
} /* extern C */
#endif /* */
#endif

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 $
module swehouse.h
@ -60,8 +59,7 @@ house and (simple) aspect calculation
for promoting such software, products or services.
*/
struct houses
{
struct houses {
double cusp[37];
double ac;
double mc;
@ -70,7 +68,7 @@ struct houses
double coasc1;
double coasc2;
double polasc;
};
};
#define HOUSES struct houses
#define VERY_SMALL 1E-10

View File

@ -12,7 +12,6 @@
Authors: Dieter Koch and Alois Treindl, Astrodienst Zurich
************************************************************/
/* Copyright (C) 1997 - 2008 Astrodienst AG, Switzerland. All rights reserved.
License conditions
@ -73,15 +72,25 @@
#include "sweph.h"
#include "swejpl.h"
#if MSDOS
extern __int64 __cdecl _ftelli64(FILE *);
extern int __cdecl _fseeki64(FILE *, __int64, int);
typedef __int64 off_t;
#define FSEEK _fseeki64
#define FTELL _ftelli64
#else
#define _FILE_OFFSET_BITS 64
#define FSEEK fseeko
#define FTELL ftello
#endif
#define DEBUG_DO_SHOW FALSE
#ifndef NO_JPL
/*
* local globals
*/
struct jpl_save
{
struct jpl_save {
char *jplfname;
char *jplfpath;
FILE *jplfptr;
@ -89,7 +98,7 @@ struct jpl_save
double eh_cval[400];
double eh_ss[3], eh_au, eh_emrat;
int32 eh_denum, eh_ncon, eh_ipt[39];
char ch_cnam[6 * 400];
char ch_cnam[6*400];
double pv[78];
double pvsun[6];
double buf[1500];
@ -99,9 +108,9 @@ struct jpl_save
static struct jpl_save *FAR js;
static int state(double et, int32 * list, int do_bary, double *pv,
double *pvsun, double *nut, char *serr);
static int interp(double FAR * buf, double t, double intv, int32 ncfin,
static int state (double et, int32 *list, int do_bary,
double *pv, double *pvsun, double *nut, char *serr);
static int interp(double FAR *buf, double t, double intv, int32 ncfin,
int32 ncmin, int32 nain, int32 ifl, double *pv);
static int32 fsizer(char *serr);
static void reorder(char *x, int size, int number);
@ -173,8 +182,7 @@ DE200 DE102 DE403
* set to a fixed value depending as in previous releases. The caller of
* fsizer() will verify by data comparison whether it computed correctly.
*/
static int32
fsizer(char *serr)
static int32 fsizer(char *serr)
{
/* Local variables */
int32 ncon;
@ -183,23 +191,21 @@ fsizer(char *serr)
double au, ss[3];
int i, kmx, khi, nd;
int32 ksize, lpt[3];
char ttl[6 * 14 * 3];
if ((js->jplfptr =
swi_fopen(SEI_FILE_PLANET, js->jplfname, js->jplfpath,
serr)) == NULL) {
char ttl[6*14*3];
if ((js->jplfptr = swi_fopen(SEI_FILE_PLANET, js->jplfname, js->jplfpath, serr)) == NULL) {
return NOT_AVAILABLE;
}
/* ttl = ephemeris title, e.g.
* "JPL Planetary Ephemeris DE404/LE404
* Start Epoch: JED= 625296.5-3001 DEC 21 00:00:00
* Final Epoch: JED= 2817168.5 3001 JAN 17 00:00:00c */
fread((void *)&ttl[0], 1, 252, js->jplfptr);
fread((void *) &ttl[0], 1, 252, js->jplfptr);
/* cnam = names of constants */
fread((void *)js->ch_cnam, 1, 6 * 400, js->jplfptr);
fread((void *) js->ch_cnam, 1, 6*400, js->jplfptr);
/* ss[0] = start epoch of ephemeris
* ss[1] = end epoch
* ss[2] = segment size in days */
fread((void *)&ss[0], sizeof(double), 3, js->jplfptr);
fread((void *) &ss[0], sizeof(double), 3, js->jplfptr);
/* reorder ? */
if (ss[2] < 1 || ss[2] > 200)
js->do_reorder = TRUE;
@ -208,42 +214,44 @@ fsizer(char *serr)
for (i = 0; i < 3; i++)
js->eh_ss[i] = ss[i];
if (js->do_reorder)
reorder((char *)&js->eh_ss[0], sizeof(double), 3);
reorder((char *) &js->eh_ss[0], sizeof(double), 3);
/* plausibility test of these constants. Start and end date must be
* between -20000 and +20000, segment size >= 1 and <= 200 */
if (js->eh_ss[0] < -5583942 || js->eh_ss[1] > 9025909 || js->eh_ss[2] < 1
|| js->eh_ss[2] > 200) {
if (serr != NULL)
sprintf(serr, "alleged ephemeris file (%s) has invalid format.",
js->jplfname);
return (NOT_AVAILABLE);
if (js->eh_ss[0] < -5583942 || js->eh_ss[1] > 9025909 || js->eh_ss[2] < 1 || js->eh_ss[2] > 200) {
if (serr != NULL) {
strcpy(serr, "alleged ephemeris file has invalid format.");
if (strlen(serr) + strlen(js->jplfname) + 3 < AS_MAXCH) {
sprintf(serr, "alleged ephemeris file (%s) has invalid format.", js->jplfname);
}
}
return(NOT_AVAILABLE);
}
/* ncon = number of constants */
fread((void *)&ncon, sizeof(int32), 1, js->jplfptr);
fread((void *) &ncon, sizeof(int32), 1, js->jplfptr);
if (js->do_reorder)
reorder((char *)&ncon, sizeof(int32), 1);
reorder((char *) &ncon, sizeof(int32), 1);
/* au = astronomical unit */
fread((void *)&au, sizeof(double), 1, js->jplfptr);
fread((void *) &au, sizeof(double), 1, js->jplfptr);
if (js->do_reorder)
reorder((char *)&au, sizeof(double), 1);
reorder((char *) &au, sizeof(double), 1);
/* emrat = earth moon mass ratio */
fread((void *)&emrat, sizeof(double), 1, js->jplfptr);
fread((void *) &emrat, sizeof(double), 1, js->jplfptr);
if (js->do_reorder)
reorder((char *)&emrat, sizeof(double), 1);
reorder((char *) &emrat, sizeof(double), 1);
/* ipt[i+0]: coefficients of planet i start at buf[ipt[i+0]-1]
* ipt[i+1]: number of coefficients (interpolation order - 1)
* ipt[i+2]: number of intervals in segment */
fread((void *)&js->eh_ipt[0], sizeof(int32), 36, js->jplfptr);
fread((void *) &js->eh_ipt[0], sizeof(int32), 36, js->jplfptr);
if (js->do_reorder)
reorder((char *)&js->eh_ipt[0], sizeof(int32), 36);
reorder((char *) &js->eh_ipt[0], sizeof(int32), 36);
/* numde = number of jpl ephemeris "404" with de404 */
fread((void *)&numde, sizeof(int32), 1, js->jplfptr);
fread((void *) &numde, sizeof(int32), 1, js->jplfptr);
if (js->do_reorder)
reorder((char *)&numde, sizeof(int32), 1);
reorder((char *) &numde, sizeof(int32), 1);
/* read librations */
fread(&lpt[0], sizeof(int32), 3, js->jplfptr);
if (js->do_reorder)
reorder((char *)&lpt[0], sizeof(int32), 3);
reorder((char *) &lpt[0], sizeof(int32), 3);
/* fill librations into eh_ipt[36]..[38] */
for (i = 0; i < 3; ++i)
js->eh_ipt[i + 36] = lpt[i];
@ -262,9 +270,7 @@ fsizer(char *serr)
nd = 2;
else
nd = 3;
ksize =
(js->eh_ipt[khi * 3 - 3] +
nd * js->eh_ipt[khi * 3 - 2] * js->eh_ipt[khi * 3 - 1] - 1L) * 2L;
ksize = (js->eh_ipt[khi * 3 - 3] + nd * js->eh_ipt[khi * 3 - 2] * js->eh_ipt[khi * 3 - 1] - 1L) * 2L;
/*
* de102 files give wrong ksize, because they contain 424 empty bytes
* per record. Fixed by hand!
@ -272,7 +278,7 @@ fsizer(char *serr)
if (ksize == 1546)
ksize = 1652;
#if 0 /* we prefer to compute ksize to be comaptible
* with new DE releases */
with new DE releases */
switch (numde) {
case 403:
case 405:
@ -295,16 +301,14 @@ fsizer(char *serr)
break;
default:
if (serr != NULL)
sprintf(serr, "unknown numde value %d;", numde);
sprintf(serr,"unknown numde value %d;", numde);
return ERR;
}
#endif
if (ksize < 1000 || ksize > 5000) {
if (serr != NULL)
sprintf(serr,
"JPL ephemeris file does not provide valid ksize (%d)",
ksize);
/**/ return NOT_AVAILABLE;
sprintf(serr, "JPL ephemeris file does not provide valid ksize (%d)", ksize);/**/
return NOT_AVAILABLE;
}
return ksize;
}
@ -341,8 +345,7 @@ fsizer(char *serr)
* The option is available to have the units in km and km/sec.
* For this, set do_km=TRUE (default FALSE).
*/
int
swi_pleph(double et, int ntarg, int ncent, double *rrd, char *serr)
int swi_pleph(double et, int ntarg, int ncent, double *rrd, char *serr)
{
int i, retc;
int32 list[12];
@ -358,11 +361,10 @@ swi_pleph(double et, int ntarg, int ncent, double *rrd, char *serr)
if (ntarg == J_NUT) {
if (js->eh_ipt[34] > 0) {
list[10] = 2;
return (state(et, list, FALSE, pv, pvsun, rrd, serr));
}
else {
return(state(et, list, FALSE, pv, pvsun, rrd, serr));
} else {
if (serr != NULL)
sprintf(serr, "No nutations on the JPL ephemeris file;");
sprintf(serr,"No nutations on the JPL ephemeris file;");
return (NOT_AVAILABLE);
}
}
@ -374,10 +376,9 @@ swi_pleph(double et, int ntarg, int ncent, double *rrd, char *serr)
for (i = 0; i < 6; ++i)
rrd[i] = pv[i + 60];
return 0;
}
else {
} else {
if (serr != NULL)
sprintf(serr, "No librations on the ephemeris file;");
sprintf(serr,"No librations on the ephemeris file;");
return (NOT_AVAILABLE);
}
}
@ -402,32 +403,29 @@ swi_pleph(double et, int ntarg, int ncent, double *rrd, char *serr)
return (retc);
if (ntarg == J_SUN || ncent == J_SUN) {
for (i = 0; i < 6; ++i)
pv[i + 6 * J_SUN] = pvsun[i];
pv[i + 6*J_SUN] = pvsun[i];
}
if (ntarg == J_SBARY || ncent == J_SBARY) {
for (i = 0; i < 6; ++i) {
pv[i + 6 * J_SBARY] = 0.;
pv[i + 6*J_SBARY] = 0.;
}
}
if (ntarg == J_EMB || ncent == J_EMB) {
for (i = 0; i < 6; ++i)
pv[i + 6 * J_EMB] = pv[i + 6 * J_EARTH];
pv[i + 6*J_EMB] = pv[i + 6*J_EARTH];
}
if ((ntarg == J_EARTH && ncent == J_MOON)
|| (ntarg == J_MOON && ncent == J_EARTH)) {
if ((ntarg==J_EARTH && ncent==J_MOON) || (ntarg == J_MOON && ncent==J_EARTH)){
for (i = 0; i < 6; ++i)
pv[i + 6 * J_EARTH] = 0.;
pv[i + 6*J_EARTH] = 0.;
}
else {
} else {
if (list[J_EARTH] == 2) {
for (i = 0; i < 6; ++i)
pv[i + 6 * J_EARTH] -=
pv[i + 6 * J_MOON] / (js->eh_emrat + 1.);
pv[i + 6*J_EARTH] -= pv[i + 6*J_MOON] / (js->eh_emrat + 1.);
}
if (list[J_MOON] == 2) {
for (i = 0; i < 6; ++i) {
pv[i + 6 * J_MOON] += pv[i + 6 * J_EARTH];
pv[i + 6*J_MOON] += pv[i + 6*J_EARTH];
}
}
}
@ -457,9 +455,8 @@ swi_pleph(double et, int ntarg, int ncent, double *rrd, char *serr)
* pv d.p. interpolated quantities requested.
* assumed dimension is pv(ncm,fl).
*/
static int
interp(double FAR * buf, double t, double intv, int32 ncfin, int32 ncmin,
int32 nain, int32 ifl, double *pv)
static int interp(double FAR *buf, double t, double intv, int32 ncfin,
int32 ncmin, int32 nain, int32 ifl, double *pv)
{
/* Initialized data */
static int FAR np, nv;
@ -470,9 +467,9 @@ interp(double FAR * buf, double t, double intv, int32 ncfin, int32 ncmin,
double FAR *vc = js->vc;
double FAR *ac = js->ac;
double FAR *jc = js->jc;
int ncf = (int)ncfin;
int ncm = (int)ncmin;
int na = (int)nain;
int ncf = (int) ncfin;
int ncm = (int) ncmin;
int na = (int) nain;
/* Local variables */
double temp;
int i, j, ni;
@ -480,15 +477,15 @@ interp(double FAR * buf, double t, double intv, int32 ncfin, int32 ncmin,
double dt1, bma;
double bma2, bma3;
/*
* | get correct sub-interval number for this set of coefficients and then
* | get normalized chebyshev time within that subinterval.
| get correct sub-interval number for this set of coefficients and then
| get normalized chebyshev time within that subinterval.
*/
if (t >= 0)
dt1 = floor(t);
else
dt1 = -floor(-t);
temp = na * t;
ni = (int)(temp - dt1);
ni = (int) (temp - dt1);
/* tc is the normalized chebyshev time (-1 <= tc <= 1) */
tc = (fmod(temp, 1.0) + dt1) * 2. - 1.;
/*
@ -517,7 +514,7 @@ interp(double FAR * buf, double t, double intv, int32 ncfin, int32 ncmin,
/* interpolate to get position for each component */
for (i = 0; i < ncm; ++i) {
pv[i] = 0.;
for (j = ncf - 1; j >= 0; --j)
for (j = ncf-1; j >= 0; --j)
pv[i] += pc[j] * buf[j + (i + ni * ncm) * ncf];
}
if (ifl <= 1)
@ -536,7 +533,7 @@ interp(double FAR * buf, double t, double intv, int32 ncfin, int32 ncmin,
/* interpolate to get velocity for each component */
for (i = 0; i < ncm; ++i) {
pv[i + ncm] = 0.;
for (j = ncf - 1; j >= 1; --j)
for (j = ncf-1; j >= 1; --j)
pv[i + ncm] += vc[j] * buf[j + (i + ni * ncm) * ncf];
pv[i + ncm] *= bma;
}
@ -554,7 +551,7 @@ interp(double FAR * buf, double t, double intv, int32 ncfin, int32 ncmin,
/* get acceleration for each component */
for (i = 0; i < ncm; ++i) {
pv[i + ncm * 2] = 0.;
for (j = ncf - 1; j >= 2; --j)
for (j = ncf-1; j >= 2; --j)
pv[i + ncm * 2] += ac[j] * buf[j + (i + ni * ncm) * ncf];
pv[i + ncm * 2] *= bma2;
}
@ -572,7 +569,7 @@ interp(double FAR * buf, double t, double intv, int32 ncfin, int32 ncmin,
/* get jerk for each component */
for (i = 0; i < ncm; ++i) {
pv[i + ncm * 3] = 0.;
for (j = ncf - 1; j >= 3; --j)
for (j = ncf-1; j >= 3; --j)
pv[i + ncm * 3] += jc[j] * buf[j + (i + ni * ncm) * ncf];
pv[i + ncm * 3] *= bma3;
}
@ -638,12 +635,12 @@ interp(double FAR * buf, double t, double intv, int32 ncfin, int32 ncmin,
| default value = FALSE (km determines time unit
| for nutations and librations. angle unit is always radians.)
*/
static int
state(double et, int32 * list, int do_bary, double *pv, double *pvsun,
double *nut, char *serr)
static int state(double et, int32 *list, int do_bary,
double *pv, double *pvsun, double *nut, char *serr)
{
int i, j, k;
int32 flen, nseg, nb;
int32 nseg;
off_t flen, nb;
double FAR *buf = js->buf;
double aufac, s, t, intv, ts[4];
int32 nrecl, ksize;
@ -664,84 +661,61 @@ state(double et, int32 * list, int do_bary, double *pv, double *pvsun,
* "JPL Planetary Ephemeris DE404/LE404
* Start Epoch: JED= 625296.5-3001 DEC 21 00:00:00
* Final Epoch: JED= 2817168.5 3001 JAN 17 00:00:00c */
fread((void *)ch_ttl, 1, 252, js->jplfptr);
fread((void *) ch_ttl, 1, 252, js->jplfptr);
/* cnam = names of constants */
fread((void *)js->ch_cnam, 1, 2400, js->jplfptr);
fread((void *) js->ch_cnam, 1, 2400, js->jplfptr);
/* ss[0] = start epoch of ephemeris
* ss[1] = end epoch
* ss[2] = segment size in days */
fread((void *)&js->eh_ss[0], sizeof(double), 3, js->jplfptr);
fread((void *) &js->eh_ss[0], sizeof(double), 3, js->jplfptr);
if (js->do_reorder)
reorder((char *)&js->eh_ss[0], sizeof(double), 3);
reorder((char *) &js->eh_ss[0], sizeof(double), 3);
/* ncon = number of constants */
fread((void *)&js->eh_ncon, sizeof(int32), 1, js->jplfptr);
fread((void *) &js->eh_ncon, sizeof(int32), 1, js->jplfptr);
if (js->do_reorder)
reorder((char *)&js->eh_ncon, sizeof(int32), 1);
reorder((char *) &js->eh_ncon, sizeof(int32), 1);
/* au = astronomical unit */
fread((void *)&js->eh_au, sizeof(double), 1, js->jplfptr);
fread((void *) &js->eh_au, sizeof(double), 1, js->jplfptr);
if (js->do_reorder)
reorder((char *)&js->eh_au, sizeof(double), 1);
reorder((char *) &js->eh_au, sizeof(double), 1);
/* emrat = earth moon mass ratio */
fread((void *)&js->eh_emrat, sizeof(double), 1, js->jplfptr);
fread((void *) &js->eh_emrat, sizeof(double), 1, js->jplfptr);
if (js->do_reorder)
reorder((char *)&js->eh_emrat, sizeof(double), 1);
reorder((char *) &js->eh_emrat, sizeof(double), 1);
/* ipt[i+0]: coefficients of planet i start at buf[ipt[i+0]-1]
* ipt[i+1]: number of coefficients (interpolation order - 1)
* ipt[i+2]: number of intervals in segment */
fread((void *)&ipt[0], sizeof(int32), 36, js->jplfptr);
fread((void *) &ipt[0], sizeof(int32), 36, js->jplfptr);
if (js->do_reorder)
reorder((char *)&ipt[0], sizeof(int32), 36);
reorder((char *) &ipt[0], sizeof(int32), 36);
/* numde = number of jpl ephemeris "404" with de404 */
fread((void *)&js->eh_denum, sizeof(int32), 1, js->jplfptr);
fread((void *) &js->eh_denum, sizeof(int32), 1, js->jplfptr);
if (js->do_reorder)
reorder((char *)&js->eh_denum, sizeof(int32), 1);
fread((void *)&lpt[0], sizeof(int32), 3, js->jplfptr);
reorder((char *) &js->eh_denum, sizeof(int32), 1);
fread((void *) &lpt[0], sizeof(int32), 3, js->jplfptr);
if (js->do_reorder)
reorder((char *)&lpt[0], sizeof(int32), 3);
reorder((char *) &lpt[0], sizeof(int32), 3);
/* cval[]: other constants in next record */
fseek(js->jplfptr, 1L * irecsz, 0);
fread((void *)&js->eh_cval[0], sizeof(double), 400, js->jplfptr);
FSEEK(js->jplfptr, (off_t) (1L * irecsz), 0);
fread((void *) &js->eh_cval[0], sizeof(double), 400, js->jplfptr);
if (js->do_reorder)
reorder((char *)&js->eh_cval[0], sizeof(double), 400);
reorder((char *) &js->eh_cval[0], sizeof(double), 400);
/* new 26-aug-2008: verify correct block size */
#if 0
sp = strstr(js->ch_cnam, "EMRAT ");
if (sp == NULL) {
if (serr != NULL)
sprintf(serr,
"JPL ephemeris file strange, constant name 'EMRAT' missing");
return ERR;
}
i = (sp - js->ch_cnam);
if (i % 6 != 0) {
if (serr != NULL)
sprintf(serr,
"JPL ephemeris file strange, constant name 'EMRAT' not at multiple of 6");
return ERR;
}
i = i / 6; /* position of EMRAT in constant array eh_cval */
if (js->eh_cval[i] != js->eh_emrat) {
if (serr != NULL)
sprintf(serr,
"JPL ephemeris file error, record size failed EMRAT check");
return ERR;
}
#endif
for (i = 0; i < 3; ++i)
ipt[i + 36] = lpt[i];
nrl = 0;
/* is file length correct? */
/* file length */
fseek(js->jplfptr, 0L, SEEK_END);
flen = ftell(js->jplfptr);
FSEEK(js->jplfptr, (off_t) 0L, SEEK_END);
flen = FTELL(js->jplfptr);
/* # of segments in file */
nseg = (int32) ((js->eh_ss[1] - js->eh_ss[0]) / js->eh_ss[2]);
/* sum of all cheby coeffs of all planets and segments */
for (i = 0, nb = 0; i < 13; i++) {
for(i = 0, nb = 0; i < 13; i++) {
k = 3;
if (i == 11)
k = 2;
nb += (ipt[i * 3 + 1] * ipt[i * 3 + 2]) * k * nseg;
nb += (ipt[i*3+1] * ipt[i*3+2]) * k * nseg;
}
/* add start and end epochs of segments */
nb += 2 * nseg;
@ -751,36 +725,33 @@ state(double et, int32 * list, int do_bary, double *pv, double *pvsun,
nb += 2 * ksize * nrecl;
#if 0
printf("hallo %d %d\n", nb, flen);
printf("hallo %d %d\n", nb - flen, ksize);
printf("hallo %d %d\n", nb-flen, ksize);
#endif
if (flen != nb
/* some of our files are one record too long */
&& flen - nb != ksize * nrecl) {
&& flen - nb != ksize * nrecl
) {
if (serr != NULL) {
sprintf(serr,
"JPL ephemeris file is mutilated; length = %d instead of %d.",
flen, nb);
if (strlen(serr) + strlen(js->jplfname) < AS_MAXCH - 1)
sprintf(serr,
"JPL ephemeris file %s is mutilated; length = %d instead of %d.",
js->jplfname, flen, nb);
sprintf(serr, "JPL ephemeris file is mutilated; length = %d instead of %d.", (unsigned int) flen, (unsigned int) nb);
if (strlen(serr) + strlen(js->jplfname) < AS_MAXCH - 1) {
sprintf(serr, "JPL ephemeris file %s is mutilated; length = %d instead of %d.", js->jplfname, (unsigned int) flen, (unsigned int) nb);
}
return (NOT_AVAILABLE);
}
return(NOT_AVAILABLE);
}
/* check if start and end dates in segments are the same as in
* file header */
fseek(js->jplfptr, 2L * irecsz, 0);
fread((void *)&ts[0], sizeof(double), 2, js->jplfptr);
FSEEK(js->jplfptr, (off_t) (2L * irecsz), 0);
fread((void *) &ts[0], sizeof(double), 2, js->jplfptr);
if (js->do_reorder)
reorder((char *)&ts[0], sizeof(double), 2);
fseek(js->jplfptr, (nseg + 2 - 1) * irecsz, 0);
fread((void *)&ts[2], sizeof(double), 2, js->jplfptr);
reorder((char *) &ts[0], sizeof(double), 2);
FSEEK(js->jplfptr, (off_t) ((nseg + 2 - 1) * ((off_t) irecsz)), 0);
fread((void *) &ts[2], sizeof(double), 2, js->jplfptr);
if (js->do_reorder)
reorder((char *)&ts[2], sizeof(double), 2);
reorder((char *) &ts[2], sizeof(double), 2);
if (ts[0] != js->eh_ss[0] || ts[3] != js->eh_ss[1]) {
if (serr != NULL)
strcpy(serr,
"JPL ephemeris file is corrupt; start/end date check failed.");
sprintf(serr, "JPL ephemeris file is corrupt; start/end date check failed. %.1f != %.1f || %.1f != %.1f", ts[0],js->eh_ss[0],ts[3],js->eh_ss[1]);
return NOT_AVAILABLE;
}
}
@ -793,58 +764,53 @@ state(double et, int32 * list, int do_bary, double *pv, double *pvsun,
/* error return for epoch out of range */
if (et < js->eh_ss[0] || et > js->eh_ss[1]) {
if (serr != NULL)
sprintf(serr, "jd %f outside JPL eph. range %.2f .. %.2f;", et,
js->eh_ss[0], js->eh_ss[1]);
sprintf(serr,"jd %f outside JPL eph. range %.2f .. %.2f;", et, js->eh_ss[0], js->eh_ss[1]);
return BEYOND_EPH_LIMITS;
}
/* calculate record # and relative time in interval */
nr = (int32) ((et_mn - js->eh_ss[0]) / js->eh_ss[2]) + 2;
if (et_mn == js->eh_ss[1])
--nr; /* end point of ephemeris, use last record */
t = (et_mn - ((nr - 2) * js->eh_ss[2] + js->eh_ss[0]) +
et_fr) / js->eh_ss[2];
t = (et_mn - ((nr - 2) * js->eh_ss[2] + js->eh_ss[0]) + et_fr) / js->eh_ss[2];
/* read correct record if not in core */
if (nr != nrl) {
nrl = nr;
if (fseek(js->jplfptr, nr * irecsz, 0) != 0) {
if (FSEEK(js->jplfptr, (off_t) (nr * ((off_t) irecsz)), 0) != 0) {
if (serr != NULL)
sprintf(serr, "Read error in JPL eph. at %f\n", et);
return NOT_AVAILABLE;
}
for (k = 1; k <= ncoeffs; ++k) {
if (fread((void *)&buf[k - 1], sizeof(double), 1, js->jplfptr) !=
1) {
if ( fread((void *) &buf[k - 1], sizeof(double), 1, js->jplfptr) != 1) {
if (serr != NULL)
sprintf(serr, "Read error in JPL eph. at %f\n", et);
return NOT_AVAILABLE;
}
if (js->do_reorder)
reorder((char *)&buf[k - 1], sizeof(double), 1);
reorder((char *) &buf[k-1], sizeof(double), 1);
}
}
if (js->do_km) {
intv = js->eh_ss[2] * 86400.;
aufac = 1.;
}
else {
} else {
intv = js->eh_ss[2];
aufac = 1. / js->eh_au;
}
/* interpolate ssbary sun */
interp(&buf[(int)ipt[30] - 1], t, intv, ipt[31], 3L, ipt[32], 2L, pvsun);
interp(&buf[(int) ipt[30] - 1], t, intv, ipt[31], 3L, ipt[32], 2L, pvsun);
for (i = 0; i < 6; ++i) {
pvsun[i] *= aufac;
}
/* check and interpolate whichever bodies are requested */
for (i = 0; i < 10; ++i) {
if (list[i] > 0) {
interp(&buf[(int)ipt[i * 3] - 1], t, intv, ipt[i * 3 + 1], 3L,
interp(&buf[(int) ipt[i * 3] - 1], t, intv, ipt[i * 3 + 1], 3L,
ipt[i * 3 + 2], list[i], &pv[i * 6]);
for (j = 0; j < 6; ++j) {
if (i < 9 && !do_bary) {
if (i < 9 && ! do_bary) {
pv[j + i * 6] = pv[j + i * 6] * aufac - pvsun[j];
}
else {
} else {
pv[j + i * 6] *= aufac;
}
}
@ -852,12 +818,12 @@ state(double et, int32 * list, int do_bary, double *pv, double *pvsun,
}
/* do nutations if requested (and if on file) */
if (list[10] > 0 && ipt[34] > 0) {
interp(&buf[(int)ipt[33] - 1], t, intv, ipt[34], 2L, ipt[35],
interp(&buf[(int) ipt[33] - 1], t, intv, ipt[34], 2L, ipt[35],
list[10], nut);
}
/* get librations if requested (and if on file) */
if (list[11] > 0 && ipt[37] > 0) {
interp(&buf[(int)ipt[36] - 1], t, intv, ipt[37], 3L, ipt[38], list[1],
interp(&buf[(int) ipt[36] - 1], t, intv, ipt[37], 3L, ipt[38], list[1],
&pv[60]);
}
return OK;
@ -867,8 +833,7 @@ state(double et, int32 * list, int do_bary, double *pv, double *pvsun,
* this entry obtains the constants from the ephemeris file
* call state to initialize the ephemeris and read in the constants
*/
static int
read_const_jpl(double *ss, char *serr)
static int read_const_jpl(double *ss, char *serr)
{
int i, retc;
retc = state(0.0, NULL, FALSE, NULL, NULL, NULL, serr);
@ -880,25 +845,22 @@ read_const_jpl(double *ss, char *serr)
{
static char FAR *bname[] = {
"Mercury", "Venus", "EMB", "Mars", "Jupiter", "Saturn",
"Uranus", "Neptune", "Pluto", "Moon", "SunBary", "Nut", "Libr"
};
"Uranus", "Neptune", "Pluto", "Moon", "SunBary", "Nut", "Libr"};
int j, k;
int32 nb, nc;
printf(" JPL TEST-EPHEMERIS program. Version October 1995.\n");
for (i = 0; i < 13; i++) {
j = i * 3;
k = 3;
if (i == 11)
k = 2;
nb = js->eh_ipt[j + 1] * js->eh_ipt[j + 2] * k;
if (i == 11) k = 2;
nb = js->eh_ipt[j+1] * js->eh_ipt[j+2] * k;
nc = (int32) (nb * 36525L / js->eh_ss[2] * 8L);
printf("%s\t%d\tipt[%d]\t%3ld %2ld %2ld,\t", bname[i], i, j,
js->eh_ipt[j], js->eh_ipt[j + 1], js->eh_ipt[j + 2]);
printf("%s\t%d\tipt[%d]\t%3ld %2ld %2ld,\t",
bname[i], i, j, js->eh_ipt[j], js->eh_ipt[j+1], js->eh_ipt[j+2]);
printf("%3ld double, bytes per century = %6ld\n", nb, nc);
fflush(stdout);
}
printf("%16.2f %16.2f %16.2f\n", js->eh_ss[0], js->eh_ss[1],
js->eh_ss[2]);
printf("%16.2f %16.2f %16.2f\n", js->eh_ss[0], js->eh_ss[1], js->eh_ss[2]);
for (i = 0; i < js->eh_ncon; ++i)
printf("%.6s\t%24.16f\n", js->ch_cnam + i * 6, js->eh_cval[i]);
fflush(stdout);
@ -907,8 +869,7 @@ read_const_jpl(double *ss, char *serr)
return OK;
}
static void
reorder(char *x, int size, int number)
static void reorder(char *x, int size, int number)
{
int i, j;
char s[8];
@ -923,31 +884,30 @@ reorder(char *x, int size, int number)
}
}
void
swi_close_jpl_file(void)
void swi_close_jpl_file(void)
{
if (js != NULL) {
if (js->jplfptr != NULL)
fclose(js->jplfptr);
if (js->jplfname != NULL)
FREE((void *)js->jplfname);
FREE((void *) js->jplfname);
if (js->jplfpath != NULL)
FREE((void *)js->jplfpath);
FREE((void *)js);
FREE((void *) js->jplfpath);
FREE((void *) js);
js = NULL;
}
}
int
swi_open_jpl_file(double *ss, char *fname, char *fpath, char *serr)
int swi_open_jpl_file(double *ss, char *fname, char *fpath, char *serr)
{
int retc = OK;
/* if open, return */
if (js != NULL && js->jplfptr != NULL)
return OK;
if ((js = (struct jpl_save *)CALLOC(1, sizeof(struct jpl_save))) == NULL
|| (js->jplfname = MALLOC(strlen(fname) + 1)) == NULL
|| (js->jplfpath = MALLOC(strlen(fpath) + 1)) == NULL) {
if ((js = (struct jpl_save *) CALLOC(1, sizeof(struct jpl_save))) == NULL
|| (js->jplfname = MALLOC(strlen(fname)+1)) == NULL
|| (js->jplfpath = MALLOC(strlen(fpath)+1)) == NULL
) {
if (serr != NULL)
strcpy(serr, "error in malloc() with JPL ephemeris.");
return ERR;
@ -968,9 +928,9 @@ swi_open_jpl_file(double *ss, char *fname, char *fpath, char *serr)
return retc;
}
int32
swi_get_jpl_denum()
int32 swi_get_jpl_denum()
{
return js->eh_denum;
}
#endif /* NO_JPL */

View File

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

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,3 @@
/* SWISSEPH
$Header: /home/dieter/sweph/RCS/swemplan.c,v 1.74 2008/06/16 10:07:20 dieter Exp $
Moshier planet routines
@ -6,7 +5,6 @@
modified for SWISSEPH by Dieter Koch
**************************************************************/
/* Copyright (C) 1997 - 2008 Astrodienst AG, Switzerland. All rights reserved.
License conditions
@ -73,24 +71,23 @@
#define FICT_GEO 1
#define KGAUSS_GEO 0.0000298122353216 /* Earth only */
/* #define KGAUSS_GEO 0.00002999502129737 Earth + Moon */
static void embofs_mosh(double J, double *xemb);
static int check_t_terms(double t, char *sinp, double *doutp);
static int read_elements_file(int32 ipl, double tjd, double *tjd0,
double *tequ, double *mano, double *sema,
double *ecce, double *parg, double *node,
double *incl, char *pname, int32 * fict_ifl,
char *serr);
static int read_elements_file(int32 ipl, double tjd,
double *tjd0, double *tequ,
double *mano, double *sema, double *ecce,
double *parg, double *node, double *incl,
char *pname, int32 *fict_ifl, char *serr);
static int pnoint2msh[] = { 2, 2, 0, 1, 3, 4, 5, 6, 7, 8, };
static int pnoint2msh[] = {2, 2, 0, 1, 3, 4, 5, 6, 7, 8, };
/* From Simon et al (1994) */
static double freqs[] = {
static double freqs[] =
{
/* Arc sec per 10000 Julian years. */
53810162868.8982,
21066413643.3548,
@ -103,8 +100,8 @@ static double freqs[] = {
52272245.1795
};
static double phases[] = {
static double phases[] =
{
/* Arc sec. */
252.25090552 * 3600.,
181.97980085 * 3600.,
@ -117,7 +114,8 @@ static double phases[] = {
860492.1546,
};
static struct plantbl *planets[] = {
static struct plantbl *planets[] =
{
&mer404,
&ven404,
&ear404,
@ -132,10 +130,9 @@ static struct plantbl *planets[] = {
static double FAR ss[9][24];
static double FAR cc[9][24];
static void sscc(int k, double arg, int n);
static void sscc (int k, double arg, int n);
int
swi_moshplan2(double J, int iplm, double *pobj)
int swi_moshplan2 (double J, int iplm, double *pobj)
{
int i, j, k, m, k1, ip, np, nt;
signed char FAR *p;
@ -146,10 +143,12 @@ swi_moshplan2(double J, int iplm, double *pobj)
T = (J - J2000) / TIMESCALE;
/* Calculate sin( i*MM ), etc. for needed multiple angles. */
for (i = 0; i < 9; i++) {
if ((j = plan->max_harmonic[i]) > 0) {
sr = (mods3600(freqs[i] * T) + phases[i]) * STR;
sscc(i, sr, j);
for (i = 0; i < 9; i++)
{
if ((j = plan->max_harmonic[i]) > 0)
{
sr = (mods3600 (freqs[i] * T) + phases[i]) * STR;
sscc (i, sr, j);
}
}
@ -163,29 +162,34 @@ swi_moshplan2(double J, int iplm, double *pobj)
sb = 0.0;
sr = 0.0;
for (;;) {
for (;;)
{
/* argument of sine and cosine */
/* Number of periodic arguments. */
np = *p++;
if (np < 0)
break;
if (np == 0) { /* It is a polynomial term. */
if (np == 0)
{ /* It is a polynomial term. */
nt = *p++;
/* Longitude polynomial. */
cu = *pl++;
for (ip = 0; ip < nt; ip++) {
for (ip = 0; ip < nt; ip++)
{
cu = cu * T + *pl++;
}
sl += mods3600(cu);
sl += mods3600 (cu);
/* Latitude polynomial. */
cu = *pb++;
for (ip = 0; ip < nt; ip++) {
for (ip = 0; ip < nt; ip++)
{
cu = cu * T + *pb++;
}
sb += cu;
/* Radius polynomial. */
cu = *pr++;
for (ip = 0; ip < nt; ip++) {
for (ip = 0; ip < nt; ip++)
{
cu = cu * T + *pr++;
}
sr += cu;
@ -194,12 +198,14 @@ swi_moshplan2(double J, int iplm, double *pobj)
k1 = 0;
cv = 0.0;
sv = 0.0;
for (ip = 0; ip < np; ip++) {
for (ip = 0; ip < np; ip++)
{
/* What harmonic. */
j = *p++;
/* Which planet. */
m = *p++ - 1;
if (j) {
if (j)
{
k = j;
if (j < 0)
k = -k;
@ -208,12 +214,14 @@ swi_moshplan2(double J, int iplm, double *pobj)
if (j < 0)
su = -su;
cu = cc[m][k];
if (k1 == 0) { /* set first angle */
if (k1 == 0)
{ /* set first angle */
sv = su;
cv = cu;
k1 = 1;
}
else { /* combine angles */
else
{ /* combine angles */
t = su * cv + cu * sv;
cv = cu * cv - su * sv;
sv = t;
@ -225,7 +233,8 @@ swi_moshplan2(double J, int iplm, double *pobj)
/* Longitude. */
cu = *pl++;
su = *pl++;
for (ip = 0; ip < nt; ip++) {
for (ip = 0; ip < nt; ip++)
{
cu = cu * T + *pl++;
su = su * T + *pl++;
}
@ -233,7 +242,8 @@ swi_moshplan2(double J, int iplm, double *pobj)
/* Latitiude. */
cu = *pb++;
su = *pb++;
for (ip = 0; ip < nt; ip++) {
for (ip = 0; ip < nt; ip++)
{
cu = cu * T + *pb++;
su = su * T + *pb++;
}
@ -241,7 +251,8 @@ swi_moshplan2(double J, int iplm, double *pobj)
/* Radius. */
cu = *pr++;
su = *pr++;
for (ip = 0; ip < nt; ip++) {
for (ip = 0; ip < nt; ip++)
{
cu = cu * T + *pr++;
su = su * T + *pr++;
}
@ -263,9 +274,7 @@ swi_moshplan2(double J, int iplm, double *pobj)
* xe earth's
* serr error string
*/
int
swi_moshplan(double tjd, int ipli, AS_BOOL do_save, double *xpret,
double *xeret, char *serr)
int swi_moshplan(double tjd, int ipli, AS_BOOL do_save, double *xpret, double *xeret, char *serr)
{
int i;
int do_earth = FALSE;
@ -281,8 +290,7 @@ swi_moshplan(double tjd, int ipli, AS_BOOL do_save, double *xpret,
if (do_save) {
xp = pdp->x;
xe = pedp->x;
}
else {
} else {
xp = xxp;
xe = xxe;
}
@ -296,18 +304,18 @@ swi_moshplan(double tjd, int ipli, AS_BOOL do_save, double *xpret,
if (strlen(serr) + strlen(s) < AS_MAXCH)
strcat(serr, s);
}
return (ERR);
return(ERR);
}
/* earth, for geocentric position */
if (do_earth) {
if (tjd == pedp->teval && pedp->iephe == SEFLG_MOSEPH) {
if (tjd == pedp->teval
&& pedp->iephe == SEFLG_MOSEPH) {
xe = pedp->x;
}
else {
} else {
/* emb */
swi_moshplan2(tjd, pnoint2msh[SEI_EMB], xe); /* emb hel. ecl. 2000 polar */
swi_polcart(xe, xe); /* to cartesian */
swi_coortrf2(xe, xe, -seps2000, ceps2000); /* and equator 2000 */
swi_coortrf2(xe, xe, -seps2000, ceps2000);/* and equator 2000 */
embofs_mosh(tjd, xe); /* emb -> earth */
if (do_save) {
pedp->teval = tjd;
@ -318,12 +326,12 @@ swi_moshplan(double tjd, int ipli, AS_BOOL do_save, double *xpret,
swi_moshplan2(tjd - PLAN_SPEED_INTV, pnoint2msh[SEI_EMB], x2);
swi_polcart(x2, x2);
swi_coortrf2(x2, x2, -seps2000, ceps2000);
embofs_mosh(tjd - PLAN_SPEED_INTV, x2);
/**/ for (i = 0; i <= 2; i++)
embofs_mosh(tjd - PLAN_SPEED_INTV, x2);/**/
for (i = 0; i <= 2; i++)
dx[i] = (xe[i] - x2[i]) / PLAN_SPEED_INTV;
/* store speed */
for (i = 0; i <= 2; i++) {
xe[i + 3] = dx[i];
xe[i+3] = dx[i];
}
}
if (xeret != NULL)
@ -333,30 +341,28 @@ swi_moshplan(double tjd, int ipli, AS_BOOL do_save, double *xpret,
/* earth is the planet wanted */
if (ipli == SEI_EARTH) {
xp = xe;
}
else {
} else {
/* other planet */
/* if planet has already been computed, return */
if (tjd == pdp->teval && pdp->iephe == SEFLG_MOSEPH) {
xp = pdp->x;
}
else {
} else {
swi_moshplan2(tjd, iplm, xp);
swi_polcart(xp, xp);
swi_coortrf2(xp, xp, -seps2000, ceps2000);
if (do_save) {
pdp->teval = tjd;
/**/ pdp->xflgs = -1;
pdp->teval = tjd;/**/
pdp->xflgs = -1;
pdp->iephe = SEFLG_MOSEPH;
}
/* one more position for speed.
* the following dt gives good speed for light-time correction
*/
#if 0
#if 0
for (i = 0; i <= 2; i++)
dx[i] = xp[i] - pedp->x[i];
dt = LIGHTTIME_AUNIT * sqrt(square_sum(dx));
#endif
#endif
dt = PLAN_SPEED_INTV;
swi_moshplan2(tjd - dt, iplm, x2);
swi_polcart(x2, x2);
@ -365,35 +371,35 @@ swi_moshplan(double tjd, int ipli, AS_BOOL do_save, double *xpret,
dx[i] = (xp[i] - x2[i]) / dt;
/* store speed */
for (i = 0; i <= 2; i++) {
xp[i + 3] = dx[i];
xp[i+3] = dx[i];
}
}
if (xpret != NULL)
for (i = 0; i <= 5; i++)
xpret[i] = xp[i];
}
return (OK);
return(OK);
}
/* Prepare lookup table of sin and cos ( i*Lj )
* for required multiple angles
*/
static void
sscc(int k, double arg, int n)
static void sscc (int k, double arg, int n)
{
double cu, su, cv, sv, s;
int i;
su = sin(arg);
cu = cos(arg);
su = sin (arg);
cu = cos (arg);
ss[k][0] = su; /* sin(L) */
cc[k][0] = cu; /* cos(L) */
sv = 2.0 * su * cu;
cv = cu * cu - su * su;
ss[k][1] = sv; /* sin(2L) */
cc[k][1] = cv;
for (i = 2; i < n; i++) {
for (i = 2; i < n; i++)
{
s = su * cv + cu * sv;
cv = cu * cv - su * sv;
sv = s;
@ -408,8 +414,7 @@ sscc(int k, double arg, int n)
* J = Julian day number
* xemb = rectangular equatorial coordinates of Earth
*/
static void
embofs_mosh(double tjd, double *xemb)
static void embofs_mosh(double tjd, double *xemb)
{
double T, M, a, L, B, p;
double smp, cmp, s2mp, c2mp, s2d, c2d, sf, cf;
@ -419,56 +424,60 @@ embofs_mosh(double tjd, double *xemb)
int i;
/* Short series for position of the Moon
*/
T = (tjd - J1900) / 36525.0;
T = (tjd-J1900)/36525.0;
/* Mean anomaly of moon (MP) */
a = swe_degnorm(((1.44e-5 * T + 0.009192) * T + 477198.8491) * T +
296.104608);
a = swe_degnorm(((1.44e-5*T + 0.009192)*T + 477198.8491)*T + 296.104608);
a *= DEGTORAD;
smp = sin(a);
cmp = cos(a);
s2mp = 2.0 * smp * cmp; /* sin(2MP) */
c2mp = cmp * cmp - smp * smp; /* cos(2MP) */
s2mp = 2.0*smp*cmp; /* sin(2MP) */
c2mp = cmp*cmp - smp*smp; /* cos(2MP) */
/* Mean elongation of moon (D) */
a = swe_degnorm(((1.9e-6 * T - 0.001436) * T + 445267.1142) * T +
350.737486);
a = swe_degnorm(((1.9e-6*T - 0.001436)*T + 445267.1142)*T + 350.737486);
a = 2.0 * DEGTORAD * a;
s2d = sin(a);
c2d = cos(a);
/* Mean distance of moon from its ascending node (F) */
a = swe_degnorm(((-3.e-7 * T - 0.003211) * T + 483202.0251) * T +
11.250889);
a = swe_degnorm((( -3.e-7*T - 0.003211)*T + 483202.0251)*T + 11.250889);
a *= DEGTORAD;
sf = sin(a);
cf = cos(a);
s2f = 2.0 * sf * cf; /* sin(2F) */
sx = s2d * cmp - c2d * smp; /* sin(2D - MP) */
cx = c2d * cmp + s2d * smp; /* cos(2D - MP) */
s2f = 2.0*sf*cf; /* sin(2F) */
sx = s2d*cmp - c2d*smp; /* sin(2D - MP) */
cx = c2d*cmp + s2d*smp; /* cos(2D - MP) */
/* Mean longitude of moon (LP) */
L = ((1.9e-6 * T - 0.001133) * T + 481267.8831) * T + 270.434164;
L = ((1.9e-6*T - 0.001133)*T + 481267.8831)*T + 270.434164;
/* Mean anomaly of sun (M) */
M = swe_degnorm(((-3.3e-6 * T - 1.50e-4) * T + 35999.0498) * T +
358.475833);
M = swe_degnorm((( -3.3e-6*T - 1.50e-4)*T + 35999.0498)*T + 358.475833);
/* Ecliptic longitude of the moon */
L = L + 6.288750 * smp + 1.274018 * sx + 0.658309 * s2d +
0.213616 * s2mp - 0.185596 * sin(DEGTORAD * M)
- 0.114336 * s2f;
L = L
+ 6.288750*smp
+ 1.274018*sx
+ 0.658309*s2d
+ 0.213616*s2mp
- 0.185596*sin( DEGTORAD * M )
- 0.114336*s2f;
/* Ecliptic latitude of the moon */
a = smp * cf;
sx = cmp * sf;
B = 5.128189 * sf + 0.280606 * (a + sx) /* sin(MP+F) */
+0.277693 * (a - sx) /* sin(MP-F) */
+0.173238 * (s2d * cf - c2d * sf); /* sin(2D-F) */
a = smp*cf;
sx = cmp*sf;
B = 5.128189*sf
+ 0.280606*(a+sx) /* sin(MP+F) */
+ 0.277693*(a-sx) /* sin(MP-F) */
+ 0.173238*(s2d*cf - c2d*sf); /* sin(2D-F) */
B *= DEGTORAD;
/* Parallax of the moon */
p = 0.950724 + 0.051818 * cmp + 0.009531 * cx + 0.007843 * c2d +
0.002824 * c2mp;
p = 0.950724
+0.051818*cmp
+0.009531*cx
+0.007843*c2d
+0.002824*c2mp;
p *= DEGTORAD;
/* Elongation of Moon from Sun
*/
L = swe_degnorm(L);
L *= DEGTORAD;
/* Distance in au */
a = 4.263523e-5 / sin(p);
a = 4.263523e-5/sin(p);
/* Convert to rectangular ecliptic coordinates */
xyz[0] = L;
xyz[1] = B;
@ -477,8 +486,7 @@ embofs_mosh(double tjd, double *xemb)
/* Convert to equatorial */
swi_coortrf2(xyz, xyz, -seps, ceps);
/* Precess to equinox of J2000.0 */
swi_precess(xyz, tjd, J_TO_J2000);
/**/
swi_precess(xyz, tjd, 0, J_TO_J2000);/**/
/* now emb -> earth */
for (i = 0; i <= 2; i++)
xemb[i] -= xyz[i] / (EARTH_MOON_MRAT + 1.0);
@ -497,33 +505,31 @@ embofs_mosh(double tjd, double *xemb)
#define SE_NEELY /* use James Neely's revised elements
* of Uranian planets*/
static char *plan_fict_nam[SE_NFICT_ELEM] =
{ "Cupido", "Hades", "Zeus", "Kronos",
{"Cupido", "Hades", "Zeus", "Kronos",
"Apollon", "Admetos", "Vulkanus", "Poseidon",
"Isis-Transpluto", "Nibiru", "Harrington",
"Leverrier", "Adams",
"Lowell", "Pickering",
};
"Lowell", "Pickering",};
char *
swi_get_fict_name(int32 ipl, char *snam)
char *swi_get_fict_name(int32 ipl, char *snam)
{
if (read_elements_file
(ipl, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, snam, NULL,
NULL) == ERR)
if (read_elements_file(ipl, 0, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL,
snam, NULL, NULL) == ERR)
strcpy(snam, "name not found");
return snam;
}
static double plan_oscu_elem[SE_NFICT_ELEM][8] = {
#ifdef SE_NEELY
{J1900, J1900, 163.7409, 40.99837, 0.00460, 171.4333, 129.8325, 1.0833}, /* Cupido Neely */
{J1900, J1900, 27.6496, 50.66744, 0.00245, 148.1796, 161.3339, 1.0500}, /* Hades Neely */
{J1900, J1900, 165.1232, 59.21436, 0.00120, 299.0440, 0.0000, 0.0000}, /* Zeus Neely */
{J1900, J1900, 169.0193, 64.81960, 0.00305, 208.8801, 0.0000, 0.0000}, /* Kronos Neely */
{J1900, J1900, 138.0533, 70.29949, 0.00000, 0.0000, 0.0000, 0.0000}, /* Apollon Neely */
{J1900, J1900, 351.3350, 73.62765, 0.00000, 0.0000, 0.0000, 0.0000}, /* Admetos Neely */
{J1900, J1900, 55.8983, 77.25568, 0.00000, 0.0000, 0.0000, 0.0000}, /* Vulcanus Neely */
{J1900, J1900, 165.5163, 83.66907, 0.00000, 0.0000, 0.0000, 0.0000}, /* Poseidon Neely */
{J1900, J1900, 163.7409, 40.99837, 0.00460, 171.4333, 129.8325, 1.0833},/* Cupido Neely */
{J1900, J1900, 27.6496, 50.66744, 0.00245, 148.1796, 161.3339, 1.0500},/* Hades Neely */
{J1900, J1900, 165.1232, 59.21436, 0.00120, 299.0440, 0.0000, 0.0000},/* Zeus Neely */
{J1900, J1900, 169.0193, 64.81960, 0.00305, 208.8801, 0.0000, 0.0000},/* Kronos Neely */
{J1900, J1900, 138.0533, 70.29949, 0.00000, 0.0000, 0.0000, 0.0000},/* Apollon Neely */
{J1900, J1900, 351.3350, 73.62765, 0.00000, 0.0000, 0.0000, 0.0000},/* Admetos Neely */
{J1900, J1900, 55.8983, 77.25568, 0.00000, 0.0000, 0.0000, 0.0000},/* Vulcanus Neely */
{J1900, J1900, 165.5163, 83.66907, 0.00000, 0.0000, 0.0000, 0.0000},/* Poseidon Neely */
#else
{J1900, J1900, 104.5959, 40.99837, 0, 0, 0, 0}, /* Cupido */
{J1900, J1900, 337.4517, 50.667443, 0, 0, 0, 0}, /* Hades */
@ -541,12 +547,11 @@ static double plan_oscu_elem[SE_NFICT_ELEM][8] = {
* The fraction is counted from 1 Jan. 1772 */
{2368547.66, 2431456.5, 0.0, 77.775, 0.3, 0.7, 0, 0},
/* Nibiru, elements from Christian Woeltge, Hannover */
{1856113.380954, 1856113.380954, 0.0, 234.8921, 0.981092, 103.966,
-44.567, 158.708},
{1856113.380954, 1856113.380954, 0.0, 234.8921, 0.981092, 103.966, -44.567, 158.708},
/* Harrington, elements from Astronomical Journal 96(4), Oct. 1988 */
{2374696.5, J2000, 0.0, 101.2, 0.411, 208.5, 275.4, 32.4},
/* Leverrier's Neptune,
* according to W.G. Hoyt, "Planets X and Pluto", Tucson 1980, p. 63 */
according to W.G. Hoyt, "Planets X and Pluto", Tucson 1980, p. 63 */
{2395662.5, 2395662.5, 34.05, 36.15, 0.10761, 284.75, 0, 0},
/* Adam's Neptune */
{2395662.5, 2395662.5, 24.28, 37.25, 0.12062, 299.11, 0, 0},
@ -562,8 +567,7 @@ static double plan_oscu_elem[SE_NFICT_ELEM][8] = {
0.7870946565779195e-01, 0.5809199028919189e+02,
0.8650119410725021e+02, 0.1066835622280712e+02},
/* Chiron, Bowell database 18-mar-1997 */
{2450500.5, J2000, 7.258191, 13.67387471, 0.38174778, 339.558345,
209.379239, 6.933360}, /**/
{2450500.5, J2000, 7.258191, 13.67387471, 0.38174778, 339.558345, 209.379239, 6.933360}, /**/
#endif
};
@ -573,9 +577,7 @@ static double plan_oscu_elem[SE_NFICT_ELEM][8] = {
* ipli body number in planetary data structure
* iflag flags
*/
int
swi_osc_el_plan(double tjd, double *xp, int ipl, int ipli, double *xearth,
double *xsun, char *serr)
int swi_osc_el_plan(double tjd, double *xp, int ipl, int ipli, double *xearth, double *xsun, char *serr)
{
double pqr[9], x[6];
double eps, K, fac, rho, cose, sine;
@ -590,8 +592,8 @@ swi_osc_el_plan(double tjd, double *xp, int ipl, int ipli, double *xearth,
/* orbital elements, either from file or, if file not found,
* from above built-in set
*/
if (read_elements_file
(ipl, tjd, &tjd0, &tequ, &mano, &sema, &ecce, &parg, &node, &incl,
if (read_elements_file(ipl, tjd, &tjd0, &tequ,
&mano, &sema, &ecce, &parg, &node, &incl,
NULL, &fict_ifl, serr) == ERR)
return ERR;
dmot = 0.9856076686 * DEGTORAD / sema / sqrt(sema); /* daily motion */
@ -621,26 +623,22 @@ swi_osc_el_plan(double tjd, double *xp, int ipl, int ipli, double *xearth,
if (M2 > 150 && M2 < 210) {
M2 -= 180;
M_180_or_0 = 180;
}
else
} else
M_180_or_0 = 0;
if (M2 > 330)
M2 -= 360;
if (M2 < 0) {
M2 = -M2;
Msgn = -1;
}
else
} else
Msgn = 1;
if (M2 < 30) {
M2 *= DEGTORAD;
alpha = (1 - ecce) / (4 * ecce + 0.5);
beta = M2 / (8 * ecce + 1);
zeta = pow(beta + sqrt(beta * beta + alpha * alpha), 1 / 3);
zeta = pow(beta + sqrt(beta * beta + alpha * alpha), 1/3);
sigma = zeta - alpha / 2;
sigma =
sigma - 0.078 * sigma * sigma * sigma * sigma * sigma / (1 +
ecce);
sigma = sigma - 0.078 * sigma * sigma * sigma * sigma * sigma / (1 + ecce);
E = Msgn * (M2 + ecce * (3 * sigma - 4 * sigma * sigma * sigma))
+ M_180_or_0;
}
@ -667,21 +665,20 @@ swi_osc_el_plan(double tjd, double *xp, int ipl, int ipli, double *xearth,
xp[4] = pqr[3] * x[3] + pqr[4] * x[4];
xp[5] = pqr[6] * x[3] + pqr[7] * x[4];
/* transformation to equator */
eps = swi_epsiln(tequ);
eps = swi_epsiln(tequ, 0);
swi_coortrf(xp, xp, -eps);
swi_coortrf(xp + 3, xp + 3, -eps);
swi_coortrf(xp+3, xp+3, -eps);
/* precess to J2000 */
if (tequ != J2000) {
swi_precess(xp, tequ, J_TO_J2000);
swi_precess(xp + 3, tequ, J_TO_J2000);
swi_precess(xp, tequ, 0, J_TO_J2000);
swi_precess(xp+3, tequ, 0, J_TO_J2000);
}
/* to solar system barycentre */
if (fict_ifl & FICT_GEO) {
for (i = 0; i <= 5; i++) {
xp[i] += xearth[i];
}
}
else {
} else {
for (i = 0; i <= 5; i++) {
xp[i] += xsun[i];
}
@ -694,13 +691,12 @@ swi_osc_el_plan(double tjd, double *xp, int ipl, int ipli, double *xearth,
}
#if 1
/* note: input parameter tjd is required for T terms in elements */
static int
read_elements_file(int32 ipl, double tjd, double *tjd0, double *tequ,
double *mano, double *sema, double *ecce, double *parg,
double *node, double *incl, char *pname, int32 * fict_ifl,
char *serr)
static int read_elements_file(int32 ipl, double tjd,
double *tjd0, double *tequ,
double *mano, double *sema, double *ecce,
double *parg, double *node, double *incl,
char *pname, int32 *fict_ifl, char *serr)
{
int i, iline, iplan, retc, ncpos;
FILE *fp = NULL;
@ -713,9 +709,7 @@ read_elements_file(int32 ipl, double tjd, double *tjd0, double *tequ,
/* file does not exist, use built-in bodies */
if (ipl >= SE_NFICT_ELEM) {
if (serr != NULL)
sprintf(serr,
"error no elements for fictitious body no %7.0f",
(double)ipl);
sprintf(serr, "error no elements for fictitious body no %7.0f", (double) ipl);
return ERR;
}
if (tjd0 != NULL)
@ -746,7 +740,7 @@ read_elements_file(int32 ipl, double tjd, double *tjd0, double *tequ,
while (fgets(s, AS_MAXCH, fp) != NULL) {
iline++;
sp = s;
while (*sp == ' ' || *sp == '\t')
while(*sp == ' ' || *sp == '\t')
sp++;
swi_strcpy(s, sp);
if (*s == '#')
@ -760,11 +754,11 @@ read_elements_file(int32 ipl, double tjd, double *tjd0, double *tequ,
if ((sp = strchr(s, '#')) != NULL)
*sp = '\0';
ncpos = swi_cutstr(s, ",", cpos, 20);
sprintf(serri, "error in file %s, line %7.0f:", SE_FICTFILE,
(double)iline);
sprintf(serri, "error in file %s, line %7.0f:", SE_FICTFILE, (double) iline);
if (ncpos < 9) {
if (serr != NULL)
if (serr != NULL) {
sprintf(serr, "%s nine elements required", serri);
}
return ERR;
}
iplan++;
@ -783,18 +777,18 @@ read_elements_file(int32 ipl, double tjd, double *tjd0, double *tequ,
else if (strncmp(sp, "j1900", 5) == OK)
*tjd0 = J1900;
else if (*sp == 'j' || *sp == 'b') {
if (serr != NULL)
if (serr != NULL) {
sprintf(serr, "%s invalid epoch", serri);
goto return_err;
}
else
goto return_err;
} else
*tjd0 = atof(sp);
tt = tjd - *tjd0;
}
/* equinox */
if (tequ != NULL) {
sp = cpos[1];
while (*sp == ' ' || *sp == '\t')
while(*sp == ' ' || *sp == '\t')
sp++;
for (i = 0; i < 5; i++)
sp[i] = tolower(sp[i]);
@ -807,11 +801,11 @@ read_elements_file(int32 ipl, double tjd, double *tjd0, double *tequ,
else if (strncmp(sp, "jdate", 5) == OK)
*tequ = tjd;
else if (*sp == 'j' || *sp == 'b') {
if (serr != NULL)
if (serr != NULL) {
sprintf(serr, "%s invalid equinox", serri);
goto return_err;
}
else
goto return_err;
} else
*tequ = atof(sp);
}
/* mean anomaly t0 */
@ -819,8 +813,9 @@ read_elements_file(int32 ipl, double tjd, double *tjd0, double *tequ,
retc = check_t_terms(tt, cpos[2], mano);
*mano = swe_degnorm(*mano);
if (retc == ERR) {
if (serr != NULL)
if (serr != NULL) {
sprintf(serr, "%s mean anomaly value invalid", serri);
}
goto return_err;
}
/* if mean anomaly has t terms (which happens with fictitious
@ -836,8 +831,9 @@ read_elements_file(int32 ipl, double tjd, double *tjd0, double *tequ,
if (sema != NULL) {
retc = check_t_terms(tt, cpos[3], sema);
if (*sema <= 0 || retc == ERR) {
if (serr != NULL)
if (serr != NULL) {
sprintf(serr, "%s semi-axis value invalid", serri);
}
goto return_err;
}
}
@ -845,10 +841,9 @@ read_elements_file(int32 ipl, double tjd, double *tjd0, double *tequ,
if (ecce != NULL) {
retc = check_t_terms(tt, cpos[4], ecce);
if (*ecce >= 1 || *ecce < 0 || retc == ERR) {
if (serr != NULL)
sprintf(serr,
"%s eccentricity invalid (no parabolic or hyperbolic orbits allowed)",
serri);
if (serr != NULL) {
sprintf(serr, "%s eccentricity invalid (no parabolic or hyperbolic orbits allowed)", serri);
}
goto return_err;
}
}
@ -857,9 +852,9 @@ read_elements_file(int32 ipl, double tjd, double *tjd0, double *tequ,
retc = check_t_terms(tt, cpos[5], parg);
*parg = swe_degnorm(*parg);
if (retc == ERR) {
if (serr != NULL)
sprintf(serr, "%s perihelion argument value invalid",
serri);
if (serr != NULL) {
sprintf(serr, "%s perihelion argument value invalid", serri);
}
goto return_err;
}
*parg *= DEGTORAD;
@ -869,8 +864,9 @@ read_elements_file(int32 ipl, double tjd, double *tjd0, double *tequ,
retc = check_t_terms(tt, cpos[6], node);
*node = swe_degnorm(*node);
if (retc == ERR) {
if (serr != NULL)
if (serr != NULL) {
sprintf(serr, "%s node value invalid", serri);
}
goto return_err;
}
*node *= DEGTORAD;
@ -880,8 +876,9 @@ read_elements_file(int32 ipl, double tjd, double *tjd0, double *tequ,
retc = check_t_terms(tt, cpos[7], incl);
*incl = swe_degnorm(*incl);
if (retc == ERR) {
if (serr != NULL)
if (serr != NULL) {
sprintf(serr, "%s inclination value invalid", serri);
}
goto return_err;
}
*incl *= DEGTORAD;
@ -889,7 +886,7 @@ read_elements_file(int32 ipl, double tjd, double *tjd0, double *tequ,
/* planet name */
if (pname != NULL) {
sp = cpos[8];
while (*sp == ' ' || *sp == '\t')
while(*sp == ' ' || *sp == '\t')
sp++;
swi_right_trim(sp);
strcpy(pname, sp);
@ -904,9 +901,9 @@ read_elements_file(int32 ipl, double tjd, double *tjd0, double *tequ,
break;
}
if (!elem_found) {
if (serr != NULL)
sprintf(serr, "%s elements for planet %7.0f not found", serri,
(double)ipl);
if (serr != NULL) {
sprintf(serr, "%s elements for planet %7.0f not found", serri, (double) ipl);
}
goto return_err;
}
fclose(fp);
@ -917,8 +914,7 @@ return_err:
}
#endif
static int
check_t_terms(double t, char *sinp, double *doutp)
static int check_t_terms(double t, char *sinp, double *doutp)
{
int i, isgn = 1, z;
int retc = 0;
@ -936,7 +932,7 @@ check_t_terms(double t, char *sinp, double *doutp)
fac = 1;
z = 0;
while (1) {
while (*sp != '\0' && strchr(" \t", *sp) != NULL)
while(*sp != '\0' && strchr(" \t", *sp) != NULL)
sp++;
if (strchr("+-", *sp) || *sp == '\0') {
if (z > 0)
@ -948,9 +944,8 @@ check_t_terms(double t, char *sinp, double *doutp)
if (*sp == '\0')
return retc;
sp++;
}
else {
while (*sp != '\0' && strchr("* \t", *sp) != NULL)
} else {
while(*sp != '\0' && strchr("* \t", *sp) != NULL)
sp++;
if (*sp != '\0' && strchr("tT", *sp) != NULL) {
/* a T */
@ -959,8 +954,7 @@ check_t_terms(double t, char *sinp, double *doutp)
fac *= tt[0];
else if ((i = atoi(sp)) <= 4 && i >= 0)
fac *= tt[i];
}
else {
} else {
/* a number */
if (atof(sp) != 0 || *sp == '0')
fac *= atof(sp);

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 $
definitions and constants for all Swiss Ephemeris source files,
@ -73,95 +72,95 @@
#ifndef _SWEODEF_INCLUDED /* allow multiple #includes */
#define _SWEODEF_INCLUDED
#define MY_TRUE 1 /* for use in other defines, before TRUE is defined */
#define MY_FALSE 0 /* for use in other defines, before TRUE is defined */
# define MY_TRUE 1 /* for use in other defines, before TRUE is defined */
# define MY_FALSE 0 /* for use in other defines, before TRUE is defined */
#ifdef _WIN32 /* Microsoft VC 5.0 does not define MSDOS anymore */
#undef MSDOS
#define MSDOS MY_TRUE
# undef MSDOS
# define MSDOS MY_TRUE
#include <wtypes.h>
#include <objbase.h>
#include <wincon.h>
#include <winbase.h>
#include <io.h>
#include <windows.h>
#define sleep(x) Sleep((x) * 1000)
# define sleep(x) Sleep((x) * 1000)
#endif
#ifdef _MSC_VER
#define MS_VC
# define MS_VC
#endif
#ifdef WIN32 /* Microsoft VC 5.0 does not define MSDOS anymore */
#define MSDOS MY_TRUE
# define MSDOS MY_TRUE
#endif
#ifdef MSDOS /* already defined by some DOS compilers */
#undef MSDOS
#define MSDOS MY_TRUE
# undef MSDOS
# define MSDOS MY_TRUE
#endif
#ifdef __TURBOC__ /* defined by turboc */
#ifndef MSDOS
#define MSDOS MY_TRUE
#endif
#define TURBO_C
# ifndef MSDOS
# define MSDOS MY_TRUE
# endif
# define TURBO_C
#endif
#ifdef __SC__ /* defined by Symantec C */
#ifndef MSDOS
#define MSDOS MY_TRUE
#endif
#define SYMANTEC_C
# ifndef MSDOS
# define MSDOS MY_TRUE
# endif
# define SYMANTEC_C
#endif
#ifdef __WATCOMC__ /* defined by WatcomC */
#ifndef MSDOS
#define MSDOS MY_TRUE
#endif
#define WATCOMC
# ifndef MSDOS
# define MSDOS MY_TRUE
# endif
# define WATCOMC
#endif
#ifdef __MWERKS__ /* defined on Macintosh CodeWarrior */
#if macintosh && powerc
#define MACOS MY_TRUE /* let it undefined otherwise */
#define MSDOS MY_FALSE /* in case one above fired falsely */
#endif
# if macintosh && powerc
# define MACOS MY_TRUE /* let it undefined otherwise */
# define MSDOS MY_FALSE /* in case one above fired falsely */
# endif
#endif
#ifdef MSDOS
#define HPUNIX MY_FALSE
#define INTEL_BYTE_ORDER 1
#ifndef TURBO_C
#define MS_C /* assume Microsoft C compiler */
#endif
#define MYFAR far
#define UNIX_FS MY_FALSE
# define HPUNIX MY_FALSE
# define INTEL_BYTE_ORDER 1
# ifndef TURBO_C
# define MS_C /* assume Microsoft C compiler */
# endif
# define MYFAR far
# define UNIX_FS MY_FALSE
#else
#ifdef MACOS
#define HPUNIX MY_FALSE
#define MYFAR
#define UNIX_FS MY_FALSE
#else
#define MSDOS MY_FALSE
#define HPUNIX MY_TRUE
#ifndef _HPUX_SOURCE
#define _HPUX_SOURCE
#endif
#define MYFAR
#define UNIX_FS MY_TRUE
#endif
# ifdef MACOS
# define HPUNIX MY_FALSE
# define MYFAR
# define UNIX_FS MY_FALSE
# else
# define MSDOS MY_FALSE
# define HPUNIX MY_TRUE
# ifndef _HPUX_SOURCE
# define _HPUX_SOURCE
# endif
# define MYFAR
# define UNIX_FS MY_TRUE
# endif
#endif
#include <math.h>
#include <stdlib.h>
#ifndef FILE
#include <stdio.h>
# include <stdio.h>
#endif
#if HPUNIX
#include <unistd.h>
# include <unistd.h>
#endif
/*
@ -171,63 +170,63 @@
*/
#include <limits.h>
#if INT_MAX < 40000
#define INT_16
# define INT_16
#else
#if LONG_MAX > INT_MAX
#define LONG_64
#endif
# if LONG_MAX > INT_MAX
# define LONG_64
# endif
#endif
#ifdef BYTE_ORDER
#ifdef LITTLE_ENDIAN
#if BYTE_ORDER == LITTLE_ENDIAN
#define INTEL_BYTE_ORDER
#endif
# if BYTE_ORDER == LITTLE_ENDIAN
# define INTEL_BYTE_ORDER
# endif
#endif
#endif
#ifdef INT_16
typedef long int32;
typedef unsigned long uint32;
typedef int int16;
typedef double REAL8; /* real with at least 64 bit precision */
typedef long INT4; /* signed integer with at least 32 bit precision */
typedef unsigned long UINT4;
typedef long int32;
typedef unsigned long uint32;
typedef int int16;
typedef double REAL8; /* real with at least 64 bit precision */
typedef long INT4; /* signed integer with at least 32 bit precision */
typedef unsigned long UINT4;
/* unsigned integer with at least 32 bit precision */
typedef int AS_BOOL;
typedef unsigned int UINT2; /* unsigned 16 bits */
#define ABS4 labs /* abs function for long */
typedef int AS_BOOL;
typedef unsigned int UINT2; /* unsigned 16 bits */
# define ABS4 labs /* abs function for long */
#else
typedef int int32;
typedef long long int64;
typedef unsigned int uint32;
typedef short int16;
typedef double REAL8; /* real with at least 64 bit precision */
typedef int INT4; /* signed integer with at least 32 bit precision */
typedef unsigned int UINT4;
typedef int int32;
typedef long long int64;
typedef unsigned int uint32;
typedef short int16;
typedef double REAL8; /* real with at least 64 bit precision */
typedef int INT4; /* signed integer with at least 32 bit precision */
typedef unsigned int UINT4;
/* unsigned integer with at least 32 bit precision */
typedef int AS_BOOL;
typedef unsigned short UINT2; /* unsigned 16 bits */
#define ABS4 abs /* abs function for long */
typedef int AS_BOOL;
typedef unsigned short UINT2; /* unsigned 16 bits */
# define ABS4 abs /* abs function for long */
#endif
#if MSDOS
#ifdef TURBO_C
#include <alloc.h> /* MSC needs malloc ! */
#else
#include <malloc.h>
#endif
#define SIGALRM SIGINT
# ifdef TURBO_C
# include <alloc.h> /* MSC needs malloc ! */
# else
# include <malloc.h>
# endif
# define SIGALRM SIGINT
#endif
#ifndef TRUE
#define TRUE 1
#define FALSE 0
# define TRUE 1
# define FALSE 0
#endif
#ifndef OK
#define OK (0)
#define ERR (-1)
# define OK (0)
# define ERR (-1)
#endif
/* hack because UCHAR is already used by mingw gcc */
@ -241,15 +240,15 @@ typedef unsigned char UCHAR;
#define UCP (UCHAR*)
#define SCP (char*)
#define ODEGREE_STRING "°" /* degree as string, utf8 encoding */
# define ODEGREE_STRING "°" /* degree as string, utf8 encoding */
#ifndef HUGE
#define HUGE 1.7E+308 /* biggest value for REAL8 */
# define HUGE 1.7E+308 /* biggest value for REAL8 */
#endif
#ifndef M_PI
#define M_PI 3.14159265358979323846
# define M_PI 3.14159265358979323846
#endif
#define forward static
@ -283,41 +282,40 @@ typedef int32 centisec; /* centiseconds used for angles and times */
/* control strings for fopen() */
#if UNIX_FS
#define BFILE_R_ACCESS "r" /* open binary file for reading */
#define BFILE_RW_ACCESS "r+" /* open binary file for writing and reading */
#define BFILE_W_CREATE "w" /* create/open binary file for write */
#define BFILE_A_ACCESS "a+" /* create/open binary file for append */
#define FILE_R_ACCESS "r" /* open text file for reading */
#define FILE_RW_ACCESS "r+" /* open text file for writing and reading */
#define FILE_W_CREATE "w" /* create/open text file for write */
#define FILE_A_ACCESS "a+" /* create/open text file for append */
#define O_BINARY 0 /* for open(), not defined in Unix */
#define OPEN_MODE 0666 /* default file creation mode */
#define DIR_GLUE "/" /* glue string for directory/file */
#define PATH_SEPARATOR ";:" /* semicolon or colon may be used */
# define BFILE_R_ACCESS "r" /* open binary file for reading */
# define BFILE_RW_ACCESS "r+" /* open binary file for writing and reading */
# define BFILE_W_CREATE "w" /* create/open binary file for write*/
# define BFILE_A_ACCESS "a+" /* create/open binary file for append*/
# define FILE_R_ACCESS "r" /* open text file for reading */
# define FILE_RW_ACCESS "r+" /* open text file for writing and reading */
# define FILE_W_CREATE "w" /* create/open text file for write*/
# define FILE_A_ACCESS "a+" /* create/open text file for append*/
# define O_BINARY 0 /* for open(), not defined in Unix */
# define OPEN_MODE 0666 /* default file creation mode */
# define DIR_GLUE "/" /* glue string for directory/file */
# define PATH_SEPARATOR ";:" /* semicolon or colon may be used */
#else
#define BFILE_R_ACCESS "rb" /* open binary file for reading */
#define BFILE_RW_ACCESS "r+b" /* open binary file for writing and reading */
#define BFILE_W_CREATE "wb" /* create/open binary file for write */
#define BFILE_A_ACCESS "a+b" /* create/open binary file for append */
#define PATH_SEPARATOR ";" /* semicolon as PATH separator */
#define OPEN_MODE 0666 /* default file creation mode */
#ifdef MACOS
#define FILE_R_ACCESS "r" /* open text file for reading */
#define FILE_RW_ACCESS "r+" /* open text file for writing and reading */
#define FILE_W_CREATE "w" /* create/open text file for write */
#define FILE_A_ACCESS "a+" /* create/open text file for append */
#define DIR_GLUE ":" /* glue string for directory/file */
#else
#define FILE_R_ACCESS "rt" /* open text file for reading */
#define FILE_RW_ACCESS "r+t" /* open text file for writing and reading */
#define FILE_W_CREATE "wt" /* create/open text file for write */
#define FILE_A_ACCESS "a+t" /* create/open text file for append */
# define BFILE_R_ACCESS "rb" /* open binary file for reading */
# define BFILE_RW_ACCESS "r+b" /* open binary file for writing and reading */
# define BFILE_W_CREATE "wb" /* create/open binary file for write*/
# define BFILE_A_ACCESS "a+b" /* create/open binary file for append*/
# define PATH_SEPARATOR ";" /* semicolon as PATH separator */
# define OPEN_MODE 0666 /* default file creation mode */
# ifdef MACOS
# define FILE_R_ACCESS "r" /* open text file for reading */
# define FILE_RW_ACCESS "r+" /* open text file for writing and reading */
# define FILE_W_CREATE "w" /* create/open text file for write*/
# define FILE_A_ACCESS "a+" /* create/open text file for append*/
# define DIR_GLUE ":" /* glue string for directory/file */
# else
# define FILE_R_ACCESS "rt" /* open text file for reading */
# define FILE_RW_ACCESS "r+t" /* open text file for writing and reading */
# define FILE_W_CREATE "wt" /* create/open text file for write*/
# define FILE_A_ACCESS "a+t" /* create/open text file for append*/
/* attention, all backslashes for msdos directry names must be written as \\,
because it is the C escape character */
#define DIR_GLUE "\\" /* glue string for directory/file */
#endif
# define DIR_GLUE "\\" /* glue string for directory/file */
# endif
#endif
#include <string.h>

View File

@ -1,10 +1,8 @@
/*****************************************************
$Header: /home/dieter/sweph/RCS/swepcalc.c,v 1.74 2008/06/16 10:07:20 dieter Exp $
Placalc compatibility interface for Swiss Ephemeris.
*******************************************************/
/* Copyright (C) 1997 - 2008 Astrodienst AG, Switzerland. All rights reserved.
License conditions
@ -82,12 +80,7 @@ Placalc compatibility interface for Swiss Ephemeris.
local globals, not exported
************************************************************/
static int plac2swe[] =
{ SE_SUN, SE_MOON, SE_MERCURY, SE_VENUS, SE_MARS, SE_JUPITER, SE_SATURN,
SE_URANUS, SE_NEPTUNE, SE_PLUTO, SE_MEAN_NODE, SE_TRUE_NODE, SE_CHIRON,
SE_MEAN_APOG,
SE_CERES, SE_PALLAS, SE_JUNO, SE_VESTA,
};
static int plac2swe[] = {SE_SUN, SE_MOON, SE_MERCURY, SE_VENUS, SE_MARS, SE_JUPITER, SE_SATURN, SE_URANUS, SE_NEPTUNE, SE_PLUTO, SE_MEAN_NODE, SE_TRUE_NODE, SE_CHIRON, SE_MEAN_APOG, SE_CERES, SE_PALLAS, SE_JUNO, SE_VESTA,};
/* If there occurs an internal error in placalc, a message is
* written into the string variable perrtx.
@ -102,20 +95,19 @@ static double ekl, nut;
* as 100 when a planet is closest and as 0 when farthest from earth.
*/
static double rmima[CALC_N][2] = {
{0.98296342, 1.01704665},
{0.00238267, 0.00271861},
{0.54900496, 1.45169607},
{0.26411287, 1.73597885},
{0.37289847, 2.67626927},
{3.94877993, 6.45627627},
{7.99362824, 11.09276636},
{ 0.98296342, 1.01704665},
{ 0.00238267, 0.00271861},
{ 0.54900496, 1.45169607},
{ 0.26411287, 1.73597885},
{ 0.37289847, 2.67626927},
{ 3.94877993, 6.45627627},
{ 7.99362824, 11.09276636},
{17.28622633, 21.10714104},
{28.81374786, 31.33507284},
{28.67716748, 50.29208774},
{0.00, 0.00259553}, /* nodes don't get a real value */
{0.00, 0.00259553},
{7.36277475, 19.86585062}
};
{ 0.00, 0.00259553}, /* nodes don't get a real value*/
{ 0.00, 0.00259553},
{ 7.36277475, 19.86585062}};
/**********************************************************
function nacalc ()
@ -132,10 +124,9 @@ coordinate format for fast mathematics with planetary positions.
This function is just a template of how the calc() package
can be used.
**********************************************************/
int
nacalc(double jd_ad, /* universal time relative julian date */
centisec * plon, /* returned longitudes */
centisec * pspe /* returned speeds, if not NULL pointer */
int nacalc (double jd_ad, /* universal time relative julian date */
centisec *plon, /* returned longitudes */
centisec *pspe /* returned speeds, if not NULL pointer */
)
{
char err[AS_MAXCH];
@ -143,17 +134,14 @@ nacalc(double jd_ad, /* universal time relative julian date */
double rlng, rrad, rlat, rspeed;
int result = OK;
flag = CALC_BIT_SPEED; /* same, with speed */
jd_ad += deltat(jd_ad); /* ET = UT + Delta_T */
jd_ad += deltat( jd_ad ); /* ET = UT + Delta_T */
for (planet = SUN; planet <= MAXPL_NACALC; planet++) {
if (calc(planet, jd_ad, flag, &rlng, &rrad, &rlat, &rspeed) == OK) {
plon[planet] = swe_csnorm(swe_d2l(rlng * DEG));
if (pspe != NULL)
pspe[planet] = swe_d2l(rspeed * DEG);
}
else {
plon[planet] = -1;
if (pspe != NULL)
pspe[planet] = 0;
if (calc (planet, jd_ad, flag, &rlng, &rrad, &rlat, &rspeed) == OK) {
plon [planet] = swe_csnorm(swe_d2l (rlng * DEG));
if (pspe != NULL) pspe [planet] = swe_d2l (rspeed * DEG);
} else {
plon [planet] = -1;
if (pspe != NULL) pspe [planet] = 0;
if (result != ERR) { /* save first error message */
strcpy(err, placalc_get_errtext());
}
@ -171,39 +159,35 @@ nacalc(double jd_ad, /* universal time relative julian date */
* over a communication line to the calculation client.
* if plalist = 0, only SUN .. CHIRON are delivered, no LILITH
******************************************************************/
int
calcserv(int id, /* request id, random number to prevent phase err */
int calcserv(int id, /* request id, random number to prevent phase err */
double jd_ad, /* time as relative Astrodienst julian date */
int flag, /* a set of CALC_BIT_ bitflags */
int plalist, /* bit list of planets to be computed, 0 = all */
char *so)
{ /* output string, MUST BE LONG ENOUGH (800 bytes) */
int plalist,/* bit list of planets to be computed, 0 = all */
char *so) /* output string, MUST BE LONG ENOUGH (800 bytes)*/
{
int p, planet, so_len;
double rlng, rrad, rlat, rspeed, rau[CALC_N];
centisec lcs[CALC_N], lpcs[CALC_N], betcs[CALC_N];
char s[AS_MAXCH];
if (plalist == 0)
plalist = (1 << 13) - 1; /* sun .. chiron */ ;
if (plalist == 0) plalist = (1 << 13) - 1; /* sun .. chiron */;
/*
* flag determines whether deltat is added to t;
* if CALC_BIT_EPHE is set, jd_ad is considered as ephemeris time,
* otherwise as universal time.
*/
if ((flag & CALC_BIT_EPHE) == 0) {
jd_ad += deltat(jd_ad);
jd_ad += deltat (jd_ad);
}
for (p = SUN; p < CALC_N; p++) {
if (!check_bit(plalist, p))
continue;
if (calc(p, jd_ad, flag, &rlng, &rrad, &rlat, &rspeed) == OK) {
lcs[p] = swe_d2l(rlng * DEG);
lpcs[p] = swe_d2l(rspeed * DEG);
betcs[p] = swe_d2l(rlat * DEG);
rau[p] = rrad;
}
else {
sprintf(so, "error at planet %d", p);
return (ERR);
if (! check_bit(plalist, p)) continue;
if (calc (p, jd_ad, flag, &rlng, &rrad, &rlat, &rspeed) == OK) {
lcs [p] = swe_d2l (rlng * DEG);
lpcs [p] = swe_d2l (rspeed * DEG);
betcs [p] = swe_d2l (rlat * DEG);
rau [p] = rrad;
} else {
sprintf(so,"error at planet %d", p);
return ( ERR);
}
}
/*
@ -216,50 +200,45 @@ calcserv(int id, /* request id, random number to prevent phase er
* then for each requested planet, if wanted: rgeo (units 0..999)
* then for each requested planet, if wanted: rau (A.U.)
*/
sprintf(so, "%d,%.8f,%d,%d,%d,%d", id, jd_ad, flag, plalist,
swe_d2l(ekl * DEG), swe_d2l(nut * DEG));
so_len = strlen(so);
sprintf (so, "%d,%.8f,%d,%d,%d,%d", id, jd_ad, flag, plalist,
swe_d2l(ekl * DEG), swe_d2l (nut * DEG) );
so_len = strlen (so);
for (planet = SUN; planet < CALC_N; planet++) {
if (!check_bit(plalist, planet))
continue;
sprintf(s, ",%d", lcs[planet]);
strcat(so + so_len, s);
so_len += strlen(s);
if (! check_bit(plalist, planet)) continue;
sprintf (s ,",%d", lcs[planet]);
strcat (so + so_len, s);
so_len += strlen (s);
}
if (flag & CALC_BIT_SPEED) {
for (planet = SUN; planet < CALC_N; planet++) {
if (!check_bit(plalist, planet))
continue;
sprintf(s, ",%d", lpcs[planet]);
strcat(so + so_len, s);
so_len += strlen(s);
if (! check_bit(plalist, planet)) continue;
sprintf (s ,",%d", lpcs[planet]);
strcat (so + so_len, s);
so_len += strlen (s);
}
}
if (flag & CALC_BIT_BETA) {
for (planet = SUN; planet < CALC_N; planet++) {
if (!check_bit(plalist, planet))
continue;
sprintf(s, ",%d", betcs[planet]);
strcat(so + so_len, s);
so_len += strlen(s);
if (! check_bit(plalist, planet)) continue;
sprintf (s ,",%d", betcs[planet]);
strcat (so + so_len, s);
so_len += strlen (s);
}
}
if (flag & CALC_BIT_RGEO) {
for (planet = SUN; planet < CALC_N; planet++) {
if (!check_bit(plalist, planet))
continue;
sprintf(s, ",%d", rel_geo(planet, rau[planet]));
strcat(so + so_len, s);
so_len += strlen(s);
if (! check_bit(plalist, planet)) continue;
sprintf (s ,",%d", rel_geo(planet,rau[planet]));
strcat (so + so_len, s);
so_len += strlen (s);
}
}
if (flag & CALC_BIT_RAU) {
for (planet = SUN; planet < CALC_N; planet++) {
if (!check_bit(plalist, planet))
continue;
sprintf(s, ",%.8f", rau[planet]);
strcat(so + so_len, s);
so_len += strlen(s);
if (! check_bit(plalist, planet)) continue;
sprintf (s ,",%.8f", rau[planet]);
strcat (so + so_len, s);
so_len += strlen (s);
}
}
return (OK);
@ -297,19 +276,21 @@ calcserv(int id, /* request id, random number to prevent phase er
will return the values for time teph.
******************************************************************/
int
calc(int planet, /* planet index as defined in placalc.h,
* SUN = 0, MOON = 1 etc.
* planet == -1 calc calculates only nut, ekl, meanekl */
int calc(int planet, /* planet index as defined in placalc.h,
SUN = 0, MOON = 1 etc.
planet == -1 calc calculates only nut, ekl, meanekl */
double jd_ad, /* relative Astrodienst Juldate, ephemeris time.
* Astrodienst Juldate is relative 31 Dec 1949, noon. */
Astrodienst Juldate is relative 31 Dec 1949, noon. */
int flag, /* See definition of flag bits above */
double *alng, double *arad, double *alat, double *alngspeed)
double *alng,
double *arad,
double *alat,
double *alngspeed)
/* pointers to the return variables:
* alng = ecliptic longitude in degrees
* arad = radius vector in AU (astronomic units)
* alat = ecliptic latitude in degrees
* alngspeed = speed of planet in degrees per day
alng = ecliptic longitude in degrees
arad = radius vector in AU (astronomic units)
alat = ecliptic latitude in degrees
alngspeed = speed of planet in degrees per day
*/
{
double tjd = jd_ad + JUL_OFFSET;
@ -348,8 +329,7 @@ calc(int planet, /* planet index as defined in placalc.h,
*alng = nut = x[2];
*arad = x[1];
*alat = ekl = x[0];
}
else {
} else {
*alng = x[0];
*arad = x[2];
*alat = x[1];
@ -358,8 +338,7 @@ calc(int planet, /* planet index as defined in placalc.h,
return (OK);
} /* end calc */
int
rel_geo(int planet, double rau)
int rel_geo(int planet, double rau)
{
/*
* get relative earth distance in range 0..1000:
@ -377,12 +356,8 @@ rel_geo(int planet, double rau)
int rgeo;
if (planet == MEAN_NODE || planet == TRUE_NODE || planet == LILITH) {
return 0;
}
else {
rgeo =
1000 * (1.0 -
(rau - rmima[planet][0]) / (rmima[planet][1] -
rmima[planet][0]));
} else {
rgeo = 1000 * (1.0 - (rau - rmima[planet][0]) / (rmima[planet][1] - rmima[planet][0]));
}
if (rgeo < 0)
rgeo = 0;
@ -395,74 +370,31 @@ rel_geo(int planet, double rau)
* get the planet index for an AFL letter
* returns -1 if the letter does not correspond to a planet.
*/
int
afl2planet(int afl)
int afl2planet(int afl)
{
int p;
switch (afl) {
case AFL_SUN:
p = SUN;
break;
case AFL_MON:
p = MOON;
break;
case AFL_MER:
p = MERCURY;
break;
case AFL_VEN:
p = VENUS;
break;
case AFL_MAR:
p = MARS;
break;
case AFL_JUP:
p = JUPITER;
break;
case AFL_SAT:
p = SATURN;
break;
case AFL_URA:
p = URANUS;
break;
case AFL_NEP:
p = NEPTUNE;
break;
case AFL_PLU:
p = PLUTO;
break;
case AFL_MNODE:
p = MEAN_NODE;
break;
case AFL_TNODE:
p = TRUE_NODE;
break;
case AFL_CHI:
p = CHIRON;
break;
case AFL_LIL:
p = LILITH;
break;
case AFL_CER:
p = CERES;
break;
case AFL_PAL:
p = PALLAS;
break;
case AFL_JUN:
p = JUNO;
break;
case AFL_VES:
p = VESTA;
break;
case AFL_AC:
p = AC;
break;
case AFL_MC:
p = MC;
break;
default:
p = -1;
break;
case AFL_SUN : p = SUN; break;
case AFL_MON : p = MOON; break;
case AFL_MER : p = MERCURY; break;
case AFL_VEN : p = VENUS; break;
case AFL_MAR : p = MARS; break;
case AFL_JUP : p = JUPITER; break;
case AFL_SAT : p = SATURN; break;
case AFL_URA : p = URANUS; break;
case AFL_NEP : p = NEPTUNE; break;
case AFL_PLU : p = PLUTO; break;
case AFL_MNODE : p = MEAN_NODE; break;
case AFL_TNODE : p = TRUE_NODE; break;
case AFL_CHI : p = CHIRON; break;
case AFL_LIL : p = LILITH; break;
case AFL_CER : p = CERES; break;
case AFL_PAL : p = PALLAS; break;
case AFL_JUN : p = JUNO; break;
case AFL_VES : p = VESTA; break;
case AFL_AC : p = AC; break;
case AFL_MC : p = MC; break;
default : p = -1; break;
}
return p;
}
@ -471,50 +403,29 @@ afl2planet(int afl)
* get the AFL letter for a planet
* returns -1 if no letter corresponds to a planet.
*/
int
planet2afl(int planet)
int planet2afl(int planet)
{
switch (planet) {
case SUN:
return AFL_SUN;
case MOON:
return AFL_MON;
case MERCURY:
return AFL_MER;
case VENUS:
return AFL_VEN;
case MARS:
return AFL_MAR;
case JUPITER:
return AFL_JUP;
case SATURN:
return AFL_SAT;
case URANUS:
return AFL_URA;
case NEPTUNE:
return AFL_NEP;
case PLUTO:
return AFL_PLU;
case MEAN_NODE:
return AFL_MNODE;
case TRUE_NODE:
return AFL_TNODE;
case CHIRON:
return AFL_CHI;
case LILITH:
return AFL_LIL;
case CERES:
return AFL_CER;
case PALLAS:
return AFL_PAL;
case JUNO:
return AFL_JUN;
case VESTA:
return AFL_VES;
case AC:
return AFL_AC;
case MC:
return AFL_MC;
case SUN: return AFL_SUN;
case MOON: return AFL_MON;
case MERCURY: return AFL_MER;
case VENUS: return AFL_VEN;
case MARS: return AFL_MAR;
case JUPITER: return AFL_JUP;
case SATURN: return AFL_SAT;
case URANUS: return AFL_URA;
case NEPTUNE: return AFL_NEP;
case PLUTO: return AFL_PLU;
case MEAN_NODE: return AFL_MNODE;
case TRUE_NODE: return AFL_TNODE;
case CHIRON: return AFL_CHI;
case LILITH: return AFL_LIL;
case CERES: return AFL_CER;
case PALLAS: return AFL_PAL;
case JUNO: return AFL_JUN;
case VESTA: return AFL_VES;
case AC: return AFL_AC;
case MC: return AFL_MC;
}
if (planet >= FIRST_HSNR && planet <= LAST_HSNR)
return AFL_HOUSE;
@ -526,50 +437,29 @@ planet2afl(int planet)
* get the 2-letter abbreviation for a planet
* returns ?? if not defined
*/
char *
planet2abbr2(int planet)
char *planet2abbr2(int planet)
{
switch (planet) {
case SUN:
return "su";
case MOON:
return "mo";
case MERCURY:
return "me";
case VENUS:
return "ve";
case MARS:
return "ma";
case JUPITER:
return "ju";
case SATURN:
return "sa";
case URANUS:
return "ur";
case NEPTUNE:
return "ne";
case PLUTO:
return "pl";
case MEAN_NODE:
return "mn";
case TRUE_NODE:
return "tn";
case CHIRON:
return "ch";
case LILITH:
return "li";
case CERES:
return "ce";
case PALLAS:
return "pa";
case JUNO:
return "jn";
case VESTA:
return "vs";
case AC:
return "ac";
case MC:
return "mc";
case SUN: return "su";
case MOON: return "mo";
case MERCURY: return "me";
case VENUS: return "ve";
case MARS: return "ma";
case JUPITER: return "ju";
case SATURN: return "sa";
case URANUS: return "ur";
case NEPTUNE: return "ne";
case PLUTO: return "pl";
case MEAN_NODE: return "mn";
case TRUE_NODE: return "tn";
case CHIRON: return "ch";
case LILITH: return "li";
case CERES: return "ce";
case PALLAS: return "pa";
case JUNO: return "jn";
case VESTA: return "vs";
case AC: return "ac";
case MC: return "mc";
}
return "??";
}
@ -578,62 +468,39 @@ planet2abbr2(int planet)
* get the 3-letter abbreviation for a planet
* returns ??? if not defined
*/
char *
planet2abbr3(int planet)
char *planet2abbr3(int planet)
{
switch (planet) {
case SUN:
return "sun";
case MOON:
return "mon";
case MERCURY:
return "mer";
case VENUS:
return "ven";
case MARS:
return "mar";
case JUPITER:
return "jup";
case SATURN:
return "sat";
case URANUS:
return "ura";
case NEPTUNE:
return "nep";
case PLUTO:
return "plu";
case MEAN_NODE:
return "mno";
case TRUE_NODE:
return "tno";
case CHIRON:
return "chi";
case LILITH:
return "lil";
case CERES:
return "cer";
case PALLAS:
return "pal";
case JUNO:
return "jun";
case VESTA:
return "ves";
case AC:
return "asc";
case MC:
return "mc ";
case SUN: return "sun";
case MOON: return "mon";
case MERCURY: return "mer";
case VENUS: return "ven";
case MARS: return "mar";
case JUPITER: return "jup";
case SATURN: return "sat";
case URANUS: return "ura";
case NEPTUNE: return "nep";
case PLUTO: return "plu";
case MEAN_NODE: return "mno";
case TRUE_NODE: return "tno";
case CHIRON: return "chi";
case LILITH: return "lil";
case CERES: return "cer";
case PALLAS: return "pal";
case JUNO: return "jun";
case VESTA: return "ves";
case AC: return "asc";
case MC: return "mc ";
}
return "???";
}
char *
placalc_set_ephepath(char *path)
char *placalc_set_ephepath(char *path)
{
static char *epath;
if (path == NULL)
return epath;
if (path == NULL) return epath;
if (epath != NULL)
free((void *)epath);
free((void *) epath);
epath = malloc(strlen(path) + 1);
if (epath != NULL) {
strcpy(epath, path);
@ -642,14 +509,12 @@ placalc_set_ephepath(char *path)
return epath;
}
void
placalc_close_files()
void placalc_close_files()
{
swe_close();
}
char *
placalc_get_errtext()
char *placalc_get_errtext()
{
return perrtx;
}
@ -659,9 +524,8 @@ deltat(t): returns delta t (in julian days) from universal time t
is included by users
ET = UT + deltat
******************************************************/
double
deltat(double jd_ad)
{ /* Astrodienst relative julian date */
double deltat (double jd_ad) /* Astrodienst relative julian date */
{
return swe_deltat(jd_ad + JUL_OFFSET);
}
@ -677,36 +541,32 @@ deltat(double jd_ad)
* lon, lat pointer for returning the ecliptic coordinates
* (mean ecliptic and equinox of date)
**********************************************************/
int
fixstar(char *star, double jd, double *lon, double *lat)
int fixstar(char *star, double jd, double *lon, double *lat)
{
double x[6];
int i;
int32 retflag;
/* if call by number, fixstar() is 0-based,
* whereas swe_fixstar starts with 1 */
if (isdigit((int)*star)) {
if (isdigit((int) *star)) {
i = atoi(star);
sprintf(star, "%d", i + 1);
sprintf(star, "%d", i+1);
}
retflag = swe_fixstar(star, jd, 0, x, perrtx);
*lon = x[0];
*lat = x[1];
return ((int)retflag);
return((int) retflag);
}
/******************************************************************/
double
diff8360(double a, double b)
/* a - b on a 360 degree circle, result -180..180 */
double diff8360 (double a, double b)
/* a - b on a 360 degree circle, result -180..180*/
{
double d;
d = a - b;
if (d >= 180.0)
return (d - 360.0);
if (d < -180.0)
return (d + 360.0);
return (d);
if ( d >= 180.0 ) return( d - 360.0 );
if ( d < -180.0 ) return( d + 360.0 );
return( d );
} /* diff8360 */
/*
@ -717,14 +577,12 @@ diff8360(double a, double b)
return in which house pp is;
houses are numbered from 1 .. 12
*************************************/
int
HouseNr(struct houses *hsp, CSEC pp)
int HouseNr(struct houses *hsp, CSEC pp)
{
CSEC cx;
int i = 2;
cx = swe_difcsn(pp, hsp->cusp[1]); /* distance from cusp 1 */
while (i < 13 && cx >= difcsn(hsp->cusp[i], hsp->cusp[1]))
i++;
cx = swe_difcsn(pp, hsp->cusp [1]); /* distance from cusp 1 */
while (i < 13 && cx >= difcsn(hsp->cusp [i], hsp->cusp [1])) i++;
return (i - 1);
}
@ -732,15 +590,12 @@ HouseNr(struct houses *hsp, CSEC pp)
returns the inp-house number, where pp is in
houses are numbered from 1 .. 12
************************************/
int
InpHouseNr(struct houses *hsp, CSEC pp, CSEC * coff)
int InpHouseNr (struct houses *hsp, CSEC pp, CSEC *coff)
{
CSEC cx;
int i = 2;
cx = swe_difcsn(pp, hsp->cusp[1] + coff[1]);
while (i < 13
&& cx >= swe_difcsn(hsp->cusp[i] + coff[i],
hsp->cusp[1] + coff[1]))
cx = swe_difcsn(pp, hsp->cusp [1] + coff [1]);
while(i<13 && cx >= swe_difcsn(hsp->cusp[i] + coff[i], hsp->cusp[1] + coff[1]))
i++;
return (i - 1);
}
@ -753,8 +608,7 @@ InpHouseNr(struct houses *hsp, CSEC pp, CSEC * coff)
* We first calculate the absolute offsets for each house of our birth chart,
* then call the function InpHouseNr() with those values.
*/
int
InpHouseNr2(struct houses *hsp, CSEC pp, CSEC * coff)
int InpHouseNr2 (struct houses *hsp, CSEC pp, CSEC *coff)
{
int i, j;
CSEC myoff[13];
@ -763,66 +617,42 @@ InpHouseNr2(struct houses *hsp, CSEC pp, CSEC * coff)
if (myoff[0] == 1) {
for (i = 1; i < 13; i++) {
j = i + 1;
if (j > 12)
j = 1;
myoff[j] =
swe_degnorm((hsp->cusp[j] -
hsp->cusp[i]) / 360000.0) / 30.0 * myoff[j];
if (j > 12) j = 1;
myoff[j] = swe_degnorm((hsp->cusp[j] - hsp->cusp[i]) / 360000.0) / 30.0 * myoff[j];
}
}
return InpHouseNr(hsp, pp, myoff);
}
/* ********************************************************* */
/* Houses: */
/* ********************************************************* */
/* Koch and Placidus don't work in the polar circle. */
/* We swap MC/IC so that MC is always before AC in the zodiac */
/* We than divide the quadrants into 3 equal parts. */
/* ********************************************************* */
/* All angles are expressed in centiseconds (1/100th of a */
/* second of arc) and integer arithmetic is used for these. */
/* Special trigonometric functions dsin, dcos etc. are im- */
/* plemented for arguments in centiseconds. */
/* ********************************************************* */
/* Arguments: th = sidereal time (angle 0..360 degrees */
/* hsy = letter code for house system; implemen- */
/* ted are P,K,C,R,E,V. */
/* fi = geographic latitude */
/* ekl = obliquity of the ecliptic */
/* iteration_count = number of iterations in */
/* Placidus calculation; can be 1 or 2. */
/* ********************************************************* */
void
CalcHouses(CSEC th, CSEC fi, CSEC mekl, char hsy, int iteration_count,
struct houses *hsp)
void CalcHouses(CSEC th, CSEC fi, CSEC mekl, char hsy, int iteration_count,
struct houses *hsp )
{
int retc = 0, i;
double cs2deg = 360000;
double cusps[13];
double ascmc[10];
/* iteration_count is always 2 */
retc =
swe_houses_armc(th / cs2deg, fi / cs2deg, mekl / cs2deg, (int)hsy,
retc = swe_houses_armc(th / cs2deg, fi / cs2deg, mekl / cs2deg, (int) hsy,
cusps, ascmc);
for (i = 0; i < 13; i++)
hsp->cusp[i] = swe_d2l(cusps[i] * cs2deg);
@ -836,10 +666,9 @@ CalcHouses(CSEC th, CSEC fi, CSEC mekl, char hsy, int iteration_count,
} /* procedure houses */
/******************************/
void
RecalcAspects(struct AspectType *a)
void RecalcAspects(struct AspectType *a)
{
centisec diff, orbis;
centisec diff,orbis;
int p1, p2, i;
struct aspRec *arp;
if (a->ppos2 == NULL) { /* no set ppos2, no interaspects */
@ -847,41 +676,40 @@ RecalcAspects(struct AspectType *a)
a->Asp[p1][p1].index = 0; /* ignore p1 conjunct p1 */
for (p2 = p1 + 1; p2 < a->NrOfPlanets; p2++) {
arp = &(a->Asp[p1][p2]);
diff = a->PlanetPos[p2] - a->PlanetPos[p1];
diff = a->PlanetPos [p2] - a->PlanetPos [p1];
if (diff >= DEG180)
diff -= DEG360;
else if (diff < -DEG180)
else if (diff < - DEG180)
diff += DEG360;
i = 1;
arp->index = 0;
while (i <= a->NrOfAspects) {
orbis = ABS4(diff) - a->Angle[i];
if (ABS4(orbis) <= a->Maxorb[i]) {
orbis = ABS4 (diff) - a->Angle [i];
if (ABS4 (orbis) <= a->Maxorb [i]) {
arp->index = i;
arp->orb = orbis;
break; /* out of while */
}
i++;
}
a->Asp[p2][p1].index = arp->index;
a->Asp[p2][p1].orb = arp->orb;
a->Asp [p2][p1].index = arp->index;
a->Asp [p2][p1].orb = arp->orb;
} /* for p2 */
} /* for p1 */
}
else { /* interaspects between set 1 and set 2 */
} else { /* interaspects between set 1 and set 2 */
for (p1 = 0; p1 < a->NrOfPlanets; p1++) {
for (p2 = 0; p2 < a->NrOfPlanets; p2++) {
arp = &(a->Asp[p1][p2]);
diff = a->ppos2[p2] - a->PlanetPos[p1];
diff = a->ppos2 [p2] - a->PlanetPos [p1];
if (diff >= DEG180)
diff -= DEG360;
else if (diff < -DEG180)
else if (diff < - DEG180)
diff += DEG360;
i = 1;
arp->index = 0;
while (i <= a->NrOfAspects) {
orbis = ABS4(diff) - a->Angle[i];
if (ABS4(orbis) <= a->Maxorb[i]) {
orbis = ABS4 (diff) - a->Angle [i];
if (ABS4 (orbis) <= a->Maxorb [i]) {
arp->index = i;
arp->orb = orbis;
break; /* out of while */
@ -899,23 +727,20 @@ function sidtime (t): returns sidereal time at greenwich;
Parameters differ from ASYS version! after AESuppl. 1961, page 75
version 24-oct-87
***********************************************************/
double
sidtime(double jd_ad, double ecl, double nuta)
double sidtime (double jd_ad, double ecl, double nuta)
/* jd_ad relative julian date */
/* ecl, nuta ecliptic and nutation of date, in degrees */
{
return swe_sidtime0(jd_ad + JUL_OFFSET, ecl, nuta);
}
#ifdef INTEL_BYTE_ORDER
# ifdef INTEL_BYTE_ORDER
/********************************************************************/
void
longreorder(UCHAR * p, int n)
void longreorder (UCHAR *p, int n)
/* p points to memory filled with int32 values; for
* each of the values the seqeuence of the four bytes
* has to be reversed, to translate HP-UX and VAX
* ordering to MSDOS/Turboc ordering */
each of the values the seqeuence of the four bytes
has to be reversed, to translate HP-UX and VAX
ordering to MSDOS/Turboc ordering */
{
int i;
unsigned char c0, c1, c2, c3;
@ -930,4 +755,4 @@ longreorder(UCHAR * p, int n)
*(p + 3) = c0;
}
}
#endif
# endif

View File

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

View File

@ -1,11 +1,9 @@
/*****************************************************
$Header: swepdate.c,v 1.65 2003/06/14 13:02:01 alois Exp $
Placalc compatibility interface for Swiss Ephemeris.
date functions
*******************************************************/
/* Copyright (C) 1997 - 2008 Astrodienst AG, Switzerland. All rights reserved.
License conditions
@ -131,8 +129,7 @@ date functions
and notifies errors like 32 January.
****************************************************************/
double
julday(int month, int day, int year, double hour, int gregflag)
double julday(int month, int day, int year, double hour, int gregflag)
{
double jd;
jd = swe_julday(year, month, day, hour, gregflag);
@ -142,21 +139,18 @@ julday(int month, int day, int year, double hour, int gregflag)
/*
* monday = 0, ... sunday = 6
*/
int
day_of_week(double jd)
int day_of_week(double jd)
{
return (((int)floor(jd - 2433282 - 1.5) % 7) + 7) % 7;
return (((int) floor (jd - 2433282 - 1.5) %7) + 7) % 7;
}
/*************** julday ******************
get absolute julian day number (author: Marc Pottenger)
with bug fix for year < -4711 15-aug-88
*/
double
juldays(int gregflag, ADATE * adp)
double juldays(int gregflag, ADATE *adp )
{
return swe_julday(adp->year, adp->month, adp->day, adp->csec / 360000.0,
gregflag);
return swe_julday(adp->year, adp->month, adp->day, adp->csec / 360000.0, gregflag);
}
/*** revjul ******************************************************
@ -178,8 +172,8 @@ juldays(int gregflag, ADATE * adp)
Original author Mark Pottenger, Los Angeles.
with bug fix for year < -4711 16-aug-88 Alois Treindl
*************************************************************************/
void
revjul(double jd, int gregflag, int *jmon, int *jday, int *jyear, double *jut)
void revjul (double jd, int gregflag,
int *jmon, int *jday, int *jyear, double *jut)
{
swe_revjul(jd, gregflag, jyear, jmon, jday, jut);
}
@ -189,8 +183,7 @@ revjul(double jd, int gregflag, int *jmon, int *jday, int *jyear, double *jut)
with bug fix for year < -4711 16-aug-88
arguments are julian day #, calendar flag (0=julian, 1=gregorian)
*/
void
revjuls(double jd, int gregflag, struct adate *adp)
void revjuls(double jd, int gregflag, struct adate *adp)
{
double jut;
swe_revjul(jd, gregflag, &adp->year, &adp->month, &adp->day, &jut);
@ -222,8 +215,9 @@ revjuls(double jd, int gregflag, struct adate *adp)
Return: OK or ERR (for illegal date)
*********************************************************/
int
date_conversion(int d, int m, int y, /* day, month, year */
int date_conversion (int d ,
int m ,
int y , /* day, month, year */
centisec gutime, /* greenwich time in centiseconds */
char c, /* calendar g[regorian]|j[ulian]|a[stro = greg] */
double *tgmt
@ -242,8 +236,7 @@ date_conversion(int d, int m, int y, /* day, month, year */
*tgmt = jd - JUL_OFFSET;
if (rmon == m && rday == d && ryear == y) {
return OK;
}
else {
} else {
return ERR;
}
} /* 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
************************************************************/
/* Copyright (C) 1997 - 2008 Astrodienst AG, Switzerland. All rights reserved.
License conditions
@ -64,7 +63,7 @@
* 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 B1950 2433282.42345905 /* 1950 January 0.923 */
@ -129,10 +128,13 @@
#define SE_TIDAL_DE404 (-25.580) /* was (-25.8) until V. 1.76.2 */
#define SE_TIDAL_DE405 (-25.826) /* was (-25.7376) until V. 1.76.2 */
#define SE_TIDAL_DE406 (-25.826) /* was (-25.7376) until V. 1.76.2 */
#define SE_TIDAL_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_DEFAULT SE_TIDAL_DE406
#define SE_TIDAL_DEFAULT SE_TIDAL_DE431
/*
* earlier content
@ -192,9 +194,9 @@
#define SEI_FILE_FIXSTAR 4
#if 0
#define SEI_FILE_TEST_ENDIAN (97L * 65536L + 98L * 256L + 99L) /*abc */
#define SEI_FILE_TEST_ENDIAN (97L * 65536L + 98L * 256L + 99L) /*abc*/
#endif
#define SEI_FILE_TEST_ENDIAN (0x616263L) /* abc */
#define SEI_FILE_TEST_ENDIAN (0x616263L) /* abc*/
#define SEI_FILE_BIGENDIAN 0
#define SEI_FILE_NOREORD 0
#define SEI_FILE_LITENDIAN 1
@ -227,15 +229,19 @@
#define MOSHPLEPH_END 2818000.5
#define MOSHLUEPH_START 625000.5
#define MOSHLUEPH_END 2818000.5
#define MOSHNDEPH_START -254900.5 /* 14 Feb -5410 00:00 ET jul.cal. */
#define MOSHNDEPH_END 3697000.5 /* 11 Dec 5409 00:00 ET, greg. cal */
/*#define MOSHNDEPH_START -254900.5 */ /* 14 Feb -5410 00:00 ET jul.cal.*/
/*#define MOSHNDEPH_END 3697000.5 */ /* 11 Dec 5409 00:00 ET, greg. cal */
#define 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_END 3600000.5
#define MOSHLUEPH_START -225000.5
#define MOSHLUEPH_END 3600000.5
*/
#define JPL_DE431_START -3027215.5
#define JPL_DE431_END 7930192.5
#if FALSE /* Alois commented out, not used anywhere */
#define JPLEPH_START 625307.5 /* about -3000 (DE406) */
#define JPLEPH_END 2816848.5 /* about 3000 (DE406) */
@ -263,7 +269,6 @@
#define MOON_MEAN_DIST 384400000.0 /* in m, AA 1996, F2 */
#define MOON_MEAN_INCL 5.1453964 /* AA 1996, D2 */
#define MOON_MEAN_ECC 0.054900489 /* AA 1996, F2 */
/* #define SUN_EARTH_MRAT 328900.561400 Su/(Ea+Mo) AA 2006 K7 */
#define SUN_EARTH_MRAT 332946.050895 /* Su / (Ea only) AA 2006 K7 */
#define EARTH_MOON_MRAT (1 / 0.0123000383) /* AA 2006, K7 */
@ -280,7 +285,6 @@
#define KGAUSS 0.01720209895 /* Gaussian gravitational constant K6 */
#define SUN_RADIUS (959.63 / 3600 * DEGTORAD) /* Meeus germ. p 391 */
#define EARTH_RADIUS 6378136.6 /* AA 2006 K6 */
/*#define EARTH_OBLATENESS (1.0/ 298.257223563) * AA 1998 K13 */
#define EARTH_OBLATENESS (1.0/ 298.25642) /* AA 2006 K6 */
#define EARTH_ROT_SPEED (7.2921151467e-5 * 86400) /* in rad/day, expl. suppl., p 162 */
@ -289,10 +293,8 @@
/* node of ecliptic measured on ecliptic 2000 */
#define SSY_PLANE_NODE_E2000 (107.582569 * DEGTORAD)
/* node of ecliptic measured on solar system rotation plane */
#define SSY_PLANE_NODE (107.58883388 * DEGTORAD)
/* inclination of ecliptic against solar system rotation plane */
#define SSY_PLANE_INCL (1.578701 * DEGTORAD)
@ -314,7 +316,7 @@
/* planetary radii in meters */
#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 */
2439000.0 * 2, /* Mercury */
6052000.0 * 2, /* Venus */
@ -332,7 +334,7 @@ static const double pla_diam[NDIAM] = { 1392000000.0, /* Sun */
523000.0, /* Pallas */
244000.0, /* Juno */
501000.0, /* Vesta */
};
};
/* Ayanamsas
@ -340,10 +342,7 @@ static const double pla_diam[NDIAM] = { 1392000000.0, /* Sun */
* t0 epoch of ayanamsa, TDT (ET)
* ayan_t0 ayanamsa value at epoch
*/
struct aya_init
{
double t0, ayan_t0;
};
struct aya_init {double t0, ayan_t0;};
static const struct aya_init ayanamsa[] = {
{2433282.5, 24.042044444}, /* 0: Fagan/Bradley (Default) */
/*{J1900, 360 - 337.53953}, * 1: Lahiri (Robert Hand) */
@ -373,28 +372,28 @@ static const struct aya_init ayanamsa[] = {
{J1900, 0}, /*19: J1900 */
{B1950, 0}, /*20: B1950 */
{1903396.8128654, 0}, /*21: Suryasiddhanta, assuming
* ingress of mean Sun into Aries at point
* of mean equinox of date on
* 21.3.499, noon, Ujjain (75.7684565 E)
* = 7:30:31.57 UT */
{1903396.8128654, -0.21463395}, /*22: Suryasiddhanta, assuming
* ingress of mean Sun into Aries at
* true position of mean Sun at same epoch */
ingress of mean Sun into Aries at point
of mean equinox of date on
21.3.499, noon, Ujjain (75.7684565 E)
= 7:30:31.57 UT */
{1903396.8128654,-0.21463395},/*22: Suryasiddhanta, assuming
ingress of mean Sun into Aries at
true position of mean Sun at same epoch */
{1903396.7895321, 0}, /*23: Aryabhata, same date, but UT 6:56:55.57
* analogous 21 */
{1903396.7895321, -0.23763238}, /*24: Aryabhata, analogous 22 */
{0, 0}, /*25: - */
{0, 0}, /*26: - */
{0, 0}, /*27: - */
{0, 0}, /*28: - */
analogous 21 */
{1903396.7895321,-0.23763238},/*24: Aryabhata, analogous 22 */
{1903396.8128654,-0.79167046},/*25: SS, Revati/zePsc at polar long. 359°50'*/
{1903396.8128654, 2.11070444},/*26: SS, Citra/Spica at polar long. 180° */
{0, 0}, /*27: True Citra (Spica always exactly at 0 Libra) */
{0, 0}, /*28: True Revati (zeta Psc always exactly at 0 Aries) */
{0, 0}, /*29: - */
};
{0, 0}, /*30: - */
};
#define PLAN_DATA struct plan_data
/* obliquity of ecliptic */
struct epsilon
{
struct epsilon {
double teps, eps, seps, ceps; /* jd, eps, sin(eps), cos(eps) */
};
@ -403,8 +402,7 @@ extern struct epsilon oec2000;
extern struct epsilon oec;
*/
struct plan_data
{
struct plan_data {
/* the following data are read from file only once, immediately after
* file has been opened */
int ibdy; /* internal body number */
@ -414,7 +412,7 @@ struct plan_data
* to coordinate system of orbital plane
* SEI_FLG_ELLIPSE: TRUE if reference ellipse */
int ncoe; /* # of coefficients of ephemeris polynomial,
* is polynomial order + 1 */
is polynomial order + 1 */
/* where is the segment index on the file */
int32 lndx0; /* file position of begin of planet's index */
int32 nndx; /* number of index entries on file: computed */
@ -462,29 +460,25 @@ struct plan_data
/* moon, s. moshmoon.c */
extern int swi_mean_node(double jd, double *x, char *serr);
extern int swi_mean_apog(double jd, double *x, char *serr);
extern int swi_moshmoon(double tjd, AS_BOOL do_save, double *xpm, char *serr);
extern int swi_moshmoon(double tjd, AS_BOOL do_save, double *xpm, char *serr) ;
extern int swi_moshmoon2(double jd, double *x);
extern int swi_intp_apsides(double J, double *pol, int ipli);
/* planets, s. moshplan.c */
extern int swi_moshplan(double tjd, int ipli, AS_BOOL do_save, double *xpret,
double *xeret, char *serr);
extern int swi_moshplan(double tjd, int ipli, AS_BOOL do_save, double *xpret, double *xeret, char *serr);
extern int swi_moshplan2(double J, int iplm, double *pobj);
extern int swi_osc_el_plan(double tjd, double *xp, int ipl, int ipli,
double *xearth, double *xsun, char *serr);
extern int swi_osc_el_plan(double tjd, double *xp, int ipl, int ipli, double *xearth, double *xsun, char *serr);
extern FILE *swi_fopen(int ifno, char *fname, char *ephepath, char *serr);
/* nutation */
struct nut
{
struct nut {
double tnut;
double nutlo[2]; /* nutation in longitude and obliquity */
double snut, cnut; /* sine and cosine of nutation in obliquity */
double matrix[3][3];
};
struct plantbl
{
struct plantbl {
char max_harmonic[9];
char max_power_of_t;
signed char *arg_tbl;
@ -494,8 +488,7 @@ struct plantbl
double distance;
};
struct file_data
{
struct file_data {
char fnam[AS_MAXCH]; /* ephemeris file name */
int fversion; /* version number of file */
char astnam[50]; /* asteroid name, if asteroid file */
@ -509,13 +502,15 @@ struct file_data
int ipl[SEI_FILE_NMAXPLAN]; /* planet numbers */
};
struct gen_const
{
double clight, aunit, helgravconst, ratme, sunradius;
struct gen_const {
double clight,
aunit,
helgravconst,
ratme,
sunradius;
};
struct save_positions
{
struct save_positions {
int ipl;
double tsave;
int32 iflgsave;
@ -529,8 +524,7 @@ struct save_positions
double xsaves[24];
};
struct node_data
{
struct node_data {
/* result of most recent data evaluation for this body: */
double teval; /* time for which last computation was made */
int32 iephe; /* which ephemeris was used */
@ -544,29 +538,31 @@ struct node_data
*/
};
struct topo_data
{
struct topo_data {
double geolon, geolat, geoalt;
double teval;
double tjd_ut;
double xobs[6];
};
struct sid_data
{
struct sid_data {
int32 sid_mode;
double ayan_t0;
double t0;
};
struct swe_data
{
struct swe_data {
AS_BOOL ephe_path_is_set;
short jpl_file_is_open;
FILE *fixfp; /* fixed stars file pointer */
char ephepath[AS_MAXCH];
char jplfnam[AS_MAXCH];
short jpldenum;
double eop_tjd_beg;
double eop_tjd_beg_horizons;
double eop_tjd_end;
double eop_tjd_end_add;
int eop_dpsi_loaded;
AS_BOOL geopos_is_set;
AS_BOOL ayana_is_set;
AS_BOOL is_old_starfile;
@ -578,7 +574,7 @@ struct swe_data
#else
struct plan_data nddat[SEI_NNODE_ETC];
#endif
struct save_positions savedat[SE_NPLANETS + 1];
struct save_positions savedat[SE_NPLANETS+1];
struct epsilon oec;
struct epsilon oec2000;
struct nut nut;
@ -592,6 +588,8 @@ struct swe_data
double ast_diam;
int i_saved_planet_name;
char saved_planet_name[80];
double dpsi[36525]; /* works for 100 years after 1962 */
double deps[36525];
};
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 $
SWISSEPH: exported definitions and constants
@ -20,7 +19,6 @@
Authors: Dieter Koch and Alois Treindl, Astrodienst Zurich
************************************************************/
/* Copyright (C) 1997 - 2008 Astrodienst AG, Switzerland. All rights reserved.
License conditions
@ -76,8 +74,7 @@
*/
#ifdef __cplusplus
extern "C"
{
extern "C" {
#endif
#ifndef _SWEPHEXP_INCLUDED /* allow multiple #includes of swephexp.h */
@ -90,8 +87,8 @@ extern "C"
***********************************************************/
/* values for gregflag in swe_julday() and swe_revjul() */
#define SE_JUL_CAL 0
#define SE_GREG_CAL 1
# define SE_JUL_CAL 0
# define SE_GREG_CAL 1
/*
* planet numbers for the ipl parameter in swe_calc()
@ -145,7 +142,6 @@ extern "C"
#define SE_ADMETOS 45
#define SE_VULKANUS 46
#define SE_POSEIDON 47
/* other fictitious bodies */
#define SE_ISIS 48
#define SE_NIBIRU 49
@ -192,7 +188,7 @@ extern "C"
#define SEFLG_J2000 32 /* no precession, i.e. give J2000 equinox */
#define SEFLG_NONUT 64 /* no nutation, i.e. mean equinox of date */
#define SEFLG_SPEED3 128 /* speed from 3 positions (do not use it,
* SEFLG_SPEED is faster and more precise.) */
SEFLG_SPEED is faster and more precise.) */
#define SEFLG_SPEED 256 /* high precision speed */
#define SEFLG_NOGDEFL 512 /* turn off gravitational deflection */
#define SEFLG_NOABERR 1024 /* turn off 'annual' aberration of light */
@ -203,12 +199,14 @@ extern "C"
#define SEFLG_TOPOCTR (32*1024) /* topocentric positions */
#define SEFLG_SIDEREAL (64*1024) /* sidereal positions */
#define SEFLG_ICRS (128*1024) /* ICRS (DE406 reference frame) */
#define SEFLG_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
/* for projection onto ecliptic of t0 */
#define SE_SIDBIT_ECL_T0 256
/* for projection onto solar system plane */
#define SE_SIDBIT_SSY_PLANE 512
@ -238,9 +236,13 @@ extern "C"
#define SE_SIDM_SURYASIDDHANTA_MSUN 22
#define SE_SIDM_ARYABHATA 23
#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_NSIDM_PREDEF 27
#define SE_NSIDM_PREDEF 29
/* used for swe_nod_aps(): */
#define SE_NODBIT_MEAN 1 /* mean nodes/apsides */
@ -270,10 +272,18 @@ extern "C"
#define SE_ECL_ALLTYPES_LUNAR (SE_ECL_TOTAL|SE_ECL_PARTIAL|SE_ECL_PENUMBRAL)
#define SE_ECL_VISIBLE 128
#define SE_ECL_MAX_VISIBLE 256
#define SE_ECL_1ST_VISIBLE 512
#define SE_ECL_2ND_VISIBLE 1024
#define SE_ECL_3RD_VISIBLE 2048
#define SE_ECL_4TH_VISIBLE 4096
#define SE_ECL_1ST_VISIBLE 512 /* begin of partial eclipse */
#define SE_ECL_PARTBEG_VISIBLE 512 /* begin of partial eclipse */
#define SE_ECL_2ND_VISIBLE 1024 /* begin of total eclipse */
#define SE_ECL_TOTBEG_VISIBLE 1024 /* begin of total eclipse */
#define SE_ECL_3RD_VISIBLE 2048 /* end of total eclipse */
#define SE_ECL_TOTEND_VISIBLE 2048 /* end of total eclipse */
#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 */
@ -313,13 +323,15 @@ extern "C"
* only used for experimenting with various JPL ephemeris files
* 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_DE403 "de403.eph"
#define SE_FNAME_DE404 "de404.eph"
#define SE_FNAME_DE405 "de405.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 "sefstars.txt"
#define SE_ASTNAMFILE "seasnam.txt"
@ -336,32 +348,32 @@ extern "C"
#ifndef SE_EPHE_PATH
#if MSDOS
#ifdef PAIR_SWEPH
#define SE_EPHE_PATH "\\pair\\ephe\\"
# define SE_EPHE_PATH "\\pair\\ephe\\"
#else
#define SE_EPHE_PATH "\\sweph\\ephe\\"
# define SE_EPHE_PATH "\\sweph\\ephe\\"
#endif
#else
#ifdef MACOS
#define SE_EPHE_PATH ":ephe:"
#else
#define SE_EPHE_PATH ".:/users/ephe2/:/users/ephe/"
# ifdef MACOS
# define SE_EPHE_PATH ":ephe:"
# else
# define SE_EPHE_PATH ".:/users/ephe2/:/users/ephe/"
/* At Astrodienst, we maintain two ephemeris areas for
* the thousands of asteroid files:
* the short files in /users/ephe/ast*,
* the long file in /users/ephe2/ast*. */
#endif
the thousands of asteroid files:
the short files in /users/ephe/ast*,
the long file in /users/ephe2/ast*. */
# endif
#endif
#endif /* SE_EPHE_PATH */
/* defines for function swe_split_deg() (in swephlib.c) */
#define SE_SPLIT_DEG_ROUND_SEC 1
#define SE_SPLIT_DEG_ROUND_MIN 2
#define SE_SPLIT_DEG_ROUND_DEG 4
#define SE_SPLIT_DEG_ZODIACAL 8
#define SE_SPLIT_DEG_KEEP_SIGN 16 /* don't round to next sign,
# define SE_SPLIT_DEG_ROUND_SEC 1
# define SE_SPLIT_DEG_ROUND_MIN 2
# define SE_SPLIT_DEG_ROUND_DEG 4
# define SE_SPLIT_DEG_ZODIACAL 8
# define SE_SPLIT_DEG_KEEP_SIGN 16 /* don't round to next sign,
* e.g. 29.9999999 will be rounded
* to 29d59'59" (or 29d59' or 29d) */
#define SE_SPLIT_DEG_KEEP_DEG 32 /* don't round to next degree
# define SE_SPLIT_DEG_KEEP_DEG 32 /* don't round to next degree
* e.g. 13.9999999 will be rounded
* to 13d59'59" (or 13d59' or 13d) */
@ -384,6 +396,7 @@ extern "C"
#define SE_HELFLAG_VISLIM_DARK (1 << 12) /* 4096 */
#define SE_HELFLAG_VISLIM_NOMOON (1 << 13) /* 8192 */
#define SE_HELFLAG_VISLIM_PHOTOPIC (1 << 14) /* 16384 */
#define SE_HELFLAG_AV (1 << 15) /* 32768 */
#define SE_HELFLAG_AVKIND_VR (1 << 15) /* 32768 */
#define SE_HELFLAG_AVKIND_PTO (1 << 16)
#define SE_HELFLAG_AVKIND_MIN7 (1 << 17)
@ -421,7 +434,7 @@ extern "C"
* Astrodienst's partner software PAIR.
*/
#ifdef PAIR_SWEPH
#define NO_JPL
# define NO_JPL
#endif
/**************************************************************
@ -432,59 +445,59 @@ extern "C"
* and skip to the export function decarations below.
************************************************************/
#if defined(MAKE_DLL) || defined(USE_DLL) || defined(_WINDOWS)
#include <windows.h>
# include <windows.h>
#endif
#ifdef USE_DLL
#include "swedll.h"
# include "swedll.h"
#endif
#if defined(DOS32) || !MSDOS || defined(WIN32)
/* use compiler switch to define DOS32 */
#ifndef FAR
#define FAR
#endif
#define MALLOC malloc
#define CALLOC calloc
#define FREE free
# ifndef FAR
# define FAR
# endif
# define MALLOC malloc
# define CALLOC calloc
# define FREE free
#else
#ifndef FAR
#define FAR far
#endif
#ifdef __BORLANDC__
#include <alloc.h>
#define MALLOC farmalloc
#define CALLOC farcalloc
#define FREE farfree
#else
#define MALLOC _fmalloc
#define CALLOC _fcalloc
#define FREE _ffree
#endif
# ifndef FAR
# define FAR far
# endif
# ifdef __BORLANDC__
# include <alloc.h>
# define MALLOC farmalloc
# define CALLOC farcalloc
# define FREE farfree
# else
# define MALLOC _fmalloc
# define CALLOC _fcalloc
# define FREE _ffree
# endif
#endif
/* DLL defines */
#ifdef MAKE_DLL
#if defined (PASCAL)
#define PASCAL_CONV PASCAL
#else
#define PASCAL_CONV
#endif
#ifdef MAKE_DLL16 /* 16bit DLL */
#if defined (PASCAL)
#define PASCAL_CONV PASCAL
#else
#define PASCAL_CONV
#endif
#ifdef MAKE_DLL16 /* 16bit DLL */
/* We compiled the 16bit DLL for Windows 3.x using Borland C/C++ Ver:3.x
* and the -WD or -WDE compiler switch. */
#define EXP16 __export
#define EXP32
#else /* 32bit DLL */
and the -WD or -WDE compiler switch. */
#define EXP16 __export
#define EXP32
#else /* 32bit DLL */
/* To export symbols in the new DLL model of Win32, Microsoft
* recommends the following approach */
#define EXP16
#define EXP32 __declspec( dllexport )
#endif
recommends the following approach */
#define EXP16
#define EXP32 __declspec( dllexport )
#endif
#else
#define PASCAL_CONV
#define EXP16
#define EXP32
#define PASCAL_CONV
#define EXP16
#define EXP32
#endif
#ifndef _SWEDLL_H
@ -496,238 +509,226 @@ extern "C"
#define ext_def(x) extern EXP32 x FAR PASCAL_CONV EXP16
/* ext_def(x) evaluates to x on Unix */
ext_def(int32) swe_heliacal_ut(double tjdstart_ut, double *geopos,
double *datm, double *dobs,
char *ObjectName, int32 TypeEvent,
int32 iflag, double *dret, char *serr);
ext_def(int32) swe_heliacal_pheno_ut(double tjd_ut, double *geopos,
double *datm, double *dobs,
char *ObjectName, int32 TypeEvent,
int32 helflag, double *darr,
char *serr);
ext_def(int32) swe_vis_limit_mag(double tjdut, double *geopos,
double *datm, double *dobs,
char *ObjectName, int32 helflag,
double *dret, char *serr);
ext_def(int32) swe_heliacal_ut(double tjdstart_ut, double *geopos, double *datm, double *dobs, char *ObjectName, int32 TypeEvent, int32 iflag, double *dret, char *serr);
ext_def(int32) swe_heliacal_pheno_ut(double tjd_ut, double *geopos, double *datm, double *dobs, char *ObjectName, int32 TypeEvent, int32 helflag, double *darr, char *serr);
ext_def(int32) swe_vis_limit_mag(double tjdut, double *geopos, double *datm, double *dobs, char *ObjectName, int32 helflag, double *dret, char *serr);
/* the following are secret, for Victor Reijs' */
ext_def(int32) swe_heliacal_angle(double tjdut, double *dgeo,
double *datm, double *dobs,
int32 helflag, double mag,
double azi_obj, double azi_sun,
double azi_moon, double alt_moon,
double *dret, char *serr);
ext_def(int32) swe_topo_arcus_visionis(double tjdut, double *dgeo,
double *datm, double *dobs,
int32 helflag, double mag,
double azi_obj, double alt_obj,
double azi_sun, double azi_moon,
double alt_moon, double *dret,
char *serr);
ext_def(int32) swe_heliacal_angle(double tjdut, double *dgeo, double *datm, double *dobs, int32 helflag, double mag, double azi_obj, double azi_sun, double azi_moon, double alt_moon, double *dret, char *serr);
ext_def(int32) swe_topo_arcus_visionis(double tjdut, double *dgeo, double *datm, double *dobs, int32 helflag, double mag, double azi_obj, double alt_obj, double azi_sun, double azi_moon, double alt_moon, double *dret, char *serr);
/****************************
* exports from sweph.c
****************************/
ext_def(char *) swe_version(char *);
ext_def(char *) swe_version(char *);
/* planets, moon, nodes etc. */
ext_def(int32) swe_calc(double tjd, int ipl, int32 iflag, double *xx,
ext_def( int32 ) swe_calc(
double tjd, int ipl, int32 iflag,
double *xx,
char *serr);
ext_def(int32) swe_calc_ut(double tjd_ut, int32 ipl, int32 iflag,
ext_def(int32) swe_calc_ut(double tjd_ut, int32 ipl, int32 iflag,
double *xx, char *serr);
/* fixed stars */
ext_def(int32) swe_fixstar(char *star, double tjd, int32 iflag,
ext_def( int32 ) swe_fixstar(
char *star, double tjd, int32 iflag,
double *xx,
char *serr);
ext_def(int32) swe_fixstar_ut(char *star, double tjd_ut, int32 iflag,
double *xx, char *serr);
ext_def(int32) swe_fixstar_ut(char *star, double tjd_ut, int32 iflag,
double *xx, char *serr);
ext_def(int32) swe_fixstar_mag(char *star, double *mag, char *serr);
ext_def(int32) swe_fixstar_mag(char *star, double *mag, char *serr);
/* close Swiss Ephemeris */
ext_def(void) swe_close(void);
ext_def( void ) swe_close(void);
/* set directory path of ephemeris files */
ext_def(void) swe_set_ephe_path(char *path);
ext_def( void ) swe_set_ephe_path(char *path);
/* set file name of JPL file */
ext_def(void) swe_set_jpl_file(char *fname);
ext_def( void ) swe_set_jpl_file(char *fname);
/* get planet name */
ext_def(char *) swe_get_planet_name(int ipl, char *spname);
ext_def( char *) swe_get_planet_name(int ipl, char *spname);
/* set geographic position of observer */
ext_def(void) swe_set_topo(double geolon, double geolat, double geoalt);
ext_def (void) swe_set_topo(double geolon, double geolat, double geoalt);
/* set sidereal mode */
ext_def(void) swe_set_sid_mode(int32 sid_mode, double t0,
double ayan_t0);
ext_def(void) swe_set_sid_mode(int32 sid_mode, double t0, double ayan_t0);
/* get ayanamsa */
ext_def(double) swe_get_ayanamsa(double tjd_et);
ext_def(double) swe_get_ayanamsa(double tjd_et);
ext_def(double) swe_get_ayanamsa_ut(double tjd_ut);
ext_def(double) swe_get_ayanamsa_ut(double tjd_ut);
ext_def(char *) swe_get_ayanamsa_name(int32 isidmode);
ext_def( char *) swe_get_ayanamsa_name(int32 isidmode);
/****************************
* exports from swedate.c
****************************/
ext_def(int) swe_date_conversion(int y, int m, int d, /* year, month, day */
ext_def( int ) swe_date_conversion(
int y , int m , int d , /* year, month, day */
double utime, /* universal time in hours (decimal) */
char c, /* calendar g[regorian]|j[ulian] */
double *tjd);
ext_def(double) swe_julday(int year, int month, int day, double hour,
ext_def( double ) swe_julday(
int year, int month, int day, double hour,
int gregflag);
ext_def(void) swe_revjul(double jd, int gregflag, int *jyear, int *jmon,
int *jday, double *jut);
ext_def( void ) swe_revjul (
double jd,
int gregflag,
int *jyear, int *jmon, int *jday, double *jut);
ext_def(int32) swe_utc_to_jd(int32 iyear, int32 imonth, int32 iday,
ext_def(int32) swe_utc_to_jd(
int32 iyear, int32 imonth, int32 iday,
int32 ihour, int32 imin, double dsec,
int32 gregflag, double *dret, char *serr);
ext_def(void) swe_jdet_to_utc(double tjd_et, int32 gregflag,
int32 * iyear, int32 * imonth,
int32 * iday, int32 * ihour, int32 * imin,
double *dsec);
ext_def(void) swe_jdet_to_utc(
double tjd_et, int32 gregflag,
int32 *iyear, int32 *imonth, int32 *iday,
int32 *ihour, int32 *imin, double *dsec);
ext_def(void) swe_jdut1_to_utc(double tjd_ut, int32 gregflag,
int32 * iyear, int32 * imonth,
int32 * iday, int32 * ihour,
int32 * imin, double *dsec);
ext_def(void) swe_jdut1_to_utc(
double tjd_ut, int32 gregflag,
int32 *iyear, int32 *imonth, int32 *iday,
int32 *ihour, int32 *imin, double *dsec);
ext_def(void) swe_utc_time_zone(int32 iyear, int32 imonth, int32 iday,
ext_def(void) swe_utc_time_zone(
int32 iyear, int32 imonth, int32 iday,
int32 ihour, int32 imin, double dsec,
double d_timezone, int32 * iyear_out,
int32 * imonth_out, int32 * iday_out,
int32 * ihour_out, int32 * imin_out,
double *dsec_out);
double d_timezone,
int32 *iyear_out, int32 *imonth_out, int32 *iday_out,
int32 *ihour_out, int32 *imin_out, double *dsec_out);
/****************************
* exports from swehouse.c
****************************/
ext_def(int) swe_houses(double tjd_ut, double geolat, double geolon,
int hsys, double *cusps, double *ascmc);
ext_def( int ) swe_houses(
double tjd_ut, double geolat, double geolon, int hsys,
double *cusps, double *ascmc);
ext_def(int) swe_houses_ex(double tjd_ut, int32 iflag, double geolat,
double geolon, int hsys, double *cusps,
double *ascmc);
ext_def( int ) swe_houses_ex(
double tjd_ut, int32 iflag, double geolat, double geolon, int hsys,
double *cusps, double *ascmc);
ext_def( int ) swe_houses_armc(
double armc, double geolat, double eps, int hsys,
double *cusps, double *ascmc);
ext_def(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
****************************/
ext_def(int32) swe_gauquelin_sector(double t_ut, int32 ipl,
char *starname, int32 iflag,
int32 imeth, double *geopos,
double atpress, double attemp,
double *dgsect, char *serr);
ext_def(int32) swe_gauquelin_sector(double t_ut, int32 ipl, char *starname, int32 iflag, int32 imeth, double *geopos, double atpress, double attemp, double *dgsect, char *serr);
/* computes geographic location and attributes of solar
* eclipse at a given tjd */
ext_def(int32) swe_sol_eclipse_where(double tjd, int32 ifl,
double *geopos, double *attr,
char *serr);
ext_def (int32) swe_sol_eclipse_where(double tjd, int32 ifl, double *geopos, double *attr, char *serr);
ext_def(int32) swe_lun_occult_where(double tjd, int32 ipl,
char *starname, int32 ifl,
double *geopos, double *attr,
char *serr);
ext_def (int32) swe_lun_occult_where(double tjd, int32 ipl, char *starname, int32 ifl, double *geopos, double *attr, char *serr);
/* computes attributes of a solar eclipse for given tjd, geolon, geolat */
ext_def(int32) swe_sol_eclipse_how(double tjd, int32 ifl,
double *geopos, double *attr,
char *serr);
ext_def (int32) swe_sol_eclipse_how(double tjd, int32 ifl, double *geopos, double *attr, char *serr);
/* finds time of next local eclipse */
ext_def(int32) swe_sol_eclipse_when_loc(double tjd_start, int32 ifl,
double *geopos, double *tret,
double *attr, int32 backward,
char *serr);
ext_def (int32) swe_sol_eclipse_when_loc(double tjd_start, int32 ifl, double *geopos, double *tret, double *attr, int32 backward, char *serr);
ext_def(int32) swe_lun_occult_when_loc(double tjd_start, int32 ipl,
char *starname, int32 ifl,
double *geopos, double *tret,
double *attr, int32 backward,
char *serr);
ext_def (int32) swe_lun_occult_when_loc(double tjd_start, int32 ipl, char *starname, int32 ifl,
double *geopos, double *tret, double *attr, int32 backward, char *serr);
/* finds time of next eclipse globally */
ext_def(int32) swe_sol_eclipse_when_glob(double tjd_start, int32 ifl,
int32 ifltype, double *tret,
int32 backward, char *serr);
ext_def (int32) swe_sol_eclipse_when_glob(double tjd_start, int32 ifl, int32 ifltype,
double *tret, int32 backward, char *serr);
/* finds time of next occultation globally */
ext_def(int32) swe_lun_occult_when_glob(double tjd_start, int32 ipl,
char *starname, int32 ifl,
int32 ifltype, double *tret,
int32 backward, char *serr);
ext_def (int32) swe_lun_occult_when_glob(double tjd_start, int32 ipl, char *starname, int32 ifl, int32 ifltype,
double *tret, int32 backward, char *serr);
/* computes attributes of a lunar eclipse for given tjd */
ext_def(int32) swe_lun_eclipse_how(double tjd_ut, int32 ifl,
double *geopos, double *attr,
ext_def (int32) swe_lun_eclipse_how(
double tjd_ut,
int32 ifl,
double *geopos,
double *attr,
char *serr);
ext_def(int32) swe_lun_eclipse_when(double tjd_start, int32 ifl,
int32 ifltype, double *tret,
int32 backward, char *serr);
ext_def (int32) swe_lun_eclipse_when(double tjd_start, int32 ifl, int32 ifltype,
double *tret, int32 backward, char *serr);
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 */
ext_def(int32) swe_pheno(double tjd, int32 ipl, int32 iflag,
double *attr, char *serr);
ext_def (int32) swe_pheno(double tjd, int32 ipl, int32 iflag, double *attr, char *serr);
ext_def(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, double *attr, char *serr);
ext_def(double) swe_refrac(double inalt, double atpress, double attemp,
int32 calc_flag);
ext_def (double) swe_refrac(double inalt, double atpress, double attemp, int32 calc_flag);
ext_def(double) swe_refrac_extended(double inalt, double geoalt,
double atpress, double attemp,
double lapse_rate, int32 calc_flag,
double *dret);
ext_def (double) swe_refrac_extended(double inalt, double geoalt, 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_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,
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_rev(double tjd_ut, int32 calc_flag,
double *geopos, double *xin, double *xout);
ext_def (void) swe_azalt_rev(
double tjd_ut,
int32 calc_flag,
double *geopos,
double *xin,
double *xout);
ext_def(int32) swe_rise_trans_true_hor(double tjd_ut, int32 ipl,
char *starname, int32 epheflag,
int32 rsmi, double *geopos,
ext_def (int32) swe_rise_trans_true_hor(
double tjd_ut, int32 ipl, char *starname,
int32 epheflag, int32 rsmi,
double *geopos,
double atpress, double attemp,
double horhgt, double *tret,
double horhgt,
double *tret,
char *serr);
ext_def(int32) swe_rise_trans(double tjd_ut, int32 ipl, char *starname,
ext_def (int32) swe_rise_trans(
double tjd_ut, int32 ipl, char *starname,
int32 epheflag, int32 rsmi,
double *geopos, double atpress,
double attemp, double *tret, char *serr);
double *geopos,
double atpress, double attemp,
double *tret,
char *serr);
ext_def(int32) swe_nod_aps(double tjd_et, int32 ipl, int32 iflag,
int32 method, double *xnasc, double *xndsc,
double *xperi, double *xaphe, char *serr);
ext_def (int32) swe_nod_aps(double tjd_et, int32 ipl, int32 iflag,
int32 method,
double *xnasc, double *xndsc,
double *xperi, double *xaphe,
char *serr);
ext_def(int32) swe_nod_aps_ut(double tjd_ut, int32 ipl, int32 iflag,
int32 method, double *xnasc,
double *xndsc, double *xperi,
double *xaphe, char *serr);
ext_def (int32) swe_nod_aps_ut(double tjd_ut, int32 ipl, int32 iflag,
int32 method,
double *xnasc, double *xndsc,
double *xperi, double *xaphe,
char *serr);
/****************************
@ -735,31 +736,31 @@ extern "C"
****************************/
/* delta t */
ext_def(double) swe_deltat(double tjd);
ext_def( double ) swe_deltat(double tjd);
/* equation of time */
ext_def(int) swe_time_equ(double tjd, double *te, char *serr);
ext_def(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 */
ext_def(double) swe_sidtime0(double tjd_ut, double eps, double nut);
ext_def(double) swe_sidtime(double tjd_ut);
ext_def( double ) swe_sidtime0(double tjd_ut, double eps, double nut);
ext_def( double ) swe_sidtime(double tjd_ut);
/* coordinate transformation polar -> polar */
ext_def(void) swe_cotrans(double *xpo, double *xpn, double eps);
ext_def(void) swe_cotrans_sp(double *xpo, double *xpn, double eps);
ext_def( void ) swe_cotrans(double *xpo, double *xpn, double eps);
ext_def( void ) swe_cotrans_sp(double *xpo, double *xpn, double eps);
/* tidal acceleration to be used in swe_deltat() */
ext_def(double) swe_get_tid_acc(void);
ext_def(void) swe_set_tid_acc(double t_acc);
ext_def( double ) swe_get_tid_acc(void);
ext_def( void ) swe_set_tid_acc(double t_acc);
ext_def(double) swe_degnorm(double x);
ext_def(double) swe_radnorm(double x);
ext_def(double) swe_rad_midp(double x1, double x0);
ext_def(double) swe_deg_midp(double x1, double x0);
ext_def( double ) swe_degnorm(double x);
ext_def( double ) swe_radnorm(double x);
ext_def( double ) swe_rad_midp(double x1, double x0);
ext_def( double ) swe_deg_midp(double x1, double x0);
ext_def(void) swe_split_deg(double ddeg, int32 roundflag, int32 * ideg,
int32 * imin, int32 * isec, double *dsecfr,
int32 * isgn);
ext_def( void ) swe_split_deg(double ddeg, int32 roundflag, int32 *ideg, int32 *imin, int32 *isec, double *dsecfr, int32 *isgn);
/*******************************************************
* other functions from swephlib.c;
@ -768,35 +769,33 @@ extern "C"
********************************************************/
/* normalize argument into interval [0..DEG360] */
ext_def(centisec) swe_csnorm(centisec p);
ext_def( centisec ) swe_csnorm(centisec p);
/* distance in centisecs p1 - p2 normalized to [0..360[ */
ext_def(centisec) swe_difcsn(centisec p1, centisec p2);
ext_def( centisec ) swe_difcsn (centisec p1, centisec p2);
ext_def(double) swe_difdegn(double p1, double p2);
ext_def( double ) swe_difdegn (double p1, double p2);
/* distance in centisecs p1 - p2 normalized to [-180..180[ */
ext_def(centisec) swe_difcs2n(centisec p1, centisec p2);
ext_def( centisec ) swe_difcs2n(centisec p1, centisec p2);
ext_def(double) swe_difdeg2n(double p1, double p2);
ext_def(double) swe_difrad2n(double p1, double p2);
ext_def( double ) swe_difdeg2n(double p1, double p2);
ext_def( double ) swe_difrad2n(double p1, double p2);
/* round second, but at 29.5959 always down */
ext_def(centisec) swe_csroundsec(centisec x);
ext_def( centisec ) swe_csroundsec(centisec x);
/* double to int32 with rounding, no overflow check */
ext_def(int32) swe_d2l(double x);
ext_def( int32 ) swe_d2l(double x);
/* monday = 0, ... sunday = 6 */
ext_def(int) swe_day_of_week(double jd);
ext_def( int ) swe_day_of_week(double jd);
ext_def(char *) swe_cs2timestr(CSEC t, int sep, AS_BOOL suppressZero,
char *a);
ext_def( char *) swe_cs2timestr(CSEC t, int sep, AS_BOOL suppressZero, char *a);
ext_def(char *) swe_cs2lonlatstr(CSEC t, char pchar, char mchar,
char *s);
ext_def( char *) swe_cs2lonlatstr(CSEC t, char pchar, char mchar, char *s);
ext_def(char *) swe_cs2degstr(CSEC t, char *a);
ext_def( char *) swe_cs2degstr(CSEC t, char *a);
#endif /* #ifndef _SWEDLL_H */

File diff suppressed because it is too large Load Diff

View File

@ -5,7 +5,6 @@
Authors: Dieter Koch and Alois Treindl, Astrodienst Zurich
************************************************************/
/* Copyright (C) 1997 - 2008 Astrodienst AG, Switzerland. All rights reserved.
License conditions
@ -60,40 +59,109 @@
for promoting such software, products or services.
*/
/* Set TRUE, to include Herring's (1987) corrections to IAU 1980
* nutation series. AA (1996) neglects them. */
#define NUT_CORR_1987 FALSE
#define PREC_IAU_1976 1
#define PREC_IAU_2000 2
#define PREC_IAU_2006 3
#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.
* One of the following four defines must be true.
*/
#define PREC_VONDRAK_2011 TRUE
#define PREC_WILLIAMS_1994 FALSE
#define PREC_SIMON_1994 FALSE
#define PREC_LASKAR_1986 FALSE
#define PREC_BRETAGNON_2003 FALSE
#define USE_PREC_VONDRAK_2011 TRUE
#define USE_PREC_WILLIAMS_1994 FALSE
#define USE_PREC_SIMON_1994 FALSE
#define USE_PREC_LASKAR_1986 FALSE
#define USE_PREC_BRETAGNON_2003 FALSE
/* IAU precession 1976 or 2003 for recent centuries.
* only one of the following two defines may be TRUE */
#define PREC_IAU_1976 FALSE
#define PREC_IAU_2003 FALSE /* precession model P03 */
#define USE_PREC_IAU_1976 FALSE
#define USE_PREC_IAU_2000 FALSE
#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 */
#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 */
#define NUT_IAU_1980 FALSE
#define NUT_IAU_2000A FALSE /* very time consuming ! */
#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 */
extern void swi_coortrf(double *xpo, double *xpn, double eps);
/* coordinate transformation */
extern void swi_coortrf2(double *xpo, double *xpn, double sineps,
double coseps);
extern void swi_coortrf2(double *xpo, double *xpn, double sineps, double coseps);
/* cartesian to polar coordinates */
extern void swi_cartpol(double *x, double *l);
@ -106,40 +174,38 @@ extern void swi_polcart_sp(double *l, double *x);
extern void swi_polcart(double *l, double *x);
/* 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 */
extern void swi_icrs2fk5(double *x, int32 iflag, AS_BOOL backward);
/* precession */
extern int swi_precess(double *R, double J, int direction);
extern void swi_precess_speed(double *xx, double t, int direction);
extern int swi_precess(double *R, double J, int32 iflag, int direction );
extern void swi_precess_speed(double *xx, double t, int32 iflag, int direction);
/* from sweph.c, light deflection, aberration, etc. */
extern void swi_deflect_light(double *xx, double dt, int32 iflag);
extern void swi_aberr_light(double *xx, double *xe, int32 iflag);
extern int swi_plan_for_osc_elem(int32 iflag, double tjd, double *xx);
extern int swi_trop_ra2sid_lon(double *xin, double *xout, double *xoutr,
int32 iflag, char *serr);
extern int swi_trop_ra2sid_lon_sosy(double *xin, double *xout, double *xoutr,
int32 iflag, char *serr);
extern int swi_get_observer(double tjd, int32 iflag, AS_BOOL do_save,
double *xobs, char *serr);
extern int swi_trop_ra2sid_lon(double *xin, double *xout, double *xoutr, int32 iflag, char *serr);
extern int swi_trop_ra2sid_lon_sosy(double *xin, double *xout, double *xoutr, int32 iflag, char *serr);
extern int swi_get_observer(double tjd, int32 iflag,
AS_BOOL do_save, double *xobs, char *serr);
extern void swi_force_app_pos_etc();
/* obliquity of ecliptic */
extern void swi_check_ecliptic(double tjd);
extern double swi_epsiln(double J);
extern void swi_check_ecliptic(double tjd, int32 iflag);
extern double swi_epsiln(double J, int32 iflag);
extern void swi_ldp_peps(double J, double *dpre, double *deps);
/* nutation */
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_mean_lunar_elements(double tjd, double *node, double *dnode,
extern void swi_mean_lunar_elements(double tjd,
double *node, double *dnode,
double *peri, double *dperi);
/* */
extern double swi_mod2PI(double x);
@ -149,7 +215,6 @@ extern double swi_edcheb(double x, double *coef, int ncf);
/* cross product of vectors */
extern void swi_cross_prod(double *a, double *b, double *x);
/* dot product of vecotrs */
extern double swi_dot_prod_unit(double *x, double *y);
@ -173,15 +238,17 @@ extern void swi_FK4_FK5(double *xp, double tjd);
extern char *swi_strcpy(char *to, char *from);
extern char *swi_strncpy(char *to, char *from, size_t n);
extern double swi_deltat_ephe(double tjd_ut, int32 epheflag);
#ifdef TRACE
#define TRACE_COUNT_MAX 10000
extern FILE *swi_fp_trace_c;
extern FILE *swi_fp_trace_out;
extern void swi_open_trace(char *serr);
extern int32 swi_trace_count;
static char *fname_trace_c = "swetrace.c";
static char *fname_trace_out = "swetrace.txt";
# define TRACE_COUNT_MAX 10000
extern FILE *swi_fp_trace_c;
extern FILE *swi_fp_trace_out;
extern void swi_open_trace(char *serr);
extern int32 swi_trace_count;
static char *fname_trace_c = "swetrace.c";
static char *fname_trace_out = "swetrace.txt";
#ifdef FORCE_IFLAG
static char *fname_force_flg = "force.flg";
static char *fname_force_flg = "force.flg";
#endif
#endif /* TRACE */

File diff suppressed because it is too large Load Diff