home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / misc / volume28 / astrolog / part05 < prev    next >
Encoding:
Text File  |  1992-03-14  |  50.6 KB  |  1,698 lines

  1. Newsgroups: comp.sources.misc
  2. From: pullen@cs.washington.edu (Walter D. Pullen)
  3. Subject:  v28i108:  astrolog - Generation of astrology charts v2.10, Part05/06
  4. Message-ID: <1992Mar16.025103.13377@sparky.imd.sterling.com>
  5. X-Md4-Signature: 7faf7413d679886e649e7899d936aad6
  6. Date: Mon, 16 Mar 1992 02:51:03 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: pullen@cs.washington.edu (Walter D. Pullen)
  10. Posting-number: Volume 28, Issue 108
  11. Archive-name: astrolog/part05
  12. Environment: UNIX, VMS
  13.  
  14. #! /bin/sh
  15. # This is a shell archive.  Remove anything before this line, then unpack
  16. # it by saving it into a file and typing "sh file".  To overwrite existing
  17. # files, type "sh file -c".  You can also feed this as standard input via
  18. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  19. # will see the following message at the end:
  20. #        "End of archive 5 (of 6)."
  21. # Contents:  options.c driver.c
  22. # Wrapped by pullen@lynx.cs.washington.edu on Sun Mar 15 16:05:15 1992
  23. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  24. if test -f 'options.c' -a "${1}" != "-c" ; then 
  25.   echo shar: Will not clobber existing file \"'options.c'\"
  26. else
  27. echo shar: Extracting \"'options.c'\" \(31626 characters\)
  28. sed "s/^X//" >'options.c' <<'END_OF_FILE'
  29. X/*
  30. X** Astrolog (Version 2.10) File: options.c
  31. X*/
  32. X
  33. X#include "astrolog.h"
  34. X
  35. Xint wheel[SIGNS][WHEELROWS];
  36. X
  37. X/*
  38. X*******************************************************************************
  39. X** Display subprograms
  40. X*******************************************************************************
  41. X*/
  42. X
  43. Xprintlocation()
  44. X{
  45. X  int i, j;
  46. X  int total = 0, elemode[4][3], elem[4], mo[3], pos = 0, abo = 0, lef = 0;
  47. X  for (i = 0; i < 4; i++)
  48. X    elem[i] = 0;
  49. X  for (j = 0; j < 3; j++)
  50. X    mo[j] = 0;
  51. X  for (i = 0; i < 4; i++)
  52. X    for (j = 0; j < 3; j++)
  53. X      elemode[i][j] = 0;
  54. X  for (i = 1; i <= objects; i++)
  55. X    if (!ignore[i]) {
  56. X      total++;
  57. X      j = (int) (planet[i]/30.0) + 1;
  58. X      elemode[(j-1)%4][(j-1)%3]++;
  59. X      elem[(j-1)%4]++; mo[(j-1)%3]++;
  60. X      pos += (j & 1);
  61. X      j = inhouse[i];
  62. X      abo += (j >= 7);
  63. X      lef += (j < 4 || j >= 10);
  64. X    }
  65. X  i = (int) ((dabs(Tim)-floor(dabs(Tim)))*100.0+0.5);
  66. X  j = (int) ((dabs(Zon)-floor(dabs(Zon)))*100.0+0.5);
  67. X  printf("Astrolog (%s) chart ", VERSION);
  68. X  if (Mon == -1)
  69. X    printf("(no time or space)\n");
  70. X  else if (relation == 2)
  71. X    printf("(composite)\n");
  72. X  else {
  73. X    printf("for %d %s %d %.0f:%d%d (%c%.0f:%d%d GMT) ",
  74. X       (int) Day, monthname[(int) Mon], (int) Yea, floor(Tim), 
  75. X       i/10, i%10, Zon > 0.0 ? '-' : '+', dabs(Zon), j/10, j%10);
  76. X    i = (int) ((dabs(Lon)-floor(dabs(Lon)))*100.0+0.5);
  77. X    j = (int) ((dabs(Lat)-floor(dabs(Lat)))*100.0+0.5);
  78. X    printf("%.0f'%d%d%c ",
  79. X       floor(dabs(Lon)), i/10, i%10, Lon < 0.0 ? 'E' : 'W');
  80. X    printf("%.0f'%d%d%c\n",
  81. X       floor(dabs(Lat)), j/10, j%10, Lat < 0.0 ? 'S' : 'N');
  82. X  }
  83. X  printf("Body  Locat. Ret. Decl. Rul.      House  Rul.    %s Houses.\n\n",
  84. X     systemname[housesystem]);
  85. X  for (i = 1; i <= objects; i++) {
  86. X    printf("%c%c%c%c: ", OBJNAM(i), objectname[i][3] ? objectname[i][3] : ' ');
  87. X    printminute(planet[i]);
  88. X    printf(" %s ", ret[i] == 0.0 ? " " : "R");
  89. X    printaltitude(planetalt[i]);
  90. X    printf(" (%c)", dignify(i, (int) (planet[i]/30.0) +1));
  91. X    j = inhouse[i];
  92. X    printf(" [%2d%c%c house]", j, post[j][0], post[j][1]);
  93. X    printf(" [%c]", dignify(i, j));
  94. X    if (i <= SIGNS) {
  95. X      printf("  -  House cusp %2d: ", i);
  96. X      printminute(house[i]);
  97. X    }
  98. X    if (i == SIGNS+2)
  99. X      printf("     Car Fix Mut TOT");
  100. X    else if (i > SIGNS+2 && i < SIGNS+7) {
  101. X      j = i-(SIGNS+2)-1;
  102. X      printf("  %c%c%c%3d %3d %3d %3d",
  103. X         element[j][0], element[j][1], element[j][2],
  104. X         elemode[j][0], elemode[j][1], elemode[j][2], elem[j]);
  105. X    } else if (i == SIGNS+7)
  106. X      printf("  TOT %2d %3d %3d %3d", mo[0], mo[1], mo[2], total);
  107. X    switch (i-SIGNS-1) {
  108. X    case 1: printf("   +:%2d", pos);       break;
  109. X    case 2: printf("   -:%2d", total-pos); break;
  110. X    case 3: printf("   M:%2d", abo);       break;
  111. X    case 4: printf("   N:%2d", total-abo); break;
  112. X    case 5: printf("   A:%2d", lef);       break;
  113. X    case 6: printf("   D:%2d", total-lef); break;
  114. X    }
  115. X    printf("\n");
  116. X  }
  117. X}
  118. X
  119. Xvoid creategrid(acc)
  120. Xint acc;
  121. X{
  122. X  int i, j, k;
  123. X  double l;
  124. X  for (j = 1; j <= objects; j++) {
  125. X    for (i = 1; i <= objects; i++) {
  126. X      if (i < j) {
  127. X    gridname[i][j] = grid[i][j] = 0;
  128. X    l = mindistance(planet[i], planet[j]);
  129. X    for (k = aspects; k >= 1; k--)
  130. X      if (dabs(l-aspectangle[k]) <
  131. X          MIN(aspectorb[k], MIN(planetorbmax[i], planetorbmax[j]))) {
  132. X        gridname[i][j] = k;
  133. X        grid[i][j] = (int) ((l-aspectangle[k])*(!acc ? 10.0 : 60.0));
  134. X      }
  135. X      } else if (i > j) {
  136. X    l = mod(midpoint(planet[i], planet[j])+0.5); k = (int) l;
  137. X    gridname[i][j] = k/30+1;
  138. X    grid[i][j] = !acc ? k%30 : (int)((l-(double)(k/30)*30.0)*60.0);
  139. X      } else {
  140. X    gridname[i][j] = (int)planet[j]/30+1;
  141. X    grid[i][j] = (int)(planet[j]-(double)(gridname[i][j]-1)*30.0);
  142. X      }
  143. X    }
  144. X  }
  145. X}
  146. X
  147. Xprintgrid()
  148. X{
  149. X  int i, j, k, temp;
  150. X  for (j = 1; j <= objects; j++) if (!ignore[j])
  151. X    for (k = 1; k <= 3; k++) {
  152. X      for (i = 1; i <= objects; i++) if (!ignore[i]) {
  153. X    if (i > 1 && j+k > 2)
  154. X      putchar('|');
  155. X    if (k > 1) {
  156. X      if (i < j) {
  157. X        if (k < 3)
  158. X          printf("%s", aspectabbrev[gridname[i][j]]);
  159. X        else {
  160. X          if (gridname[i][j]) {
  161. X        if (grid[i][j] < 100)
  162. X          printf("%d%c%d", abs(grid[i][j])/10,
  163. X             grid[i][j] < 0 ? ',' : '.', abs(grid[i][j])%10);
  164. X        else if (grid[i][j] < 1000)
  165. X          printf("%2d%c", abs(grid[i][j])/10,
  166. X             grid[i][j] < 0 ? ',' : '.');
  167. X        else
  168. X          printf("%3d", abs(grid[i][j])/10);
  169. X          } else
  170. X        printf("   ");
  171. X        }
  172. X      } else if (i > j) {
  173. X        if (k < 3)
  174. X          printf("%d%d'", grid[i][j]/10, grid[i][j]%10);
  175. X        else {
  176. X          temp = gridname[i][j];
  177. X          printf("%c%c%c", SIGNAM(temp));
  178. X        }
  179. X      } else {
  180. X        if (k < 3)
  181. X          printf("%c%c%c", OBJNAM(j));
  182. X        else
  183. X          printf("###");
  184. X      }
  185. X    } else
  186. X      if (j > 1)
  187. X        printf("---");
  188. X      }
  189. X      if (j+k > 2)
  190. X    putchar('\n');
  191. X    }
  192. X}
  193. X
  194. Xcreaterelationgrid(acc)
  195. Xint acc;
  196. X{
  197. X  int i, j, k;
  198. X  double l;
  199. X  for (j = 1; j <= objects; j++) {
  200. X    for (i = 1; i <= objects; i++) {
  201. X      l = mindistance(planet2[i], planet1[j]);
  202. X      for (k = aspects; k >= 1; k--)
  203. X    if (dabs(l-aspectangle[k]) <
  204. X        MIN(aspectorb[k], MIN(planetorbmax[i], planetorbmax[j]))) {
  205. X      gridname[i][j] = k;
  206. X      grid[i][j] = (int) ((l-aspectangle[k])*(!acc ? 10.0 : 60.0));
  207. X    }
  208. X    }
  209. X  }
  210. X}
  211. X
  212. Xprintrelationgrid()
  213. X{
  214. X  int i, j, k;
  215. X  printf("AB>");
  216. X  for (i = 1; i < objects; i++) if (!ignore[i])
  217. X    printf("|%c%c%c", OBJNAM(i));
  218. X  printf("\nV  ");
  219. X  for (i = 1; i < objects; i++) if (!ignore[i])
  220. X    printf("|###");
  221. X  putchar('\n');
  222. X  for (j = 1; j < objects; j++) if (!ignore[j])
  223. X    for (k = 1; k <= 3; k++) {
  224. X      if (k < 2)
  225. X    printf("---");
  226. X      else if (k == 2)
  227. X    printf("%c%c%c", OBJNAM(j));
  228. X      else
  229. X    printf("###");
  230. X      for (i = 1; i < objects; i++) if (!ignore[i]) {
  231. X    putchar('|');
  232. X        if (k < 2)
  233. X      printf("---");
  234. X    else if (k == 2)
  235. X      printf("%s", aspectabbrev[gridname[i][j]]);
  236. X    else
  237. X      if (gridname[i][j]) {
  238. X        if (grid[i][j] < 100)
  239. X          printf("%d%c%d", abs(grid[i][j])/10, grid[i][j] < 0 ? ',' : '.',
  240. X             abs(grid[i][j])%10);
  241. X        else if (grid[i][j] < 1000)
  242. X          printf("%2d%c", abs(grid[i][j])/10,
  243. X             grid[i][j] < 0 ? ',' : '.');
  244. X        else
  245. X          printf("%3d", abs(grid[i][j])/10);
  246. X      } else
  247. X        printf("   ");
  248. X      }
  249. X      putchar('\n');
  250. X    }
  251. X}
  252. X
  253. Xprintgrand(nam, i1, i2, i3, i4)
  254. Xchar nam;
  255. Xint i1, i2, i3, i4;
  256. X{
  257. X  switch (nam) {
  258. X  case 't': printf("Grand Trine"); break;
  259. X  case 's': printf("T-Square   "); break;
  260. X  case 'y': printf("Yod        "); break;
  261. X  case 'g': printf("Grand Cross"); break;
  262. X  case 'c': printf("Cradle     "); break;
  263. X  default: ;
  264. X  }
  265. X  printf(" %s ", nam == 't' || nam == 'g' ? "with" : "from");
  266. X  printf("%c%c%c: ", OBJNAM(i1));
  267. X  printminute(planet[i1]);
  268. X  printf(" %s %c%c%c: ", nam == 't' ? "and" : "to ", OBJNAM(i2));
  269. X  printminute(planet[i2]);
  270. X  printf(" %s %c%c%c: ", nam == 'g' || nam == 'c' ? "to " : "and", OBJNAM(i3));
  271. X  printminute(planet[i3]);
  272. X  if (nam == 'g' || nam == 'c') {
  273. X    printf(" to %c%c%c: ", OBJNAM(i4));
  274. X    printminute(planet[i4]);
  275. X  }
  276. X  printf("\n");
  277. X}
  278. X
  279. Xdisplaygrands()
  280. X{
  281. X  int count = 0, i, j, k, l;
  282. X  for (i = 1; i <= objects; i++) if (!ignore[i])
  283. X    for (j = 1; j <= objects; j++) if (j != i && !ignore[j])
  284. X      for (k = 1; k <= objects; k++) if (k != i && k != j && !ignore[k]) {
  285. X    if (i < j && j < k && gridname[i][j] == 4 &&
  286. X        gridname[i][k] == 4 && gridname[j][k] == 4) {
  287. X      count++;
  288. X      printgrand('t', i, j, k, l);
  289. X    } else if (j < k && gridname[j][k] == 2 &&
  290. X        gridname[MIN(i, j)][MAX(i, j)] == 3 &&
  291. X        gridname[MIN(i, k)][MAX(i, k)] == 3) {
  292. X      count++;
  293. X      printgrand('s', i, j, k, l);
  294. X    } else if (j < k && gridname[j][k] == 5 &&
  295. X        gridname[MIN(i, j)][MAX(i, j)] == 6 &&
  296. X        gridname[MIN(i, k)][MAX(i, k)] == 6) {
  297. X      count++;
  298. X      printgrand('y', i, j, k, l);
  299. X    }
  300. X    for (l = 1; l <= objects; l++) if (!ignore[l]) {
  301. X      if (i < j && i < k && i < l && j < l && gridname[i][j] == 3 &&
  302. X          gridname[MIN(j, k)][MAX(j, k)] == 3 &&
  303. X          gridname[MIN(k, l)][MAX(k, l)] == 3 &&
  304. X          gridname[i][l] == 3 && mindistance(planet[i], planet[k]) > 150.0
  305. X          && mindistance(planet[j], planet[l]) > 150.0) {
  306. X        count++;
  307. X        printgrand('g', i, j, k, l);
  308. X      } else if (i < l && gridname[MIN(i, j)][MAX(i, j)] == 5 &&
  309. X          gridname[MIN(j, k)][MAX(j, k)] == 5 &&
  310. X          gridname[MIN(k, l)][MAX(k, l)] == 5 &&
  311. X          mindistance(planet[i], planet[l]) > 150.0) {
  312. X        count++;
  313. X        printgrand('c', i, j, k, l);
  314. X      }
  315. X    }
  316. X      }
  317. X  if (!count)
  318. X    printf("No major configurations in aspect grid.\n");
  319. X}
  320. X
  321. Xprinttab(chr, count)
  322. Xchar chr;
  323. Xint count;
  324. X{
  325. X  int i;
  326. X  for (i = 0; i < count; i++)
  327. X    putchar(chr);
  328. X}
  329. X
  330. Xprintwheelslot(house, row)
  331. Xint house, row;
  332. X{
  333. X  int i;
  334. X  i = wheel[house-1][row];
  335. X  if (i) {
  336. X    printf(" %c%c%c ", OBJNAM(i));
  337. X    printminute(planet[i]);
  338. X    printf("%c ", ret[i] ? 'r' : ' ');
  339. X    printtab(' ', WHEELCOLS-14-1);
  340. X  } else
  341. X    printtab(' ', WHEELCOLS-1);
  342. X}
  343. X
  344. Xprintwheel()
  345. X{
  346. X  int i, j, k, l;
  347. X  for (i = 0; i < SIGNS; i++)
  348. X    for (j = 0; j < WHEELROWS; j++)
  349. X      wheel[i][j] = 0;
  350. X  for (i = 1; i <= objects; i++) {
  351. X    if (!ignore[i] && i != 18 && i != 19)
  352. X      for (j = inhouse[i]-1; j < SIGNS; j = j < SIGNS ? (j+1)%SIGNS : j) {
  353. X    l = house[j+1] > house[mod12(j+2)];
  354. X    for (k = 0; k < WHEELROWS && wheel[j][k] > 0 &&
  355. X         (planet[i] >= planet[wheel[j][k]] ||
  356. X          (l && planet[i] < 180.0 && planet[wheel[j][k]] > 180.0)) &&
  357. X         !(l && planet[i] > 180.0 && planet[wheel[j][k]] < 180.0); k++)
  358. X      ;
  359. X    if (wheel[j][k] <= 0) {
  360. X      wheel[j][k] = i;
  361. X      j = SIGNS;
  362. X    } else if (k < WHEELROWS && wheel[j][WHEELROWS-1] <= 0) {
  363. X      for (l = WHEELROWS-1; l > k; l--)
  364. X        wheel[j][l] = wheel[j][l-1];
  365. X      wheel[j][k] = i;
  366. X      j = SIGNS;
  367. X    }
  368. X      }
  369. X  }
  370. X  if (todisplay & 2048)
  371. X    for (i = 3; i < 9; i++)
  372. X      for (j = 0; j < WHEELROWS/2; j++) {
  373. X    k = WHEELROWS-1-j;
  374. X    l = wheel[i][j]; wheel[i][j] = wheel[i][k]; wheel[i][k] = l;
  375. X      }
  376. X  printf("+"); printtab('-', WHEELCOLS-8); printf("<11>");
  377. X  printminute(house[11]); printtab('-', WHEELCOLS-11); printf("<10>");
  378. X  printminute(house[10]); printtab('-', WHEELCOLS-10); printf("<9>");
  379. X  printminute(house[9]); printtab('-', WHEELCOLS-4); printf("+\n");
  380. X  for (i = 0; i < WHEELROWS; i++) {
  381. X    for (j = 11; j >= 8; j--) {
  382. X      printf("|"); printwheelslot(j, i);
  383. X    }
  384. X    printf("|\n");
  385. X  }
  386. X  printf("<12>"); printminute(house[12]); printtab('-', WHEELCOLS-11);
  387. X  printf("|"); printtab('-', WHEELCOLS*2-1); printf("|");
  388. X  printtab('-', WHEELCOLS-10); printminute(house[8]); printf("<8>\n");
  389. X  for (i = 0; i < WHEELROWS; i++) {
  390. X    printf("|"); printwheelslot(12, i); printf("|");
  391. X    printtab(' ', WHEELCOLS*2-1); printf("|"); printwheelslot(7, i);
  392. X    printf("|\n");
  393. X  }
  394. X  printf("<1>"); printminute(house[1]); printtab('-', WHEELCOLS-10);
  395. X  printf("|"); printtab(' ', WHEELCOLS*2-1); printf("|");
  396. X  printtab('-', WHEELCOLS-10); printminute(house[7]); printf("<7>\n");
  397. X  for (i = 0; i < WHEELROWS; i++) {
  398. X    printf("|"); printwheelslot(1, i); printf("|");
  399. X    printtab(' ', WHEELCOLS*2-1); printf("|"); printwheelslot(6, i);
  400. X    printf("|\n");
  401. X  }
  402. X  printf("<2>"); printminute(house[2]); printtab('-', WHEELCOLS-10);
  403. X  printf("|"); printtab('-', WHEELCOLS*2-1); printf("|");
  404. X  printtab('-', WHEELCOLS-10); printminute(house[6]); printf("<6>\n");
  405. X  for (i = 0; i < WHEELROWS; i++) {
  406. X    for (j = 2; j <= 5; j++) {
  407. X      printf("|"); printwheelslot(j, i);
  408. X    }
  409. X    printf("|\n");
  410. X  }
  411. X  printf("+"); printtab('-', WHEELCOLS-4); printminute(house[3]);
  412. X  printf("<3>"); printtab('-', WHEELCOLS-10); printminute(house[4]);
  413. X  printf("<4>"); printtab('-', WHEELCOLS-10); printminute(house[5]);
  414. X  printf("<5>"); printtab('-', WHEELCOLS-7); printf("+\n");
  415. X}
  416. X
  417. Xequtolocal(azi, alt, tilt)
  418. Xdouble *azi, *alt, tilt;
  419. X{
  420. X  double x, y, a1, l1;
  421. X  x = cos(*alt)*sin(*azi)*cos(tilt);
  422. X  y = sin(*alt)*sin(tilt);
  423. X  x -= y;
  424. X  a1 = cos(*alt);
  425. X  y = cos(*alt)*cos(*azi);
  426. X  l1 = atan(x/y);
  427. X  if (l1 < 0.0)
  428. X    l1 += PI;
  429. X  if (x < 0.0)
  430. X    l1 += PI;
  431. X  a1 = ASIN(a1*sin(*azi)*sin(tilt)+sin(*alt)*cos(tilt));
  432. X  *azi = l1; *alt = a1;
  433. X}
  434. X
  435. Xprinthorizon()
  436. X{
  437. X  double lon, lat, sx, sy, vx, vy,
  438. X    lonz[OBJECTS+1], latz[OBJECTS+1], azi[OBJECTS+1], alt[OBJECTS+1];
  439. X  int i, j;
  440. X  lon = DTOR(mod(Lon)); lat = DTOR(Lat);
  441. X  for (i = 1; i <= objects; i++) {
  442. X    lonz[i] = DTOR(planet[i]); latz[i] = DTOR(planetalt[i]);
  443. X    ecltoequ(&lonz[i], &latz[i]);
  444. X  }
  445. X  for (i = 1; i <= objects; i++) {
  446. X    lonz[i] = DTOR(mod(RTOD(lonz[18]-lonz[i]+lon)));
  447. X    lonz[i] = DTOR(mod(RTOD(lonz[i]-lon+PI/2.0)));
  448. X    equtolocal(&lonz[i], &latz[i], PI/2.0-lat);
  449. X    azi[i] = DEGREES-RTOD(lonz[i]); alt[i] = RTOD(latz[i]);
  450. X  }
  451. X  printf("Body Altitude Azimuth  Azi. Vector   %s Vector    Moon Vector\n\n",
  452. X     heliocentric ? "Earth" : " Sun");
  453. X  for (i = 1; i <= THINGS; i++) {
  454. X    printf("%c%c%c%c: ", OBJNAM(i), objectname[i][3] ? objectname[i][3] : ' ');
  455. X    printaltitude(alt[i]);
  456. X    j = (int) ((azi[i]-floor(azi[i]))*60.0);
  457. X    printf(" %3d %d%d'", (int) azi[i], j/10, j%10);
  458. X    sx = cos(DTOR(azi[i])); sy = sin(DTOR(azi[i]));
  459. X    if (dabs(sx) < dabs(sy)) {
  460. X      vx = dabs(sx / sy); vy = 1.0;
  461. X    } else {
  462. X      vy = dabs(sy / sx); vx = 1.0;
  463. X    }
  464. X    printf(" (%.2f%c %.2f%c)",
  465. X       vy, sy < 0.0 ? 's' : 'n', vx, sx > 0.0 ? 'e' : 'w');
  466. X    vx = azi[1]-azi[i]; vy = azi[2]-azi[i];
  467. X    printf(" [%6.1f%6.1f] [%6.1f%6.1f]\n",
  468. X       dabs(vx) < 180.0 ? vx : sgn(vx)*(DEGREES-dabs(vx)), alt[1]-alt[i],
  469. X       dabs(vy) < 180.0 ? vy : sgn(vy)*(DEGREES-dabs(vy)), alt[2]-alt[i]);
  470. X  }
  471. X}
  472. X
  473. Xprintastrograph()
  474. X{
  475. X  double lat[MAXCROSS], lon[MAXCROSS], mc[OBJECTS+1], ic[OBJECTS+1],
  476. X    as[OBJECTS+1], ds[OBJECTS+1], as1[OBJECTS+1], ds1[OBJECTS+1],
  477. X    lo = Lon, longm, w, x, y, z, ad, oa, am, od, dm;
  478. X  int obj1[MAXCROSS], obj2[MAXCROSS], occurcount = 0, i, j, k, l, m, n;
  479. X  for (i = 1; i <= objects; i++) {
  480. X    planet1[i] = DTOR(planet[i]);
  481. X    planet2[i] = DTOR(planetalt[i]);
  482. X    ecltoequ(&planet1[i], &planet2[i]);
  483. X  }
  484. X  printf("Planet :");
  485. X  for (i = 1; i <= THINGS; i++)
  486. X    printf(" %c%c%c", OBJNAM(i));
  487. X  printf("\n------ :");
  488. X  for (i = 1; i <= THINGS; i++)
  489. X    printf(" ###");
  490. X  printf("\nMidheav: ");
  491. X  if (lo < 0.0)
  492. X    lo += 360.0;
  493. X  for (i = 1; i <= THINGS; i++) {
  494. X    x = planet1[18]-planet1[i];
  495. X    if (x < 0.0)
  496. X      x += 2.0*PI;
  497. X    if (x > PI)
  498. X      x -= 2.0*PI;
  499. X    z = lo+RTOD(x);
  500. X    if (z > 180.0)
  501. X      z -= 360.0;
  502. X    mc[i] = z;
  503. X    printf("%3.0f%c", dabs(z), z < 0.0 ? 'e' : 'w');
  504. X  }
  505. X  printf("\nNadir  : ");
  506. X  for (i = 1; i <= THINGS; i++) {
  507. X    z = mc[i] + 180.0;
  508. X    if (z > 180.0)
  509. X      z -= 360.0;
  510. X    ic[i] = z;
  511. X    printf("%3.0f%c", dabs(z), z < 0.0 ? 'e' : 'w');
  512. X  }
  513. X  printf("\nZenith : ");
  514. X  for (i = 1; i <= THINGS; i++) {
  515. X    y = RTOD(planet2[i]);
  516. X    printf("%3.0f%c", dabs(y), y < 0.0 ? 's' : 'n');
  517. X    as[i] = ds[i] = as1[i] = ds1[i] = 1000.0;
  518. X  }
  519. X  printf("\n\n");
  520. X  longm = DTOR(mod(RTOD(planet1[18])+lo));
  521. X  for (j = 80; j >= -80; j -= 5) {
  522. X    printf("Asc@%2d%c: ", j >= 0 ? j : -j, j < 0 ? 's' : 'n');
  523. X    for (i = 1; i <= THINGS; i++) {
  524. X      ad = tan(planet2[i])*tan(DTOR(j));
  525. X      if (ad*ad > 1.0) {
  526. X    printf(" -- ");
  527. X    as1[i] = ds1[i] = ret2[i] = 1000.0;
  528. X      } else {
  529. X    ad = ASIN(ad);
  530. X    oa = planet1[i]-ad;
  531. X    if (oa < 0.0)
  532. X      oa += 2.0*PI;
  533. X    am = oa-PI/2.0;
  534. X    if (am < 0.0)
  535. X      am += 2.0*PI;
  536. X    z = longm-am;
  537. X    if (z < 0.0)
  538. X      z += 2.0*PI;
  539. X    if (z > PI)
  540. X      z -= 2.0*PI;
  541. X    as1[i] = as[i];
  542. X    as[i] = z = RTOD(z);
  543. X    ret2[i] = ad;
  544. X    printf("%3.0f%c", dabs(z), z < 0.0 ? 'e' : 'w');
  545. X      }
  546. X    }
  547. X    printf("\nDsc@%2d%c: ", j >= 0 ? j : -j, j < 0 ? 's' : 'n');
  548. X    for (i = 1; i <= THINGS; i++) {
  549. X      ad = ret2[i];
  550. X      if (ad == 1000.0)
  551. X    printf(" -- ");
  552. X      else {
  553. X    od = planet1[i]+ad;
  554. X    dm = od+PI/2.0;
  555. X    z = longm-dm;
  556. X    if (z < 0.0)
  557. X      z += 2.0*PI;
  558. X    if (z > PI)
  559. X      z -= 2.0*PI;
  560. X    ds1[i] = ds[i];
  561. X    ds[i] = z = RTOD(z);
  562. X    printf("%3.0f%c", dabs(z), z < 0.0 ? 'e' : 'w');
  563. X      }
  564. X    }
  565. X    putchar('\n');
  566. X    if (todisplay & 16384)
  567. X      for (l = 1; l <= THINGS; l++) if (!ignore[l])
  568. X    for (k = 1; k <= THINGS; k++) if (!ignore[k])
  569. X      for (n = 0; n <= 1; n++) {
  570. X        x = n ? ds1[l] : as1[l];
  571. X        y = n ? ds[l] : as[l];
  572. X        for (m = 0; m <= 1; m++) {
  573. X          z = m ? ic[k] : mc[k];
  574. X          if (occurcount < MAXCROSS &&
  575. X          dabs(x-y) < 180.0 && sgn(z-x) != sgn(z-y)) {
  576. X        obj1[occurcount] = n ? -l : l;
  577. X        obj2[occurcount] = m ? -k : k;
  578. X        lat[occurcount] = (double)j+5.0*dabs(z-y)/dabs(x-y);
  579. X        lon[occurcount] = z;
  580. X        occurcount++;
  581. X          }
  582. X          w = m ? ds1[k] : as1[k];
  583. X          z = m ? ds[k] : as[k];
  584. X          if (occurcount < MAXCROSS && k > l &&
  585. X          dabs(x-y)+dabs(w-z) < 180.0 && sgn(w-x) != sgn(z-y)) {
  586. X        obj1[occurcount] = n ? -l : l;
  587. X        obj2[occurcount] = 100+(m ? -k : k);
  588. X        lat[occurcount] = (double)j+5.0*
  589. X          dabs(y-z)/(dabs(x-w)+dabs(y-z));
  590. X        lon[occurcount] = MIN(x, y)+dabs(x-y)*
  591. X          dabs(y-z)/(dabs(x-w)+dabs(y-z));
  592. X        occurcount++;
  593. X          }
  594. X        }
  595. X      }
  596. X  }
  597. X  if ((todisplay & 16384) == 0)
  598. X    return;
  599. X  putchar('\n');
  600. X  for (i = 1; i < occurcount; i++) {
  601. X    j = i-1;
  602. X    while (j >= 0 && lat[j] < lat[j+1]) {
  603. X      swapint(&obj1[j], &obj1[j+1]); swapint(&obj2[j], &obj2[j+1]);
  604. X      swapdoub(&lat[j], &lat[j+1]); swapdoub(&lon[j], &lon[j+1]);
  605. X      j--;
  606. X    }
  607. X  }
  608. X  for (i = 1; i < occurcount; i++) {
  609. X    j = abs(obj1[i]);
  610. X    printf("%c%c%c %s crosses ", OBJNAM(j),
  611. X       obj1[i] > 0 ? "Ascendant " : "Descendant");
  612. X    j = abs(obj2[i] - (obj2[i] < 50 ? 0 : 100));
  613. X    printf("%c%c%c %s at ", OBJNAM(j),
  614. X       obj2[i] < 50 ? (obj2[i] > 0 ? "Midheaven " :
  615. X       "Nadir     ") : (obj2[i] > 100 ? "Ascendant " : "Descendant"));
  616. X    j = (int) ((dabs(lon[i])-floor(dabs(lon[i])))*60.0);
  617. X    printf("%3d %d%d'%c, ", (int) dabs(lon[i]),
  618. X       j/10, j%10, lon[i] < 0.0 ? 'E' : 'W');
  619. X    j = (int) ((dabs(lat[i])-floor(dabs(lat[i])))*60.0);
  620. X    printf("%2d %d%d'%c\n", (int) dabs(lat[i]),
  621. X       j/10, j%10, lat[i] < 0.0 ? 'S' : 'N');
  622. X  }
  623. X  if (!occurcount)
  624. X    printf("No latitude crossings.\n");
  625. X}
  626. X
  627. Xprintinday(prog)
  628. Xint prog;
  629. X{
  630. X  int time[MAXINDAY], source[MAXINDAY], aspect[MAXINDAY], dest[MAXINDAY],
  631. X    sign1[MAXINDAY], sign2[MAXINDAY], occurcount, divisions, div,
  632. X    i, j, k, s1, s2;
  633. X  double Day2, D1, D2, divsiz, d1, d2, e1, e2, f1, f2, g;
  634. X  divisions = prog ? 1 : DIVISIONS;
  635. X  divsiz = 24.0/ (double) divisions*60.0;
  636. X  if (todisplay & 256) {
  637. X    D1 = 1.0;
  638. X    if (prog && Mon2 == 0.0) {
  639. X      Mon2 = 1.0; D2 = 365.0-28.0+(double)dayinmonth(2, (int) Yea2);
  640. X    } else D2 = (double)
  641. X      dayinmonth((int) (prog ? Mon2 : Mon), (int) (prog ? Yea2 : Yea));
  642. X  } else
  643. X    D1 = D2 = Day;
  644. X  for (Day2 = D1; Day2 <= D2; Day2 += 1.0) {
  645. X    occurcount = 0;
  646. X    readplanetdata(TRUE);
  647. X    M = Mon; D = Day2; Y = Yea; F = 0.0; X = Zon; L5 = Lon; LA = Lat;
  648. X    if (progress = prog) {
  649. X      Jdp = mdytojulian(Mon2, D, Yea2);
  650. X      M = Mon; D = Day; Y = Yea; F = Tim; X = Zon; L5 = Lon; LA = Lat;
  651. X    }
  652. X    castchart(TRUE);
  653. X    for (i = 1; i <= SIGNS; i++) {
  654. X      house2[i] = house[i];
  655. X      inhouse2[i] = inhouse[i];
  656. X    }
  657. X    for (i = 1; i <= objects; i++) {
  658. X      planet2[i] = planet[i];
  659. X      ret2[i] = ret[i];
  660. X    }
  661. X    for (div = 1; div <= divisions; div++) {
  662. X      readplanetdata(TRUE);
  663. X      M = Mon; D = Day2; Y = Yea; X = Zon; L5 = Lon; LA = Lat;
  664. X      F = 24.0*div/ (double) divisions;
  665. X      if (prog) {
  666. X    Jdp = mdytojulian(Mon2, D+1.0, Yea2);
  667. X    M = Mon; D = Day; Y = Yea; F = Tim; X = Zon; L5 = Lon; LA = Lat;
  668. X      }
  669. X      castchart(TRUE);
  670. X      for (i = 1; i <= SIGNS; i++) {
  671. X    house1[i] = house2[i]; inhouse1[i] = inhouse2[i];
  672. X    house2[i] = house[i];  inhouse2[i] = inhouse[i];
  673. X      }
  674. X      for (i = 1; i <= objects; i++) {
  675. X    planet1[i] = planet2[i]; ret1[i] = ret2[i];
  676. X    planet2[i] = planet[i];  ret2[i] = ret[i];
  677. X      }
  678. X      for (i = 1; i <= THINGS; i++) {
  679. X    s1 = (int) floor(planet1[i] / 30.0);
  680. X    s2 = (int) floor(planet2[i] / 30.0);
  681. X    if (!ignore[i] && s1 != s2) {
  682. X      source[occurcount] = i;
  683. X      aspect[occurcount] = -1;
  684. X      dest[occurcount] = s2+1;
  685. X      time[occurcount] = (int) (mindistance(planet1[i],
  686. X            (double) (ret1[i] == 0.0 ? s2 : s1) * 30.0) /
  687. X            mindistance(planet1[i], planet2[i])*divsiz) +
  688. X        (int) ((double) (div-1)*divsiz);
  689. X      sign1[occurcount] = sign2[occurcount] = s1+1;
  690. X      occurcount++;
  691. X    }
  692. X    if (!ignore[i] && ret1[i] != ret2[i]) {
  693. X      source[occurcount] = i;
  694. X      aspect[occurcount] = -2;
  695. X      dest[occurcount] = (int) ret2[i];
  696. X      time[occurcount] = 1441;
  697. X      sign1[occurcount] = sign2[occurcount] = s1+1;
  698. X      occurcount++;
  699. X    }
  700. X    for (j = i+1; j <= THINGS; j++) {
  701. X      if (!ignore[i] && !ignore[j])
  702. X        for (k = 1; k <= aspects; k++) {
  703. X          d1 = planet1[i]; d2 = planet2[i];
  704. X          e1 = planet1[j]; e2 = planet2[j];
  705. X          if (mindistance(d1, d2) < mindistance(e1, e2)) {
  706. X        swapdoub(&d1, &e1);
  707. X        swapdoub(&d2, &e2);
  708. X          }
  709. X          if (mindistance(e1, mod(d1-aspectangle[k])) <
  710. X          mindistance(e2, mod(d2+aspectangle[k]))) {
  711. X        e1 = mod(e1+aspectangle[k]);
  712. X        e2 = mod(e2+aspectangle[k]);
  713. X          } else {
  714. X        e1 = mod(e1-aspectangle[k]);
  715. X        e2 = mod(e2-aspectangle[k]);
  716. X          }
  717. X          f1 = e1-d1;
  718. X          if (dabs(f1) > 180.0)
  719. X        f1 -= sgn(f1)*DEGREES;
  720. X          f2 = e2-d2;
  721. X          if (dabs(f2) > 180.0)
  722. X        f2 -= sgn(f2)*DEGREES;
  723. X          if (mindistance(midpoint(d1, d2), midpoint(e1, e2)) < 90.0 &&
  724. X          sgn(f1) != sgn(f2)) {
  725. X        source[occurcount] = i;
  726. X        aspect[occurcount] = k;
  727. X        dest[occurcount] = j;
  728. X        f1 = d2-d1;
  729. X        if (dabs(f1) > 180.0)
  730. X          f1 -= sgn(f1)*DEGREES;
  731. X        f2 = e2-e1;
  732. X        if (dabs(f2) > 180.0)
  733. X          f2 -= sgn(f2)*DEGREES;
  734. X        g = (dabs(d1-e1) > 180.0 ?
  735. X          (d1-e1)-sgn(d1-e1)*DEGREES : d1-e1)/(f2-f1);
  736. X        time[occurcount] = (int) (g*divsiz) +
  737. X          (int) ((double) (div-1)*divsiz);
  738. X        sign1[occurcount] = (int) (mod(planet1[i]+
  739. X          sgn(planet2[i]-planet1[i])*
  740. X          (dabs(planet2[i]-planet1[i]) > 180.0 ? -1 : 1)*
  741. X                  dabs(g)*mindistance(planet1[i], planet2[i]))/30.0)+1;
  742. X        sign2[occurcount] = (int) (mod(planet1[j]+
  743. X          sgn(planet2[j]-planet1[j])*
  744. X          (dabs(planet2[j]-planet1[j]) > 180.0 ? -1 : 1)*
  745. X                  dabs(g)*mindistance(planet1[j], planet2[j]))/30.0)+1;
  746. X        occurcount++;
  747. X          }
  748. X        }
  749. X    }
  750. X      }
  751. X    }
  752. X    for (i = 1; i < occurcount; i++) {
  753. X      j = i-1;
  754. X      while (j >= 0 && time[j] > time[j+1]) {
  755. X    swapint(&source[j], &source[j+1]);
  756. X    swapint(&aspect[j], &aspect[j+1]);
  757. X    swapint(&dest[j], &dest[j+1]);
  758. X    swapint(&time[j], &time[j+1]);
  759. X    swapint(&sign1[j], &sign1[j+1]); swapint(&sign2[j], &sign2[j+1]);
  760. X    j--;
  761. X      }
  762. X    }
  763. X    for (i = 0; i < occurcount; i++) {
  764. X      s1 = time[i]/60;
  765. X      s2 = time[i]-s1*60;
  766. X      s1 = mod12(s1);
  767. X      j = (int) Day2;
  768. X      if (prog) {
  769. X    g = Mon2;
  770. X    while (j > (k = dayinmonth((int) g, (int) Yea2))) {
  771. X      j -= k;
  772. X      g += 1.0;
  773. X    }
  774. X      }
  775. X      printf("%2.0f/%d%d/%4.0f ",
  776. X         prog ? g : Mon, j/10, j%10, prog ? Yea2 : Yea);
  777. X      if (aspect[i] != -2)
  778. X    printf("%2d:%d%d%cm - ",
  779. X           s1, s2/10, s2%10, time[i] < 12*60 ? 'a' : 'p');
  780. X      else
  781. X    printtab(' ', 10);
  782. X      if (prog)
  783. X    printf("progr ");
  784. X      printtab(' ', 7-stringlen(objectname[source[i]]));
  785. X      j = (int) (ret1[source[i]]+ret2[source[i]]);
  786. X      printf("%s %c%c%c%c%c", objectname[source[i]],
  787. X         j < 1 ? '(' : (j > 1 ? '[' : '<'), SIGNAM(sign1[i]),
  788. X         j < 1 ? ')' : (j > 1 ? ']' : '>'));
  789. X      if (aspect[i] == -1)
  790. X    printf(" --> ");
  791. X      else if (aspect[i] == -2)
  792. X    printf(" S/%c", dest[i] ? 'R' : 'D');
  793. X      else
  794. X    printf(" %s ", aspectabbrev[aspect[i]]);
  795. X      if (aspect[i] == -1) {
  796. X    printf("%s", signname[dest[i]]);
  797. X    if (source[i] == 1) {
  798. X      if (dest[i] == 1)
  799. X        printf(" (Vernal Equinox)");
  800. X      else if (dest[i] == 4)
  801. X        printf(" (Summer Solstice)");
  802. X      else if (dest[i] == 7)
  803. X        printf(" (Autumnal Equinox)");
  804. X      else if (dest[i] == 10)
  805. X        printf(" (Winter Solstice)");
  806. X    }
  807. X      } else if (aspect[i] > 0) {
  808. X    j = (int) (ret1[dest[i]]+ret2[dest[i]]);
  809. X    printf("%c%c%c%c%c %s",
  810. X           j < 1 ? '(' : (j > 1 ? '[' : '<'), SIGNAM(sign2[i]),
  811. X           j < 1 ? ')' : (j > 1 ? ']' : '>'), objectname[dest[i]]);
  812. X    if (source[i] == 1 && dest[i] == 2) {
  813. X      if (aspect[i] == 1)
  814. X        printf(" (New Moon)");
  815. X      else if (aspect[i] == 2)
  816. X        printf(" (Full Moon)");
  817. X      else if (aspect[i] == 3)
  818. X        printf(" (Half Moon)");
  819. X    }
  820. X      }
  821. X      putchar('\n');
  822. X    }
  823. X  }
  824. X}
  825. X
  826. X
  827. X/*
  828. X*******************************************************************************
  829. X** Calculation subprograms
  830. X*******************************************************************************
  831. X*/
  832. X
  833. Xvoid printtransit(prog)
  834. Xint prog;
  835. X{
  836. X  double planet3[OBJECTS+5], house3[SIGNS+1], ret3[OBJECTS+5];
  837. X  int inhouse3[OBJECTS+1],
  838. X    time[MAXINDAY], source[MAXINDAY], aspect[MAXINDAY], dest[MAXINDAY],
  839. X    sign[MAXINDAY], isret[MAXINDAY], occurcount, div, i, j, k, s1, s2, s3;
  840. X  double M1, M2, divsiz, daysiz, d, e1, e2, f1, f2;
  841. X  inputdata(filename);
  842. X  Mon = M; Day = D; Yea = Y; Tim = F; Zon = X; Lon = L5; Lat = LA;
  843. X  castchart(TRUE);
  844. X  for (i = 1; i <= SIGNS; i++) {
  845. X    house3[i] = house[i];
  846. X    inhouse3[i] = inhouse[i];
  847. X  }
  848. X  for (i = 1; i <= objects; i++) {
  849. X    planet3[i] = planet[i];
  850. X    ret3[i] = ret[i];
  851. X  }
  852. X  planet3[objects+1] = house[11]; planet3[objects+2] = house[12];
  853. X  planet3[objects+3] = house[2];  planet3[objects+4] = house[3];
  854. X  for (i = objects+1; i <= objects+4; i++)
  855. X    ret3[i] = 0.0;
  856. X  if (Mon2 == 0.0) {
  857. X    M1 = 1.0; M2 = 12.0;
  858. X  } else
  859. X    M1 = M2 = Mon2;
  860. X  for (Mon2 = M1; Mon2 <= M2; Mon2 += 1.0) {
  861. X    daysiz = (double) dayinmonth((int) Mon2, (int) Yea2)*24.0*60.0;
  862. X    divsiz = daysiz/ (double) DIVISIONS;
  863. X    readplanetdata(TRUE);
  864. X    M = Mon2; D = 1.0; Y = Yea2; F = 0.0;
  865. X    X = defzone; L5 = deflong; LA = deflat;
  866. X    if (progress = prog) {
  867. X      Jdp = mdytojulian(M, D, Y);
  868. X      M = Mon; D = Day; Y = Yea; F = Tim; X = Zon; L5 = Lon; LA = Lat;
  869. X    }
  870. X    castchart(TRUE);
  871. X    for (i = 1; i <= SIGNS; i++) {
  872. X      house2[i] = house[i];
  873. X      inhouse2[i] = inhouse[i];
  874. X    }
  875. X    for (i = 1; i <= objects; i++) {
  876. X      planet2[i] = planet[i];
  877. X      ret2[i] = ret[i];
  878. X    }
  879. X    for (div = 1; div <= DIVISIONS; div++) {
  880. X      occurcount = 0;
  881. X      readplanetdata(TRUE);
  882. X      M = Mon2; Y = Yea2; F = 0.0; X = defzone; L5 = deflong; LA = deflat;
  883. X      D = 1.0+(daysiz/24.0/60.0)*div/ (double) DIVISIONS;
  884. X      if (prog) {
  885. X    Jdp = mdytojulian(M, D, Y);
  886. X    M = Mon; D = Day; Y = Yea; F = Tim; X = Zon; L5 = Lon; LA = Lat;
  887. X      }
  888. X      castchart(TRUE);
  889. X      for (i = 1; i <= SIGNS; i++) {
  890. X    house1[i] = house2[i]; inhouse1[i] = inhouse2[i];
  891. X    house2[i] = house[i];  inhouse2[i] = inhouse[i];
  892. X      }
  893. X      for (i = 1; i <= objects; i++) {
  894. X    planet1[i] = planet2[i]; ret1[i] = ret2[i];
  895. X    planet2[i] = planet[i];  ret2[i] = ret[i];
  896. X      }
  897. X      for (i = 1; i <= objects+4; i++) {
  898. X    for (j = 1; j <= THINGS;
  899. X         j += (j != 1 || (todisplay & 512) ? 1 : 2)) {
  900. X      if (!ignore[i] && !ignore[j])
  901. X        for (k = 1; k <= aspects; k++) {
  902. X          d = planet3[i]; e1 = planet1[j]; e2 = planet2[j];
  903. X          if (mindistance(e1, mod(d-aspectangle[k])) <
  904. X          mindistance(e2, mod(d+aspectangle[k]))) {
  905. X        e1 = mod(e1+aspectangle[k]);
  906. X        e2 = mod(e2+aspectangle[k]);
  907. X          } else {
  908. X        e1 = mod(e1-aspectangle[k]);
  909. X        e2 = mod(e2-aspectangle[k]);
  910. X          }
  911. X          f1 = e1-d;
  912. X          if (dabs(f1) > 180.0)
  913. X        f1 -= sgn(f1)*DEGREES;
  914. X          f2 = e2-d;
  915. X          if (dabs(f2) > 180.0)
  916. X        f2 -= sgn(f2)*DEGREES;
  917. X          if (mindistance(d, midpoint(e1, e2)) < 90.0 &&
  918. X          sgn(f1) != sgn(f2) && occurcount < MAXINDAY) {
  919. X        source[occurcount] = j;
  920. X        aspect[occurcount] = k;
  921. X                dest[occurcount] = i;
  922. X        time[occurcount] = (int) (dabs(f1)/(dabs(f1)+dabs(f2))*divsiz)
  923. X          + (int) ((double) (div-1)*divsiz);
  924. X        sign[occurcount] = (int) (mod(
  925. X          mindistance(planet1[j], mod(d-aspectangle[k])) <
  926. X          mindistance(planet2[j], mod(d+aspectangle[k])) ?
  927. X          d-aspectangle[k] : d+aspectangle[k])/30.0)+1;
  928. X        isret[occurcount] = (int) (ret1[j]+ret2[j]);
  929. X        occurcount++;
  930. X          }
  931. X        }
  932. X    }
  933. X      }
  934. X      for (i = 1; i < occurcount; i++) {
  935. X    j = i-1;
  936. X    while (j >= 0 && time[j] > time[j+1]) {
  937. X      swapint(&source[j], &source[j+1]);
  938. X      swapint(&aspect[j], &aspect[j+1]);
  939. X      swapint(&dest[j], &dest[j+1]);
  940. X      swapint(&time[j], &time[j+1]);
  941. X      swapint(&sign[j], &sign[j+1]);
  942. X      swapint(&isret[j], &isret[j+1]);
  943. X      j--;
  944. X    }
  945. X      }
  946. X      for (i = 0; i < occurcount; i++) {
  947. X    s1 = time[i]/24/60;
  948. X    s3 = time[i]-s1*24*60;
  949. X    s2 = s3/60;
  950. X    s3 = s3-s2*60;
  951. X    printf("%2.0f/%d%d/%4.0f %2d:%d%d%cm - %s ",
  952. X           Mon2, (s1+1)/10, (s1+1)%10, Yea2, mod12(s2),
  953. X           s3/10, s3%10, s2 < 12 ? 'a' : 'p', !prog ? "trans" : "progr");
  954. X    printtab(' ', 7-stringlen(objectname[source[i]]));
  955. X    j = (int) (planet3[dest[i]]/30.0)+1;
  956. X    printf("%s %c%c%c%c%c ", objectname[source[i]],
  957. X           isret[i] < 1 ? '(' : (isret[i] > 1 ? '[' : '<'),
  958. X           SIGNAM(sign[i]),
  959. X           isret[i] < 1 ? ')' : (isret[i] > 1 ? ']' : '>'));
  960. X    printf("%s natal %c%c%c%c%c %s", aspectabbrev[aspect[i]],
  961. X           ret3[dest[i]] == 0.0 ? '(' : '[', SIGNAM(j),
  962. X           ret3[dest[i]] == 0.0 ? ')' : ']', objectname[dest[i]]);
  963. X    if (source[i] == 1 && aspect[i] == 1 && dest[i] == 1)
  964. X      printf(" (Solar Return)");
  965. X    else if (source[i] == 2 && aspect[i] == 1 && dest[i] == 2)
  966. X      printf(" (Lunar Return)");
  967. X    putchar('\n');
  968. X      }
  969. X    }
  970. X  }
  971. X}
  972. X
  973. Xvoid printephemeris()
  974. X{
  975. X  double M1, M2;
  976. X  int daysiz, i, j, k, s, d, m;
  977. X  k = todisplay & 1024 ? 16 : 10;
  978. X  if (Mon2 == 0.0) {
  979. X    M1 = 1.0; M2 = 12.0;
  980. X  } else
  981. X    M1 = M2 = Mon2;
  982. X  for (Mon2 = M1; Mon2 <= M2; Mon2 += 1.0) {
  983. X    daysiz = dayinmonth((int) Mon2, (int) Yea2);
  984. X    printf("Mo/Dy/Yr");
  985. X    for (j = 1; j <= k; j++)
  986. X      if (!ignore[j])
  987. X    printf("  %c%c%c%c%c", OBJNAM(j), objectname[j][3] != 0 ?
  988. X           objectname[j][3] : ' ', j < k ? ' ' : '\n');
  989. X    for (i = 1; i <= daysiz; i++) {
  990. X      readplanetdata(TRUE);
  991. X      M = Mon2; D = (double) i; Y = Yea2;
  992. X      F = 0.0; X = defzone; L5 = deflong; LA = deflat;
  993. X      castchart(TRUE);
  994. X      printf("%2d/%2d/%2d ", (int) Mon2, i, ((int) Yea2) % 100);
  995. X      for (j = 1; j <= k; j++)
  996. X    if (!ignore[j]) {
  997. X      s = (int) (planet[j]/30.0) + 1;
  998. X      d = (int) planet[j] - (s-1)*30;
  999. X      m = (int) ((planet[j]-floor(planet[j]))*60.0);
  1000. X      printf("%d%d%s%d%d%c", d/10, d%10, signabbrev[s], m/10, m%10,
  1001. X         ret[j] == 0 ? ' ' : '.');
  1002. X    }
  1003. X      putchar('\n');
  1004. X    }
  1005. X    if (Mon2 < M2)
  1006. X      putchar('\n');
  1007. X  }
  1008. X}
  1009. X
  1010. Xvoid castrelation()
  1011. X{
  1012. X  int i;
  1013. X  inputdata(filename);
  1014. X  castchart(TRUE);
  1015. X  for (i = 1; i <= SIGNS; i++) {
  1016. X    house1[i] = house[i];
  1017. X    inhouse1[i] = inhouse[i];
  1018. X  }
  1019. X  for (i = 1; i <= objects; i++) {
  1020. X    planet1[i] = planet[i];
  1021. X    planetalt1[i] = planetalt[i];
  1022. X    ret1[i] = ret[i];
  1023. X  }
  1024. X  readplanetdata(TRUE);
  1025. X  inputdata(filename2);
  1026. X  Mon = M; Day = D; Yea = Y; Tim = F; Zon = X; Lon = L5; Lat = LA;
  1027. X  castchart(TRUE);
  1028. X  for (i = 1; i <= SIGNS; i++) {
  1029. X    house2[i] = house[i];
  1030. X    inhouse2[i] = inhouse[i];
  1031. X  }
  1032. X  for (i = 1; i <= objects; i++) {
  1033. X    planet2[i] = planet[i];
  1034. X    planetalt2[i] = planetalt[i];
  1035. X    ret2[i] = ret[i];
  1036. X  }
  1037. X  if (relation == 1)
  1038. X    for (i = 1; i <= SIGNS; i++)
  1039. X      house[i] = house1[i];
  1040. X  else if (relation == 2) {    
  1041. X    for (i = 1; i <= objects; i++) {
  1042. X      planet[i] = midpoint(planet1[i], planet2[i]);
  1043. X      planetalt[i] = (planetalt1[i]+planetalt2[i])/2.0;
  1044. X      ret[i] = (ret1[i] == 1.0 && ret2[i] == 1.0) ? 1.0 : 0.0;
  1045. X    }
  1046. X    for (i = 1; i <= SIGNS; i++)
  1047. X      house[i] = midpoint(house1[i], house2[i]);
  1048. X    for (i = 1; i <= SIGNS; i++)
  1049. X      if (mindistance(house[10], mod(house[i]-(double)(i+2)*30.0)) > 90.0)
  1050. X    house[i] = mod(house[i]+180.0);
  1051. X  }
  1052. X  houseplace();
  1053. X}
  1054. X
  1055. Xvoid printchart(prog)
  1056. X{
  1057. X  int todisp;
  1058. X  todisp = todisplay & 255;
  1059. X  if (todisp == 0)
  1060. X    todisp = todisp | 1;
  1061. X  if (todisp & 1) {
  1062. X    printlocation();
  1063. X    if (todisp - (todisp & 1))
  1064. X      printf("\n");
  1065. X  }
  1066. X  if (todisp & 2) {
  1067. X    printwheel();
  1068. X    if (todisp - (todisp & 3))
  1069. X      printf("\n");
  1070. X  }
  1071. X  if (todisp & 4) {
  1072. X    if (relation != 1) {
  1073. X      creategrid(FALSE);
  1074. X      printgrid();
  1075. X      if (todisplay & 8192) {
  1076. X    printf("\n");
  1077. X    displaygrands();
  1078. X      }
  1079. X    } else {
  1080. X      createrelationgrid(FALSE);
  1081. X      printrelationgrid();
  1082. X    }
  1083. X    if (todisp - (todisp & 7))
  1084. X      printf("\n");
  1085. X  }
  1086. X  if (todisp & 8) {
  1087. X    printhorizon();
  1088. X    if (todisp - (todisp & 15))
  1089. X      printf("\n");
  1090. X  }
  1091. X  if (todisp & 16) {
  1092. X    printastrograph();
  1093. X    if (todisp - (todisp & 31))
  1094. X      printf("\n");
  1095. X  }
  1096. X  if (todisp & 32)
  1097. X    printinday(prog);
  1098. X}
  1099. X
  1100. X/**/
  1101. END_OF_FILE
  1102. if test 31626 -ne `wc -c <'options.c'`; then
  1103.     echo shar: \"'options.c'\" unpacked with wrong size!
  1104. fi
  1105. # end of 'options.c'
  1106. fi
  1107. if test -f 'driver.c' -a "${1}" != "-c" ; then 
  1108.   echo shar: Will not clobber existing file \"'driver.c'\"
  1109. else
  1110. echo shar: Extracting \"'driver.c'\" \(16426 characters\)
  1111. sed "s/^X//" >'driver.c' <<'END_OF_FILE'
  1112. X/*
  1113. X** Astrolog (Version 2.10) File: driver.c
  1114. X*/
  1115. X
  1116. X#include "astrolog.h"
  1117. X
  1118. Xchar *filenameout, **extralines;
  1119. Xint prog = FALSE, extracount = 0;
  1120. X
  1121. X/*
  1122. X*******************************************************************************
  1123. X** Option processing
  1124. X*******************************************************************************
  1125. X*/
  1126. X
  1127. Xoutputdata()
  1128. X{
  1129. X  int i, j;
  1130. X  double k;
  1131. X  data = fopen(filenameout, "w");
  1132. X  if (data == NULL) {
  1133. X    fprintf(stderr, "File %s can not be created.\n", filenameout);
  1134. X    exit(1);
  1135. X  }
  1136. X  if (!(todisplay & 4096)) {
  1137. X    if (Mon < 1) {
  1138. X      fprintf(stderr, "\nCan't output chart with no time/space to file.\n");
  1139. X      fclose(data);
  1140. X      exit(1);
  1141. X    }
  1142. X    fprintf(data, "%.0f\n%.0f\n%.0f\n%.2f\n%.2f\n%.2f\n%.2f\n",
  1143. X        Mon, Day, Yea, Tim, Zon, Lon, Lat);
  1144. X  } else {
  1145. X    for (i = 1; i <= objects; i++) {
  1146. X      j = (int) planet[i];
  1147. X      fprintf(data, "%c%c%c: %2d %2d %10.7f\n", OBJNAM(i),
  1148. X          j%30, j/30+1, (planet[i]-floor(planet[i]))*60.0);
  1149. X      k = planetalt[i];
  1150. X      fprintf(data, "[%c]: %3d %12.8f\n",
  1151. X          ret[i] == 0 ? 'D' : 'R', (int)(sgn(k)*
  1152. X              floor(dabs(k))), (k-(double)(int)k)*60.0);
  1153. X    }
  1154. X    for (i = 1; i <= SIGNS/2; i++) {
  1155. X      j = (int) house[i];
  1156. X      fprintf(data, "H_%c: %2d %2d %10.7f\n",
  1157. X          'a'+i-1, j%30, j/30+1, (house[i]-floor(house[i]))*60.0);
  1158. X    }
  1159. X  }
  1160. X  for (i = 1; i < extracount; i++) {
  1161. X    extralines++;
  1162. X    fprintf(data, "%s\n", extralines[1]);
  1163. X  }
  1164. X  fclose(data);
  1165. X}
  1166. X
  1167. Xaction()
  1168. X{
  1169. X  if (operation & 2)
  1170. X    printtransit(prog);
  1171. X  else if (operation & 4)
  1172. X    printephemeris();
  1173. X  else {
  1174. X    if (!relation) {
  1175. X      if (!autom)
  1176. X    inputdata("tty");
  1177. X      Mon = M; Day = D; Yea = Y; Tim = F; Zon = X; Lon = L5; Lat = LA;
  1178. X      castchart(TRUE);
  1179. X    } else
  1180. X      castrelation();
  1181. X#ifdef X11
  1182. X    if (operation & 8)
  1183. X      actionx();
  1184. X    else
  1185. X#endif
  1186. X      printchart(prog);
  1187. X  }
  1188. X  if (operation & 1)
  1189. X    outputdata();
  1190. X}
  1191. X
  1192. Xdisplayswitches()
  1193. X{
  1194. X  printf("Astrolog command switches (version %s) (%s):\n", VERSION, DATE); 
  1195. X  printf(" -H: Display this help message.\n");
  1196. X  printf(" -O: Display available planets and other celestial objects.\n");
  1197. X  printf(" -R [<obj1> [<obj2> ..]: Restrict specific bodies from displays.\n");
  1198. X  printf(" -R0 [<obj1> ..]: Like -R but restrict everything first.\n");
  1199. X  printf(" -A [<0-18>]: Display available aspects or limit their number.\n");
  1200. X  printf(" -Ao <orb1> [<orb2> ..]: Specify max orbs for each aspect.\n");
  1201. X  printf(" -AO [..]: Like -Ao but suspend objects' max orb restrictions.\n");
  1202. X  printf("Switches which affect how a chart is computed:\n");
  1203. X  printf(" -s: Compute siderial instead of the normal tropical chart.\n");
  1204. X  printf(" -h: Compute heliocentric instead of geocentric positions.\n");
  1205. X  printf(" -c <value>: Select a different default system of houses.\n");
  1206. X  printf("     (0 = Placidus, 1 = Koch, 2 = Equal, 3 = Campanus, ");
  1207. X  printf("4 = Meridian,\n     5 = Regiomontanus, 6 = Porphry, ");
  1208. X  printf("7 = Morinus, 8 = Topocentric, 9 = None.)\n");
  1209. X  printf(" -u: Replace Mercury..Pluto with transneptunian/uranian bodies.\n");
  1210. X  printf(" -x <1-360>: Cast harmonic chart based on specified factor.\n");
  1211. X  printf(" -1 [<objnum>]: Cast chart with specified object on ascendant.\n");
  1212. X  printf(" -f: Display houses as sign positions (flip them).\n");
  1213. X  printf(" -3: Display objects in their zodiac decan positions.\n");
  1214. X  printf(" -p <month> <day> <year>: Cast progressed chart based for date.\n");
  1215. X#ifdef TIME
  1216. X  printf(" -pn: Cast progressed chart based on current date now.\n");
  1217. X#endif
  1218. X  printf(" -+ <days>: Cast chart for specified days in the future.\n");
  1219. X  printf("Switches which affect how a chart is displayed:\n");
  1220. X  printf(" -w: Display chart on screen in a graphic house wheel format.\n");
  1221. X  printf(" -w0: Like -w but show objects in houses 4..9 in reverse order.\n");
  1222. X  printf(" -g: Display midpoint & aspect grid instead of positions.\n");
  1223. X  printf(" -g0: Like -g but flag aspect configurations (e.g. Yod's) too.\n");
  1224. X  printf(" -Z: Display planet locations with respect to the local horizon.\n");
  1225. X  printf(" -L: Display astro-graph locations of planet angles on Earth.\n");
  1226. X  printf(" -L0: Like -L but display list of latitude crossings too.\n");
  1227. X  printf(" -d: Print all aspects and changes occuring in a day.\n");
  1228. X  printf(" -d0: Like -d but print all aspects for the entire month.\n");
  1229. X  printf(" -dp <month> <year>: Print aspects within progressed chart.\n");
  1230. X  printf(" -e: Print all options for chart (i.e. normal & -w0-g0-Z-L0-d).\n");
  1231. X  printf("Switches which affect how the chart parameters are obtained:\n");
  1232. X#ifdef TIME
  1233. X  printf(" -n: Compute chart for this exact moment using current time.\n");
  1234. X#endif
  1235. X  printf(" -a <month> <date> <year> <time> <zone> <long> <lat>:\n");
  1236. X  printf("     Compute chart automatically given specified data.\n");
  1237. X  printf(" -z <zone>: Change the default time zone (for -d-q-T-E options).\n");
  1238. X  printf(" -l <long> <lat>: ");
  1239. X  printf("Change the default longitude & latitude.\n");
  1240. X  printf(" -q <month> <date> <year>: Compute chart for noon on date.\n");
  1241. X  printf(" -q0 <month> <date> <year> <time>: Like -q but include time too.\n");
  1242. X  printf(" -i <file>: Compute chart based on info in file.\n");
  1243. X  printf(" -o <file> [..]: Write parameters of current chart to file.\n");
  1244. X  printf(" -o0 <file> [..]: Like -o but output planet/house positions.\n");
  1245. X  printf("Other features or major modes:\n");
  1246. X  printf(" -r <file1> <file2>: Compute a relationship chart.\n");
  1247. X  printf(" -rc <file1> <file2>: Compute a composite chart.\n");
  1248. X#ifdef TIME
  1249. X  printf(" -t <file>: Compute current house transits for particular chart.\n");
  1250. X#endif
  1251. X  printf(" -T <file> <month> <year>: ");
  1252. X  printf("Compute all transits in month for chart.\n");
  1253. X  printf(" -T0 <..>: Like -T but include transits of the Moon as well.\n");
  1254. X  printf(" -Tp <file> <month> <year>: ");
  1255. X  printf("Compute all progressions in month for chart.\n");
  1256. X  printf(" -E <month> <year>: Display ephemeris for given month.\n");
  1257. X  printf(" -E0 <..>: Like -E but include Chiron and the asteroids as well.\n");
  1258. X#ifdef X11
  1259. X  displayswitchesx();
  1260. X#endif
  1261. X}
  1262. X
  1263. X#ifndef SWITCHES
  1264. X#define MAXSWITCHES 20
  1265. Xint inputswitches(argv)
  1266. Xchar argv[MAXSWITCHES][10];
  1267. X{
  1268. X  int argc = 0;
  1269. X  printf("** Astrolog version %s (pullen@lynx.cs.washington.edu) **\n",
  1270. X    VERSION); 
  1271. X  printf("Enter all the switch parameters below. (Enter -H for help.)\n");
  1272. X  printf("Press return after each switch or number parameter input.\n");
  1273. X  printf("Input a '.' on a line by itself when done.\n\n");
  1274. X  do {
  1275. X    argc++;
  1276. X    printf("Input parameter string #%2d: ", argc);
  1277. X    if (gets(argv[argc]) == (char *) NULL) {
  1278. X      printf("\nAstrolog terminated.\n");
  1279. X      exit(1);
  1280. X    }
  1281. X  } while (argc < MAXSWITCHES && (argv[argc][0] != '.' || argv[argc][1] != 0));
  1282. X  printf("\n");
  1283. X  return argc;
  1284. X}
  1285. X#endif
  1286. X
  1287. X
  1288. X/*
  1289. X*******************************************************************************
  1290. X** Main program
  1291. X*******************************************************************************
  1292. X*/
  1293. X
  1294. Xmain(argc, argv)
  1295. Xint argc;
  1296. Xchar **argv;
  1297. X{
  1298. X#ifdef TIME
  1299. X  struct tm curtime;
  1300. X  long int curtimer;
  1301. X#endif
  1302. X  int i, j;
  1303. X  double k;
  1304. X#ifndef SWITCHES
  1305. X  char strings[MAXSWITCHES][10];
  1306. X  char *pointers[MAXSWITCHES];
  1307. X  for (i = 0; i < MAXSWITCHES; i++)
  1308. X    pointers[i] = strings[i];
  1309. X  argc = inputswitches(strings);
  1310. X  argv = pointers;
  1311. X#endif
  1312. X  argc--; argv++;
  1313. X  while (argc) {
  1314. X    if (argv[0][0] != '-') {
  1315. X      fprintf(stderr, "Option '%s' unknown.\n", argv[0]);
  1316. X      exit(1);
  1317. X    }
  1318. X    switch (argv[0][1]) {
  1319. X    case 'H':
  1320. X      displayswitches();
  1321. X      exit(0);
  1322. X    case 'O':
  1323. X      printf("Astrolog planets and objects:\n");
  1324. X      printf("No. Name    Rule Co-Rule Fall Co-Fall Exalt Debilitate\n\n");
  1325. X      for (i = 1; i <= objects; i++) {
  1326. X    printf("%2d %s", i, objectname[i]);
  1327. X    if (ruler1[i]) {
  1328. X      printtab(' ', 9-stringlen(objectname[i]));
  1329. X      j = ruler2[i];
  1330. X      printf("%c%c%c  %c%c%c     ", SIGNAM(ruler1[i]),
  1331. X         j ? signname[j][0] : ' ', j ? signname[j][1] : ' ',
  1332. X         j ? signname[j][2] : ' ');
  1333. X      printf("%c%c%c  %c%c%c     ", SIGNAM(mod12(ruler1[i]+6)),
  1334. X         j ? signname[mod12(j+6)][0] : ' ',
  1335. X         j ? signname[mod12(j+6)][1] : ' ',
  1336. X         j ? signname[mod12(j+6)][2] : ' ');
  1337. X      printf("%c%c%c   %c%c%c", SIGNAM(exalt[i]),
  1338. X         SIGNAM(mod12(exalt[i]+6)));
  1339. X    }
  1340. X    putchar('\n');
  1341. X      }
  1342. X      exit(0);
  1343. X    case 'R':
  1344. X      if (argv[0][2] == '0')
  1345. X    for (i = 1; i <= objects+4; i++)
  1346. X      ignore[i] = TRUE;
  1347. X      if (argc <= 1 || (!atoi(argv[1]))) {
  1348. X    for (i = 11; i <= 15; i++)
  1349. X      ignore[i] = 1-ignore[i];
  1350. X    ignore[17] = 1-ignore[17]; ignore[20] = 1-ignore[20];
  1351. X      } else
  1352. X    while (argc > 1 && (i = atoi(argv[1])))
  1353. X      if (i < 1 || i > objects+4) {
  1354. X        fprintf(stderr, "Bad value %d to switch -R\n", i);
  1355. X        exit(1);
  1356. X      } else {
  1357. X        ignore[i] = 1-ignore[i];
  1358. X        argc--; argv++;
  1359. X      }
  1360. X      break;
  1361. X    case 'A':
  1362. X      if (argc <= 1) {
  1363. X    printf("Astrolog aspects:\nNo. Angle    Orb       Abbrev. Name");
  1364. X    printf("          Description of glyph\n\n");
  1365. X    for (i = 1; i <= ASPECTS; i++) {
  1366. X      printf("%2d %6.2f +/- %1.0f degrees (%s) %s", i,
  1367. X         aspectangle[i], aspectorb[i], aspectabbrev[i], aspectname[i]);
  1368. X      printtab(' ', 15-stringlen(aspectname[i]));
  1369. X      printf("%s\n", aspectglyph[i]);
  1370. X    }
  1371. X    exit(0);
  1372. X      }
  1373. X      if (argv[0][2] != 'o' && argv[0][2] != 'O') {
  1374. X    aspects = atoi(argv[1]);
  1375. X    if (aspects < 0 || aspects > ASPECTS) {
  1376. X      fprintf(stderr, "Bad value %d to switch -A\n", aspects);
  1377. X      exit(1);
  1378. X    }
  1379. X    argc--; argv++;
  1380. X      } else {
  1381. X    if (argv[0][2] == 'O')
  1382. X      for (i = 1; i <= OBJECTS; i++)
  1383. X        planetorbmax[i] = DEGREES;
  1384. X    i = 1;
  1385. X    while (argc > 1 && ((k = atof(argv[1])) || argv[1][0] == '0'))
  1386. X      if (k < -180.0 || k > 180.0 || i > ASPECTS) {
  1387. X        fprintf(stderr, "Bad value %.1f to switch -Ao\n", k);
  1388. X        exit(1);
  1389. X      } else {
  1390. X        aspectorb[i++] = k;
  1391. X        argc--; argv++;
  1392. X      }
  1393. X      }
  1394. X      break;
  1395. X    case 's':
  1396. X      siderial = TRUE;
  1397. X      break;
  1398. X    case 'h':
  1399. X      heliocentric = TRUE;
  1400. X      objectname[1][0] = 'E'; objectname[1][1] = 'a'; objectname[1][2] = 'r'; 
  1401. X      objectname[1][3] = 't'; objectname[1][4] = 'h'; objectname[1][5] = 0;
  1402. X      break;
  1403. X    case 'c':
  1404. X      if (argc <= 1) {
  1405. X    fprintf(stderr, "Too few options to switch -c\n");
  1406. X    exit(1);
  1407. X      }
  1408. X      housesystem = atoi(argv[1]);
  1409. X      if (housesystem < 0 || housesystem >= SYSTEMS) {
  1410. X    fprintf(stderr, "Bad value %d to switch -c\n", housesystem);
  1411. X    exit(1);
  1412. X      }
  1413. X      argc--; argv++;
  1414. X      break;
  1415. X    case 'u':
  1416. X      uranian = TRUE;
  1417. X      for (i = 1; i <= 8; i++)
  1418. X    for (j = 0; j < 10; j++)
  1419. X      objectname[2+i][j] = uranianname[i][j];
  1420. X      break;
  1421. X    case 'x':
  1422. X      if (argc <= 1) {
  1423. X    fprintf(stderr, "Too few options to switch -x\n");
  1424. X    exit(1);
  1425. X      }
  1426. X      multiplyfactor = atoi(argv[1]);
  1427. X      if (multiplyfactor < 1 || multiplyfactor > DEGREES) {
  1428. X    fprintf(stderr, "Bad value %d to switch -x\n", multiplyfactor);
  1429. X    exit(1);
  1430. X      }
  1431. X      argc--; argv++;
  1432. X      break;
  1433. X    case '1':
  1434. X      if (argc > 1 && (onasc = atoi(argv[1]))) {
  1435. X    argc--; argv++;
  1436. X      } else
  1437. X    onasc = 1;
  1438. X      if (onasc < 1 || onasc > objects) {
  1439. X    fprintf(stderr, "Bad value %d to switch -1\n", onasc);
  1440. X    exit(1);
  1441. X      }
  1442. X      break;
  1443. X    case 'f':
  1444. X      flip = TRUE;
  1445. X      break;
  1446. X    case '3':
  1447. X      decan = TRUE;
  1448. X      break;
  1449. X    case 'p':
  1450. X#ifdef TIME
  1451. X      if (argv[0][2] == 'n') {
  1452. X    progress = TRUE;
  1453. X    curtimer = (long int) time((long int *) 0);
  1454. X    curtime = *localtime(&curtimer);
  1455. X    Mon = (double) curtime.tm_mon + 1.0;
  1456. X    Day = (double) curtime.tm_mday;
  1457. X    Yea = (double) curtime.tm_year + 1900.0;
  1458. X    Jdp = mdytojulian(Mon, Day, Yea);
  1459. X    break;
  1460. X      }
  1461. X#endif
  1462. X      if (argc <= 3) {
  1463. X    fprintf(stderr, "Too few options to switch -p\n");
  1464. X    exit(1);
  1465. X      }
  1466. X      progress = TRUE;
  1467. X      Mon = atof(argv[1]);
  1468. X      Day = atof(argv[2]);
  1469. X      Yea = atof(argv[3]);
  1470. X      if (Mon < 1.0 || Mon > 12.0 || Day < 1.0 || Day > 31.0) {
  1471. X    fprintf(stderr, "Bad date value %.0f,%.0f,%.0f to switch -p\n",
  1472. X        Mon, Day, Yea);
  1473. X    exit(1);
  1474. X      }
  1475. X      Jdp = mdytojulian(Mon, Day, Yea);
  1476. X      argc -= 3; argv += 3;
  1477. X      break;
  1478. X    case '+':
  1479. X      if (argc <= 1) {
  1480. X    fprintf(stderr, "Too few options to switch -+\n");
  1481. X    exit(1);
  1482. X      }
  1483. X      Delta = atof(argv[1]);
  1484. X      argc--; argv++;
  1485. X      break;
  1486. X    case 'w':
  1487. X      if (argv[0][2] == '0')
  1488. X    todisplay = todisplay | 2048;
  1489. X      todisplay = todisplay | 2;
  1490. X      break;
  1491. X    case 'g':
  1492. X      if (argv[0][2] == '0')
  1493. X    todisplay = todisplay | 8192;
  1494. X      todisplay = todisplay | 4;
  1495. X      break;
  1496. X    case 'Z':
  1497. X      todisplay = todisplay | 8;
  1498. X      break;
  1499. X    case 'L':
  1500. X      if (argv[0][2] == '0')
  1501. X    todisplay = todisplay | 16384;
  1502. X      todisplay = todisplay | 16;
  1503. X      break;
  1504. X    case 'd':
  1505. X      if (argv[0][2] == 'p') {
  1506. X    if (argc <= 2) {
  1507. X      fprintf(stderr, "Too few options to switch -dp\n");
  1508. X      exit(1);
  1509. X    }
  1510. X    prog = TRUE;
  1511. X    todisplay = todisplay | 256;
  1512. X    Mon2 = atof(argv[1]);
  1513. X    Yea2 = atof(argv[2]);
  1514. X    if (Mon2 < 0.0 || Mon2 > 12.0) {
  1515. X      fprintf(stderr, "Bad date value %.0f to switch -dp\n", Mon2);
  1516. X      exit(1);
  1517. X    }
  1518. X    argc -= 2; argv += 2;
  1519. X      } else if (argv[0][2] == '0')
  1520. X    todisplay = todisplay | 256;
  1521. X      todisplay = todisplay | 32;
  1522. X      break;
  1523. X    case 'e':
  1524. X      todisplay = 63 | 2048 | 8192 | 16384;
  1525. X      break;
  1526. X#ifdef TIME
  1527. X    case 'n':
  1528. X      inputdata("now");
  1529. X      break;
  1530. X#endif
  1531. X    case 'l':
  1532. X      if (argc <= 2) {
  1533. X    fprintf(stderr, "Too few options to switch -l\n");
  1534. X    exit(1);
  1535. X      }
  1536. X      deflong = atof(argv[1]);
  1537. X      deflat  = atof(argv[2]);
  1538. X      argc -= 2; argv += 2;
  1539. X      break;
  1540. X    case 'z':
  1541. X      if (argc <= 1) {
  1542. X    fprintf(stderr, "Too few options to switch -z\n");
  1543. X    exit(1);
  1544. X      }
  1545. X      defzone = atof(argv[1]);
  1546. X      if (defzone < -24.0 || defzone > 24.0) {
  1547. X    fprintf(stderr, "Bad value %.0f to switch -z\n", defzone);
  1548. X    exit(1);
  1549. X      }
  1550. X      argc--; argv++;
  1551. X      break;
  1552. X    case 'a':
  1553. X      if (argc <= 7) {
  1554. X    fprintf(stderr, "Too few options to switch -a\n");
  1555. X    exit(1);
  1556. X      }
  1557. X      autom = TRUE;
  1558. X      M = atof(argv[1]); D = atof(argv[2]); Y = atof(argv[3]);
  1559. X      F = atof(argv[4]); X = atof(argv[5]);
  1560. X      L5 = atof(argv[6]); LA = atof(argv[7]);
  1561. X      argc -= 7; argv += 7;
  1562. X      break;
  1563. X    case 'q':
  1564. X      i = (argv[0][2] == '0');
  1565. X      if (argc <= 3+i) {
  1566. X    fprintf(stderr, "Too few options to switch -q\n");
  1567. X    exit(1);
  1568. X      }
  1569. X      autom = TRUE;
  1570. X      M = atof(argv[1]); D = atof(argv[2]); Y = atof(argv[3]);
  1571. X      F = i ? atof(argv[4]) : 12.0; X = defzone; L5 = deflong; LA = deflat;
  1572. X      argc -= 3+i; argv += 3+i;
  1573. X      break;
  1574. X    case 'i':
  1575. X      if (argc <= 1) {
  1576. X    fprintf(stderr, "Too few options to switch -i\n");
  1577. X    exit(1);
  1578. X      }
  1579. X      inputdata(argv[1]);
  1580. X      argc--; argv++;
  1581. X      break;
  1582. X    case 'o':
  1583. X      if (argv[0][2] == '0')
  1584. X    todisplay = todisplay | 4096;
  1585. X      if (argc <= 1) {
  1586. X    fprintf(stderr, "Too few options to switch -o\n");
  1587. X    exit(1);
  1588. X      }
  1589. X      operation = operation | 1;
  1590. X      filenameout = argv[1];
  1591. X      extralines = argv;
  1592. X      do {
  1593. X    argc--; argv++;
  1594. X    extracount++;
  1595. X      } while (argc > 1 && argv[1][0] != '-');
  1596. X      break;
  1597. X    case 'r':
  1598. X      if (argc <= 2) {
  1599. X    fprintf(stderr, "Too few options to switch -r\n");
  1600. X    exit(1);
  1601. X      }
  1602. X      if (argv[0][2] == 'c')
  1603. X    relation = 2;
  1604. X      else
  1605. X    relation = 1;
  1606. X      filename = argv[1]; filename2 = argv[2];
  1607. X      argc -= 2; argv += 2;
  1608. X      break;
  1609. X#ifdef TIME
  1610. X    case 't':
  1611. X      if (argc <= 1) {
  1612. X    fprintf(stderr, "Too few options to switch -t\n");
  1613. X    exit(1);
  1614. X      }
  1615. X      relation = 1;
  1616. X      filename = argv[1]; filename2 = "now";
  1617. X      argc--; argv++;
  1618. X      break;
  1619. X#endif
  1620. X    case 'T':
  1621. X      if (argc <= 3) {
  1622. X    fprintf(stderr, "Too few options to switch -T\n");
  1623. X    exit(1);
  1624. X      }
  1625. X      if (argv[0][2] == 'p') {
  1626. X    prog = TRUE;
  1627. X    todisplay = todisplay | 512;
  1628. X      } else if (argv[0][2] == '0')
  1629. X    todisplay = todisplay | 512;
  1630. X      operation = 2;
  1631. X      filename = argv[1];
  1632. X      Mon2 = atof(argv[2]);
  1633. X      Yea2 = atof(argv[3]);
  1634. X      if (Mon2 < 0.0 || Mon2 > 12.0) {
  1635. X    fprintf(stderr, "Bad date value %.0f to switch -T\n", Mon2);
  1636. X    exit(1);
  1637. X      }
  1638. X      argc -= 3; argv += 3;
  1639. X      break;
  1640. X    case 'E':
  1641. X      if (argc <= 2) {
  1642. X    fprintf(stderr, "Too few options to switch -E\n");
  1643. X    exit(1);
  1644. X      }
  1645. X      if (argv[0][2] == '0')
  1646. X    todisplay = todisplay | 1024;
  1647. X      operation = 4;
  1648. X      Mon2 = atof(argv[1]);
  1649. X      Yea2 = atof(argv[2]);
  1650. X      if (Mon2 < 0.0 || Mon2 > 12.0) {
  1651. X    fprintf(stderr, "Bad date value %.0f to switch -E\n", Mon2);
  1652. X    exit(1);
  1653. X      }
  1654. X      argc -= 2; argv += 2;
  1655. X      break;
  1656. X#ifdef X11
  1657. X    case 'X':
  1658. X      i = processx(argc, argv);
  1659. X      operation = 8;
  1660. X      argc -= i; argv += i;
  1661. X      break;
  1662. X#endif
  1663. X    default:
  1664. X      fprintf(stderr, "Unknown switch -%c\n", argv[0][1]);
  1665. X      exit(1);
  1666. X    }
  1667. X    argc--; argv++;
  1668. X  }
  1669. X  action();
  1670. X}
  1671. X
  1672. X/**/
  1673. END_OF_FILE
  1674. if test 16426 -ne `wc -c <'driver.c'`; then
  1675.     echo shar: \"'driver.c'\" unpacked with wrong size!
  1676. fi
  1677. # end of 'driver.c'
  1678. fi
  1679. echo shar: End of archive 5 \(of 6\).
  1680. cp /dev/null ark5isdone
  1681. MISSING=""
  1682. for I in 1 2 3 4 5 6 ; do
  1683.     if test ! -f ark${I}isdone ; then
  1684.     MISSING="${MISSING} ${I}"
  1685.     fi
  1686. done
  1687. if test "${MISSING}" = "" ; then
  1688.     echo You have unpacked all 6 archives.
  1689.     rm -f ark[1-9]isdone
  1690. else
  1691.     echo You still need to unpack the following archives:
  1692.     echo "        " ${MISSING}
  1693. fi
  1694. ##  End of shell archive.
  1695. exit 0
  1696.  
  1697. exit 0 # Just in case...
  1698.