Update to Swiss Ephemeris 2.04

This commit is contained in:
Gergely Polonkai 2016-07-25 12:42:52 +02:00
parent ae1ba0a5e9
commit aed102ea11
22 changed files with 555 additions and 500 deletions

View File

@ -28,3 +28,4 @@
20081231 20081231
20120630 20120630
20150630 20150630
20161231

View File

@ -25,11 +25,10 @@
# e.g. number of Kronos is ipl = 39 + 4 = 43 # e.g. number of Kronos is ipl = 39 + 4 = 43
# #
# Witte/Sieggruen planets, refined by James Neely # Witte/Sieggruen planets, refined by James Neely
#2456200.5, J2000, 143.49291, 1.4579341, 0.2225740, 178.78899, 304.33810, 10.82816, Eros # 1
J1900, J1900, 163.7409, 40.99837, 0.00460, 171.4333, 129.8325, 1.0833, Cupido # 1 J1900, J1900, 163.7409, 40.99837, 0.00460, 171.4333, 129.8325, 1.0833, Cupido # 1
J1900, J1900, 27.6496, 50.66744, 0.00245, 148.1796, 161.3339, 1.0500, Hades # 2 J1900, J1900, 27.6496, 50.66744, 0.00245, 148.1796, 161.3339, 1.0500, Hades # 2
J1900, J1900, 165.1232, 59.21436, 0.00120, 299.0440, 0.0000, 0.0000, Zeus # 3 J1900, J1900, 165.1232, 59.21436, 0.00120, 299.0440, 0.0000, 0.0000, Zeus # 3
J1900, J1900, 169.0193, 64.81960, 0.00305, 208.8801, 0.0000, 0.0000, Kronos # 4 J1900, J1900, 169.0193, 64.81690, 0.00305, 208.8801, 0.0000, 0.0000, Kronos # 4
J1900, J1900, 138.0533, 70.29949, 0.00000, 0.0000, 0.0000, 0.0000, Apollon # 5 J1900, J1900, 138.0533, 70.29949, 0.00000, 0.0000, 0.0000, 0.0000, Apollon # 5
J1900, J1900, 351.3350, 73.62765, 0.00000, 0.0000, 0.0000, 0.0000, Admetos # 6 J1900, J1900, 351.3350, 73.62765, 0.00000, 0.0000, 0.0000, 0.0000, Admetos # 6
J1900, J1900, 55.8983, 77.25568, 0.00000, 0.0000, 0.0000, 0.0000, Vulcanus # 7 J1900, J1900, 55.8983, 77.25568, 0.00000, 0.0000, 0.0000, 0.0000, Vulcanus # 7
@ -67,7 +66,7 @@ J1900,JDATE, 170.73, 79.225630, 0, 0, 0, 0, Proserpina #18
# Neither Swisseph nor Solar fire elements agree with Delphine Jay's ephemeris, # Neither Swisseph nor Solar fire elements agree with Delphine Jay's ephemeris,
# which is obviously wrong. # which is obviously wrong.
2414290.95827875,2414290.95827875, 70.3407215 + 109023.2634989 * T, 0.0068400705250028, 0.1587, 8.14049594 + 2393.47417444 * T, 136.24878256 - 1131.71719709 * T, 2.5, Waldemath, geo # 19 2414290.95827875,2414290.95827875, 70.3407215 + 109023.2634989 * T, 0.0068400705250028, 0.1587, 8.14049594 + 2393.47417444 * T, 136.24878256 - 1131.71719709 * T, 2.5, Waldemath, geo # 19
############################################## #
# The following elements are for test only # The following elements are for test only
# (Selena without T) # (Selena without T)
J2000,JDATE, 242.2205555, 0.05279142865925, 0.0, 0.0, 0.0, 0.0, Selena/White Moon, geo # 17 J2000,JDATE, 242.2205555, 0.05279142865925, 0.0, 0.0, 0.0, 0.0, Selena/White Moon, geo # 17

Binary file not shown.

Binary file not shown.

View File

@ -72,7 +72,7 @@ static int find_zero(double y00, double y11, double y2, double dx,
double *dxret, double *dxret2); double *dxret, double *dxret2);
static double calc_dip(double geoalt, double atpress, double attemp, double lapse_rate); static double calc_dip(double geoalt, double atpress, double attemp, double lapse_rate);
static double calc_astronomical_refr(double geoalt,double atpress, double attemp); static double calc_astronomical_refr(double geoalt,double atpress, double attemp);
static double const_lapse_rate = SE_LAPSE_RATE; /* for refraction */ static TLS double const_lapse_rate = SE_LAPSE_RATE; /* for refraction */
#if 0 #if 0
#define DSUN (1391978489.9 / AUNIT) /* this value is consistent with #define DSUN (1391978489.9 / AUNIT) /* this value is consistent with
@ -549,7 +549,7 @@ struct saros_data saros_data_lunar[NSAROS_LUNAR] = {
* attr[7] angular distance of moon from sun in degrees * attr[7] angular distance of moon from sun in degrees
* declare as attr[20] at least ! * declare as attr[20] at least !
*/ */
int32 FAR PASCAL_CONV swe_sol_eclipse_where( int32 CALL_CONV swe_sol_eclipse_where(
double tjd_ut, double tjd_ut,
int32 ifl, int32 ifl,
double *geopos, double *geopos,
@ -568,7 +568,7 @@ int32 FAR PASCAL_CONV swe_sol_eclipse_where(
return retflag; return retflag;
} }
int32 FAR PASCAL_CONV swe_lun_occult_where( int32 CALL_CONV swe_lun_occult_where(
double tjd_ut, double tjd_ut,
int32 ipl, int32 ipl,
char *starname, char *starname,
@ -896,7 +896,7 @@ static int32 calc_planet_star(double tjd_et, int32 ipl, char *starname, int32 if
* declare as attr[20] at least ! * declare as attr[20] at least !
* *
*/ */
int32 FAR PASCAL_CONV swe_sol_eclipse_how( int32 CALL_CONV swe_sol_eclipse_how(
double tjd_ut, double tjd_ut,
int32 ifl, int32 ifl,
double *geopos, double *geopos,
@ -1148,7 +1148,7 @@ static int32 eclipse_how( double tjd_ut, int32 ipl, char *starname, int32 ifl,
* declare as tret[10] at least! * declare as tret[10] at least!
* *
*/ */
int32 FAR PASCAL_CONV swe_sol_eclipse_when_glob(double tjd_start, int32 ifl, int32 ifltype, int32 CALL_CONV swe_sol_eclipse_when_glob(double tjd_start, int32 ifl, int32 ifltype,
double *tret, int32 backward, char *serr) double *tret, int32 backward, char *serr)
{ {
int i, j, k, m, n, o, i1 = 0, i2 = 0; int i, j, k, m, n, o, i1 = 0, i2 = 0;
@ -1535,7 +1535,7 @@ end_search_global:
* declare as tret[10] at least! * declare as tret[10] at least!
* *
*/ */
int32 FAR PASCAL_CONV swe_lun_occult_when_glob( int32 CALL_CONV swe_lun_occult_when_glob(
double tjd_start, int32 ipl, char *starname, int32 ifl, int32 ifltype, double tjd_start, int32 ipl, char *starname, int32 ifl, int32 ifltype,
double *tret, int32 backward, char *serr) double *tret, int32 backward, char *serr)
{ {
@ -1982,7 +1982,7 @@ end_search_global:
* attr[10] saros series member number * attr[10] saros series member number
* declare as attr[20] at least ! * declare as attr[20] at least !
*/ */
int32 FAR PASCAL_CONV swe_sol_eclipse_when_loc(double tjd_start, int32 ifl, int32 CALL_CONV swe_sol_eclipse_when_loc(double tjd_start, int32 ifl,
double *geopos, double *tret, double *attr, int32 backward, char *serr) double *geopos, double *tret, double *attr, int32 backward, char *serr)
{ {
int32 retflag = 0, retflag2 = 0; int32 retflag = 0, retflag2 = 0;
@ -2034,7 +2034,7 @@ int32 FAR PASCAL_CONV swe_sol_eclipse_when_loc(double tjd_start, int32 ifl,
* *
* for all other parameters, see function swe_sol_eclipse_when_loc(). * for all other parameters, see function swe_sol_eclipse_when_loc().
*/ */
int32 FAR PASCAL_CONV swe_lun_occult_when_loc(double tjd_start, int32 ipl, char *starname, int32 ifl, int32 CALL_CONV swe_lun_occult_when_loc(double tjd_start, int32 ipl, char *starname, int32 ifl,
double *geopos, double *tret, double *attr, int32 backward, char *serr) double *geopos, double *tret, double *attr, int32 backward, char *serr)
{ {
int32 retflag = 0, retflag2 = 0; int32 retflag = 0, retflag2 = 0;
@ -2748,7 +2748,7 @@ next_try:
* if a non-zero height above sea is given, atpress is estimated. * if a non-zero height above sea is given, atpress is estimated.
* geohgt height of observer above sea (optional) * geohgt height of observer above sea (optional)
*/ */
void FAR PASCAL_CONV swe_azalt( void CALL_CONV swe_azalt(
double tjd_ut, double tjd_ut,
int32 calc_flag, int32 calc_flag,
double *geopos, double *geopos,
@ -2799,7 +2799,7 @@ void FAR PASCAL_CONV swe_azalt(
* iflag either SE_HOR2ECL or SE_HOR2EQU * iflag either SE_HOR2ECL or SE_HOR2EQU
* xin[2] azimut and true altitude, in degrees * xin[2] azimut and true altitude, in degrees
*/ */
void FAR PASCAL_CONV swe_azalt_rev( void CALL_CONV swe_azalt_rev(
double tjd_ut, double tjd_ut,
int32 calc_flag, int32 calc_flag,
double *geopos, double *geopos,
@ -2847,7 +2847,7 @@ void FAR PASCAL_CONV swe_azalt_rev(
* int32 calc_flag; * either SE_CALC_APP_TO_TRUE or * int32 calc_flag; * either SE_CALC_APP_TO_TRUE or
* * SE_CALC_TRUE_TO_APP * * SE_CALC_TRUE_TO_APP
*/ */
double FAR PASCAL_CONV swe_refrac(double inalt, double atpress, double attemp, int32 calc_flag) double CALL_CONV swe_refrac(double inalt, double atpress, double attemp, int32 calc_flag)
{ {
double a, refr; double a, refr;
double pt_factor = atpress / 1010.0 * 283.0 / (273.0 + attemp); double pt_factor = atpress / 1010.0 * 283.0 / (273.0 + attemp);
@ -2946,7 +2946,7 @@ double FAR PASCAL_CONV swe_refrac(double inalt, double atpress, double attemp, i
} }
} }
void FAR PASCAL_CONV swe_set_lapse_rate(double lapse_rate) void CALL_CONV swe_set_lapse_rate(double lapse_rate)
{ {
const_lapse_rate = lapse_rate; const_lapse_rate = lapse_rate;
} }
@ -2993,7 +2993,7 @@ void FAR PASCAL_CONV swe_set_lapse_rate(double lapse_rate)
* *
* The body is above the horizon if the dret[0] != dret[1] * The body is above the horizon if the dret[0] != dret[1]
*/ */
double FAR PASCAL_CONV swe_refrac_extended(double inalt, double geoalt, double atpress, double attemp, double lapse_rate, int32 calc_flag, double *dret) double CALL_CONV swe_refrac_extended(double inalt, double geoalt, double atpress, double attemp, double lapse_rate, int32 calc_flag, double *dret)
{ {
double refr; double refr;
double trualt; double trualt;
@ -3143,7 +3143,7 @@ static double calc_dip(double geoalt, double atpress, double attemp, double laps
* declare as attr[20] at least ! * declare as attr[20] at least !
* *
*/ */
int32 FAR PASCAL_CONV swe_lun_eclipse_how( int32 CALL_CONV swe_lun_eclipse_how(
double tjd_ut, double tjd_ut,
int32 ifl, int32 ifl,
double *geopos, double *geopos,
@ -3330,7 +3330,7 @@ static int32 lun_eclipse_how(
* tret[6] time of penumbral phase begin * tret[6] time of penumbral phase begin
* tret[7] time of penumbral phase end * tret[7] time of penumbral phase end
*/ */
int32 FAR PASCAL_CONV swe_lun_eclipse_when(double tjd_start, int32 ifl, int32 ifltype, int32 CALL_CONV swe_lun_eclipse_when(double tjd_start, int32 ifl, int32 ifltype,
double *tret, int32 backward, char *serr) double *tret, int32 backward, char *serr)
{ {
int i, j, m, n, o, i1 = 0, i2 = 0; int i, j, m, n, o, i1 = 0, i2 = 0;
@ -3585,7 +3585,7 @@ next_try:
* attr[10] saros series member number * attr[10] saros series member number
* declare as attr[20] at least ! * declare as attr[20] at least !
*/ */
int32 FAR PASCAL_CONV swe_lun_eclipse_when_loc(double tjd_start, int32 ifl, int32 CALL_CONV swe_lun_eclipse_when_loc(double tjd_start, int32 ifl,
double *geopos, double *tret, double *attr, int32 backward, char *serr) double *geopos, double *tret, double *attr, int32 backward, char *serr)
{ {
int32 retflag = 0, retflag2 = 0, retc; int32 retflag = 0, retflag2 = 0, retc;
@ -3701,19 +3701,23 @@ next_lun_ecl:
*/ */
#define EULER 2.718281828459 #define EULER 2.718281828459
#define NMAG_ELEM (SE_VESTA + 1) #define NMAG_ELEM (SE_VESTA + 1)
static double mag_elem[NMAG_ELEM][4] = { #define MAG_IAU_1986
static const double mag_elem[NMAG_ELEM][4] = {
/* DTV-Atlas Astronomie, p. 32 */ /* DTV-Atlas Astronomie, p. 32 */
{-26.86, 0, 0, 0}, {-26.86, 0, 0, 0}, /* Sun */
{-12.55, 0, 0, 0}, {-12.55, 0, 0, 0}, /* Moon */
#ifdef MAG_IAU_1986
/* IAU 1986 */ /* IAU 1986 */
{-0.42, 3.80, -2.73, 2.00}, {-0.42, 3.80, -2.73, 2.00}, /* Mercury */
{-4.40, 0.09, 2.39, -0.65}, {-4.40, 0.09, 2.39, -0.65}, /* Venus */
{- 1.52, 1.60, 0, 0}, /* Mars */ {- 1.52, 1.60, 0, 0}, /* Mars */
{- 9.40, 0.5, 0, 0}, /* Jupiter */ {- 9.40, 0.5, 0, 0}, /* Jupiter */
{- 8.88, -2.60, 1.25, 0.044}, /* Saturn */ {- 8.88, -2.60, 1.25, 0.044}, /* Saturn */
{- 7.19, 0.0, 0, 0}, /* Uranus */ {- 7.19, 0.0, 0, 0}, /* Uranus */
{- 6.87, 0.0, 0, 0}, /* Neptune */ {- 6.87, 0.0, 0, 0}, /* Neptune */
{- 1.00, 0.0, 0, 0}, /* Pluto */ {- 1.00, 0.0, 0, 0}, /* Pluto */
#else
#endif
{99, 0, 0, 0}, /* nodes and apogees */ {99, 0, 0, 0}, /* nodes and apogees */
{99, 0, 0, 0}, {99, 0, 0, 0},
{99, 0, 0, 0}, {99, 0, 0, 0},
@ -3727,7 +3731,7 @@ static double mag_elem[NMAG_ELEM][4] = {
{5.33, 0.32, 0, 0}, /* Juno */ {5.33, 0.32, 0, 0}, /* Juno */
{3.20, 0.32, 0, 0}, /* Vesta */ {3.20, 0.32, 0, 0}, /* Vesta */
}; };
int32 FAR PASCAL_CONV swe_pheno(double tjd, int32 ipl, int32 iflag, double *attr, char *serr) int32 CALL_CONV swe_pheno(double tjd, int32 ipl, int32 iflag, double *attr, char *serr)
{ {
int i; int i;
double xx[6], xx2[6], xxs[6], lbr[6], lbr2[6], dt = 0, dd; double xx[6], xx2[6], xxs[6], lbr[6], lbr2[6], dt = 0, dd;
@ -3862,11 +3866,14 @@ int32 FAR PASCAL_CONV swe_pheno(double tjd, int32 ipl, int32 iflag, double *attr
+ mag_elem[ipl][3] * du + mag_elem[ipl][3] * du
+ mag_elem[ipl][0]; + mag_elem[ipl][0];
} else if (ipl < SE_CHIRON) { } else if (ipl < SE_CHIRON) {
#ifdef MAG_IAU_1986
attr[4] = 5 * log10(lbr2[2] * lbr[2]) attr[4] = 5 * log10(lbr2[2] * lbr[2])
+ mag_elem[ipl][1] * attr[0] /100.0 + mag_elem[ipl][1] * attr[0] /100.0
+ mag_elem[ipl][2] * attr[0] * attr[0] / 10000.0 + mag_elem[ipl][2] * attr[0] * attr[0] / 10000.0
+ mag_elem[ipl][3] * attr[0] * attr[0] * attr[0] / 1000000.0 + mag_elem[ipl][3] * attr[0] * attr[0] * attr[0] / 1000000.0
+ mag_elem[ipl][0]; + mag_elem[ipl][0];
#else
#endif
} else if (ipl < NMAG_ELEM || ipl > SE_AST_OFFSET) { /* asteroids */ } else if (ipl < NMAG_ELEM || ipl > SE_AST_OFFSET) { /* asteroids */
ph1 = pow(EULER, -3.33 * pow(tan(attr[0] * DEGTORAD / 2), 0.63)); ph1 = pow(EULER, -3.33 * pow(tan(attr[0] * DEGTORAD / 2), 0.63));
ph2 = pow(EULER, -1.87 * pow(tan(attr[0] * DEGTORAD / 2), 1.22)); ph2 = pow(EULER, -1.87 * pow(tan(attr[0] * DEGTORAD / 2), 1.22));
@ -3942,7 +3949,7 @@ int32 FAR PASCAL_CONV swe_pheno(double tjd, int32 ipl, int32 iflag, double *attr
return OK; return OK;
} }
int32 FAR PASCAL_CONV swe_pheno_ut(double tjd_ut, int32 ipl, int32 iflag, double *attr, char *serr) int32 CALL_CONV swe_pheno_ut(double tjd_ut, int32 ipl, int32 iflag, double *attr, char *serr)
{ {
double deltat; double deltat;
int32 retflag = OK; int32 retflag = OK;
@ -4025,7 +4032,7 @@ double rdi_twilight(int32 rsmi)
* serr[256] error string * serr[256] error string
* function return value -2 means that the body does not rise or set */ * function return value -2 means that the body does not rise or set */
#define SEFLG_EPHMASK (SEFLG_JPLEPH|SEFLG_SWIEPH|SEFLG_MOSEPH) #define SEFLG_EPHMASK (SEFLG_JPLEPH|SEFLG_SWIEPH|SEFLG_MOSEPH)
int32 FAR PASCAL_CONV swe_rise_trans( int32 CALL_CONV swe_rise_trans(
double tjd_ut, int32 ipl, char *starname, double tjd_ut, int32 ipl, char *starname,
int32 epheflag, int32 rsmi, int32 epheflag, int32 rsmi,
double *geopos, double *geopos,
@ -4038,7 +4045,7 @@ int32 FAR PASCAL_CONV swe_rise_trans(
/* same as swe_rise_trans(), but allows to define the height of the horizon /* same as swe_rise_trans(), but allows to define the height of the horizon
* at the point of the rising or setting (horhgt) */ * at the point of the rising or setting (horhgt) */
int32 FAR PASCAL_CONV swe_rise_trans_true_hor( int32 CALL_CONV swe_rise_trans_true_hor(
double tjd_ut, int32 ipl, char *starname, double tjd_ut, int32 ipl, char *starname,
int32 epheflag, int32 rsmi, int32 epheflag, int32 rsmi,
double *geopos, double *geopos,
@ -4613,7 +4620,7 @@ barycentric position.
* be returned instead of the aphelia. * be returned instead of the aphelia.
*/ */
/* mean elements for Mercury - Neptune from VSOP87 (mean equinox of date) */ /* mean elements for Mercury - Neptune from VSOP87 (mean equinox of date) */
static double el_node[8][4] = static const double el_node[8][4] =
{{ 48.330893, 1.1861890, 0.00017587, 0.000000211,}, /* Mercury */ {{ 48.330893, 1.1861890, 0.00017587, 0.000000211,}, /* Mercury */
{ 76.679920, 0.9011190, 0.00040665, -0.000000080,}, /* Venus */ { 76.679920, 0.9011190, 0.00040665, -0.000000080,}, /* Venus */
{ 0 , 0 , 0 , 0 ,}, /* Earth */ { 0 , 0 , 0 , 0 ,}, /* Earth */
@ -4623,7 +4630,7 @@ static double el_node[8][4] =
{ 74.005947, 0.5211258, 0.00133982, 0.000018516,}, /* Uranus */ { 74.005947, 0.5211258, 0.00133982, 0.000018516,}, /* Uranus */
{131.784057, 1.1022057, 0.00026006, -0.000000636,}, /* Neptune */ {131.784057, 1.1022057, 0.00026006, -0.000000636,}, /* Neptune */
}; };
static double el_peri[8][4] = static const double el_peri[8][4] =
{{ 77.456119, 1.5564775, 0.00029589, 0.000000056,}, /* Mercury */ {{ 77.456119, 1.5564775, 0.00029589, 0.000000056,}, /* Mercury */
{131.563707, 1.4022188, -0.00107337, -0.000005315,}, /* Venus */ {131.563707, 1.4022188, -0.00107337, -0.000005315,}, /* Venus */
{102.937348, 1.7195269, 0.00045962, 0.000000499,}, /* Earth */ {102.937348, 1.7195269, 0.00045962, 0.000000499,}, /* Earth */
@ -4633,7 +4640,7 @@ static double el_peri[8][4] =
{173.005159, 1.4863784, 0.00021450, 0.000000433,}, /* Uranus */ {173.005159, 1.4863784, 0.00021450, 0.000000433,}, /* Uranus */
{ 48.123691, 1.4262677, 0.00037918, -0.000000003,}, /* Neptune */ { 48.123691, 1.4262677, 0.00037918, -0.000000003,}, /* Neptune */
}; };
static double el_incl[8][4] = static const double el_incl[8][4] =
{{ 7.004986, 0.0018215, -0.00001809, 0.000000053,}, /* Mercury */ {{ 7.004986, 0.0018215, -0.00001809, 0.000000053,}, /* Mercury */
{ 3.394662, 0.0010037, -0.00000088, -0.000000007,}, /* Venus */ { 3.394662, 0.0010037, -0.00000088, -0.000000007,}, /* Venus */
{ 0, 0, 0, 0 ,}, /* Earth */ { 0, 0, 0, 0 ,}, /* Earth */
@ -4643,7 +4650,7 @@ static double el_incl[8][4] =
{ 0.773196, 0.0007744, 0.00003749, -0.000000092,}, /* Uranus */ { 0.773196, 0.0007744, 0.00003749, -0.000000092,}, /* Uranus */
{ 1.769952, -0.0093082, -0.00000708, 0.000000028,}, /* Neptune */ { 1.769952, -0.0093082, -0.00000708, 0.000000028,}, /* Neptune */
}; };
static double el_ecce[8][4] = static const double el_ecce[8][4] =
{{ 0.20563175, 0.000020406, -0.0000000284, -0.00000000017,}, /* Mercury */ {{ 0.20563175, 0.000020406, -0.0000000284, -0.00000000017,}, /* Mercury */
{ 0.00677188, -0.000047766, 0.0000000975, 0.00000000044,}, /* Venus */ { 0.00677188, -0.000047766, 0.0000000975, 0.00000000044,}, /* Venus */
{ 0.01670862, -0.000042037, -0.0000001236, 0.00000000004,}, /* Earth */ { 0.01670862, -0.000042037, -0.0000001236, 0.00000000004,}, /* Earth */
@ -4653,7 +4660,7 @@ static double el_ecce[8][4] =
{ 0.04629590, -0.000027337, 0.0000000790, 0.00000000025,}, /* Uranus */ { 0.04629590, -0.000027337, 0.0000000790, 0.00000000025,}, /* Uranus */
{ 0.00898809, 0.000006408, -0.0000000008, -0.00000000005,}, /* Neptune */ { 0.00898809, 0.000006408, -0.0000000008, -0.00000000005,}, /* Neptune */
}; };
static double el_sema[8][4] = static const double el_sema[8][4] =
{{ 0.387098310, 0.0, 0.0, 0.0,}, /* Mercury */ {{ 0.387098310, 0.0, 0.0, 0.0,}, /* Mercury */
{ 0.723329820, 0.0, 0.0, 0.0,}, /* Venus */ { 0.723329820, 0.0, 0.0, 0.0,}, /* Venus */
{ 1.000001018, 0.0, 0.0, 0.0,}, /* Earth */ { 1.000001018, 0.0, 0.0, 0.0,}, /* Earth */
@ -4664,7 +4671,7 @@ static double el_sema[8][4] =
{ 30.110386869, -0.0000001663, 0.00000000069, 0.0,}, /* Neptune */ { 30.110386869, -0.0000001663, 0.00000000069, 0.0,}, /* Neptune */
}; };
/* Ratios of mass of Sun to masses of the planets */ /* Ratios of mass of Sun to masses of the planets */
static double plmass[9] = { static const double plmass[9] = {
6023600, /* Mercury */ 6023600, /* Mercury */
408523.5, /* Venus */ 408523.5, /* Venus */
328900.5, /* Earth and Moon */ 328900.5, /* Earth and Moon */
@ -4675,8 +4682,8 @@ static double plmass[9] = {
19314, /* Neptune */ 19314, /* Neptune */
130000000, /* Pluto */ 130000000, /* Pluto */
}; };
static int ipl_to_elem[15] = {2, 0, 0, 1, 3, 4, 5, 6, 7, 0, 0, 0, 0, 0, 2,}; static const int ipl_to_elem[15] = {2, 0, 0, 1, 3, 4, 5, 6, 7, 0, 0, 0, 0, 0, 2,};
int32 FAR PASCAL_CONV swe_nod_aps(double tjd_et, int32 ipl, int32 iflag, int32 CALL_CONV swe_nod_aps(double tjd_et, int32 ipl, int32 iflag,
int32 method, int32 method,
double *xnasc, double *xndsc, double *xnasc, double *xndsc,
double *xperi, double *xaphe, double *xperi, double *xaphe,
@ -4702,7 +4709,7 @@ int32 FAR PASCAL_CONV swe_nod_aps(double tjd_et, int32 ipl, int32 iflag,
struct plan_data pldat; struct plan_data pldat;
double *xsun = psbdp->x; double *xsun = psbdp->x;
double *xear = pedp->x; double *xear = pedp->x;
double *ep; const double *ep;
double Gmsm, dzmin; double Gmsm, dzmin;
double rxy, rxyz, fac, sgn; double rxy, rxyz, fac, sgn;
double sinnode, cosnode, sinincl, cosincl, sinu, cosu, sinE, cosE, cosE2; double sinnode, cosnode, sinincl, cosincl, sinu, cosu, sinE, cosE, cosE2;
@ -5189,11 +5196,11 @@ int32 FAR PASCAL_CONV swe_nod_aps(double tjd_et, int32 ipl, int32 iflag,
if (iflag & SEFLG_SIDEREAL) { if (iflag & SEFLG_SIDEREAL) {
/* project onto ecliptic t0 */ /* project onto ecliptic t0 */
if (swed.sidd.sid_mode & SE_SIDBIT_ECL_T0) { if (swed.sidd.sid_mode & SE_SIDBIT_ECL_T0) {
if (swi_trop_ra2sid_lon(x2000, pldat.xreturn+6, pldat.xreturn+18, iflag, serr) != OK) if (swi_trop_ra2sid_lon(x2000, pldat.xreturn+6, pldat.xreturn+18, iflag) != OK)
return ERR; return ERR;
/* project onto solar system equator */ /* project onto solar system equator */
} else if (swed.sidd.sid_mode & SE_SIDBIT_SSY_PLANE) { } else if (swed.sidd.sid_mode & SE_SIDBIT_SSY_PLANE) {
if (swi_trop_ra2sid_lon_sosy(x2000, pldat.xreturn+6, pldat.xreturn+18, iflag, serr) != OK) if (swi_trop_ra2sid_lon_sosy(x2000, pldat.xreturn+6, iflag) != OK)
return ERR; return ERR;
} else { } else {
/* traditional algorithm */ /* traditional algorithm */
@ -5255,7 +5262,7 @@ int32 FAR PASCAL_CONV swe_nod_aps(double tjd_et, int32 ipl, int32 iflag,
return OK; return OK;
} }
int32 FAR PASCAL_CONV swe_nod_aps_ut(double tjd_ut, int32 ipl, int32 iflag, int32 CALL_CONV swe_nod_aps_ut(double tjd_ut, int32 ipl, int32 iflag,
int32 method, int32 method,
double *xnasc, double *xndsc, double *xnasc, double *xndsc,
double *xperi, double *xaphe, double *xperi, double *xaphe,
@ -5285,7 +5292,7 @@ int32 FAR PASCAL_CONV swe_nod_aps_ut(double tjd_ut, int32 ipl, int32 iflag,
* dgsect is return area (pointer to a double) * dgsect is return area (pointer to a double)
* serr is pointer to error string, may be NULL * serr is pointer to error string, may be NULL
*/ */
int32 FAR PASCAL_CONV swe_gauquelin_sector(double t_ut, int32 ipl, char *starname, int32 iflag, int32 imeth, double *geopos, double atpress, double attemp, double *dgsect, char *serr) int32 CALL_CONV swe_gauquelin_sector(double t_ut, int32 ipl, char *starname, int32 iflag, int32 imeth, double *geopos, double atpress, double attemp, double *dgsect, char *serr)
{ {
AS_BOOL rise_found = TRUE; AS_BOOL rise_found = TRUE;
AS_BOOL set_found = TRUE; AS_BOOL set_found = TRUE;

View File

@ -86,10 +86,10 @@
# include "swephexp.h" # include "swephexp.h"
# include "sweph.h" # include "sweph.h"
static AS_BOOL init_leapseconds_done = FALSE; static TLS AS_BOOL init_leapseconds_done = FALSE;
int FAR PASCAL_CONV swe_date_conversion(int y, int CALL_CONV swe_date_conversion(int y,
int m, int m,
int d, /* day, month, year */ int d, /* day, month, year */
double uttime, /* UT in hours (decimal) */ double uttime, /* UT in hours (decimal) */
@ -161,7 +161,7 @@ int FAR PASCAL_CONV swe_date_conversion(int y,
and notifies errors like 32 January. and notifies errors like 32 January.
****************************************************************/ ****************************************************************/
double FAR PASCAL_CONV swe_julday(int year, int month, int day, double hour, int gregflag) double CALL_CONV swe_julday(int year, int month, int day, double hour, int gregflag)
{ {
double jd; double jd;
double u,u0,u1,u2; double u,u0,u1,u2;
@ -202,7 +202,7 @@ double FAR PASCAL_CONV swe_julday(int year, int month, int day, double hour, int
Original author Mark Pottenger, Los Angeles. Original author Mark Pottenger, Los Angeles.
with bug fix for year < -4711 16-aug-88 Alois Treindl with bug fix for year < -4711 16-aug-88 Alois Treindl
*************************************************************************/ *************************************************************************/
void FAR PASCAL_CONV swe_revjul (double jd, int gregflag, void CALL_CONV swe_revjul (double jd, int gregflag,
int *jyear, int *jmon, int *jday, double *jut) int *jyear, int *jmon, int *jday, double *jut)
{ {
double u0,u1,u2,u3,u4; double u0,u1,u2,u3,u4;
@ -236,7 +236,7 @@ void FAR PASCAL_CONV swe_revjul (double jd, int gregflag,
* For conversion from local time to utc, use +d_timezone. * For conversion from local time to utc, use +d_timezone.
* For conversion from utc to local time, use -d_timezone. * For conversion from utc to local time, use -d_timezone.
*/ */
void FAR PASCAL_CONV swe_utc_time_zone( void CALL_CONV swe_utc_time_zone(
int32 iyear, int32 imonth, int32 iday, int32 iyear, int32 imonth, int32 iday,
int32 ihour, int32 imin, double dsec, int32 ihour, int32 imin, double dsec,
double d_timezone, double d_timezone,
@ -278,7 +278,7 @@ void FAR PASCAL_CONV swe_utc_time_zone(
/* Leap seconds were inserted at the end of the following days:*/ /* Leap seconds were inserted at the end of the following days:*/
#define NLEAP_SECONDS 26 #define NLEAP_SECONDS 26
#define NLEAP_SECONDS_SPACE 100 #define NLEAP_SECONDS_SPACE 100
static int leap_seconds[NLEAP_SECONDS_SPACE] = { static TLS int leap_seconds[NLEAP_SECONDS_SPACE] = {
19720630, 19720630,
19721231, 19721231,
19731231, 19731231,
@ -376,7 +376,7 @@ static int init_leapsec(void)
* the leap seconds table (or the Swiss Ephemeris version) is not updated * the leap seconds table (or the Swiss Ephemeris version) is not updated
* for a long time. * for a long time.
*/ */
int32 FAR PASCAL_CONV swe_utc_to_jd(int32 iyear, int32 imonth, int32 iday, int32 ihour, int32 imin, double dsec, int32 gregflag, double *dret, char *serr) int32 CALL_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; double tjd_ut1, tjd_et, tjd_et_1972, dhour, d;
int iyear2, imonth2, iday2; int iyear2, imonth2, iday2;
@ -487,7 +487,7 @@ int32 FAR PASCAL_CONV swe_utc_to_jd(int32 iyear, int32 imonth, int32 iday, int32
* the leap seconds table (or the Swiss Ephemeris version) has not been * the leap seconds table (or the Swiss Ephemeris version) has not been
* updated for a long time. * updated for a long time.
*/ */
void FAR PASCAL_CONV swe_jdet_to_utc(double tjd_et, int32 gregflag, int32 *iyear, int32 *imonth, int32 *iday, int32 *ihour, int32 *imin, double *dsec) void CALL_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 i;
int second_60 = 0; int second_60 = 0;
@ -584,7 +584,7 @@ void FAR PASCAL_CONV swe_jdet_to_utc(double tjd_et, int32 gregflag, int32 *iyear
* the leap seconds table (or the Swiss Ephemeris version) has not been * the leap seconds table (or the Swiss Ephemeris version) has not been
* updated for a long time. * updated for a long time.
*/ */
void FAR PASCAL_CONV swe_jdut1_to_utc(double tjd_ut, int32 gregflag, int32 *iyear, int32 *imonth, int32 *iday, int32 *ihour, int32 *imin, double *dsec) void CALL_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_ex(tjd_ut, -1, NULL); double tjd_et = tjd_ut + swe_deltat_ex(tjd_ut, -1, NULL);
swe_jdet_to_utc(tjd_et, gregflag, iyear, imonth, iday, ihour, imin, dsec); swe_jdet_to_utc(tjd_et, gregflag, iyear, imonth, iday, ihour, imin, dsec);

View File

@ -62,17 +62,17 @@ extern "C" {
#endif #endif
#ifndef _SWEDLL_H #ifndef _SWEDLL_H
extern EXP32 int FAR PASCAL_CONV EXP16 swe_date_conversion ( extern EXP32 int swe_date_conversion (
int y , int m , int d , /* year, month, day */ int y , int m , int d , /* year, month, day */
double utime, /* universal time in hours (decimal) */ double utime, /* universal time in hours (decimal) */
char c, /* calendar g[regorian]|j[ulian]|a[stro = greg] */ char c, /* calendar g[regorian]|j[ulian]|a[stro = greg] */
double *tgmt); double *tgmt);
extern EXP32 double *FAR PASCAL_CONV EXP16 swe_julday( extern EXP32 double *swe_julday(
int year, int month, int day, double hour, int year, int month, int day, double hour,
int gregflag); int gregflag);
extern EXP32 void FAR PASCAL_CONV EXP16 swe_revjul ( extern EXP32 void swe_revjul (
double jd, double jd,
int gregflag, int gregflag,
int *jyear, int *jmon, int *jday, double *jut); int *jyear, int *jmon, int *jday, double *jut);

View File

@ -81,132 +81,138 @@ extern "C" {
# endif # endif
#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); #if defined (PASCAL) || defined(__stdcall)
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); #define CALL_CONV_IMP __stdcall
DllImport int32 FAR PASCAL swe_vis_limit_mag(double tjdut, double *geopos, double *datm, double *dobs, char *ObjectName, int32 helflag, double *dret, char *serr); #else
#define CALL_CONV_IMP
#endif
DllImport int32 CALL_CONV_IMP swe_heliacal_ut(double JDNDaysUTStart, double *geopos, double *datm, double *dobs, char *ObjectName, int32 TypeEvent, int32 iflag, double *dret, char *serr);
DllImport int32 CALL_CONV_IMP swe_heliacal_pheno_ut(double JDNDaysUT, double *geopos, double *datm, double *dobs, char *ObjectName, int32 TypeEvent, int32 helflag, double *darr, char *serr);
DllImport int32 CALL_CONV_IMP swe_vis_limit_mag(double tjdut, double *geopos, double *datm, double *dobs, char *ObjectName, int32 helflag, double *dret, char *serr);
/* the following are secret, for Victor Reijs' */ /* the following are secret, for Victor Reijs' */
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 CALL_CONV_IMP 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 int32 CALL_CONV_IMP 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 double CALL_CONV_IMP swe_degnorm(double deg);
DllImport char * FAR PASCAL swe_version(char *); DllImport char * CALL_CONV_IMP swe_version(char *);
DllImport int32 FAR PASCAL swe_calc( DllImport int32 CALL_CONV_IMP swe_calc(
double tjd, int ipl, int32 iflag, double tjd, int ipl, int32 iflag,
double *xx, double *xx,
char *serr); char *serr);
DllImport int32 FAR PASCAL swe_calc_ut( DllImport int32 CALL_CONV_IMP swe_calc_ut(
double tjd_ut, int32 ipl, int32 iflag, double tjd_ut, int32 ipl, int32 iflag,
double *xx, double *xx,
char *serr); char *serr);
DllImport int32 FAR PASCAL swe_fixstar( DllImport int32 CALL_CONV_IMP swe_fixstar(
char *star, double tjd, int32 iflag, char *star, double tjd, int32 iflag,
double *xx, double *xx,
char *serr); char *serr);
DllImport int32 FAR PASCAL swe_fixstar_ut( DllImport int32 CALL_CONV_IMP swe_fixstar_ut(
char *star, double tjd_ut, int32 iflag, char *star, double tjd_ut, int32 iflag,
double *xx, double *xx,
char *serr); char *serr);
DllImport int32 FAR PASCAL swe_fixstar_mag( DllImport int32 CALL_CONV_IMP swe_fixstar_mag(
char *star, double *xx, char *serr); char *star, double *xx, char *serr);
DllImport double FAR PASCAL swe_sidtime0(double tjd_ut, double ecl, double nut); DllImport double CALL_CONV_IMP swe_sidtime0(double tjd_ut, double ecl, double nut);
DllImport double FAR PASCAL swe_sidtime(double tjd_ut); DllImport double CALL_CONV_IMP swe_sidtime(double tjd_ut);
DllImport double FAR PASCAL swe_deltat_ex(double tjd, int32 iflag, char *serr); DllImport double CALL_CONV_IMP swe_deltat_ex(double tjd, int32 iflag, char *serr);
DllImport double FAR PASCAL swe_deltat(double tjd); DllImport double CALL_CONV_IMP swe_deltat(double tjd);
DllImport int FAR PASCAL swe_houses( DllImport int CALL_CONV_IMP swe_houses(
double tjd_ut, double geolat, double geolon, int hsys, double tjd_ut, double geolat, double geolon, int hsys,
double *hcusps, double *ascmc); double *hcusps, double *ascmc);
DllImport int FAR PASCAL swe_houses_ex( DllImport int CALL_CONV_IMP swe_houses_ex(
double tjd_ut, int32 iflag, double geolat, double geolon, int hsys, double tjd_ut, int32 iflag, double geolat, double geolon, int hsys,
double *hcusps, double *ascmc); double *hcusps, double *ascmc);
DllImport int FAR PASCAL swe_houses_armc( DllImport int CALL_CONV_IMP swe_houses_armc(
double armc, double geolat, double eps, int hsys, double armc, double geolat, double eps, int hsys,
double *hcusps, double *ascmc); double *hcusps, double *ascmc);
DllImport double FAR PASCAL swe_house_pos( DllImport double CALL_CONV_IMP swe_house_pos(
double armc, double geolon, double eps, int hsys, double *xpin, char *serr); double armc, double geolon, double eps, int hsys, double *xpin, char *serr);
DllImport char * FAR PASCAL swe_house_name(int hsys); DllImport char * CALL_CONV_IMP swe_house_name(int hsys);
DllImport int32 FAR PASCAL swe_gauquelin_sector( DllImport int32 CALL_CONV_IMP swe_gauquelin_sector(
double t_ut, int32 ipl, char *starname, int32 iflag, int32 imeth, double *geopos, double atpress, double attemp, double *dgsect, char *serr); 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( DllImport void CALL_CONV_IMP swe_set_sid_mode(
int32 sid_mode, double t0, double ayan_t0); int32 sid_mode, double t0, double ayan_t0);
DllImport int32 FAR PASCAL swe_get_ayanamsa_ex(double tjd_et, int32 iflag, double *daya, char *serr); DllImport int32 CALL_CONV_IMP swe_get_ayanamsa_ex(double tjd_et, int32 iflag, double *daya, char *serr);
DllImport int32 FAR PASCAL swe_get_ayanamsa_ex_ut(double tjd_ut, int32 iflag, double *daya, char *serr); DllImport int32 CALL_CONV_IMP swe_get_ayanamsa_ex_ut(double tjd_ut, int32 iflag, double *daya, char *serr);
DllImport double FAR PASCAL swe_get_ayanamsa(double tjd_et); DllImport double CALL_CONV_IMP swe_get_ayanamsa(double tjd_et);
DllImport double FAR PASCAL swe_get_ayanamsa_ut(double tjd_ut); DllImport double CALL_CONV_IMP swe_get_ayanamsa_ut(double tjd_ut);
DllImport char *FAR PASCAL swe_get_ayanamsa_name(int32 isidmode); DllImport char * CALL_CONV_IMP swe_get_ayanamsa_name(int32 isidmode);
DllImport int FAR PASCAL swe_date_conversion( DllImport int CALL_CONV_IMP swe_date_conversion(
int y , int m , int d , /* year, month, day */ int y , int m , int d , /* year, month, day */
double utime, /* universal time in hours (decimal) */ double utime, /* universal time in hours (decimal) */
char c, /* calendar g[regorian]|j[ulian]|a[stro = greg] */ char c, /* calendar g[regorian]|j[ulian]|a[stro = greg] */
double *tjd); double *tjd);
DllImport double FAR PASCAL swe_julday( DllImport double CALL_CONV_IMP swe_julday(
int year, int mon, int mday, int year, int mon, int mday,
double hour, double hour,
int gregflag); int gregflag);
DllImport void FAR PASCAL swe_revjul( DllImport void CALL_CONV_IMP swe_revjul(
double jd, int gregflag, double jd, int gregflag,
int *year, int *mon, int *mday, int *year, int *mon, int *mday,
double *hour); double *hour);
DllImport void FAR PASCAL swe_utc_time_zone( DllImport void CALL_CONV_IMP swe_utc_time_zone(
int32 iyear, int32 imonth, int32 iday, int32 iyear, int32 imonth, int32 iday,
int32 ihour, int32 imin, double dsec, int32 ihour, int32 imin, double dsec,
double d_timezone, double d_timezone,
int32 *iyear_out, int32 *imonth_out, int32 *iday_out, int32 *iyear_out, int32 *imonth_out, int32 *iday_out,
int32 *ihour_out, int32 *imin_out, double *dsec_out); int32 *ihour_out, int32 *imin_out, double *dsec_out);
DllImport int32 FAR PASCAL swe_utc_to_jd( DllImport int32 CALL_CONV_IMP swe_utc_to_jd(
int32 iyear, int32 imonth, int32 iday, int32 iyear, int32 imonth, int32 iday,
int32 ihour, int32 imin, double dsec, int32 ihour, int32 imin, double dsec,
int32 gregflag, double *dret, char *serr); int32 gregflag, double *dret, char *serr);
DllImport void FAR PASCAL swe_jdet_to_utc( DllImport void CALL_CONV_IMP swe_jdet_to_utc(
double tjd_et, int32 gregflag, double tjd_et, int32 gregflag,
int32 *iyear, int32 *imonth, int32 *iday, int32 *iyear, int32 *imonth, int32 *iday,
int32 *ihour, int32 *imin, double *dsec); int32 *ihour, int32 *imin, double *dsec);
DllImport void FAR PASCAL swe_jdut1_to_utc( DllImport void CALL_CONV_IMP swe_jdut1_to_utc(
double tjd_ut, int32 gregflag, double tjd_ut, int32 gregflag,
int32 *iyear, int32 *imonth, int32 *iday, int32 *iyear, int32 *imonth, int32 *iday,
int32 *ihour, int32 *imin, double *dsec); int32 *ihour, int32 *imin, double *dsec);
DllImport int FAR PASCAL swe_time_equ( DllImport int CALL_CONV_IMP swe_time_equ(
double tjd, double *e, char *serr); 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 CALL_CONV_IMP 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 int CALL_CONV_IMP swe_lat_to_lmt(double tjd_lat, double geolon, double *tjd_lmt, char *serr);
DllImport double FAR PASCAL swe_get_tid_acc(void); DllImport double CALL_CONV_IMP swe_get_tid_acc(void);
DllImport void FAR PASCAL swe_set_tid_acc(double tidacc); DllImport void CALL_CONV_IMP swe_set_tid_acc(double tidacc);
DllImport void FAR PASCAL swe_set_ephe_path(char *path); DllImport void CALL_CONV_IMP swe_set_ephe_path(char *path);
DllImport void FAR PASCAL swe_set_jpl_file(char *fname); DllImport void CALL_CONV_IMP swe_set_jpl_file(char *fname);
DllImport void FAR PASCAL swe_close(void); DllImport void CALL_CONV_IMP swe_close(void);
DllImport char *FAR PASCAL swe_get_planet_name(int ipl, char *spname); DllImport char * CALL_CONV_IMP swe_get_planet_name(int ipl, char *spname);
DllImport void FAR PASCAL swe_cotrans(double *xpo, double *xpn, double eps); DllImport void CALL_CONV_IMP swe_cotrans(double *xpo, double *xpn, double eps);
DllImport void FAR PASCAL swe_cotrans_sp(double *xpo, double *xpn, double eps); DllImport void CALL_CONV_IMP swe_cotrans_sp(double *xpo, double *xpn, double eps);
DllImport void FAR PASCAL swe_set_topo(double geolon, double geolat, double height); DllImport void CALL_CONV_IMP swe_set_topo(double geolon, double geolat, double height);
DllImport void FAR PASCAL swe_set_astro_models(int32 *imodel); DllImport void CALL_CONV_IMP swe_set_astro_models(int32 *imodel);
/**************************** /****************************
* from swecl.c * from swecl.c
@ -214,43 +220,43 @@ DllImport void FAR PASCAL swe_set_astro_models(int32 *imodel);
/* computes geographic location and attributes of solar /* computes geographic location and attributes of solar
* eclipse at a given tjd */ * 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 CALL_CONV_IMP 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 CALL_CONV_IMP 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 */ /* 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 CALL_CONV_IMP swe_sol_eclipse_how(double tjd, int32 ifl, double *geopos, double *attr, char *serr);
/* finds time of next local eclipse */ /* 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 CALL_CONV_IMP 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 CALL_CONV_IMP 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 */ /* 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 CALL_CONV_IMP swe_sol_eclipse_when_glob(double tjd_start, int32 ifl, int32 ifltype, double *tret, int32 backward, char *serr);
/* finds time of next occultation globally */ /* 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 CALL_CONV_IMP 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 */ /* computes attributes of a lunar eclipse for given tjd */
DllImport int32 FAR PASCAL swe_lun_eclipse_how( DllImport int32 CALL_CONV_IMP swe_lun_eclipse_how(
double tjd_ut, double tjd_ut,
int32 ifl, int32 ifl,
double *geopos, double *geopos,
double *attr, double *attr,
char *serr); 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 CALL_CONV_IMP 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); DllImport int32 CALL_CONV_IMP swe_lun_eclipse_when_loc(double tjd_start, int32 ifl, double *geopos, double *tret, double *attr, int32 backward, char *serr);
/* planetary phenomena */ /* planetary phenomena */
DllImport int32 FAR PASCAL swe_pheno(double tjd, int32 ipl, int32 iflag, double *attr, char *serr); DllImport int32 CALL_CONV_IMP 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 int32 CALL_CONV_IMP 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 CALL_CONV_IMP 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 double CALL_CONV_IMP 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 CALL_CONV_IMP swe_set_lapse_rate(double lapse_rate);
DllImport void FAR PASCAL swe_azalt( DllImport void CALL_CONV_IMP swe_azalt(
double tjd_ut, double tjd_ut,
int32 calc_flag, int32 calc_flag,
double *geopos, double *geopos,
@ -259,14 +265,14 @@ DllImport void FAR PASCAL swe_azalt(
double *xin, double *xin,
double *xaz); double *xaz);
DllImport void FAR PASCAL swe_azalt_rev( DllImport void CALL_CONV_IMP swe_azalt_rev(
double tjd_ut, double tjd_ut,
int32 calc_flag, int32 calc_flag,
double *geopos, double *geopos,
double *xin, double *xin,
double *xout); double *xout);
DllImport int32 FAR PASCAL swe_rise_trans( DllImport int32 CALL_CONV_IMP swe_rise_trans(
double tjd_ut, int32 ipl, char *starname, double tjd_ut, int32 ipl, char *starname,
int32 epheflag, int32 rsmi, int32 epheflag, int32 rsmi,
double *geopos, double *geopos,
@ -274,7 +280,7 @@ DllImport int32 FAR PASCAL swe_rise_trans(
double *tret, double *tret,
char *serr); char *serr);
DllImport int32 FAR PASCAL swe_rise_trans_true_hor( DllImport int32 CALL_CONV_IMP swe_rise_trans_true_hor(
double tjd_ut, int32 ipl, char *starname, double tjd_ut, int32 ipl, char *starname,
int32 epheflag, int32 rsmi, int32 epheflag, int32 rsmi,
double *geopos, double *geopos,
@ -283,22 +289,18 @@ DllImport int32 FAR PASCAL swe_rise_trans_true_hor(
double *tret, double *tret,
char *serr); char *serr);
DllImport int32 FAR PASCAL swe_nod_aps(double tjd_et, int32 ipl, int32 iflag, DllImport int32 CALL_CONV_IMP swe_nod_aps(double tjd_et, int32 ipl, int32 iflag,
int32 method, int32 method,
double *xnasc, double *xndsc, double *xnasc, double *xndsc,
double *xperi, double *xaphe, double *xperi, double *xaphe,
char *serr); char *serr);
DllImport int32 FAR PASCAL swe_nod_aps_ut(double tjd_ut, int32 ipl, int32 iflag, DllImport int32 CALL_CONV_IMP swe_nod_aps_ut(double tjd_ut, int32 ipl, int32 iflag,
int32 method, int32 method,
double *xnasc, double *xndsc, double *xnasc, double *xndsc,
double *xperi, double *xaphe, double *xperi, double *xaphe,
char *serr); 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; * other functions from swephlib.c;
* they are not needed for Swiss Ephemeris, * they are not needed for Swiss Ephemeris,
@ -306,39 +308,39 @@ DllImport int32 FAR PASCAL HeliacalJDut(double JDNDaysUTStart, double Age, int S
********************************************************/ ********************************************************/
/* normalize argument into interval [0..DEG360] */ /* normalize argument into interval [0..DEG360] */
DllImport centisec FAR PASCAL swe_csnorm(centisec p); DllImport centisec CALL_CONV_IMP swe_csnorm(centisec p);
/* distance in centisecs p1 - p2 normalized to [0..360[ */ /* distance in centisecs p1 - p2 normalized to [0..360[ */
DllImport centisec FAR PASCAL swe_difcsn (centisec p1, centisec p2); DllImport centisec CALL_CONV_IMP swe_difcsn (centisec p1, centisec p2);
DllImport double FAR PASCAL swe_difdegn (double p1, double p2); DllImport double CALL_CONV_IMP swe_difdegn (double p1, double p2);
/* distance in centisecs p1 - p2 normalized to [-180..180[ */ /* distance in centisecs p1 - p2 normalized to [-180..180[ */
DllImport centisec FAR PASCAL swe_difcs2n(centisec p1, centisec p2); DllImport centisec CALL_CONV_IMP swe_difcs2n(centisec p1, centisec p2);
DllImport double FAR PASCAL swe_difdeg2n(double p1, double p2); DllImport double CALL_CONV_IMP swe_difdeg2n(double p1, double p2);
DllImport double FAR PASCAL swe_difdeg2n(double p1, double p2); DllImport double CALL_CONV_IMP swe_difdeg2n(double p1, double p2);
DllImport double FAR PASCAL swe_difrad2n(double p1, double p2); DllImport double CALL_CONV_IMP swe_difrad2n(double p1, double p2);
DllImport double FAR PASCAL swe_rad_midp(double x1, double x0); DllImport double CALL_CONV_IMP swe_rad_midp(double x1, double x0);
DllImport double FAR PASCAL swe_deg_midp(double x1, double x0); DllImport double CALL_CONV_IMP swe_deg_midp(double x1, double x0);
/* round second, but at 29.5959 always down */ /* round second, but at 29.5959 always down */
DllImport centisec FAR PASCAL swe_csroundsec(centisec x); DllImport centisec CALL_CONV_IMP swe_csroundsec(centisec x);
/* double to int32 with rounding, no overflow check */ /* double to int32 with rounding, no overflow check */
DllImport int32 FAR PASCAL swe_d2l(double x); DllImport int32 CALL_CONV_IMP 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 void CALL_CONV_IMP swe_split_deg(double ddeg, int32 roundflag, int32 *ideg, int32 *imin, int32 *isec, double *dsecfr, int32 *isgn);
/* monday = 0, ... sunday = 6 */ /* monday = 0, ... sunday = 6 */
DllImport int FAR PASCAL swe_day_of_week(double jd); DllImport int CALL_CONV_IMP swe_day_of_week(double jd);
DllImport char *FAR PASCAL swe_cs2timestr(CSEC t, int sep, AS_BOOL suppressZero, char *a); DllImport char * CALL_CONV_IMP 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 * CALL_CONV_IMP swe_cs2lonlatstr(CSEC t, char pchar, char mchar, char *s);
DllImport char *FAR PASCAL swe_cs2degstr(CSEC t, char *a); DllImport char * CALL_CONV_IMP swe_cs2degstr(CSEC t, char *a);
/* additional functions for antiquated GFA basic DLL interface. /* additional functions for antiquated GFA basic DLL interface.
@ -347,115 +349,115 @@ DllImport char *FAR PASCAL swe_cs2degstr(CSEC t, char *a);
* void -> int * void -> int
*/ */
DllImport int32 FAR PASCAL swe_calc_d( DllImport int32 CALL_CONV_IMP swe_calc_d(
double *tjd, int ipl, int32 iflag, double *tjd, int ipl, int32 iflag,
double *x, double *x,
char *serr); char *serr);
DllImport int32 FAR PASCAL swe_calc_ut_d( DllImport int32 CALL_CONV_IMP swe_calc_ut_d(
double *tjd, int16 ipl, int32 iflag, double *tjd, int16 ipl, int32 iflag,
double *x, double *x,
char *serr); char *serr);
DllImport int32 FAR PASCAL swe_fixstar_d( DllImport int32 CALL_CONV_IMP swe_fixstar_d(
char *star, double *tjd, int32 iflag, char *star, double *tjd, int32 iflag,
double *x, double *x,
char *serr); char *serr);
DllImport int32 FAR PASCAL swe_fixstar_ut_d( DllImport int32 CALL_CONV_IMP swe_fixstar_ut_d(
char *star, double *tjd, int32 iflag, char *star, double *tjd, int32 iflag,
double *x, double *x,
char *serr); char *serr);
DllImport int FAR PASCAL swe_close_d(int ivoid); DllImport int CALL_CONV_IMP swe_close_d(int ivoid);
DllImport int FAR PASCAL swe_set_ephe_path_d(char *path); DllImport int CALL_CONV_IMP swe_set_ephe_path_d(char *path);
DllImport int FAR PASCAL swe_set_jpl_file_d(char *fname); DllImport int CALL_CONV_IMP swe_set_jpl_file_d(char *fname);
DllImport char *FAR PASCAL swe_get_planet_name_d(int ipl, char *spname); DllImport char * CALL_CONV_IMP swe_get_planet_name_d(int ipl, char *spname);
DllImport int FAR PASCAL swe_deltat_d(double *tjd, double *deltat); DllImport int CALL_CONV_IMP swe_deltat_d(double *tjd, double *deltat);
DllImport int FAR PASCAL swe_sidtime0_d(double *tjd_ut, double *eps, DllImport int CALL_CONV_IMP swe_sidtime0_d(double *tjd_ut, double *eps,
double *nut, double *sidt); double *nut, double *sidt);
DllImport int FAR PASCAL swe_sidtime_d(double *tjd_ut, double *sidt); DllImport int CALL_CONV_IMP swe_sidtime_d(double *tjd_ut, double *sidt);
DllImport int FAR PASCAL swe_set_sid_mode_d( DllImport int CALL_CONV_IMP swe_set_sid_mode_d(
int32 sid_mode, double *t0, double *ayan_t0); int32 sid_mode, double *t0, double *ayan_t0);
DllImport int FAR PASCAL swe_get_ayanamsa_d(double *tjd_et, double *ayan); DllImport int CALL_CONV_IMP 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 CALL_CONV_IMP 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 CALL_CONV_IMP 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 CALL_CONV_IMP 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 CALL_CONV_IMP swe_set_topo_d(double *geolon, double *geolat, double *height);
DllImport int FAR PASCAL swe_get_tid_acc_d(double *t_acc); DllImport int CALL_CONV_IMP swe_get_tid_acc_d(double *t_acc);
DllImport int FAR PASCAL swe_set_tid_acc_d(double *t_acc); DllImport int CALL_CONV_IMP swe_set_tid_acc_d(double *t_acc);
DllImport int FAR PASCAL swe_degnorm_d(double *x); DllImport int CALL_CONV_IMP swe_degnorm_d(double *x);
DllImport int FAR PASCAL swe_date_conversion_d( DllImport int CALL_CONV_IMP swe_date_conversion_d(
int y , int m , int d , /* year, month, day */ int y , int m , int d , /* year, month, day */
double *utime, /* universal time in hours (decimal) */ double *utime, /* universal time in hours (decimal) */
char *c, /* calendar g[regorian]|j[ulian]|a[stro = greg] */ char *c, /* calendar g[regorian]|j[ulian]|a[stro = greg] */
double *tjd); double *tjd);
DllImport int FAR PASCAL swe_julday_d( DllImport int CALL_CONV_IMP swe_julday_d(
int year, int month, int day, double *hour, int year, int month, int day, double *hour,
int gregflag, double *tjd); int gregflag, double *tjd);
DllImport int FAR PASCAL swe_revjul_d( DllImport int CALL_CONV_IMP swe_revjul_d(
double *tjd, double *tjd,
int gregflag, int gregflag,
int *jyear, int *jmon, int *jday, double *jut); int *jyear, int *jmon, int *jday, double *jut);
DllImport int FAR PASCAL swe_houses_d( DllImport int CALL_CONV_IMP swe_houses_d(
double *tjd, double *geolat, double *geolon, int hsys, double *tjd, double *geolat, double *geolon, int hsys,
double *hcusps, double *ascmc); double *hcusps, double *ascmc);
DllImport int FAR PASCAL swe_houses_ex_d( DllImport int CALL_CONV_IMP swe_houses_ex_d(
double *tjd_ut, int32 iflag, double *geolat, double *geolon, int hsys, double *tjd_ut, int32 iflag, double *geolat, double *geolon, int hsys,
double *hcusps, double *ascmc); double *hcusps, double *ascmc);
DllImport int FAR PASCAL swe_houses_armc_d( DllImport int CALL_CONV_IMP swe_houses_armc_d(
double *armc, double *geolat, double *eps, int hsys, double *armc, double *geolat, double *eps, int hsys,
double *hcusps, double *ascmc); double *hcusps, double *ascmc);
DllImport int FAR PASCAL swe_house_pos_d( DllImport int CALL_CONV_IMP swe_house_pos_d(
double *armc, double *geolon, double *eps, int hsys, double *xpin, double *hpos, char *serr); double *armc, double *geolon, double *eps, int hsys, double *xpin, double *hpos, char *serr);
/* normalize argument into interval [0..DEG360] */ /* normalize argument into interval [0..DEG360] */
DllImport centisec FAR PASCAL swe_csnorm_d(centisec p); DllImport centisec CALL_CONV_IMP swe_csnorm_d(centisec p);
/* distance in centisecs p1 - p2 normalized to [0..360[ */ /* distance in centisecs p1 - p2 normalized to [0..360[ */
DllImport centisec FAR PASCAL swe_difcsn_d(centisec p1, centisec p2); DllImport centisec CALL_CONV_IMP swe_difcsn_d(centisec p1, centisec p2);
DllImport int FAR PASCAL swe_difdegn_d(double *p1, double *p2, double *diff); DllImport int CALL_CONV_IMP swe_difdegn_d(double *p1, double *p2, double *diff);
/* distance in centisecs p1 - p2 normalized to [-180..180[ */ /* distance in centisecs p1 - p2 normalized to [-180..180[ */
DllImport centisec FAR PASCAL swe_difcs2n_d(centisec p1, centisec p2); DllImport centisec CALL_CONV_IMP swe_difcs2n_d(centisec p1, centisec p2);
DllImport int FAR PASCAL swe_difdeg2n_d(double *p1, double *p2, double *diff); DllImport int CALL_CONV_IMP swe_difdeg2n_d(double *p1, double *p2, double *diff);
/* round second, but at 29.5959 always down */ /* round second, but at 29.5959 always down */
DllImport centisec FAR PASCAL swe_csroundsec_d(centisec x); DllImport centisec CALL_CONV_IMP swe_csroundsec_d(centisec x);
/* double to int32 with rounding, no overflow check */ /* double to int32 with rounding, no overflow check */
DllImport int32 FAR PASCAL swe_d2l_d(double *x); DllImport int32 CALL_CONV_IMP 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 int CALL_CONV_IMP swe_split_deg_d(double *ddeg, int32 roundflag, int32 *ideg, int32 *imin, int32 *isec, double *dsecfr, int32 *isgn);
/* monday = 0, ... sunday = 6 */ /* monday = 0, ... sunday = 6 */
DllImport int FAR PASCAL swe_day_of_week_d(double *jd); DllImport int CALL_CONV_IMP 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 * CALL_CONV_IMP 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 * CALL_CONV_IMP swe_cs2lonlatstr_d(CSEC t, char *pchar, char *mchar, char *s);
DllImport char *FAR PASCAL swe_cs2degstr_d(CSEC t, char *a); DllImport char * CALL_CONV_IMP swe_cs2degstr_d(CSEC t, char *a);
/**************************** /****************************
* from swecl.c * from swecl.c
@ -463,35 +465,35 @@ DllImport char *FAR PASCAL swe_cs2degstr_d(CSEC t, char *a);
/* computes geographic location and attributes of solar /* computes geographic location and attributes of solar
* eclipse at a given tjd */ * 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 CALL_CONV_IMP 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 */ /* 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 CALL_CONV_IMP 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 */ /* 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 CALL_CONV_IMP 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 */ /* finds time of next eclipse globally */
DllImport int32 FAR PASCAL swe_sol_eclipse_when_glob_d(double *tjd_start, int32 ifl, int32 ifltype, DllImport int32 CALL_CONV_IMP swe_sol_eclipse_when_glob_d(double *tjd_start, int32 ifl, int32 ifltype,
double *tret, AS_BOOL backward, char *serr); double *tret, AS_BOOL backward, char *serr);
/* computes attributes of a lunar eclipse for given tjd */ /* computes attributes of a lunar eclipse for given tjd */
DllImport int32 FAR PASCAL swe_lun_eclipse_how_d( DllImport int32 CALL_CONV_IMP swe_lun_eclipse_how_d(
double *tjd_ut, double *tjd_ut,
int32 ifl, int32 ifl,
double *attr, double *attr,
char *serr); char *serr);
DllImport int32 FAR PASCAL swe_lun_eclipse_when_d(double *tjd_start, int32 ifl, int32 ifltype, DllImport int32 CALL_CONV_IMP swe_lun_eclipse_when_d(double *tjd_start, int32 ifl, int32 ifltype,
double *tret, AS_BOOL backward, char *serr); double *tret, AS_BOOL backward, char *serr);
DllImport int32 FAR PASCAL swe_pheno_d(double *tjd, int32 ipl, int32 iflag, DllImport int32 CALL_CONV_IMP swe_pheno_d(double *tjd, int32 ipl, int32 iflag,
double *attr, char *serr); double *attr, char *serr);
DllImport int32 FAR PASCAL swe_pheno_ut_d(double *tjd_ut, int32 ipl, int32 iflag, double *attr, char *serr); DllImport int32 CALL_CONV_IMP 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 CALL_CONV_IMP swe_refrac_d(double *inalt, double *atpress, double *attemp, int32 calc_flag, double *retalt);
DllImport int FAR PASCAL swe_azalt_d( DllImport int CALL_CONV_IMP swe_azalt_d(
double *tjd_ut, double *tjd_ut,
int32 calc_flag, int32 calc_flag,
double *geopos, double *geopos,
@ -500,14 +502,14 @@ DllImport int FAR PASCAL swe_azalt_d(
double *xin, double *xin,
double *xaz); double *xaz);
DllImport int FAR PASCAL swe_azalt_rev_d( DllImport int CALL_CONV_IMP swe_azalt_rev_d(
double *tjd_ut, double *tjd_ut,
int32 calc_flag, int32 calc_flag,
double *geopos, double *geopos,
double *xin, double *xin,
double *xout); double *xout);
DllImport int32 FAR PASCAL swe_rise_trans_d( DllImport int32 CALL_CONV_IMP swe_rise_trans_d(
double *tjd_ut, int32 ipl, char *starname, double *tjd_ut, int32 ipl, char *starname,
int32 epheflag, int32 rsmi, int32 epheflag, int32 rsmi,
double *geopos, double *geopos,
@ -515,13 +517,13 @@ DllImport int32 FAR PASCAL swe_rise_trans_d(
double *tret, double *tret,
char *serr); char *serr);
DllImport int32 FAR PASCAL swe_nod_aps_d(double *tjd_et, int32 ipl, int32 iflag, DllImport int32 CALL_CONV_IMP swe_nod_aps_d(double *tjd_et, int32 ipl, int32 iflag,
int32 method, int32 method,
double *xnasc, double *xndsc, double *xnasc, double *xndsc,
double *xperi, double *xaphe, double *xperi, double *xaphe,
char *serr); char *serr);
DllImport int32 FAR PASCAL swe_nod_aps_ut_d(double *tjd_ut, int32 ipl, int32 iflag, DllImport int32 CALL_CONV_IMP swe_nod_aps_ut_d(double *tjd_ut, int32 ipl, int32 iflag,
int32 method, int32 method,
double *xnasc, double *xndsc, double *xnasc, double *xndsc,
double *xperi, double *xaphe, double *xperi, double *xaphe,

View File

@ -320,9 +320,9 @@ int32 call_swe_calc(double tjd, int32 ipl, int32 iflag, double *x, char *serr)
{ {
int32 retval = OK, ipli, i; int32 retval = OK, ipli, i;
double dtjd; double dtjd;
static double tjdsv[3]; static TLS double tjdsv[3];
static double xsv[3][6]; static TLS double xsv[3][6];
static int32 iflagsv[3]; static TLS int32 iflagsv[3];
ipli = ipl; ipli = ipl;
if (ipli > SE_MOON) if (ipli > SE_MOON)
ipli = 2; ipli = 2;
@ -360,8 +360,8 @@ int32 call_swe_fixstar_mag(char *star, double *mag, char *serr)
{ {
int32 retval; int32 retval;
char star2[AS_MAXCH]; char star2[AS_MAXCH];
static double dmag; static TLS double dmag;
static char star_save[AS_MAXCH]; static TLS char star_save[AS_MAXCH];
if (strcmp(star, star_save) == 0) { if (strcmp(star, star_save) == 0) {
*mag = dmag; *mag = dmag;
return OK; return OK;
@ -530,8 +530,8 @@ static double SunRA(double JDNDaysUT, int32 helflag, char *serr)
{ {
int imon, iday, iyar, calflag = SE_GREG_CAL; int imon, iday, iyar, calflag = SE_GREG_CAL;
double dut; double dut;
static double tjdlast; static TLS double tjdlast;
static double ralast; static TLS double ralast;
if (JDNDaysUT == tjdlast) if (JDNDaysUT == tjdlast)
return ralast; return ralast;
#ifndef SIMULATE_VICTORVB #ifndef SIMULATE_VICTORVB
@ -789,7 +789,7 @@ static double kW(double HeightEye, double TempS, double RH)
static double kOZ(double AltS, double sunra, double Lat) static double kOZ(double AltS, double sunra, double Lat)
{ {
double CHANGEKO, OZ, LT, kOZret; double CHANGEKO, OZ, LT, kOZret;
static double koz_last, alts_last, sunra_last; static TLS double koz_last, alts_last, sunra_last;
if (AltS == alts_last && sunra == sunra_last) if (AltS == alts_last && sunra == sunra_last)
return koz_last; return koz_last;
alts_last = AltS; sunra_last = sunra; alts_last = AltS; sunra_last = sunra;
@ -849,7 +849,7 @@ static double ka(double AltS, double sunra, double Lat, double HeightEye, double
/* depending on day/night vision (altitude of sun < start astronomical twilight), /* depending on day/night vision (altitude of sun < start astronomical twilight),
* lambda eye sensibility changes * lambda eye sensibility changes
* see extinction section of Vistas in Astronomy page 343 */ * see extinction section of Vistas in Astronomy page 343 */
static double alts_last, sunra_last, ka_last; static TLS double alts_last, sunra_last, ka_last;
if (AltS == alts_last && sunra == sunra_last) if (AltS == alts_last && sunra == sunra_last)
return ka_last; return ka_last;
alts_last = AltS; sunra_last = sunra; alts_last = AltS; sunra_last = sunra;
@ -1001,7 +1001,7 @@ static double Deltam(double AltO, double AltS, double sunra, double Lat, double
double TempE = TempEfromTempS(datm[1], HeightEye, LapseSA); double TempE = TempEfromTempS(datm[1], HeightEye, LapseSA);
double AppAltO = AppAltfromTopoAlt(AltO, TempE, PresE, helflag); double AppAltO = AppAltfromTopoAlt(AltO, TempE, PresE, helflag);
double deltam; double deltam;
static double alts_last, alto_last, sunra_last, deltam_last; static TLS double alts_last, alto_last, sunra_last, deltam_last;
if (AltS == alts_last && AltO == alto_last && sunra == sunra_last) if (AltS == alts_last && AltO == alto_last && sunra == sunra_last)
return deltam_last; return deltam_last;
alts_last = AltS; alto_last = AltO; sunra_last = sunra; alts_last = AltS; alto_last = AltO; sunra_last = sunra;
@ -1095,9 +1095,9 @@ static int32 fast_magnitude(double tjd, double *dgeo, char *ObjectName, int32 he
{ {
int32 retval = OK, ipl, ipli; int32 retval = OK, ipl, ipli;
double dtjd; double dtjd;
static double tjdsv[3]; static TLS double tjdsv[3];
static double dmagsv[3]; static TLS double dmagsv[3];
static int32 helflagsv[3]; static TLS int32 helflagsv[3];
ipl = DeterObject(ObjectName); ipl = DeterObject(ObjectName);
ipli = ipl; ipli = ipl;
if (ipli > SE_MOON) if (ipli > SE_MOON)
@ -1376,7 +1376,7 @@ static double VisLimMagn(double *dobs, double AltO, double AziO, double AltM, do
* |1 OK, scotopic vision * |1 OK, scotopic vision
* |2 OK, near limit photopic/scotopic * |2 OK, near limit photopic/scotopic
*/ */
int32 FAR PASCAL_CONV swe_vis_limit_mag(double tjdut, double *dgeo, double *datm, double *dobs, char *ObjectName, int32 helflag, double *dret, char *serr) int32 CALL_CONV swe_vis_limit_mag(double tjdut, double *dgeo, double *datm, double *dobs, char *ObjectName, int32 helflag, double *dret, char *serr)
{ {
int32 retval = OK, i, scotopic_flag = 0; int32 retval = OK, i, scotopic_flag = 0;
double AltO, AziO, AltM, AziM, AltS, AziS; double AltO, AziO, AltM, AziM, AltS, AziS;
@ -1512,7 +1512,7 @@ static int32 TopoArcVisionis(double Magn, double *dobs, double AltO, double AziO
return OK; return OK;
} }
int32 FAR PASCAL_CONV swe_topo_arcus_visionis(double tjdut, double *dgeo, double *datm, double *dobs, int32 helflag, double mag, double azi_obj, double alt_obj, double azi_sun, double azi_moon, double alt_moon, double *dret, char *serr) int32 CALL_CONV 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)
{ {
double sunra; double sunra;
swi_set_tid_acc(tjdut, helflag, 0, serr); swi_set_tid_acc(tjdut, helflag, 0, serr);
@ -1605,7 +1605,7 @@ static int32 HeliacalAngle(double Magn, double *dobs, double AziO, double AltM,
return OK; return OK;
} }
int32 FAR PASCAL_CONV 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) int32 CALL_CONV 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)
{ {
if (dgeo[2] < SEI_ECL_GEOALT_MIN || dgeo[2] > SEI_ECL_GEOALT_MAX) { if (dgeo[2] < SEI_ECL_GEOALT_MIN || dgeo[2] > SEI_ECL_GEOALT_MAX) {
if (serr != NULL) if (serr != NULL)
@ -1768,7 +1768,7 @@ static void strcpy_VBsafe(char *sout, char *sin)
'28=CVAact [deg] 'new '28=CVAact [deg] 'new
'29=MSk [-] '29=MSk [-]
*/ */
int32 FAR PASCAL_CONV swe_heliacal_pheno_ut(double JDNDaysUT, double *dgeo, double *datm, double *dobs, char *ObjectNameIn, int32 TypeEvent, int32 helflag, double *darr, char *serr) int32 CALL_CONV swe_heliacal_pheno_ut(double JDNDaysUT, double *dgeo, double *datm, double *dobs, char *ObjectNameIn, int32 TypeEvent, int32 helflag, double *darr, char *serr)
{ {
double AziS, AltS, AltS2, AziO, AltO, AltO2, GeoAltO, AppAltO, DAZact, TAVact, ParO, MagnO; double AziS, AltS, AltS2, AziO, AltO, AltO2, GeoAltO, AppAltO, DAZact, TAVact, ParO, MagnO;
double ARCVact, ARCLact, kact, WMoon, LMoon = 0, qYal, qCrit; double ARCVact, ARCLact, kact, WMoon, LMoon = 0, qYal, qCrit;
@ -1982,7 +1982,7 @@ output_heliacal_pheno:
} }
#if 0 #if 0
int32 FAR PASCAL_CONV HeliacalJDut(double JDNDaysUTStart, double Age, double 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) int32 HeliacalJDut(double JDNDaysUTStart, double Age, double 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)
{ {
double dgeo[3], datm[4], dobs[6]; double dgeo[3], datm[4], dobs[6];
int32 helflag = SE_HELFLAG_HIGH_PRECISION; int32 helflag = SE_HELFLAG_HIGH_PRECISION;
@ -2471,7 +2471,7 @@ static int32 get_asc_obl_diff_old(double tjd, int32 ipl, char *star, int32 iflag
* - superior and inferior conjunction (Mercury and Venus) * - superior and inferior conjunction (Mercury and Venus)
* - conjunction and opposition (ipl >= Mars) * - conjunction and opposition (ipl >= Mars)
*/ */
static double tcon[] = static const double tcon[] =
{ {
0, 0, 0, 0,
2451550, 2451550, /* Moon */ 2451550, 2451550, /* Moon */
@ -3237,7 +3237,7 @@ static int32 heliacal_ut(double JDNDaysUTStart, double *dgeo, double *datm, doub
' dret[2]: end of visibility (Julian day number; 0 if SE_HELFLAG_AV) ' dret[2]: end of visibility (Julian day number; 0 if SE_HELFLAG_AV)
' see http://www.iol.ie/~geniet/eng/atmoastroextinction.htm ' see http://www.iol.ie/~geniet/eng/atmoastroextinction.htm
*/ */
int32 FAR PASCAL_CONV swe_heliacal_ut(double JDNDaysUTStart, double *dgeo, double *datm, double *dobs, char *ObjectNameIn, int32 TypeEvent, int32 helflag, double *dret, char *serr_ret) int32 CALL_CONV swe_heliacal_ut(double JDNDaysUTStart, double *dgeo, double *datm, double *dobs, char *ObjectNameIn, int32 TypeEvent, int32 helflag, double *dret, char *serr_ret)
{ {
int32 retval, Planet, itry; int32 retval, Planet, itry;
char ObjectName[AS_MAXCH], serr[AS_MAXCH], s[AS_MAXCH]; char ObjectName[AS_MAXCH], serr[AS_MAXCH], s[AS_MAXCH];

View File

@ -112,7 +112,7 @@ static int sidereal_houses_ssypl(double tjde,
* ascmc[6] = coasc2 * "co-ascendant" (M. Munkasey) * * ascmc[6] = coasc2 * "co-ascendant" (M. Munkasey) *
* ascmc[7] = polasc * "polar ascendant" (M. Munkasey) * * ascmc[7] = polasc * "polar ascendant" (M. Munkasey) *
*/ */
int FAR PASCAL_CONV swe_houses(double tjd_ut, int CALL_CONV swe_houses(double tjd_ut,
double geolat, double geolat,
double geolon, double geolon,
int hsys, int hsys,
@ -162,7 +162,7 @@ int FAR PASCAL_CONV swe_houses(double tjd_ut,
* ascmc[6] = coasc2 * "co-ascendant" (M. Munkasey) * * ascmc[6] = coasc2 * "co-ascendant" (M. Munkasey) *
* ascmc[7] = polasc * "polar ascendant" (M. Munkasey) * * ascmc[7] = polasc * "polar ascendant" (M. Munkasey) *
*/ */
int FAR PASCAL_CONV swe_houses_ex(double tjd_ut, int CALL_CONV swe_houses_ex(double tjd_ut,
int32 iflag, int32 iflag,
double geolat, double geolat,
double geolon, double geolon,
@ -497,7 +497,7 @@ static int sidereal_houses_trad(double tjde,
* ascmc[6] = coasc2 * "co-ascendant" (M. Munkasey) * * ascmc[6] = coasc2 * "co-ascendant" (M. Munkasey) *
* ascmc[7] = polasc * "polar ascendant" (M. Munkasey) * * ascmc[7] = polasc * "polar ascendant" (M. Munkasey) *
*/ */
int FAR PASCAL_CONV swe_houses_armc( int CALL_CONV swe_houses_armc(
double armc, double armc,
double geolat, double geolat,
double eps, double eps,
@ -556,7 +556,7 @@ int FAR PASCAL_CONV swe_houses_armc(
fprintf(swi_fp_trace_out, "swe_houses_armc: %f\t%f\t%f\t%c\t\n", armc, geolat, eps, hsys); fprintf(swi_fp_trace_out, "swe_houses_armc: %f\t%f\t%f\t%c\t\n", armc, geolat, eps, hsys);
fprintf(swi_fp_trace_out, "retc = %d\n", retc); fprintf(swi_fp_trace_out, "retc = %d\n", retc);
fputs("cusp:\n", swi_fp_trace_out); fputs("cusp:\n", swi_fp_trace_out);
for (i = 0; i < 12; i++) for (i = 1; i <= 12; i++)
fprintf(swi_fp_trace_out, " %d\t%f\n", i, cusp[i]); fprintf(swi_fp_trace_out, " %d\t%f\n", i, cusp[i]);
fputs("ascmc:\n", swi_fp_trace_out); fputs("ascmc:\n", swi_fp_trace_out);
for (i = 0; i < 10; i++) for (i = 0; i < 10; i++)
@ -617,7 +617,7 @@ static double apc_sector(int n, double ph, double e, double az)
return dret; return dret;
} }
char *FAR PASCAL_CONV swe_house_name(int hsys) char *CALL_CONV swe_house_name(int hsys)
{ {
switch (toupper(hsys)) { switch (toupper(hsys)) {
case 'A': return "equal"; case 'A': return "equal";
@ -1376,7 +1376,7 @@ static double Asc2 (double x, double f, double sine, double cose)
* equal, Porphyry, Alcabitius, Koch, Krusinski (all others should work). * equal, Porphyry, Alcabitius, Koch, Krusinski (all others should work).
* The Swiss Ephemeris currently does not handle these cases. * The Swiss Ephemeris currently does not handle these cases.
*/ */
double FAR PASCAL_CONV swe_house_pos( double CALL_CONV swe_house_pos(
double armc, double geolat, double eps, int hsys, double *xpin, char *serr) double armc, double geolat, double eps, int hsys, double *xpin, char *serr)
{ {
double xp[6], xeq[6], ra, de, mdd, mdn, sad, san; double xp[6], xeq[6], ra, de, mdd, mdn, sad, san;

View File

@ -106,11 +106,11 @@ struct jpl_save {
short do_km; short do_km;
}; };
static struct jpl_save *FAR js; static TLS struct jpl_save *js;
static int state (double et, int32 *list, int do_bary, static int state (double et, int32 *list, int do_bary,
double *pv, double *pvsun, double *nut, char *serr); double *pv, double *pvsun, double *nut, char *serr);
static int interp(double FAR *buf, double t, double intv, int32 ncfin, static int interp(double *buf, double t, double intv, int32 ncfin,
int32 ncmin, int32 nain, int32 ifl, double *pv); int32 ncmin, int32 nain, int32 ifl, double *pv);
static int32 fsizer(char *serr); static int32 fsizer(char *serr);
static void reorder(char *x, int size, int number); static void reorder(char *x, int size, int number);
@ -349,8 +349,8 @@ int swi_pleph(double et, int ntarg, int ncent, double *rrd, char *serr)
{ {
int i, retc; int i, retc;
int32 list[12]; int32 list[12];
double FAR *pv = js->pv; double *pv = js->pv;
double FAR *pvsun = js->pvsun; double *pvsun = js->pvsun;
for (i = 0; i < 6; ++i) for (i = 0; i < 6; ++i)
rrd[i] = 0.0; rrd[i] = 0.0;
if (ntarg == ncent) if (ntarg == ncent)
@ -455,18 +455,18 @@ int swi_pleph(double et, int ntarg, int ncent, double *rrd, char *serr)
* pv d.p. interpolated quantities requested. * pv d.p. interpolated quantities requested.
* assumed dimension is pv(ncm,fl). * assumed dimension is pv(ncm,fl).
*/ */
static int interp(double FAR *buf, double t, double intv, int32 ncfin, static int interp(double *buf, double t, double intv, int32 ncfin,
int32 ncmin, int32 nain, int32 ifl, double *pv) int32 ncmin, int32 nain, int32 ifl, double *pv)
{ {
/* Initialized data */ /* Initialized data */
static int FAR np, nv; static TLS int np, nv;
static int FAR nac; static TLS int nac;
static int FAR njk; static TLS int njk;
static double FAR twot = 0.; static TLS double twot = 0.;
double FAR *pc = js->pc; double *pc = js->pc;
double FAR *vc = js->vc; double *vc = js->vc;
double FAR *ac = js->ac; double *ac = js->ac;
double FAR *jc = js->jc; double *jc = js->jc;
int ncf = (int) ncfin; int ncf = (int) ncfin;
int ncm = (int) ncmin; int ncm = (int) ncmin;
int na = (int) nain; int na = (int) nain;
@ -641,15 +641,15 @@ static int state(double et, int32 *list, int do_bary,
int i, j, k; int i, j, k;
int32 nseg; int32 nseg;
off_t flen, nb; off_t flen, nb;
double FAR *buf = js->buf; double *buf = js->buf;
double aufac, s, t, intv, ts[4]; double aufac, s, t, intv, ts[4];
int32 nrecl, ksize; int32 nrecl, ksize;
int32 nr; int32 nr;
double et_mn, et_fr; double et_mn, et_fr;
int32 FAR *ipt = js->eh_ipt; int32 *ipt = js->eh_ipt;
char ch_ttl[252]; char ch_ttl[252];
static int32 irecsz; static TLS int32 irecsz;
static int32 nrl, lpt[3], ncoeffs; static TLS int32 nrl, lpt[3], ncoeffs;
if (js->jplfptr == NULL) { if (js->jplfptr == NULL) {
ksize = fsizer(serr); /* the number of single precision words in a record */ ksize = fsizer(serr); /* the number of single precision words in a record */
nrecl = 4; nrecl = 4;
@ -839,7 +839,7 @@ static int read_const_jpl(double *ss, char *serr)
ss[i] = js->eh_ss[i]; ss[i] = js->eh_ss[i];
#if DEBUG_DO_SHOW #if DEBUG_DO_SHOW
{ {
static char FAR *bname[] = { static const char *bname[] = {
"Mercury", "Venus", "EMB", "Mars", "Jupiter", "Saturn", "Mercury", "Venus", "EMB", "Mars", "Jupiter", "Saturn",
"Uranus", "Neptune", "Pluto", "Moon", "SunBary", "Nut", "Libr"}; "Uranus", "Neptune", "Pluto", "Moon", "SunBary", "Nut", "Libr"};
int j, k; int j, k;

View File

@ -187,7 +187,7 @@ static void mean_elements(void);
static void mean_elements_pl(void); static void mean_elements_pl(void);
static double mods3600(double x); static double mods3600(double x);
static void ecldat_equ2000(double tjd, double *xpm); static void ecldat_equ2000(double tjd, double *xpm);
static void chewm(short *pt, int nlines, int nangles, static void chewm(const short *pt, int nlines, int nangles,
int typflg, double *ans ); int typflg, double *ans );
static void sscc(int k, double arg, int n ); static void sscc(int k, double arg, int n );
static void moon1(void); static void moon1(void);
@ -203,7 +203,7 @@ static void moon4(void);
* See references to the array z[] later on in the program. * See references to the array z[] later on in the program.
* The 71 coefficients were estimated from 42,529 Lunar positions. * The 71 coefficients were estimated from 42,529 Lunar positions.
*/ */
static double z[] = { static const double z[] = {
-1.225346551567e+001, /* F, t^2 */ -1.225346551567e+001, /* F, t^2 */
-1.096676093208e-003, /* F, t^3 */ -1.096676093208e-003, /* F, t^3 */
-2.165750777942e-006, /* F, t^4 */ -2.165750777942e-006, /* F, t^4 */
@ -282,7 +282,7 @@ static double z[] = {
* interval from -3000 to +3000. * interval from -3000 to +3000.
* The coefficients were estimated from 34,247 Lunar positions. * The coefficients were estimated from 34,247 Lunar positions.
*/ */
static double FAR z[] = { static const double z[] = {
/* The following are scaled in arc seconds, time in Julian centuries. /* The following are scaled in arc seconds, time in Julian centuries.
They replace the corresponding terms in the mean elements. */ They replace the corresponding terms in the mean elements. */
-1.312045233711e+01, /* F, t^2 */ -1.312045233711e+01, /* F, t^2 */
@ -317,7 +317,7 @@ static double FAR z[] = {
/* Perturbation tables /* Perturbation tables
*/ */
#define NLR 118 #define NLR 118
static short FAR LR[8*NLR] = { static const short LR[8*NLR] = {
/* /*
Longitude Radius Longitude Radius
D l' l F 1" .0001" 1km .0001km */ D l' l F 1" .0001" 1km .0001km */
@ -445,7 +445,7 @@ static short FAR LR[8*NLR] = {
#ifdef MOSH_MOON_200 #ifdef MOSH_MOON_200
#define NMB 56 #define NMB 56
static short FAR MB[6*NMB] = { static const short MB[6*NMB] = {
/* /*
Latitude Latitude
D l' l F 1" .0001" */ D l' l F 1" .0001" */
@ -509,7 +509,7 @@ static short FAR MB[6*NMB] = {
}; };
#else #else
#define NMB 77 #define NMB 77
static short FAR MB[6*NMB] = { static const short MB[6*NMB] = {
/* /*
Latitude Latitude
D l' l F 1" .0001" */ D l' l F 1" .0001" */
@ -595,7 +595,7 @@ static short FAR MB[6*NMB] = {
#endif /* ! MOSH_MOON_200 */ #endif /* ! MOSH_MOON_200 */
#define NLRT 38 #define NLRT 38
static short FAR LRT[8*NLRT] = { static const short LRT[8*NLRT] = {
/* /*
Multiply by T Multiply by T
Longitude Radius Longitude Radius
@ -642,7 +642,7 @@ Multiply by T
}; };
#define NBT 16 #define NBT 16
static short FAR BT[5*NBT] = { static const short BT[5*NBT] = {
/* /*
Multiply by T Multiply by T
Latitude Latitude
@ -667,7 +667,7 @@ Multiply by T
}; };
#define NLRT2 25 #define NLRT2 25
static short FAR LRT2[6*NLRT2] = { static const short LRT2[6*NLRT2] = {
/* /*
Multiply by T^2 Multiply by T^2
Longitude Radius Longitude Radius
@ -701,7 +701,7 @@ Multiply by T^2
}; };
#define NBT2 12 #define NBT2 12
static short FAR BT2[5*NBT2] = { static const short BT2[5*NBT2] = {
/* /*
Multiply by T^2 Multiply by T^2
Latitiude Latitiude
@ -723,7 +723,7 @@ Multiply by T^2
/* corrections for mean lunar node in degrees, from -13100 to 17200, /* corrections for mean lunar node in degrees, from -13100 to 17200,
* in 100-year steps. corrections are set to 0 between the years 0 and 3000 */ * in 100-year steps. corrections are set to 0 between the years 0 and 3000 */
static double mean_node_corr[] = { static const double mean_node_corr[] = {
-2.56, -2.56,
-2.473, -2.392347, -2.316425, -2.239639, -2.167764, -2.095100, -2.024810, -1.957622, -1.890097, -1.826389, -2.473, -2.392347, -2.316425, -2.239639, -2.167764, -2.095100, -2.024810, -1.957622, -1.890097, -1.826389,
-1.763335, -1.701047, -1.643016, -1.584186, -1.527309, -1.473352, -1.418917, -1.367736, -1.317202, -1.267269, -1.763335, -1.701047, -1.643016, -1.584186, -1.527309, -1.473352, -1.418917, -1.367736, -1.317202, -1.267269,
@ -765,7 +765,7 @@ static double mean_node_corr[] = {
/* corrections for mean lunar apsides in degrees, from -13100 to 17200, /* corrections for mean lunar apsides in degrees, from -13100 to 17200,
* in 100-year steps. corrections are set to 0 between the years 0 and 3000 */ * in 100-year steps. corrections are set to 0 between the years 0 and 3000 */
static double mean_apsis_corr[] = { static const double mean_apsis_corr[] = {
7.525, 7.525,
7.290, 7.057295, 6.830813, 6.611723, 6.396775, 6.189569, 5.985968, 5.788342, 5.597304, 5.410167, 7.290, 7.057295, 6.830813, 6.611723, 6.396775, 6.189569, 5.985968, 5.788342, 5.597304, 5.410167,
5.229946, 5.053389, 4.882187, 4.716494, 4.553532, 4.396734, 4.243718, 4.094282, 3.950865, 3.810366, 5.229946, 5.053389, 4.882187, 4.716494, 4.553532, 4.396734, 4.243718, 4.094282, 3.950865, 3.810366,
@ -809,39 +809,39 @@ static double mean_apsis_corr[] = {
* to the same instant. The distinction between them * to the same instant. The distinction between them
* is required by altaz(). * is required by altaz().
*/ */
static double FAR ss[5][8]; static TLS double ss[5][8];
static double FAR cc[5][8]; static TLS double cc[5][8];
static double l; /* Moon's ecliptic longitude */ static TLS double l; /* Moon's ecliptic longitude */
static double B; /* Ecliptic latitude */ static TLS double B; /* Ecliptic latitude */
static double moonpol[3]; static TLS double moonpol[3];
/* Orbit calculation begins. /* Orbit calculation begins.
*/ */
static double SWELP; static TLS double SWELP;
static double M; static TLS double M;
static double MP; static TLS double MP;
static double D; static TLS double D;
static double NF; static TLS double NF;
static double T; static TLS double T;
static double T2; static TLS double T2;
static double T3; static TLS double T3;
static double T4; static TLS double T4;
static double f; static TLS double f;
static double g; static TLS double g;
static double Ve; static TLS double Ve;
static double Ea; static TLS double Ea;
static double Ma; static TLS double Ma;
static double Ju; static TLS double Ju;
static double Sa; static TLS double Sa;
static double cg; static TLS double cg;
static double sg; static TLS double sg;
static double l1; static TLS double l1;
static double l2; static TLS double l2;
static double l3; static TLS double l3;
static double l4; static TLS double l4;
/* Calculate geometric coordinates of Moon /* Calculate geometric coordinates of Moon
* without light time or nutation correction. * without light time or nutation correction.
@ -1626,7 +1626,7 @@ int swi_mean_apog(double J, double *pol, char *serr)
/* Program to step through the perturbation table /* Program to step through the perturbation table
*/ */
static void chewm(short *pt, int nlines, int nangles, int typflg, double *ans ) static void chewm(const short *pt, int nlines, int nangles, int typflg, double *ans )
{ {
int i, j, k, k1, m; int i, j, k, k1, m;
double cu, su, cv, sv, ff; double cu, su, cv, sv, ff;

View File

@ -82,11 +82,11 @@ static int read_elements_file(int32 ipl, double tjd,
double *parg, double *node, double *incl, double *parg, double *node, double *incl,
char *pname, int32 *fict_ifl, char *serr); char *pname, int32 *fict_ifl, char *serr);
static int pnoint2msh[] = {2, 2, 0, 1, 3, 4, 5, 6, 7, 8, }; static const int pnoint2msh[] = {2, 2, 0, 1, 3, 4, 5, 6, 7, 8, };
/* From Simon et al (1994) */ /* From Simon et al (1994) */
static double freqs[] = static const double freqs[] =
{ {
/* Arc sec per 10000 Julian years. */ /* Arc sec per 10000 Julian years. */
53810162868.8982, 53810162868.8982,
@ -100,7 +100,7 @@ static double freqs[] =
52272245.1795 52272245.1795
}; };
static double phases[] = static const double phases[] =
{ {
/* Arc sec. */ /* Arc sec. */
252.25090552 * 3600., 252.25090552 * 3600.,
@ -114,7 +114,7 @@ static double phases[] =
860492.1546, 860492.1546,
}; };
static struct plantbl *planets[] = static const struct plantbl *planets[] =
{ {
&mer404, &mer404,
&ven404, &ven404,
@ -127,19 +127,19 @@ static struct plantbl *planets[] =
&plu404 &plu404
}; };
static double FAR ss[9][24]; static TLS double ss[9][24];
static double FAR cc[9][24]; static TLS double 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; int i, j, k, m, k1, ip, np, nt;
signed char FAR *p; signed char *p;
double FAR *pl, *pb, *pr; double *pl, *pb, *pr;
double su, cu, sv, cv, T; double su, cu, sv, cv, T;
double t, sl, sb, sr; double t, sl, sb, sr;
struct plantbl *plan = planets[iplm]; const struct plantbl *plan = planets[iplm];
T = (J - J2000) / TIMESCALE; T = (J - J2000) / TIMESCALE;
/* Calculate sin( i*MM ), etc. for needed multiple angles. */ /* Calculate sin( i*MM ), etc. for needed multiple angles. */
@ -504,7 +504,7 @@ static void embofs_mosh(double tjd, double *xemb)
*/ */
#define SE_NEELY /* use James Neely's revised elements #define SE_NEELY /* use James Neely's revised elements
* of Uranian planets*/ * of Uranian planets*/
static char *plan_fict_nam[SE_NFICT_ELEM] = static const char *plan_fict_nam[SE_NFICT_ELEM] =
{"Cupido", "Hades", "Zeus", "Kronos", {"Cupido", "Hades", "Zeus", "Kronos",
"Apollon", "Admetos", "Vulkanus", "Poseidon", "Apollon", "Admetos", "Vulkanus", "Poseidon",
"Isis-Transpluto", "Nibiru", "Harrington", "Isis-Transpluto", "Nibiru", "Harrington",
@ -520,7 +520,7 @@ char *swi_get_fict_name(int32 ipl, char *snam)
return snam; return snam;
} }
static double plan_oscu_elem[SE_NFICT_ELEM][8] = { static const double plan_oscu_elem[SE_NFICT_ELEM][8] = {
#ifdef SE_NEELY #ifdef SE_NEELY
{J1900, J1900, 163.7409, 40.99837, 0.00460, 171.4333, 129.8325, 1.0833},/* Cupido 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, 27.6496, 50.66744, 0.00245, 148.1796, 161.3339, 1.0500},/* Hades Neely */

View File

@ -1,10 +1,9 @@
/* SWISSEPH /* SWISSEPH
$Header: /home/dieter/sweph/RCS/swemptab.h,v 1.74 2008/06/16 10:07:20 dieter Exp $ $Header: /home/dieter/sweph/RCS/swemptab.c,v 1.74 2008/06/16 10:07:20 dieter Exp $
ATTENTION: this source file is not to be compiled separately, ATTENTION: this source file is not to be compiled separately,
as it is #included by swemplan as it is #included by swemplan
*/
**************************************************************/
/* Copyright (C) 1997 - 2008 Astrodienst AG, Switzerland. All rights reserved. /* Copyright (C) 1997 - 2008 Astrodienst AG, Switzerland. All rights reserved.
License conditions License conditions
@ -76,7 +75,7 @@ Days per record = 4.0
2500.0 to 3000.0: 0.42 0.13 0.16 2500.0 to 3000.0: 0.42 0.13 0.16
3000.0 to 3000.8: 0.252 0.087 0.115 3000.0 to 3000.8: 0.252 0.087 0.115
*/ */
static double FAR mertabl[] = { static double mertabl[] = {
35.85255, -163.26379, 53810162857.56026, 908082.18475, 35.85255, -163.26379, 53810162857.56026, 908082.18475,
0.05214, -0.07712, 0.05214, -0.07712,
@ -363,7 +362,7 @@ static double FAR mertabl[] = {
-0.00013, -0.00986, -0.00013, -0.00986,
}; };
static double FAR mertabb[] = { static double mertabb[] = {
68.33369, 422.77623, -2057.26405, -2522.29068, 68.33369, 422.77623, -2057.26405, -2522.29068,
-0.00030, -0.00009, -0.00030, -0.00009,
@ -650,7 +649,7 @@ static double FAR mertabb[] = {
-0.01665, -0.00199, -0.01665, -0.00199,
}; };
static double FAR mertabr[] = { static double mertabr[] = {
-8.30490, -11.68232, 86.54880, 4361.05018, -8.30490, -11.68232, 86.54880, 4361.05018,
0.00002, -0.00001, 0.00002, -0.00001,
@ -938,7 +937,7 @@ static double FAR mertabr[] = {
}; };
static signed char FAR merargs[] = { static signed char merargs[] = {
0, 3, 0, 3,
3, 1, 1,-10, 3, 11, 4, 0, 3, 1, 1,-10, 3, 11, 4, 0,
2, 2, 5, -5, 6, 2, 2, 2, 5, -5, 6, 2,
@ -1072,7 +1071,7 @@ static signed char FAR merargs[] = {
-1 -1
}; };
/* Total terms = 130, small = 128 */ /* Total terms = 130, small = 128 */
static struct plantbl FAR mer404 = { static struct plantbl mer404 = {
{ 11, 14, 10, 11, 4, 5, 2, 0, 0,}, { 11, 14, 10, 11, 4, 5, 2, 0, 0,},
6, 6,
merargs, merargs,
@ -1100,7 +1099,7 @@ Days per record = 4.0
2500.0 to 3000.0: 0.30 0.15 0.10 2500.0 to 3000.0: 0.30 0.15 0.10
3000.0 to 3000.8: 0.116 0.062 0.058 3000.0 to 3000.8: 0.116 0.062 0.058
*/ */
static double FAR ventabl[] = { static double ventabl[] = {
9.08078, 55.42416, 21066413644.98911, 655127.20186, 9.08078, 55.42416, 21066413644.98911, 655127.20186,
0.00329, 0.10408, 0.00329, 0.10408,
@ -1328,7 +1327,7 @@ static double FAR ventabl[] = {
-0.00004, 0.00645, -0.00004, 0.00645,
}; };
static double FAR ventabb[] = { static double ventabb[] = {
-23.91858, 31.44154, 25.93273, -67.68643, -23.91858, 31.44154, 25.93273, -67.68643,
-0.00171, 0.00123, -0.00171, 0.00123,
@ -1556,7 +1555,7 @@ static double FAR ventabb[] = {
0.00002, 0.00020, 0.00002, 0.00020,
}; };
static double FAR ventabr[] = { static double ventabr[] = {
-0.24459, 3.72698, -6.67281, 5.24378, -0.24459, 3.72698, -6.67281, 5.24378,
0.00030, 0.00003, 0.00030, 0.00003,
@ -1785,7 +1784,7 @@ static double FAR ventabr[] = {
}; };
static signed char FAR venargs[] = { static signed char venargs[] = {
0, 3, 0, 3,
2, 2, 5, -5, 6, 0, 2, 2, 5, -5, 6, 0,
3, 2, 2, 1, 3, -8, 4, 0, 3, 2, 2, 1, 3, -8, 4, 0,
@ -1897,7 +1896,7 @@ static signed char FAR venargs[] = {
-1 -1
}; };
/* Total terms = 108, small = 107 */ /* Total terms = 108, small = 107 */
static struct plantbl FAR ven404 = { static struct plantbl ven404 = {
{ 5, 14, 13, 8, 4, 5, 1, 0, 0,}, { 5, 14, 13, 8, 4, 5, 1, 0, 0,},
5, 5,
venargs, venargs,
@ -1924,7 +1923,7 @@ Days per record = 6.0
3000.0 to 3000.8: 0.074 0.048 0.044 3000.0 to 3000.8: 0.074 0.048 0.044
*/ */
static double FAR eartabl[] = { static double eartabl[] = {
-65.54655, -232.74963, 12959774227.57587, 361678.59587, -65.54655, -232.74963, 12959774227.57587, 361678.59587,
2.52679, -4.93511, 2.46852, -8.88928, 2.52679, -4.93511, 2.46852, -8.88928,
@ -2216,7 +2215,7 @@ static double FAR eartabl[] = {
0.00002, -0.00623, 0.00002, -0.00623,
}; };
static double FAR eartabb[] = { static double eartabb[] = {
-41.97860, -48.43539, 74.72897, 0.00075, -41.97860, -48.43539, 74.72897, 0.00075,
-0.12774, -0.10188, -0.00943, -0.04574, -0.12774, -0.10188, -0.00943, -0.04574,
@ -2508,7 +2507,7 @@ static double FAR eartabb[] = {
0.00025, 0.00021, 0.00025, 0.00021,
}; };
static double FAR eartabr[] = { static double eartabr[] = {
0.64577, -2.90183, -14.50280, 28.85196, 0.64577, -2.90183, -14.50280, 28.85196,
0.08672, -0.05643, 0.02353, -0.00404, 0.08672, -0.05643, 0.02353, -0.00404,
@ -2801,7 +2800,7 @@ static double FAR eartabr[] = {
}; };
static signed char FAR earargs[] = { static signed char earargs[] = {
0, 3, 0, 3,
3, 4, 3, -8, 4, 3, 5, 2, 3, 4, 3, -8, 4, 3, 5, 2,
2, 2, 5, -5, 6, 1, 2, 2, 5, -5, 6, 1,
@ -2940,7 +2939,7 @@ static signed char FAR earargs[] = {
-1 -1
}; };
/* Total terms = 135, small = 134 */ /* Total terms = 135, small = 134 */
static struct plantbl FAR ear404 = { static struct plantbl ear404 = {
{ 1, 9, 14, 17, 5, 5, 2, 1, 0,}, { 1, 9, 14, 17, 5, 5, 2, 1, 0,},
4, 4,
earargs, earargs,
@ -2967,7 +2966,7 @@ Days per record = 4.0
3000.0 to 3000.8: 0.182 0.125 0.087 3000.0 to 3000.8: 0.182 0.125 0.087
*/ */
static double FAR martabl[] = { static double martabl[] = {
43471.66140, 21291.11063, 2033.37848, 6890507597.78366, 43471.66140, 21291.11063, 2033.37848, 6890507597.78366,
1279543.73631, 1279543.73631,
@ -3409,7 +3408,7 @@ static double FAR martabl[] = {
-0.00723, -0.01536, -0.00723, -0.01536,
}; };
static double FAR martabb[] = { static double martabb[] = {
-364.49380, -47.17612, -554.97858, -430.63121, -364.49380, -47.17612, -554.97858, -430.63121,
596.44312, 596.44312,
@ -3851,7 +3850,7 @@ static double FAR martabb[] = {
0.00826, -0.00524, 0.00826, -0.00524,
}; };
static double FAR martabr[] = { static double martabr[] = {
-816.07287, -381.41365, -33.69436, 177.22955, -816.07287, -381.41365, -33.69436, 177.22955,
0.18630, 0.18630,
@ -4294,7 +4293,7 @@ static double FAR martabr[] = {
}; };
static signed char FAR marargs[] = { static signed char marargs[] = {
0, 4, 0, 4,
3, 4, 3, -8, 4, 3, 5, 2, 3, 4, 3, -8, 4, 3, 5, 2,
3, 5, 2, -6, 3, -4, 4, 0, 3, 5, 2, -6, 3, -4, 4, 0,
@ -4499,7 +4498,7 @@ static signed char FAR marargs[] = {
-1 -1
}; };
/* Total terms = 201, small = 199 */ /* Total terms = 201, small = 199 */
static struct plantbl FAR mar404 = { static struct plantbl mar404 = {
{ 0, 5, 12, 24, 9, 7, 3, 2, 0,}, { 0, 5, 12, 24, 9, 7, 3, 2, 0,},
5, 5,
marargs, marargs,
@ -4528,7 +4527,7 @@ Days per record = 131.0
2500.0 to 3000.0: 0.70 0.09 0.36 2500.0 to 3000.0: 0.70 0.09 0.36
3000.0 to 3000.4: 0.526 0.023 0.190 3000.0 to 3000.4: 0.526 0.023 0.190
*/ */
static double FAR juptabl[] = { static double juptabl[] = {
153429.13855, 130818.16897, 18120.42948, -8463.12663, 153429.13855, 130818.16897, 18120.42948, -8463.12663,
-5058.91447, 1092566021.02148, 123671.25097, -5058.91447, 1092566021.02148, 123671.25097,
@ -4874,7 +4873,7 @@ static double FAR juptabl[] = {
0.00011, 0.12033, 0.00011, 0.12033,
}; };
static double FAR juptabb[] = { static double juptabb[] = {
548.59659, 594.29629, 219.97664, 59.71822, 548.59659, 594.29629, 219.97664, 59.71822,
23.62157, 40.77732, 227.07380, 23.62157, 40.77732, 227.07380,
@ -5220,7 +5219,7 @@ static double FAR juptabb[] = {
-0.00006, 0.00001, -0.00006, 0.00001,
}; };
static double FAR juptabr[] = { static double juptabr[] = {
-734.58857, -1081.04460, -551.65750, -148.79782, -734.58857, -1081.04460, -551.65750, -148.79782,
-25.23171, 164.64781, 248.64813, -25.23171, 164.64781, 248.64813,
@ -5567,7 +5566,7 @@ static double FAR juptabr[] = {
}; };
static signed char FAR jupargs[] = { static signed char jupargs[] = {
0, 6, 0, 6,
3, 2, 5, -6, 6, 3, 7, 0, 3, 2, 5, -6, 6, 3, 7, 0,
2, 2, 5, -5, 6, 6, 2, 2, 5, -5, 6, 6,
@ -5713,7 +5712,7 @@ static signed char FAR jupargs[] = {
-1 -1
}; };
/* Total terms = 142, small = 140 */ /* Total terms = 142, small = 140 */
static struct plantbl FAR jup404 = { static struct plantbl jup404 = {
{ 0, 0, 1, 0, 9, 16, 7, 5, 0,}, { 0, 0, 1, 0, 9, 16, 7, 5, 0,},
6, 6,
jupargs, jupargs,
@ -5742,7 +5741,7 @@ Days per record = 131.0
2500.0 to 3000.0: 0.63 0.22 0.53 2500.0 to 3000.0: 0.63 0.22 0.53
3000.0 to 3000.4: 0.047 0.073 0.086 3000.0 to 3000.4: 0.047 0.073 0.086
*/ */
static double FAR sattabl[] = { static double sattabl[] = {
1788381.26240, 2460423.68044, 1370113.15868, 415406.99187, 1788381.26240, 2460423.68044, 1370113.15868, 415406.99187,
72040.39885, 12669.58806, 439960754.85333, 180256.80433, 72040.39885, 12669.58806, 439960754.85333, 180256.80433,
@ -6231,7 +6230,7 @@ static double FAR sattabl[] = {
-0.00010, 0.06547, -0.00010, 0.06547,
}; };
static double FAR sattabb[] = { static double sattabb[] = {
-567865.62548, -796277.29029, -410804.00791, -91793.12562, -567865.62548, -796277.29029, -410804.00791, -91793.12562,
-6268.13975, 398.64391, -710.67442, 175.29456, -6268.13975, 398.64391, -710.67442, 175.29456,
@ -6720,7 +6719,7 @@ static double FAR sattabb[] = {
-0.00003, -0.00013, -0.00003, -0.00013,
}; };
static double FAR sattabr[] = { static double sattabr[] = {
-38127.94034, -48221.08524, -20986.93487, -3422.75861, -38127.94034, -48221.08524, -20986.93487, -3422.75861,
-8.97362, 53.34259, -404.15708, -0.05434, -8.97362, 53.34259, -404.15708, -0.05434,
@ -7210,7 +7209,7 @@ static double FAR sattabr[] = {
}; };
static signed char FAR satargs[] = { static signed char satargs[] = {
0, 7, 0, 7,
3, 2, 5, -6, 6, 3, 7, 0, 3, 2, 5, -6, 6, 3, 7, 0,
2, 2, 5, -5, 6, 5, 2, 2, 5, -5, 6, 5,
@ -7429,7 +7428,7 @@ static signed char FAR satargs[] = {
-1 -1
}; };
/* Total terms = 215, small = 211 */ /* Total terms = 215, small = 211 */
static struct plantbl FAR sat404 = { static struct plantbl sat404 = {
{ 0, 0, 1, 0, 8, 18, 9, 5, 0,}, { 0, 0, 1, 0, 8, 18, 9, 5, 0,},
7, 7,
satargs, satargs,
@ -7458,7 +7457,7 @@ Days per record = 131.0
2500.0 to 3000.0: 0.34 0.06 0.32 2500.0 to 3000.0: 0.34 0.06 0.32
3000.0 to 3000.4: 0.406 0.035 0.172 3000.0 to 3000.4: 0.406 0.035 0.172
*/ */
static double FAR uratabl[] = { static double uratabl[] = {
21.56000, -4652.06828, 154246324.90417, 1130486.05080, 21.56000, -4652.06828, 154246324.90417, 1130486.05080,
330.11531, -3020.20235, 330.11531, -3020.20235,
@ -7842,7 +7841,7 @@ static double FAR uratabl[] = {
-0.01517, 0.03748, -0.01517, 0.03748,
}; };
static double FAR uratabb[] = { static double uratabb[] = {
0.00000, 107.91527, 83.39404, -124.29804, 0.00000, 107.91527, 83.39404, -124.29804,
-7.73277, -3.99442, -7.73277, -3.99442,
@ -8226,7 +8225,7 @@ static double FAR uratabb[] = {
0.00005, 0.00003, 0.00005, 0.00003,
}; };
static double FAR uratabr[] = { static double uratabr[] = {
0.00000, -53.23277, -44.70609, -62.54432, 0.00000, -53.23277, -44.70609, -62.54432,
-19.15218, 0.10867, -19.15218, 0.10867,
@ -8611,7 +8610,7 @@ static double FAR uratabr[] = {
}; };
static signed char FAR uraargs[] = { static signed char uraargs[] = {
0, 3, 0, 3,
2, 1, 7, -2, 8, 0, 2, 1, 7, -2, 8, 0,
2, 2, 7, -4, 8, 0, 2, 2, 7, -4, 8, 0,
@ -8792,7 +8791,7 @@ static signed char FAR uraargs[] = {
-1 -1
}; };
/* Total terms = 177, small = 171 */ /* Total terms = 177, small = 171 */
static struct plantbl FAR ura404 = { static struct plantbl ura404 = {
{ 0, 0, 0, 0, 5, 10, 9, 12, 0,}, { 0, 0, 0, 0, 5, 10, 9, 12, 0,},
6, 6,
uraargs, uraargs,
@ -8821,7 +8820,7 @@ Days per record = 131.0
2500.0 to 3000.0: 0.43 0.25 0.46 2500.0 to 3000.0: 0.43 0.25 0.46
3000.0 to 3000.4: 0.122 0.071 0.260 3000.0 to 3000.4: 0.122 0.071 0.260
*/ */
static double FAR neptabl[] = { static double neptabl[] = {
-1376.86480, 730.38970, 78655362.50948, 1095691.38676, -1376.86480, 730.38970, 78655362.50948, 1095691.38676,
-196.19023, 2086.77782, -196.19023, 2086.77782,
@ -8943,7 +8942,7 @@ static double FAR neptabl[] = {
-0.28141, 0.25061, -0.20293, 0.79930, -0.28141, 0.25061, -0.20293, 0.79930,
}; };
static double FAR neptabb[] = { static double neptabb[] = {
-391.05987, -243.95958, -23.83558, 58.13857, -391.05987, -243.95958, -23.83558, 58.13857,
5.04859, -3.93183, 5.04859, -3.93183,
@ -9065,7 +9064,7 @@ static double FAR neptabb[] = {
0.00106, 0.00025, 0.00013, -0.00019, 0.00106, 0.00025, 0.00013, -0.00019,
}; };
static double FAR neptabr[] = { static double neptabr[] = {
-767.68936, -460.59576, -52.41861, -273.85897, -767.68936, -460.59576, -52.41861, -273.85897,
59.52489, 1.85006, 59.52489, 1.85006,
@ -9188,7 +9187,7 @@ static double FAR neptabr[] = {
}; };
static signed char FAR nepargs[] = { static signed char nepargs[] = {
0, 3, 0, 3,
2, 1, 7, -2, 8, 0, 2, 1, 7, -2, 8, 0,
3, 3, 5, -8, 6, 3, 8, 0, 3, 3, 5, -8, 6, 3, 8, 0,
@ -9251,7 +9250,7 @@ static signed char FAR nepargs[] = {
-1 -1
}; };
/* Total terms = 59, small = 58 */ /* Total terms = 59, small = 58 */
static struct plantbl FAR nep404 = { static struct plantbl nep404 = {
{ 0, 0, 0, 0, 3, 8, 7, 9, 0,}, { 0, 0, 0, 0, 3, 8, 7, 9, 0,},
3, 3,
nepargs, nepargs,
@ -9280,7 +9279,7 @@ Days per record = 131.0
2500.0 to 3000.0: 1.09 0.70 0.46 2500.0 to 3000.0: 1.09 0.70 0.46
3000.0 to 3000.4: 0.871 0.395 0.051 3000.0 to 3000.4: 0.871 0.395 0.051
*/ */
static double FAR plutabl[] = { static double plutabl[] = {
74986469.33577, 100898343.73690, 48199471.54076, 9520076.03177, 74986469.33577, 100898343.73690, 48199471.54076, 9520076.03177,
690431.67340, -427355.12716, 52266623.77862, 860190.70714, 690431.67340, -427355.12716, 52266623.77862, 860190.70714,
@ -9671,7 +9670,7 @@ static double FAR plutabl[] = {
-0.06243, 0.04306, -0.06243, 0.04306,
}; };
static double FAR plutabb[] = { static double plutabb[] = {
-35042727.30412, -49049197.81293, -25374963.60995, -5761406.03035, -35042727.30412, -49049197.81293, -25374963.60995, -5761406.03035,
-467370.57540, 14040.11453, 2329.15763, -13978.69390, -467370.57540, 14040.11453, 2329.15763, -13978.69390,
@ -10062,7 +10061,7 @@ static double FAR plutabb[] = {
0.05985, 0.04130, 0.05985, 0.04130,
}; };
static double FAR plutabr[] = { static double plutabr[] = {
17990649.12487, 24806479.30874, 12690953.00645, 2892671.69562, 17990649.12487, 24806479.30874, 12690953.00645, 2892671.69562,
249947.71316, -5138.71425, 1142.68629, 6075.25751, 249947.71316, -5138.71425, 1142.68629, 6075.25751,
@ -10454,7 +10453,7 @@ static double FAR plutabr[] = {
}; };
static signed char FAR pluargs[] = { static signed char pluargs[] = {
0, 7, 0, 7,
2, 3, 7, -9, 9, 0, 2, 3, 7, -9, 9, 0,
2, 4, 7,-12, 9, 0, 2, 4, 7,-12, 9, 0,
@ -10631,7 +10630,7 @@ static signed char FAR pluargs[] = {
-1 -1
}; };
/* Total terms = 173, small = 156 */ /* Total terms = 173, small = 156 */
static struct plantbl FAR plu404 = { static struct plantbl plu404 = {
{ 0, 0, 0, 0, 2, 2, 9, 13, 13,}, { 0, 0, 0, 0, 2, 2, 9, 13, 13,},
7, 7,
pluargs, pluargs,

View File

@ -69,7 +69,7 @@
#define NPL 687 #define NPL 687
/* Luni-Solar argument multipliers /* Luni-Solar argument multipliers
L L' F D Om */ L L' F D Om */
static int16 nls[] = { static const int16 nls[] = {
0, 0, 0, 0, 1, 0, 0, 0, 0, 1,
0, 0, 2, -2, 2, 0, 0, 2, -2, 2,
0, 0, 2, 0, 2, 0, 0, 2, 0, 2,
@ -752,7 +752,7 @@ static int16 nls[] = {
/* Luni-Solar nutation coefficients, unit 1e-7 arcsec /* Luni-Solar nutation coefficients, unit 1e-7 arcsec
* longitude (sin, t*sin, cos), obliquity (cos, t*cos, sin) */ * longitude (sin, t*sin, cos), obliquity (cos, t*cos, sin) */
static int32 cls[] = { static const int32 cls[] = {
-172064161, -174666, 33386, 92052331, 9086, 15377, -172064161, -174666, 33386, 92052331, 9086, 15377,
-13170906, -1675, -13696, 5730336, -3015, -4587, -13170906, -1675, -13696, 5730336, -3015, -4587,
-2276413, -234, 2796, 978459, -485, 1374, -2276413, -234, 2796, 978459, -485, 1374,
@ -1436,7 +1436,7 @@ static int32 cls[] = {
/*#if NUT_IAU_2000A*/ /*#if NUT_IAU_2000A*/
/* Planetary argument multipliers /* Planetary argument multipliers
* L L' F D Om Me Ve E Ma Ju Sa Ur Ne pre */ * L L' F D Om Me Ve E Ma Ju Sa Ur Ne pre */
static int16 npl[] = { static const int16 npl[] = {
0, 0, 0, 0, 0, 0, 0, 8,-16, 4, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8,-16, 4, 5, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, -8, 16, -4, -5, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, -8, 16, -4, -5, 0, 0, 2,
0, 0, 0, 0, 0, 0, 0, 8,-16, 4, 5, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 8,-16, 4, 5, 0, 0, 2,
@ -2128,7 +2128,7 @@ static int16 npl[] = {
/* Planetary nutation coefficients, unit 1e-7 arcsec /* Planetary nutation coefficients, unit 1e-7 arcsec
* longitude (sin, cos), obliquity (sin, cos) */ * longitude (sin, cos), obliquity (sin, cos) */
static int16 icpl[] = { static const int16 icpl[] = {
1440, 0, 0, 0, 1440, 0, 0, 0,
56, -117, -42, -40, 56, -117, -42, -40,
125, -43, 0, -54, 125, -43, 0, -54,

View File

@ -75,6 +75,20 @@
# define MY_TRUE 1 /* for use in other defines, before TRUE is defined */ # define MY_TRUE 1 /* for use in other defines, before TRUE is defined */
# define MY_FALSE 0 /* for use in other defines, before TRUE is defined */ # define MY_FALSE 0 /* for use in other defines, before TRUE is defined */
/* TLS support
*
* Sun Studio C/C++, IBM XL C/C++, GNU C and Intel C/C++ (Linux systems) -> __thread
* Borland, VC++ -> __declspec(thread)
*/
#if !defined( __APPLE__ ) && !defined(WIN32) && !defined(DOS32)
#if defined( __GNUC__ )
#define TLS __thread
#else
#define TLS __declspec(thread)
#endif
#else
#define TLS
#endif
#ifdef _WIN32 /* Microsoft VC 5.0 does not define MSDOS anymore */ #ifdef _WIN32 /* Microsoft VC 5.0 does not define MSDOS anymore */
# undef MSDOS # undef MSDOS
@ -135,12 +149,10 @@
# ifndef TURBO_C # ifndef TURBO_C
# define MS_C /* assume Microsoft C compiler */ # define MS_C /* assume Microsoft C compiler */
# endif # endif
# define MYFAR far
# define UNIX_FS MY_FALSE # define UNIX_FS MY_FALSE
#else #else
# ifdef MACOS # ifdef MACOS
# define HPUNIX MY_FALSE # define HPUNIX MY_FALSE
# define MYFAR
# define UNIX_FS MY_FALSE # define UNIX_FS MY_FALSE
# else # else
# define MSDOS MY_FALSE # define MSDOS MY_FALSE
@ -148,7 +160,6 @@
# ifndef _HPUX_SOURCE # ifndef _HPUX_SOURCE
# define _HPUX_SOURCE # define _HPUX_SOURCE
# endif # endif
# define MYFAR
# define UNIX_FS MY_TRUE # define UNIX_FS MY_TRUE
# endif # endif
#endif #endif

View File

@ -80,13 +80,13 @@ Placalc compatibility interface for Swiss Ephemeris.
local globals, not exported 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 const 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 /* If there occurs an internal error in placalc, a message is
* written into the string variable perrtx. * written into the string variable perrtx.
* The message can be read with placalc_get_errtext(); * The message can be read with placalc_get_errtext();
*/ */
static char perrtx[AS_MAXCH]; static TLS char perrtx[AS_MAXCH];
static double ekl, nut; static double ekl, nut;
/* /*
@ -94,7 +94,7 @@ static double ekl, nut;
* required for relative distances rgeo, where the distance is given * required for relative distances rgeo, where the distance is given
* as 100 when a planet is closest and as 0 when farthest from earth. * as 100 when a planet is closest and as 0 when farthest from earth.
*/ */
static double rmima[CALC_N][2] = { static const double rmima[CALC_N][2] = {
{ 0.98296342, 1.01704665}, { 0.98296342, 1.01704665},
{ 0.00238267, 0.00271861}, { 0.00238267, 0.00271861},
{ 0.54900496, 1.45169607}, { 0.54900496, 1.45169607},
@ -497,7 +497,7 @@ char *planet2abbr3(int planet)
char *placalc_set_ephepath(char *path) char *placalc_set_ephepath(char *path)
{ {
static char *epath; static TLS char *epath;
if (path == NULL) return epath; if (path == NULL) return epath;
if (epath != NULL) if (epath != NULL)
free((void *) epath); free((void *) epath);

View File

@ -83,7 +83,7 @@ struct meff_ele {double r,m;};
/**************** /****************
* global stuff * * global stuff *
****************/ ****************/
struct swe_data FAR swed = {FALSE, /* ephe_path_is_set = FALSE */ TLS struct swe_data swed = {FALSE, /* ephe_path_is_set = FALSE */
FALSE, /* jpl_file_is_open = FALSE */ FALSE, /* jpl_file_is_open = FALSE */
NULL, /* fixfp, fixed stars file pointer */ NULL, /* fixfp, fixed stars file pointer */
#if 0 #if 0
@ -99,14 +99,17 @@ struct swe_data FAR swed = {FALSE, /* ephe_path_is_set = FALSE */
FALSE, /* ayana_is_set, ayanamsa is set */ FALSE, /* ayana_is_set, ayanamsa is set */
FALSE, /* is_old_starfile, fixstars.cat is used (default is sefstars.txt) */ FALSE, /* is_old_starfile, fixstars.cat is used (default is sefstars.txt) */
0.0, 0.0, 0.0, 0.0, /* eop_tjd_... */ 0.0, 0.0, 0.0, 0.0, /* eop_tjd_... */
0, /* eop_dpsi_loaded */ 0, /* eop_dpsi_loaded */
0.0, /* tid_acc */
FALSE, /* is_tid_acc_manual */
FALSE, /* init_dt_done */
}; };
/************* /*************
* constants * * constants *
*************/ *************/
static char *ayanamsa_name[] = { static const char *ayanamsa_name[] = {
"Fagan/Bradley", "Fagan/Bradley",
"Lahiri", "Lahiri",
"De Luce", "De Luce",
@ -138,7 +141,7 @@ static char *ayanamsa_name[] = {
"True Revati", "True Revati",
"True Pushya", "True Pushya",
}; };
static const int FAR pnoint2jpl[] = PNOINT2JPL; static const int pnoint2jpl[] = PNOINT2JPL;
static const int pnoext2int[] = {SEI_SUN, SEI_MOON, SEI_MERCURY, SEI_VENUS, SEI_MARS, SEI_JUPITER, SEI_SATURN, SEI_URANUS, SEI_NEPTUNE, SEI_PLUTO, 0, 0, 0, 0, SEI_EARTH, SEI_CHIRON, SEI_PHOLUS, SEI_CERES, SEI_PALLAS, SEI_JUNO, SEI_VESTA, }; static const int pnoext2int[] = {SEI_SUN, SEI_MOON, SEI_MERCURY, SEI_VENUS, SEI_MARS, SEI_JUPITER, SEI_SATURN, SEI_URANUS, SEI_NEPTUNE, SEI_PLUTO, 0, 0, 0, 0, SEI_EARTH, SEI_CHIRON, SEI_PHOLUS, SEI_CERES, SEI_PALLAS, SEI_JUNO, SEI_VESTA, };
@ -180,7 +183,6 @@ static double meff(double r);
static void denormalize_positions(double *x0, double *x1, double *x2); static void denormalize_positions(double *x0, double *x1, double *x2);
static void calc_speed(double *x0, double *x1, double *x2, double dt); static void calc_speed(double *x0, double *x1, double *x2, double dt);
static int32 plaus_iflag(int32 iflag, int32 ipl, double tjd, char *serr); static int32 plaus_iflag(int32 iflag, int32 ipl, double tjd, char *serr);
void FAR PASCAL_CONV swe_set_sid_mode(int32 sid_mode, double t0, double ayan_t0);
static int app_pos_rest(struct plan_data *pdp, int32 iflag, static int app_pos_rest(struct plan_data *pdp, int32 iflag,
double *xx, double *x2000, struct epsilon *oe, char *serr); double *xx, double *x2000, struct epsilon *oe, char *serr);
static int open_jpl_file(double *ss, char *fname, char *fpath, char *serr); static int open_jpl_file(double *ss, char *fname, char *fpath, char *serr);
@ -192,7 +194,7 @@ static void trace_swe_fixstar(int swtch, char *star, double tjd, int32 iflag, do
static void trace_swe_get_planet_name(int swtch, int ipl, char *s); static void trace_swe_get_planet_name(int swtch, int ipl, char *s);
#endif #endif
char *FAR PASCAL_CONV swe_version(char *s) char *CALL_CONV swe_version(char *s)
{ {
strcpy(s, SE_VERSION); strcpy(s, SE_VERSION);
return s; return s;
@ -211,7 +213,7 @@ char *FAR PASCAL_CONV swe_version(char *s)
* program tests only. * program tests only.
* -> If no speed flag has been specified, no speed will be returned. * -> If no speed flag has been specified, no speed will be returned.
*/ */
int32 FAR PASCAL_CONV swe_calc(double tjd, int ipl, int32 iflag, int32 CALL_CONV swe_calc(double tjd, int ipl, int32 iflag,
double *xx, char *serr) double *xx, char *serr)
{ {
int i, j; int i, j;
@ -237,9 +239,9 @@ int32 FAR PASCAL_CONV swe_calc(double tjd, int ipl, int32 iflag,
* FORCE_IFLAG and then running the application with this DLL (we had no * FORCE_IFLAG and then running the application with this DLL (we had no
* source code of the application itself). * source code of the application itself).
*/ */
static int force_flag = 0; static TLS int force_flag = 0;
static int32 iflag_forced = 0; static TLS int32 iflag_forced = 0;
static int force_flag_checked = 0; static TLS int force_flag_checked = 0;
FILE *fp; FILE *fp;
char s[AS_MAXCH], *sp; char s[AS_MAXCH], *sp;
memset(x, 0, sizeof(double) * 6); memset(x, 0, sizeof(double) * 6);
@ -428,12 +430,14 @@ return_error:
return ERR; return ERR;
} }
int32 FAR PASCAL_CONV swe_calc_ut(double tjd_ut, int32 ipl, int32 iflag, int32 CALL_CONV swe_calc_ut(double tjd_ut, int32 ipl, int32 iflag,
double *xx, char *serr) double *xx, char *serr)
{ {
double deltat; double deltat;
int32 retval = OK; int32 retval = OK;
int32 epheflag = iflag & SEFLG_EPHMASK; int32 epheflag = 0;
iflag = plaus_iflag(iflag, ipl, tjd_ut, serr);
epheflag = iflag & SEFLG_EPHMASK;
if (epheflag == 0) { if (epheflag == 0) {
epheflag = SEFLG_SWIEPH; epheflag = SEFLG_SWIEPH;
iflag |= SEFLG_SWIEPH; iflag |= SEFLG_SWIEPH;
@ -1082,7 +1086,7 @@ int32 swi_init_swed_if_start(void)
{ {
/* initialisation of swed, when called first time from */ /* initialisation of swed, when called first time from */
if (!swed.ephe_path_is_set) { if (!swed.ephe_path_is_set) {
//memset((void *) &swed, 0, sizeof(struct swe_data)); memset((void *) &swed, 0, sizeof(struct swe_data));
strcpy(swed.ephepath, SE_EPHE_PATH); strcpy(swed.ephepath, SE_EPHE_PATH);
strcpy(swed.jplfnam, SE_FNAME_DFT); strcpy(swed.jplfnam, SE_FNAME_DFT);
swe_set_tid_acc(SE_TIDAL_AUTOMATIC); swe_set_tid_acc(SE_TIDAL_AUTOMATIC);
@ -1129,7 +1133,7 @@ static void swi_close_keep_topo_etc(void)
/* closes all open files, frees space of planetary data, /* closes all open files, frees space of planetary data,
* deletes memory of all computed positions * deletes memory of all computed positions
*/ */
void FAR PASCAL_CONV swe_close(void) void CALL_CONV swe_close(void)
{ {
int i; int i;
/* close SWISSEPH files */ /* close SWISSEPH files */
@ -1204,7 +1208,7 @@ void FAR PASCAL_CONV swe_close(void)
* won't return planet positions previously computed from other * won't return planet positions previously computed from other
* ephemerides * ephemerides
*/ */
void FAR PASCAL_CONV swe_set_ephe_path(char *path) void CALL_CONV swe_set_ephe_path(char *path)
{ {
int i, iflag; int i, iflag;
char s[AS_MAXCH]; char s[AS_MAXCH];
@ -1360,7 +1364,7 @@ void load_dpsi_deps(void)
* won't return planet positions previously computed from other * won't return planet positions previously computed from other
* ephemerides * ephemerides
*/ */
void FAR PASCAL_CONV swe_set_jpl_file(char *fname) void CALL_CONV swe_set_jpl_file(char *fname)
{ {
char *sp; char *sp;
int retc; int retc;
@ -1462,8 +1466,9 @@ static int main_planet(double tjd, int ipli, int32 epheflag, int32 iflag,
if (serr != NULL && strlen(serr) + 30 < AS_MAXCH) if (serr != NULL && strlen(serr) + 30 < AS_MAXCH)
strcat(serr, " \nusing Moshier Eph; "); strcat(serr, " \nusing Moshier Eph; ");
goto moshier_planet; goto moshier_planet;
} else } else {
return ERR; return ERR;
}
} }
/* geocentric, lighttime etc. */ /* geocentric, lighttime etc. */
if (ipli == SEI_SUN) if (ipli == SEI_SUN)
@ -1912,16 +1917,16 @@ static int jplplan(double tjd, int ipli, int32 iflag, AS_BOOL do_save,
/* barycentric earth */ /* barycentric earth */
if (tjd != pedp->teval || tjd == 0) { if (tjd != pedp->teval || tjd == 0) {
retc = swi_pleph(tjd, J_EARTH, J_SBARY, xpe, serr); retc = swi_pleph(tjd, J_EARTH, J_SBARY, xpe, serr);
if (retc != OK) {
swi_close_jpl_file();
swed.jpl_file_is_open = FALSE;
return retc;
}
if (do_save) { if (do_save) {
pedp->teval = tjd; pedp->teval = tjd;
pedp->xflgs = -1; /* new light-time etc. required */ pedp->xflgs = -1; /* new light-time etc. required */
pedp->iephe = SEFLG_JPLEPH; pedp->iephe = SEFLG_JPLEPH;
} }
if (retc != OK) {
swi_close_jpl_file();
swed.jpl_file_is_open = FALSE;
return retc;
}
} else { } else {
xpe = pedp->x; xpe = pedp->x;
} }
@ -1934,16 +1939,16 @@ static int jplplan(double tjd, int ipli, int32 iflag, AS_BOOL do_save,
/* barycentric sun */ /* barycentric sun */
if (tjd != psdp->teval || tjd == 0) { if (tjd != psdp->teval || tjd == 0) {
retc = swi_pleph(tjd, J_SUN, J_SBARY, xps, serr); retc = swi_pleph(tjd, J_SUN, J_SBARY, xps, serr);
if (retc != OK) {
swi_close_jpl_file();
swed.jpl_file_is_open = FALSE;
return retc;
}
if (do_save) { if (do_save) {
psdp->teval = tjd; psdp->teval = tjd;
psdp->xflgs = -1; psdp->xflgs = -1;
psdp->iephe = SEFLG_JPLEPH; psdp->iephe = SEFLG_JPLEPH;
} }
if (retc != OK) {
swi_close_jpl_file();
swed.jpl_file_is_open = FALSE;
return retc;
}
} else { } else {
xps = psdp->x; xps = psdp->x;
} }
@ -1966,16 +1971,16 @@ static int jplplan(double tjd, int ipli, int32 iflag, AS_BOOL do_save,
xp = pdp->x; xp = pdp->x;
} else { } else {
retc = swi_pleph(tjd, pnoint2jpl[ipli], ictr, xp, serr); retc = swi_pleph(tjd, pnoint2jpl[ipli], ictr, xp, serr);
if (retc != OK) {
swi_close_jpl_file();
swed.jpl_file_is_open = FALSE;
return retc;
}
if (do_save) { if (do_save) {
pdp->teval = tjd; pdp->teval = tjd;
pdp->xflgs = -1; pdp->xflgs = -1;
pdp->iephe = SEFLG_JPLEPH; pdp->iephe = SEFLG_JPLEPH;
} }
if (retc != OK) {
swi_close_jpl_file();
swed.jpl_file_is_open = FALSE;
return retc;
}
} }
} }
if (xpret != NULL) if (xpret != NULL)
@ -2247,6 +2252,40 @@ FILE *swi_fopen(int ifno, char *fname, char *ephepath, char *serr)
return NULL; return NULL;
} }
static int32 get_denum(int32 ipli, int32 iflag)
{
struct file_data *fdp = NULL;
if (iflag & SEFLG_MOSEPH)
return 403;
if (iflag & SEFLG_JPLEPH) {
if (swed.jpldenum > 0)
return swed.jpldenum;
else
return SE_DE_NUMBER;
}
if (ipli > SE_AST_OFFSET) {
fdp = &swed.fidat[SEI_FILE_ANY_AST];
} else if (ipli == SEI_CHIRON
|| ipli == SEI_PHOLUS
|| ipli == SEI_CERES
|| ipli == SEI_PALLAS
|| ipli == SEI_JUNO
|| ipli == SEI_VESTA) {
fdp = &swed.fidat[SEI_FILE_MAIN_AST];
} else if (ipli == SEI_MOON) {
fdp = &swed.fidat[SEI_FILE_MOON];
} else {
fdp = &swed.fidat[SEI_FILE_PLANET];
}
if (fdp != NULL) {
if (fdp->sweph_denum != 0)
return fdp->sweph_denum;
else
return SE_DE_NUMBER;
}
return SE_DE_NUMBER;
}
/* converts planets from barycentric to geocentric, /* converts planets from barycentric to geocentric,
* apparent positions * apparent positions
* precession and nutation * precession and nutation
@ -2550,7 +2589,7 @@ xx[0] -= 0.053 / 3600.0 * DEGTORAD;
swi_polcart(xx, xx); swi_polcart(xx, xx);
#endif #endif
/* ICRS to J2000 */ /* ICRS to J2000 */
if (!(iflag & SEFLG_ICRS) && (swed.jpldenum >= 403 || (iflag & SEFLG_MOSEPH))) { if (!(iflag & SEFLG_ICRS) && get_denum(ipli, epheflag) >= 403) {
swi_bias(xx, t, iflag, FALSE); swi_bias(xx, t, iflag, FALSE);
}/**/ }/**/
/* save J2000 coordinates; required for sidereal positions */ /* save J2000 coordinates; required for sidereal positions */
@ -2607,11 +2646,11 @@ static int app_pos_rest(struct plan_data *pdp, int32 iflag,
if (iflag & SEFLG_SIDEREAL) { if (iflag & SEFLG_SIDEREAL) {
/* project onto ecliptic t0 */ /* project onto ecliptic t0 */
if (swed.sidd.sid_mode & SE_SIDBIT_ECL_T0) { if (swed.sidd.sid_mode & SE_SIDBIT_ECL_T0) {
if (swi_trop_ra2sid_lon(x2000, pdp->xreturn+6, pdp->xreturn+18, iflag, serr) != OK) if (swi_trop_ra2sid_lon(x2000, pdp->xreturn+6, pdp->xreturn+18, iflag) != OK)
return ERR; return ERR;
/* project onto solar system equator */ /* project onto solar system equator */
} else if (swed.sidd.sid_mode & SE_SIDBIT_SSY_PLANE) { } else if (swed.sidd.sid_mode & SE_SIDBIT_SSY_PLANE) {
if (swi_trop_ra2sid_lon_sosy(x2000, pdp->xreturn+6, pdp->xreturn+18, iflag, serr) != OK) if (swi_trop_ra2sid_lon_sosy(x2000, pdp->xreturn+6, iflag) != OK)
return ERR; return ERR;
} else { } else {
/* traditional algorithm */ /* traditional algorithm */
@ -2653,7 +2692,7 @@ static int app_pos_rest(struct plan_data *pdp, int32 iflag,
return OK; return OK;
} }
void FAR PASCAL_CONV swe_set_sid_mode(int32 sid_mode, double t0, double ayan_t0) void CALL_CONV swe_set_sid_mode(int32 sid_mode, double t0, double ayan_t0)
{ {
struct sid_data *sip = &swed.sidd; struct sid_data *sip = &swed.sidd;
swi_init_swed_if_start(); swi_init_swed_if_start();
@ -2684,7 +2723,7 @@ void FAR PASCAL_CONV swe_set_sid_mode(int32 sid_mode, double t0, double ayan_t0)
swi_force_app_pos_etc(); swi_force_app_pos_etc();
} }
int32 FAR PASCAL_CONV swe_get_ayanamsa_ex(double tjd_et, int32 iflag, double *daya, char *serr) int32 CALL_CONV swe_get_ayanamsa_ex(double tjd_et, int32 iflag, double *daya, char *serr)
{ {
double x[6], eps; double x[6], eps;
struct sid_data *sip = &swed.sidd; struct sid_data *sip = &swed.sidd;
@ -2747,7 +2786,7 @@ int32 FAR PASCAL_CONV swe_get_ayanamsa_ex(double tjd_et, int32 iflag, double *da
return iflag; return iflag;
} }
int32 FAR PASCAL_CONV swe_get_ayanamsa_ex_ut(double tjd_ut, int32 iflag, double *daya, char *serr) int32 CALL_CONV swe_get_ayanamsa_ex_ut(double tjd_ut, int32 iflag, double *daya, char *serr)
{ {
double deltat; double deltat;
int32 retflag = OK; int32 retflag = OK;
@ -2771,7 +2810,7 @@ int32 FAR PASCAL_CONV swe_get_ayanamsa_ex_ut(double tjd_ut, int32 iflag, double
* longitude of the vernal point of t referred to the * longitude of the vernal point of t referred to the
* ecliptic of t0. * ecliptic of t0.
*/ */
double FAR PASCAL_CONV swe_get_ayanamsa(double tjd_et) double CALL_CONV swe_get_ayanamsa(double tjd_et)
{ {
double daya; double daya;
int32 iflag = swi_guess_ephe_flag(); int32 iflag = swi_guess_ephe_flag();
@ -2779,7 +2818,7 @@ double FAR PASCAL_CONV swe_get_ayanamsa(double tjd_et)
return daya; return daya;
} }
double FAR PASCAL_CONV swe_get_ayanamsa_ut(double tjd_ut) double CALL_CONV swe_get_ayanamsa_ut(double tjd_ut)
{ {
double daya; double daya;
int32 iflag = swi_guess_ephe_flag(); int32 iflag = swi_guess_ephe_flag();
@ -2792,7 +2831,7 @@ double FAR PASCAL_CONV swe_get_ayanamsa_ut(double tjd_ut)
* xout ecliptical sidereal position * xout ecliptical sidereal position
* xoutr equatorial sidereal position * xoutr equatorial sidereal position
*/ */
int swi_trop_ra2sid_lon(double *xin, double *xout, double *xoutr, int32 iflag, char *serr) int swi_trop_ra2sid_lon(double *xin, double *xout, double *xoutr, int32 iflag)
{ {
double x[6]; double x[6];
int i; int i;
@ -2825,7 +2864,7 @@ int swi_trop_ra2sid_lon(double *xin, double *xout, double *xoutr, int32 iflag, c
* xout ecliptical sidereal position * xout ecliptical sidereal position
* xoutr equatorial sidereal position * xoutr equatorial sidereal position
*/ */
int swi_trop_ra2sid_lon_sosy(double *xin, double *xout, double *xoutr, int32 iflag, char *serr) int swi_trop_ra2sid_lon_sosy(double *xin, double *xout, int32 iflag)
{ {
double x[6], x0[6]; double x[6], x0[6];
int i; int i;
@ -3506,7 +3545,7 @@ static int app_pos_etc_sun(int32 iflag, char *serr)
for (i = 3; i <= 5; i++) for (i = 3; i <= 5; i++)
xx[i] = 0; xx[i] = 0;
/* ICRS to J2000 */ /* ICRS to J2000 */
if (!(iflag & SEFLG_ICRS) && (swed.jpldenum >= 403 || (iflag & SEFLG_MOSEPH))) { if (!(iflag & SEFLG_ICRS) && get_denum(SEI_SUN, iflag) >= 403) {
swi_bias(xx, t, iflag, FALSE); swi_bias(xx, t, iflag, FALSE);
}/**/ }/**/
/* save J2000 coordinates; required for sidereal positions */ /* save J2000 coordinates; required for sidereal positions */
@ -3681,7 +3720,7 @@ static int app_pos_etc_moon(int32 iflag, char *serr)
for (i = 3; i <= 5; i++) for (i = 3; i <= 5; i++)
xx[i] = 0; xx[i] = 0;
/* ICRS to J2000 */ /* ICRS to J2000 */
if (!(iflag & SEFLG_ICRS) && (swed.jpldenum >= 403 || (iflag & SEFLG_MOSEPH))) { if (!(iflag & SEFLG_ICRS) && get_denum(SEI_MOON, iflag) >= 403) {
swi_bias(xx, t, iflag, FALSE); swi_bias(xx, t, iflag, FALSE);
}/**/ }/**/
/* save J2000 coordinates; required for sidereal positions */ /* save J2000 coordinates; required for sidereal positions */
@ -3728,7 +3767,7 @@ static int app_pos_etc_sbar(int32 iflag, char *serr)
for (i = 3; i <= 5; i++) for (i = 3; i <= 5; i++)
xx[i] = 0; xx[i] = 0;
/* ICRS to J2000 */ /* ICRS to J2000 */
if (!(iflag & SEFLG_ICRS) && (swed.jpldenum >= 403 || (iflag & SEFLG_MOSEPH))) { if (!(iflag & SEFLG_ICRS) && get_denum(SEI_SUN, iflag) >= 403) {
swi_bias(xx, psdp->teval, iflag, FALSE); swi_bias(xx, psdp->teval, iflag, FALSE);
}/**/ }/**/
/* save J2000 coordinates; required for sidereal positions */ /* save J2000 coordinates; required for sidereal positions */
@ -4108,9 +4147,9 @@ static int read_const(int ifno, char *serr)
if (fread((void *) &testendian, 4, 1, fp) != 1) if (fread((void *) &testendian, 4, 1, fp) != 1)
goto file_damage; goto file_damage;
/* is byte order correct? */ /* is byte order correct? */
if (testendian == SEI_FILE_TEST_ENDIAN) if (testendian == SEI_FILE_TEST_ENDIAN) {
freord = SEI_FILE_NOREORD; freord = SEI_FILE_NOREORD;
else { } else {
freord = SEI_FILE_REORD; freord = SEI_FILE_REORD;
sp = (char *) &lng; sp = (char *) &lng;
c = (char *) &testendian; c = (char *) &testendian;
@ -4149,7 +4188,6 @@ fendian, ifno, serr);
fendian, ifno, serr); fendian, ifno, serr);
if (retc != OK) if (retc != OK)
goto return_error; goto return_error;
swed.jpldenum = fdp->sweph_denum;
/************************************* /*************************************
* start and end epoch of file * * start and end epoch of file *
*************************************/ *************************************/
@ -4994,10 +5032,10 @@ static int lunar_osc_elem(double tjd, int ipl, int32 iflag, char *serr)
if (iflag & SEFLG_SPEED) if (iflag & SEFLG_SPEED)
swi_precess_speed(x, tjd, iflag, J_TO_J2000); swi_precess_speed(x, tjd, iflag, J_TO_J2000);
if (swed.sidd.sid_mode & SE_SIDBIT_ECL_T0) if (swed.sidd.sid_mode & SE_SIDBIT_ECL_T0)
swi_trop_ra2sid_lon(x, ndp->xreturn+6, ndp->xreturn+18, iflag, NULL); swi_trop_ra2sid_lon(x, ndp->xreturn+6, ndp->xreturn+18, iflag);
/* project onto solar system equator */ /* project onto solar system equator */
else if (swed.sidd.sid_mode & SE_SIDBIT_SSY_PLANE) else if (swed.sidd.sid_mode & SE_SIDBIT_SSY_PLANE)
swi_trop_ra2sid_lon_sosy(x, ndp->xreturn+6, ndp->xreturn+18, iflag, NULL); swi_trop_ra2sid_lon_sosy(x, ndp->xreturn+6, iflag);
/* to polar */ /* to polar */
swi_cartpol_sp(ndp->xreturn+6, ndp->xreturn); swi_cartpol_sp(ndp->xreturn+6, ndp->xreturn);
swi_cartpol_sp(ndp->xreturn+18, ndp->xreturn+12); swi_cartpol_sp(ndp->xreturn+18, ndp->xreturn+12);
@ -5128,10 +5166,10 @@ static int intp_apsides(double tjd, int ipl, int32 iflag, char *serr)
if (iflag & SEFLG_SPEED) if (iflag & SEFLG_SPEED)
swi_precess_speed(x, tjd, iflag, J_TO_J2000); swi_precess_speed(x, tjd, iflag, J_TO_J2000);
if (swed.sidd.sid_mode & SE_SIDBIT_ECL_T0) if (swed.sidd.sid_mode & SE_SIDBIT_ECL_T0)
swi_trop_ra2sid_lon(x, ndp->xreturn+6, ndp->xreturn+18, iflag, NULL); swi_trop_ra2sid_lon(x, ndp->xreturn+6, ndp->xreturn+18, iflag);
/* project onto solar system equator */ /* project onto solar system equator */
else if (swed.sidd.sid_mode & SE_SIDBIT_SSY_PLANE) else if (swed.sidd.sid_mode & SE_SIDBIT_SSY_PLANE)
swi_trop_ra2sid_lon_sosy(x, ndp->xreturn+6, ndp->xreturn+18, iflag, NULL); swi_trop_ra2sid_lon_sosy(x, ndp->xreturn+6, iflag);
/* to polar */ /* to polar */
swi_cartpol_sp(ndp->xreturn+6, ndp->xreturn); swi_cartpol_sp(ndp->xreturn+6, ndp->xreturn);
swi_cartpol_sp(ndp->xreturn+18, ndp->xreturn+12); swi_cartpol_sp(ndp->xreturn+18, ndp->xreturn+12);
@ -5215,7 +5253,7 @@ int swi_plan_for_osc_elem(int32 iflag, double tjd, double *xx)
struct epsilon *oe = &swed.oec; struct epsilon *oe = &swed.oec;
struct epsilon oectmp; struct epsilon oectmp;
/* ICRS to J2000 */ /* ICRS to J2000 */
if (!(iflag & SEFLG_ICRS) && (swed.jpldenum >= 403 || (iflag & SEFLG_MOSEPH))) { if (!(iflag & SEFLG_ICRS) && get_denum(SEI_SUN, iflag) >= 403) {
swi_bias(xx, tjd, iflag, FALSE); swi_bias(xx, tjd, iflag, FALSE);
}/**/ }/**/
/************************************************ /************************************************
@ -5305,7 +5343,7 @@ int swi_plan_for_osc_elem(int32 iflag, double tjd, double *xx)
return(OK); return(OK);
} }
static const struct meff_ele FAR eff_arr[] = { static const struct meff_ele eff_arr[] = {
/* /*
* r , m_eff for photon passing the sun at min distance r (fraction of Rsun) * r , m_eff for photon passing the sun at min distance r (fraction of Rsun)
* the values where computed with sun_model.c, which is a classic * the values where computed with sun_model.c, which is a classic
@ -5482,7 +5520,7 @@ void swi_check_ecliptic(double tjd, int32 iflag)
void swi_check_nutation(double tjd, int32 iflag) void swi_check_nutation(double tjd, int32 iflag)
{ {
int32 speedf1, speedf2; int32 speedf1, speedf2;
static int32 nutflag = 0; static TLS int32 nutflag = 0;
double t; double t;
speedf1 = nutflag & SEFLG_SPEED; speedf1 = nutflag & SEFLG_SPEED;
speedf2 = iflag & SEFLG_SPEED; speedf2 = iflag & SEFLG_SPEED;
@ -5608,7 +5646,7 @@ static int32 plaus_iflag(int32 iflag, int32 ipl, double tjd, char *serr)
* x pointer for returning the ecliptic coordinates * x pointer for returning the ecliptic coordinates
* serr error return string * serr error return string
**********************************************************/ **********************************************************/
int32 FAR PASCAL_CONV swe_fixstar(char *star, double tjd, int32 iflag, int32 CALL_CONV swe_fixstar(char *star, double tjd, int32 iflag,
double *xx, char *serr) double *xx, char *serr)
{ {
int i; int i;
@ -5620,8 +5658,8 @@ int32 FAR PASCAL_CONV swe_fixstar(char *star, double tjd, int32 iflag,
char *cpos[20]; char *cpos[20];
char sstar[SE_MAX_STNAME + 1]; char sstar[SE_MAX_STNAME + 1];
char fstar[SE_MAX_STNAME + 1]; char fstar[SE_MAX_STNAME + 1];
static char slast_stardata[AS_MAXCH]; static TLS char slast_stardata[AS_MAXCH];
static char slast_starname[AS_MAXCH]; static TLS char slast_starname[AS_MAXCH];
char s[AS_MAXCH + 20], *sp, *sp2; /* 20 byte for SE_STARFILE */ char s[AS_MAXCH + 20], *sp, *sp2; /* 20 byte for SE_STARFILE */
double ra_s, ra_pm, de_pm, ra, de, t, cosra, cosde, sinra, sinde; double ra_s, ra_pm, de_pm, ra, de, t, cosra, cosde, sinra, sinde;
double ra_h, ra_m, de_d, de_m, de_s; double ra_h, ra_m, de_d, de_m, de_s;
@ -5879,7 +5917,7 @@ int32 FAR PASCAL_CONV swe_fixstar(char *star, double tjd, int32 iflag,
if (epoch != 0) { if (epoch != 0) {
swi_icrs2fk5(x, iflag, TRUE); /* backward, i. e. to icrf */ swi_icrs2fk5(x, iflag, TRUE); /* backward, i. e. to icrf */
/* with ephemerides < DE403, we now convert to J2000 */ /* with ephemerides < DE403, we now convert to J2000 */
if (swed.jpldenum < 403) { if (get_denum(SEI_SUN, iflag) >= 403) {
swi_bias(x, J2000, SEFLG_SPEED, FALSE); swi_bias(x, J2000, SEFLG_SPEED, FALSE);
} }
} }
@ -5966,7 +6004,7 @@ int32 FAR PASCAL_CONV swe_fixstar(char *star, double tjd, int32 iflag,
if ((iflag & SEFLG_TRUEPOS) == 0 && (iflag & SEFLG_NOABERR) == 0) if ((iflag & SEFLG_TRUEPOS) == 0 && (iflag & SEFLG_NOABERR) == 0)
swi_aberr_light(x, xpo, iflag & SEFLG_SPEED); swi_aberr_light(x, xpo, iflag & SEFLG_SPEED);
/* ICRS to J2000 */ /* ICRS to J2000 */
if (!(iflag & SEFLG_ICRS) && (swed.jpldenum >= 403 || (iflag & SEFLG_MOSEPH) || (iflag & SEFLG_BARYCTR))) { if (!(iflag & SEFLG_ICRS) && (get_denum(SEI_SUN, iflag) >= 403 || (iflag & SEFLG_BARYCTR))) {
swi_bias(x, tjd, iflag, FALSE); swi_bias(x, tjd, iflag, FALSE);
}/**/ }/**/
/* save J2000 coordinates; required for sidereal positions */ /* save J2000 coordinates; required for sidereal positions */
@ -6027,14 +6065,14 @@ if (0) {
if (iflag & SEFLG_SIDEREAL) { if (iflag & SEFLG_SIDEREAL) {
/* rigorous algorithm */ /* rigorous algorithm */
if (swed.sidd.sid_mode & SE_SIDBIT_ECL_T0) { if (swed.sidd.sid_mode & SE_SIDBIT_ECL_T0) {
if (swi_trop_ra2sid_lon(xxsv, x, xxsv, iflag, serr) != OK) if (swi_trop_ra2sid_lon(xxsv, x, xxsv, iflag) != OK)
goto return_err; goto return_err;
if (iflag & SEFLG_EQUATORIAL) if (iflag & SEFLG_EQUATORIAL)
for (i = 0; i <= 5; i++) for (i = 0; i <= 5; i++)
x[i] = xxsv[i]; x[i] = xxsv[i];
/* project onto solar system equator */ /* project onto solar system equator */
} else if (swed.sidd.sid_mode & SE_SIDBIT_SSY_PLANE) { } else if (swed.sidd.sid_mode & SE_SIDBIT_SSY_PLANE) {
if (swi_trop_ra2sid_lon_sosy(xxsv, x, xxsv, iflag, serr) != OK) if (swi_trop_ra2sid_lon_sosy(xxsv, x, iflag) != OK)
return ERR; return ERR;
if (iflag & SEFLG_EQUATORIAL) if (iflag & SEFLG_EQUATORIAL)
for (i = 0; i <= 5; i++) for (i = 0; i <= 5; i++)
@ -6081,12 +6119,14 @@ if (0) {
return retc; return retc;
} }
int32 FAR PASCAL_CONV swe_fixstar_ut(char *star, double tjd_ut, int32 iflag, int32 CALL_CONV swe_fixstar_ut(char *star, double tjd_ut, int32 iflag,
double *xx, char *serr) double *xx, char *serr)
{ {
double deltat; double deltat;
int32 retflag; int32 retflag;
int32 epheflag = iflag & SEFLG_EPHMASK; int32 epheflag = 0;
iflag = plaus_iflag(iflag, -1, tjd_ut, serr);
epheflag = iflag & SEFLG_EPHMASK;
if (epheflag == 0) { if (epheflag == 0) {
epheflag = SEFLG_SWIEPH; epheflag = SEFLG_SWIEPH;
iflag |= SEFLG_SWIEPH; iflag |= SEFLG_SWIEPH;
@ -6112,7 +6152,7 @@ int32 FAR PASCAL_CONV swe_fixstar_ut(char *star, double tjd_ut, int32 iflag,
* mag pointer to a double, for star magnitude * mag pointer to a double, for star magnitude
* serr error return string * serr error return string
**********************************************************/ **********************************************************/
int32 FAR PASCAL_CONV swe_fixstar_mag(char *star, double *mag, char *serr) int32 CALL_CONV swe_fixstar_mag(char *star, double *mag, char *serr)
{ {
int i; int i;
int star_nr = 0; int star_nr = 0;
@ -6238,7 +6278,7 @@ int32 FAR PASCAL_CONV swe_fixstar_mag(char *star, double *mag, char *serr)
} }
#if 0 #if 0
int swe_fixstar(char *star, double tjd, int32 iflag, double *xx, char *serr) int CALL_CONV swe_fixstar(char *star, double tjd, int32 iflag, double *xx, char *serr)
{ {
int i, j; int i, j;
int32 iflgcoor = SEFLG_EQUATORIAL | SEFLG_XYZ | SEFLG_RADIANS; int32 iflgcoor = SEFLG_EQUATORIAL | SEFLG_XYZ | SEFLG_RADIANS;
@ -6277,7 +6317,7 @@ int swe_fixstar(char *star, double tjd, int32 iflag, double *xx, char *serr)
#endif #endif
char *FAR PASCAL_CONV swe_get_planet_name(int ipl, char *s) char *CALL_CONV swe_get_planet_name(int ipl, char *s)
{ {
int i; int i;
int32 retc; int32 retc;
@ -6286,6 +6326,7 @@ char *FAR PASCAL_CONV swe_get_planet_name(int ipl, char *s)
swi_open_trace(NULL); swi_open_trace(NULL);
trace_swe_get_planet_name(1, ipl, s); trace_swe_get_planet_name(1, ipl, s);
#endif #endif
swi_init_swed_if_start();
/* function calls for Pluto with asteroid number 134340 /* function calls for Pluto with asteroid number 134340
* are treated as calls for Pluto as main body SE_PLUTO */ * are treated as calls for Pluto as main body SE_PLUTO */
if (ipl == SE_AST_OFFSET + 134340) if (ipl == SE_AST_OFFSET + 134340)
@ -6452,7 +6493,7 @@ char *FAR PASCAL_CONV swe_get_planet_name(int ipl, char *s)
return s; return s;
} }
char *FAR PASCAL_CONV swe_get_ayanamsa_name(int32 isidmode) const char *CALL_CONV swe_get_ayanamsa_name(int32 isidmode)
{ {
isidmode %= SE_SIDBITS; isidmode %= SE_SIDBITS;
if (isidmode < SE_NSIDM_PREDEF) if (isidmode < SE_NSIDM_PREDEF)
@ -6574,7 +6615,7 @@ static void trace_swe_get_planet_name(int swtch, int ipl, char *s)
#endif #endif
/* set geographic position and altitude of observer */ /* set geographic position and altitude of observer */
void FAR PASCAL_CONV swe_set_topo(double geolon, double geolat, double geoalt) void CALL_CONV swe_set_topo(double geolon, double geolat, double geoalt)
{ {
swi_init_swed_if_start(); swi_init_swed_if_start();
swed.topd.geolon = geolon; swed.topd.geolon = geolon;
@ -6705,7 +6746,7 @@ int swi_get_observer(double tjd, int32 iflag,
* E = LAT - LMT * E = LAT - LMT
* Input variable tjd is UT. * Input variable tjd is UT.
*/ */
int32 FAR PASCAL_CONV swe_time_equ(double tjd_ut, double *E, char *serr) int32 CALL_CONV swe_time_equ(double tjd_ut, double *E, char *serr)
{ {
int32 retval; int32 retval;
double t, dt, x[6]; double t, dt, x[6];
@ -6733,7 +6774,7 @@ int32 FAR PASCAL_CONV swe_time_equ(double tjd_ut, double *E, char *serr)
return OK; return OK;
} }
int32 FAR PASCAL_CONV swe_lmt_to_lat(double tjd_lmt, double geolon, double *tjd_lat, char *serr) int32 CALL_CONV swe_lmt_to_lat(double tjd_lmt, double geolon, double *tjd_lat, char *serr)
{ {
int32 retval; int32 retval;
double E, tjd_lmt0; double E, tjd_lmt0;
@ -6743,7 +6784,7 @@ int32 FAR PASCAL_CONV swe_lmt_to_lat(double tjd_lmt, double geolon, double *tjd_
return retval; return retval;
} }
int32 FAR PASCAL_CONV swe_lat_to_lmt(double tjd_lat, double geolon, double *tjd_lmt, char *serr) int32 CALL_CONV swe_lat_to_lmt(double tjd_lat, double geolon, double *tjd_lmt, char *serr)
{ {
int32 retval; int32 retval;
double E, tjd_lmt0; double E, tjd_lmt0;
@ -6791,7 +6832,7 @@ static int open_jpl_file(double *ss, char *fname, char *fpath, char *serr)
} }
#if 0 #if 0
void FAR PASCAL_CONV swe_set_timeout(int32 tsec) void CALL_CONV swe_set_timeout(int32 tsec)
{ {
if (tsec < 0) tsec = 0; if (tsec < 0) tsec = 0;
swed.timeout = tsec; swed.timeout = tsec;
@ -6799,7 +6840,7 @@ void FAR PASCAL_CONV swe_set_timeout(int32 tsec)
#endif #endif
#if 0 #if 0
int FAR PASCAL_CONV swe_time_equ(double tjd_ut, double *E, char *serr) int CALL_CONV swe_time_equ(double tjd_ut, double *E, char *serr)
/* Algorithm according to Meeus, German, p. 190ff.*/ /* Algorithm according to Meeus, German, p. 190ff.*/
double L0, dpsi, eps, x[6], nutlo[2]; double L0, dpsi, eps, x[6], nutlo[2];
double tau = (tjd - J2000) / 365250; double tau = (tjd - J2000) / 365250;

View File

@ -63,7 +63,7 @@
* move over from swephexp.h * move over from swephexp.h
*/ */
#define SE_VERSION "2.02.01" #define SE_VERSION "2.04"
#define J2000 2451545.0 /* 2000 January 1.5 */ #define J2000 2451545.0 /* 2000 January 1.5 */
#define B1950 2433282.42345905 /* 1950 January 0.923 */ #define B1950 2433282.42345905 /* 1950 January 0.923 */
@ -600,4 +600,4 @@ struct swe_data {
int32 timeout; int32 timeout;
}; };
extern struct swe_data FAR swed; extern TLS struct swe_data swed;

View File

@ -551,16 +551,10 @@ extern "C" {
#if defined(DOS32) || !MSDOS || defined(WIN32) #if defined(DOS32) || !MSDOS || defined(WIN32)
/* use compiler switch to define DOS32 */ /* use compiler switch to define DOS32 */
# ifndef FAR
# define FAR
# endif
# define MALLOC malloc # define MALLOC malloc
# define CALLOC calloc # define CALLOC calloc
# define FREE free # define FREE free
#else #else
# ifndef FAR
# define FAR far
# endif
# ifdef __BORLANDC__ # ifdef __BORLANDC__
# include <alloc.h> # include <alloc.h>
# define MALLOC farmalloc # define MALLOC farmalloc
@ -575,10 +569,10 @@ extern "C" {
/* DLL defines */ /* DLL defines */
#ifdef MAKE_DLL #ifdef MAKE_DLL
#if defined (PASCAL) #if defined (PASCAL) || defined(__stdcall)
#define PASCAL_CONV PASCAL #define CALL_CONV __stdcall
#else #else
#define PASCAL_CONV #define CALL_CONV
#endif #endif
#ifdef MAKE_DLL16 /* 16bit DLL */ #ifdef MAKE_DLL16 /* 16bit DLL */
/* We compiled the 16bit DLL for Windows 3.x using Borland C/C++ Ver:3.x /* We compiled the 16bit DLL for Windows 3.x using Borland C/C++ Ver:3.x
@ -592,7 +586,7 @@ extern "C" {
#define EXP32 __declspec( dllexport ) #define EXP32 __declspec( dllexport )
#endif #endif
#else #else
#define PASCAL_CONV #define CALL_CONV
#define EXP16 #define EXP16
#define EXP32 #define EXP32
#endif #endif
@ -603,7 +597,7 @@ extern "C" {
* exported functions * exported functions
***********************************************************/ ***********************************************************/
#define ext_def(x) extern EXP32 x FAR PASCAL_CONV EXP16 #define ext_def(x) extern EXP32 x CALL_CONV EXP16
/* ext_def(x) evaluates to x on Unix */ /* ext_def(x) evaluates to x on Unix */
ext_def(int32) swe_heliacal_ut(double tjdstart_ut, double *geopos, double *datm, double *dobs, char *ObjectName, int32 TypeEvent, int32 iflag, double *dret, char *serr); ext_def(int32) swe_heliacal_ut(double tjdstart_ut, double *geopos, double *datm, double *dobs, char *ObjectName, int32 TypeEvent, int32 iflag, double *dret, char *serr);
@ -669,7 +663,7 @@ 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(const char *) swe_get_ayanamsa_name(int32 isidmode);
/*ext_def(void) swe_set_timeout(int32 tsec);*/ /*ext_def(void) swe_set_timeout(int32 tsec);*/

View File

@ -84,9 +84,9 @@
#ifdef TRACE #ifdef TRACE
void swi_open_trace(char *serr); void swi_open_trace(char *serr);
FILE *swi_fp_trace_c = NULL; TLS FILE *swi_fp_trace_c = NULL;
FILE *swi_fp_trace_out = NULL; TLS FILE *swi_fp_trace_out = NULL;
int32 swi_trace_count = 0; TLS int32 swi_trace_count = 0;
#endif #endif
static void init_crc32(void); static void init_crc32(void);
@ -101,7 +101,7 @@ static double deltat_aa(double tjd, double tid_acc);
/* Reduce x modulo 360 degrees /* Reduce x modulo 360 degrees
*/ */
double FAR PASCAL_CONV swe_degnorm(double x) double CALL_CONV swe_degnorm(double x)
{ {
double y; double y;
y = fmod(x, 360.0); y = fmod(x, 360.0);
@ -112,7 +112,7 @@ double FAR PASCAL_CONV swe_degnorm(double x)
/* Reduce x modulo TWOPI degrees /* Reduce x modulo TWOPI degrees
*/ */
double FAR PASCAL_CONV swe_radnorm(double x) double CALL_CONV swe_radnorm(double x)
{ {
double y; double y;
y = fmod(x, TWOPI); y = fmod(x, TWOPI);
@ -121,7 +121,7 @@ double FAR PASCAL_CONV swe_radnorm(double x)
return(y); return(y);
} }
double FAR PASCAL_CONV swe_deg_midp(double x1, double x0) double CALL_CONV swe_deg_midp(double x1, double x0)
{ {
double d, y; double d, y;
d = swe_difdeg2n(x1, x0); /* arc from x0 to x1 */ d = swe_difdeg2n(x1, x0); /* arc from x0 to x1 */
@ -129,7 +129,7 @@ double FAR PASCAL_CONV swe_deg_midp(double x1, double x0)
return(y); return(y);
} }
double FAR PASCAL_CONV swe_rad_midp(double x1, double x0) double CALL_CONV swe_rad_midp(double x1, double x0)
{ {
return DEGTORAD * swe_deg_midp(x1 * RADTODEG, x0 * RADTODEG); return DEGTORAD * swe_deg_midp(x1 * RADTODEG, x0 * RADTODEG);
} }
@ -218,7 +218,7 @@ double swi_edcheb(double x, double *coef, int ncf)
* xpo, xpn are arrays of 3 doubles containing position. * xpo, xpn are arrays of 3 doubles containing position.
* attention: input must be in degrees! * attention: input must be in degrees!
*/ */
void FAR PASCAL_CONV swe_cotrans(double *xpo, double *xpn, double eps) void CALL_CONV swe_cotrans(double *xpo, double *xpn, double eps)
{ {
int i; int i;
double x[6], e = eps * DEGTORAD; double x[6], e = eps * DEGTORAD;
@ -246,7 +246,7 @@ void FAR PASCAL_CONV swe_cotrans(double *xpo, double *xpn, double eps)
* xpo, xpn are arrays of 6 doubles containing position and speed. * xpo, xpn are arrays of 6 doubles containing position and speed.
* attention: input must be in degrees! * attention: input must be in degrees!
*/ */
void FAR PASCAL_CONV swe_cotrans_sp(double *xpo, double *xpn, double eps) void CALL_CONV swe_cotrans_sp(double *xpo, double *xpn, double eps)
{ {
int i; int i;
double x[6], e = eps * DEGTORAD; double x[6], e = eps * DEGTORAD;
@ -465,7 +465,7 @@ double swi_dot_prod_unit(double *x, double *y)
/* for pre_peps(): */ /* for pre_peps(): */
/* polynomials */ /* polynomials */
static double pepol[NPOL_PEPS][2] = { static const double pepol[NPOL_PEPS][2] = {
{+8134.017132, +84028.206305}, {+8134.017132, +84028.206305},
{+5043.0520035, +0.3624445}, {+5043.0520035, +0.3624445},
{-0.00710733, -0.00004039}, {-0.00710733, -0.00004039},
@ -473,7 +473,7 @@ static double pepol[NPOL_PEPS][2] = {
}; };
/* periodics */ /* periodics */
static double peper[5][NPER_PEPS] = { static const double peper[5][NPER_PEPS] = {
{+409.90, +396.15, +537.22, +402.90, +417.15, +288.92, +4043.00, +306.00, +277.00, +203.00}, {+409.90, +396.15, +537.22, +402.90, +417.15, +288.92, +4043.00, +306.00, +277.00, +203.00},
{-6908.287473, -3198.706291, +1453.674527, -857.748557, +1173.231614, -156.981465, +371.836550, -216.619040, +193.691479, +11.891524}, {-6908.287473, -3198.706291, +1453.674527, -857.748557, +1173.231614, -156.981465, +371.836550, -216.619040, +193.691479, +11.891524},
{+753.872780, -247.805823, +379.471484, -53.880558, -90.109153, -353.600190, -63.115353, -28.248187, +17.703387, +38.911307}, {+753.872780, -247.805823, +379.471484, -53.880558, -90.109153, -353.600190, -63.115353, -28.248187, +17.703387, +38.911307},
@ -483,7 +483,7 @@ static double peper[5][NPER_PEPS] = {
/* for pre_pecl(): */ /* for pre_pecl(): */
/* polynomials */ /* polynomials */
static double pqpol[NPOL_PECL][2] = { static const double pqpol[NPOL_PECL][2] = {
{+5851.607687, -1600.886300}, {+5851.607687, -1600.886300},
{-0.1189000, +1.1689818}, {-0.1189000, +1.1689818},
{-0.00028913, -0.00000020}, {-0.00028913, -0.00000020},
@ -491,7 +491,7 @@ static double pqpol[NPOL_PECL][2] = {
}; };
/* periodics */ /* periodics */
static double pqper[5][NPER_PECL] = { static const double pqper[5][NPER_PECL] = {
{708.15, 2309, 1620, 492.2, 1183, 622, 882, 547}, {708.15, 2309, 1620, 492.2, 1183, 622, 882, 547},
{-5486.751211, -17.127623, -617.517403, 413.44294, 78.614193, -180.732815, -87.676083, 46.140315}, {-5486.751211, -17.127623, -617.517403, 413.44294, 78.614193, -180.732815, -87.676083, 46.140315},
{-684.66156, 2446.28388, 399.671049, -356.652376, -186.387003, -316.80007, 198.296701, 101.135679}, /* typo in publication fixed */ {-684.66156, 2446.28388, 399.671049, -356.652376, -186.387003, -316.80007, 198.296701, 101.135679}, /* typo in publication fixed */
@ -501,7 +501,7 @@ static double pqper[5][NPER_PECL] = {
/* for pre_pequ(): */ /* for pre_pequ(): */
/* polynomials */ /* polynomials */
static double xypol[NPOL_PEQU][2] = { static const double xypol[NPOL_PEQU][2] = {
{+5453.282155, -73750.930350}, {+5453.282155, -73750.930350},
{+0.4252841, -0.7675452}, {+0.4252841, -0.7675452},
{-0.00037173, -0.00018725}, {-0.00037173, -0.00018725},
@ -509,7 +509,7 @@ static double xypol[NPOL_PEQU][2] = {
}; };
/* periodics */ /* periodics */
static double xyper[5][NPER_PEQU] = { static const double xyper[5][NPER_PEQU] = {
{256.75, 708.15, 274.2, 241.45, 2309, 492.2, 396.1, 288.9, 231.1, 1610, 620, 157.87, 220.3, 1200}, {256.75, 708.15, 274.2, 241.45, 2309, 492.2, 396.1, 288.9, 231.1, 1610, 620, 157.87, 220.3, 1200},
{-819.940624, -8444.676815, 2600.009459, 2755.17563, -167.659835, 871.855056, 44.769698, -512.313065, -819.415595, -538.071099, -189.793622, -402.922932, 179.516345, -9.814756}, {-819.940624, -8444.676815, 2600.009459, 2755.17563, -167.659835, 871.855056, 44.769698, -512.313065, -819.415595, -538.071099, -189.793622, -402.922932, 179.516345, -9.814756},
{75004.344875, 624.033993, 1251.136893, -1102.212834, -2660.66498, 699.291817, 153.16722, -950.865637, 499.754645, -145.18821, 558.116553, -23.923029, -165.405086, 9.344131}, {75004.344875, 624.033993, 1251.136893, -1102.212834, -2660.66498, 699.291817, 153.16722, -950.865637, 499.754645, -145.18821, 558.116553, -23.923029, -165.405086, 9.344131},
@ -891,46 +891,46 @@ static int precess_1(double *R, double J, int direction, int prec_method)
is the same except for the lower order terms. */ is the same except for the lower order terms. */
/* SEMOD_PREC_WILLIAMS_1994 */ /* SEMOD_PREC_WILLIAMS_1994 */
static double pAcof_williams[] = { static const double pAcof_williams[] = {
-8.66e-10, -4.759e-8, 2.424e-7, 1.3095e-5, 1.7451e-4, -1.8055e-3, -8.66e-10, -4.759e-8, 2.424e-7, 1.3095e-5, 1.7451e-4, -1.8055e-3,
-0.235316, 0.076, 110.5407, 50287.70000 }; -0.235316, 0.076, 110.5407, 50287.70000 };
static double nodecof_williams[] = { static const double nodecof_williams[] = {
6.6402e-16, -2.69151e-15, -1.547021e-12, 7.521313e-12, 1.9e-10, 6.6402e-16, -2.69151e-15, -1.547021e-12, 7.521313e-12, 1.9e-10,
-3.54e-9, -1.8103e-7, 1.26e-7, 7.436169e-5, -3.54e-9, -1.8103e-7, 1.26e-7, 7.436169e-5,
-0.04207794833, 3.052115282424}; -0.04207794833, 3.052115282424};
static double inclcof_williams[] = { static const double inclcof_williams[] = {
1.2147e-16, 7.3759e-17, -8.26287e-14, 2.503410e-13, 2.4650839e-11, 1.2147e-16, 7.3759e-17, -8.26287e-14, 2.503410e-13, 2.4650839e-11,
-5.4000441e-11, 1.32115526e-9, -6.012e-7, -1.62442e-5, -5.4000441e-11, 1.32115526e-9, -6.012e-7, -1.62442e-5,
0.00227850649, 0.0 }; 0.00227850649, 0.0 };
/* SEMOD_PREC_SIMON_1994 */ /* SEMOD_PREC_SIMON_1994 */
/* Precession coefficients from Simon et al: */ /* Precession coefficients from Simon et al: */
static double pAcof_simon[] = { static const double pAcof_simon[] = {
-8.66e-10, -4.759e-8, 2.424e-7, 1.3095e-5, 1.7451e-4, -1.8055e-3, -8.66e-10, -4.759e-8, 2.424e-7, 1.3095e-5, 1.7451e-4, -1.8055e-3,
-0.235316, 0.07732, 111.2022, 50288.200 }; -0.235316, 0.07732, 111.2022, 50288.200 };
static double nodecof_simon[] = { static const double nodecof_simon[] = {
6.6402e-16, -2.69151e-15, -1.547021e-12, 7.521313e-12, 1.9e-10, 6.6402e-16, -2.69151e-15, -1.547021e-12, 7.521313e-12, 1.9e-10,
-3.54e-9, -1.8103e-7, 2.579e-8, 7.4379679e-5, -3.54e-9, -1.8103e-7, 2.579e-8, 7.4379679e-5,
-0.0420782900, 3.0521126906}; -0.0420782900, 3.0521126906};
static double inclcof_simon[] = { static const double inclcof_simon[] = {
1.2147e-16, 7.3759e-17, -8.26287e-14, 2.503410e-13, 2.4650839e-11, 1.2147e-16, 7.3759e-17, -8.26287e-14, 2.503410e-13, 2.4650839e-11,
-5.4000441e-11, 1.32115526e-9, -5.99908e-7, -1.624383e-5, -5.4000441e-11, 1.32115526e-9, -5.99908e-7, -1.624383e-5,
0.002278492868, 0.0 }; 0.002278492868, 0.0 };
/* SEMOD_PREC_LASKAR_1986 */ /* SEMOD_PREC_LASKAR_1986 */
/* Precession coefficients taken from Laskar's paper: */ /* Precession coefficients taken from Laskar's paper: */
static double pAcof_laskar[] = { static const double pAcof_laskar[] = {
-8.66e-10, -4.759e-8, 2.424e-7, 1.3095e-5, 1.7451e-4, -1.8055e-3, -8.66e-10, -4.759e-8, 2.424e-7, 1.3095e-5, 1.7451e-4, -1.8055e-3,
-0.235316, 0.07732, 111.1971, 50290.966 }; -0.235316, 0.07732, 111.1971, 50290.966 };
/* Node and inclination of the earth's orbit computed from /* Node and inclination of the earth's orbit computed from
* Laskar's data as done in Bretagnon and Francou's paper. * Laskar's data as done in Bretagnon and Francou's paper.
* Units are radians. * Units are radians.
*/ */
static double nodecof_laskar[] = { static const double nodecof_laskar[] = {
6.6402e-16, -2.69151e-15, -1.547021e-12, 7.521313e-12, 6.3190131e-10, 6.6402e-16, -2.69151e-15, -1.547021e-12, 7.521313e-12, 6.3190131e-10,
-3.48388152e-9, -1.813065896e-7, 2.75036225e-8, 7.4394531426e-5, -3.48388152e-9, -1.813065896e-7, 2.75036225e-8, 7.4394531426e-5,
-0.042078604317, 3.052112654975 }; -0.042078604317, 3.052112654975 };
static double inclcof_laskar[] = { static const double inclcof_laskar[] = {
1.2147e-16, 7.3759e-17, -8.26287e-14, 2.503410e-13, 2.4650839e-11, 1.2147e-16, 7.3759e-17, -8.26287e-14, 2.503410e-13, 2.4650839e-11,
-5.4000441e-11, 1.32115526e-9, -5.998737027e-7, -1.6242797091e-5, -5.4000441e-11, 1.32115526e-9, -5.998737027e-7, -1.6242797091e-5,
0.002278495537, 0.0 }; 0.002278495537, 0.0 };
@ -941,9 +941,9 @@ static int precess_2(double *R, double J, int32 iflag, int direction, int prec_m
double T, z; double T, z;
double eps, sineps, coseps; double eps, sineps, coseps;
double x[3]; double x[3];
double *p; const double *p;
double A, B, pA, W; double A, B, pA, W;
double *pAcof, *inclcof, *nodecof; const double *pAcof, *inclcof, *nodecof;
if( J == J2000 ) if( J == J2000 )
return(0); return(0);
if (prec_method == SEMOD_PREC_LASKAR_1986) { if (prec_method == SEMOD_PREC_LASKAR_1986) {
@ -1181,7 +1181,7 @@ int swi_precess(double *R, double J, int32 iflag, int direction )
* .0123 .0880 .0224 .0905 * .0123 .0880 .0224 .0905
* .0386 .1808 .0895 .1129 * .0386 .1808 .0895 .1129
*/ */
static short FAR nt[] = { static const short nt[] = {
/* LS and OC are units of 0.0001" /* LS and OC are units of 0.0001"
*LS2 and OC2 are units of 0.00001" *LS2 and OC2 are units of 0.00001"
*MM,MS,FF,DD,OM, LS, LS2,OC, OC2 */ *MM,MS,FF,DD,OM, LS, LS2,OC, OC2 */
@ -1320,7 +1320,7 @@ static int swi_nutation_iau1980(double J, double *nutlo)
double C, D; double C, D;
int i, j, k, k1, m, n; int i, j, k, k1, m, n;
int ns[5]; int ns[5];
short *p; const short *p;
int nut_model = swed.astro_models[SE_MODEL_NUT]; int nut_model = swed.astro_models[SE_MODEL_NUT];
if (nut_model == 0) nut_model = SEMOD_NUT_DEFAULT; if (nut_model == 0) nut_model = SEMOD_NUT_DEFAULT;
/* Julian centuries from 2000 January 1.5, /* Julian centuries from 2000 January 1.5,
@ -2024,7 +2024,7 @@ void swi_icrs2fk5(double *x, int32 iflag, AS_BOOL backward)
#define TABSIZ (TABEND-TABSTART+1) #define TABSIZ (TABEND-TABSTART+1)
/* we make the table greater for additional values read from external file */ /* we make the table greater for additional values read from external file */
#define TABSIZ_SPACE (TABSIZ+100) #define TABSIZ_SPACE (TABSIZ+100)
static double FAR dt[TABSIZ_SPACE] = { static TLS double dt[TABSIZ_SPACE] = {
/* 1620.0 thru 1659.0 */ /* 1620.0 thru 1659.0 */
124.00, 119.00, 115.00, 110.00, 106.00, 102.00, 98.00, 95.00, 91.00, 88.00, 124.00, 119.00, 115.00, 110.00, 106.00, 102.00, 98.00, 95.00, 91.00, 88.00,
85.00, 82.00, 79.00, 77.00, 74.00, 72.00, 70.00, 67.00, 65.00, 63.00, 85.00, 82.00, 79.00, 77.00, 74.00, 72.00, 70.00, 67.00, 65.00, 63.00,
@ -2089,7 +2089,7 @@ static double FAR dt[TABSIZ_SPACE] = {
#define LTERM_EQUATION_YSTART 1820 #define LTERM_EQUATION_YSTART 1820
#define LTERM_EQUATION_COEFF 32 #define LTERM_EQUATION_COEFF 32
/* Table for -1000 through 1600, from Morrison & Stephenson (2004). */ /* Table for -1000 through 1600, from Morrison & Stephenson (2004). */
static short FAR dt2[TAB2_SIZ] = { static const short dt2[TAB2_SIZ] = {
/*-1000 -900 -800 -700 -600 -500 -400 -300 -200 -100*/ /*-1000 -900 -800 -700 -600 -500 -400 -300 -200 -100*/
25400,23700,22000,21000,19040,17190,15530,14080,12790,11640, 25400,23700,22000,21000,19040,17190,15530,14080,12790,11640,
/* 0 100 200 300 400 500 600 700 800 900*/ /* 0 100 200 300 400 500 600 700 800 900*/
@ -2204,14 +2204,14 @@ static int32 calc_deltat(double tjd, int32 iflag, double *deltat, char *serr)
return iflag; return iflag;
} }
double FAR PASCAL_CONV swe_deltat_ex(double tjd, int32 iflag, char *serr) double CALL_CONV swe_deltat_ex(double tjd, int32 iflag, char *serr)
{ {
double deltat; double deltat;
calc_deltat(tjd, iflag, &deltat, serr); calc_deltat(tjd, iflag, &deltat, serr);
return deltat; return deltat;
} }
double FAR PASCAL_CONV swe_deltat(double tjd) double CALL_CONV swe_deltat(double tjd)
{ {
int32 iflag = swi_guess_ephe_flag(); int32 iflag = swi_guess_ephe_flag();
return swe_deltat_ex(tjd, iflag, NULL); /* with default tidal acceleration/default ephemeris */ return swe_deltat_ex(tjd, iflag, NULL); /* with default tidal acceleration/default ephemeris */
@ -2475,7 +2475,7 @@ static double adjust_for_tidacc(double ans, double Y, double tid_acc)
} }
/* returns tidal acceleration used in swe_deltat() and swe_deltat_ex() */ /* returns tidal acceleration used in swe_deltat() and swe_deltat_ex() */
double FAR PASCAL_CONV swe_get_tid_acc() double CALL_CONV swe_get_tid_acc()
{ {
return swed.tid_acc; return swed.tid_acc;
} }
@ -2486,7 +2486,7 @@ double FAR PASCAL_CONV swe_get_tid_acc()
* of the Moon will be set consistent with that ephemeris. * of the Moon will be set consistent with that ephemeris.
* - SE_TIDAL_AUTOMATIC, * - SE_TIDAL_AUTOMATIC,
*/ */
void FAR PASCAL_CONV swe_set_tid_acc(double t_acc) void CALL_CONV swe_set_tid_acc(double t_acc)
{ {
if (t_acc == SE_TIDAL_AUTOMATIC) { if (t_acc == SE_TIDAL_AUTOMATIC) {
swed.tid_acc = SE_TIDAL_DEFAULT; swed.tid_acc = SE_TIDAL_DEFAULT;
@ -2576,10 +2576,11 @@ int32 swi_get_tid_acc(double tjd_ut, int32 iflag, int32 denum, int32 *denumret,
int32 swi_set_tid_acc(double tjd_ut, int32 iflag, int32 denum, char *serr) int32 swi_set_tid_acc(double tjd_ut, int32 iflag, int32 denum, char *serr)
{ {
int32 retc = iflag; int32 retc = iflag;
int32 denumret;
/* manual tid_acc overrides automatic tid_acc */ /* manual tid_acc overrides automatic tid_acc */
if (swed.is_tid_acc_manual) if (swed.is_tid_acc_manual)
return retc; return retc;
retc = swi_get_tid_acc(tjd_ut, iflag, denum, &(swed.jpldenum), &(swed.tid_acc), serr); retc = swi_get_tid_acc(tjd_ut, iflag, denum, &denumret, &(swed.tid_acc), serr);
#if TRACE #if TRACE
swi_open_trace(NULL); swi_open_trace(NULL);
if (swi_trace_count < TRACE_COUNT_MAX) { if (swi_trace_count < TRACE_COUNT_MAX) {
@ -2671,7 +2672,7 @@ static double sidtime_long_term(double tjd_ut, double eps, double nut)
*/ */
/* C'_{s,j})_i C'_{c,j})_i */ /* C'_{s,j})_i C'_{c,j})_i */
#define SIDTNTERM 33 #define SIDTNTERM 33
static double stcf[SIDTNTERM * 2] = { static const double stcf[SIDTNTERM * 2] = {
2640.96,-0.39, 2640.96,-0.39,
63.52,-0.02, 63.52,-0.02,
11.75,0.01, 11.75,0.01,
@ -2708,7 +2709,7 @@ static double stcf[SIDTNTERM * 2] = {
}; };
#define SIDTNARG 14 #define SIDTNARG 14
/* l l' F D Om L_Me L_Ve L_E L_Ma L_J L_Sa L_U L_Ne p_A*/ /* l l' F D Om L_Me L_Ve L_E L_Ma L_J L_Sa L_U L_Ne p_A*/
static int stfarg[SIDTNTERM * SIDTNARG] = { static const int stfarg[SIDTNTERM * SIDTNARG] = {
0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 2, -2, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, -2, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@ -2788,7 +2789,7 @@ static double sidtime_non_polynomial_part(double tt)
#define SIDT_LTERM_T1 2469807.5 /* 1 Jan 2050 */ #define SIDT_LTERM_T1 2469807.5 /* 1 Jan 2050 */
#define SIDT_LTERM_OFS0 (0.000378172 / 15.0) #define SIDT_LTERM_OFS0 (0.000378172 / 15.0)
#define SIDT_LTERM_OFS1 (0.001385646 / 15.0) #define SIDT_LTERM_OFS1 (0.001385646 / 15.0)
double FAR PASCAL_CONV swe_sidtime0( double tjd, double eps, double nut ) double CALL_CONV swe_sidtime0( double tjd, double eps, double nut )
{ {
double jd0; /* Julian day at midnight Universal Time */ double jd0; /* Julian day at midnight Universal Time */
double secs; /* Time of day, UT seconds since UT midnight */ double secs; /* Time of day, UT seconds since UT midnight */
@ -2886,7 +2887,7 @@ sidtime_done:
* tjd must be UT !!! * tjd must be UT !!!
* for more informsation, see comment with swe_sidtime0() * for more informsation, see comment with swe_sidtime0()
*/ */
double FAR PASCAL_CONV swe_sidtime(double tjd_ut) double CALL_CONV swe_sidtime(double tjd_ut)
{ {
int i; int i;
double eps, nutlo[2], tsid; double eps, nutlo[2], tsid;
@ -3061,7 +3062,7 @@ char *swi_right_trim(char *s)
* The CRCs this code generates agree with the vendor-supplied Verilog models * The CRCs this code generates agree with the vendor-supplied Verilog models
* of several of the popular FDDI "MAC" chips. * of several of the popular FDDI "MAC" chips.
*/ */
static uint32 crc32_table[256]; static TLS uint32 crc32_table[256];
/* Initialized first time "crc32()" is called. If you prefer, you can /* Initialized first time "crc32()" is called. If you prefer, you can
* statically initialize it at compile time. [Another exercise.] * statically initialize it at compile time. [Another exercise.]
*/ */
@ -3103,7 +3104,7 @@ static void init_crc32(void)
/************************************ /************************************
normalize argument into interval [0..DEG360] normalize argument into interval [0..DEG360]
*************************************/ *************************************/
centisec FAR PASCAL_CONV swe_csnorm(centisec p) centisec CALL_CONV swe_csnorm(centisec p)
{ {
if (p < 0) if (p < 0)
do { p += DEG360; } while (p < 0); do { p += DEG360; } while (p < 0);
@ -3116,12 +3117,12 @@ centisec FAR PASCAL_CONV swe_csnorm(centisec p)
distance in centisecs p1 - p2 distance in centisecs p1 - p2
normalized to [0..360[ normalized to [0..360[
**************************************/ **************************************/
centisec FAR PASCAL_CONV swe_difcsn (centisec p1, centisec p2) centisec CALL_CONV swe_difcsn (centisec p1, centisec p2)
{ {
return (swe_csnorm(p1 - p2)); return (swe_csnorm(p1 - p2));
} }
double FAR PASCAL_CONV swe_difdegn (double p1, double p2) double CALL_CONV swe_difdegn (double p1, double p2)
{ {
return (swe_degnorm(p1 - p2)); return (swe_degnorm(p1 - p2));
} }
@ -3130,21 +3131,21 @@ double FAR PASCAL_CONV swe_difdegn (double p1, double p2)
distance in centisecs p1 - p2 distance in centisecs p1 - p2
normalized to [-180..180[ normalized to [-180..180[
**************************************/ **************************************/
centisec FAR PASCAL_CONV swe_difcs2n(centisec p1, centisec p2) centisec CALL_CONV swe_difcs2n(centisec p1, centisec p2)
{ centisec dif; { centisec dif;
dif = swe_csnorm(p1 - p2); dif = swe_csnorm(p1 - p2);
if (dif >= DEG180) return (dif - DEG360); if (dif >= DEG180) return (dif - DEG360);
return (dif); return (dif);
} }
double FAR PASCAL_CONV swe_difdeg2n(double p1, double p2) double CALL_CONV swe_difdeg2n(double p1, double p2)
{ double dif; { double dif;
dif = swe_degnorm(p1 - p2); dif = swe_degnorm(p1 - p2);
if (dif >= 180.0) return (dif - 360.0); if (dif >= 180.0) return (dif - 360.0);
return (dif); return (dif);
} }
double FAR PASCAL_CONV swe_difrad2n(double p1, double p2) double CALL_CONV swe_difrad2n(double p1, double p2)
{ double dif; { double dif;
dif = swe_radnorm(p1 - p2); dif = swe_radnorm(p1 - p2);
if (dif >= TWOPI / 2) return (dif - TWOPI); if (dif >= TWOPI / 2) return (dif - TWOPI);
@ -3154,7 +3155,7 @@ double FAR PASCAL_CONV swe_difrad2n(double p1, double p2)
/************************************* /*************************************
round second, but at 29.5959 always down round second, but at 29.5959 always down
*************************************/ *************************************/
centisec FAR PASCAL_CONV swe_csroundsec(centisec x) centisec CALL_CONV swe_csroundsec(centisec x)
{ {
centisec t; centisec t;
t = (x + 50) / 100 *100L; /* round to seconds */ t = (x + 50) / 100 *100L; /* round to seconds */
@ -3166,7 +3167,7 @@ centisec FAR PASCAL_CONV swe_csroundsec(centisec x)
/************************************* /*************************************
double to int32 with rounding, no overflow check double to int32 with rounding, no overflow check
*************************************/ *************************************/
int32 FAR PASCAL_CONV swe_d2l(double x) int32 CALL_CONV swe_d2l(double x)
{ {
if (x >=0) if (x >=0)
return ((int32) (x + 0.5)); return ((int32) (x + 0.5));
@ -3177,12 +3178,12 @@ int32 FAR PASCAL_CONV swe_d2l(double x)
/* /*
* monday = 0, ... sunday = 6 * monday = 0, ... sunday = 6
*/ */
int FAR PASCAL_CONV swe_day_of_week(double jd) int CALL_CONV swe_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;
} }
char *FAR PASCAL_CONV swe_cs2timestr(CSEC t, int sep, AS_BOOL suppressZero, char *a) char *CALL_CONV swe_cs2timestr(CSEC t, int sep, AS_BOOL suppressZero, char *a)
/* does not suppress zeros in hours or minutes */ /* does not suppress zeros in hours or minutes */
{ {
/* static char a[9];*/ /* static char a[9];*/
@ -3206,7 +3207,7 @@ char *FAR PASCAL_CONV swe_cs2timestr(CSEC t, int sep, AS_BOOL suppressZero, char
return (a); return (a);
} /* swe_cs2timestr() */ } /* swe_cs2timestr() */
char *FAR PASCAL_CONV swe_cs2lonlatstr(CSEC t, char pchar, char mchar, char *sp) char *CALL_CONV swe_cs2lonlatstr(CSEC t, char pchar, char mchar, char *sp)
{ {
char a[10]; /* must be initialized at each call */ char a[10]; /* must be initialized at each call */
char *aa; char *aa;
@ -3236,7 +3237,7 @@ char *FAR PASCAL_CONV swe_cs2lonlatstr(CSEC t, char pchar, char mchar, char *sp)
return (sp); return (sp);
} /* swe_cs2lonlatstr() */ } /* swe_cs2lonlatstr() */
char *FAR PASCAL_CONV swe_cs2degstr(CSEC t, char *a) char *CALL_CONV swe_cs2degstr(CSEC t, char *a)
/* does suppress leading zeros in degrees */ /* does suppress leading zeros in degrees */
{ {
/* char a[9]; must be initialized at each call */ /* char a[9]; must be initialized at each call */
@ -3259,7 +3260,7 @@ char *FAR PASCAL_CONV swe_cs2degstr(CSEC t, char *a)
* or +/- sign * or +/- sign
* *
*********************************************************/ *********************************************************/
void FAR PASCAL_CONV swe_split_deg(double ddeg, int32 roundflag, int32 *ideg, int32 *imin, int32 *isec, double *dsecfr, int32 *isgn) void CALL_CONV swe_split_deg(double ddeg, int32 roundflag, int32 *ideg, int32 *imin, int32 *isec, double *dsecfr, int32 *isgn)
{ {
double dadd = 0; double dadd = 0;
*isgn = 1; *isgn = 1;
@ -3351,7 +3352,7 @@ void swi_FK5_FK4(double *xp, double tjd)
swi_polcart(xp, xp); swi_polcart(xp, xp);
} }
void FAR PASCAL_CONV swe_set_astro_models(int32 *imodel) void CALL_CONV swe_set_astro_models(int32 *imodel)
{ {
int *pmodel = &(swed.astro_models[0]); int *pmodel = &(swed.astro_models[0]);
swi_init_swed_if_start(); swi_init_swed_if_start();
@ -3359,7 +3360,7 @@ void FAR PASCAL_CONV swe_set_astro_models(int32 *imodel)
} }
#if 0 #if 0
void FAR PASCAL_CONV swe_get_prec_nut_models(int *imodel) void CALL_CONV swe_get_prec_nut_models(int *imodel)
{ {
int *pmodel = &(swed.astro_models[0]); int *pmodel = &(swed.astro_models[0]);
memcpy(imodel, pmodel, SEI_NMODELS * sizeof(int)); memcpy(imodel, pmodel, SEI_NMODELS * sizeof(int));

View File

@ -157,8 +157,8 @@ extern int32 swi_guess_ephe_flag();
extern void swi_deflect_light(double *xx, double dt, int32 iflag); extern void swi_deflect_light(double *xx, double dt, int32 iflag);
extern void swi_aberr_light(double *xx, double *xe, int32 iflag); extern void swi_aberr_light(double *xx, double *xe, int32 iflag);
extern int swi_plan_for_osc_elem(int32 iflag, double tjd, double *xx); extern int swi_plan_for_osc_elem(int32 iflag, double tjd, double *xx);
extern int swi_trop_ra2sid_lon(double *xin, double *xout, double *xoutr, int32 iflag, char *serr); extern int swi_trop_ra2sid_lon(double *xin, double *xout, double *xoutr, int32 iflag);
extern int swi_trop_ra2sid_lon_sosy(double *xin, double *xout, double *xoutr, int32 iflag, char *serr); extern int swi_trop_ra2sid_lon_sosy(double *xin, double *xout, int32 iflag);
extern int swi_get_observer(double tjd, int32 iflag, extern int swi_get_observer(double tjd, int32 iflag,
AS_BOOL do_save, double *xobs, char *serr); AS_BOOL do_save, double *xobs, char *serr);
extern void swi_force_app_pos_etc(); extern void swi_force_app_pos_etc();
@ -212,13 +212,13 @@ extern double swi_deltat_ephe(double tjd_ut, int32 epheflag);
#ifdef TRACE #ifdef TRACE
# define TRACE_COUNT_MAX 10000 # define TRACE_COUNT_MAX 10000
extern FILE *swi_fp_trace_c; extern TLS FILE *swi_fp_trace_c;
extern FILE *swi_fp_trace_out; extern TLS FILE *swi_fp_trace_out;
extern TLS int32 swi_trace_count;
extern void swi_open_trace(char *serr); extern void swi_open_trace(char *serr);
extern int32 swi_trace_count; static const char *fname_trace_c = "swetrace.c";
static char *fname_trace_c = "swetrace.c"; static const char *fname_trace_out = "swetrace.txt";
static char *fname_trace_out = "swetrace.txt";
#ifdef FORCE_IFLAG #ifdef FORCE_IFLAG
static char *fname_force_flg = "force.flg"; static const char *fname_force_flg = "force.flg";
#endif #endif
#endif /* TRACE */ #endif /* TRACE */