home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume28 / ephem / part06 < prev    next >
Text File  |  1992-03-15  |  55KB  |  1,599 lines

  1. Newsgroups: comp.sources.misc
  2. From: e_downey@hwking.cca.cr.rockwell.com (Elwood C. Downey)
  3. Subject:  v28i089:  ephem - an interactive astronomical ephemeris, v4.28, Part06/09
  4. Message-ID: <1992Mar10.215855.16195@sparky.imd.sterling.com>
  5. X-Md4-Signature: fd5703f5cc181a936bc82cddd987c96f
  6. Date: Tue, 10 Mar 1992 21:58:55 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: e_downey@hwking.cca.cr.rockwell.com (Elwood C. Downey)
  10. Posting-number: Volume 28, Issue 89
  11. Archive-name: ephem/part06
  12. Environment: UNIX, VMS, DOS, MAC
  13. Supersedes: ephem-4.21: Volume 14, Issue 76-81
  14.  
  15. #! /bin/sh
  16. # into a shell via "sh file" or similar.  To overwrite existing files,
  17. # type "sh file -c".
  18. # The tool that generated this appeared in the comp.sources.unix newsgroup;
  19. # send mail to comp-sources-unix@uunet.uu.net if you want that tool.
  20. # Contents:  circum.c compiler.c ephem.db version.c
  21. # Wrapped by kent@sparky on Tue Mar 10 14:34:08 1992
  22. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  23. echo If this archive is complete, you will see the following message:
  24. echo '          "shar: End of archive 6 (of 9)."'
  25. if test -f 'circum.c' -a "${1}" != "-c" ; then 
  26.   echo shar: Will not clobber existing file \"'circum.c'\"
  27. else
  28.   echo shar: Extracting \"'circum.c'\" \(10633 characters\)
  29.   sed "s/^X//" >'circum.c' <<'END_OF_FILE'
  30. X/* fill in a Sky struct with all we know about each object.
  31. X *(the user defined objects are in obj.c)
  32. X */
  33. X
  34. X#include <stdio.h>
  35. X#include <math.h>
  36. X#include "astro.h"
  37. X#include "circum.h"
  38. X#include "screen.h"    /* just for SUN and MOON */
  39. X
  40. X/* find body p's circumstances now.
  41. X * to save some time the caller may specify a desired accuracy, in arc seconds.
  42. X * if, based on its mean motion, it would not have moved this much since the
  43. X * last time we were called we only recompute altitude and azimuth and avoid
  44. X * recomputing the planet's heliocentric position. use 0.0 for best possible.
  45. X * we always recompute the user-defined objects' position regardless.
  46. X * return 0 if only alt/az changes, else 1 if all other stuff updated too.
  47. X * N.B: values are for opposition, ie, at fastest retrograde.
  48. X */
  49. Xbody_cir (p, as, np, sp)
  50. Xint p;
  51. Xdouble as;
  52. XNow *np;
  53. XSky *sp;
  54. X{
  55. X    typedef struct {
  56. X        double l_dpas;    /* mean days per arc second */
  57. X        Now l_now;        /* when l_sky was found */
  58. X        double l_ra, l_dec;    /* the eod, ie, unprecessed, ra/dec values */
  59. X        Sky l_sky;
  60. X    } Last;
  61. X    /* must be in same order as the astro.h object #define's */
  62. X    static Last last[8] = {
  63. X        {.000068, {NOMJD}},    /* mercury */
  64. X        {.00017, {NOMJD}},    /* venus */
  65. X        {.00015, {NOMJD}},    /* mars */
  66. X        {.0012, {NOMJD}},    /* jupiter */
  67. X        {.0024, {NOMJD}},    /* saturn */
  68. X        {.0051, {NOMJD}},    /* uranus */
  69. X        {.0081, {NOMJD}},    /* neptune */
  70. X        {.011, {NOMJD}}    /* pluto */
  71. X    };
  72. X    Last objxlast, objylast;
  73. X    double lst, alt, az;
  74. X    double ehp, ha, dec;    /* ehp: angular dia of earth from body */
  75. X    Last *lp;
  76. X    int new;
  77. X
  78. X    switch (p) {
  79. X    case SUN: return (sun_cir (as, np, sp));
  80. X    case MOON: return (moon_cir (as, np, sp));
  81. X    case OBJX: lp = &objxlast; break;
  82. X    case OBJY: lp = &objylast; break;
  83. X    default: lp = last + p; break;
  84. X    }
  85. X
  86. X    /* if less than l_every days from last time for this planet
  87. X     * just redo alt/az.
  88. X     * ALWAYS redo objects x and y.
  89. X     */
  90. X    if (p != OBJX && p != OBJY && same_cir (np, &lp->l_now)
  91. X              && about_now (np, &lp->l_now, as*lp->l_dpas)) {
  92. X        *sp = lp->l_sky;
  93. X        new = 0;
  94. X    } else {
  95. X        double lpd0, psi0;    /* heliocentric ecliptic long and lat */
  96. X        double rp0;        /* dist from sun */
  97. X        double rho0;    /* dist from earth */
  98. X        double lam, bet;    /* geocentric ecliptic long and lat */
  99. X        double dia, mag;    /* angular diameter at 1 AU and magnitude */
  100. X        double lsn, rsn;    /* true geoc lng of sun, dist from sn to earth*/
  101. X        double el;    /* elongation */
  102. X        double f;   /* phase from earth */
  103. X
  104. X        lp->l_now = *np;
  105. X        sunpos (mjd, &lsn, &rsn);
  106. X        if (p == OBJX || p == OBJY)
  107. X        obj_cir(mjd, p, &lpd0, &psi0, &rp0, &rho0, &lam, &bet,
  108. X                        &sp->s_size, &sp->s_mag);
  109. X        else {
  110. X        double deps, dpsi;
  111. X        double a;
  112. X        plans(mjd, p, &lpd0, &psi0, &rp0, &rho0, &lam, &bet, &dia,&mag);
  113. X        nutation (mjd, &deps, &dpsi);    /* correct for nutation */
  114. X        lam += dpsi;
  115. X        a = lsn-lam;            /* and 20.4" aberation */
  116. X        lam -= degrad(20.4/3600)*cos(a)/cos(bet);
  117. X        bet -= degrad(20.4/3600)*sin(a)*sin(bet);
  118. X        }
  119. X
  120. X        ecl_eq (mjd, bet, lam, &lp->l_ra, &lp->l_dec);
  121. X
  122. X        sp->s_ra = lp->l_ra;
  123. X        sp->s_dec = lp->l_dec;
  124. X        if (epoch != EOD)
  125. X        precess (mjd, epoch, &sp->s_ra, &sp->s_dec);
  126. X        sp->s_edist = rho0;
  127. X        sp->s_sdist = rp0;
  128. X        elongation (lam, bet, lsn, &el);
  129. X        el = raddeg(el);
  130. X        sp->s_elong = el;
  131. X        f = (rp0 > 0.0)
  132. X        ? 0.25 * (((rp0+rho0)*(rp0+rho0) - rsn*rsn)/(rp0*rho0)) : 0.0;
  133. X        sp->s_phase = f*100.0; /* percent */
  134. X        if (p != OBJX && p != OBJY) {
  135. X        sp->s_size = dia/rho0;
  136. X        sp->s_mag = mag + 5.0*log(rp0*rho0/sqrt(f))/log(10.0);
  137. X        }
  138. X        sp->s_hlong = lpd0;
  139. X        sp->s_hlat = psi0;
  140. X        new = 1;
  141. X    }
  142. X
  143. X    /* alt, az; correct for parallax and refraction; use eod ra/dec */
  144. X    now_lst (np, &lst);
  145. X    ha = hrrad(lst) - lp->l_ra;
  146. X    if (sp->s_edist > 0.0) {
  147. X        ehp = (2.0*6378.0/146.0e6) / sp->s_edist;
  148. X        ta_par (ha, lp->l_dec, lat, height, ehp, &ha, &dec);
  149. X    } else
  150. X        dec = lp->l_dec;
  151. X    hadec_aa (lat, ha, dec, &alt, &az);
  152. X    refract (pressure, temp, alt, &alt);
  153. X    sp->s_alt = alt;
  154. X    sp->s_az = az;
  155. X    lp->l_sky = *sp;
  156. X    return (new);
  157. X}
  158. X
  159. X/* find local times when sun is 18 degrees below horizon.
  160. X * return 0 if just returned same stuff as previous call, else 1 if new.
  161. X */
  162. Xtwilight_cir (np, dawn, dusk, status)
  163. XNow *np;
  164. Xdouble *dawn, *dusk;
  165. Xint *status;
  166. X{
  167. X    static Now last_now = {NOMJD};
  168. X    static double last_dawn, last_dusk;
  169. X    static int last_status;
  170. X    int new;
  171. X
  172. X    if (same_cir (np, &last_now) && same_lday (np, &last_now)) {
  173. X        *dawn = last_dawn;
  174. X        *dusk = last_dusk;
  175. X        *status = last_status;
  176. X        new = 0;
  177. X    } else {
  178. X        double x;
  179. X        (void) riset_cir (SUN,np,0,TWILIGHT,dawn,dusk,&x,&x,&x,&x,status);
  180. X        last_dawn = *dawn;
  181. X        last_dusk = *dusk;
  182. X        last_status = *status;
  183. X        last_now = *np;
  184. X        new = 1;
  185. X    }
  186. X    return (new);
  187. X}
  188. X
  189. X/* find sun's circumstances now.
  190. X * as is the desired accuracy, in arc seconds; use 0.0 for best possible.
  191. X * return 0 if only alt/az changes, else 1 if all other stuff updated too.
  192. X */
  193. Xsun_cir (as, np, sp)
  194. Xdouble as;
  195. XNow *np;
  196. XSky *sp;
  197. X{
  198. X    static Sky last_sky;
  199. X    static Now last_now = {NOMJD};
  200. X    static double last_ra, last_dec;    /* unprecessed ra/dec */
  201. X    double lst, alt, az;
  202. X    double ehp, ha, dec;    /* ehp: angular dia of earth from body */
  203. X    int new;
  204. X
  205. X    if (same_cir (np, &last_now) && about_now (np, &last_now, as*.00028)) {
  206. X        *sp = last_sky;
  207. X        new = 0;
  208. X    } else {
  209. X        double lsn, rsn;
  210. X        double deps, dpsi;
  211. X
  212. X        last_now = *np;
  213. X        sunpos (mjd, &lsn, &rsn);        /* sun's true ecliptic long
  214. X                         * and dist
  215. X                         */
  216. X        nutation (mjd, &deps, &dpsi);    /* correct for nutation */
  217. X        lsn += dpsi;
  218. X        lsn -= degrad(20.4/3600);        /* and light travel time */
  219. X
  220. X        sp->s_edist = rsn;
  221. X        sp->s_sdist = 0.0;
  222. X        sp->s_elong = 0.0;
  223. X        sp->s_size = raddeg(4.65242e-3/rsn)*3600*2;
  224. X        sp->s_mag = -26.8;
  225. X        sp->s_hlong = lsn-PI;    /* geo- to helio- centric */
  226. X        range (&sp->s_hlong, 2*PI);
  227. X        sp->s_hlat = 0.0;
  228. X
  229. X        ecl_eq (mjd, 0.0, lsn, &last_ra, &last_dec);
  230. X        sp->s_ra = last_ra;
  231. X        sp->s_dec = last_dec;
  232. X        if (epoch != EOD)
  233. X        precess (mjd, epoch, &sp->s_ra, &sp->s_dec);
  234. X        new = 1;
  235. X    }
  236. X
  237. X    now_lst (np, &lst);
  238. X    ha = hrrad(lst) - last_ra;
  239. X    ehp = (2.0 * 6378.0 / 146.0e6) / sp->s_edist;
  240. X    ta_par (ha, last_dec, lat, height, ehp, &ha, &dec);
  241. X    hadec_aa (lat, ha, dec, &alt, &az);
  242. X    refract (pressure, temp, alt, &alt);
  243. X    sp->s_alt = alt;
  244. X    sp->s_az = az;
  245. X    last_sky = *sp;
  246. X    return (new);
  247. X}
  248. X
  249. X/* find moon's circumstances now.
  250. X * as is the desired accuracy, in arc seconds; use 0.0 for best possible.
  251. X * return 0 if only alt/az changes, else 1 if all other stuff updated too.
  252. X */
  253. Xmoon_cir (as, np, sp)
  254. Xdouble as;
  255. XNow *np;
  256. XSky *sp;
  257. X{
  258. X    static Sky last_sky;
  259. X    static Now last_now = {NOMJD};
  260. X    static double ehp;
  261. X    static double last_ra, last_dec;    /* unprecessed */
  262. X    double lst, alt, az;
  263. X    double ha, dec;
  264. X    int new;
  265. X
  266. X    if (same_cir (np, &last_now) && about_now (np, &last_now, as*.000021)) {
  267. X        *sp = last_sky;
  268. X        new = 0;
  269. X    } else {
  270. X        double lam, bet;
  271. X        double deps, dpsi;
  272. X        double lsn, rsn;    /* sun long in rads, earth-sun dist in au */
  273. X        double edistau;    /* earth-moon dist, in au */
  274. X        double el;        /* elongation, rads east */
  275. X
  276. X        last_now = *np;
  277. X        moon (mjd, &lam, &bet, &ehp);    /* moon's true ecliptic loc */
  278. X        nutation (mjd, &deps, &dpsi);    /* correct for nutation */
  279. X        lam += dpsi;
  280. X        range (&lam, 2*PI);
  281. X
  282. X        sp->s_edist = 6378.14/sin(ehp);    /* earth-moon dist, want km */
  283. X        sp->s_size = 3600*31.22512*sin(ehp);/* moon angular dia, seconds */
  284. X        sp->s_hlong = lam;            /* save geo in helio fields */
  285. X        sp->s_hlat = bet;
  286. X
  287. X        ecl_eq (mjd, bet, lam, &last_ra, &last_dec);
  288. X        sp->s_ra = last_ra;
  289. X        sp->s_dec = last_dec;
  290. X        if (epoch != EOD)
  291. X        precess (mjd, epoch, &sp->s_ra, &sp->s_dec);
  292. X
  293. X        sunpos (mjd, &lsn, &rsn);
  294. X        range (&lsn, 2*PI);
  295. X        elongation (lam, bet, lsn, &el);
  296. X
  297. X        /* solve triangle of earth, sun, and elongation for moon-sun dist */
  298. X        edistau = sp->s_edist/1.495979e8; /* km -> au */
  299. X        sp->s_sdist =
  300. X        sqrt (edistau*edistau + rsn*rsn - 2.0*edistau*rsn*cos(el));
  301. X
  302. X        /* TODO: improve mag; this is based on a flat moon model. */
  303. X        sp->s_mag = -12.7 + 2.5*(log10(PI) - log10(PI/2*(1+1.e-6-cos(el))));
  304. X
  305. X        sp->s_elong = raddeg(el);    /* want degrees */
  306. X        sp->s_phase = fabs(el)/PI*100.0;    /* want non-negative % */
  307. X        new = 1;
  308. X    }
  309. X
  310. X    /* show topocentric alt/az by correcting ra/dec for parallax 
  311. X     * as well as refraction.
  312. X     */
  313. X    now_lst (np, &lst);
  314. X    ha = hrrad(lst) - last_ra;
  315. X    ta_par (ha, last_dec, lat, height, ehp, &ha, &dec);
  316. X    hadec_aa (lat, ha, dec, &alt, &az);
  317. X    refract (pressure, temp, alt, &alt);
  318. X    sp->s_alt = alt;
  319. X    sp->s_az = az;
  320. X    last_sky = *sp;
  321. X    return (new);
  322. X}
  323. X
  324. X/* given geocentric ecliptic longitude and latitude, lam and bet, of some object
  325. X * and the longitude of the sun, lsn, find the elongation, el. this is the
  326. X * actual angular separation of the object from the sun, not just the difference
  327. X * in the longitude. the sign, however, IS set simply as a test on longitude
  328. X * such that el will be >0 for an evening object <0 for a morning object.
  329. X * to understand the test for el sign, draw a graph with lam going from 0-2*PI
  330. X *   down the vertical axis, lsn going from 0-2*PI across the hor axis. then
  331. X *   define the diagonal regions bounded by the lines lam=lsn+PI, lam=lsn and
  332. X *   lam=lsn-PI. the "morning" regions are any values to the lower left of the
  333. X *   first line and bounded within the second pair of lines.
  334. X * all angles in radians.
  335. X */
  336. Xelongation (lam, bet, lsn, el)
  337. Xdouble lam, bet, lsn;
  338. Xdouble *el;
  339. X{
  340. X    *el = acos(cos(bet)*cos(lam-lsn));
  341. X    if (lam>lsn+PI || lam>lsn-PI && lam<lsn) *el = - *el;
  342. X}
  343. X
  344. X/* return whether the two Nows are for the same observing circumstances. */
  345. Xsame_cir (n1, n2)
  346. Xregister Now *n1, *n2;
  347. X{
  348. X    return (n1->n_lat == n2->n_lat
  349. X        && n1->n_lng == n2->n_lng
  350. X        && n1->n_temp == n2->n_temp
  351. X        && n1->n_pressure == n2->n_pressure
  352. X        && n1->n_height == n2->n_height
  353. X        && n1->n_tz == n2->n_tz
  354. X        && n1->n_epoch == n2->n_epoch);
  355. X}
  356. X
  357. X/* return whether the two Nows are for the same LOCAL day */
  358. Xsame_lday (n1, n2)
  359. XNow *n1, *n2;
  360. X{
  361. X    return (mjd_day(n1->n_mjd - n1->n_tz/24.0) ==
  362. X               mjd_day(n2->n_mjd - n2->n_tz/24.0)); 
  363. X}
  364. X
  365. X/* return whether the mjd of the two Nows are within dt */
  366. Xstatic
  367. Xabout_now (n1, n2, dt)
  368. XNow *n1, *n2;
  369. Xdouble dt;
  370. X{
  371. X    return (fabs (n1->n_mjd - n2->n_mjd) <= dt/2.0);
  372. X}
  373. X
  374. Xnow_lst (np, lst)
  375. XNow *np;
  376. Xdouble *lst;
  377. X{
  378. X    utc_gst (mjd_day(mjd), mjd_hr(mjd), lst);
  379. X    *lst += radhr(lng);
  380. X    range (lst, 24.0);
  381. X}
  382. X
  383. X/* round a time in days, *t, to the nearest second, IN PLACE. */
  384. Xrnd_second (t)
  385. Xdouble *t;
  386. X{
  387. X    *t = floor(*t*SPD+0.5)/SPD;
  388. X}
  389. X    
  390. Xdouble
  391. Xmjd_day(jd)
  392. Xdouble jd;
  393. X{
  394. X    return (floor(jd-0.5)+0.5);
  395. X}
  396. X
  397. Xdouble
  398. Xmjd_hr(jd)
  399. Xdouble jd;
  400. X{
  401. X    return ((jd-mjd_day(jd))*24.0);
  402. X}
  403. END_OF_FILE
  404.   if test 10633 -ne `wc -c <'circum.c'`; then
  405.     echo shar: \"'circum.c'\" unpacked with wrong size!
  406.   fi
  407.   # end of 'circum.c'
  408. fi
  409. if test -f 'compiler.c' -a "${1}" != "-c" ; then 
  410.   echo shar: Will not clobber existing file \"'compiler.c'\"
  411. else
  412.   echo shar: Extracting \"'compiler.c'\" \(15828 characters\)
  413.   sed "s/^X//" >'compiler.c' <<'END_OF_FILE'
  414. X/* module to compile and execute a c-style arithmetic expression.
  415. X * public entry points are compile_expr() and execute_expr().
  416. X *
  417. X * one reason this is so nice and tight is that all opcodes are the same size
  418. X * (an int) and the tokens the parser returns are directly usable as opcodes,
  419. X * for the most part. constants and variables are compiled as an opcode
  420. X * with an offset into the auxiliary opcode tape, opx.
  421. X */
  422. X
  423. X#include <math.h>
  424. X#include <ctype.h>
  425. X#ifdef VMS
  426. X#include <stdlib.h>
  427. X#endif
  428. X#include "screen.h"
  429. X
  430. X/* parser tokens and opcodes, as necessary */
  431. X#define    HALT    0    /* good value for HALT since program is inited to 0 */
  432. X/* binary operators (precedences in table, below) */
  433. X#define    ADD    1
  434. X#define    SUB    2
  435. X#define    MULT    3
  436. X#define    DIV    4
  437. X#define    AND    5
  438. X#define    OR    6
  439. X#define    GT    7
  440. X#define    GE    8
  441. X#define    EQ    9
  442. X#define    NE    10
  443. X#define    LT    11
  444. X#define    LE    12
  445. X/* unary op, precedence in NEG_PREC #define, below */
  446. X#define    NEG    13
  447. X/* symantically operands, ie, constants, variables and all functions */
  448. X#define    CONST    14    
  449. X#define    VAR    15
  450. X#define    ABS    16    /* add functions if desired just like this is done */
  451. X#define    SQRT    17    /* add functions if desired just like this is done */
  452. X/* purely tokens - never get compiled as such */
  453. X#define    LPAREN    255
  454. X#define    RPAREN    254
  455. X#define    ERR    (-1)
  456. X
  457. X/* precedence of each of the binary operators.
  458. X * in case of a tie, compiler associates left-to-right.
  459. X * N.B. each entry's index must correspond to its #define!
  460. X */
  461. Xstatic int precedence[] = {0,5,5,6,6,2,1,4,4,3,3,4,4};
  462. X#define    NEG_PREC    7    /* negation is highest */
  463. X
  464. X/* execute-time operand stack */
  465. X#define    MAX_STACK    16
  466. Xstatic double stack[MAX_STACK], *sp;
  467. X
  468. X/* space for compiled opcodes - the "program".
  469. X * opcodes go in lower 8 bits.
  470. X * when an opcode has an operand (as CONST and VAR) it is really in opx[] and
  471. X *   the index is in the remaining upper bits.
  472. X */
  473. X#define    MAX_PROG 32
  474. Xstatic int program[MAX_PROG], *pc;
  475. X#define    OP_SHIFT    8
  476. X#define    OP_MASK        0xff
  477. X
  478. X/* auxiliary operand info.
  479. X * the operands (all but lower 8 bits) of CONST and VAR are really indeces
  480. X * into this array. thus, no point in making this any longer than you have
  481. X * bits more than 8 in your machine's int to index into it, ie, make
  482. X *    MAX_OPX <= 1 << ((sizeof(int)-1)*8)
  483. X * also, the fld's must refer to ones being flog'd, so not point in more
  484. X * of these then that might be used for plotting and srching combined.
  485. X */
  486. X#define    MAX_OPX    16
  487. Xtypedef union {
  488. X    double opu_f;        /* value when opcode is CONST */
  489. X    int opu_fld;        /* rcfpack() of field when opcode is VAR */
  490. X} OpX;
  491. Xstatic OpX opx[MAX_OPX];
  492. Xstatic int opxidx;
  493. X
  494. X/* these are global just for easy/rapid access */
  495. Xstatic int parens_nest;    /* to check that parens end up nested */
  496. Xstatic char *err_msg;    /* caller provides storage; we point at it with this */
  497. Xstatic char *cexpr, *lcexpr; /* pointers that move along caller's expression */
  498. Xstatic int good_prog;    /* != 0 when program appears to be good */
  499. X
  500. X/* compile the given c-style expression.
  501. X * return 0 and set good_prog if ok,
  502. X * else return -1 and a reason message in errbuf.
  503. X */
  504. Xcompile_expr (ex, errbuf)
  505. Xchar *ex;
  506. Xchar *errbuf;
  507. X{
  508. X    int instr;
  509. X
  510. X    /* init the globals.
  511. X     * also delete any flogs used in the previous program.
  512. X     */
  513. X    cexpr = ex;
  514. X    err_msg = errbuf;
  515. X    pc = program;
  516. X    opxidx = 0;
  517. X    parens_nest = 0;
  518. X    do {
  519. X        instr = *pc++;
  520. X        if ((instr & OP_MASK) == VAR)
  521. X        flog_delete (opx[instr >> OP_SHIFT].opu_fld);
  522. X    } while (instr != HALT);
  523. X
  524. X    pc = program;
  525. X    if (compile(0) == ERR) {
  526. X        (void) sprintf (err_msg + strlen(err_msg), " at \"%.10s\"", lcexpr);
  527. X        good_prog = 0;
  528. X        return (-1);
  529. X    }
  530. X    *pc++ = HALT;
  531. X    good_prog = 1;
  532. X    return (0);
  533. X}
  534. X
  535. X/* execute the expression previously compiled with compile_expr().
  536. X * return 0 with *vp set to the answer if ok, else return -1 with a reason
  537. X * why not message in errbuf.
  538. X */
  539. Xexecute_expr (vp, errbuf)
  540. Xdouble *vp;
  541. Xchar *errbuf;
  542. X{
  543. X    int s;
  544. X
  545. X    err_msg = errbuf;
  546. X    sp = stack + MAX_STACK;    /* grows towards lower addresses */
  547. X    pc = program;
  548. X    s = execute(vp);
  549. X    if (s < 0)
  550. X        good_prog = 0;
  551. X    return (s);
  552. X}
  553. X
  554. X/* this is a way for the outside world to ask whether there is currently a
  555. X * reasonable program compiled and able to execute.
  556. X */
  557. Xprog_isgood()
  558. X{
  559. X    return (good_prog);
  560. X}
  561. X
  562. X/* get and return the opcode corresponding to the next token.
  563. X * leave with lcexpr pointing at the new token, cexpr just after it.
  564. X * also watch for mismatches parens and proper operator/operand alternation.
  565. X */
  566. Xstatic
  567. Xnext_token ()
  568. X{
  569. X    static char toomt[] = "More than %d terms";
  570. X    static char badop[] = "Illegal operator";
  571. X    int tok = ERR;    /* just something illegal */
  572. X    char c;
  573. X
  574. X    while ((c = *cexpr) == ' ')
  575. X        cexpr++;
  576. X    lcexpr = cexpr++;
  577. X
  578. X    /* mainly check for a binary operator */
  579. X    switch (c) {
  580. X    case '\0': --cexpr; tok = HALT; break; /* keep returning HALT */
  581. X    case '+': tok = ADD; break; /* compiler knows when it's really unary */
  582. X    case '-': tok = SUB; break; /* compiler knows when it's really negate */
  583. X    case '*': tok = MULT; break;
  584. X    case '/': tok = DIV; break;
  585. X    case '(': parens_nest++; tok = LPAREN; break;
  586. X    case ')':
  587. X        if (--parens_nest < 0) {
  588. X            (void) sprintf (err_msg, "Too many right parens");
  589. X        return (ERR);
  590. X        } else
  591. X        tok = RPAREN;
  592. X        break;
  593. X    case '|':
  594. X        if (*cexpr == '|') { cexpr++; tok = OR; }
  595. X        else { (void) sprintf (err_msg, badop); return (ERR); }
  596. X        break;
  597. X    case '&':
  598. X        if (*cexpr == '&') { cexpr++; tok = AND; }
  599. X        else { (void) sprintf (err_msg, badop); return (ERR); }
  600. X        break;
  601. X    case '=':
  602. X        if (*cexpr == '=') { cexpr++; tok = EQ; }
  603. X        else { (void) sprintf (err_msg, badop); return (ERR); }
  604. X        break;
  605. X    case '!':
  606. X        if (*cexpr == '=') { cexpr++; tok = NE; }
  607. X        else { (void) sprintf (err_msg, badop); return (ERR); }
  608. X        break;
  609. X    case '<':
  610. X        if (*cexpr == '=') { cexpr++; tok = LE; }
  611. X        else tok = LT;
  612. X        break;
  613. X    case '>':
  614. X        if (*cexpr == '=') { cexpr++; tok = GE; }
  615. X        else tok = GT;
  616. X        break;
  617. X    }
  618. X
  619. X    if (tok != ERR)
  620. X        return (tok);
  621. X
  622. X    /* not op so check for a constant, variable or function */
  623. X    if (isdigit(c) || c == '.') {
  624. X        if (opxidx > MAX_OPX) {
  625. X        (void) sprintf (err_msg, toomt, MAX_OPX);
  626. X        return (ERR);
  627. X        }
  628. X        opx[opxidx].opu_f = atof (lcexpr);
  629. X        tok = CONST | (opxidx++ << OP_SHIFT);
  630. X        skip_double();
  631. X    } else if (isalpha(c)) {
  632. X        /* check list of functions */
  633. X        if (strncmp (lcexpr, "abs", 3) == 0) {
  634. X        cexpr += 2;
  635. X        tok = ABS;
  636. X        } else if (strncmp (lcexpr, "sqrt", 4) == 0) {
  637. X        cexpr += 3;
  638. X        tok = SQRT;
  639. X        } else {
  640. X        /* not a function, so assume it's a variable */
  641. X        int fld;
  642. X        if (opxidx > MAX_OPX) {
  643. X            (void) sprintf (err_msg, toomt, MAX_OPX);
  644. X            return (ERR);
  645. X        }
  646. X        fld = parse_fieldname ();
  647. X        if (fld < 0) {
  648. X            (void) sprintf (err_msg, "Unknown field");
  649. X            return (ERR);
  650. X        } else {
  651. X            if (flog_add (fld) < 0) { /* register with field logger */
  652. X            (void) sprintf (err_msg, "Sorry; too many fields");
  653. X            return (ERR);
  654. X            }
  655. X            opx[opxidx].opu_fld = fld;
  656. X            tok = VAR | (opxidx++ << OP_SHIFT);
  657. X        }
  658. X        }
  659. X    }
  660. X
  661. X    return (tok);
  662. X}
  663. X
  664. X/* move cexpr on past a double.
  665. X * allow sci notation.
  666. X * no need to worry about a leading '-' or '+' but allow them after an 'e'.
  667. X * TODO: this handles all the desired cases, but also admits a bit too much
  668. X *   such as things like 1eee2...3. geeze; to skip a double right you almost
  669. X *   have to go ahead and crack it!
  670. X */
  671. Xstatic
  672. Xskip_double()
  673. X{
  674. X    int sawe = 0;    /* so we can allow '-' or '+' right after an 'e' */
  675. X
  676. X    while (1) {
  677. X        char c = *cexpr;
  678. X        if (isdigit(c) || c=='.' || (sawe && (c=='-' || c=='+'))) {
  679. X        sawe = 0;
  680. X        cexpr++;
  681. X        } else if (c == 'e') {
  682. X        sawe = 1;
  683. X        cexpr++;
  684. X        } else
  685. X        break;
  686. X    }
  687. X}
  688. X
  689. X/* call this whenever you want to dig out the next (sub)expression.
  690. X * keep compiling instructions as long as the operators are higher precedence
  691. X * than prec, then return that "look-ahead" token that wasn't (higher prec).
  692. X * if error, fill in a message in err_msg[] and return ERR.
  693. X */
  694. Xstatic
  695. Xcompile (prec)
  696. Xint prec;
  697. X{
  698. X    int expect_binop = 0;    /* set after we have seen any operand.
  699. X                 * used by SUB so it can tell if it really 
  700. X                 * should be taken to be a NEG instead.
  701. X                 */
  702. X    int tok = next_token ();
  703. X
  704. X        while (1) {
  705. X        int p;
  706. X        if (tok == ERR)
  707. X        return (ERR);
  708. X        if (pc - program >= MAX_PROG) {
  709. X        (void) sprintf (err_msg, "Program is too long");
  710. X        return (ERR);
  711. X        }
  712. X
  713. X        /* check for special things like functions, constants and parens */
  714. X            switch (tok & OP_MASK) {
  715. X            case HALT: return (tok);
  716. X        case ADD:
  717. X        if (expect_binop)
  718. X            break;    /* procede with binary addition */
  719. X        /* just skip a unary positive(?) */
  720. X        tok = next_token();
  721. X        continue;
  722. X        case SUB:
  723. X        if (expect_binop)
  724. X            break;    /* procede with binary subtract */
  725. X        tok = compile (NEG_PREC);
  726. X        *pc++ = NEG;
  727. X        expect_binop = 1;
  728. X        continue;
  729. X            case ABS: /* other funcs would be handled the same too ... */
  730. X        case SQRT:
  731. X        /* eat up the function parenthesized argument */
  732. X        if (next_token() != LPAREN || compile (0) != RPAREN) {
  733. X            (void) sprintf (err_msg, "Function arglist error");
  734. X            return (ERR);
  735. X        }
  736. X        /* then handled same as ... */
  737. X            case CONST: /* handled same as... */
  738. X        case VAR:
  739. X        *pc++ = tok;
  740. X        tok = next_token();
  741. X        expect_binop = 1;
  742. X        continue;
  743. X            case LPAREN:
  744. X        if (compile (0) != RPAREN) {
  745. X            (void) sprintf (err_msg, "Unmatched left paren");
  746. X            return (ERR);
  747. X        }
  748. X        tok = next_token();
  749. X        expect_binop = 1;
  750. X        continue;
  751. X            case RPAREN:
  752. X        return (RPAREN);
  753. X            }
  754. X
  755. X        /* everything else is a binary operator */
  756. X        p = precedence[tok];
  757. X            if (p > prec) {
  758. X                int newtok = compile (p);
  759. X        if (newtok == ERR)
  760. X            return (ERR);
  761. X                *pc++ = tok;
  762. X        expect_binop = 1;
  763. X                tok = newtok;
  764. X            } else
  765. X                return (tok);
  766. X        }
  767. X}
  768. X
  769. X/* "run" the program[] compiled with compile().
  770. X * if ok, return 0 and the final result,
  771. X * else return -1 with a reason why not message in err_msg.
  772. X */
  773. Xstatic
  774. Xexecute(result)
  775. Xdouble *result;
  776. X{
  777. X    int instr; 
  778. X
  779. X    do {
  780. X        instr = *pc++;
  781. X        switch (instr & OP_MASK) {
  782. X        /* put these in numberic order so hopefully even the dumbest
  783. X         * compiler will choose to use a jump table, not a cascade of ifs.
  784. X         */
  785. X        case HALT: break;    /* outer loop will stop us */
  786. X        case ADD:  sp[1] = sp[1] +  sp[0]; sp++; break;
  787. X        case SUB:  sp[1] = sp[1] -  sp[0]; sp++; break;
  788. X        case MULT: sp[1] = sp[1] *  sp[0]; sp++; break;
  789. X        case DIV:  sp[1] = sp[1] /  sp[0]; sp++; break;
  790. X        case AND:  sp[1] = sp[1] && sp[0] ? 1 : 0; sp++; break;
  791. X        case OR:   sp[1] = sp[1] || sp[0] ? 1 : 0; sp++; break;
  792. X        case GT:   sp[1] = sp[1] >  sp[0] ? 1 : 0; sp++; break;
  793. X        case GE:   sp[1] = sp[1] >= sp[0] ? 1 : 0; sp++; break;
  794. X        case EQ:   sp[1] = sp[1] == sp[0] ? 1 : 0; sp++; break;
  795. X        case NE:   sp[1] = sp[1] != sp[0] ? 1 : 0; sp++; break;
  796. X        case LT:   sp[1] = sp[1] <  sp[0] ? 1 : 0; sp++; break;
  797. X        case LE:   sp[1] = sp[1] <= sp[0] ? 1 : 0; sp++; break;
  798. X        case NEG:  *sp = -*sp; break;
  799. X        case CONST: *--sp = opx[instr >> OP_SHIFT].opu_f; break;
  800. X        case VAR:
  801. X        if (flog_get(opx[instr>>OP_SHIFT].opu_fld, --sp, (char *)0)<0) {
  802. X            (void) sprintf (err_msg, "Bug! VAR field not logged");
  803. X            return (-1);
  804. X        }
  805. X        break;
  806. X        case ABS:  *sp = fabs (*sp); break;
  807. X        case SQRT: *sp = sqrt (*sp); break;
  808. X        default:
  809. X        (void) sprintf (err_msg, "Bug! bad opcode: 0x%x", instr);
  810. X        return (-1);
  811. X        }
  812. X        if (sp < stack) {
  813. X        (void) sprintf (err_msg, "Runtime stack overflow");
  814. X        return (-1);
  815. X        } else if (sp - stack > MAX_STACK) {
  816. X        (void) sprintf (err_msg, "Bug! runtime stack underflow");
  817. X        return (-1);
  818. X        }
  819. X    } while (instr != HALT);
  820. X
  821. X    /* result should now be on top of stack */
  822. X    if (sp != &stack[MAX_STACK - 1]) {
  823. X        (void) sprintf (err_msg, "Bug! stack has %d items",
  824. X                            MAX_STACK - (sp-stack));
  825. X        return (-1);
  826. X    }
  827. X    *result = *sp;
  828. X    return (0);
  829. X}
  830. X
  831. X/* starting with lcexpr pointing at a string expected to be a field name,
  832. X * return an rcfpack(r,c,0) of the field else -1 if bad.
  833. X * when return, leave lcexpr alone but move cexpr to just after the name.
  834. X */
  835. Xstatic
  836. Xparse_fieldname ()
  837. X{
  838. X    int r = -1, c = -1;     /* anything illegal */
  839. X    char *fn = lcexpr;    /* likely faster than using the global */
  840. X    char f0, f1;
  841. X    char *dp;
  842. X
  843. X    /* search for first thing not an alpha char.
  844. X     * leave it in f0 and leave dp pointing to it.
  845. X     */
  846. X    dp = fn;
  847. X    while (isalpha(f0 = *dp))
  848. X        dp++;
  849. X
  850. X    /* crack the new field name.
  851. X     * when done trying, leave dp pointing at first char just after it.
  852. X     * set r and c if we recognized it.
  853. X     */
  854. X    if (f0 == '.') {
  855. X        int jcontext = 0;    /* need more of then as time goes on */
  856. X
  857. X        /* object.column "dot" notation pair.
  858. X         * crack the first portion (pointed to by fn): set r.
  859. X         * then the second portion (pointed to by dp+1): set c.
  860. X         */
  861. X        f0 = fn[0];
  862. X        f1 = fn[1];
  863. X        switch (f0) {
  864. X        case 'c':            r = R_CALLISTO;
  865. X        break;
  866. X        case 'e':            r = R_EUROPA;
  867. X        break;
  868. X        case 'g':            r = R_GANYMEDE;
  869. X        break;
  870. X        case 'i':            r = R_IO;
  871. X        break;
  872. X        case 'j':
  873. X                    r = R_JUPITER;
  874. X        jcontext = 1;
  875. X        break;
  876. X        case 'm':
  877. X        if (f1 == 'a')      r = R_MARS;
  878. X        else if (f1 == 'e') r = R_MERCURY;
  879. X        else if (f1 == 'o') r = R_MOON;
  880. X        break;
  881. X        case 'n':            r = R_NEPTUNE;
  882. X        break;
  883. X        case 'p':            r = R_PLUTO;
  884. X        break;
  885. X        case 's':
  886. X        if (f1 == 'a')      r = R_SATURN;
  887. X        else if (f1 == 'u') r = R_SUN;
  888. X        break;
  889. X        case 'u':            r = R_URANUS;
  890. X        break;
  891. X        case 'x':            r = R_OBJX;
  892. X        break;
  893. X        case 'y':            r = R_OBJY;
  894. X        break;
  895. X        case 'v':            r = R_VENUS;
  896. X        break;
  897. X        }
  898. X
  899. X        /* now crack the column (stuff after the dp) */
  900. X        dp++;    /* point at good stuff just after the decimal pt */
  901. X        f0 = dp[0];
  902. X        f1 = dp[1];
  903. X        switch (f0) {
  904. X        case 'a':
  905. X        if (f1 == 'l')        c = C_ALT;
  906. X        else if (f1 == 'z')   c = C_AZ;
  907. X        break;
  908. X        case 'd':              c = C_DEC;
  909. X        break;
  910. X        case 'e':
  911. X        if (f1 == 'd')        c = C_EDIST;
  912. X        else if (f1 == 'l')   c = C_ELONG;
  913. X        break;
  914. X        case 'h':
  915. X        if (f1 == 'l') {
  916. X            if (dp[2] == 'a')              c = C_HLAT;
  917. X            else if (dp[2] == 'o')         c = C_HLONG;
  918. X        } else if (f1 == 'r' || f1 == 'u') c = C_TUP;
  919. X        break;
  920. X        case 'j':              c = C_JUPITER;
  921. X        break;
  922. X        case 'm':
  923. X        if (f1 == 'a')        c = C_MARS;
  924. X        else if (f1 == 'e')   c = C_MERCURY;
  925. X        else if (f1 == 'o')   c = C_MOON;
  926. X        break;
  927. X        case 'n':              c = C_NEPTUNE;
  928. X        break;
  929. X        case 'p':
  930. X        if (f1 == 'h')        c = C_PHASE;
  931. X        else if (f1 == 'l')   c = C_PLUTO;
  932. X        break;
  933. X        case 'r':
  934. X        if (f1 == 'a') {
  935. X            if (dp[2] == 'z') c = C_RISEAZ;
  936. X            else           c = C_RA;
  937. X        } else if (f1 == 't') c = C_RISETM;
  938. X        break;
  939. X        case 's':
  940. X        if (f1 == 'a') {
  941. X            if (dp[2] == 'z') c = C_SETAZ;
  942. X            else          c = C_SATURN;
  943. X        } else if (f1 == 'd') c = C_SDIST;
  944. X        else if (f1 == 'i')   c = C_SIZE;
  945. X        else if (f1 == 't')   c = C_SETTM;
  946. X        else if (f1 == 'u')   c = C_SUN;
  947. X        break;
  948. X        case 't':
  949. X        if (f1 == 'a')        c = C_TRANSALT;
  950. X        else if (f1 == 't')   c = C_TRANSTM;
  951. X        break;
  952. X        case 'u':              c = C_URANUS;
  953. X        break;
  954. X        case 'x':              c = jcontext ? C_OBJX : C_JMX;
  955. X        break;
  956. X        case 'y':              c = jcontext ? C_OBJY : C_JMY;
  957. X        break;
  958. X        case 'z':              c = C_JMZ;
  959. X        break;
  960. X        case 'v':
  961. X        if (f1 == 'e')        c = C_VENUS;
  962. X        else if (f1 == 'm')   c = C_MAG;
  963. X        break;
  964. X        }
  965. X
  966. X        /* now skip dp on past the column stuff */
  967. X        while (isalpha(*dp))
  968. X        dp++;
  969. X    } else {
  970. X        /* no decimal point; some other field */
  971. X        f0 = fn[0];
  972. X        f1 = fn[1];
  973. X        switch (f0) {
  974. X        case 'd':
  975. X        if (f1 == 'a')      r = R_DAWN, c = C_DAWNV;
  976. X        else if (f1 == 'u') r = R_DUSK, c = C_DUSKV;
  977. X        break;
  978. X        case 'j':
  979. X        if (f1 == 'I') {
  980. X            if (fn[2] == 'I') r = R_JCML, c = C_JCMLSII;
  981. X            else           r = R_JCML, c = C_JCMLSI;
  982. X        }
  983. X        break;
  984. X        case 'n':
  985. X        r = R_LON, c = C_LONV;
  986. X        break;
  987. X        }
  988. X    }
  989. X
  990. X    cexpr = dp;
  991. X    if (r <= 0 || c <= 0) return (-1);
  992. X    return (rcfpack (r, c, 0));
  993. X}
  994. END_OF_FILE
  995.   if test 15828 -ne `wc -c <'compiler.c'`; then
  996.     echo shar: \"'compiler.c'\" unpacked with wrong size!
  997.   fi
  998.   # end of 'compiler.c'
  999. fi
  1000. if test -f 'ephem.db' -a "${1}" != "-c" ; then 
  1001.   echo shar: Will not clobber existing file \"'ephem.db'\"
  1002. else
  1003.   echo shar: Extracting \"'ephem.db'\" \(12159 characters\)
  1004.   sed "s/^X//" >'ephem.db' <<'END_OF_FILE'
  1005. X* ephem database.
  1006. X*
  1007. X* these are sorted for easy reading but they don't have to be in any order.
  1008. X* things will run faster if you put the objects you use nearer the top.
  1009. X*
  1010. X* elliptical format (e < 1):
  1011. X*    i = inclination, degrees
  1012. X*    O = longitude of ascending node, degrees
  1013. X*    o = argument of perihelion, degrees
  1014. X*    a = mean distance (aka semi-major axis), AU
  1015. X*    n = daily motion, degrees per day
  1016. X*    e = eccentricity,
  1017. X*    M = mean anomaly (ie, degrees from perihelion),
  1018. X*    E = epoch date (ie, time of M),
  1019. X*    D = the equinox year (ie, time of i/O/o).
  1020. X*    g/k or H/G = magnitude model
  1021. X*    s = angular size at 1 AU, arc seconds, optional
  1022. X*
  1023. X* hyperbolic format (e > 1):
  1024. X*    T = epoch of perihelion
  1025. X*    i = inclination, degrees
  1026. X*    O = longitude of ascending node, degrees
  1027. X*    o = argument of perihelion, degrees
  1028. X*    e = eccentricity,
  1029. X*    q = perihelion distance, AU
  1030. X*    D = the equinox year (ie, time of i/O/o).
  1031. X*    g/k = magnitude model
  1032. X*    s = angular size at 1 AU, arc seconds, optional
  1033. X*
  1034. X* parabolic format (e == 1):
  1035. X*    T = epoch of perihelion
  1036. X*    i = inclination, degrees
  1037. X*    o = argument of perihelion, degrees
  1038. X*    q = perihelion distance, AU
  1039. X*    O = longitude of ascending node, degrees
  1040. X*    D = the equinox year (ie, time of i/O/o).
  1041. X*    g/k = magnitude model
  1042. X*    s = angular size at 1 AU, arc seconds, optional
  1043. X*
  1044. X* fixed format:
  1045. X*    ra, hours
  1046. X*    dec, degrees
  1047. X*    magnitude
  1048. X*    reference epoch
  1049. X*    s = angular size, arc seconds, optional
  1050. X
  1051. X* from IAU circular 4985
  1052. XAustin,p,4/9.9715/1990,58.9574,61.5625,0.349854,75.2223,1950.0,4.5,4
  1053. X* from IAU circular 4986
  1054. XCernis,p,3/17.2967/1990,48.138,100.588,1.06849,347.727,1950,0,0
  1055. X* from IAU circular 4984
  1056. XGeorge,p,4/11.9396/1990,59.3652,137.8482,1.569001,279.3118,1950,0,0
  1057. X*Comet Levy (1990c) elements from IAUC 5060 (25 Jul 1990);g & k by J. Fedock
  1058. XLevy,h,10/24.6277/1990,131.5951,138.6561,242.6328,1.001267,.938779,1950,4.2,3.4
  1059. X*Comet Tsuchiya-Kiuchi (1990i) from IAUC 5055 (19 Jul 1990);g & k by J. Fedock
  1060. XTK,p,9/28.648/1990,143.758,180.830,1.09430,330.059,1950,5.5,4
  1061. X
  1062. X*Comet Honda-Mrkos-Pajdusakova (1990f) elements from IAUC 5035 (19 June 1990)
  1063. X*g & k via least squares fit by J. Fedock (10 Aug 90).
  1064. XHMP,e,4.2224,88.7097,325.702,3.03891,0.186049,0.821936,0,9/12.6864/1990,1950,g14.018,7.946
  1065. X
  1066. X* updated elements for Pluto
  1067. XPluto,e,17.1519,110.2183,113.5202,39.37210,.00398953,0.24678,0.1782,10/1/1989,2000.0,g6.3,0.0,8.1
  1068. X
  1069. XVesta,e,7.139,104.015,149.986,2.3607,0.27174,0.0906,152.190,11/5/1990,2000.0,3.16,0.34
  1070. XVesta89,e,7.139,104.015,150.175,2.3613,0.27163,0.0906,43.314,10/1/1989,2000.0,3.16,0.34
  1071. XCeres,e,10.607,80.702,71.274,2.7685,0.21396,0.0780,287.265,10/1/1989,2000.0,3.32,0.11
  1072. XHalley,e,162.238,58.154,111.857,17.9435,0.0129674,0.9673,0,1986.109,1950,3.66,7.05
  1073. XPallas,e,34.804,173.323,309.796,2.7703,0.21375,0.2347,273.779,10/1/1989,2000.0,4.13,0.15
  1074. XEunomia,e,11.76001,292.89583,97.40910,2.6446692,0.22916434,0.1850083,236.28800,8/27/1988,1950.0,5.22,0.20
  1075. XEunomia,e,11.765,293.619,97.591,2.6437,0.22929,0.1849,327.856,10/1/1989,2000.0,5.22,0.20
  1076. XJuno,e,12.991,170.542,246.787,2.6692,0.22601,0.2575,205.808,11/5/1990,2000.0,5.31,0.30
  1077. XJuno89,e,12.993,170.556,246.744,2.6682,0.22614,0.2580,115.411,10/1/1989,2000.0,5.31,0.30
  1078. XHygiea,e,3.840,283.833,315.832,3.1365,0.17743,0.1202,104.089,11/5/1990,2000.0,5.37,0.15
  1079. XIris,e,5.513,260.100,144.725,2.3864,0.26735,0.2292,239.261,11/5/1990,2000.0,5.56,0.25
  1080. XHebe,e,14.781,139.033,238.480,2.4250,0.26100,0.2020,253.786,11/5/1990,2000.0,5.70,0.24
  1081. XHerculina,e,16.35677,107.39552,75.08723,2.7711409,0.21365652,0.1763770,199.36894,10/1/1989,1950.0,5.78,0.22
  1082. XAmphitrite,e,6.110,356.625,63.020,2.5546,0.24139,0.0715,294.249,11/5/1990,2000.0,5.84,0.21
  1083. XDembowska,e,8.264,32.824,343.637,2.9246,0.19707,0.0901,257.577,11/5/1990,2000.0,5.98,0.32
  1084. XPsyche,e,3.089,150.508,227.697,2.9229,0.19723,0.1333,37.474,11/5/1990,2000.0,5.98,0.22
  1085. XPsyche89,e,3.089,150.508,227.581,2.9234,0.19718,0.1335,318.680,10/1/1989,2000.0,5.98,0.22
  1086. XInteramnia,e,17.301,281.072,92.206,3.0631,0.18385,0.1471,350.196,11/5/1990,2000.0,6.00,0.02
  1087. XLaetitia,e,10.368,157.417,208.197,2.7677,0.21405,0.1145,237.595,11/5/1990,2000.0,6.16,0.25
  1088. XDavida,e,15.937,107.998,339.207,3.1728,0.17439,0.1783,314.054,11/5/1990,2000.0,6.17,0.02
  1089. XIrene,e,9.113,86.863,95.016,2.5858,0.23703,0.1665,223.034,11/5/1990,2000.0,6.27,0.09
  1090. XIrene89,e,9.113,86.867,95.052,2.5867,0.23691,0.1661,128.194,10/1/1989,2000.0,6.27,0.09
  1091. XEuropa,e,7.439,129.275,337.304,3.1022,0.18038,0.1000,164.467,11/5/1990,2000.0,6.29,0.15
  1092. XElenora,e,18.429,140.729,5.535,2.7962,0.21079,0.1170,304.553,11/5/1990,2000.0,6.32,0.32
  1093. XMetis,e,5.585,69.112,5.315,2.3865,0.26733,0.1219,270.833,10/1/1989,2000.0,6.32,0.29
  1094. XMelpomene,e,10.137,150.705,227.396,2.2950,0.28349,0.2185,200.804,11/5/1990,2000.0,6.41,0.17
  1095. XFlora,e,5.888,111.120,284.896,2.2016,0.30171,0.1561,296.988,11/5/1990,2000.0,6.48,0.33
  1096. XKalliope,e,13.696,66.469,355.776,2.9112,0.19842,0.0977,291.742,11/5/1990,2000.0,6.49,0.22
  1097. X
  1098. XSirius,f,6:45:9,-16:43,-1.4,2000
  1099. XCanopus,f,6:23:57,-52:41,-0.7,2000
  1100. XArcturus,f,14:15:40,19:11,-0.1,2000
  1101. XVega,f,18:36:56,38:47,0.04,2000
  1102. XCapella,f,5:16:41,46:0,0.06,2000
  1103. XRigel,f,5:14:32,-8:12,0.15,2000
  1104. XRigil,f,14:39:36,-60:50,0.33,2000
  1105. XProcyon,f,7:39:18,5:14,0.36,2000
  1106. XAchernar,f,1:37:42,-57:15,0.49,2000
  1107. XHadar,f,14:3:50,-60:22,0.61,2000
  1108. XAltair,f,19:50:47,8:52,0.75,2000
  1109. XBetelgeuse,f,5:55:10,7:24,0.8,2000
  1110. XAldebaran,f,4:35:55,16:30,0.86,2000
  1111. XSpica,f,13:25:11,-11:9,0.97,2000
  1112. XAntares,f,16:29:25,-26:26,1.08,2000
  1113. XPollux,f,7:45:19,28:1,1.15,2000
  1114. XFomalhaut,f,22:57:39,-29:37,1.15,2000
  1115. XDeneb,f,20:41:26,45:16,1.25,2000
  1116. XMimosa,f,12:47:44,-59:42,1.27,2000
  1117. XRegulus,f,10:8:22,11:58,1.35,2000
  1118. XAdara,f,6:58:38,-28:58,1.5,2000
  1119. XShaula,f,17:33:36,-37:6,1.62,2000
  1120. XBellatrix,f,5:25:8,6:21,1.63,2000
  1121. XAlnath,f,5:26:17,28:36,1.65,2000
  1122. XAlnilam,f,5:36:12,-1:12,1.69,2000
  1123. XDubhe,f,11:3:44,61:45,1.79,2000
  1124. XAlioth,f,12:54:2,55:57,1.79,2000
  1125. XMirfak,f,3:24:20,49:51,1.8,2000
  1126. XKaus,f,18:24:10,-34:23,1.83,2000
  1127. XBenetnasch,f,13:47:32,49:19,1.88,2000
  1128. XMenkalinan,f,5:59:32,44:57,1.9,2000
  1129. XMirzam,f,6:22:42,-17:57,1.98,2000
  1130. XMira,f,2:19:21,-2:59,2,2000
  1131. XHamal,f,2:7:10,23:27,2.01,2000
  1132. XDiphda,f,0:43:35,-17:59,2.03,2000
  1133. XPolaris,f,2:31:13,89:15,2.04,2000
  1134. XMirach,f,1:9:44,35:37,2.06,2000
  1135. XAlpheratz,f,0:8:23,29:5,2.07,2000
  1136. XRas,f,17:34:56,12:34,2.07,2000
  1137. XKocab,f,14:50:43,74:9,2.07,2000
  1138. XDenebola,f,11:49:4,14:34,2.13,2000
  1139. XAlgol,f,3:8:11,40:57,2.15,2000
  1140. XMintaka,f,5:32:1,0:18,2.2,2000
  1141. XSchedar,f,0:40:31,56:32,2.22,2000
  1142. XRastaban,f,17:56:36,51:29,2.23,2000
  1143. XAlphecca,f,15:34:41,26:43,2.23,2000
  1144. XMizar,f,13:23:56,54:56,2.27,2000
  1145. XCaph,f,0:9:10,59:9,2.27,2000
  1146. XMerak,f,11:1:51,56:23,2.38,2000
  1147. XPulcherrima,f,14:44:59,27:5,2.4,2000
  1148. XEniph,f,21:44:11,9:53,2.4,2000
  1149. XPhecda,f,11:53:49,53:42,2.43,2000
  1150. XAlderamin,f,21:18:35,62:35,2.44,2000
  1151. XMarkab,f,23:4:46,15:12,2.5,2000
  1152. XMekab,f,3:2:17,4:6,2.52,2000
  1153. XZozca,,f,11:14:6,20:31,2.56,2000
  1154. XArneb,f,5:32:44,-17:50,2.58,2000
  1155. XZuben,f,15:17:0,-9:23,2.61,2000
  1156. XPhakt,f,5:39:39,-34:5,2.63,2000
  1157. XSheratan,f,1:54:39,20:48,2.63,2000
  1158. XUnukalhay,f,15:44:17,6:25,2.65,2000
  1159. XMuphrid,f,13:54:41,18:24,2.68,2000
  1160. XTarazed,f,19:46:15,10:37,2.72,2000
  1161. XIB,f,14:50:53,-16:3,2.75,2000
  1162. XCursa,f,5:7:51,-5:5,2.77,2000
  1163. XKelb,f,17:43:28,4:34,2.77,2000
  1164. XKornephoros,f,16:30:13,21:29,2.78,2000
  1165. XAlwaid,f,17:30:26,52:19,2.79,2000
  1166. XAlgenib,f,0:13:14,15:11,2.83,2000
  1167. XVindemiatrix,f,13:2:11,10:58,2.83,2000
  1168. XAlcyone,f,3:47:29,24:7,2.87,2000
  1169. XSadalsud,f,21:31:34,-5:35,2.88,2000
  1170. XGomeisa,f,7:27:9,8:17,2.89,2000
  1171. XSadalmelik,f,22:5:47,0:19,2.93,2000
  1172. XZaurak,f,3:58:2,-13:31,2.95,2000
  1173. XMEbsuta,f,6:43:56,25:8,2.99,2000
  1174. XAlbireo,f,19:30:43,27:58,3.08,2000
  1175. XTalitha,f,8:59:13,48:2,3.15,2000
  1176. XAlphirk,f,21:28:39,70:33,3.18,2000
  1177. XAlrai,f,23:39:20,77:37,3.22,2000
  1178. XSulaphat,f,18:58:56,32:41,3.25,2000
  1179. XSkat,f,22:54:39,-15:49,3.27,2000
  1180. XMegrez,f,12:15:26,57:2,3.31,2000
  1181. XHomam,f,22:41:27,10:50,3.39,2000
  1182. XSheliak,f,18:50:4,33:22,3.43,2000
  1183. XNekkar,f,15:1:57,40:23,3.49,2000
  1184. XWasat,f,7:20:7,21:59,3.53,2000
  1185. XRotanev,f,20:37:33,14:36,3.58,2000
  1186. XZawijah,f,11:50:42,1:46,3.61,2000
  1187. XThuban,f,14:4:24,64:22,3.65,2000
  1188. XBaten,f,1:51:27,-10:20,3.72,2000
  1189. XSvalocin,f,20:39:39,15:55,3.77,2000
  1190. XSadachbia,f,22:21:39,-1:23,3.84,2000
  1191. XZuben,f,15:35:32,-14:47,3.9,2000
  1192. XAlbireo,f,19:30:45,27:58,5.11,2000
  1193. XM1,f,5:34:30,22:2,8.4,2000
  1194. XM2,f,21:33:17,0:47,6.3,2000
  1195. XM3,f,13:42:9,28:21,6.4,2000
  1196. XM4,f,16:23:18,-26:30,6.4,2000
  1197. XM5,f,15:19:16,2:5,6.2,2000
  1198. XM6,f,17:39:38,-32:13,5.3,2000
  1199. XM7,f,17:53:40,-34:48,3.2,2000
  1200. XM8,f,18:3:32,-24:23,6,2000
  1201. XM9,f,17:18:28,-18:31,7.3,2000
  1202. XM10,f,16:57:19,-4:7,6.7,2000
  1203. XM11,f,18:51:21,-6:16,6.3,2000
  1204. XM12,f,16:47:18,-1:58,6.6,2000
  1205. XM13,f,16:41:54,36:27,5.7,2000
  1206. XM14,f,17:37:19,-3:15,7.7,2000
  1207. XM15,f,21:30:13,12:12,6,2000
  1208. XM16,f,18:19:25,-13:47,6.5,2000
  1209. XM17,f,18:21:27,-16:11,7,2000
  1210. XM18,f,18:19:27,-17:8,7.5,2000
  1211. XM19,f,17:2:33,-26:15,6.6,2000
  1212. XM20,f,18:2:31,-23:2,9,2000
  1213. XM21,f,18:4:31,-22:30,6.5,2000
  1214. XM22,f,18:36:32,-23:55,5.9,2000
  1215. XM23,f,17:56:29,-19:1,6.9,2000
  1216. XM24,f,18:18:28,-18:24,4.6,2000
  1217. XM25,f,18:32:29,-19:15,6,2000
  1218. XM26,f,18:45:22,-9:24,9.3,2000
  1219. XM27,f,20:0:5,22:44,7.6,2000
  1220. XM28,f,18:24:33,-24:52,7.3,2000
  1221. XM29,f,20:23:55,38:32,7.1,2000
  1222. XM30,f,21:40:25,-23:8,8.4,2000
  1223. XM31,f,0:43:22,41:17,4.8,2000
  1224. XM32,f,0:43:22,40:53,8.7,2000
  1225. XM33,f,1:34:25,30:41,6.7,2000
  1226. XM34,f,2:42:37,42:49,5.5,2000
  1227. XM35,f,6:9:32,24:21,5.3,2000
  1228. XM36,f,5:36:40,34:6,6.3,2000
  1229. XM37,f,5:53:38,32:33,6.2,2000
  1230. XM38,f,5:28:41,35:49,7.4,2000
  1231. XM39,f,21:32:54,48:28,5.2,2000
  1232. XM40,f,12:35:19,58:13,9,2000
  1233. XM41,f,6:47:3,-20:44,5,2000
  1234. XM42,f,5:35:14,-5:23,5,2000
  1235. XM43,f,5:35:14,-5:16,7,2000
  1236. XM44,f,8:40:26,19:59,3.7,2000
  1237. XM45,f,3:47:29,24:8,1.4,2000
  1238. XM46,f,7:42:9,-14:50,6,2000
  1239. XM47,f,7:37:9,-14:30,4.5,2000
  1240. XM48,f,8:13:14,-5:46,5.3,2000
  1241. XM49,f,12:30:16,7:59,8.6,2000
  1242. XM50,f,7:3:12,-8:20,6.9,2000
  1243. XM51,f,13:30:3,47:10,8.1,2000
  1244. XM52,f,23:24:7,61:37,7.3,2000
  1245. XM53,f,13:13:14,18:9,7.6,2000
  1246. XM54,f,18:54:36,-30:29,8.7,2000
  1247. XM55,f,19:39:35,-30:57,7.1,2000
  1248. XM56,f,19:16:58,30:11,8.2,2000
  1249. XM57,f,18:53:56,33:3,9.3,2000
  1250. XM58,f,12:38:16,11:48,9.2,2000
  1251. XM59,f,12:42:16,11:39,9.6,2000
  1252. XM60,f,12:44:16,11:33,9.7,2000
  1253. XM61,f,12:22:17,4:28,9.99,2000
  1254. XM62,f,17:1:36,-30:7,6.6,2000
  1255. XM63,f,13:16:7,42:0,9.5,2000
  1256. XM64,f,12:57:14,21:40,8.8,2000
  1257. XM65,f,11:19:18,13:5,9.3,2000
  1258. XM66,f,11:20:18,12:59,8.4,2000
  1259. XM67,f,8:50:22,11:48,6.1,2000
  1260. XM68,f,12:39:20,-26:45,8.2,2000
  1261. XM69,f,18:30:38,-32:21,8.9,2000
  1262. XM70,f,18:42:38,-32:19,9.6,2000
  1263. XM71,f,19:54:7,18:47,9,2000
  1264. XM72,f,20:53:22,-12:33,9.8,2000
  1265. XM73,f,20:57:22,-12:43,9.99,2000
  1266. XM74,f,1:37:21,15:49,9.99,2000
  1267. XM75,f,20:5:29,-21:57,8,2000
  1268. XM76,f,1:42:35,51:36,9.99,2000
  1269. XM77,f,2:43:17,0:2,8.9,2000
  1270. XM78,f,5:47:17,0:3,8,2000
  1271. XM79,f,5:24:2,-24:32,8.4,2000
  1272. XM80,f,16:17:30,-22:59,7.7,2000
  1273. XM81,f,9:56:3,69:2,7.9,2000
  1274. XM82,f,9:56:5,69:40,8.8,2000
  1275. XM83,f,13:37:25,-29:54,9.99,2000
  1276. XM84,f,12:25:16,12:52,9.3,2000
  1277. XM85,f,12:25:16,18:10,9.3,2000
  1278. XM86,f,12:26:16,12:55,9.7,2000
  1279. XM87,f,12:31:16,12:22,9.2,2000
  1280. XM88,f,12:32:16,14:24,9.99,2000
  1281. XM89,f,12:36:16,12:32,9.5,2000
  1282. XM90,f,12:37:16,13:8,9.97,2000
  1283. XM91,f,12:36:16,13:54,9.99,2000
  1284. XM92,f,17:17:46,43:8,6.1,2000
  1285. XM93,f,7:44:4,-23:52,6,2000
  1286. XM94,f,12:51:11,41:6,7.9,2000
  1287. XM95,f,10:43:19,11:44,9.99,2000
  1288. XM96,f,10:47:19,11:48,9.1,2000
  1289. XM97,f,11:15:27,54:59,9.99,2000
  1290. XM98,f,12:14:16,14:53,9.99,2000
  1291. XM99,f,12:19:16,14:24,9.99,2000
  1292. XM100,f,12:23:16,15:48,9.99,2000
  1293. XM101,f,14:2:53,54:20,9.6,2000
  1294. XM102,f,15:6:27,55:45,9.99,2000
  1295. XM103,f,1:33:40,60:43,7.4,2000
  1296. XM104,f,12:40:18,-11:37,8.7,2000
  1297. XM105,f,10:48:19,12:34,9.2,2000
  1298. XM106,f,12:19:14,47:17,8.6,2000
  1299. XM107,f,16:32:24,-13:5,9.2,2000
  1300. XM108,f,11:12:27,55:39,9.9,2000
  1301. XM109,f,11:58:18,53:21,9.9,2000
  1302. Xm110,f,0:40:22,41:43,9.4,2000
  1303. XUCNGC104,f,0:24:8,-72:5,5,2000
  1304. XNGC225,f,0:43:32,61:48,6.5,2000
  1305. XNGC362,f,1:2:25,-70:50,6,2000
  1306. XNGC457,f,1:19:10,58:19,6.5,2000
  1307. XNGC663,f,1:45:57,61:15,6.5,2000
  1308. XNGCGC869,f,2:20:45,57:9,5.2,2000
  1309. XNGC2070,f,5:38:44,-69:7,5.7,2000
  1310. XNGC2244,f,6:32:40,4:52,5.7,2000
  1311. XNGC2440,f,7:41:50,-18:12,7,2000
  1312. XNGC2506,f,7:59:54,-10:35,7.5,2000
  1313. XNGC2808,f,9:11:59,-64:51,7,2000
  1314. XNGC3242,f,10:24:43,-18:38,7,2000
  1315. XNGC3532,f,11:6:26,-58:40,7,2000
  1316. XNGC3766,f,11:36:14,-61:37,6.5,2000
  1317. XNGC4258,f,12:18:59,47:17,7.5,2000
  1318. XNGC4565,f,12:36:24,25:59,7,2000
  1319. XNGC5322,f,13:49:35,60:10,6,2000
  1320. XNGC6025,f,16:3:41,-60:29,6,2000
  1321. XNGC6067,f,16:13:21,-54:13,7,2000
  1322. XNGC6210,f,16:44:28,25:28,7,2000
  1323. XNGC6543,f,17:58:35,66:38,6.5,2000
  1324. XNGC6572,f,18:12:38,6:51,8,2000
  1325. XNGC6752,f,19:10:50,-59:59,7,2000
  1326. XNGC7009,f,21:4:8,-11:22,7,2000
  1327. XNGC7243,f,22:15:5,49:53,6.5,2000
  1328. XNGC7662,f,23:25:49,42:29,7,2000
  1329. XNGC7772,f,23:51:33,16:16,5,2000
  1330. XNGC7789,f,23:57:2,56:43,8,2000
  1331. END_OF_FILE
  1332.   if test 12159 -ne `wc -c <'ephem.db'`; then
  1333.     echo shar: \"'ephem.db'\" unpacked with wrong size!
  1334.   fi
  1335.   # end of 'ephem.db'
  1336. fi
  1337. if test -f 'version.c' -a "${1}" != "-c" ; then 
  1338.   echo shar: Will not clobber existing file \"'version.c'\"
  1339. else
  1340.   echo shar: Extracting \"'version.c'\" \(12040 characters\)
  1341.   sed "s/^X//" >'version.c' <<'END_OF_FILE'
  1342. X/* N.B. please increment version and date and note each change. */
  1343. X
  1344. X#include "screen.h"
  1345. X
  1346. Xstatic char vmsg[] = "Version 4.28 February 25, 1992";
  1347. X
  1348. X/*
  1349. X * 4.28 2/25/92    post to comp.sources.misc
  1350. X * 4.27 1/10    allow full plotting accuracy for LD/UD fields.
  1351. X *        check better for bad temp/height/pressure/stpsz formats.
  1352. X * 4.26    11/27    fix bug in nutation.c (two successive degrad() calls for tnm)
  1353. X *        allow for earth being >1 au from sun in watch_solarsystem().
  1354. X *    12/8    use unsigned short for fields[] in sel_fld.c
  1355. X * 4.25    11/6    fix problem redrawing first page of object lookup.
  1356. X * 4.24    11/5    fix initial cursor loc in jupiter extra menu.
  1357. X * 4.23    10/11    switch to Meeus' algorithm for jupiter's moons.
  1358. X *    10/13    some constellation values had leading 0: octal!
  1359. X *        add casts to setting srch_f to 0 via ?: for better portability.
  1360. X *    10/16    bona fide menu option for moons.
  1361. X *    10/18    add SPACE as an alternative to RETURN for picking.
  1362. X *    10/19    wrap long listing file lines. 
  1363. X *    10/24    disregard Pause while listing too.
  1364. X *    10/25    obj lookup now lets you pick from a table.
  1365. X *    10/27    add sqrt as a builtin search function
  1366. X *        add jupiter's central meridian longitudes to jup aux menu.
  1367. X *    10/29    ignore all .cfg/.db lines not starting with alpha char.
  1368. X *        use ctype.h for all alpha/digit/print tests.
  1369. X *    10/30    park the watch cursor after each screen-full.
  1370. X *    10/31    allow for retrograde rates in body_cir()'s conservation effort.
  1371. X * 4.22    8/29/90    add options for using select() in io.c.
  1372. X *    9/6    add checks for termcap keypad start/end codes (ke/ks).
  1373. X *        guard against a 0 entry from tgetstr() in io.c/egetstr().
  1374. X *    9/11    add hyperbolic objx type.
  1375. X *    9/12    check for missing termcap codes better.
  1376. X *    9/13    a few more #ifdef VMS tweaks.
  1377. X *    9/14    add more horizon marks to sky dome.
  1378. X *    10/3    add optional size to user objects (fixed rise/set problem too).
  1379. X *        add constellations support.
  1380. X *        add jupiter's moons. (to be much improved some day)
  1381. X *    10/4    switch to precession routine from Astro Almanac.
  1382. X *    10/5    use J for jupiter hot key, not ^j (more portable).
  1383. X *        fix year 0 problem.
  1384. X * 4.21    8/23/90    fix dawn/dusk near vernal equinox.
  1385. X * 4.20 8/15/90    add g/k and H/G magnitude model options for elliptical objects.
  1386. X *    8/17    put moon's geocentric long/lat under Hlong/Hlat columns.
  1387. X *        allow entering negative decimal years.
  1388. X *    8/20    init all static mjd storage to unlike times.
  1389. X *    8/21    add USE_TERMIO option to io.c.
  1390. X * 4.19 8/7/90    add listing feature, with 'L' hot-key.
  1391. X *        add title for plot file (as well as listing file).
  1392. X *        add some (void) casts for lint sake.
  1393. X * 4.18 8/2/90    fix parabolic comet bug in objx.c (bad lam computation).
  1394. X * 4.17 7/2/90    add 'c' short cut to Menu field.
  1395. X *        display full Dec precision for fixed objx setup.
  1396. X *        increase pluto auscale in watch.c, and guard screen boundries.
  1397. X *        add Pause feature.
  1398. X *    7/27    further improve rise/set and dawn/dusk times.
  1399. X *        add MENU={DATA,RISET,SEP} config/arg option.
  1400. X * 4.16 5/30/90    watch popup now allows changing formats without returning.
  1401. X *        add 'w' short cut to watch field.
  1402. X *        improve labeling a bit in Dome display.
  1403. X * 4.15    5/2/90    move setjmp() in main so it catches fp errs from ephem.cfg too.
  1404. X *    5/15    maintain name of objx/y.
  1405. X *        clean up objx.c.
  1406. X *    5/16    fix bug circum.c related to phase of fixed objects.
  1407. X *    5/22    add "Sky dome" watch display format (idea from Jeffery Cook).
  1408. X *    5/23    remember last selection in watch, search, and plot popup menus.
  1409. X *        cleanup layout and add labels in the watch screens.
  1410. X * 4.14 4/9/90    add y to body_tags[] in watch.c.
  1411. X *    4/10    add ! support (#ifdef BANG in sel_fld()).
  1412. X *      4/17    add #ifdef VMS and allow for no time zones (Karsten Spang).
  1413. X *    4/23    switch to EPHEMCFG (no more HOME).
  1414. X *        add #include <stdlib.h> #ifdef VMS wherever atof() is used.
  1415. X *    4/24    fix phase so it works for objects out of the ecliptic.
  1416. X * 4.13 3/9/90    add support for second user-def object: "object y"
  1417. X *        fix bug updating obj ref epoch (always used PARABOLIC's)
  1418. X *        fix Turbo C workaround that prevented plotting sun dist.
  1419. X *      3/13    fix bug preventing searching on separation column for objx
  1420. X *    3/22    revamp elliptical object definition parameters to match AA.
  1421. X *        permit exiting/redrawing properly from within a popup too.
  1422. X *        add a bit more precision to plot labels.
  1423. X *        let plot files have comments too, ie, leading *'s
  1424. X *    3/23    add "Lookup" to search config file for objects.
  1425. X *    3/30    separate database from config file; add -d and EPHEMDB env var.
  1426. X *        catch SIGFPE and longjmp() back into main interation loop.
  1427. X *    4/3    add magnitude to fixed-object database fields.
  1428. X * 4.12 1/12/90    lay framework for orbital element support for object x.
  1429. X *    1/15    fix slight bug related to nutation.
  1430. X *        plot fields in the same order they were selected.
  1431. X *    1/18       add copywrite notice in main.c.
  1432. X *        note <sys/time.h> in time.c for BSD 4.3.
  1433. X *    1/20    work on fixed and parabolic orbital elements.
  1434. X *      1/25    work on elliptical orbital elements.
  1435. X *    2/1    work on objx's magnitude models.
  1436. X *        add confirmation question before quitting.
  1437. X *      2/6    add d,o,z special speed move chars.
  1438. X *    2/8    watch: add LST to night sky and maintain RTC time back in main.
  1439. X *    2/12    fix bug in timezone related to daytime flag.
  1440. X *        add w (week) watch advance key code.
  1441. X *        add cautionary note about no string[s].h to Readme
  1442. X *    2/15    allow for precession moving dec outside range -90..90.
  1443. X *    2/19    fix bug that wiggled cursor during plotting in rise/set menu.
  1444. X *    2/20    fix bug preventing DAWN/DUSK/LON from being used in search func.
  1445. X * 4.11 12/29    add PC_GRAPHICS option in mainmenu.c (no effect on unix version)
  1446. X *      1/3/90    fix twilight error when sun never gets as low as -18 degs.
  1447. X *      1/4/90    always find alt/az from eod ra/dec, not from precessed values.
  1448. X *    1/9/90    lastmjd in plans.c was an int: prevented needless recalcs.
  1449. X * 4.10 12/6/89 fix transit times of circumpolar objects that don't rise.
  1450. X *              fix plotting search function when searching is not on.
  1451. X *    12/12    fix Objx rise/set bug.
  1452. X *      12/21    don't erase last watch positions until computed all new ones.
  1453. X *      12/23   added USE_BIOSCALLS to io.c: Doug McDonald's BIOS calls
  1454. X *    12/27    allow dates to be entered as decimal years (for help with plots)
  1455. X *    12/27    remove literal ESC chars in strings in io.c.
  1456. X * 4.9 11/28/89 provide two forms of non-blocking reads for unix in io.c
  1457. X *     11/30/89 take out superfluous ESC testing in chk_arrow().
  1458. X *              guard better against bogus chars in sel_fld().
  1459. X *        use %lf in scanf's.
  1460. X *              command-line arg PROPTS+ adds to settings from config file.
  1461. X *        change (int) casts in moduloes to (long) for 16bit int systems.
  1462. X * 4.8 10/28/89 use doubles everywhere
  1463. X *     10/31/89    add direct planet row selection codes.
  1464. X *     11/2/89  improve compiler's fieldname parser.
  1465. X *     11/3/89    switch from ESC to q for "go on" (CBREAK ESC not very portable)
  1466. X *     11/6/89    allow plotting the search function too.
  1467. X *     11/8/89  suppress screen updates while plotting and nstep > 1.
  1468. X *     11/9/89    fix bug prohibiting plotting venus' sdist and objx's transit.
  1469. X *     11/9/89    add option to plot in polar coords.
  1470. X *     11/12/89    fix bug related to updating timezone name when it is changed.
  1471. X *     11/21/89 fix bug in when to print info about object-x
  1472. X *     11/21/89    increase MAXPLTLINES to 10 (to ease plotting all planet seps)
  1473. X *     11/22/89 allow setting fields from command line too.
  1474. X * 4.7 10/13/89 start adding general searching feature. start with flogging.
  1475. X *     10/17/89 add compiler, first menu ideas, get binary srch working.
  1476. X *     10/18/89 add parabolic-extrema and secant-0 solvers.
  1477. X *     10/23/89 finish up new idea of one-line control and set-up "popup" menus.
  1478. X * 4.6 10/29/89 improve transit circumstances by iterating as with rise/set.
  1479. X *        allow changing lst.
  1480. X *        show Updating message at better times.
  1481. X *        avoid overstrikes while watching and add trails option.
  1482. X *        allow for Turbo-C 2.0 printf bug using %?.0f".
  1483. X * 4.5  9/24/89 add third table of all mutual planet angular distances.
  1484. X * 4.4  9/21/89 add second planet table with rise/set times.
  1485. X *        all rise/set times may now use standard or adaptive horizons.
  1486. X * 4.3   9/6/89 NM/FM calendar overstikes now use local time (was ut).
  1487. X *        display elongation of object x.
  1488. X *        better handling of typo when asking for refraction model.
  1489. X * 4.2    7/24/89    specify 7 digits to plot file (not just default to 6)
  1490. X * 4.1  7/18/89 use buffered output and fflush in read_char().
  1491. X * 4.0   7/8/89    add simple sky and solarsystem plotting (and rearrange fields)
  1492. X *        change mars' .cfg mnemonic from a to m.
  1493. X *        clean up nstep/NEW CIR handling
  1494. X *        quit adding our own .cfg suffixes, but...
  1495. X *        add looking for $HOME/.ephemrc (Ronald Florence)
  1496. X *        drop -b
  1497. X *        no longer support SITE
  1498. X * 3.17 6/15/89 misspelt temperature prompt; sun -/= bug. (Mike McCants)
  1499. X *        change sun() to sunpos() for sake of Sun Microsystems.
  1500. X * 3.16  6/9/89 allow JD to be set and plotted.
  1501. X *        c_clear (LATTIC_C) should use J not j (Alex Pruss)
  1502. X *        support SIGINT (Ronald Florence)
  1503. X * 3.15  6/8/89 forget SIMPLETZ: now TZA and TZB.
  1504. X * 3.14  6/6/89 add back borders but allow turning off via -b
  1505. X * 3.13 5/26/89 fix Day/Nite picking loc bug.
  1506. X * 3.12 5/25/89 add SIMPLETZ option to time.c for systems w/o tzset()
  1507. X *        files; couldn't plot dayln or niteln.
  1508. X * 3.11 5/16/89 local time prompt said utc; add NiteLn; check for bad plot
  1509. X * 3.10 4/27/89 allow caps for moving cursor around too
  1510. X * 3.9   4/5/89 discard leading termcap delay digits, for now
  1511. X * 3.8   3/2/89 shorten displayed precision, add heliocentric lat/long
  1512. X * 3.7  2/13/89 change to ^d to quit program.
  1513. X * 3.6   2/7/89 try adding .cfg suffix if can't find config file
  1514. X * 3.5   2/2/89 sunrise/set times based on actual sun size and pressure/temp
  1515. X * 3.4  1/22/89 calendar and all rise/set times based on local date, not utc
  1516. X * 3.3   1/6/89 add z to plot files (still don't plot it however)
  1517. X * 3.2   1/3/89 if set date/time then time does not inc first step
  1518. X * 3.1   1/1/89 user def. graph labels; nstep/stpsz control; genuine c_eol
  1519. X * 3.0 12/31/88 add graphing; add version to credits.
  1520. X * 2.7 12/30/88 add version to credits.
  1521. X * 2.6 12/28/88 twilight defined as 18 rather than 15 degrees below horizon
  1522. X * 2.5 12/26/88 remove trace capability; add screen shadowing: ^l.
  1523. X * 2.4 10/31/88 add credits banner, -s turns it off; savings time fix.
  1524. X * 2.3  9/23/88 exchange Altitude/Elevation titles (no code changes)
  1525. X * 2.2  9/20/88 more caution in aaha_aux() guarding acos() arg range
  1526. X * 2.1  9/14/88 moon phase always >= 0 to match planets convention
  1527. X * 2.0  9/13/88 add version ^v option
  1528. X */
  1529. X
  1530. Xversion()
  1531. X{
  1532. X    f_msg (vmsg);
  1533. X}
  1534. X
  1535. Xstatic char *cre[] = {
  1536. X"Ephem - an interactive astronomical ephemeris program",
  1537. Xvmsg,
  1538. X"",
  1539. X"Copyright (c) 1990,1991,1992 by Elwood Charles Downey",
  1540. X"",
  1541. X"Permission is granted to make and distribute copies of this program free of",
  1542. X"charge, provided the copyright notices and this permission notice are",
  1543. X"preserved on all copies.  All other rights reserved.  No representation is",
  1544. X"made about the suitability of this software for any purpose.  It is provided",
  1545. X"\"as is\" without express or implied warranty, to the extent permitted by",
  1546. X"applicable law.",
  1547. X"",
  1548. X/*
  1549. X"Many formulas and tables are based, with permission, on material found in",
  1550. X"\"Astronomy with your Personal Computer\" by Dr. Peter Duffett-Smith,",
  1551. X"Cambridge University Press, (c) 1985.  Constellation algorithm from a paper",
  1552. X"by Nancy G.  Roman, \"Identification of a constellation from a position\",",
  1553. X"Publications of the Astronomical Society of the Pacific, Vol.  99, p.",
  1554. X"695-699, July 1987.  Precession routine from 1989 Astronomical Almanac.",
  1555. X"Jupiter's moons based on information in \"Astronomical Formulae for",
  1556. X"Calculators\" by Jean Meeus.  Richmond, Va., U.S.A., Willmann-Bell, (c) 1982.",
  1557. X*/
  1558. X"See the manual (Man.txt) for a list of references.",
  1559. X"",
  1560. X"type any key to continue..."
  1561. X};
  1562. X
  1563. Xcredits()
  1564. X{
  1565. X    int r;
  1566. X    int l;
  1567. X    int nr;
  1568. X
  1569. X    c_erase();
  1570. X    nr = sizeof(cre)/sizeof(cre[0]);
  1571. X    r = (NR - nr)/2 + 1;
  1572. X    for (l = 0; l < nr; l++)
  1573. X        f_string (r++, (NC - strlen(cre[l]))/2, cre[l]);
  1574. X    (void) read_char();    /* wait for any char to continue */
  1575. X}
  1576. END_OF_FILE
  1577.   if test 12040 -ne `wc -c <'version.c'`; then
  1578.     echo shar: \"'version.c'\" unpacked with wrong size!
  1579.   fi
  1580.   # end of 'version.c'
  1581. fi
  1582. echo shar: End of archive 6 \(of 9\).
  1583. cp /dev/null ark6isdone
  1584. MISSING=""
  1585. for I in 1 2 3 4 5 6 7 8 9 ; do
  1586.     if test ! -f ark${I}isdone ; then
  1587.     MISSING="${MISSING} ${I}"
  1588.     fi
  1589. done
  1590. if test "${MISSING}" = "" ; then
  1591.     echo You have unpacked all 9 archives.
  1592.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  1593. else
  1594.     echo You still must unpack the following archives:
  1595.     echo "        " ${MISSING}
  1596. fi
  1597. exit 0
  1598. exit 0 # Just in case...
  1599.