sweph 2.10.3-3 → 2.10.3-5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.mjs CHANGED
@@ -1,109 +1,116 @@
1
1
  import { createRequire } from "module";
2
+ import { fileURLToPath } from "url";
2
3
  import c from "./constants.js";
3
4
 
5
+ const __dirname = fileURLToPath(new URL(".", import.meta.url));
4
6
  const require = createRequire(import.meta.url);
5
- export const sweph = require("./build/Release/sweph.node");
6
7
 
7
- sweph.constants = c;
8
- sweph.sweph = sweph;
9
- sweph.default = sweph;
8
+ /** @type {Omit<import("sweph"), "constants" | "sweph" | "default">} */
9
+ const s = require("node-gyp-build")(__dirname);
10
+
11
+ export const sweph = {
12
+ ...s,
13
+ constants: c,
14
+ sweph: s,
15
+ default: s
16
+ }
10
17
 
11
18
  export default sweph;
12
- export const constants = sweph.constants;
13
- export const close = sweph.close;
14
- export const set_delta_t_userdef = sweph.set_delta_t_userdef;
15
- export const set_ephe_path = sweph.set_ephe_path;
16
- export const set_jpl_file = sweph.set_jpl_file;
17
- export const set_sid_mode = sweph.set_sid_mode;
18
- export const set_tid_acc = sweph.set_tid_acc;
19
- export const set_topo = sweph.set_topo;
20
- export const version = sweph.version;
21
- export const get_library_path = sweph.get_library_path;
22
- export const get_tid_acc = sweph.get_tid_acc;
23
- export const get_planet_name = sweph.get_planet_name;
24
- export const get_current_file_data = sweph.get_current_file_data;
25
- export const get_orbital_elements = sweph.get_orbital_elements;
26
- export const get_ayanamsa_name = sweph.get_ayanamsa_name;
27
- export const get_ayanamsa_ex_ut = sweph.get_ayanamsa_ex_ut;
28
- export const get_ayanamsa_ex = sweph.get_ayanamsa_ex;
29
- export const get_ayanamsa_ut = sweph.get_ayanamsa_ut;
30
- export const get_ayanamsa = sweph.get_ayanamsa;
31
- export const calc = sweph.calc;
32
- export const calc_ut = sweph.calc_ut;
33
- export const calc_pctr = sweph.calc_pctr;
34
- export const fixstar = sweph.fixstar;
35
- export const fixstar_ut = sweph.fixstar_ut;
36
- export const fixstar_mag = sweph.fixstar_mag;
37
- export const fixstar2 = sweph.fixstar2;
38
- export const fixstar2_ut = sweph.fixstar2_ut;
39
- export const fixstar2_mag = sweph.fixstar2_mag;
40
- export const nod_aps = sweph.nod_aps;
41
- export const nod_aps_ut = sweph.nod_aps_ut;
42
- export const orbit_max_min_true_distance = sweph.orbit_max_min_true_distance;
43
- export const sol_eclipse_when_loc = sweph.sol_eclipse_when_loc;
44
- export const sol_eclipse_when_glob = sweph.sol_eclipse_when_glob;
45
- export const sol_eclipse_how = sweph.sol_eclipse_how;
46
- export const sol_eclipse_where = sweph.sol_eclipse_where;
47
- export const lun_occult_when_loc = sweph.lun_occult_when_loc;
48
- export const lun_occult_when_glob = sweph.lun_occult_when_glob;
49
- export const lun_occult_where = sweph.lun_occult_where;
50
- export const lun_eclipse_when_loc = sweph.lun_eclipse_when_loc;
51
- export const lun_eclipse_when = sweph.lun_eclipse_when;
52
- export const lun_eclipse_how = sweph.lun_eclipse_how;
53
- export const rise_trans = sweph.rise_trans;
54
- export const rise_trans_true_hor = sweph.rise_trans_true_hor;
55
- export const pheno = sweph.pheno;
56
- export const pheno_ut = sweph.pheno_ut;
57
- export const azalt = sweph.azalt;
58
- export const azalt_rev = sweph.azalt_rev;
59
- export const refrac = sweph.refrac;
60
- export const refrac_extended = sweph.refrac_extended;
61
- export const heliacal_ut = sweph.heliacal_ut;
62
- export const vis_limit_mag = sweph.vis_limit_mag;
63
- export const heliacal_pheno_ut = sweph.heliacal_pheno_ut;
64
- export const julday = sweph.julday;
65
- export const date_conversion = sweph.date_conversion;
66
- export const revjul = sweph.revjul;
67
- export const utc_time_zone = sweph.utc_time_zone;
68
- export const utc_to_jd = sweph.utc_to_jd;
69
- export const jdet_to_utc = sweph.jdet_to_utc;
70
- export const jdut1_to_utc = sweph.jdut1_to_utc;
71
- export const time_equ = sweph.time_equ;
72
- export const lmt_to_lat = sweph.lmt_to_lat;
73
- export const lat_to_lmt = sweph.lat_to_lmt;
74
- export const deltat = sweph.deltat;
75
- export const deltat_ex = sweph.deltat_ex;
76
- export const house_name = sweph.house_name;
77
- export const houses = sweph.houses;
78
- export const houses_armc = sweph.houses_armc;
79
- export const houses_armc_ex2 = sweph.houses_armc_ex2;
80
- export const houses_ex = sweph.houses_ex;
81
- export const houses_ex2 = sweph.houses_ex2;
82
- export const house_pos = sweph.house_pos;
83
- export const gauquelin_sector = sweph.gauquelin_sector;
84
- export const sidtime = sweph.sidtime;
85
- export const sidtime0 = sweph.sidtime0;
86
- export const cotrans = sweph.cotrans;
87
- export const cotrans_sp = sweph.cotrans_sp;
88
- export const degnorm = sweph.degnorm;
89
- export const radnorm = sweph.radnorm;
90
- export const split_deg = sweph.split_deg;
91
- export const csnorm = sweph.csnorm;
92
- export const difcsn = sweph.difcsn;
93
- export const difdegn = sweph.difdegn;
94
- export const difcs2n = sweph.difcs2n;
95
- export const difdeg2n = sweph.difdeg2n;
96
- export const csroundsec = sweph.csroundsec;
97
- export const d2l = sweph.d2l;
98
- export const day_of_week = sweph.day_of_week;
99
- export const cs2timestr = sweph.cs2timestr;
100
- export const cs2lonlatstr = sweph.cs2lonlatstr;
101
- export const cs2degstr = sweph.cs2degstr;
102
- export const solcross = sweph.solcross;
103
- export const solcross_ut = sweph.solcross_ut;
104
- export const mooncross = sweph.mooncross;
105
- export const mooncross_ut = sweph.mooncross_ut;
106
- export const mooncross_node = sweph.mooncross_node;
107
- export const mooncross_node_ut = sweph.mooncross_node_ut;
108
- export const helio_cross = sweph.helio_cross;
109
- export const helio_cross_ut = sweph.helio_cross_ut;
19
+ export const constants = c;
20
+ export const close = s.close;
21
+ export const set_delta_t_userdef = s.set_delta_t_userdef;
22
+ export const set_ephe_path = s.set_ephe_path;
23
+ export const set_jpl_file = s.set_jpl_file;
24
+ export const set_sid_mode = s.set_sid_mode;
25
+ export const set_tid_acc = s.set_tid_acc;
26
+ export const set_topo = s.set_topo;
27
+ export const version = s.version;
28
+ export const get_library_path = s.get_library_path;
29
+ export const get_tid_acc = s.get_tid_acc;
30
+ export const get_planet_name = s.get_planet_name;
31
+ export const get_current_file_data = s.get_current_file_data;
32
+ export const get_orbital_elements = s.get_orbital_elements;
33
+ export const get_ayanamsa_name = s.get_ayanamsa_name;
34
+ export const get_ayanamsa_ex_ut = s.get_ayanamsa_ex_ut;
35
+ export const get_ayanamsa_ex = s.get_ayanamsa_ex;
36
+ export const get_ayanamsa_ut = s.get_ayanamsa_ut;
37
+ export const get_ayanamsa = s.get_ayanamsa;
38
+ export const calc = s.calc;
39
+ export const calc_ut = s.calc_ut;
40
+ export const calc_pctr = s.calc_pctr;
41
+ export const fixstar = s.fixstar;
42
+ export const fixstar_ut = s.fixstar_ut;
43
+ export const fixstar_mag = s.fixstar_mag;
44
+ export const fixstar2 = s.fixstar2;
45
+ export const fixstar2_ut = s.fixstar2_ut;
46
+ export const fixstar2_mag = s.fixstar2_mag;
47
+ export const nod_aps = s.nod_aps;
48
+ export const nod_aps_ut = s.nod_aps_ut;
49
+ export const orbit_max_min_true_distance = s.orbit_max_min_true_distance;
50
+ export const sol_eclipse_when_loc = s.sol_eclipse_when_loc;
51
+ export const sol_eclipse_when_glob = s.sol_eclipse_when_glob;
52
+ export const sol_eclipse_how = s.sol_eclipse_how;
53
+ export const sol_eclipse_where = s.sol_eclipse_where;
54
+ export const lun_occult_when_loc = s.lun_occult_when_loc;
55
+ export const lun_occult_when_glob = s.lun_occult_when_glob;
56
+ export const lun_occult_where = s.lun_occult_where;
57
+ export const lun_eclipse_when_loc = s.lun_eclipse_when_loc;
58
+ export const lun_eclipse_when = s.lun_eclipse_when;
59
+ export const lun_eclipse_how = s.lun_eclipse_how;
60
+ export const rise_trans = s.rise_trans;
61
+ export const rise_trans_true_hor = s.rise_trans_true_hor;
62
+ export const pheno = s.pheno;
63
+ export const pheno_ut = s.pheno_ut;
64
+ export const azalt = s.azalt;
65
+ export const azalt_rev = s.azalt_rev;
66
+ export const refrac = s.refrac;
67
+ export const refrac_extended = s.refrac_extended;
68
+ export const heliacal_ut = s.heliacal_ut;
69
+ export const vis_limit_mag = s.vis_limit_mag;
70
+ export const heliacal_pheno_ut = s.heliacal_pheno_ut;
71
+ export const julday = s.julday;
72
+ export const date_conversion = s.date_conversion;
73
+ export const revjul = s.revjul;
74
+ export const utc_time_zone = s.utc_time_zone;
75
+ export const utc_to_jd = s.utc_to_jd;
76
+ export const jdet_to_utc = s.jdet_to_utc;
77
+ export const jdut1_to_utc = s.jdut1_to_utc;
78
+ export const time_equ = s.time_equ;
79
+ export const lmt_to_lat = s.lmt_to_lat;
80
+ export const lat_to_lmt = s.lat_to_lmt;
81
+ export const deltat = s.deltat;
82
+ export const deltat_ex = s.deltat_ex;
83
+ export const house_name = s.house_name;
84
+ export const houses = s.houses;
85
+ export const houses_armc = s.houses_armc;
86
+ export const houses_armc_ex2 = s.houses_armc_ex2;
87
+ export const houses_ex = s.houses_ex;
88
+ export const houses_ex2 = s.houses_ex2;
89
+ export const house_pos = s.house_pos;
90
+ export const gauquelin_sector = s.gauquelin_sector;
91
+ export const sidtime = s.sidtime;
92
+ export const sidtime0 = s.sidtime0;
93
+ export const cotrans = s.cotrans;
94
+ export const cotrans_sp = s.cotrans_sp;
95
+ export const degnorm = s.degnorm;
96
+ export const radnorm = s.radnorm;
97
+ export const split_deg = s.split_deg;
98
+ export const csnorm = s.csnorm;
99
+ export const difcsn = s.difcsn;
100
+ export const difdegn = s.difdegn;
101
+ export const difcs2n = s.difcs2n;
102
+ export const difdeg2n = s.difdeg2n;
103
+ export const csroundsec = s.csroundsec;
104
+ export const d2l = s.d2l;
105
+ export const day_of_week = s.day_of_week;
106
+ export const cs2timestr = s.cs2timestr;
107
+ export const cs2lonlatstr = s.cs2lonlatstr;
108
+ export const cs2degstr = s.cs2degstr;
109
+ export const solcross = s.solcross;
110
+ export const solcross_ut = s.solcross_ut;
111
+ export const mooncross = s.mooncross;
112
+ export const mooncross_ut = s.mooncross_ut;
113
+ export const mooncross_node = s.mooncross_node;
114
+ export const mooncross_node_ut = s.mooncross_node_ut;
115
+ export const helio_cross = s.helio_cross;
116
+ export const helio_cross_ut = s.helio_cross_ut;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sweph",
3
- "version": "2.10.3-3",
3
+ "version": "2.10.3-5",
4
4
  "description": "The definitive Swiss Ephemeris bindings for Node.js",
5
5
  "keywords": [
6
6
  "sweph",
@@ -13,11 +13,15 @@
13
13
  ],
14
14
  "homepage": "https://github.com/timotejroiko/sweph",
15
15
  "bugs": "https://github.com/timotejroiko/sweph/issues",
16
- "repository": "github:timotejroiko/sweph",
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "git+https://github.com/timotejroiko/sweph.git"
19
+ },
17
20
  "funding": "https://github.com/timotejroiko/sweph?sponsor=1",
18
21
  "license": "(AGPL-3.0-or-later OR LGPL-3.0-or-later)",
19
22
  "author": "Timotej Valentin Rojko",
20
23
  "exports": {
24
+ "types": "./index.d.ts",
21
25
  "require": "./index.js",
22
26
  "import": "./index.mjs"
23
27
  },
@@ -28,6 +32,7 @@
28
32
  "./index.mjs",
29
33
  "./index.d.ts",
30
34
  "./constants.js",
35
+ "./prebuilds",
31
36
  "./binding.gyp",
32
37
  "./swisseph",
33
38
  "./src/functions",
@@ -36,13 +41,16 @@
36
41
  ],
37
42
  "scripts": {
38
43
  "preinstall": "node -e \"const { readdirSync, readFileSync, writeFileSync } = require('fs'); const file = readdirSync('./src/functions').map((x,i) => readFileSync('./src/functions/' + x, 'utf8').replace(/args/g, 'args' + i).replace('#include <sweph.h>', '')).reduce((a,b) => a + b, '#include <sweph.h>'); writeFileSync('./src/functions.cpp', file, 'utf8');\"",
39
- "install": "node-gyp rebuild && npm run test",
40
- "test": "node -e \"const s = require('./'); const c = s.calc(2222222,0,4); console.log('OK')\""
44
+ "rebuild": "node-gyp rebuild && npm run test",
45
+ "test": "node -e \"const s = require('./'); const c = s.calc(2222222,0,4); console.log('OK')\"",
46
+ "install": "node-gyp-build && npm run test",
47
+ "prebuild": "prebuildify --napi --strip"
41
48
  },
42
49
  "dependencies": {
43
- "node-addon-api": "*"
50
+ "node-addon-api": "^8.7.0",
51
+ "node-gyp-build": "^4.8.4"
44
52
  },
45
53
  "devDependencies": {
46
- "eslint": "^8.44.0"
54
+ "prebuildify": "^6.0.1"
47
55
  }
48
56
  }
Binary file
Binary file
Binary file
package/swisseph/swecl.c CHANGED
@@ -771,7 +771,7 @@ iter_where:
771
771
  } else {
772
772
  if (serr != NULL)
773
773
  sprintf(serr, "no solar eclipse at tjd = %f", tjd);
774
- for (i = 0; i < 10; i++)
774
+ for (i = 0; i < 2; i++)
775
775
  geopos[i] = 0;
776
776
  *dcore = 0;
777
777
  retc = 0;
@@ -1991,7 +1991,7 @@ end_search_global:
1991
1991
  * SE_ECL_VISIBLE,
1992
1992
  * SE_ECL_MAX_VISIBLE,
1993
1993
  * SE_ECL_1ST_VISIBLE, SE_ECL_2ND_VISIBLE
1994
- * SE_ECL_3ST_VISIBLE, SE_ECL_4ND_VISIBLE
1994
+ * SE_ECL_3RD_VISIBLE, SE_ECL_4TH_VISIBLE
1995
1995
  *
1996
1996
  * tret[0] time of maximum eclipse
1997
1997
  * tret[1] time of first contact
@@ -2048,7 +2048,7 @@ int32 CALL_CONV swe_sol_eclipse_when_loc(double tjd_start, int32 ifl,
2048
2048
  * SE_ECL_VISIBLE,
2049
2049
  * SE_ECL_MAX_VISIBLE,
2050
2050
  * SE_ECL_1ST_VISIBLE, SE_ECL_2ND_VISIBLE
2051
- * SE_ECL_3ST_VISIBLE, SE_ECL_4ND_VISIBLE
2051
+ * SE_ECL_3RD_VISIBLE, SE_ECL_4TH_VISIBLE
2052
2052
  * SE_ECL_OCC_BEG_DAYLIGHT, SE_ECL_OCC_END_DAYLIGHT
2053
2053
  * The latter two indicate that the beginning or end of the occultation takes
2054
2054
  * place during the day. If Venus is occulted, it may be observable with the
@@ -2103,7 +2103,7 @@ static int32 eclipse_when_loc(double tjd_start, int32 ifl, double *geopos, doubl
2103
2103
  int32 retflag = 0, retc;
2104
2104
  double t, tjd, dt, dtint, K, T, T2, T3, T4, F, M, Mm;
2105
2105
  double tjdr, tjds;
2106
- double E, Ff, A1, Om;
2106
+ double E, Ff; // A1, Om;
2107
2107
  double xs[6], xm[6], ls[6], lm[6], x1[6], x2[6], dm, ds;
2108
2108
  double rmoon, rsun, rsplusrm, rsminusrm;
2109
2109
  double dc[3], dctr, dctrmin;
@@ -2149,16 +2149,14 @@ next_try:
2149
2149
  + 0.1017438 * T2
2150
2150
  + 0.00001239 * T3
2151
2151
  + 0.000000058 * T4);
2152
- Om = swe_degnorm(124.7746 - 1.56375580 * K
2153
- + 0.0020691 * T2
2154
- + 0.00000215 * T3);
2152
+ // Om = swe_degnorm(124.7746 - 1.56375580 * K + 0.0020691 * T2 + 0.00000215 * T3);
2155
2153
  E = 1 - 0.002516 * T - 0.0000074 * T2;
2156
- A1 = swe_degnorm(299.77 + 0.107408 * K - 0.009173 * T2);
2154
+ // A1 = swe_degnorm(299.77 + 0.107408 * K - 0.009173 * T2);
2157
2155
  M *= DEGTORAD;
2158
2156
  Mm *= DEGTORAD;
2159
2157
  F *= DEGTORAD;
2160
- Om *= DEGTORAD;
2161
- A1 *= DEGTORAD;
2158
+ // Om *= DEGTORAD;
2159
+ // A1 *= DEGTORAD;
2162
2160
  tjd = tjd - 0.4075 * sin(Mm)
2163
2161
  + 0.1721 * E * sin(M);
2164
2162
  swe_set_topo(geopos[0], geopos[1], geopos[2]);
@@ -4213,7 +4211,6 @@ static int32 rise_set_fast(
4213
4211
  int i;
4214
4212
  double xx[6], xaz[6], xaz2[6];
4215
4213
  double dd, dt, refr;
4216
- double dtsum = 0;
4217
4214
  int32 iflag = epheflag & (SEFLG_JPLEPH|SEFLG_SWIEPH|SEFLG_MOSEPH);
4218
4215
  int32 iflagtopo = iflag | SEFLG_EQUATORIAL;
4219
4216
  double sda, armc, md, dmd, mdrise, rdi, tr, dalt;
@@ -4307,9 +4304,11 @@ run_rise_again:
4307
4304
  dd = (xaz2[1] - xaz[1]);
4308
4305
  dalt = xaz[1] + rdi;
4309
4306
  dt = dalt / dd / 1000.0;
4310
- if (dt > 0.1) dt = 0.1;
4311
- else if (dt < -0.1) dt = -0.1;
4312
- dtsum += dt;
4307
+ if (dt > 0.1) {
4308
+ dt = 0.1;
4309
+ } else if (dt < -0.1) {
4310
+ dt = -0.1;
4311
+ }
4313
4312
  if ((0) && fabs(dt) > 5.0 / 86400.0 && nloop < 20)
4314
4313
  nloop++;
4315
4314
  tr -= dt;
@@ -4403,8 +4402,8 @@ int32 CALL_CONV swe_rise_trans_true_hor(
4403
4402
  double t, te, tt, dt, twohrs = 1.0 / 12.0;
4404
4403
  double curdist;
4405
4404
  int32 tohor_flag = SE_EQU2HOR;
4406
- int nazalt = 0;
4407
- int ncalc = 0;
4405
+ int nazalt = 0;
4406
+ int ncalc = 0;
4408
4407
  AS_BOOL do_fixstar = (starname != NULL && *starname != '\0');
4409
4408
  if (geopos[2] < SEI_ECL_GEOALT_MIN || geopos[2] > SEI_ECL_GEOALT_MAX) {
4410
4409
  if (serr != NULL)
@@ -4676,8 +4675,8 @@ nazalt++;
4676
4675
  }
4677
4676
  if (t > tjd_ut) {
4678
4677
  *tret = t;
4679
- // fprintf(stderr, "nazalt=%d\n", nazalt);
4680
- // fprintf(stderr, "ncalc=%d\n", ncalc);
4678
+ if (0) fprintf(stderr, "nazalt=%d\n", nazalt);
4679
+ if (0) fprintf(stderr, "ncalc=%d\n", ncalc);
4681
4680
  return OK;
4682
4681
  }
4683
4682
  }
@@ -5782,7 +5781,7 @@ int32 CALL_CONV swe_get_orbital_elements(
5782
5781
  int32 iflJ2000 = (iflag & SEFLG_EPHMASK)|SEFLG_J2000|SEFLG_XYZ|SEFLG_TRUEPOS|SEFLG_NONUT|SEFLG_SPEED;
5783
5782
  int32 iflJ2000p = (iflag & SEFLG_EPHMASK)|SEFLG_J2000|SEFLG_TRUEPOS|SEFLG_NONUT|SEFLG_SPEED;
5784
5783
  double Gmsm;
5785
- int32 iflg0 = 0;
5784
+ // int32 iflg0 = 0;
5786
5785
  double fac, sgn, rxy, rxyz, c2, cosnode, sinnode;
5787
5786
  double incl, node, parg, peri, mlon;
5788
5787
  double csid, ctro, csyn, dmot, pa;
@@ -5795,8 +5794,7 @@ int32 CALL_CONV swe_get_orbital_elements(
5795
5794
  sprintf(serr, "error in swe_get_orbital_elements(): object %d not valid\n", ipl);
5796
5795
  return ERR;
5797
5796
  }
5798
- if (ipl != SE_MOON)
5799
- iflg0 |= SEFLG_HELCTR;
5797
+ // if (ipl != SE_MOON) iflg0 |= SEFLG_HELCTR;
5800
5798
  /* first, we need a heliocentric distance of the planet */
5801
5799
  if (swe_calc(tjd_et, ipl, iflJ2000p, x, serr) == ERR)
5802
5800
  return ERR;
package/swisseph/swehel.c CHANGED
@@ -3164,8 +3164,8 @@ static int32 heliacal_ut_vis_lim(double tjd_start, double *dgeo, double *datm, d
3164
3164
  {
3165
3165
  int i;
3166
3166
  double d, darr[10], direct = 1, tjd, tday;
3167
- int32 epheflag, retval = OK, helflag2;
3168
- int32 iflag, ipl;
3167
+ int32 retval = OK, helflag2;
3168
+ int32 ipl;
3169
3169
  int32 TypeEvent = TypeEventIn;
3170
3170
  char serr[AS_MAXCH];
3171
3171
  for (i = 0; i < 10; i++)
@@ -3173,10 +3173,6 @@ static int32 heliacal_ut_vis_lim(double tjd_start, double *dgeo, double *datm, d
3173
3173
  *dret = tjd_start;
3174
3174
  *serr = '\0';
3175
3175
  ipl = DeterObject(ObjectName);
3176
- epheflag = helflag & (SEFLG_JPLEPH|SEFLG_SWIEPH|SEFLG_MOSEPH);
3177
- iflag = SEFLG_TOPOCTR | SEFLG_EQUATORIAL | epheflag;
3178
- if (!(helflag & SE_HELFLAG_HIGH_PRECISION))
3179
- iflag |= SEFLG_NONUT | SEFLG_TRUEPOS;
3180
3176
  if (ipl == SE_MERCURY)
3181
3177
  tjd = tjd_start - 30;
3182
3178
  else
@@ -3255,8 +3251,7 @@ static int32 moon_event_vis_lim(double tjdstart, double *dgeo, double *datm, dou
3255
3251
  double tjd, trise;
3256
3252
  char serr[AS_MAXCH];
3257
3253
  char ObjectName[30];
3258
- int32 iflag, ipl, retval, helflag2, direct;
3259
- int32 epheflag = helflag & (SEFLG_JPLEPH|SEFLG_SWIEPH|SEFLG_MOSEPH);
3254
+ int32 ipl, retval, helflag2, direct;
3260
3255
  dret[0] = tjdstart; /* will be returned in error case */
3261
3256
  if (TypeEvent == 1 || TypeEvent == 2) {
3262
3257
  if (serr_ret != NULL)
@@ -3265,9 +3260,6 @@ static int32 moon_event_vis_lim(double tjdstart, double *dgeo, double *datm, dou
3265
3260
  }
3266
3261
  strcpy(ObjectName, "moon");
3267
3262
  ipl = SE_MOON;
3268
- iflag = SEFLG_TOPOCTR | SEFLG_EQUATORIAL | epheflag;
3269
- if (!(helflag & SE_HELFLAG_HIGH_PRECISION))
3270
- iflag |= SEFLG_NONUT|SEFLG_TRUEPOS;
3271
3263
  helflag2 = helflag;
3272
3264
  helflag2 &= ~SE_HELFLAG_HIGH_PRECISION;
3273
3265
  /* check Synodic/phase Period */
@@ -3392,7 +3384,7 @@ static int32 heliacal_ut(double JDNDaysUTStart, double *dgeo, double *datm, doub
3392
3384
  */
3393
3385
  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)
3394
3386
  {
3395
- int32 retval, Planet, itry;
3387
+ int32 retval, Planet;
3396
3388
  char ObjectName[AS_MAXCH], serr[AS_MAXCH], s[AS_MAXCH];
3397
3389
  double tjd0 = JDNDaysUTStart, tjd, dsynperiod, tjdmax, tadd;
3398
3390
  int32 MaxCountSynodicPeriod = MAX_COUNT_SYNPER;
@@ -3490,11 +3482,8 @@ int32 CALL_CONV swe_heliacal_ut(double JDNDaysUTStart, double *dgeo, double *dat
3490
3482
  /*
3491
3483
  * this is the outer loop over n synodic periods
3492
3484
  */
3493
- tjd = tjd0;
3494
3485
  retval = -2; /* indicates that another synodic period has to be done */
3495
- for (itry = 0;
3496
- tjd < tjdmax && retval == -2;
3497
- itry++, tjd += tadd) {
3486
+ for (tjd = tjd0; tjd < tjdmax && retval == -2; tjd += tadd) {
3498
3487
  *serr = '\0';
3499
3488
  retval = heliacal_ut(tjd, dgeo, datm, dobs, ObjectName, TypeEvent, helflag, dret, serr);
3500
3489
  /* if resulting event date < start date for search (tjd0): retry starting
@@ -967,7 +967,9 @@ static int CalcH(
967
967
  } /* if */
968
968
  hsp->mc = swe_degnorm(hsp->mc);
969
969
  if (hsp->do_speed) hsp->mc_speed = AscDash(th, 0, sine, cose);
970
- /* ascendant */
970
+ // ascendant
971
+ // In case of ascendant, the great circle is the horizon, which has pole height latitude.
972
+ // intersection equator horizon is at th + 90, reactasce 90° east of meridian.
971
973
  hsp->ac = Asc1(th + 90, fi, sine, cose);
972
974
  if (hsp->do_speed)
973
975
  hsp->ac_speed = AscDash(th + 90, fi, sine, cose);
@@ -2049,7 +2051,7 @@ porphyry:
2049
2051
 
2050
2052
  /*****
2051
2053
  * oblique triangle formed by: great circle with pole height f, ecliptic and equator,
2052
- * x = intersection equator - great circle.
2054
+ * x = intersection equator - great circle, measured along equator.
2053
2055
  * return crossing of ecliptic with great circle.
2054
2056
  * Prepare quadrants before doing the work in Asc2.
2055
2057
  */
@@ -2091,7 +2093,8 @@ static double Asc1(double x1, double f, double sine, double cose)
2091
2093
  * f in range -90 .. +90
2092
2094
  * sine, cose around e=23°
2093
2095
  * oblique triangle formed by: great circle with pole height f, ecliptic and equator,
2094
- * x = intersection equator - great circle.
2096
+ * In case of ascendant, the great circle is the horizon, which has pole height latitude.
2097
+ * x = intersection equator - great circle, measured along equator.
2095
2098
  * return crossing of ecliptic with great circle.
2096
2099
  */
2097
2100
  static double Asc2(double x, double f, double sine, double cose)
package/swisseph/swejpl.c CHANGED
@@ -81,6 +81,12 @@
81
81
  typedef off_t off_t64;
82
82
  #define FSEEK fseeko
83
83
  #define FTELL ftello
84
+ // #ifdef __ANDROID_API__
85
+ // #undef FSEEK
86
+ // #undef FTELL
87
+ // #define FSEEK fseek
88
+ // #define FTELL ftell
89
+ // #endif
84
90
  #endif
85
91
 
86
92
  #define DEBUG_DO_SHOW FALSE
@@ -945,7 +951,7 @@ int swi_open_jpl_file(double *ss, char *fname, char *fpath, char *serr)
945
951
  return retc;
946
952
  }
947
953
 
948
- int32 swi_get_jpl_denum()
954
+ int32 swi_get_jpl_denum(void)
949
955
  {
950
956
  return js->eh_denum;
951
957
  }
@@ -1179,7 +1179,7 @@ moonpol[1] *= a;
1179
1179
  moonpol[2] *= a;
1180
1180
  }
1181
1181
  #else
1182
- static void moon1()
1182
+ static void moon1(void)
1183
1183
  {
1184
1184
  double a;
1185
1185
  /* This code added by Bhanu Pinnamaneni, 17-aug-2009 */
@@ -1364,7 +1364,7 @@ moonpol[2] *= a;
1364
1364
  }
1365
1365
  #endif /* MOSH_MOON_200 */
1366
1366
 
1367
- static void moon2()
1367
+ static void moon2(void)
1368
1368
  {
1369
1369
  /* terms in T^0 */
1370
1370
  g = STR*(2*(Ea-Ju+D)-MP+648431.172);
@@ -1441,7 +1441,7 @@ g = STR*(SWELP - 2.0*D + 2.5);
1441
1441
  B += 0.29855 * sin(g);
1442
1442
  }
1443
1443
 
1444
- static void moon3()
1444
+ static void moon3(void)
1445
1445
  {
1446
1446
  /* terms in T^0 */
1447
1447
  moonpol[0] = 0.0;
@@ -1455,7 +1455,7 @@ moonpol[2] = 1.0e-4 * moonpol[2] + 385000.52899; /* kilometers */
1455
1455
 
1456
1456
  /* Compute final ecliptic polar coordinates
1457
1457
  */
1458
- static void moon4()
1458
+ static void moon4(void)
1459
1459
  {
1460
1460
  moonpol[2] /= AUNIT / 1000;
1461
1461
  moonpol[0] = STR * mods3600( moonpol[0] );
@@ -1760,7 +1760,7 @@ void swi_mean_lunar_elements(double tjd,
1760
1760
  *peri = swe_degnorm(*peri - dcor);
1761
1761
  }
1762
1762
 
1763
- static void mean_elements()
1763
+ static void mean_elements(void)
1764
1764
  {
1765
1765
  double fracT = fmod(T, 1);
1766
1766
  /* Mean anomaly of sun = l' (J. Laskar) */
@@ -1817,7 +1817,7 @@ SWELP += ((z[11]*T + z[10])*T + z[9])*T2;
1817
1817
  */
1818
1818
  }
1819
1819
 
1820
- void mean_elements_pl()
1820
+ void mean_elements_pl(void)
1821
1821
  {
1822
1822
  /* Mean longitudes of planets (Laskar, Bretagnon) */
1823
1823
  Ve = mods3600( 210664136.4335482 * T + 655127.283046 );
@@ -139,12 +139,6 @@
139
139
  # define WATCOMC
140
140
  #endif
141
141
 
142
- #ifdef __MWERKS__ /* defined on Macintosh CodeWarrior */
143
- # if macintosh && powerc
144
- # define MACOS MY_TRUE /* let it undefined otherwise */
145
- # define MSDOS MY_FALSE /* in case one above fired falsely */
146
- # endif
147
- #endif
148
142
 
149
143
  #ifdef MSDOS
150
144
  # define HPUNIX MY_FALSE
@@ -154,17 +148,12 @@
154
148
  # endif
155
149
  # define UNIX_FS MY_FALSE
156
150
  #else
157
- # ifdef MACOS
158
- # define HPUNIX MY_FALSE
159
- # define UNIX_FS MY_FALSE
160
- # else
161
151
  # define MSDOS MY_FALSE
162
152
  # define HPUNIX MY_TRUE
163
153
  # ifndef _HPUX_SOURCE
164
154
  # define _HPUX_SOURCE
165
155
  # endif
166
156
  # define UNIX_FS MY_TRUE
167
- # endif
168
157
  #endif
169
158
 
170
159
  #include <math.h>
@@ -321,13 +310,6 @@ typedef int32 centisec; /* centiseconds used for angles and times */
321
310
  # define BFILE_A_ACCESS "a+b" /* create/open binary file for append*/
322
311
  # define PATH_SEPARATOR ";" /* semicolon as PATH separator */
323
312
  # define OPEN_MODE 0666 /* default file creation mode */
324
- # ifdef MACOS
325
- # define FILE_R_ACCESS "r" /* open text file for reading */
326
- # define FILE_RW_ACCESS "r+" /* open text file for writing and reading */
327
- # define FILE_W_CREATE "w" /* create/open text file for write*/
328
- # define FILE_A_ACCESS "a+" /* create/open text file for append*/
329
- # define DIR_GLUE ":" /* glue string for directory/file */
330
- # else
331
313
  # define FILE_R_ACCESS "rt" /* open text file for reading */
332
314
  # define FILE_RW_ACCESS "r+t" /* open text file for writing and reading */
333
315
  # define FILE_W_CREATE "wt" /* create/open text file for write*/
@@ -335,7 +317,6 @@ typedef int32 centisec; /* centiseconds used for angles and times */
335
317
  /* attention, all backslashes for msdos directry names must be written as \\,
336
318
  because it is the C escape character */
337
319
  # define DIR_GLUE "\\" /* glue string for directory/file */
338
- # endif
339
320
  #endif
340
321
 
341
322
  #include <string.h>