home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / misc / volume30 / astrolog / part02 < prev    next >
Encoding:
Text File  |  1992-06-18  |  59.7 KB  |  2,047 lines

  1. Newsgroups: comp.sources.misc
  2. From: cruiser1@u.washington.edu (Walter D. Pullen)
  3. Subject:  v30i063:  astrolog - Generation of astrology charts v2.25, Part02/08
  4. Message-ID: <1992Jun18.185551.12470@sparky.imd.sterling.com>
  5. X-Md4-Signature: a8d52b30afe591645eb0aaabdb5f1aa9
  6. Date: Thu, 18 Jun 1992 18:55:51 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: cruiser1@u.washington.edu (Walter D. Pullen)
  10. Posting-number: Volume 30, Issue 63
  11. Archive-name: astrolog/part02
  12. Environment: UNIX, VMS
  13. Supersedes: astrolog: Volume 28, Issue 104-109
  14.  
  15. #! /bin/sh
  16. # This is a shell archive.  Remove anything before this line, then unpack
  17. # it by saving it into a file and typing "sh file".  To overwrite existing
  18. # files, type "sh file -c".  You can also feed this as standard input via
  19. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  20. # will see the following message at the end:
  21. #        "End of archive 2 (of 8)."
  22. # Contents:  formulas.c charts.c options.c
  23. # Wrapped by cruiser1@milton.u.washington.edu on Thu Jun 11 21:53:36 1992
  24. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  25. if test -f 'formulas.c' -a "${1}" != "-c" ; then 
  26.   echo shar: Will not clobber existing file \"'formulas.c'\"
  27. else
  28. echo shar: Extracting \"'formulas.c'\" \(18125 characters\)
  29. sed "s/^X//" >'formulas.c' <<'END_OF_FILE'
  30. X/*
  31. X** Astrolog (Version 2.25) File: formulas.c
  32. X**
  33. X** IMPORTANT: The planetary calculation routines used in this program
  34. X** have been Copyrighted and the core of this program is basically a
  35. X** conversion to C of the routines created by James Neely as listed in
  36. X** Michael Erlewine's 'Manual of Computer Programming for Astrologers',
  37. X** available from Matrix Software. The copyright gives us permission to
  38. X** use the routines for our own purposes but not to sell them or profit
  39. X** from them in any way.
  40. X*/
  41. X
  42. X#include "astrolog.h"
  43. X
  44. Xdouble MC, Asc, Vtx, OB,
  45. X  A, R, B, Q, L, G, O, RA, R1, R2, AZ, FF, LO, OA,
  46. X  S, S1, S2, AP, IN, AN, XX, YY, ZZ, NU, BR, AB, C, P, T0[4];
  47. X
  48. Xdouble geo[TOTAL+1], geoalt[TOTAL+1], georet[TOTAL+1],
  49. X  helio[TOTAL+1], helioalt[TOTAL+1], helioret[TOTAL+1],
  50. X  planet1[TOTAL+1], planet2[TOTAL+1], planetalt1[TOTAL+1], planetalt2[TOTAL+1],
  51. X  house1[SIGNS+1], house2[SIGNS+1], ret1[TOTAL+1], ret2[TOTAL+1];
  52. X
  53. X
  54. X/*
  55. X*******************************************************************************
  56. X** Specific calculations
  57. X*******************************************************************************
  58. X*/
  59. X
  60. Xvoid juliantomdy(JD, mon, day, yea)
  61. Xdouble JD, *mon, *day, *yea;
  62. X{
  63. X  double L, N, IT, JT, K, IK;
  64. X  L  = floor(JD+0.5)+68569.0;
  65. X  N  = floor(4.0*L/146097.0);
  66. X  L  = L-floor((146097.0*N+3.0)/4.0);
  67. X  IT = floor(4000.0*(L+1.0)/1461001.0);
  68. X  L  = L-floor(1461.0*IT/4.0)+31.0;
  69. X  JT = floor(80.0*L/2447.0);
  70. X  K  = L-floor(2447.0*JT/80.0);
  71. X  L  = floor(JT/11.0);
  72. X  JT = JT+2.0-12.0*L;
  73. X  IK = 100.0*(N-49.0)+IT+L;
  74. X  *mon = JT; *day = K; *yea = IK;
  75. X}
  76. X
  77. Xdouble mdytojulian(mon, day, yea)
  78. Xdouble mon, day, yea;
  79. X{
  80. X  double im, j;
  81. X  im = 12.0*(yea+4800.0)+mon-3.0;
  82. X  j = (2.0*(im-floor(im/12.0)*12.0)+7.0+365.0*im)/12.0;
  83. X  j = floor(j)+day+floor(im/48.0)-32083.0;
  84. X  if (j > 2299171.0)
  85. X    j += floor(im/4800.0)-floor(im/1200.0)+38.0;
  86. X  return j;
  87. X}
  88. X
  89. Xdouble processinput(var)
  90. Xint var;
  91. X{
  92. X  double Off, Ln;
  93. X  F = sgn(F)*floor(dabs(F))+(dabs(F)-floor(dabs(F)))*100.0/60.0+dectodeg(X);
  94. X  L5 = dectodeg(L5);
  95. X  LA = DTOR(dectodeg(LA));
  96. X  if (var) {
  97. X    JD = mdytojulian(M, D+Delta, Y);
  98. X    if (!progress)
  99. X      T = ((JD-2415020.0)+F/24.0-0.5)/36525.0;
  100. X    else
  101. X      T = (((Jdp-JD)/progday+JD)-2415020.0+F/24.0-0.5)/36525.0;
  102. X  }
  103. X  OB = DTOR(23.452294-0.0130125*T);
  104. X  Ln = mod((933060-6962911*T+7.5*T*T)/3600.0);
  105. X  Off = (259205536.0*T+2013816.0)/3600.0;
  106. X  Off = 17.23*sin(DTOR(Ln))+1.27*sin(DTOR(Off))-(5025.64+1.11*T)*T;
  107. X  Off = (Off-84038.27)/3600.0;
  108. X  SD = siderial ? Off : 0.0;
  109. X  return Off;
  110. X}
  111. X
  112. Xpoltorec(A, R, X, Y)
  113. Xdouble A, R, *X, *Y;
  114. X{
  115. X  if (A == 0.0)
  116. X    A = 1.7453E-09;
  117. X  *X = R*cos(A);
  118. X  *Y = R*sin(A);
  119. X}
  120. X
  121. Xrectopol(X, Y, A, R)
  122. Xdouble X, Y, *A, *R;
  123. X{
  124. X  if (Y == 0.0)
  125. X    Y = 1.7453E-09;
  126. X  *R = sqrt(X*X+Y*Y);
  127. X  *A = atan(Y/X);
  128. X  if (*A < 0.0)
  129. X    *A += PI;
  130. X  if (Y < 0.0)
  131. X    *A += PI;
  132. X}
  133. X
  134. Xrectosph()
  135. X{
  136. X  A = B; R = 1.0;
  137. X  poltorec(A, R, &X, &Y);
  138. X  Q = Y; R = X; A = L;
  139. X  poltorec(A, R, &X, &Y);
  140. X  G = X; X = Y; Y = Q;
  141. X  rectopol(X, Y, &A, &R);
  142. X  A += O;
  143. X  poltorec(A, R, &X, &Y);
  144. X  Q = ASIN(Y);
  145. X  Y = X; X = G;
  146. X  rectopol(X, Y, &A, &R);
  147. X  if (A < 0.0)
  148. X    A += 2*PI;
  149. X  G = A;
  150. X}
  151. X
  152. Xvoid coorxform(azi, alt, tilt)
  153. Xdouble *azi, *alt, tilt;
  154. X{
  155. X  double x, y, a1, l1;
  156. X  x = cos(*alt)*sin(*azi)*cos(tilt);
  157. X  y = sin(*alt)*sin(tilt);
  158. X  x -= y;
  159. X  a1 = cos(*alt);
  160. X  y = cos(*alt)*cos(*azi);
  161. X  l1 = atan(x/y);
  162. X  if (l1 < 0.0)
  163. X    l1 += PI;
  164. X  if (x < 0.0)
  165. X    l1 += PI;
  166. X  a1 = ASIN(a1*sin(*azi)*sin(tilt)+sin(*alt)*cos(tilt));
  167. X  *azi = l1; *alt = a1;
  168. X}
  169. X
  170. Xcomputevariables()
  171. X{
  172. X  RA = DTOR(mod((6.6460656+2400.0513*T+2.58E-5*T*T+F)*15.0-L5));
  173. X  R2 = RA; O = -OB; B = LA; A = R2; R = 1.0;
  174. X  poltorec(A, R, &X, &Y);
  175. X  X *= cos(O);
  176. X  rectopol(X, Y, &A, &R);
  177. X  MC = mod(SD+RTOD(A));
  178. X  L = R2;
  179. X  rectosph();
  180. X  AZ = mod(SD+mod(G+PI/2.0));
  181. X  L= R2+PI; B = PI/2.0-dabs(B);
  182. X  if (LA < 0.0)
  183. X    B = -B;
  184. X  rectosph();
  185. X  Vtx = mod(SD+RTOD(G+PI/2.0));
  186. X}
  187. X
  188. X
  189. X/*
  190. X*******************************************************************************
  191. X** House cusp calculations
  192. X*******************************************************************************
  193. X*/
  194. X
  195. Xint inhouseplace(point)
  196. Xdouble point;
  197. X{
  198. X  int i = 0;
  199. X  do {
  200. X    i++;
  201. X  } while (!(i >= SIGNS ||
  202. X         (point >= house[i] && point < house[mod12(i+1)]) ||
  203. X         (house[i] > house[mod12(i+1)] &&
  204. X          (point >= house[i] || point < house[mod12(i+1)]))));
  205. X  return i;
  206. X}
  207. X
  208. Xvoid houseplace()
  209. X{
  210. X  int i;
  211. X  for (i = 1; i <= total; i++)
  212. X    inhouse[i] = inhouseplace(planet[i]);
  213. X}
  214. X
  215. Xdouble midheaven()
  216. X{
  217. X  double MC;
  218. X  MC = atan(tan(RA)/cos(OB));
  219. X  if (MC < 0.0)
  220. X    MC += PI;
  221. X  if (RA > PI)
  222. X    MC += PI;
  223. X  return mod(RTOD(MC)+SD);
  224. X}
  225. X
  226. Xdouble ascendant()
  227. X{
  228. X  double Asc;
  229. X  Asc = atan(cos(RA)/(-sin(RA)*cos(OB)-tan(LA)*sin(OB)));
  230. X  if (Asc < 0.0)
  231. X    Asc += PI;
  232. X  if (cos(RA) < 0.0)
  233. X    Asc += PI;
  234. X  return mod(RTOD(Asc)+SD);
  235. X}
  236. X
  237. Xplacidus_cusp()
  238. X{
  239. X  int i;
  240. X  X = -1.0;
  241. X  if (Y == 1.0)
  242. X    X = 1.0;
  243. X  for (i = 1; i <= 10; i++) {
  244. X    XX = ACOS(X*sin(R1)*tan(OB)*tan(LA));
  245. X    if (XX < 0.0)
  246. X      XX += PI;
  247. X    R2 = RA+(XX/FF);
  248. X    if (Y == 1.0)
  249. X      R2 = RA+PI-(XX/FF);
  250. X    R1 = R2;
  251. X  }
  252. X  LO = atan(tan(R1)/cos(OB));
  253. X  if (LO < 0.0)
  254. X    LO += PI;
  255. X  if (sin(R1) < 0.0)
  256. X    LO += PI;
  257. X  LO = RTOD(LO);
  258. X}
  259. X
  260. Xplacidus()
  261. X{
  262. X  int i;
  263. X  Y = 0.0;
  264. X  house[4] = mod(MC+180.0-SD);
  265. X  house[1] = mod(Asc-SD);
  266. X  R1 = RA+DTOR(30.0);  FF=3.0; placidus_cusp(); house[5]=mod(LO+180.0);
  267. X  R1 = RA+DTOR(60.0);  FF=1.5; placidus_cusp(); house[6]=mod(LO+180.0);
  268. X  R1 = RA+DTOR(120.0); Y=1.0;  placidus_cusp(); house[2]=LO;
  269. X  R1 = RA+DTOR(150.0); FF=3.0; placidus_cusp(); house[3]=LO;
  270. X  for (i = 1; i <= SIGNS; i++) {
  271. X    house[i] = mod(house[i]+SD);
  272. X    if (i > 6)
  273. X      house[i] = mod(house[i-6]+180.0);
  274. X  }
  275. X}
  276. X
  277. Xkoch()
  278. X{
  279. X  double A1, A2, A3, KN;
  280. X  int i;
  281. X  A1 = ASIN(sin(RA)*tan(LA)*tan(OB));
  282. X  for (i = 1; i <= SIGNS; i++) {
  283. X    D = mod(60.0+30.0*(double)i);
  284. X    A2 = D/90.0-1.0; KN = 1.0;
  285. X    if (D >= 180.0) {
  286. X      KN = -1.0;
  287. X      A2 = D/90.0-3.0;
  288. X    }
  289. X    A3 = DTOR(mod(RTOD(RA)+D+A2*RTOD(A1)));
  290. X    X = atan(sin(A3)/(cos(A3)*cos(OB)-KN*tan(LA)*sin(OB)));
  291. X    if (X < 0.0)
  292. X      X += PI;
  293. X    if (sin(A3) < 0.0)
  294. X      X += PI;
  295. X    house[i] = mod(RTOD(X)+SD);
  296. X  }
  297. X}
  298. X
  299. Xequal()
  300. X{
  301. X  int i;
  302. X  for (i = 1; i <= SIGNS; i++) {
  303. X    house[i] = mod(Asc-30.0+30.0*(double)i);
  304. X  }
  305. X}
  306. X
  307. Xcampanus()
  308. X{
  309. X  double KO, DN;
  310. X  int i;
  311. X  for (i = 1; i <= SIGNS; i++) {
  312. X    KO = DTOR(60.000001+30.0*(double)i);
  313. X    DN = atan(tan(KO)*cos(LA));
  314. X    if (DN < 0.0)
  315. X      DN += PI;
  316. X    if (sin(KO) < 0.0)
  317. X      DN += PI;
  318. X    Y = sin(RA+DN);
  319. X    X = cos(RA+DN)*cos(OB)-sin(DN)*tan(LA)*sin(OB);
  320. X    X = atan(Y/X);
  321. X    if (X < 0.0)
  322. X      X += PI;
  323. X    if (Y < 0.0)
  324. X      X += PI;
  325. X    house[i] = mod(RTOD(X)+SD);
  326. X  }
  327. X}
  328. X
  329. Xmeridian()
  330. X{
  331. X  int i;
  332. X  for (i = 1; i <= SIGNS; i++) {
  333. X    D = DTOR(60.0+30.0*(double)i);
  334. X    Y = sin(RA+D);
  335. X    X = atan(Y/(cos(RA+D)*cos(OB)));
  336. X    if (X < 0.0)
  337. X      X += PI;
  338. X    if (Y < 0.0)
  339. X      X += PI;
  340. X    house[i] = mod(RTOD(X)+SD);
  341. X  }
  342. X}
  343. X
  344. Xregiomontanus()
  345. X{
  346. X  int i;
  347. X  for (i = 1; i <= SIGNS; i++) {
  348. X    D = DTOR(60.0+30.0*i);
  349. X    Y = sin(RA+D);
  350. X    X = atan(Y/(cos(RA+D)*cos(OB)-sin(D)*tan(LA)*sin(OB)));
  351. X    if (X < 0.0)
  352. X      X += PI;
  353. X    if (Y < 0.0)
  354. X      X += PI;
  355. X    house[i] = mod(RTOD(X)+SD);
  356. X  }
  357. X}
  358. X
  359. Xporphyry()
  360. X{
  361. X  int i;
  362. X  X = Asc-MC;
  363. X  if (X < 0.0)
  364. X    X += 360;
  365. X  Y = X/3.0;
  366. X  for (i = 1; i <= 2; i++)
  367. X    house[i+4] = mod(180.0+MC+i*Y);
  368. X  X = mod(180.0+MC)-Asc;
  369. X  if (X < 0.0)
  370. X    X += 360;
  371. X  house[1]=Asc;
  372. X  Y = X/3.0;
  373. X  for (i = 1; i <= 3; i++)
  374. X    house[i+1] = mod(Asc+i*Y);
  375. X  for (i = 1; i <= 6; i++)
  376. X    house[i+6] = mod(house[i]+180.0);
  377. X}
  378. X
  379. Xmorinus()
  380. X{
  381. X  int i;
  382. X  for (i = 1; i <= SIGNS; i++) {
  383. X    D = DTOR(60.0+30.0*(double)i);
  384. X    Y = sin(RA+D)*cos(OB);
  385. X    X = atan(Y/cos(RA+D));
  386. X    if (X < 0.0)
  387. X      X += PI;
  388. X    if (Y < 0.0)
  389. X      X += PI;
  390. X    house[i] = mod(RTOD(X)+SD);
  391. X  }
  392. X}
  393. X
  394. Xtopocentric_cusp()
  395. X{
  396. X  X = atan(tan(LA)/cos(OA));
  397. X  Y = X+OB;
  398. X  LO = atan(cos(X)*tan(OA)/cos(Y));
  399. X  if (LO < 0.0)
  400. X    LO += PI;
  401. X  if (sin(OA) < 0.0)
  402. X    LO += PI;
  403. X}
  404. X
  405. Xtopocentric()
  406. X{
  407. X  double TL, P1, P2, LT;
  408. X  int i;
  409. X  modulus = 2.0*PI;
  410. X  house[4] = mod(DTOR(MC+180.0-SD));
  411. X  TL = tan(LA); P1 = atan(TL/3.0); P2 = atan(TL/1.5); LT = LA;
  412. X  LA = P1; OA = mod(RA+DTOR(30.0)); topocentric_cusp(); house[5] = mod(LO+PI);
  413. X  LA = P2; OA = mod(OA+DTOR(30.0)); topocentric_cusp(); house[6] = mod(LO+PI);
  414. X  LA = LT; OA = mod(OA+DTOR(30.0)); topocentric_cusp(); house[1] = LO;
  415. X  LA = P2; OA = mod(OA+DTOR(30.0)); topocentric_cusp(); house[2] = LO;
  416. X  LA = P1; OA = mod(OA+DTOR(30.0)); topocentric_cusp(); house[3] = LO;
  417. X  LA = LT; modulus = DEGREES;
  418. X  for (i = 1; i <= 6; i++) {
  419. X    house[i] = mod(RTOD(house[i])+SD);
  420. X    house[i+6] = mod(house[i]+180.0);
  421. X  }
  422. X}
  423. X
  424. Xnull()
  425. X{
  426. X  int i;
  427. X  for (i = 1; i <= SIGNS; i++)
  428. X    house[i] = mod((double)(i-1)*30.0+SD);
  429. X}
  430. X
  431. Xhouses(housesystem)
  432. Xint housesystem;
  433. X{
  434. X  switch (housesystem) {
  435. X  case  1: koch();          break;
  436. X  case  2: equal();         break;
  437. X  case  3: campanus();      break;
  438. X  case  4: meridian();      break;
  439. X  case  5: regiomontanus(); break;
  440. X  case  6: porphyry();      break;
  441. X  case  7: morinus();       break;
  442. X  case  8: topocentric();   break;
  443. X  case  9: null();          break;
  444. X  default: placidus();
  445. X  }
  446. X}
  447. X
  448. X
  449. X/*
  450. X*******************************************************************************
  451. X** Planetary position calculations
  452. X*******************************************************************************
  453. X*/
  454. X
  455. Xdouble readthree()
  456. X{
  457. X  S = readplanetdata(FALSE); S1 = readplanetdata(FALSE);
  458. X  S2 = readplanetdata(FALSE);
  459. X  return S = DTOR(S+S1*T+S2*T*T);
  460. X}
  461. X
  462. Xrectosph2()
  463. X{
  464. X  rectopol(X, Y, &A, &R); A += AP; poltorec(A, R, &X, &Y);
  465. X  D = X; X = Y; Y = 0.0; rectopol(X, Y, &A, &R);
  466. X  A += IN; poltorec(A, R, &X, &Y);
  467. X  G = Y; Y = X; X = D; rectopol(X, Y, &A, &R); A += AN;
  468. X  if (A < 0.0)
  469. X    A += 2.0*PI;
  470. X  poltorec(A, R, &X, &Y);
  471. X}
  472. X
  473. Xerrorcorrect(ind)
  474. Xint ind;
  475. X{
  476. X  double U, V, W;
  477. X  int IK, IJ, errorindex;
  478. X  errorindex = errorcount[ind];
  479. X  for (IK = 1; IK <= 3; IK++) {
  480. X    if (ind == 6 && IK == 3) {
  481. X      T0[3]=0;
  482. X      return;
  483. X    }
  484. X    if (IK == 3)
  485. X      errorindex--;
  486. X    readthree(); A = 0.0;
  487. X    for (IJ = 1; IJ <= errorindex; IJ++) {
  488. X      U = readplanetdata(FALSE); V = readplanetdata(FALSE);
  489. X      W = readplanetdata(FALSE);
  490. X      A = A+DTOR(U)*cos((V*T+W)*PI/180.0);
  491. X    }
  492. X    T0[IK] = RTOD(S+A);
  493. X  }
  494. X}
  495. X
  496. Xprocessplanet(ind)
  497. Xint ind;
  498. X{
  499. X  X = XX; Y = YY; rectopol(X, Y, &A, &R);
  500. X  C = RTOD(A)+NU-BR;
  501. X  if (ind == 1 && AB == 1.0)
  502. X    C = mod(C+180.0);
  503. X  C = mod(C+SD); Y = ZZ; X = R; rectopol(X, Y, &A, &R);
  504. X  P = RTOD(A);
  505. X}
  506. X
  507. Xplanets()
  508. X{
  509. X  double AU, E, EA, E1, XK, XW, YW, XH[BASE+1], YH[BASE+1], ZH[BASE+1];
  510. X  int ind, i;
  511. X  readplanetdata(TRUE);
  512. X  for (ind = 1; ind <= (uranian ? BASE : PLANETS+1);
  513. X       ind += (ind == 1 ? 2 : (ind != PLANETS+1 ? 1 : 10))) {
  514. X    modulus = 2.0*PI;
  515. X    EA = M = mod(readthree());
  516. X    E = RTOD(readthree());
  517. X    for (i = 1; i <= 5; i++)
  518. X      EA = M+E*sin(EA);
  519. X    AU = readplanetdata(FALSE);
  520. X    E1 = 0.01720209/(pow(AU,1.5)*(1.0-E*cos(EA)));
  521. X    XW = -AU*E1*sin(EA);
  522. X    YW = AU*E1*pow(1.0-E*E,0.5)*cos(EA);
  523. X    AP = readthree(); AN = readthree(); IN = readthree();
  524. X    X = XW; Y = YW; rectosph2();
  525. X    XH[ind] = X; YH[ind] = Y; ZH[ind] = G;
  526. X    modulus = DEGREES;
  527. X    if (ind > 1) {
  528. X      XW = XH[ind]-XH[1]; YW = YH[ind]-YH[1];
  529. X    }
  530. X    X = AU*(cos(EA)-E); Y = AU*sin(EA)*pow(1.0-E*E,0.5); rectosph2();
  531. X    XX = X; YY = Y; ZZ = G;
  532. X    if (ind >= 6 && ind <= 10) {
  533. X      errorcorrect(ind); XX += T0[2]; YY += T0[1]; ZZ += T0[3];
  534. X    }
  535. X    helioret[ind] = XK = (XX*YH[ind]-YY*XH[ind])/(XX*XX+YY*YY);
  536. X    spacex[ind] = XX; spacey[ind] = YY; spacez[ind] = ZZ;
  537. X    BR = 0.0; processplanet(ind); helio[ind] = C; helioalt[ind] = P; AB = 1.0;
  538. X    if (ind > 1) {
  539. X      XX -= spacex[1]; YY -= spacey[1]; ZZ -= spacez[1];
  540. X      XK = (XX*YW-YY*XW)/(XX*XX+YY*YY);
  541. X    }
  542. X    BR = 0.0057756*sqrt(XX*XX+YY*YY+ZZ*ZZ)*RTOD(XK);
  543. X    georet[ind] = XK; processplanet(ind); geo[ind] = C; geoalt[ind] = P;
  544. X    if (!centerplanet) {
  545. X      planet[ind] = helio[ind]; planetalt[ind] = helioalt[ind];
  546. X      ret[ind] = helioret[ind];
  547. X    } else {
  548. X      planet[ind] = geo[ind]; planetalt[ind] = geoalt[ind];
  549. X      ret[ind] = georet[ind];
  550. X    }
  551. X    if (todisplay & 32768)
  552. X      ret[ind] = DTOR(ret[ind]/helioret[ind]);
  553. X  }
  554. X  spacex[0] = spacey[0] = spacez[0] = 0.0;
  555. X  ind = centerplanet;
  556. X  if (ind) {
  557. X    for (i = 0; i <= BASE; i++) if (i != 2 && i != ind) {
  558. X      spacex[i] -= spacex[ind]; spacey[i] -= spacey[ind];
  559. X      spacez[i] -= spacez[ind];
  560. X    }
  561. X    spacex[ind] = spacey[ind] = spacez[ind] = 0.0;
  562. X    swapdoub(&spacex[0], &spacex[ind]);
  563. X    swapdoub(&spacey[0], &spacey[ind]);
  564. X    swapdoub(&spacez[0], &spacez[ind]);
  565. X    swapdoub(&spacex[1], &spacex[ind]);
  566. X    swapdoub(&spacey[1], &spacey[ind]);
  567. X    swapdoub(&spacez[1], &spacez[ind]);
  568. X  }
  569. X  if (ind > 2)
  570. X    for (i = 1; i <= (uranian ? BASE : PLANETS+1);
  571. X     i += (i == 1 ? 2 : (i != PLANETS+1 ? 1 : 10))) {
  572. X      XX = spacex[i]; YY = spacey[i]; ZZ = spacez[i];
  573. X      AB = 0.0; BR = 0.0; processplanet(i);
  574. X      planet[i] = C; planetalt[i] = P;
  575. X      ret[i] = (XX*(YH[i]-YH[ind])-YY*(XH[i]-XH[ind]))/(XX*XX+YY*YY);
  576. X    }
  577. X}
  578. X
  579. X
  580. X/*
  581. X*******************************************************************************
  582. X** Lunar position calculations
  583. X*******************************************************************************
  584. X*/
  585. X
  586. Xlunar(moonlo, moonla, nodelo, nodela)
  587. Xdouble *moonlo, *moonla, *nodelo, *nodela;
  588. X{
  589. X  double LL, G, N, G1, D, L, ML, L1, MB, TN, M = 3600.0;
  590. X  LL = 973563.0+1732564379.0*T-4.0*T*T;
  591. X  G = 1012395.0+6189.0*T;
  592. X  N = 933060.0-6962911.0*T+7.5*T*T;
  593. X  G1 = 1203586.0+14648523.0*T-37.0*T*T;
  594. X  D = 1262655.0+1602961611.0*T-5.0*T*T;
  595. X  L = (LL-G1)/M; L1 = ((LL-D)-G)/M; F = (LL-N)/M; D = D/M; Y = 2.0*D;
  596. X  ML = 22639.6*SIND(L)-4586.4*SIND(L-Y)+2369.9*SIND(Y)+769.0*SIND(2.0*L)-
  597. X    669.0*SIND(L1)-411.6*SIND(2.0*F)-212.0*SIND(2.0*L-Y)-206.0*SIND(L+L1-Y);
  598. X  ML += 192.0*SIND(L+Y)-165.0*SIND(L1-Y)+148.0*SIND(L-L1)-125.0*SIND(D)-
  599. X    110.0*SIND(L+L1)-55.0*SIND(2.0*F-Y)-45.0*SIND(L+2.0*F)+ 40.0*SIND(L-2.0*F);
  600. X  *moonlo = G = mod((LL+ML)/M+SD);
  601. X  MB = 18461.5*SIND(F)+1010.0*SIND(L+F)-999.0*SIND(F-L)-624.0*SIND(F-Y)+
  602. X    199.0*SIND(F+Y-L)-167.0*SIND(L+F-Y);
  603. X  MB += 117.0*SIND(F+Y)+62.0*SIND(2.0*L+F)-
  604. X    33.0*SIND(F-Y-L)-32.0*SIND(F-2.0*L)-30.0*SIND(L1+F-Y);
  605. X  *moonla = MB =
  606. X    sgn(MB)*((dabs(MB)/M)/DEGREES-floor((dabs(MB)/M)/DEGREES))*DEGREES;
  607. X  /*TN = N+5392.0*SIND(2.0*F-Y)-541.0*SIND(L1)-442.0*SIND(Y)+423.0*SIND(2.0*F)-
  608. X    291.0*SIND(2.0*L-2.0*F);
  609. X  TN = mod(TN/M);*/
  610. X  *nodelo = N = mod(N/M+SD);
  611. X  *nodela = 0.0;
  612. X}
  613. X
  614. X
  615. X/*
  616. X*******************************************************************************
  617. X** Star position calculations
  618. X*******************************************************************************
  619. X*/
  620. X
  621. Xint strcmp(s1, s2)
  622. Xchar *s1, *s2;
  623. X{
  624. X  int i = 0;
  625. X  while (s1[i] == s2[i] && s1[i] != 0)
  626. X    i++;
  627. X  return (s1[i] == s2[i] ? 0 : (s1[i] > s2[i] ? 1 : -1));
  628. X}
  629. X
  630. Xvoid caststar(SD)
  631. Xdouble SD;
  632. X{
  633. X  int i, j;
  634. X  double x, y, z;
  635. X  readstardata(TRUE);
  636. X  for (i = 1; i <= stars; i++) {
  637. X    x = readstardata(FALSE); y = readstardata(FALSE); z = readstardata(FALSE);
  638. X    planet[BASE+i] = DTOR(mod(x*DEGREES/24.0+y*15.0/60.0+z*0.25/60.0-SD));
  639. X    x = readstardata(FALSE); y = readstardata(FALSE); z = readstardata(FALSE);
  640. X    planetalt[BASE+i] = DTOR(x+y/60.0+z/60.0/60.0);
  641. X    equtoecl(&planet[BASE+i], &planetalt[BASE+i]);
  642. X    planet[BASE+i] = RTOD(planet[BASE+i]);
  643. X    planetalt[BASE+i] = RTOD(planetalt[BASE+i]);
  644. X    starname[i] = i;
  645. X  }
  646. X  if (universe > 1) for (i = 2; i <= stars; i++) {
  647. X    j = i-1;
  648. X    if (universe == 'n') while (j > 0 &&
  649. X      strcmp(objectname[BASE+starname[j]],
  650. X         objectname[BASE+starname[j+1]]) > 0) {
  651. X      swapint(&starname[j], &starname[j+1]);
  652. X      j--;
  653. X    } else if (universe == 'b') while (j > 0 &&
  654. X      starbright[starname[j]] > starbright[starname[j+1]]) {
  655. X      swapint(&starname[j], &starname[j+1]);
  656. X      j--;
  657. X    } else if (universe == 'z') while (j > 0 &&
  658. X      planet[BASE+starname[j]] > planet[BASE+starname[j+1]]) {
  659. X      swapint(&starname[j], &starname[j+1]);
  660. X      j--;
  661. X    } else if (universe == 'l') while (j > 0 &&
  662. X      planetalt[BASE+starname[j]] < planetalt[BASE+starname[j+1]]) {
  663. X      swapint(&starname[j], &starname[j+1]);
  664. X      j--;
  665. X    }
  666. X  }
  667. X}
  668. X
  669. X
  670. X/*
  671. X*******************************************************************************
  672. X** Calculate chart for specific time
  673. X*******************************************************************************
  674. X*/
  675. X
  676. Xdouble castchart(var)
  677. Xint var;
  678. X{
  679. X  int i, k;
  680. X  double housetemp[SIGNS+1], Off = 0.0, j;
  681. X  if (M == -1.0) {
  682. X    MC = planet[18]; Asc = planet[19]; Vtx = planet[20];
  683. X  } else {
  684. X    Off = processinput(var); computevariables();
  685. X    if (geodetic)
  686. X      RA = DTOR(mod(-L5));
  687. X    MC = midheaven(); Asc = ascendant();
  688. X    houses(housesystem);
  689. X    for (i = 1; i <= total; i++)
  690. X      ret[i] = 1.0;
  691. X    planets();
  692. X    lunar(&planet[2], &planetalt[2], &planet[16], &planetalt[16]);
  693. X    ret[16] = -1.0;
  694. X    j = planet[2]-planet[1]; j = dabs(j) < 90.0 ? j : j - sgn(j)*DEGREES;
  695. X    planet[17] = mod(j+Asc);
  696. X    planet[18] = MC; planet[19] = Asc; planet[20] = Vtx;
  697. X    planet[21] = house[11]; planet[22] = house[12];
  698. X    planet[23] = house[2];  planet[24] = house[3];
  699. X  }
  700. X  if (universe)
  701. X    caststar(siderial ? 0.0 : Off);
  702. X  if (multiplyfactor > 1)
  703. X    for (i = 1; i <= total; i++)
  704. X      planet[i] = mod(planet[i] * (double)multiplyfactor);
  705. X  if (onasc) {
  706. X    j = planet[onasc]-Asc;
  707. X    for (i = 1; i <= SIGNS; i++)
  708. X      house[i] = mod(house[i]+j);
  709. X  }
  710. X  houseplace();
  711. X  if (flip) {
  712. X    for (i = 1; i <= total; i++) {
  713. X      k = inhouse[i];
  714. X      inhouse[i] = (int) (planet[i]/30.0)+1;
  715. X      planet[i] = (double)(k-1)*30.0+mindistance(house[k], planet[i])/
  716. X    mindistance(house[k], house[mod12(k+1)])*30.0;
  717. X    }
  718. X    for (i = 1; i <= SIGNS; i++) {
  719. X      k = inhouseplace((double) (i-1)*30.0);
  720. X      housetemp[i] = (double)(k-1)*30.0+mindistance(house[k],
  721. X        (double) (i-1)*30.0)/mindistance(house[k], house[mod12(k+1)])*30.0;
  722. X    }
  723. X    for (i = 1; i <= SIGNS; i++)
  724. X      house[i] = housetemp[i];
  725. X  }
  726. X  if (decan)
  727. X    for (i = 1; i <= total; i++) {
  728. X      k = (int) (planet[i]/30.0)+1;
  729. X      j = planet[i] - (double)((k-1)*30);
  730. X      k = mod12(k + 4*((int)floor(j/10.0)));
  731. X      j = (j - floor(j/10.0)*10.0)*3.0;
  732. X      planet[i] = (double)(k-1)*30.0+j;
  733. X      houseplace();
  734. X    }
  735. X  return T;
  736. X}
  737. X
  738. X/**/
  739. END_OF_FILE
  740. if test 18125 -ne `wc -c <'formulas.c'`; then
  741.     echo shar: \"'formulas.c'\" unpacked with wrong size!
  742. fi
  743. # end of 'formulas.c'
  744. fi
  745. if test -f 'charts.c' -a "${1}" != "-c" ; then 
  746.   echo shar: Will not clobber existing file \"'charts.c'\"
  747. else
  748. echo shar: Extracting \"'charts.c'\" \(20844 characters\)
  749. sed "s/^X//" >'charts.c' <<'END_OF_FILE'
  750. X/*
  751. X** Astrolog (Version 2.25) File: charts.c
  752. X**
  753. X** IMPORTANT: The planetary calculation routines used in this program
  754. X** have been Copyrighted and the core of this program is basically a
  755. X** conversion to C of the routines created by James Neely as listed in
  756. X** Michael Erlewine's 'Manual of Computer Programming for Astrologers',
  757. X** available from Matrix Software. The copyright gives us permission to
  758. X** use the routines for our own purposes but not to sell them or profit
  759. X** from them in any way.
  760. X*/
  761. X
  762. X#include "astrolog.h"
  763. X
  764. Xint wheel[SIGNS][WHEELROWS];
  765. X
  766. X/*
  767. X*******************************************************************************
  768. X** Display subprograms
  769. X*******************************************************************************
  770. X*/
  771. X
  772. Xvoid chartlocation()
  773. X{
  774. X  int i, j, k;
  775. X  int count = 0, elemode[4][3], elem[4], mo[3], pos = 0, abo = 0, lef = 0;
  776. X  for (i = 0; i < 4; i++)
  777. X    elem[i] = 0;
  778. X  for (j = 0; j < 3; j++)
  779. X    mo[j] = 0;
  780. X  for (i = 0; i < 4; i++)
  781. X    for (j = 0; j < 3; j++)
  782. X      elemode[i][j] = 0;
  783. X  for (i = 1; i <= total; i++) if (!ignore[i]) {
  784. X    count++;
  785. X    j = (int) (planet[i]/30.0) + 1;
  786. X    elemode[(j-1)%4][(j-1)%3]++;
  787. X    elem[(j-1)%4]++; mo[(j-1)%3]++;
  788. X    pos += (j & 1);
  789. X    j = inhouse[i];
  790. X    abo += (j >= 7);
  791. X    lef += (j < 4 || j >= 10);
  792. X  }
  793. X  printf("Astrolog (%s) chart ", VERSION);
  794. X  if (Mon == -1)
  795. X    printf("(no time or space)\n");
  796. X  else if (relation == 2)
  797. X    printf("(composite)\n");
  798. X  else {
  799. X    i = (int) ((dabs(Tim)-floor(dabs(Tim)))*100.0+0.5);
  800. X    j = (int) ((dabs(Zon)-floor(dabs(Zon)))*100.0+0.5);
  801. X    printf("for %d %s %d %.0f:%d%d (%c%.0f:%d%d GMT) ",
  802. X       (int) Day, monthname[(int) Mon], (int) Yea, floor(Tim), 
  803. X       i/10, i%10, Zon > 0.0 ? '-' : '+', dabs(Zon), j/10, j%10);
  804. X    printf("%s\n", stringlocation(Lon, Lat, 100.0));
  805. X  }
  806. X  printf("Body  Locat. Ret. Decl. Rul.      House  Rul. Veloc.    ");
  807. X  printf("%s Houses.\n\n", systemname[housesystem]);
  808. X  for (i = 1; i <= BASE; i++)
  809. X    if (i <= objects || (i > objects+4 && !ignore[i])) {
  810. X    printf("%c%c%c%c: ", OBJNAM(i), objectname[i][3] ? objectname[i][3] : ' ');
  811. X    printminute(planet[i]);
  812. X    printf(" %c ", ret[i] >= 0.0 ? ' ' : 'R');
  813. X    printaltitude(planetalt[i]);
  814. X    printf(" (%c)", dignify(i, (int) (planet[i]/30.0)+1));
  815. X    j = inhouse[i];
  816. X    printf(" [%2d%c%c house]", j, post[j][0], post[j][1]);
  817. X    printf(" [%c]", dignify(i, j));
  818. X    if (i != 2 && i < THINGS || i > objects+4)
  819. X      printf(" %c%5.3f", ret[i] < 0.0 ? '-' : '+', RTOD(dabs(ret[i])));
  820. X    else
  821. X      printf(" ______");
  822. X    if (i <= SIGNS) {
  823. X      printf("  -  House cusp %2d: ", i);
  824. X      printminute(house[i]);
  825. X    }
  826. X    if (i == SIGNS+2)
  827. X      printf("     Car Fix Mut TOT");
  828. X    else if (i > SIGNS+2 && i < SIGNS+7) {
  829. X      j = i-(SIGNS+2)-1;
  830. X      printf("  %c%c%c%3d %3d %3d %3d",
  831. X         element[j][0], element[j][1], element[j][2],
  832. X         elemode[j][0], elemode[j][1], elemode[j][2], elem[j]);
  833. X    } else if (i == SIGNS+7)
  834. X      printf("  TOT %2d %3d %3d %3d", mo[0], mo[1], mo[2], count);
  835. X    else if (i > objects)
  836. X      printf("  Uranian #%d", i-objects-4);
  837. X    switch (i-SIGNS-1) {
  838. X    case 1: printf("   +:%2d", pos);       break;
  839. X    case 2: printf("   -:%2d", count-pos); break;
  840. X    case 3: printf("   M:%2d", abo);       break;
  841. X    case 4: printf("   N:%2d", count-abo); break;
  842. X    case 5: printf("   A:%2d", lef);       break;
  843. X    case 6: printf("   D:%2d", count-lef); break;
  844. X    }
  845. X    putchar('\n');
  846. X  }
  847. X  if (universe) for (i = BASE+1; i <= total; i++) if (!ignore[i]) {
  848. X    j = BASE+starname[i-BASE];
  849. X    printf("%c%c%c%c: ", OBJNAM(j), objectname[j][3]);
  850. X    printminute(planet[j]);
  851. X    printf("   ");
  852. X    printaltitude(planetalt[j]);
  853. X    k = inhouse[j];
  854. X    printf("     [%2d%c%c house]", k, post[k][0], post[k][1]);
  855. X    printf("     ______  Star #%2d: %5.2f\n", i-BASE, starbright[j-BASE]);
  856. X  }
  857. X}
  858. X
  859. Xvoid chartgrid()
  860. X{
  861. X  int i, j, k, temp;
  862. X  for (j = 1; j <= total; j++) if (!ignore[j])
  863. X    for (k = 1; k <= 3; k++) {
  864. X      for (i = 1; i <= total; i++) if (!ignore[i]) {
  865. X    if (i > 1 && j+k > 2)
  866. X      putchar('|');
  867. X    if (k > 1) {
  868. X      if (i < j) {
  869. X        if (k < 3)
  870. X          printf("%s", aspectabbrev[gridname[i][j]]);
  871. X        else {
  872. X          if (gridname[i][j]) {
  873. X        if (grid[i][j] < 100)
  874. X          printf("%d%c%d", abs(grid[i][j])/10,
  875. X             grid[i][j] < 0 ? ',' : '.', abs(grid[i][j])%10);
  876. X        else if (grid[i][j] < 1000)
  877. X          printf("%2d%c", abs(grid[i][j])/10,
  878. X             grid[i][j] < 0 ? ',' : '.');
  879. X        else
  880. X          printf("%3d", abs(grid[i][j])/10);
  881. X          } else
  882. X        printf("   ");
  883. X        }
  884. X      } else if (i > j) {
  885. X        if (k < 3)
  886. X          printf("%d%d'", grid[i][j]/10, grid[i][j]%10);
  887. X        else {
  888. X          temp = gridname[i][j];
  889. X          printf("%c%c%c", SIGNAM(temp));
  890. X        }
  891. X      } else {
  892. X        if (k < 3)
  893. X          printf("%c%c%c", OBJNAM(j));
  894. X        else
  895. X          printf("###");
  896. X      }
  897. X    } else
  898. X      if (j > 1)
  899. X        printf("---");
  900. X      }
  901. X      if (j+k > 2)
  902. X    putchar('\n');
  903. X    }
  904. X}
  905. X
  906. Xprintgrand(nam, i1, i2, i3, i4)
  907. Xchar nam;
  908. Xint i1, i2, i3, i4;
  909. X{
  910. X  switch (nam) {
  911. X  case '.': printf("Stellium   "); break;
  912. X  case 't': printf("Grand Trine"); break;
  913. X  case 's': printf("T-Square   "); break;
  914. X  case 'y': printf("Yod        "); break;
  915. X  case 'g': printf("Grand Cross"); break;
  916. X  case 'c': printf("Cradle     "); break;
  917. X  default: ;
  918. X  }
  919. X  printf(" %s ", nam == '.' || nam == 't' || nam == 'g' ? "with" : "from");
  920. X  printf("%c%c%c: ", OBJNAM(i1));
  921. X  printminute(planet[i1]);
  922. X  printf(" %s %c%c%c: ", nam == '.' || nam == 't' ? "and" : "to ", OBJNAM(i2));
  923. X  printminute(planet[i2]);
  924. X  printf(" %s %c%c%c: ", nam == 'g' || nam == 'c' ? "to " : "and", OBJNAM(i3));
  925. X  printminute(planet[i3]);
  926. X  if (nam == 'g' || nam == 'c') {
  927. X    printf(" to %c%c%c: ", OBJNAM(i4));
  928. X    printminute(planet[i4]);
  929. X  }
  930. X  printf("\n");
  931. X}
  932. X
  933. Xvoid displaygrands()
  934. X{
  935. X  int count = 0, i, j, k, l;
  936. X  for (i = 1; i <= objects; i++) if (!ignore[i])
  937. X    for (j = 1; j <= objects; j++) if (j != i && !ignore[j])
  938. X      for (k = 1; k <= objects; k++) if (k != i && k != j && !ignore[k]) {
  939. X    if (i < j && j < k && gridname[i][j] == 1 &&
  940. X        gridname[i][k] == 1 && gridname[j][k] == 1) {
  941. X      count++;
  942. X      printgrand('.', i, j, k, l);
  943. X    } else if (i < j && j < k && gridname[i][j] == 4 &&
  944. X        gridname[i][k] == 4 && gridname[j][k] == 4) {
  945. X      count++;
  946. X      printgrand('t', i, j, k, l);
  947. X    } else if (j < k && gridname[j][k] == 2 &&
  948. X        gridname[MIN(i, j)][MAX(i, j)] == 3 &&
  949. X        gridname[MIN(i, k)][MAX(i, k)] == 3) {
  950. X      count++;
  951. X      printgrand('s', i, j, k, l);
  952. X    } else if (j < k && gridname[j][k] == 5 &&
  953. X        gridname[MIN(i, j)][MAX(i, j)] == 6 &&
  954. X        gridname[MIN(i, k)][MAX(i, k)] == 6) {
  955. X      count++;
  956. X      printgrand('y', i, j, k, l);
  957. X    }
  958. X    for (l = 1; l <= objects; l++) if (!ignore[l]) {
  959. X      if (i < j && i < k && i < l && j < l && gridname[i][j] == 3 &&
  960. X          gridname[MIN(j, k)][MAX(j, k)] == 3 &&
  961. X          gridname[MIN(k, l)][MAX(k, l)] == 3 &&
  962. X          gridname[i][l] == 3 && mindistance(planet[i], planet[k]) > 150.0
  963. X          && mindistance(planet[j], planet[l]) > 150.0) {
  964. X        count++;
  965. X        printgrand('g', i, j, k, l);
  966. X      } else if (i < l && gridname[MIN(i, j)][MAX(i, j)] == 5 &&
  967. X          gridname[MIN(j, k)][MAX(j, k)] == 5 &&
  968. X          gridname[MIN(k, l)][MAX(k, l)] == 5 &&
  969. X          mindistance(planet[i], planet[l]) > 150.0) {
  970. X        count++;
  971. X        printgrand('c', i, j, k, l);
  972. X      }
  973. X    }
  974. X      }
  975. X  if (!count)
  976. X    printf("No major configurations in aspect grid.\n");
  977. X}
  978. X
  979. Xprinttab(chr, count)
  980. Xchar chr;
  981. Xint count;
  982. X{
  983. X  int i;
  984. X  for (i = 0; i < count; i++)
  985. X    putchar(chr);
  986. X}
  987. X
  988. Xprintwheelslot(house, row)
  989. Xint house, row;
  990. X{
  991. X  int i;
  992. X  i = wheel[house-1][row];
  993. X  if (i) {
  994. X    printf(" %c%c%c ", OBJNAM(i));
  995. X    printminute(planet[i]);
  996. X    printf("%c ", ret[i] < 0.0 ? 'r' : ' ');
  997. X    printtab(' ', WHEELCOLS-14-1);
  998. X  } else
  999. X    printtab(' ', WHEELCOLS-1);
  1000. X}
  1001. X
  1002. Xvoid chartwheel()
  1003. X{
  1004. X  int i, j, k, l, count = 0;
  1005. X  for (i = 0; i < SIGNS; i++)
  1006. X    for (j = 0; j < WHEELROWS; j++)
  1007. X      wheel[i][j] = 0;
  1008. X  for (i = 1; i <= total && count < 26; i++) {
  1009. X    if (!ignore[i] && (i < 18 || i == 20 || i > objects+4))
  1010. X      for (j = inhouse[i]-1; j < SIGNS; j = j < SIGNS ? (j+1)%SIGNS : j) {
  1011. X    l = house[j+1] > house[mod12(j+2)];
  1012. X    for (k = 0; k < WHEELROWS && wheel[j][k] > 0 &&
  1013. X         (planet[i] >= planet[wheel[j][k]] ||
  1014. X          (l && planet[i] < 180.0 && planet[wheel[j][k]] > 180.0)) &&
  1015. X         !(l && planet[i] > 180.0 && planet[wheel[j][k]] < 180.0); k++)
  1016. X      ;
  1017. X    count++;
  1018. X    if (wheel[j][k] <= 0) {
  1019. X      wheel[j][k] = i;
  1020. X      j = SIGNS;
  1021. X    } else if (k < WHEELROWS && wheel[j][WHEELROWS-1] <= 0) {
  1022. X      for (l = WHEELROWS-1; l > k; l--)
  1023. X        wheel[j][l] = wheel[j][l-1];
  1024. X      wheel[j][k] = i;
  1025. X      j = SIGNS;
  1026. X    }
  1027. X      }
  1028. X  }
  1029. X  if (!(todisplay & 2048))
  1030. X    for (i = 3; i < 9; i++)
  1031. X      for (j = 0; j < WHEELROWS/2; j++) {
  1032. X    k = WHEELROWS-1-j;
  1033. X    l = wheel[i][j]; wheel[i][j] = wheel[i][k]; wheel[i][k] = l;
  1034. X      }
  1035. X  putchar('+'); printtab('-', WHEELCOLS-8); printf("<11>");
  1036. X  printminute(house[11]); printtab('-', WHEELCOLS-11); printf("<10>");
  1037. X  printminute(house[10]); printtab('-', WHEELCOLS-10); printf("<9>");
  1038. X  printminute(house[9]); printtab('-', WHEELCOLS-4); printf("+\n");
  1039. X  for (i = 0; i < WHEELROWS; i++) {
  1040. X    for (j = 11; j >= 8; j--) {
  1041. X      putchar('|'); printwheelslot(j, i);
  1042. X    }
  1043. X    printf("|\n");
  1044. X  }
  1045. X  printf("<12>"); printminute(house[12]); printtab('-', WHEELCOLS-11);
  1046. X  putchar('|'); printtab('-', WHEELCOLS*2-1); putchar('|');
  1047. X  printtab('-', WHEELCOLS-10); printminute(house[8]); printf("<8>\n");
  1048. X  for (i = 0; i < WHEELROWS; i++) {
  1049. X    putchar('|'); printwheelslot(12, i); putchar('|');
  1050. X    if (i) {
  1051. X      printtab(' ', WHEELCOLS-11);
  1052. X      if (i == 1)
  1053. X    printf("Astrolog (%s) chart", VERSION);
  1054. X      else if (i == 2) {
  1055. X    j = (int) Mon;
  1056. X    printf("%2d %c%c%c ", (int) Day,
  1057. X           monthname[j][0], monthname[j][1], monthname[j][2]);
  1058. X    k = (int) ((dabs(Tim)-floor(dabs(Tim)))*100.0+0.5);
  1059. X    printf("%4d     %2.0f:%d%d", (int) Yea, floor(Tim), k/10, k%10);
  1060. X      } else {
  1061. X    printf("%c%d%d:", Zon > 0.0 ? '-' : '+',
  1062. X           (int)dabs(Zon)/10, (int)dabs(Zon)%10);
  1063. X    j = (int) ((dabs(Zon)-floor(dabs(Zon)))*100.0+0.5);
  1064. X    printf("%d%d %s", j/10, j%10, stringlocation(Lon, Lat, 100.0));
  1065. X      }
  1066. X      printtab(' ', WHEELCOLS-11);
  1067. X    } else
  1068. X      printtab(' ', WHEELCOLS*2-1);
  1069. X    putchar('|'); printwheelslot(7, i); printf("|\n");
  1070. X  }
  1071. X  printf("<1>"); printminute(house[1]); printtab('-', WHEELCOLS-10);
  1072. X  putchar('|'); printtab(' ', WHEELCOLS-11);
  1073. X  printf("%s", systemname[housesystem]);
  1074. X  printtab(' ', 14-stringlen(systemname[housesystem]));
  1075. X  printf("Houses."); printtab(' ', WHEELCOLS-11); putchar('|');
  1076. X  printtab('-', WHEELCOLS-10); printminute(house[7]); printf("<7>\n");
  1077. X  for (i = 0; i < WHEELROWS; i++) {
  1078. X    putchar('|'); printwheelslot(1, i); putchar('|');
  1079. X    printtab(' ', WHEELCOLS*2-1); putchar('|'); printwheelslot(6, i);
  1080. X    printf("|\n");
  1081. X  }
  1082. X  printf("<2>"); printminute(house[2]); printtab('-', WHEELCOLS-10);
  1083. X  putchar('|'); printtab('-', WHEELCOLS*2-1); putchar('|');
  1084. X  printtab('-', WHEELCOLS-10); printminute(house[6]); printf("<6>\n");
  1085. X  for (i = 0; i < WHEELROWS; i++) {
  1086. X    for (j = 2; j <= 5; j++) {
  1087. X      putchar('|'); printwheelslot(j, i);
  1088. X    }
  1089. X    printf("|\n");
  1090. X  }
  1091. X  printf("+"); printtab('-', WHEELCOLS-4); printminute(house[3]);
  1092. X  printf("<3>"); printtab('-', WHEELCOLS-10); printminute(house[4]);
  1093. X  printf("<4>"); printtab('-', WHEELCOLS-10); printminute(house[5]);
  1094. X  printf("<5>"); printtab('-', WHEELCOLS-7); printf("+\n");
  1095. X}
  1096. X
  1097. Xvoid charthorizon()
  1098. X{
  1099. X  double lon, lat, sx, sy, vx, vy,
  1100. X    lonz[TOTAL+1], latz[TOTAL+1], azi[TOTAL+1], alt[TOTAL+1];
  1101. X  int i, j, k;
  1102. X  lon = DTOR(mod(Lon)); lat = DTOR(Lat);
  1103. X  for (i = 1; i <= total; i++) {
  1104. X    lonz[i] = DTOR(planet[i]); latz[i] = DTOR(planetalt[i]);
  1105. X    ecltoequ(&lonz[i], &latz[i]);
  1106. X  }
  1107. X  for (i = 1; i <= total; i++) if (i != 18) {
  1108. X    lonz[i] = DTOR(mod(RTOD(lonz[18]-lonz[i]+lon)));
  1109. X    lonz[i] = DTOR(mod(RTOD(lonz[i]-lon+PI/2.0)));
  1110. X    equtolocal(&lonz[i], &latz[i], PI/2.0-lat);
  1111. X    azi[i] = DEGREES-RTOD(lonz[i]); alt[i] = RTOD(latz[i]);
  1112. X  }
  1113. X  printf("Body Altitude Azimuth  Azi. Vector   %s Vector    Moon Vector\n\n",
  1114. X     centerplanet ? " Sun" : " Earth");
  1115. X  for (k = 1; k <= total; k++) {
  1116. X    i = k <= BASE ? k : BASE+starname[k-BASE];
  1117. X    if (!ignore[i] && (i <= THINGS || i > objects+4)) {
  1118. X      printf("%c%c%c%c: ", OBJNAM(i),
  1119. X         objectname[i][3] ? objectname[i][3] : ' ');
  1120. X      printaltitude(alt[i]);
  1121. X      j = (int) ((azi[i]-floor(azi[i]))*60.0);
  1122. X      printf(" %3d %d%d'", (int) azi[i], j/10, j%10);
  1123. X      sx = cos(DTOR(azi[i])); sy = sin(DTOR(azi[i]));
  1124. X      if (dabs(sx) < dabs(sy)) {
  1125. X    vx = dabs(sx / sy); vy = 1.0;
  1126. X      } else {
  1127. X    vy = dabs(sy / sx); vx = 1.0;
  1128. X      }
  1129. X      printf(" (%.2f%c %.2f%c)",
  1130. X         vy, sy < 0.0 ? 's' : 'n', vx, sx > 0.0 ? 'e' : 'w');
  1131. X      vx = azi[1]-azi[i]; vy = azi[2]-azi[i];
  1132. X      printf(" [%6.1f%6.1f] [%6.1f%6.1f]\n",
  1133. X        dabs(vx) < 180.0 ? vx : sgn(vx)*(DEGREES-dabs(vx)), alt[1]-alt[i],
  1134. X    dabs(vy) < 180.0 ? vy : sgn(vy)*(DEGREES-dabs(vy)), alt[2]-alt[i]);
  1135. X    }
  1136. X  }
  1137. X}
  1138. X
  1139. Xvoid chartspace()
  1140. X{
  1141. X  double x, y, z;
  1142. X  int i;
  1143. X  printf("Body     Angle    X axis    Y axis    Z axis    Length\n");
  1144. X  for (i = 0; i <= BASE; i++)
  1145. X    if (!ignore[i] && i != 2 && (i < THINGS || i > objects+4)) {
  1146. X      printf("%c%c%c%c: ", OBJNAM(i),
  1147. X         objectname[i][3] ? objectname[i][3] : ' ');
  1148. X      x = spacex[i]; y = spacey[i]; z = spacez[i];
  1149. X      printf("[%7.2f] [%7.2f] [%7.3f] [%7.3f] [%7.3f]",
  1150. X         planet[i], x, y, z, sqrt(x*x+y*y+z*z));
  1151. X      printf("\n");
  1152. X    }
  1153. X}
  1154. X
  1155. Xdouble objectinf[] = {0, 30, 25, 10, 10, 10, 10, 10, 10, 10, 10,
  1156. X              5, 5, 5, 5, 5, 5, 5, 15, 20, 5};
  1157. Xdouble houseinf[]  = {0, 20, 0, 0, 10, 0, 0, 5, 0, 0, 15, 0, 0};
  1158. Xdouble aspectinf[] = {0.0, 1.0, 0.8, 0.8, 0.6, 0.6, 0.4, 0.4, 0.2, 0.2,
  1159. X              0.2, 0.2, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1};
  1160. Xint rules[SIGNS+1] = {0, 5, 4, 3, 2, 1, 3, 4, 10, 6, 7, 8, 9};
  1161. X
  1162. Xsortrank(value, rank)
  1163. Xdouble *value;
  1164. Xint *rank;
  1165. X{
  1166. X  int h, i, j, k;
  1167. X  value[0] = -1.0;
  1168. X  for (i = 1; i <= THINGS; i++)
  1169. X    rank[i] = -1;
  1170. X  for (h = 1, i = 0; h <= THINGS; h++) if (!ignore[h]) {
  1171. X    i++;
  1172. X    k = 0;
  1173. X    for (j = 1; j <= THINGS; j++) if (!ignore[j])
  1174. X      if (value[j] > value[k] && rank[j] < 0)
  1175. X    k = j;
  1176. X    rank[k] = i;
  1177. X  }
  1178. X}
  1179. X
  1180. Xvoid chartinfluence()
  1181. X{
  1182. X  double power[OBJECTS+1], power1[OBJECTS+1], power2[OBJECTS+1],
  1183. X    total, total1, total2, x;
  1184. X  int rank[OBJECTS+1], rank1[OBJECTS+1], rank2[OBJECTS+1], i, j, k, l;
  1185. X  char c;
  1186. X  for (i = 1; i <= objects; i++) {
  1187. X    power1[i] = power2[i] = 0.0;
  1188. X  }
  1189. X  total = total1 = total2 = 0.0;
  1190. X  for (i = 1; i <= THINGS; i++) {
  1191. X    j = (int) (planet[i]/30.0)+1;
  1192. X    power1[i] += objectinf[i];
  1193. X    power1[i] += houseinf[inhouse[i]];
  1194. X    c = dignify(i, j);
  1195. X    switch (c) {
  1196. X    case 'R': x = 20.0; break;
  1197. X    case 'e': x = 10.0; break;
  1198. X    default:  x =  0.0;
  1199. X    }
  1200. X    power1[i] += x;
  1201. X    c = dignify(i, inhouse[i]);
  1202. X    switch (c) {
  1203. X    case 'R': x = 15.0; break;
  1204. X    case 'e': x =  5.0; break;
  1205. X    default:  x =  0.0;
  1206. X    }
  1207. X    power1[i] += x;
  1208. X    if (i != rules[j])
  1209. X      power1[rules[j]] += objectinf[i]/2.0;
  1210. X    if (i != (j = rules[inhouse[i]]))
  1211. X      power1[j] += objectinf[i]/2.0;
  1212. X  }
  1213. X  for (i = 1; i <= SIGNS; i++) {
  1214. X    j = (int)(house[i]/30.0)+1;
  1215. X    power1[rules[j]] += houseinf[i];
  1216. X  }
  1217. X  creategrid(TRUE);
  1218. X  for (j = 1; j <= objects; j++) if (!ignore[j])
  1219. X    for (i = 1; i <= objects; i++) if (!ignore[i] && i != j) {
  1220. X      k = gridname[MIN(i, j)][MAX(i, j)];
  1221. X      if (k) {
  1222. X    l = grid[MIN(i, j)][MAX(i, j)];
  1223. X    power2[j] += aspectinf[k]*objectinf[i]*
  1224. X      (1.0-dabs((double)l)/60.0/aspectorb[k]);
  1225. X      }
  1226. X    }
  1227. X  for (i = 1; i <= THINGS; i++) if (!ignore[i]) {
  1228. X    power[i] = power1[i]+power2[i]; total1 += power1[i]; total2 += power2[i];
  1229. X  }
  1230. X  total = total1+total2;
  1231. X  sortrank(power1, rank1); sortrank(power2, rank2); sortrank(power, rank);
  1232. X  printf("Name:    Position     Aspects     Total       Percent\n");
  1233. X  for (i = 1; i <= THINGS; i++) if (!ignore[i]) {
  1234. X    printf("%c%c%c%c: ", OBJNAM(i),
  1235. X       objectname[i][3] ? objectname[i][3] : ' ');
  1236. X    printf("%6.1f (%2d) +%6.1f (%2d) =%7.1f (%2d) /%6.1f%%\n",
  1237. X       power1[i], rank1[i], power2[i], rank2[i],
  1238. X       power[i], rank[i], power[i]/total*100.0);
  1239. X  }
  1240. X  printf("Tot : %6.1f      +%6.1f      =%7.1f      / 100.0%%\n",
  1241. X     total1, total2, total);
  1242. X}
  1243. X
  1244. Xvoid chartastrograph()
  1245. X{
  1246. X  double planet1[TOTAL+1], planet2[TOTAL+1], lat[MAXCROSS], lon[MAXCROSS],
  1247. X    mc[TOTAL+1], ic[TOTAL+1], as[TOTAL+1], ds[TOTAL+1], as1[TOTAL+1],
  1248. X    ds1[TOTAL+1], lo = Lon, longm, w, x, y, z, ad, oa, am, od, dm;
  1249. X  int obj1[MAXCROSS], obj2[MAXCROSS], occurcount = 0, i, j, k, l, m, n;
  1250. X  for (i = 1; i <= TOTAL; i++) {
  1251. X    planet1[i] = DTOR(planet[i]);
  1252. X    planet2[i] = DTOR(planetalt[i]);
  1253. X    ecltoequ(&planet1[i], &planet2[i]);
  1254. X  }
  1255. X  printf("Object :");
  1256. X  for (i = 1; i <= total; i++)
  1257. X    if (!ignore[i] && (i <= THINGS || i > objects+4))
  1258. X      printf(" %c%c%c", OBJNAM(i));
  1259. X  printf("\n------ :");
  1260. X  for (i = 1; i <= total; i++)
  1261. X    if (!ignore[i] && (i <= THINGS || i > objects+4))
  1262. X      printf(" ###");
  1263. X  printf("\nMidheav: ");
  1264. X  if (lo < 0.0)
  1265. X    lo += DEGREES;
  1266. X  for (i = 1; i <= total; i++)
  1267. X    if (!ignore[i] && (i <= THINGS || i > objects+4)) {
  1268. X    x = planet1[18]-planet1[i];
  1269. X    if (x < 0.0)
  1270. X      x += 2.0*PI;
  1271. X    if (x > PI)
  1272. X      x -= 2.0*PI;
  1273. X    z = lo+RTOD(x);
  1274. X    if (z > 180.0)
  1275. X      z -= DEGREES;
  1276. X    mc[i] = z;
  1277. X    printf("%3.0f%c", dabs(z), z < 0.0 ? 'e' : 'w');
  1278. X  }
  1279. X  printf("\nNadir  : ");
  1280. X  for (i = 1; i <= total; i++)
  1281. X    if (!ignore[i] && (i <= THINGS || i > objects+4)) {
  1282. X    z = mc[i] + 180.0;
  1283. X    if (z > 180.0)
  1284. X      z -= DEGREES;
  1285. X    ic[i] = z;
  1286. X    printf("%3.0f%c", dabs(z), z < 0.0 ? 'e' : 'w');
  1287. X  }
  1288. X  printf("\nZenith : ");
  1289. X  for (i = 1; i <= total; i++)
  1290. X    if (!ignore[i] && (i <= THINGS || i > objects+4)) {
  1291. X      y = RTOD(planet2[i]);
  1292. X      printf("%3.0f%c", dabs(y), y < 0.0 ? 's' : 'n');
  1293. X      as[i] = ds[i] = as1[i] = ds1[i] = 1000.0;
  1294. X    }
  1295. X  printf("\n\n");
  1296. X  longm = DTOR(mod(RTOD(planet1[18])+lo));
  1297. X  for (j = 80; j >= -80; j -= graphstep) {
  1298. X    printf("Asc@%2d%c: ", j >= 0 ? j : -j, j < 0 ? 's' : 'n');
  1299. X    for (i = 1; i <= total; i++)
  1300. X      if (!ignore[i] && (i <= THINGS || i > objects+4)) {
  1301. X      ad = tan(planet2[i])*tan(DTOR(j));
  1302. X      if (ad*ad > 1.0) {
  1303. X    printf(" -- ");
  1304. X    as1[i] = ds1[i] = ret2[i] = 1000.0;
  1305. X      } else {
  1306. X    ad = ASIN(ad);
  1307. X    oa = planet1[i]-ad;
  1308. X    if (oa < 0.0)
  1309. X      oa += 2.0*PI;
  1310. X    am = oa-PI/2.0;
  1311. X    if (am < 0.0)
  1312. X      am += 2.0*PI;
  1313. X    z = longm-am;
  1314. X    if (z < 0.0)
  1315. X      z += 2.0*PI;
  1316. X    if (z > PI)
  1317. X      z -= 2.0*PI;
  1318. X    as1[i] = as[i];
  1319. X     as[i] = z = RTOD(z);
  1320. X    ret2[i] = ad;
  1321. X    printf("%3.0f%c", dabs(z), z < 0.0 ? 'e' : 'w');
  1322. X      }
  1323. X    }
  1324. X    printf("\nDsc@%2d%c: ", j >= 0 ? j : -j, j < 0 ? 's' : 'n');
  1325. X    for (i = 1; i <= total; i++)
  1326. X      if (!ignore[i] && (i <= THINGS || i > objects+4)) {
  1327. X      ad = ret2[i];
  1328. X      if (ad == 1000.0)
  1329. X    printf(" -- ");
  1330. X      else {
  1331. X    od = planet1[i]+ad;
  1332. X    dm = od+PI/2.0;
  1333. X    z = longm-dm;
  1334. X    if (z < 0.0)
  1335. X      z += 2.0*PI;
  1336. X    if (z > PI)
  1337. X      z -= 2.0*PI;
  1338. X    ds1[i] = ds[i];
  1339. X    ds[i] = z = RTOD(z);
  1340. X    printf("%3.0f%c", dabs(z), z < 0.0 ? 'e' : 'w');
  1341. X      }
  1342. X    }
  1343. X    putchar('\n');
  1344. X    if (todisplay & 16384)
  1345. X      for (l = 1; l <= total; l++)
  1346. X    if (!ignore[l] && (l <= THINGS || l > objects+4))
  1347. X    for (k = 1; k <= total; k++)
  1348. X      if (!ignore[k] && (k <= THINGS || k > objects+4))
  1349. X      for (n = 0; n <= 1; n++) {
  1350. X        x = n ? ds1[l] : as1[l];
  1351. X        y = n ? ds[l] : as[l];
  1352. X        for (m = 0; m <= 1; m++) {
  1353. X          z = m ? ic[k] : mc[k];
  1354. X          if (occurcount < MAXCROSS &&
  1355. X          dabs(x-y) < 180.0 && sgn(z-x) != sgn(z-y)) {
  1356. X        obj1[occurcount] = n ? -l : l;
  1357. X        obj2[occurcount] = m ? -k : k;
  1358. X        lat[occurcount] = (double)j+5.0*dabs(z-y)/dabs(x-y);
  1359. X        lon[occurcount] = z;
  1360. X        occurcount++;
  1361. X          }
  1362. X          w = m ? ds1[k] : as1[k];
  1363. X          z = m ? ds[k] : as[k];
  1364. X          if (occurcount < MAXCROSS && k > l &&
  1365. X          dabs(x-y)+dabs(w-z) < 180.0 && sgn(w-x) != sgn(z-y)) {
  1366. X        obj1[occurcount] = n ? -l : l;
  1367. X        obj2[occurcount] = 100+(m ? -k : k);
  1368. X        lat[occurcount] = (double)j+5.0*
  1369. X          dabs(y-z)/(dabs(x-w)+dabs(y-z));
  1370. X        lon[occurcount] = MIN(x, y)+dabs(x-y)*
  1371. X          dabs(y-z)/(dabs(x-w)+dabs(y-z));
  1372. X        occurcount++;
  1373. X          }
  1374. X        }
  1375. X      }
  1376. X  }
  1377. X  if ((todisplay & 16384) == 0)
  1378. X    return;
  1379. X  putchar('\n');
  1380. X  for (i = 1; i < occurcount; i++) {
  1381. X    j = i-1;
  1382. X    while (j >= 0 && lat[j] < lat[j+1]) {
  1383. X      swapint(&obj1[j], &obj1[j+1]); swapint(&obj2[j], &obj2[j+1]);
  1384. X      swapdoub(&lat[j], &lat[j+1]); swapdoub(&lon[j], &lon[j+1]);
  1385. X      j--;
  1386. X    }
  1387. X  }
  1388. X  for (i = 1; i < occurcount; i++) {
  1389. X    j = abs(obj1[i]);
  1390. X    printf("%c%c%c %s crosses ", OBJNAM(j),
  1391. X       obj1[i] > 0 ? "Ascendant " : "Descendant");
  1392. X    j = abs(obj2[i] - (obj2[i] < 50 ? 0 : 100));
  1393. X    printf("%c%c%c %s at ", OBJNAM(j),
  1394. X       obj2[i] < 50 ? (obj2[i] > 0 ? "Midheaven " :
  1395. X       "Nadir     ") : (obj2[i] > 100 ? "Ascendant " : "Descendant"));
  1396. X    j = (int) ((dabs(lon[i])-floor(dabs(lon[i])))*60.0);
  1397. X    printf("%3d %d%d'%c, ", (int) dabs(lon[i]),
  1398. X       j/10, j%10, lon[i] < 0.0 ? 'E' : 'W');
  1399. X    j = (int) ((dabs(lat[i])-floor(dabs(lat[i])))*60.0);
  1400. X    printf("%2d %d%d'%c\n", (int) dabs(lat[i]),
  1401. X       j/10, j%10, lat[i] < 0.0 ? 'S' : 'N');
  1402. X  }
  1403. X  if (!occurcount)
  1404. X    printf("No latitude crossings.\n");
  1405. X}
  1406. X
  1407. X/**/
  1408. END_OF_FILE
  1409. if test 20844 -ne `wc -c <'charts.c'`; then
  1410.     echo shar: \"'charts.c'\" unpacked with wrong size!
  1411. fi
  1412. # end of 'charts.c'
  1413. fi
  1414. if test -f 'options.c' -a "${1}" != "-c" ; then 
  1415.   echo shar: Will not clobber existing file \"'options.c'\"
  1416. else
  1417. echo shar: Extracting \"'options.c'\" \(17587 characters\)
  1418. sed "s/^X//" >'options.c' <<'END_OF_FILE'
  1419. X/*
  1420. X** Astrolog (Version 2.25) File: options.c
  1421. X*/
  1422. X
  1423. X#include "astrolog.h"
  1424. X
  1425. X/*
  1426. X*******************************************************************************
  1427. X** Calculation subprograms
  1428. X*******************************************************************************
  1429. X*/
  1430. X
  1431. Xgetaspect(planet1, planet2, i, j, acc)
  1432. Xdouble *planet1, *planet2;
  1433. Xint i, j, acc;
  1434. X{
  1435. X  int k;
  1436. X  double l, m, n;
  1437. X  gridname[i][j] = grid[i][j] = 0;
  1438. X  l = mindistance(planet2[i], planet1[j]);
  1439. X  for (k = aspects; k >= 1; k--) {
  1440. X    m = l-aspectangle[k];
  1441. X    if (dabs(m) < orb(i, j, k)) {
  1442. X      gridname[i][j] = k;
  1443. X      if (todisplay & 65536)
  1444. X    m = sgn(ret[j]-ret[i])*sgn(planet1[j]-planet2[i])*
  1445. X      (dabs(planet1[j]-planet2[i])>180.0 ? -1.0 : 1.0)*sgn(m)*dabs(m);
  1446. X      grid[i][j] = (int) (m*(!acc ? 10.0 : 60.0));
  1447. X    }
  1448. X  }
  1449. X}
  1450. X
  1451. Xvoid creategrid(acc)
  1452. Xint acc;
  1453. X{
  1454. X  int i, j, k;
  1455. X  double l;
  1456. X  for (j = 1; j <= total; j++) if (!ignore[j])
  1457. X    for (i = 1; i <= total; i++) if (!ignore[i])
  1458. X      if (acc < 2 ? i < j : i > j)
  1459. X    getaspect(planet, planet, i, j, acc);
  1460. X      else if (acc < 2 ? i > j : i < j) {
  1461. X    l = mod(midpoint(planet[i], planet[j])); k = (int) l;
  1462. X    gridname[i][j] = k/30+1;
  1463. X    grid[i][j] = !acc ? k%30 : (int)((l-(double)(k/30)*30.0)*60.0);
  1464. X      } else {
  1465. X    gridname[i][j] = (int)planet[j]/30+1;
  1466. X    grid[i][j] = (int)(planet[j]-(double)(gridname[i][j]-1)*30.0);
  1467. X      }
  1468. X}
  1469. X
  1470. Xcreaterelationgrid(acc)
  1471. Xint acc;
  1472. X{
  1473. X  int i, j, k;
  1474. X  double l;
  1475. X  for (j = 1; j <= total; j++) if (!ignore[j])
  1476. X    for (i = 1; i <= total; i++) if (!ignore[i])
  1477. X      if (acc < 2)
  1478. X    getaspect(planet1, planet2, i, j, acc);
  1479. X      else {
  1480. X    l = mod(midpoint(planet2[i], planet1[j])); k = (int) l;
  1481. X    gridname[i][j] = k/30+1;
  1482. X    grid[i][j] = (int)((l-(double)(k/30)*30.0)*60.0);
  1483. X      }
  1484. X}
  1485. X
  1486. Xdisplayrelationgrid()
  1487. X{
  1488. X  int i, j, k, temp;
  1489. X  printf("AB>");
  1490. X  for (i = 1; i < total; i++) if (!ignore[i])
  1491. X    printf("|%c%c%c", OBJNAM(i));
  1492. X  printf("\nV  ");
  1493. X  for (i = 1; i < total; i++) if (!ignore[i])
  1494. X    printf("|###");
  1495. X  putchar('\n');
  1496. X  for (j = 1; j < total; j++) if (!ignore[j])
  1497. X    for (k = 1; k <= 3; k++) {
  1498. X      if (k < 2)
  1499. X    printf("---");
  1500. X      else if (k == 2)
  1501. X    printf("%c%c%c", OBJNAM(j));
  1502. X      else
  1503. X    printf("###");
  1504. X      for (i = 1; i < total; i++) if (!ignore[i]) {
  1505. X    putchar('|');
  1506. X        if (k < 2)
  1507. X      printf("---");
  1508. X    else if (k == 2) {
  1509. X      temp = gridname[i][j];
  1510. X      if (todisplay & 8192)
  1511. X        printf("%c%c%c", SIGNAM(temp));
  1512. X      else
  1513. X        printf("%s", aspectabbrev[temp]);
  1514. X    } else
  1515. X      if (todisplay & 8192) {
  1516. X        temp = grid[i][j] / 60;
  1517. X        printf("%d%d'", temp/10, temp%10);
  1518. X      } else
  1519. X        if (gridname[i][j]) {
  1520. X          temp = grid[i][j];
  1521. X          if (temp < 100)
  1522. X        printf("%d%c%d", abs(temp)/10,
  1523. X               temp < 0 ? ',' : '.', abs(temp)%10);
  1524. X          else if (temp < 1000)
  1525. X        printf("%2d%c", abs(temp)/10, temp < 0 ? ',' : '.');
  1526. X          else
  1527. X        printf("%3d", abs(temp)/10);
  1528. X        } else
  1529. X          printf("   ");
  1530. X      }
  1531. X      putchar('\n');
  1532. X    }
  1533. X}
  1534. X
  1535. X#define degtodec(A) sgn(A)*(floor(dabs(A))+(dabs(A)-floor(dabs(A)))*60/100.0)
  1536. X
  1537. Xvoid castrelation()
  1538. X{
  1539. X  double zon, lon, lat, t1, t2, t;
  1540. X  int i;
  1541. X  inputdata(filename);
  1542. X  zon = X; lon = L5; lat = LA;
  1543. X  t1 = castchart(TRUE);
  1544. X  for (i = 1; i <= SIGNS; i++) {
  1545. X    house1[i] = house[i];
  1546. X    inhouse1[i] = inhouse[i];
  1547. X  }
  1548. X  for (i = 1; i <= total; i++) {
  1549. X    planet1[i] = planet[i];
  1550. X    planetalt1[i] = planetalt[i];
  1551. X    ret1[i] = ret[i];
  1552. X  }
  1553. X  inputdata(filename2);
  1554. X  Mon = M; Day = D; Yea = Y; Tim = F; Zon = X; Lon = L5; Lat = LA;
  1555. X  t2 = castchart(TRUE);
  1556. X  for (i = 1; i <= SIGNS; i++) {
  1557. X    house2[i] = house[i];
  1558. X    inhouse2[i] = inhouse[i];
  1559. X  }
  1560. X  for (i = 1; i <= total; i++) {
  1561. X    planet2[i] = planet[i];
  1562. X    planetalt2[i] = planetalt[i];
  1563. X    ret2[i] = ret[i];
  1564. X  }
  1565. X  if (relation <= 1)
  1566. X    for (i = 1; i <= SIGNS; i++)
  1567. X      house[i] = house1[i];
  1568. X  else if (relation == 2) {   
  1569. X    for (i = 1; i <= total; i++) {
  1570. X      planet[i] = midpoint(planet1[i], planet2[i]);
  1571. X      planetalt[i] = (planetalt1[i]+planetalt2[i])/2.0;
  1572. X      ret[i] = (ret1[i]+ret2[i])/2.0;
  1573. X    }
  1574. X    for (i = 1; i <= SIGNS; i++)
  1575. X      house[i] = midpoint(house1[i], house2[i]);
  1576. X    for (i = 1; i <= SIGNS; i++)
  1577. X      if (mindistance(house[10], mod(house[i]-(double)(i+2)*30.0)) > 90.0)
  1578. X    house[i] = mod(house[i]+180.0);
  1579. X  } else if (relation == 3) {
  1580. X    T = (t1+t2)/2.0;
  1581. X    t = (T*36525.0)+0.5; JD = floor(t)+2415020.0; F = (t-floor(t))*24.0;
  1582. X    X = (dectodeg(zon)+dectodeg(Zon))/2.0; X = degtodec(X);
  1583. X    F = dectodeg(F)-dectodeg(X); F = degtodec(F);
  1584. X    if (F < 0.0) {
  1585. X      F = dectodeg(F)+24.0; F = degtodec(F); JD -= 1.0;
  1586. X    }
  1587. X    juliantomdy(JD, &M, &D, &Y);
  1588. X    L5 = (dectodeg(lon)+dectodeg(Lon))/2.0; L5 = degtodec(L5);
  1589. X    LA = (dectodeg(lat)+dectodeg(Lat))/2.0; LA = degtodec(LA);
  1590. X    Mon = M; Day = D; Yea = Y; Tim = F; Zon = X; Lon = L5; Lat = LA;
  1591. X    castchart(FALSE);
  1592. X  }
  1593. X  houseplace();
  1594. X}
  1595. X
  1596. Xprintfield(string, field)
  1597. Xchar *string;
  1598. Xint field;
  1599. X{
  1600. X  int i, j;
  1601. X  j = stringlen(string);
  1602. X  printtab(' ', field-j);
  1603. X  for (i = 0; i < j && i < field; i++)
  1604. X    putchar(string[i]);
  1605. X}
  1606. X
  1607. Xdisplayinday(prog)
  1608. Xint prog;
  1609. X{
  1610. X  int time[MAXINDAY], source[MAXINDAY], aspect[MAXINDAY], dest[MAXINDAY],
  1611. X    sign1[MAXINDAY], sign2[MAXINDAY], occurcount, divisions, div,
  1612. X    i, j, k, s1, s2;
  1613. X  double Day2, D1, D2, divsiz, d1, d2, e1, e2, f1, f2, g;
  1614. X  divisions = prog ? 1 : DIVISIONS;
  1615. X  divsiz = 24.0/ (double) divisions*60.0;
  1616. X  if (todisplay & 256) {
  1617. X    D1 = 1.0;
  1618. X    if (prog && Mon2 == 0.0) {
  1619. X      Mon2 = 1.0; D2 = 365.0-28.0+(double)dayinmonth(2, (int) Yea2);
  1620. X    } else D2 = (double)
  1621. X      dayinmonth((int) (prog ? Mon2 : Mon), (int) (prog ? Yea2 : Yea));
  1622. X  } else
  1623. X    D1 = D2 = Day;
  1624. X  for (Day2 = D1; Day2 <= D2; Day2 += 1.0) {
  1625. X    occurcount = 0;
  1626. X    M = Mon; D = Day2; Y = Yea; F = 0.0; X = Zon; L5 = Lon; LA = Lat;
  1627. X    if (progress = prog) {
  1628. X      Jdp = mdytojulian(Mon2, D, Yea2);
  1629. X      M = Mon; D = Day; Y = Yea; F = Tim; X = Zon; L5 = Lon; LA = Lat;
  1630. X    }
  1631. X    castchart(TRUE);
  1632. X    for (i = 1; i <= SIGNS; i++) {
  1633. X      house2[i] = house[i];
  1634. X      inhouse2[i] = inhouse[i];
  1635. X    }
  1636. X    for (i = 1; i <= total; i++) {
  1637. X      planet2[i] = planet[i];
  1638. X      ret2[i] = ret[i];
  1639. X    }
  1640. X    for (div = 1; div <= divisions; div++) {
  1641. X      M = Mon; D = Day2; Y = Yea; X = Zon; L5 = Lon; LA = Lat;
  1642. X      F = 24.0*div/ (double) divisions;
  1643. X      if (prog) {
  1644. X    Jdp = mdytojulian(Mon2, D+1.0, Yea2);
  1645. X    M = Mon; D = Day; Y = Yea; F = Tim; X = Zon; L5 = Lon; LA = Lat;
  1646. X      }
  1647. X      castchart(TRUE);
  1648. X      for (i = 1; i <= SIGNS; i++) {
  1649. X    house1[i] = house2[i]; inhouse1[i] = inhouse2[i];
  1650. X    house2[i] = house[i];  inhouse2[i] = inhouse[i];
  1651. X      }
  1652. X      for (i = 1; i <= total; i++) {
  1653. X    planet1[i] = planet2[i]; ret1[i] = ret2[i];
  1654. X    planet2[i] = planet[i];  ret2[i] = ret[i];
  1655. X      }
  1656. X      for (i = 1; i <= total; i++) if (!ignore[i] &&
  1657. X    (prog || i <= THINGS || i > objects+4)) {
  1658. X    s1 = (int) floor(planet1[i] / 30.0);
  1659. X    s2 = (int) floor(planet2[i] / 30.0);
  1660. X    if (!ignore[i] && s1 != s2) {
  1661. X      source[occurcount] = i;
  1662. X      aspect[occurcount] = -1;
  1663. X      dest[occurcount] = s2+1;
  1664. X      time[occurcount] = (int) (mindistance(planet1[i],
  1665. X            (double) (ret1[i] >= 0.0 ? s2 : s1) * 30.0) /
  1666. X            mindistance(planet1[i], planet2[i])*divsiz) +
  1667. X        (int) ((double) (div-1)*divsiz);
  1668. X      sign1[occurcount] = sign2[occurcount] = s1+1;
  1669. X      occurcount++;
  1670. X    }
  1671. X    if (!ignore[i] && (ret1[i] < 0.0) != (ret2[i] < 0.0)) {
  1672. X      source[occurcount] = i;
  1673. X      aspect[occurcount] = -2;
  1674. X      dest[occurcount] = ret2[i] < 0.0;
  1675. X      time[occurcount] = (int) (dabs(ret1[i])/(dabs(ret1[i])+dabs(ret2[i]))
  1676. X        *divsiz) + (int) ((double) (div-1)*divsiz);
  1677. X      sign1[occurcount] = sign2[occurcount] = s1+1;
  1678. X      occurcount++;
  1679. X    }
  1680. X    for (j = i+1; j <= total; j++) if (!ignore[j] &&
  1681. X      (prog || j <= THINGS || j > objects+4))
  1682. X      for (k = 1; k <= aspects; k++) {
  1683. X        d1 = planet1[i]; d2 = planet2[i];
  1684. X        e1 = planet1[j]; e2 = planet2[j];
  1685. X        if (mindistance(d1, d2) < mindistance(e1, e2)) {
  1686. X          swapdoub(&d1, &e1);
  1687. X          swapdoub(&d2, &e2);
  1688. X        }
  1689. X        if (mindistance(e1, mod(d1-aspectangle[k])) <
  1690. X        mindistance(e2, mod(d2+aspectangle[k]))) {
  1691. X          e1 = mod(e1+aspectangle[k]);
  1692. X          e2 = mod(e2+aspectangle[k]);
  1693. X        } else {
  1694. X          e1 = mod(e1-aspectangle[k]);
  1695. X          e2 = mod(e2-aspectangle[k]);
  1696. X        }
  1697. X        f1 = e1-d1;
  1698. X        if (dabs(f1) > 180.0)
  1699. X          f1 -= sgn(f1)*DEGREES;
  1700. X        f2 = e2-d2;
  1701. X        if (dabs(f2) > 180.0)
  1702. X          f2 -= sgn(f2)*DEGREES;
  1703. X        if (mindistance(midpoint(d1, d2), midpoint(e1, e2)) < 90.0 &&
  1704. X        sgn(f1) != sgn(f2)) {
  1705. X          source[occurcount] = i;
  1706. X          aspect[occurcount] = k;
  1707. X          dest[occurcount] = j;
  1708. X          f1 = d2-d1;
  1709. X          if (dabs(f1) > 180.0)
  1710. X        f1 -= sgn(f1)*DEGREES;
  1711. X          f2 = e2-e1;
  1712. X          if (dabs(f2) > 180.0)
  1713. X        f2 -= sgn(f2)*DEGREES;
  1714. X          g = (dabs(d1-e1) > 180.0 ?
  1715. X           (d1-e1)-sgn(d1-e1)*DEGREES : d1-e1)/(f2-f1);
  1716. X          time[occurcount] = (int) (g*divsiz) +
  1717. X        (int) ((double) (div-1)*divsiz);
  1718. X          sign1[occurcount] = (int) (mod(planet1[i]+
  1719. X        sgn(planet2[i]-planet1[i])*
  1720. X        (dabs(planet2[i]-planet1[i]) > 180.0 ? -1 : 1)*
  1721. X        dabs(g)*mindistance(planet1[i], planet2[i]))/30.0)+1;
  1722. X          sign2[occurcount] = (int) (mod(planet1[j]+
  1723. X        sgn(planet2[j]-planet1[j])*
  1724. X        (dabs(planet2[j]-planet1[j]) > 180.0 ? -1 : 1)*
  1725. X        dabs(g)*mindistance(planet1[j], planet2[j]))/30.0)+1;
  1726. X          occurcount++;
  1727. X        }
  1728. X      }
  1729. X      }
  1730. X    }
  1731. X    for (i = 1; i < occurcount; i++) {
  1732. X      j = i-1;
  1733. X      while (j >= 0 && time[j] > time[j+1]) {
  1734. X    swapint(&source[j], &source[j+1]);
  1735. X    swapint(&aspect[j], &aspect[j+1]);
  1736. X    swapint(&dest[j], &dest[j+1]);
  1737. X    swapint(&time[j], &time[j+1]);
  1738. X    swapint(&sign1[j], &sign1[j+1]); swapint(&sign2[j], &sign2[j+1]);
  1739. X    j--;
  1740. X      }
  1741. X    }
  1742. X    for (i = 0; i < occurcount; i++) {
  1743. X      s1 = time[i]/60;
  1744. X      s2 = time[i]-s1*60;
  1745. X      s1 = mod12(s1);
  1746. X      j = (int) Day2;
  1747. X      if (prog) {
  1748. X    g = Mon2;
  1749. X    while (j > (k = dayinmonth((int) g, (int) Yea2))) {
  1750. X      j -= k;
  1751. X      g += 1.0;
  1752. X    }
  1753. X      }
  1754. X      printf("%2.0f/%d%d/%4.0f ",
  1755. X         prog ? g : Mon, j/10, j%10, prog ? Yea2 : Yea);
  1756. X      printf("%2d:%d%d%cm - ",
  1757. X         s1, s2/10, s2%10, time[i] < 12*60 ? 'a' : 'p');
  1758. X      if (prog)
  1759. X    printf("progr ");
  1760. X      printfield(objectname[source[i]], 7);
  1761. X      j = (ret1[source[i]] < 0.0)+(ret2[source[i]] < 0.0);
  1762. X      printf(" %c%c%c%c%c", j < 1 ? '(' : (j > 1 ? '[' : '<'),
  1763. X         SIGNAM(sign1[i]), j < 1 ? ')' : (j > 1 ? ']' : '>'));
  1764. X      if (aspect[i] == -1)
  1765. X    printf(" --> ");
  1766. X      else if (aspect[i] == -2)
  1767. X    printf(" S/%c", dest[i] ? 'R' : 'D');
  1768. X      else
  1769. X    printf(" %s ", aspectabbrev[aspect[i]]);
  1770. X      if (aspect[i] == -1) {
  1771. X    printf("%s", signname[dest[i]]);
  1772. X    if (source[i] == 1) {
  1773. X      if (dest[i] == 1)
  1774. X        printf(" (Vernal Equinox)");
  1775. X      else if (dest[i] == 4)
  1776. X        printf(" (Summer Solstice)");
  1777. X      else if (dest[i] == 7)
  1778. X        printf(" (Autumnal Equinox)");
  1779. X      else if (dest[i] == 10)
  1780. X        printf(" (Winter Solstice)");
  1781. X    }
  1782. X      } else if (aspect[i] > 0) {
  1783. X    j = (ret1[dest[i]] < 0.0)+(ret2[dest[i]] < 0.0);
  1784. X    printf("%c%c%c%c%c %s",
  1785. X           j < 1 ? '(' : (j > 1 ? '[' : '<'), SIGNAM(sign2[i]),
  1786. X           j < 1 ? ')' : (j > 1 ? ']' : '>'), objectname[dest[i]]);
  1787. X    if (source[i] == 1 && dest[i] == 2) {
  1788. X      if (aspect[i] == 1)
  1789. X        printf(" (New Moon)");
  1790. X      else if (aspect[i] == 2)
  1791. X        printf(" (Full Moon)");
  1792. X      else if (aspect[i] == 3)
  1793. X        printf(" (Half Moon)");
  1794. X    }
  1795. X      }
  1796. X      putchar('\n');
  1797. X    }
  1798. X  }
  1799. X}
  1800. X
  1801. Xvoid printtransit(prog)
  1802. Xint prog;
  1803. X{
  1804. X  double planet3[TOTAL+1], house3[SIGNS+1], ret3[TOTAL+1];
  1805. X  int time[MAXINDAY], source[MAXINDAY], aspect[MAXINDAY], dest[MAXINDAY],
  1806. X    sign[MAXINDAY], isret[MAXINDAY], occurcount, div, i, j, k, s1, s2, s3;
  1807. X  double M1, M2, divsiz, daysiz, d, e1, e2, f1, f2;
  1808. X  inputdata(filename);
  1809. X  Mon = M; Day = D; Yea = Y; Tim = F; Zon = X; Lon = L5; Lat = LA;
  1810. X  castchart(TRUE);
  1811. X  for (i = 1; i <= SIGNS; i++)
  1812. X    house3[i] = house[i];
  1813. X  for (i = 1; i <= total; i++) {
  1814. X    planet3[i] = planet[i];
  1815. X    ret3[i] = ret[i];
  1816. X  }
  1817. X  if (Mon2 == 0.0) {
  1818. X    M1 = 1.0; M2 = 12.0;
  1819. X  } else
  1820. X    M1 = M2 = Mon2;
  1821. X  for (Mon2 = M1; Mon2 <= M2; Mon2 += 1.0) {
  1822. X    daysiz = (double) dayinmonth((int) Mon2, (int) Yea2)*24.0*60.0;
  1823. X    divsiz = daysiz/ (double) DIVISIONS;
  1824. X    M = Mon2; D = 1.0; Y = Yea2; F = 0.0;
  1825. X    X = defzone; L5 = deflong; LA = deflat;
  1826. X    if (progress = prog) {
  1827. X      Jdp = mdytojulian(M, D, Y);
  1828. X      M = Mon; D = Day; Y = Yea; F = Tim; X = Zon; L5 = Lon; LA = Lat;
  1829. X    }
  1830. X    castchart(TRUE);
  1831. X    for (i = 1; i <= SIGNS; i++)
  1832. X      house2[i] = house[i];
  1833. X    for (i = 1; i <= objects; i++) {
  1834. X      planet2[i] = planet[i];
  1835. X      ret2[i] = ret[i];
  1836. X    }
  1837. X    for (div = 1; div <= DIVISIONS; div++) {
  1838. X      occurcount = 0;
  1839. X      M = Mon2; Y = Yea2; F = 0.0; X = defzone; L5 = deflong; LA = deflat;
  1840. X      D = 1.0+(daysiz/24.0/60.0)*div/ (double) DIVISIONS;
  1841. X      if (prog) {
  1842. X    Jdp = mdytojulian(M, D, Y);
  1843. X    M = Mon; D = Day; Y = Yea; F = Tim; X = Zon; L5 = Lon; LA = Lat;
  1844. X      }
  1845. X      castchart(TRUE);
  1846. X      for (i = 1; i <= SIGNS; i++) {
  1847. X    house1[i] = house2[i]; house2[i] = house[i];
  1848. X      }
  1849. X      for (i = 1; i <= objects; i++) {
  1850. X    planet1[i] = planet2[i]; ret1[i] = ret2[i];
  1851. X    planet2[i] = planet[i];  ret2[i] = ret[i];
  1852. X      }
  1853. X      for (i = 1; i <= total; i++) if (!ignore[i])
  1854. X    for (j = 1; j <= BASE; j++) if (!ignore[j] &&
  1855. X      (j != 2 || (j == 2 && (todisplay & 512) > 0)) &&
  1856. X      (prog || j <= THINGS || j > objects+4))
  1857. X      for (k = 1; k <= aspects; k++) {
  1858. X        d = planet3[i]; e1 = planet1[j]; e2 = planet2[j];
  1859. X        if (mindistance(e1, mod(d-aspectangle[k])) <
  1860. X        mindistance(e2, mod(d+aspectangle[k]))) {
  1861. X          e1 = mod(e1+aspectangle[k]);
  1862. X          e2 = mod(e2+aspectangle[k]);
  1863. X        } else {
  1864. X          e1 = mod(e1-aspectangle[k]);
  1865. X          e2 = mod(e2-aspectangle[k]);
  1866. X        }
  1867. X        f1 = e1-d;
  1868. X        if (dabs(f1) > 180.0)
  1869. X          f1 -= sgn(f1)*DEGREES;
  1870. X        f2 = e2-d;
  1871. X        if (dabs(f2) > 180.0)
  1872. X          f2 -= sgn(f2)*DEGREES;
  1873. X        if (mindistance(d, midpoint(e1, e2)) < 90.0 &&
  1874. X        sgn(f1) != sgn(f2) && occurcount < MAXINDAY) {
  1875. X          source[occurcount] = j;
  1876. X          aspect[occurcount] = k;
  1877. X          dest[occurcount] = i;
  1878. X          time[occurcount] = (int) (dabs(f1)/(dabs(f1)+dabs(f2))*divsiz) +
  1879. X        (int) ((double) (div-1)*divsiz);
  1880. X          sign[occurcount] = (int) (mod(
  1881. X        mindistance(planet1[j], mod(d-aspectangle[k])) <
  1882. X        mindistance(planet2[j], mod(d+aspectangle[k])) ?
  1883. X        d-aspectangle[k] : d+aspectangle[k])/30.0)+1;
  1884. X          isret[occurcount] = (ret1[j] < 0.0)+(ret2[j] < 0.0);
  1885. X          occurcount++;
  1886. X        }
  1887. X      }
  1888. X      for (i = 1; i < occurcount; i++) {
  1889. X    j = i-1;
  1890. X    while (j >= 0 && time[j] > time[j+1]) {
  1891. X      swapint(&source[j], &source[j+1]);
  1892. X      swapint(&aspect[j], &aspect[j+1]);
  1893. X      swapint(&dest[j], &dest[j+1]);
  1894. X      swapint(&time[j], &time[j+1]);
  1895. X      swapint(&sign[j], &sign[j+1]);
  1896. X      swapint(&isret[j], &isret[j+1]);
  1897. X      j--;
  1898. X    }
  1899. X      }
  1900. X      for (i = 0; i < occurcount; i++) {
  1901. X    s1 = time[i]/24/60;
  1902. X    s3 = time[i]-s1*24*60;
  1903. X    s2 = s3/60;
  1904. X    s3 = s3-s2*60;
  1905. X    printf("%2.0f/%d%d/%4.0f %2d:%d%d%cm - %s ",
  1906. X           Mon2, (s1+1)/10, (s1+1)%10, Yea2, mod12(s2),
  1907. X           s3/10, s3%10, s2 < 12 ? 'a' : 'p', !prog ? "trans" : "progr");
  1908. X    printfield(objectname[source[i]], 7);
  1909. X    j = (int) (planet3[dest[i]]/30.0)+1;
  1910. X    printf(" %c%c%c%c%c ",
  1911. X           isret[i] < 1 ? '(' : (isret[i] > 1 ? '[' : '<'),
  1912. X           SIGNAM(sign[i]),
  1913. X           isret[i] < 1 ? ')' : (isret[i] > 1 ? ']' : '>'));
  1914. X    printf("%s natal %c%c%c%c%c %s", aspectabbrev[aspect[i]],
  1915. X           ret3[dest[i]] >= 0.0 ? '(' : '[', SIGNAM(j),
  1916. X           ret3[dest[i]] >= 0.0 ? ')' : ']', objectname[dest[i]]);
  1917. X    if (source[i] == 1 && aspect[i] == 1 && dest[i] == 1)
  1918. X      printf(" (Solar Return)");
  1919. X    else if (source[i] == 2 && aspect[i] == 1 && dest[i] == 2)
  1920. X      printf(" (Lunar Return)");
  1921. X    putchar('\n');
  1922. X      }
  1923. X    }
  1924. X  }
  1925. X}
  1926. X
  1927. Xvoid printephemeris()
  1928. X{
  1929. X  double M1, M2;
  1930. X  int daysiz, i, j, k, s, d, m;
  1931. X  k = todisplay & 1024 ? BASE : 10;
  1932. X  if (Mon2 == 0.0) {
  1933. X    M1 = 1.0; M2 = 12.0;
  1934. X  } else
  1935. X    M1 = M2 = Mon2;
  1936. X  for (Mon2 = M1; Mon2 <= M2; Mon2 += 1.0) {
  1937. X    daysiz = dayinmonth((int) Mon2, (int) Yea2);
  1938. X    printf("Mo/Dy/Yr");
  1939. X    for (j = 1; j <= k; j++) {
  1940. X      if (!ignore[j] && (j <= THINGS || j > objects+4))
  1941. X    printf("  %c%c%c%c ", OBJNAM(j), objectname[j][3] != 0 ?
  1942. X           objectname[j][3] : ' ');
  1943. X    }
  1944. X    putchar('\n');
  1945. X    for (i = 1; i <= daysiz; i++) {
  1946. X      M = Mon2; D = (double) i; Y = Yea2;
  1947. X      F = 0.0; X = defzone; L5 = deflong; LA = deflat;
  1948. X      castchart(TRUE);
  1949. X      printf("%2d/%2d/%2d ", (int) Mon2, i, ((int) Yea2) % 100);
  1950. X      for (j = 1; j <= k; j++)
  1951. X    if (!ignore[j] && (j <= THINGS || j > objects+4)) {
  1952. X      s = (int) (planet[j]/30.0) + 1;
  1953. X      d = (int) planet[j] - (s-1)*30;
  1954. X      m = (int) ((planet[j]-floor(planet[j]))*60.0);
  1955. X      printf("%d%d%s%d%d%c", d/10, d%10, signabbrev[s], m/10, m%10,
  1956. X         ret[j] >= 0.0 ? ' ' : '.');
  1957. X    }
  1958. X      putchar('\n');
  1959. X    }
  1960. X    if (Mon2 < M2)
  1961. X      putchar('\n');
  1962. X  }
  1963. X}
  1964. X
  1965. Xvoid printchart(prog)
  1966. X{
  1967. X  int todisp;
  1968. X  todisp = todisplay & 255;
  1969. X  if (todisp == 0)
  1970. X    todisp = todisplay = todisplay | 1;
  1971. X  if (todisp & 1) {
  1972. X    chartlocation();
  1973. X    if (todisp - (todisp & 1))
  1974. X      printf("\n\n");
  1975. X  }
  1976. X  if (todisp & 2) {
  1977. X    chartwheel();
  1978. X    if (todisp - (todisp & 3))
  1979. X      printf("\n\n");
  1980. X  }
  1981. X  if (todisp & 4) {
  1982. X    if (relation != -1) {
  1983. X      creategrid(FALSE);
  1984. X      chartgrid();
  1985. X      if (todisplay & 8192) {
  1986. X    printf("\n");
  1987. X    displaygrands();
  1988. X      }
  1989. X    } else {
  1990. X      createrelationgrid(todisplay & 8192 ? 2 : FALSE);
  1991. X      displayrelationgrid();
  1992. X    }
  1993. X    if (todisp - (todisp & 7))
  1994. X      printf("\n\n");
  1995. X  }
  1996. X  if (todisp & 8) {
  1997. X    charthorizon();
  1998. X    if (todisp - (todisp & 15))
  1999. X      printf("\n\n");
  2000. X  }
  2001. X  if (todisp & 16) {
  2002. X    chartspace();
  2003. X    if (todisp - (todisp & 31))
  2004. X      printf("\n\n");
  2005. X  }
  2006. X  if (todisp & 32) {
  2007. X    chartinfluence();
  2008. X    if (todisp - (todisp & 63))
  2009. X      printf("\n\n");
  2010. X  }
  2011. X  if (todisp & 64) {
  2012. X    chartastrograph();
  2013. X    if (todisp - (todisp & 127))
  2014. X      printf("\n\n");
  2015. X  }
  2016. X  if (todisp & 128)
  2017. X    displayinday(prog);
  2018. X}
  2019. X
  2020. X/**/
  2021. END_OF_FILE
  2022. if test 17587 -ne `wc -c <'options.c'`; then
  2023.     echo shar: \"'options.c'\" unpacked with wrong size!
  2024. fi
  2025. # end of 'options.c'
  2026. fi
  2027. echo shar: End of archive 2 \(of 8\).
  2028. cp /dev/null ark2isdone
  2029. MISSING=""
  2030. for I in 1 2 3 4 5 6 7 8 ; do
  2031.     if test ! -f ark${I}isdone ; then
  2032.     MISSING="${MISSING} ${I}"
  2033.     fi
  2034. done
  2035. if test "${MISSING}" = "" ; then
  2036.     echo You have unpacked all 8 archives.
  2037.     echo "See the README file for further instructions."
  2038.     rm -f ark[1-9]isdone
  2039. else
  2040.     echo You still need to unpack the following archives:
  2041.     echo "        " ${MISSING}
  2042. fi
  2043. ##  End of shell archive.
  2044. exit 0
  2045.  
  2046. exit 0 # Just in case...
  2047.