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/swisseph/sweph.c CHANGED
@@ -1316,6 +1316,7 @@ void CALL_CONV swe_set_ephe_path(const char *path)
1316
1316
  {
1317
1317
  int i, iflag;
1318
1318
  char s[AS_MAXCH];
1319
+ char serr[AS_MAXCH];
1319
1320
  char *sp;
1320
1321
  double xx[6];
1321
1322
  /* close all open files and delete all planetary data */
@@ -1343,7 +1344,7 @@ void CALL_CONV swe_set_ephe_path(const char *path)
1343
1344
  * tidal acceleration of the Moon */
1344
1345
  iflag = SEFLG_SWIEPH|SEFLG_J2000|SEFLG_TRUEPOS|SEFLG_ICRS;
1345
1346
  swed.last_epheflag = 2;
1346
- swe_calc(J2000, SE_MOON, iflag, xx, NULL);
1347
+ swe_calc(J2000, SE_MOON, iflag, xx, serr);
1347
1348
  if (swed.fidat[SEI_FILE_MOON].fptr != NULL) {
1348
1349
  swi_set_tid_acc(0, 0, swed.fidat[SEI_FILE_MOON].sweph_denum, NULL);
1349
1350
  }
@@ -6210,7 +6211,7 @@ static int CMP_CALL_CONV fstar_node_compare(const void *node1, const void *node2
6210
6211
  int32 fixstar_cut_string(char *srecord, char *star, struct fixed_star *stardata, char *serr)
6211
6212
  {
6212
6213
  int i;
6213
- char s[AS_MAXCH];
6214
+ char s[AS_MAXCH + 20];
6214
6215
  char *sde_d;
6215
6216
  char *cpos[20];
6216
6217
  double epoch, radv, parall, mag;
@@ -6256,6 +6257,7 @@ int32 fixstar_cut_string(char *srecord, char *star, struct fixed_star *stardata,
6256
6257
  de_pm = atof(cpos[10]);
6257
6258
  radv = atof(cpos[11]);
6258
6259
  parall = atof(cpos[12]);
6260
+ if (parall < 0) parall = -parall; // to fix bug like old Rasalgheti
6259
6261
  mag = atof(cpos[13]);
6260
6262
  /****************************************
6261
6263
  * position and speed (equinox)
@@ -6322,7 +6324,7 @@ int32 fixstar_cut_string(char *srecord, char *star, struct fixed_star *stardata,
6322
6324
  static int32 load_all_fixed_stars(char *serr)
6323
6325
  {
6324
6326
  int32 retc = OK;
6325
- int nstars = 0, line = 0, fline = 0, nrecs = 0, nnamed = 0;
6327
+ int nstars = 0, nrecs = 0, nnamed = 0;
6326
6328
  char s[AS_MAXCH], *sp;
6327
6329
  char srecord[AS_MAXCH];
6328
6330
  struct fixed_star fstdata;
@@ -6344,13 +6346,11 @@ static int32 load_all_fixed_stars(char *serr)
6344
6346
  rewind(swed.fixfp);
6345
6347
  swed.fixed_stars = NULL;
6346
6348
  while (fgets(s, AS_MAXCH, swed.fixfp) != NULL) {
6347
- fline++;
6348
6349
  // skip comment lines
6349
6350
  if (*s == '#') continue;
6350
6351
  if (*s == '\n') continue;
6351
6352
  if (*s == '\r') continue;
6352
6353
  if (*s == '\0') continue;
6353
- line++;
6354
6354
  strcpy(srecord, s);
6355
6355
  retc = fixstar_cut_string(srecord, NULL, &fstdata, serr);
6356
6356
  if (retc == ERR) return ERR;
@@ -6388,7 +6388,7 @@ static int32 load_all_fixed_stars(char *serr)
6388
6388
  swed.n_fixstars_real = nstars;
6389
6389
  swed.n_fixstars_named = nnamed;
6390
6390
  swed.n_fixstars_records = nrecs;
6391
- //printf("nstars=%d, nrecords=%d\n", nstars, nrecs);
6391
+ // fprintf(stderr, "nstars=%d, nrecords=%d\n", nstars, nrecs);
6392
6392
  (void) qsort ((void *) swed.fixed_stars, (size_t) nrecs, sizeof (struct fixed_star),
6393
6393
  (int (CMP_CALL_CONV *)(const void *,const void *))(fixedstar_name_compare));
6394
6394
  return retc;
@@ -7266,7 +7266,7 @@ void CALL_CONV swe_set_topo(double geolon, double geolat, double geoalt)
7266
7266
  swi_force_app_pos_etc();
7267
7267
  }
7268
7268
 
7269
- void swi_force_app_pos_etc()
7269
+ void swi_force_app_pos_etc(void)
7270
7270
  {
7271
7271
  int i;
7272
7272
  for (i = 0; i < SEI_NPLANETS; i++)
package/swisseph/sweph.h CHANGED
@@ -445,14 +445,14 @@ static const struct aya_init ayanamsa[SE_NSIDM_PREDEF] = {
445
445
  /*************************/
446
446
  /* 8: J.N. Bhasin; (David Cochrane)
447
447
  We don't have any sources or detailed information about this ayanamsha. */
448
- {J1900, 360 - 338.634444, FALSE, -1}, // Bhasin
448
+ {J1900, 360 - 338.634444, FALSE, -1}, // 8: Bhasin
449
449
  /*************************/
450
450
  /* 14 Sept. 2018: the following three ayanamshas have been wrong for
451
451
  many years */
452
452
  /* 9 - 11: Babylonian, Kugler */
453
- {1684532.5, -5.66667, TRUE, -1}, /* 9: Babylonian, Kugler 1 */
454
- {1684532.5, -4.26667, TRUE, -1}, /* 10: Babylonian, Kugler 2 */
455
- {1684532.5, -3.41667, TRUE, -1}, /* 11: Babylonian, Kugler 3 */
453
+ {1684532.5, -5.66667, TRUE, -1}, // 9: Babylonian, Kugler 1
454
+ {1684532.5, -4.26667, TRUE, -1}, // 10: Babylonian, Kugler 2
455
+ {1684532.5, -3.41667, TRUE, -1}, // 11: Babylonian, Kugler 3
456
456
  /*************************/
457
457
  /* 12: Babylonian, Huber
458
458
  P. Huber, "Über den Nullpunkt der babylonischen Ekliptik", in: Centaurus
@@ -464,7 +464,7 @@ static const struct aya_init ayanamsa[SE_NSIDM_PREDEF] = {
464
464
  {1673941, -5.079167, TRUE, -1}, // 13: Babylonian, Mercier
465
465
  /*************************/
466
466
  /* 14: t0 is defined by Aldebaran at 15 Taurus in year -100 */
467
- {1684532.5, -4.44138598, TRUE, 0},
467
+ {1684532.5, -4.44138598, TRUE, 0}, // 14: Babylonian/Aldebaran = 15 Tau
468
468
  /*************************/
469
469
  /* 15: Hipparchos */
470
470
  {1674484.0, -9.33333, TRUE, -1}, // 15: Hipparchos
@@ -476,34 +476,34 @@ static const struct aya_init ayanamsa[SE_NSIDM_PREDEF] = {
476
476
  {0, 0, FALSE, 0}, // 17: Galactic Center at 0 Sagittarius
477
477
  /*************************/
478
478
  /* 18: J2000 */
479
- {J2000, 0, FALSE, 0}, /* 18: J2000 */
479
+ {J2000, 0, FALSE, 0}, // 18: J2000
480
480
  /*************************/
481
481
  /* 19: J1900 */
482
- {J1900, 0, FALSE, 0}, /* 19: J1900 */
482
+ {J1900, 0, FALSE, 0}, // 19: J1900
483
483
  /*************************/
484
484
  /* 20: B1950 */
485
- {B1950, 0, FALSE, 0}, /* 20: B1950 */
485
+ {B1950, 0, FALSE, 0}, // 20: B1950
486
486
  /*************************/
487
487
  /* 21: Suryasiddhanta, assuming ingress of mean Sun into Aries at point of mean
488
488
  equinox of date on 21.3.499, near noon, Ujjain (75.7684565 E)
489
489
  = 7:30:31.57 UT = 12:33:36 LMT*/
490
- {1903396.8128654, 0, TRUE, 0}, // 21:
490
+ {1903396.8128654, 0, TRUE, 0}, // 21: Suryasiddhanta
491
491
  /*************************/
492
492
  /* 22: Suryasiddhanta, assuming ingress of mean Sun into Aries at true position
493
493
  of mean Sun at same epoch */
494
- {1903396.8128654,-0.21463395, TRUE, 0}, // 22:
494
+ {1903396.8128654,-0.21463395, TRUE, 0}, // 22: Suryasiddhanta, mean Sun
495
495
  /*************************/
496
496
  /* 23: Aryabhata, same date, but UT 6:56:55.57 analogous to 21 */
497
- {1903396.7895321, 0, TRUE, 0}, // 23:
497
+ {1903396.7895321, 0, TRUE, 0}, // 23: Aryabhata
498
498
  /*************************/
499
499
  /* 24: Aryabhata, analogous 22 */
500
- {1903396.7895321,-0.23763238, TRUE, 0}, // 24:
500
+ {1903396.7895321,-0.23763238, TRUE, 0}, // 24: Aryabhata, mean Sun
501
501
  /*************************/
502
502
  /* 25: Suryasiddhanta, Revati/zePsc at polar long. 359°50'*/
503
- {1903396.8128654,-0.79167046, TRUE, 0}, // 25:
503
+ {1903396.8128654,-0.79167046, TRUE, 0}, // 25: SS Revati
504
504
  /*************************/
505
505
  /* 26: Suryasiddhanta, Citra/Spica at polar long. 180° */
506
- {1903396.8128654, 2.11070444, TRUE, 0}, // 26:
506
+ {1903396.8128654, 2.11070444, TRUE, 0}, // 26: SS Citra
507
507
  /*************************/
508
508
  /* 27: True Citra (Spica exactly at 0 Libra) */
509
509
  {0, 0, FALSE, 0}, // 27: True Citra
@@ -400,15 +400,10 @@ extern "C" {
400
400
  #if MSDOS
401
401
  # define SE_EPHE_PATH "\\sweph\\ephe\\"
402
402
  #else
403
- # ifdef MACOS
404
- # define SE_EPHE_PATH ":ephe:"
405
- # else
406
403
  # define SE_EPHE_PATH ".:/users/ephe2/:/users/ephe/"
407
- /* At Astrodienst, we maintain two ephemeris areas for
408
- the thousands of asteroid files:
409
- the short files in /users/ephe/ast*,
410
- the long file in /users/ephe2/ast*. */
411
- # endif
404
+ /* At Astrodienst, we maintain two ephemeris areas for the 600'000+ asteroid files:
405
+ the short files in /users/ephe/ast*, the long file in /users/ephe2/ast*.
406
+ /users is a synonym for /home on many systems */
412
407
  #endif
413
408
  #endif /* SE_EPHE_PATH */
414
409
 
@@ -3151,7 +3151,7 @@ static double adjust_for_tidacc(double ans, double Y, double tid_acc, double tid
3151
3151
  }
3152
3152
 
3153
3153
  /* returns tidal acceleration used in swe_deltat() and swe_deltat_ex() */
3154
- double CALL_CONV swe_get_tid_acc()
3154
+ double CALL_CONV swe_get_tid_acc(void)
3155
3155
  {
3156
3156
  return swed.tid_acc;
3157
3157
  }
@@ -3183,7 +3183,7 @@ void CALL_CONV swe_set_delta_t_userdef(double dt)
3183
3183
  }
3184
3184
  }
3185
3185
 
3186
- int32 swi_guess_ephe_flag()
3186
+ int32 swi_guess_ephe_flag(void)
3187
3187
  {
3188
3188
  int32 iflag = SEFLG_SWIEPH;
3189
3189
  /* if jpl file is open, assume SEFLG_JPLEPH */
@@ -3933,9 +3933,9 @@ char *CALL_CONV swe_cs2degstr(CSEC t, char *a)
3933
3933
  * for definition of input see function swe_split_deg().
3934
3934
  * output:
3935
3935
  * ideg degrees,
3936
- * imin minutes,
3937
- * isec seconds,
3938
- * dsecfr fraction of seconds
3936
+ * imin minutes, (zero if rounding to degree)
3937
+ * isec seconds, (zero if rounding to minute)
3938
+ * dsecfr fraction of seconds (zero if rounding used)
3939
3939
  * inak nakshatra number;
3940
3940
  ******************************************************************/
3941
3941
  static void split_deg_nakshatra(double ddeg, int32 roundflag, int32 *ideg, int32 *imin, int32 *isec, double *dsecfr, int32 *inak)
@@ -3977,8 +3977,12 @@ static void split_deg_nakshatra(double ddeg, int32 roundflag, int32 *ideg, int32
3977
3977
  if (!(roundflag & (SE_SPLIT_DEG_ROUND_DEG | SE_SPLIT_DEG_ROUND_MIN | SE_SPLIT_DEG_ROUND_SEC))) {
3978
3978
  *dsecfr = ddeg * 3600 - *isec;
3979
3979
  } else {
3980
- *dsecfr = *isec; // is rounded, no fractional seconds
3980
+ *dsecfr = 0;
3981
3981
  }
3982
+ if (roundflag & (SE_SPLIT_DEG_ROUND_DEG))
3983
+ *imin = 0;
3984
+ if (roundflag & (SE_SPLIT_DEG_ROUND_DEG | SE_SPLIT_DEG_ROUND_MIN))
3985
+ *isec = 0;
3982
3986
  } /* end split_deg_nakshtra */
3983
3987
 
3984
3988
  /************************************************************
@@ -4003,8 +4007,8 @@ static void split_deg_nakshatra(double ddeg, int32 roundflag, int32 *ideg, int32
4003
4007
  * to 10d59'59" (or 10d59' or 10d) *
4004
4008
  * output:
4005
4009
  * ideg degrees,
4006
- * imin minutes,
4007
- * isec seconds,
4010
+ * imin minutes, (zero if rounding to degree)
4011
+ * isec seconds, (zero if rounding to minute or degree)
4008
4012
  * dsecfr fraction of seconds (zero if rounding used)
4009
4013
  * isgn zodiac sign number;
4010
4014
  * or +/- sign
@@ -4052,6 +4056,10 @@ void CALL_CONV swe_split_deg(double ddeg, int32 roundflag, int32 *ideg, int32 *i
4052
4056
  } else {
4053
4057
  *dsecfr = 0;
4054
4058
  }
4059
+ if (roundflag & (SE_SPLIT_DEG_ROUND_DEG))
4060
+ *imin = 0;
4061
+ if (roundflag & (SE_SPLIT_DEG_ROUND_DEG | SE_SPLIT_DEG_ROUND_MIN))
4062
+ *isec = 0;
4055
4063
  } /* end split_deg */
4056
4064
 
4057
4065
  double swi_kepler(double E, double M, double ecce)