home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / x / volume16 / xephem / part02 < prev    next >
Encoding:
Text File  |  1992-03-05  |  50.2 KB  |  1,660 lines

  1. Newsgroups: comp.sources.x
  2. Path: uunet!think.com!mips!msi!dcmartin
  3. From: e_downey@hwking.cca.cr.rockwell.com (Elwood Downey)
  4. Subject: v16i113: xephem - astronomical ephemeris program., Part02/24
  5. Message-ID: <1992Mar6.135211.1933@msi.com>
  6. Originator: dcmartin@fascet
  7. Sender: dcmartin@msi.com (David C. Martin - Moderator)
  8. Organization: Molecular Simulations, Inc.
  9. References: <csx-16i112-xephem@uunet.UU.NET>
  10. Date: Fri, 6 Mar 1992 13:52:11 GMT
  11. Approved: dcmartin@msi.com
  12.  
  13. Submitted-by: e_downey@hwking.cca.cr.rockwell.com (Elwood Downey)
  14. Posting-number: Volume 16, Issue 113
  15. Archive-name: xephem/part02
  16.  
  17. # this is part.02 (part 2 of a multipart archive)
  18. # do not concatenate these parts, unpack them in order with /bin/sh
  19. # file cal_mjd.c continued
  20. #
  21. if test ! -r _shar_seq_.tmp; then
  22.     echo 'Please unpack part 1 first!'
  23.     exit 1
  24. fi
  25. (read Scheck
  26.  if test "$Scheck" != 2; then
  27.     echo Please unpack part "$Scheck" next!
  28.     exit 1
  29.  else
  30.     exit 0
  31.  fi
  32. ) < _shar_seq_.tmp || exit 1
  33. if test ! -f _shar_wnt_.tmp; then
  34.     echo 'x - still skipping cal_mjd.c'
  35. else
  36. echo 'x - continuing file cal_mjd.c'
  37. sed 's/^X//' << 'SHAR_EOF' >> 'cal_mjd.c' &&
  38. X    }
  39. X
  40. X    if (y < 0)
  41. X        c = (long)((365.25*y) - 0.75) - 694025L;
  42. X    else
  43. X        c = (long)(365.25*y) - 694025L;
  44. X
  45. X    d = 30.6001*(m+1);
  46. X
  47. X    *mjd = b + c + d + dy - 0.5;
  48. }
  49. X
  50. /* given the modified Julian date (number of days elapsed since 1900 jan 0.5,),
  51. X * mjd, return the calendar date in months, *mn, days, *dy, and years, *yr.
  52. X */
  53. mjd_cal (mjd, mn, dy, yr)
  54. double mjd;
  55. int *mn, *yr;
  56. double *dy;
  57. {
  58. X    double d, f;
  59. X    double i, a, b, ce, g;
  60. X
  61. X    d = mjd + 0.5;
  62. X    i = floor(d);
  63. X    f = d-i;
  64. X    if (f == 1) {
  65. X        f = 0;
  66. X        i += 1;
  67. X    }
  68. X
  69. X    if (i > -115860.0) {
  70. X        a = floor((i/36524.25)+.9983573)+14;
  71. X        i += 1 + a - floor(a/4.0);
  72. X    }
  73. X
  74. X    b = floor((i/365.25)+.802601);
  75. X    ce = i - floor((365.25*b)+.750001)+416;
  76. X    g = floor(ce/30.6001);
  77. X    *mn = g - 1;
  78. X    *dy = ce - floor(30.6001*g)+f;
  79. X    *yr = b + 1899;
  80. X
  81. X    if (g > 13.5)
  82. X        *mn = g - 13;
  83. X    if (*mn < 2.5)
  84. X        *yr = b + 1900;
  85. X    if (*yr < 1)
  86. X        *yr -= 1;
  87. }
  88. X
  89. /* given an mjd, set *dow to 0..6 according to which dayof the week it falls
  90. X * on (0=sunday) or set it to -1 if can't figure it out.
  91. X */
  92. mjd_dow (mjd, dow)
  93. double mjd;
  94. int *dow;
  95. {
  96. X    /* cal_mjd() uses Gregorian dates on or after Oct 15, 1582.
  97. X     * (Pope Gregory XIII dropped 10 days, Oct 5..14, and improved the leap-
  98. X     * year algorithm). however, Great Britian and the colonies did not
  99. X     * adopt it until Sept 14, 1752 (they dropped 11 days, Sept 3-13,
  100. X     * due to additional accumulated error). leap years before 1752 thus
  101. X     * can not easily be accounted for from the cal_mjd() number...
  102. X     */
  103. X    if (mjd < -53798.5) {
  104. X        /* pre sept 14, 1752 too hard to correct */
  105. X        *dow = -1;
  106. X        return;
  107. X    }
  108. X    *dow = ((long)floor(mjd-.5) + 1) % 7;/* 1/1/1900 (mjd 0.5) is a Monday*/
  109. X    if (*dow < 0)
  110. X        *dow += 7;
  111. }
  112. X
  113. /* given a mjd, return the the number of days in the month.  */
  114. mjd_dpm (mjd, ndays)
  115. double mjd;
  116. int *ndays;
  117. {
  118. X    static short dpm[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
  119. X    int m, y;
  120. X    double d;
  121. X
  122. X    mjd_cal (mjd, &m, &d, &y);
  123. X    *ndays = (m==2 && ((y%4==0 && y%100!=0)||y%400==0)) ? 29 : dpm[m-1];
  124. }
  125. X
  126. X
  127. /* given a mjd, return the year as a double. */
  128. mjd_year (mjd, yr)
  129. double mjd;
  130. double *yr;
  131. {
  132. X    int m, y;
  133. X    double d;
  134. X    double e0, e1;    /* mjd of start of this year, start of next year */
  135. X
  136. X    mjd_cal (mjd, &m, &d, &y);
  137. X    if (y == -1) y = -2;
  138. X    cal_mjd (1, 1.0, y, &e0);
  139. X    cal_mjd (1, 1.0, y+1, &e1);
  140. X    *yr = y + (mjd - e0)/(e1 - e0);
  141. }
  142. X
  143. /* given a decimal year, return mjd */
  144. year_mjd (y, mjd)
  145. double y;
  146. double *mjd;
  147. {
  148. X    double e0, e1;    /* mjd of start of this year, start of next year */
  149. X    int yf = floor (y);
  150. X    if (yf == -1) yf = -2;
  151. X
  152. X    cal_mjd (1, 1.0, yf, &e0);
  153. X    cal_mjd (1, 1.0, yf+1, &e1);
  154. X    *mjd = e0 + (y - yf)*(e1-e0);
  155. }
  156. SHAR_EOF
  157. echo 'File cal_mjd.c is complete' &&
  158. chmod 0644 cal_mjd.c ||
  159. echo 'restore of cal_mjd.c failed'
  160. Wc_c="`wc -c < 'cal_mjd.c'`"
  161. test 3113 -eq "$Wc_c" ||
  162.     echo 'cal_mjd.c: original size 3113, current size' "$Wc_c"
  163. rm -f _shar_wnt_.tmp
  164. fi
  165. # ============= circum.c ==============
  166. if test -f 'circum.c' -a X"$1" != X"-c"; then
  167.     echo 'x - skipping circum.c (File already exists)'
  168.     rm -f _shar_wnt_.tmp
  169. else
  170. > _shar_wnt_.tmp
  171. echo 'x - extracting circum.c (Text)'
  172. sed 's/^X//' << 'SHAR_EOF' > 'circum.c' &&
  173. /* fill in a Sky struct with all we know about each object.
  174. X *(the user defined objects are in obj.c)
  175. X */
  176. X
  177. #include <stdio.h>
  178. #include <math.h>
  179. #include "astro.h"
  180. #include "circum.h"
  181. #include "moreobjs.h"
  182. X
  183. /* find body p's circumstances now.
  184. X * to save some time the caller may specify a desired accuracy, in arc seconds.
  185. X * if, based on its mean motion, it would not have moved this much since the
  186. X * last time we were called we only recompute altitude and azimuth and avoid
  187. X * recomputing the planet's heliocentric position. use 0.0 for best possible.
  188. X * we always recompute the user-defined objects' position regardless.
  189. X * return 0 if only alt/az changes, else 1 if all other stuff updated too.
  190. X * N.B: values are for opposition, ie, at fastest retrograde.
  191. X * 8/7/91: turn memory off via about_now. it just isn't reliable for example
  192. X *   during searching when fine time changes are being made.
  193. X */
  194. body_cir (p, as, np, sp)
  195. int p;
  196. double as;
  197. Now *np;
  198. Sky *sp;
  199. {
  200. X    typedef struct {
  201. X        double l_dpas;    /* mean days per arc second */
  202. X        Now l_now;        /* when l_sky was found */
  203. X        double l_ra, l_dec;    /* the eod, ie, unprecessed, ra/dec values */
  204. X        Sky l_sky;
  205. X    } Last;
  206. X    /* must be in same order as the astro.h object #define's */
  207. X    static Last last[8] = {
  208. X        {.000068, {NOMJD}},    /* mercury */
  209. X        {.00017, {NOMJD}},    /* venus */
  210. X        {.00015, {NOMJD}},    /* mars */
  211. X        {.0012, {NOMJD}},    /* jupiter */
  212. X        {.0024, {NOMJD}},    /* saturn */
  213. X        {.0051, {NOMJD}},    /* uranus */
  214. X        {.0081, {NOMJD}},    /* neptune */
  215. X        {.011, {NOMJD}}    /* pluto */
  216. X    };
  217. X    Last objxlast, objylast;
  218. X    double lst, alt, az;
  219. X    double ehp, ha, dec;    /* ehp: angular dia of earth from body */
  220. X    Last *lp;
  221. X    int new;
  222. X
  223. X    switch (p) {
  224. X    case SUN: return (sun_cir (as, np, sp));
  225. X    case MOON: return (moon_cir (as, np, sp));
  226. X    case OBJX: lp = &objxlast; break;
  227. X    case OBJY: lp = &objylast; break;
  228. X    default: lp = last + p; break;
  229. X    }
  230. X
  231. X    /* if less than l_every days from last time for this planet
  232. X     * just redo alt/az.
  233. X     * ALWAYS redo objects x and y.
  234. X     */
  235. X    if (p != OBJX && p != OBJY && same_cir (np, &lp->l_now)
  236. X              && about_now (np, &lp->l_now, as*lp->l_dpas)) {
  237. X        *sp = lp->l_sky;
  238. X        new = 0;
  239. X    } else {
  240. X        double lpd0, psi0;    /* heliocentric ecliptic long and lat */
  241. X        double rp0;        /* dist from sun */
  242. X        double rho0;    /* dist from earth */
  243. X        double lam, bet;    /* geocentric ecliptic long and lat */
  244. X        double dia, mag;    /* angular diameter at 1 AU and magnitude */
  245. X        double lsn, rsn;    /* true geoc lng of sun, dist from sn to earth*/
  246. X        double el;    /* elongation */
  247. X        double f;   /* phase from earth */
  248. X
  249. X        lp->l_now = *np;
  250. X        sunpos (mjd, &lsn, &rsn);
  251. X        if (p == OBJX || p == OBJY)
  252. X        obj_cir(mjd, p, &lpd0, &psi0, &rp0, &rho0, &lam, &bet,
  253. X                        &sp->s_size, &sp->s_mag);
  254. X        else {
  255. X        double deps, dpsi;
  256. X        double a;
  257. X        plans(mjd, p, &lpd0, &psi0, &rp0, &rho0, &lam, &bet, &dia,&mag);
  258. X        nutation (mjd, &deps, &dpsi);    /* correct for nutation */
  259. X        lam += dpsi;
  260. X        a = lsn-lam;            /* and 20.4" aberation */
  261. X        lam -= degrad(20.4/3600)*cos(a)/cos(bet);
  262. X        bet -= degrad(20.4/3600)*sin(a)*sin(bet);
  263. X        }
  264. X
  265. X        ecl_eq (mjd, bet, lam, &lp->l_ra, &lp->l_dec);
  266. X
  267. X        sp->s_ra = lp->l_ra;
  268. X        sp->s_dec = lp->l_dec;
  269. X        if (epoch != EOD)
  270. X        precess (mjd, epoch, &sp->s_ra, &sp->s_dec);
  271. X        sp->s_edist = rho0;
  272. X        sp->s_sdist = rp0;
  273. X        elongation (lam, bet, lsn, &el);
  274. X        el = raddeg(el);
  275. X        sp->s_elong = el;
  276. X        f = (rp0 > 0.0)
  277. X        ? 0.25 * (((rp0+rho0)*(rp0+rho0) - rsn*rsn)/(rp0*rho0)) : 0.0;
  278. X        sp->s_phase = f*100.0; /* percent */
  279. X        if (p != OBJX && p != OBJY) {
  280. X        sp->s_size = dia/rho0;
  281. X        sp->s_mag = mag + 5.0*log(rp0*rho0/sqrt(f))/log(10.0);
  282. X        }
  283. X        sp->s_hlong = lpd0;
  284. X        sp->s_hlat = psi0;
  285. X        new = 1;
  286. X    }
  287. X
  288. X    /* alt, az; correct for parallax and refraction; use eod ra/dec */
  289. X    now_lst (np, &lst);
  290. X    ha = hrrad(lst) - lp->l_ra;
  291. X    if (sp->s_edist > 0.0) {
  292. X        ehp = (2.0*6378.0/146.0e6) / sp->s_edist;
  293. X        ta_par (ha, lp->l_dec, lat, height, ehp, &ha, &dec);
  294. X    } else
  295. X        dec = lp->l_dec;
  296. X    hadec_aa (lat, ha, dec, &alt, &az);
  297. X    refract (pressure, temp, alt, &alt);
  298. X    sp->s_alt = alt;
  299. X    sp->s_az = az;
  300. X    lp->l_sky = *sp;
  301. X    return (new);
  302. }
  303. X
  304. /* find local times when sun is 18 degrees below horizon.
  305. X * return 0 if just returned same stuff as previous call, else 1 if new.
  306. X */
  307. twilight_cir (np, dawn, dusk, status)
  308. Now *np;
  309. double *dawn, *dusk;
  310. int *status;
  311. {
  312. X    static Now last_now = {NOMJD};
  313. X    static double last_dawn, last_dusk;
  314. X    static int last_status;
  315. X    int new;
  316. X
  317. X    if (same_cir (np, &last_now) && same_lday (np, &last_now)) {
  318. X        *dawn = last_dawn;
  319. X        *dusk = last_dusk;
  320. X        *status = last_status;
  321. X        new = 0;
  322. X    } else {
  323. X        double x;
  324. X        (void) riset_cir (SUN,np,0,TWILIGHT,dawn,dusk,&x,&x,&x,&x,status);
  325. X        last_dawn = *dawn;
  326. X        last_dusk = *dusk;
  327. X        last_status = *status;
  328. X        last_now = *np;
  329. X        new = 1;
  330. X    }
  331. X    return (new);
  332. }
  333. X
  334. /* find sun's circumstances now.
  335. X * as is the desired accuracy, in arc seconds; use 0.0 for best possible.
  336. X * return 0 if only alt/az changes, else 1 if all other stuff updated too.
  337. X */
  338. sun_cir (as, np, sp)
  339. double as;
  340. Now *np;
  341. Sky *sp;
  342. {
  343. X    static Sky last_sky;
  344. X    static Now last_now = {NOMJD};
  345. X    static double last_ra, last_dec;    /* unprecessed ra/dec */
  346. X    double lst, alt, az;
  347. X    double ehp, ha, dec;    /* ehp: angular dia of earth from body */
  348. X    int new;
  349. X
  350. X    if (same_cir (np, &last_now) && about_now (np, &last_now, as*.00028)) {
  351. X        *sp = last_sky;
  352. X        new = 0;
  353. X    } else {
  354. X        double lsn, rsn;
  355. X        double deps, dpsi;
  356. X
  357. X        last_now = *np;
  358. X        sunpos (mjd, &lsn, &rsn);        /* sun's true ecliptic long
  359. X                         * and dist
  360. X                         */
  361. X        nutation (mjd, &deps, &dpsi);    /* correct for nutation */
  362. X        lsn += dpsi;
  363. X        lsn -= degrad(20.4/3600);        /* and light travel time */
  364. X
  365. X        sp->s_edist = rsn;
  366. X        sp->s_sdist = 0.0;
  367. X        sp->s_elong = 0.0;
  368. X        sp->s_size = raddeg(4.65242e-3/rsn)*3600*2;
  369. X        sp->s_mag = -26.8;
  370. X        sp->s_hlong = lsn-PI;    /* geo- to helio- centric */
  371. X        range (&sp->s_hlong, 2*PI);
  372. X        sp->s_hlat = 0.0;
  373. X
  374. X        ecl_eq (mjd, 0.0, lsn, &last_ra, &last_dec);
  375. X        sp->s_ra = last_ra;
  376. X        sp->s_dec = last_dec;
  377. X        if (epoch != EOD)
  378. X        precess (mjd, epoch, &sp->s_ra, &sp->s_dec);
  379. X        new = 1;
  380. X    }
  381. X
  382. X    now_lst (np, &lst);
  383. X    ha = hrrad(lst) - last_ra;
  384. X    ehp = (2.0 * 6378.0 / 146.0e6) / sp->s_edist;
  385. X    ta_par (ha, last_dec, lat, height, ehp, &ha, &dec);
  386. X    hadec_aa (lat, ha, dec, &alt, &az);
  387. X    refract (pressure, temp, alt, &alt);
  388. X    sp->s_alt = alt;
  389. X    sp->s_az = az;
  390. X    last_sky = *sp;
  391. X    return (new);
  392. }
  393. X
  394. /* find moon's circumstances now.
  395. X * as is the desired accuracy, in arc seconds; use 0.0 for best possible.
  396. X * return 0 if only alt/az changes, else 1 if all other stuff updated too.
  397. X */
  398. moon_cir (as, np, sp)
  399. double as;
  400. Now *np;
  401. Sky *sp;
  402. {
  403. X    static Sky last_sky;
  404. X    static Now last_now = {NOMJD};
  405. X    static double ehp;
  406. X    static double last_ra, last_dec;    /* unprecessed */
  407. X    double lst, alt, az;
  408. X    double ha, dec;
  409. X    int new;
  410. X
  411. X    if (same_cir (np, &last_now) && about_now (np, &last_now, as*.000021)) {
  412. X        *sp = last_sky;
  413. X        new = 0;
  414. X    } else {
  415. X        double lam, bet;
  416. X        double deps, dpsi;
  417. X        double lsn, rsn;    /* sun long in rads, earth-sun dist in au */
  418. X        double edistau;    /* earth-moon dist, in au */
  419. X        double el;        /* elongation, rads east */
  420. X
  421. X        last_now = *np;
  422. X        moon (mjd, &lam, &bet, &ehp);    /* moon's true ecliptic loc */
  423. X        nutation (mjd, &deps, &dpsi);    /* correct for nutation */
  424. X        lam += dpsi;
  425. X        range (&lam, 2*PI);
  426. X
  427. X        sp->s_edist = 6378.14/sin(ehp);    /* earth-moon dist, want km */
  428. X        sp->s_size = 3600*31.22512*sin(ehp);/* moon angular dia, seconds */
  429. X        sp->s_hlong = lam;            /* save geo in helio fields */
  430. X        sp->s_hlat = bet;
  431. X
  432. X        ecl_eq (mjd, bet, lam, &last_ra, &last_dec);
  433. X        sp->s_ra = last_ra;
  434. X        sp->s_dec = last_dec;
  435. X        if (epoch != EOD)
  436. X        precess (mjd, epoch, &sp->s_ra, &sp->s_dec);
  437. X
  438. X        sunpos (mjd, &lsn, &rsn);
  439. X        range (&lsn, 2*PI);
  440. X        elongation (lam, bet, lsn, &el);
  441. X
  442. X        /* solve triangle of earth, sun, and elongation for moon-sun dist */
  443. X        edistau = sp->s_edist/1.495979e8;    /* km -> au */
  444. X        sp->s_sdist =
  445. X        sqrt (edistau*edistau + rsn*rsn - 2.0*edistau*rsn*cos(el));
  446. X
  447. X        /* TODO: improve mag; this is based on a flat moon model. */
  448. X        sp->s_mag = -12.7 + 2.5*(log10(PI) - log10(PI/2*(1+1.e-6-cos(el))));
  449. X
  450. X        sp->s_elong = raddeg(el);        /* want degrees */
  451. X        sp->s_phase = fabs(el)/PI*100.0;    /* want non-negative % */
  452. X        new = 1;
  453. X    }
  454. X
  455. X    /* show topocentric alt/az by correcting ra/dec for parallax 
  456. X     * as well as refraction.
  457. X     */
  458. X    now_lst (np, &lst);
  459. X    ha = hrrad(lst) - last_ra;
  460. X    ta_par (ha, last_dec, lat, height, ehp, &ha, &dec);
  461. X    hadec_aa (lat, ha, dec, &alt, &az);
  462. X    refract (pressure, temp, alt, &alt);
  463. X    sp->s_alt = alt;
  464. X    sp->s_az = az;
  465. X    last_sky = *sp;
  466. X    return (new);
  467. }
  468. X
  469. /* given geocentric ecliptic longitude and latitude, lam and bet, of some object
  470. X * and the longitude of the sun, lsn, find the elongation, el. this is the
  471. X * actual angular separation of the object from the sun, not just the difference
  472. X * in the longitude. the sign, however, IS set simply as a test on longitude
  473. X * such that el will be >0 for an evening object <0 for a morning object.
  474. X * to understand the test for el sign, draw a graph with lam going from 0-2*PI
  475. X *   down the vertical axis, lsn going from 0-2*PI across the hor axis. then
  476. X *   define the diagonal regions bounded by the lines lam=lsn+PI, lam=lsn and
  477. X *   lam=lsn-PI. the "morning" regions are any values to the lower left of the
  478. X *   first line and bounded within the second pair of lines.
  479. X * all angles in radians.
  480. X */
  481. elongation (lam, bet, lsn, el)
  482. double lam, bet, lsn;
  483. double *el;
  484. {
  485. X    *el = acos(cos(bet)*cos(lam-lsn));
  486. X    if (lam>lsn+PI || lam>lsn-PI && lam<lsn) *el = - *el;
  487. }
  488. X
  489. /* return whether the two Nows are for the same observing circumstances. */
  490. same_cir (n1, n2)
  491. register Now *n1, *n2;
  492. {
  493. X    return (n1->n_lat == n2->n_lat
  494. X        && n1->n_lng == n2->n_lng
  495. X        && n1->n_temp == n2->n_temp
  496. X        && n1->n_pressure == n2->n_pressure
  497. X        && n1->n_height == n2->n_height
  498. X        && n1->n_tz == n2->n_tz
  499. X        && n1->n_epoch == n2->n_epoch);
  500. }
  501. X
  502. /* return whether the two Nows are for the same LOCAL day */
  503. same_lday (n1, n2)
  504. Now *n1, *n2;
  505. {
  506. X    return (mjd_day(n1->n_mjd - n1->n_tz/24.0) ==
  507. X               mjd_day(n2->n_mjd - n2->n_tz/24.0)); 
  508. }
  509. X
  510. /* return whether the mjd of the two Nows are within dt */
  511. static
  512. about_now (n1, n2, dt)
  513. Now *n1, *n2;
  514. double dt;
  515. {
  516. X    /* always say it's out pf bounds for now unless it's exactly the same...
  517. X    return (fabs (n1->n_mjd - n2->n_mjd) <= dt/2.0);
  518. X    */
  519. X    return (n1->n_mjd == n2->n_mjd);
  520. }
  521. X
  522. now_lst (np, lst)
  523. Now *np;
  524. double *lst;
  525. {
  526. X    utc_gst (mjd_day(mjd), mjd_hr(mjd), lst);
  527. X    *lst += radhr(lng);
  528. X    range (lst, 24.0);
  529. }
  530. X
  531. /* round a time in days, *t, to the nearest second, IN PLACE. */
  532. rnd_second (t)
  533. double *t;
  534. {
  535. X    *t = floor(*t*SPD+0.5)/SPD;
  536. }
  537. X    
  538. double
  539. mjd_day(jd)
  540. double jd;
  541. {
  542. X    return (floor(jd-0.5)+0.5);
  543. }
  544. X
  545. double
  546. mjd_hr(jd)
  547. double jd;
  548. {
  549. X    return ((jd-mjd_day(jd))*24.0);
  550. }
  551. SHAR_EOF
  552. chmod 0644 circum.c ||
  553. echo 'restore of circum.c failed'
  554. Wc_c="`wc -c < 'circum.c'`"
  555. test 10858 -eq "$Wc_c" ||
  556.     echo 'circum.c: original size 10858, current size' "$Wc_c"
  557. rm -f _shar_wnt_.tmp
  558. fi
  559. # ============= comet.c ==============
  560. if test -f 'comet.c' -a X"$1" != X"-c"; then
  561.     echo 'x - skipping comet.c (File already exists)'
  562.     rm -f _shar_wnt_.tmp
  563. else
  564. > _shar_wnt_.tmp
  565. echo 'x - extracting comet.c (Text)'
  566. sed 's/^X//' << 'SHAR_EOF' > 'comet.c' &&
  567. #include <math.h>
  568. #include "astro.h"
  569. X
  570. /* given a modified Julian date, mjd, and a set of heliocentric parabolic
  571. X * orbital elements referred to the epoch of date (mjd):
  572. X *   ep:   epoch of perihelion,
  573. X *   inc:  inclination,
  574. X *   ap:   argument of perihelion (equals the longitude of perihelion minus the
  575. X *       longitude of ascending node)
  576. X *   qp:   perihelion distance,
  577. X *   om:   longitude of ascending node;
  578. X * find:
  579. X *   lpd:  heliocentric longitude, 
  580. X *   psi:  heliocentric latitude,
  581. X *   rp:   distance from the sun to the planet, 
  582. X *   rho:  distance from the Earth to the planet,
  583. X *   lam:  geocentric ecliptic longitude, 
  584. X *   bet:  geocentric ecliptic latitude,
  585. X *         none are corrected for light time, ie, they are the true values for
  586. X *       the given instant.
  587. X *
  588. X * all angles are in radians, all distances in AU.
  589. X * mutual perturbation corrections with other solar system objects are not
  590. X * applied. corrections for nutation and abberation must be made by the caller.
  591. X * The RA and DEC calculated from the fully-corrected ecliptic coordinates are
  592. X * then the apparent geocentric coordinates. Further corrections can be made,
  593. X * if required, for atmospheric refraction and geocentric parallax.
  594. X */
  595. comet (mjd, ep, inc, ap, qp, om, lpd, psi, rp, rho, lam, bet)
  596. double mjd;
  597. double ep, inc, ap, qp, om;
  598. double *lpd, *psi, *rp, *rho, *lam, *bet;
  599. {
  600. X    double w, s, s2;
  601. X    double l, sl, cl, y;
  602. X    double spsi, cpsi;
  603. X    double rd, lsn, rsn;
  604. X    double lg, re, ll;
  605. X    double cll, sll;
  606. X    double nu;
  607. X
  608. #define    ERRLMT    0.0001
  609. X        w = ((mjd-ep)*3.649116e-02)/(qp*sqrt(qp));
  610. X        s = w/3;
  611. X    while (1) {
  612. X        double d;
  613. X        s2 = s*s;
  614. X        d = (s2+3)*s-w;
  615. X        if (fabs(d) <= ERRLMT)
  616. X        break;
  617. X        s = ((2*s*s2)+w)/(3*(s2+1));
  618. X    }
  619. X
  620. X        nu = 2*atan(s);
  621. X    *rp = qp*(1+s2);
  622. X    l = nu+ap;
  623. X        sl = sin(l);
  624. X    cl = cos(l);
  625. X    spsi = sl*sin(inc);
  626. X        *psi = asin(spsi);
  627. X    y = sl*cos(inc);
  628. X        *lpd = atan(y/cl)+om;
  629. X    cpsi = cos(*psi);
  630. X        if (cl<0) *lpd += PI;
  631. X    range (lpd, 2*PI);
  632. X        rd = *rp * cpsi;
  633. X    sunpos (mjd, &lsn, &rsn);
  634. X    lg = lsn+PI;
  635. X        re = rsn;
  636. X    ll = *lpd - lg;
  637. X        cll = cos(ll);
  638. X    sll = sin(ll);
  639. X        *rho = sqrt((re * re)+(*rp * *rp)-(2*re*rd*cll));
  640. X        if (rd<re) 
  641. X            *lam = atan((-1*rd*sll)/(re-(rd*cll)))+lg+PI;
  642. X    else
  643. X        *lam = atan((re*sll)/(rd-(re*cll)))+*lpd;
  644. X    range (lam, 2*PI);
  645. X        *bet = atan((rd*spsi*sin(*lam-*lpd))/(cpsi*re*sll));
  646. }
  647. SHAR_EOF
  648. chmod 0644 comet.c ||
  649. echo 'restore of comet.c failed'
  650. Wc_c="`wc -c < 'comet.c'`"
  651. test 2390 -eq "$Wc_c" ||
  652.     echo 'comet.c: original size 2390, current size' "$Wc_c"
  653. rm -f _shar_wnt_.tmp
  654. fi
  655. # ============= compiler.c ==============
  656. if test -f 'compiler.c' -a X"$1" != X"-c"; then
  657.     echo 'x - skipping compiler.c (File already exists)'
  658.     rm -f _shar_wnt_.tmp
  659. else
  660. > _shar_wnt_.tmp
  661. echo 'x - extracting compiler.c (Text)'
  662. sed 's/^X//' << 'SHAR_EOF' > 'compiler.c' &&
  663. /* module to compile and execute a c-style arithmetic expression.
  664. X * public entry points are compile_expr() and execute_expr().
  665. X *
  666. X * one reason this is so nice and tight is that all opcodes are the same size
  667. X * (an int) and the tokens the parser returns are directly usable as opcodes,
  668. X * for the most part. constants and variables are compiled as an opcode
  669. X * with an offset into the auxiliary opcode tape, opx.
  670. X */
  671. X
  672. #include <math.h>
  673. #include <ctype.h>
  674. #ifdef VMS
  675. #include <stdlib.h>
  676. #endif
  677. #include <X11/Xlib.h>
  678. #include <Xm/Xm.h>
  679. #include "fieldmap.h"
  680. X
  681. /* parser tokens and opcodes, as necessary */
  682. #define    HALT    0    /* good value for HALT since program is inited to 0 */
  683. /* binary operators (precedences in table, below) */
  684. #define    ADD    1
  685. #define    SUB    2
  686. #define    MULT    3
  687. #define    DIV    4
  688. #define    AND    5
  689. #define    OR    6
  690. #define    GT    7
  691. #define    GE    8
  692. #define    EQ    9
  693. #define    NE    10
  694. #define    LT    11
  695. #define    LE    12
  696. /* unary op, precedence in NEG_PREC #define, below */
  697. #define    NEG    13
  698. /* symantically operands, ie, constants, variables and all functions */
  699. #define    CONST    14    
  700. #define    VAR    15
  701. #define    ABS    16    /* add functions if desired just like this is done */
  702. #define    SIN    17
  703. #define    COS    18
  704. #define    TAN    19
  705. #define    ASIN    20
  706. #define    ACOS    21
  707. #define    ATAN    22
  708. #define    PITOK    23    /* built-in constant, pi */
  709. #define    DEGRAD    24
  710. #define    RADDEG    25
  711. #define    LOG    26
  712. #define    LOG10    27
  713. #define    EXP    28
  714. #define    SQRT    29
  715. #define    POW    30
  716. #define    ATAN2    31
  717. /* purely tokens - never get compiled as such */
  718. #define    LPAREN    255
  719. #define    RPAREN    254
  720. #define    COMMA    253
  721. #define    ERR    (-1)
  722. X
  723. /* precedence of each of the binary operators.
  724. X * in case of a tie, compiler associates left-to-right.
  725. X * N.B. each entry's index must correspond to its #define!
  726. X */
  727. static int precedence[] = {0,5,5,6,6,2,1,4,4,3,3,4,4};
  728. #define    NEG_PREC    7    /* negation is highest */
  729. X
  730. /* execute-time operand stack */
  731. #define    MAX_STACK    16
  732. static double stack[MAX_STACK], *sp;
  733. X
  734. /* space for compiled opcodes - the "program".
  735. X * opcodes go in lower 8 bits.
  736. X * when an opcode has an operand (as CONST and VAR) it is really in opx[] and
  737. X *   the index is in the remaining upper bits.
  738. X */
  739. #define    MAX_PROG 32
  740. static int program[MAX_PROG], *pc;
  741. #define    OP_SHIFT    8
  742. #define    OP_MASK        0xff
  743. X
  744. /* auxiliary operand info.
  745. X * the operands (all but lower 8 bits) of CONST and VAR are really indeces
  746. X * into this array. thus, no point in making this any longer than you have
  747. X * bits more than 8 in your machine's int to index into it, ie, make
  748. X *    MAX_OPX <= 1 << ((sizeof(int)-1)*8)
  749. X * also, the fld's must refer to ones being flog'd, so not point in more
  750. X * of these then that might be used for plotting and srching combined.
  751. X */
  752. #define    MAX_OPX    16
  753. typedef union {
  754. X    double opu_f;        /* value when opcode is CONST */
  755. X    Widget opu_fld;        /* widget of field when opcode is VAR */
  756. } OpX;
  757. static OpX opx[MAX_OPX];
  758. static int opxidx;
  759. X
  760. /* these are global just for easy/rapid access */
  761. static int parens_nest;    /* to check that parens end up nested */
  762. static char *err_msg;    /* caller provides storage; we point at it with this */
  763. static char *cexpr, *lcexpr; /* pointers that move along caller's expression */
  764. static int good_prog;    /* != 0 when program appears to be good */
  765. X
  766. /* compile the given c-style expression.
  767. X * return 0 and set good_prog if ok,
  768. X * else return -1 and a reason message in errbuf.
  769. X */
  770. compile_expr (ex, errbuf)
  771. char *ex;
  772. char *errbuf;
  773. {
  774. X    int instr;
  775. X
  776. X    /* init the globals.
  777. X     * also delete any flogs used in the previous program.
  778. X     */
  779. X    cexpr = ex;
  780. X    err_msg = errbuf;
  781. X    pc = program;
  782. X    opxidx = 0;
  783. X    parens_nest = 0;
  784. X    do {
  785. X        instr = *pc++;
  786. X        if ((instr & OP_MASK) == VAR)
  787. X        flog_delete (opx[instr >> OP_SHIFT].opu_fld);
  788. X    } while (instr != HALT);
  789. X
  790. X    pc = program;
  791. X    if (compile(0) == ERR) {
  792. X        (void) sprintf (err_msg + strlen(err_msg), " at \"%.10s\"", lcexpr);
  793. X        good_prog = 0;
  794. X        return (-1);
  795. X    }
  796. X    if (pc == program) {
  797. X        (void) sprintf (err_msg, "null program");
  798. X        good_prog = 0;
  799. X        return (-1);
  800. X    }
  801. X    *pc++ = HALT;
  802. X    good_prog = 1;
  803. X    return (0);
  804. }
  805. X
  806. /* execute the expression previously compiled with compile_expr().
  807. X * return 0 with *vp set to the answer if ok, else return -1 with a reason
  808. X * why not message in errbuf.
  809. X */
  810. execute_expr (vp, errbuf)
  811. double *vp;
  812. char *errbuf;
  813. {
  814. X    int s;
  815. X
  816. X    err_msg = errbuf;
  817. X    sp = stack + MAX_STACK;    /* grows towards lower addresses */
  818. X    pc = program;
  819. X    s = execute(vp);
  820. X    if (s < 0)
  821. X        good_prog = 0;
  822. X    return (s);
  823. }
  824. X
  825. /* this is a way for the outside world to ask whether there is currently a
  826. X * reasonable program compiled and able to execute.
  827. X */
  828. prog_isgood()
  829. {
  830. X    return (good_prog);
  831. }
  832. X
  833. /* get and return the opcode corresponding to the next token.
  834. X * leave with lcexpr pointing at the new token, cexpr just after it.
  835. X * also watch for mismatches parens and proper operator/operand alternation.
  836. X */
  837. static
  838. next_token ()
  839. {
  840. X    Widget parse_fieldname ();
  841. X    static char toomt[] = "More than %d terms";
  842. X    static char badop[] = "Illegal operator";
  843. X    int tok = ERR;    /* just something illegal */
  844. X    char c;
  845. X
  846. X    while ((c = *cexpr) == ' ')
  847. X        cexpr++;
  848. X    lcexpr = cexpr++;
  849. X
  850. X    /* mainly check for a binary operator */
  851. X    switch (c) {
  852. X    case ',': tok = COMMA; break;
  853. X    case '\0': --cexpr; tok = HALT; break; /* keep returning HALT */
  854. X    case '+': tok = ADD; break; /* compiler knows when it's really unary */
  855. X    case '-': tok = SUB; break; /* compiler knows when it's really negate */
  856. X    case '*': tok = MULT; break;
  857. X    case '/': tok = DIV; break;
  858. X    case '(': parens_nest++; tok = LPAREN; break;
  859. X    case ')':
  860. X        if (--parens_nest < 0) {
  861. X            (void) sprintf (err_msg, "Too many right parens");
  862. X        return (ERR);
  863. X        } else
  864. X        tok = RPAREN;
  865. X        break;
  866. X    case '|':
  867. X        if (*cexpr == '|') { cexpr++; tok = OR; }
  868. X        else { (void) sprintf (err_msg, badop); return (ERR); }
  869. X        break;
  870. X    case '&':
  871. X        if (*cexpr == '&') { cexpr++; tok = AND; }
  872. X        else { (void) sprintf (err_msg, badop); return (ERR); }
  873. X        break;
  874. X    case '=':
  875. X        if (*cexpr == '=') { cexpr++; tok = EQ; }
  876. X        else { (void) sprintf (err_msg, badop); return (ERR); }
  877. X        break;
  878. X    case '!':
  879. X        if (*cexpr == '=') { cexpr++; tok = NE; }
  880. X        else { (void) sprintf (err_msg, badop); return (ERR); }
  881. X        break;
  882. X    case '<':
  883. X        if (*cexpr == '=') { cexpr++; tok = LE; }
  884. X        else tok = LT;
  885. X        break;
  886. X    case '>':
  887. X        if (*cexpr == '=') { cexpr++; tok = GE; }
  888. X        else tok = GT;
  889. X        break;
  890. X    }
  891. X
  892. X    if (tok != ERR)
  893. X        return (tok);
  894. X
  895. X    /* not op so check for a constant, variable or function */
  896. X    if (isdigit(c) || c == '.') {
  897. X        if (opxidx > MAX_OPX) {
  898. X        (void) sprintf (err_msg, toomt, MAX_OPX);
  899. X        return (ERR);
  900. X        }
  901. X        opx[opxidx].opu_f = atof (lcexpr);
  902. X        tok = CONST | (opxidx++ << OP_SHIFT);
  903. X        skip_double();
  904. X    } else if (isalpha(c)) {
  905. X        /* check list of functions */
  906. X        tok = chk_funcs();
  907. X        if (tok == ERR) {
  908. X        /* not a function, so assume it's a variable */
  909. X        Widget fld;
  910. X        if (opxidx > MAX_OPX) {
  911. X            (void) sprintf (err_msg, toomt, MAX_OPX);
  912. X            return (ERR);
  913. X        }
  914. X        fld = parse_fieldname ();
  915. X        if (fld == 0) {
  916. X            (void) sprintf (err_msg, "Unknown field");
  917. X            return (ERR);
  918. X         } else {
  919. X            if (flog_add (fld) < 0) { /* register with field logger */
  920. X            (void) sprintf (err_msg, "Sorry; too many fields");
  921. X            return (ERR);
  922. X            }
  923. X            opx[opxidx].opu_fld = fld;
  924. X            tok = VAR | (opxidx++ << OP_SHIFT);
  925. X        }
  926. X        }
  927. X    }
  928. X
  929. X    if (tok != ERR)
  930. X        return (tok);
  931. X
  932. X    /* what the heck is it? */
  933. X    sprintf (err_msg, "syntax error");
  934. X    return (ERR);
  935. }
  936. X
  937. /* return funtion token, else ERR.
  938. X * if find one, update cexpr too.
  939. X */
  940. static
  941. chk_funcs()
  942. {
  943. X    static struct {
  944. X        char *st_name;
  945. X        int st_tok;
  946. X    } symtab[] = {
  947. X         /* be sure to put short names AFTER longer ones */
  948. X         {"abs", ABS},     {"acos", ACOS},   {"asin", ASIN},
  949. X         {"atan2", ATAN2},     {"atan", ATAN},   {"cos", COS},
  950. X         {"degrad", DEGRAD}, {"exp", EXP},       {"log10", LOG10},
  951. X         {"log", LOG},     {"pi", PITOK},       {"pow", POW},
  952. X         {"raddeg", RADDEG}, {"sin", SIN},       {"sqrt", SQRT},
  953. X         {"tan", TAN}
  954. X    };
  955. X    int i;
  956. X
  957. X    for (i = 0; i < sizeof(symtab)/sizeof(symtab[0]); i++) {
  958. X        int l = strlen (symtab[i].st_name);
  959. X        if (strncmp (lcexpr, symtab[i].st_name, l) == 0) {
  960. X        cexpr += l-1;
  961. X        return (symtab[i].st_tok);
  962. X        }
  963. X    }
  964. X    return (ERR);
  965. }
  966. X
  967. /* move cexpr on past a double.
  968. X * allow sci notation.
  969. X * no need to worry about a leading '-' or '+' but allow them after an 'e'.
  970. X * TODO: this handles all the desired cases, but also admits a bit too much
  971. X *   such as things like 1eee2...3. geeze; to skip a double right you almost
  972. X *   have to go ahead and crack it!
  973. X */
  974. static
  975. skip_double()
  976. {
  977. X    int sawe = 0;    /* so we can allow '-' or '+' right after an 'e' */
  978. X
  979. X    while (1) {
  980. X        char c = *cexpr;
  981. X        if (isdigit(c) || c=='.' || (sawe && (c=='-' || c=='+'))) {
  982. X        sawe = 0;
  983. X        cexpr++;
  984. X        } else if (c == 'e') {
  985. X        sawe = 1;
  986. X        cexpr++;
  987. X        } else
  988. X        break;
  989. X    }
  990. }
  991. X
  992. /* call this whenever you want to dig out the next (sub)expression.
  993. X * keep compiling instructions as long as the operators are higher precedence
  994. X * than prec (or until see HALT, COMMA or RPAREN) then return that
  995. X * "look-ahead" token.
  996. X * if error, fill in a message in err_msg[] and return ERR.
  997. X */
  998. static
  999. compile (prec)
  1000. int prec;
  1001. {
  1002. X    int expect_binop = 0;    /* set after we have seen any operand.
  1003. X                 * used by SUB so it can tell if it really 
  1004. X                 * should be taken to be a NEG instead.
  1005. X                 */
  1006. X    int tok = next_token ();
  1007. X    int *oldpc;
  1008. X
  1009. X        while (1) {
  1010. X        int p;
  1011. X        if (tok == ERR)
  1012. X        return (ERR);
  1013. X        if (pc - program >= MAX_PROG) {
  1014. X        sprintf (err_msg, "program is too long");
  1015. X        return (ERR);
  1016. X        }
  1017. X
  1018. X        /* check for special things like functions, constants and parens */
  1019. X            switch (tok & OP_MASK) {
  1020. X        case COMMA: return (tok);
  1021. X            case HALT: return (tok);
  1022. X        case ADD:
  1023. X        if (expect_binop)
  1024. X            break;    /* procede with binary addition */
  1025. X        /* just skip a unary positive(?) */
  1026. X        tok = next_token();
  1027. X        if (tok == HALT) {
  1028. X            sprintf (err_msg, "term expected");
  1029. X            return (ERR);
  1030. X        }
  1031. X        continue;
  1032. X        case SUB:
  1033. X        if (expect_binop)
  1034. X            break;    /* procede with binary subtract */
  1035. X        oldpc = pc;
  1036. X        tok = compile (NEG_PREC);
  1037. X        if (oldpc == pc) {
  1038. X            sprintf (err_msg, "term expected");
  1039. X            return (ERR);
  1040. X        }
  1041. X        *pc++ = NEG;
  1042. X        expect_binop = 1;
  1043. X        continue;
  1044. X        /* one-arg functions */
  1045. X            case ABS: case SIN: case COS: case TAN: case ASIN: case ACOS:
  1046. X        case ATAN: case DEGRAD: case RADDEG: case LOG: case LOG10:
  1047. X        case EXP: case SQRT:
  1048. X        /* eat up the function's parenthesized argument */
  1049. X        if (next_token() != LPAREN) {
  1050. X            sprintf (err_msg, "saw a built-in function: expecting (");
  1051. X            return (ERR);
  1052. X        }
  1053. X        oldpc = pc;
  1054. X        if (compile (0) != RPAREN || oldpc == pc) {
  1055. X            sprintf (err_msg, "1-arg function arglist error");
  1056. X            return (ERR);
  1057. X        }
  1058. X        *pc++ = tok;
  1059. X        tok = next_token();
  1060. X        expect_binop = 1;
  1061. X        continue;
  1062. X        /* two-arg functions */
  1063. X        case POW: case ATAN2:
  1064. X        /* eat up the function's parenthesized arguments */
  1065. X        if (next_token() != LPAREN) {
  1066. X            sprintf (err_msg, "saw a built-in function: expecting (");
  1067. X            return (ERR);
  1068. X        }
  1069. X        oldpc = pc;
  1070. X        if (compile (0) != COMMA || oldpc == pc) {
  1071. X            sprintf (err_msg, "1st of 2-arg function arglist error");
  1072. X            return (ERR);
  1073. X        }
  1074. X        oldpc = pc;
  1075. X        if (compile (0) != RPAREN || oldpc == pc) {
  1076. X            sprintf (err_msg, "2nd of 2-arg function arglist error");
  1077. X            return (ERR);
  1078. X        }
  1079. X        *pc++ = tok;
  1080. X        tok = next_token();
  1081. X        expect_binop = 1;
  1082. X        continue;
  1083. X        /* constants and variables are just like 0-arg functions w/o ()'s */
  1084. X            case CONST:
  1085. X        case PITOK:
  1086. X        case VAR:
  1087. X        *pc++ = tok;
  1088. X        tok = next_token();
  1089. X        expect_binop = 1;
  1090. X        continue;
  1091. X            case LPAREN:
  1092. X        oldpc = pc;
  1093. X        if (compile (0) != RPAREN) {
  1094. X            sprintf (err_msg, "unmatched left paren");
  1095. X            return (ERR);
  1096. X        }
  1097. X        if (oldpc == pc) {
  1098. X            sprintf (err_msg, "null expression");
  1099. X            return (ERR);
  1100. X        }
  1101. X        tok = next_token();
  1102. X        expect_binop = 1;
  1103. X        continue;
  1104. X            case RPAREN:
  1105. X        return (RPAREN);
  1106. X            }
  1107. X
  1108. X        /* everything else is a binary operator */
  1109. X        p = precedence[tok];
  1110. X            if (p > prec) {
  1111. X                int newtok;
  1112. X        oldpc = pc;
  1113. X                newtok = compile (p);
  1114. X        if (newtok == ERR)
  1115. X            return (ERR);
  1116. X        if (oldpc == pc) {
  1117. X            strcpy (err_msg, "term or factor expected");
  1118. X            return (ERR);
  1119. X        }
  1120. X                *pc++ = tok;
  1121. X        expect_binop = 1;
  1122. X                tok = newtok;
  1123. X            } else
  1124. X                return (tok);
  1125. X        }
  1126. }
  1127. X
  1128. /* "run" the program[] compiled with compile().
  1129. X * if ok, return 0 and the final result,
  1130. X * else return -1 with a reason why not message in err_msg.
  1131. X */
  1132. static
  1133. execute(result)
  1134. double *result;
  1135. {
  1136. X    int instr; 
  1137. X
  1138. X    do {
  1139. X        instr = *pc++;
  1140. X        switch (instr & OP_MASK) {
  1141. X        /* put these in numberic order so hopefully even the dumbest
  1142. X         * compiler will choose to use a jump table, not a cascade of ifs.
  1143. X         */
  1144. X        case HALT: break;    /* outer loop will stop us */
  1145. X        case ADD:  sp[1] = sp[1] +  sp[0]; sp++; break;
  1146. X        case SUB:  sp[1] = sp[1] -  sp[0]; sp++; break;
  1147. X        case MULT: sp[1] = sp[1] *  sp[0]; sp++; break;
  1148. X        case DIV:  sp[1] = sp[1] /  sp[0]; sp++; break;
  1149. X        case AND:  sp[1] = sp[1] && sp[0] ? 1 : 0; sp++; break;
  1150. X        case OR:   sp[1] = sp[1] || sp[0] ? 1 : 0; sp++; break;
  1151. X        case GT:   sp[1] = sp[1] >  sp[0] ? 1 : 0; sp++; break;
  1152. X        case GE:   sp[1] = sp[1] >= sp[0] ? 1 : 0; sp++; break;
  1153. X        case EQ:   sp[1] = sp[1] == sp[0] ? 1 : 0; sp++; break;
  1154. X        case NE:   sp[1] = sp[1] != sp[0] ? 1 : 0; sp++; break;
  1155. X        case LT:   sp[1] = sp[1] <  sp[0] ? 1 : 0; sp++; break;
  1156. X        case LE:   sp[1] = sp[1] <= sp[0] ? 1 : 0; sp++; break;
  1157. X        case NEG:  *sp = -*sp; break;
  1158. X        case CONST: *--sp = opx[instr >> OP_SHIFT].opu_f; break;
  1159. X        case VAR:
  1160. X        if (flog_get(opx[instr>>OP_SHIFT].opu_fld, --sp, (char *)0)<0) {
  1161. X            (void) sprintf (err_msg, "Bug! VAR field not logged");
  1162. X            return (-1);
  1163. X        }
  1164. X        break;
  1165. X        case PITOK:  *--sp = 4.0*atan(1.0); break;
  1166. X        case ABS:  *sp = fabs (*sp); break;
  1167. X        case SIN:  *sp = sin (*sp); break;
  1168. X        case COS:  *sp = cos (*sp); break;
  1169. X        case TAN:  *sp = tan (*sp); break;
  1170. X        case ASIN:  *sp = asin (*sp); break;
  1171. X        case ACOS:  *sp = acos (*sp); break;
  1172. X        case ATAN:  *sp = atan (*sp); break;
  1173. X        case DEGRAD:  *sp *= atan(1.0)/45.0; break;
  1174. X        case RADDEG:  *sp *= 45.0/atan(1.0); break;
  1175. X        case LOG: *sp = log (*sp); break;
  1176. X        case LOG10: *sp = log10 (*sp); break;
  1177. X        case EXP: *sp = exp (*sp); break;
  1178. X        case SQRT: *sp = sqrt (*sp); break;
  1179. X        case POW: sp[1] = pow (sp[1], sp[0]); sp++; break;
  1180. X        case ATAN2: sp[1] = atan2 (sp[1], sp[0]); sp++; break;
  1181. X        default:
  1182. X        (void) sprintf (err_msg, "Bug! bad opcode: 0x%x", instr);
  1183. X        return (-1);
  1184. X        }
  1185. X        if (sp < stack) {
  1186. X        (void) sprintf (err_msg, "Runtime stack overflow");
  1187. X        return (-1);
  1188. X        } else if (sp - stack > MAX_STACK) {
  1189. X        (void) sprintf (err_msg, "Bug! runtime stack underflow");
  1190. X        return (-1);
  1191. X        }
  1192. X    } while (instr != HALT);
  1193. X
  1194. X    /* result should now be on top of stack */
  1195. X    if (sp != &stack[MAX_STACK - 1]) {
  1196. X        (void) sprintf (err_msg, "Bug! stack has %d items",
  1197. X                            MAX_STACK - (sp-stack));
  1198. X        return (-1);
  1199. X    }
  1200. X    *result = *sp;
  1201. X    return (0);
  1202. }
  1203. X
  1204. /* starting with lcexpr pointing at a string expected to be a field name,
  1205. X * return the widget of the field, else 0 if bad.
  1206. X * when return, leave lcexpr alone but move cexpr to just after the name.
  1207. X */
  1208. static Widget
  1209. parse_fieldname ()
  1210. {
  1211. #define    NFM    5
  1212. X    /* collection of all the FieldMaps from the other menus that contain
  1213. X     * fields that can be PLT'd (that is, searched). we look through
  1214. X     * their names to find the field called out in an expression.
  1215. X     * N.B. NFM must match the number of FieldMaps we gather, below.
  1216. X     */
  1217. X    static struct {
  1218. X        FieldMap *fmp;
  1219. X        int nfm;
  1220. X    } fms[NFM];
  1221. X    FieldMap *fmp;
  1222. X    char name[32];
  1223. X    int fmn;
  1224. X    char c;
  1225. X    int len;
  1226. X
  1227. X    /* copy into name all up to first char not an alpha or '.'.
  1228. X     * set len to number thereof.
  1229. X     */
  1230. X    for (len = 0;
  1231. X        len < sizeof(name)-1 && ((c = lcexpr[len])=='.' || isalpha(c));
  1232. X        len++)
  1233. X        name[len] = c;
  1234. X    if (len == sizeof(name)-1)
  1235. X        return (0);
  1236. X    name[len] = '\0';
  1237. X    cexpr = &lcexpr[len];    /* as per functional description */
  1238. X
  1239. X    /* if first time here, go get all NFM FieldMaps */
  1240. X    if (fms[0].fmp == 0) {
  1241. X        fms[0].nfm = dm_getfieldmap (&fms[0].fmp);
  1242. X        fms[1].nfm = sm_getfieldmap (&fms[1].fmp);
  1243. X        fms[2].nfm = jm_getfieldmap (&fms[2].fmp);
  1244. X        fms[3].nfm = mm_getfieldmap (&fms[3].fmp);
  1245. X        fms[4].nfm = rm_getfieldmap (&fms[4].fmp);
  1246. X    }
  1247. X
  1248. X    /* search each set of fieldmaps for one with name */
  1249. X    for (fmn = 0; fmn < NFM; fmn++)
  1250. X        for (fmp = fms[fmn].fmp; fmp < &(fms[fmn].fmp)[fms[fmn].nfm]; fmp++)
  1251. X        if (fmp->name && strcmp (name, fmp->name) == 0)
  1252. X            return (fmp->w);
  1253. X    return (0);
  1254. }
  1255. SHAR_EOF
  1256. chmod 0644 compiler.c ||
  1257. echo 'restore of compiler.c failed'
  1258. Wc_c="`wc -c < 'compiler.c'`"
  1259. test 16567 -eq "$Wc_c" ||
  1260.     echo 'compiler.c: original size 16567, current size' "$Wc_c"
  1261. rm -f _shar_wnt_.tmp
  1262. fi
  1263. # ============= constel.c ==============
  1264. if test -f 'constel.c' -a X"$1" != X"-c"; then
  1265.     echo 'x - skipping constel.c (File already exists)'
  1266.     rm -f _shar_wnt_.tmp
  1267. else
  1268. > _shar_wnt_.tmp
  1269. echo 'x - extracting constel.c (Text)'
  1270. sed 's/^X//' << 'SHAR_EOF' > 'constel.c' &&
  1271. #include <math.h>
  1272. #include "astro.h"
  1273. X
  1274. /*
  1275. X  METHOD TO DETERMINE THE CONSTELLATION IN WHICH A POSITION IS LOCATED
  1276. X
  1277. C version by Craig Counterman and Elwood Downey,
  1278. adapted from fortran version:
  1279. exerpt from accompanying doc file:
  1280. X
  1281. X        Recently, Mr. Barry N. Rappaport of New  Mexico State University
  1282. X  transcribed  the constellation  boundaries as  fixed  by the IAU  into
  1283. X  machine-readable form.  These have  been  transcribed  by Dr. Nancy G.
  1284. X  Roman to make it possible  to determine by  computer the constellation
  1285. X  in which a position is located.
  1286. X
  1287. NSSDC catalog description:
  1288. X 6042   AN     Catalog of Constellation Boundary Data (Delporte, E. 1930, 
  1289. X               Cambridge Univ. Press)
  1290. X               Comment(s): includes constellation identification software 
  1291. X               (ADC 1987; see Roman, N.G. 1987, Publ. Astron. Soc. Pacific 
  1292. X               99, 695); 23 description, 118 software, 358 data records. 
  1293. X               3 files: 23x80, 118x80, 358x29 
  1294. X
  1295. full documentation file:
  1296. X
  1297. X   METHOD TO DETERMINE THE CONSTELLATION IN WHICH A POSITION IS LOCATED
  1298. X
  1299. X     Recently, Mr. Barry N. Rappaport of New Mexico State University trans-
  1300. cribed the constellation boundaries as fixed by the IAU into machine-readable
  1301. form.  These have been transcribed by Dr. Nancy G. Roman to make it possible to
  1302. determine by computer the constellation in which a position is located.
  1303. X     Two files follow.  The first is a program, in FORTRAN77, for determining
  1304. the constellation using the data in the succeeding file.  Comments describe
  1305. the format in which the positions must be entered.  The main program is
  1306. followed by a precession subroutine.
  1307. X     The final file is a list of constellation boundaries in the form Lower
  1308. Right Ascension (F8.4), Upper Right Ascension (F8.4), Lower Declination (F9.4),
  1309. three letter abbreviation for the Constellation (1X,A3).  The file contains
  1310. 358, 29-byte records.
  1311. X    The following is an example of the output of the program:
  1312. X RA =  9.0000 DEC =  65.0000  IS IN CONSTELLATION UMa
  1313. X RA = 23.5000 DEC = -20.0000  IS IN CONSTELLATION Aqr
  1314. X RA =  5.1200 DEC =   9.1200  IS IN CONSTELLATION Ori
  1315. X RA =  9.4555 DEC = -19.9000  IS IN CONSTELLATION Hya
  1316. X RA = 12.8888 DEC =  22.0000  IS IN CONSTELLATION Com
  1317. X RA = 15.6687 DEC = -12.1234  IS IN CONSTELLATION Lib
  1318. X RA = 19.0000 DEC = -40.0000  IS IN CONSTELLATION CrA
  1319. X RA =  6.2222 DEC = -81.1234  IS IN CONSTELLATION Men
  1320. X END OF INPUT POSITIONS AFTER: RA =   6.2222   DEC = -81.1234
  1321. X THE EQUINOX FOR THESE POSITIONS IS 1950.0
  1322. */
  1323. X
  1324. static char And[] = "And: Andromeda";
  1325. static char Ant[] = "Ant: Antlia";
  1326. static char Aps[] = "Aps: Apus";
  1327. static char Aql[] = "Aql: Aquila";
  1328. static char Aqr[] = "Aqr: Aquarius";
  1329. static char Ara[] = "Ara: Ara";
  1330. static char Ari[] = "Ari: Aries";
  1331. static char Aur[] = "Aur: Auriga";
  1332. static char Boo[] = "Boo: Bootes";
  1333. static char CMa[] = "CMa: Canis Major";
  1334. static char CMi[] = "CMi: Canis Minor";
  1335. static char CVn[] = "CVn: Canes Venatici";
  1336. static char Cae[] = "Cae: Caelum";
  1337. static char Cam[] = "Cam: Camelopardalis";
  1338. static char Cap[] = "Cap: Capricornus";
  1339. static char Car[] = "Car: Carina";
  1340. static char Cas[] = "Cas: Cassiopeia";
  1341. static char Cen[] = "Cen: Centaurus";
  1342. static char Cep[] = "Cep: Cepheus";
  1343. static char Cet[] = "Cet: Cetus";
  1344. static char Cha[] = "Cha: Chamaeleon";
  1345. static char Cir[] = "Cir: Circinus";
  1346. static char Cnc[] = "Cnc: Cancer";
  1347. static char Col[] = "Col: Columba";
  1348. static char Com[] = "Com: Coma Berenices";
  1349. static char CrA[] = "CrA: Corona Australis";
  1350. static char CrB[] = "CrB: Corona Borealis";
  1351. static char Crt[] = "Crt: Crater";
  1352. static char Cru[] = "Cru: Crux";
  1353. static char Crv[] = "Crv: Corvus";
  1354. static char Cyg[] = "Cyg: Cygnus";
  1355. static char Del[] = "Del: Delphinus";
  1356. static char Dor[] = "Dor: Dorado";
  1357. static char Dra[] = "Dra: Draco";
  1358. static char Equ[] = "Equ: Equuleus";
  1359. static char Eri[] = "Eri: Eridanus";
  1360. static char For[] = "For: Fornax";
  1361. static char Gem[] = "Gem: Gemini";
  1362. static char Gru[] = "Gru: Grus";
  1363. static char Her[] = "Her: Hercules";
  1364. static char Hor[] = "Hor: Horologium";
  1365. static char Hya[] = "Hya: Hydra";
  1366. static char Hyi[] = "Hyi: Hydrus";
  1367. static char Ind[] = "Ind: Indus";
  1368. static char LMi[] = "LMi: Leo Minor";
  1369. static char Lac[] = "Lac: Lacerta";
  1370. static char Leo[] = "Leo: Leo";
  1371. static char Lep[] = "Lep: Lepus";
  1372. static char Lib[] = "Lib: Libra";
  1373. static char Lup[] = "Lup: Lupus";
  1374. static char Lyn[] = "Lyn: Lynx";
  1375. static char Lyr[] = "Lyr: Lyra";
  1376. static char Men[] = "Men: Mensa";
  1377. static char Mic[] = "Mic: Microscopium";
  1378. static char Mon[] = "Mon: Monoceros";
  1379. static char Mus[] = "Mus: Musca";
  1380. static char Nor[] = "Nor: Norma";
  1381. static char Oct[] = "Oct: Octans";
  1382. static char Oph[] = "Oph: Ophiuchus";
  1383. static char Ori[] = "Ori: Orion";
  1384. static char Pav[] = "Pav: Pavo";
  1385. static char Peg[] = "Peg: Pegasus";
  1386. static char Per[] = "Per: Perseus";
  1387. static char Phe[] = "Phe: Phoenix";
  1388. static char Pic[] = "Pic: Pictor";
  1389. static char PsA[] = "PsA: Piscis Austrinus";
  1390. static char Psc[] = "Psc: Pisces";
  1391. static char Pup[] = "Pup: Puppis";
  1392. static char Pyx[] = "Pyx: Pyxis";
  1393. static char Ret[] = "Ret: Reticulum";
  1394. static char Scl[] = "Scl: Sculptor";
  1395. static char Sco[] = "Sco: Scorpius";
  1396. static char Sct[] = "Sct: Scutum";
  1397. static char Ser[] = "Ser: Serpens";
  1398. static char Sex[] = "Sex: Sextans";
  1399. static char Sge[] = "Sge: Sagitta";
  1400. static char Sgr[] = "Sgr: Sagittarius";
  1401. static char Tau[] = "Tau: Taurus";
  1402. static char Tel[] = "Tel: Telescopium";
  1403. static char TrA[] = "TrA: Triangulum Australe";
  1404. static char Tri[] = "Tri: Triangulum";
  1405. static char Tuc[] = "Tuc: Tucana";
  1406. static char UMa[] = "UMa: Ursa Major";
  1407. static char UMi[] = "UMi: Ursa Minor";
  1408. static char Vel[] = "Vel: Vela";
  1409. static char Vir[] = "Vir: Virgo";
  1410. static char Vol[] = "Vol: Volans";
  1411. static char Vul[] = "Vul: Vulpecula";
  1412. X
  1413. struct cdata {
  1414. X    double l_ra, u_ra, l_dec;
  1415. X    char *cons;
  1416. } con_data[] = {
  1417. X    {0.0000, 24.0000, 88.0000, UMi},
  1418. X    {8.0000, 14.5000, 86.5000, UMi},
  1419. X    {21.0000, 23.0000, 86.1667, UMi},
  1420. X    {18.0000, 21.0000, 86.0000, UMi},
  1421. X    {0.0000, 8.0000, 85.0000, Cep},
  1422. X    {9.1667, 10.6667, 82.0000, Cam},
  1423. X    {0.0000, 5.0000, 80.0000, Cep},
  1424. X    {10.6667, 14.5000, 80.0000, Cam},
  1425. X    {17.5000, 18.0000, 80.0000, UMi},
  1426. X    {20.1667, 21.0000, 80.0000, Dra},
  1427. X    {0.0000, 3.5083, 77.0000, Cep},
  1428. X    {11.5000, 13.5833, 77.0000, Cam},
  1429. X    {16.5333, 17.5000, 75.0000, UMi},
  1430. X    {20.1667, 20.6667, 75.0000, Cep},
  1431. X    {7.9667, 9.1667, 73.5000, Cam},
  1432. X    {9.1667, 11.3333, 73.5000, Dra},
  1433. X    {13.0000, 16.5333, 70.0000, UMi},
  1434. X    {3.1000, 3.4167, 68.0000, Cas},
  1435. X    {20.4167, 20.6667, 67.0000, Dra},
  1436. X    {11.3333, 12.0000, 66.5000, Dra},
  1437. X    {0.0000, 0.3333, 66.0000, Cep},
  1438. X    {14.0000, 15.6667, 66.0000, UMi},
  1439. X    {23.5833, 24.0000, 66.0000, Cep},
  1440. X    {12.0000, 13.5000, 64.0000, Dra},
  1441. X    {13.5000, 14.4167, 63.0000, Dra},
  1442. X    {23.1667, 23.5833, 63.0000, Cep},
  1443. X    {6.1000, 7.0000, 62.0000, Cam},
  1444. X    {20.0000, 20.4167, 61.5000, Dra},
  1445. X    {20.5367, 20.6000, 60.9167, Cep},
  1446. X    {7.0000, 7.9667, 60.0000, Cam},
  1447. X    {7.9667, 8.4167, 60.0000, UMa},
  1448. X    {19.7667, 20.0000, 59.5000, Dra},
  1449. X    {20.0000, 20.5367, 59.5000, Cep},
  1450. X    {22.8667, 23.1667, 59.0833, Cep},
  1451. X    {0.0000, 2.4333, 58.5000, Cas},
  1452. X    {19.4167, 19.7667, 58.0000, Dra},
  1453. X    {1.7000, 1.9083, 57.5000, Cas},
  1454. X    {2.4333, 3.1000, 57.0000, Cas},
  1455. X    {3.1000, 3.1667, 57.0000, Cam},
  1456. X    {22.3167, 22.8667, 56.2500, Cep},
  1457. X    {5.0000, 6.1000, 56.0000, Cam},
  1458. X    {14.0333, 14.4167, 55.5000, UMa},
  1459. X    {14.4167, 19.4167, 55.5000, Dra},
  1460. X    {3.1667, 3.3333, 55.0000, Cam},
  1461. X    {22.1333, 22.3167, 55.0000, Cep},
  1462. X    {20.6000, 21.9667, 54.8333, Cep},
  1463. X    {0.0000, 1.7000, 54.0000, Cas},
  1464. X    {6.1000, 6.5000, 54.0000, Lyn},
  1465. X    {12.0833, 13.5000, 53.0000, UMa},
  1466. X    {15.2500, 15.7500, 53.0000, Dra},
  1467. X    {21.9667, 22.1333, 52.7500, Cep},
  1468. X    {3.3333, 5.0000, 52.5000, Cam},
  1469. X    {22.8667, 23.3333, 52.5000, Cas},
  1470. X    {15.7500, 17.0000, 51.5000, Dra},
  1471. X    {2.0417, 2.5167, 50.5000, Per},
  1472. X    {17.0000, 18.2333, 50.5000, Dra},
  1473. X    {0.0000, 1.3667, 50.0000, Cas},
  1474. X    {1.3667, 1.6667, 50.0000, Per},
  1475. X    {6.5000, 6.8000, 50.0000, Lyn},
  1476. X    {23.3333, 24.0000, 50.0000, Cas},
  1477. X    {13.5000, 14.0333, 48.5000, UMa},
  1478. X    {0.0000, 1.1167, 48.0000, Cas},
  1479. X    {23.5833, 24.0000, 48.0000, Cas},
  1480. X    {18.1750, 18.2333, 47.5000, Her},
  1481. X    {18.2333, 19.0833, 47.5000, Dra},
  1482. X    {19.0833, 19.1667, 47.5000, Cyg},
  1483. X    {1.6667, 2.0417, 47.0000, Per},
  1484. X    {8.4167, 9.1667, 47.0000, UMa},
  1485. X    {0.1667, 0.8667, 46.0000, Cas},
  1486. X    {12.0000, 12.0833, 45.0000, UMa},
  1487. X    {6.8000, 7.3667, 44.5000, Lyn},
  1488. X    {21.9083, 21.9667, 44.0000, Cyg},
  1489. X    {21.8750, 21.9083, 43.7500, Cyg},
  1490. X    {19.1667, 19.4000, 43.5000, Cyg},
  1491. X    {9.1667, 10.1667, 42.0000, UMa},
  1492. X    {10.1667, 10.7833, 40.0000, UMa},
  1493. X    {15.4333, 15.7500, 40.0000, Boo},
  1494. X    {15.7500, 16.3333, 40.0000, Her},
  1495. X    {9.2500, 9.5833, 39.7500, Lyn},
  1496. X    {0.0000, 2.5167, 36.7500, And},
  1497. X    {2.5167, 2.5667, 36.7500, Per},
  1498. X    {19.3583, 19.4000, 36.5000, Lyr},
  1499. X    {4.5000, 4.6917, 36.0000, Per},
  1500. X    {21.7333, 21.8750, 36.0000, Cyg},
  1501. X    {21.8750, 22.0000, 36.0000, Lac},
  1502. X    {6.5333, 7.3667, 35.5000, Aur},
  1503. X    {7.3667, 7.7500, 35.5000, Lyn},
  1504. X    {0.0000, 2.0000, 35.0000, And},
  1505. X    {22.0000, 22.8167, 35.0000, Lac},
  1506. X    {22.8167, 22.8667, 34.5000, Lac},
  1507. X    {22.8667, 23.5000, 34.5000, And},
  1508. X    {2.5667, 2.7167, 34.0000, Per},
  1509. X    {10.7833, 11.0000, 34.0000, UMa},
  1510. X    {12.0000, 12.3333, 34.0000, CVn},
  1511. X    {7.7500, 9.2500, 33.5000, Lyn},
  1512. X    {9.2500, 9.8833, 33.5000, LMi},
  1513. X    {0.7167, 1.4083, 33.0000, And},
  1514. X    {15.1833, 15.4333, 33.0000, Boo},
  1515. X    {23.5000, 23.7500, 32.0833, And},
  1516. X    {12.3333, 13.2500, 32.0000, CVn},
  1517. X    {23.7500, 24.0000, 31.3333, And},
  1518. X    {13.9583, 14.0333, 30.7500, CVn},
  1519. X    {2.4167, 2.7167, 30.6667, Tri},
  1520. X    {2.7167, 4.5000, 30.6667, Per},
  1521. X    {4.5000, 4.7500, 30.0000, Aur},
  1522. X    {18.1750, 19.3583, 30.0000, Lyr},
  1523. X    {11.0000, 12.0000, 29.0000, UMa},
  1524. X    {19.6667, 20.9167, 29.0000, Cyg},
  1525. X    {4.7500, 5.8833, 28.5000, Aur},
  1526. X    {9.8833, 10.5000, 28.5000, LMi},
  1527. X    {13.2500, 13.9583, 28.5000, CVn},
  1528. X    {0.0000, 0.0667, 28.0000, And},
  1529. X    {1.4083, 1.6667, 28.0000, Tri},
  1530. X    {5.8833, 6.5333, 28.0000, Aur},
  1531. X    {7.8833, 8.0000, 28.0000, Gem},
  1532. X    {20.9167, 21.7333, 28.0000, Cyg},
  1533. X    {19.2583, 19.6667, 27.5000, Cyg},
  1534. X    {1.9167, 2.4167, 27.2500, Tri},
  1535. X    {16.1667, 16.3333, 27.0000, CrB},
  1536. X    {15.0833, 15.1833, 26.0000, Boo},
  1537. X    {15.1833, 16.1667, 26.0000, CrB},
  1538. X    {18.3667, 18.8667, 26.0000, Lyr},
  1539. X    {10.7500, 11.0000, 25.5000, LMi},
  1540. X    {18.8667, 19.2583, 25.5000, Lyr},
  1541. X    {1.6667, 1.9167, 25.0000, Tri},
  1542. X    {0.7167, 0.8500, 23.7500, Psc},
  1543. X    {10.5000, 10.7500, 23.5000, LMi},
  1544. X    {21.2500, 21.4167, 23.5000, Vul},
  1545. X    {5.7000, 5.8833, 22.8333, Tau},
  1546. X    {0.0667, 0.1417, 22.0000, And},
  1547. X    {15.9167, 16.0333, 22.0000, Ser},
  1548. X    {5.8833, 6.2167, 21.5000, Gem},
  1549. X    {19.8333, 20.2500, 21.2500, Vul},
  1550. X    {18.8667, 19.2500, 21.0833, Vul},
  1551. X    {0.1417, 0.8500, 21.0000, And},
  1552. X    {20.2500, 20.5667, 20.5000, Vul},
  1553. X    {7.8083, 7.8833, 20.0000, Gem},
  1554. X    {20.5667, 21.2500, 19.5000, Vul},
  1555. X    {19.2500, 19.8333, 19.1667, Vul},
  1556. X    {3.2833, 3.3667, 19.0000, Ari},
  1557. X    {18.8667, 19.0000, 18.5000, Sge},
  1558. X    {5.7000, 5.7667, 18.0000, Ori},
  1559. X    {6.2167, 6.3083, 17.5000, Gem},
  1560. X    {19.0000, 19.8333, 16.1667, Sge},
  1561. X    {4.9667, 5.3333, 16.0000, Tau},
  1562. X    {15.9167, 16.0833, 16.0000, Her},
  1563. X    {19.8333, 20.2500, 15.7500, Sge},
  1564. X    {4.6167, 4.9667, 15.5000, Tau},
  1565. X    {5.3333, 5.6000, 15.5000, Tau},
  1566. X    {12.8333, 13.5000, 15.0000, Com},
  1567. X    {17.2500, 18.2500, 14.3333, Her},
  1568. X    {11.8667, 12.8333, 14.0000, Com},
  1569. X    {7.5000, 7.8083, 13.5000, Gem},
  1570. X    {16.7500, 17.2500, 12.8333, Her},
  1571. X    {0.0000, 0.1417, 12.5000, Peg},
  1572. X    {5.6000, 5.7667, 12.5000, Tau},
  1573. X    {7.0000, 7.5000, 12.5000, Gem},
  1574. X    {21.1167, 21.3333, 12.5000, Peg},
  1575. X    {6.3083, 6.9333, 12.0000, Gem},
  1576. X    {18.2500, 18.8667, 12.0000, Her},
  1577. X    {20.8750, 21.0500, 11.8333, Del},
  1578. X    {21.0500, 21.1167, 11.8333, Peg},
  1579. X    {11.5167, 11.8667, 11.0000, Leo},
  1580. X    {6.2417, 6.3083, 10.0000, Ori},
  1581. X    {6.9333, 7.0000, 10.0000, Gem},
  1582. X    {7.8083, 7.9250, 10.0000, Cnc},
  1583. X    {23.8333, 24.0000, 10.0000, Peg},
  1584. X    {1.6667, 3.2833,  9.9167, Ari},
  1585. X    {20.1417, 20.3000,  8.5000, Del},
  1586. X    {13.5000, 15.0833,  8.0000, Boo},
  1587. X    {22.7500, 23.8333,  7.5000, Peg},
  1588. X    {7.9250, 9.2500,  7.0000, Cnc},
  1589. X    {9.2500, 10.7500,  7.0000, Leo},
  1590. X    {18.2500, 18.6622,  6.2500, Oph},
  1591. X    {18.6622, 18.8667,  6.2500, Aql},
  1592. X    {20.8333, 20.8750,  6.0000, Del},
  1593. X    {7.0000, 7.0167,  5.5000, CMi},
  1594. X    {18.2500, 18.4250,  4.5000, Ser},
  1595. X    {16.0833, 16.7500,  4.0000, Her},
  1596. X    {18.2500, 18.4250,  3.0000, Oph},
  1597. X    {21.4667, 21.6667,  2.7500, Peg},
  1598. X    {0.0000, 2.0000,  2.0000, Psc},
  1599. X    {18.5833, 18.8667,  2.0000, Ser},
  1600. X    {20.3000, 20.8333,  2.0000, Del},
  1601. X    {20.8333, 21.3333,  2.0000, Equ},
  1602. X    {21.3333, 21.4667,  2.0000, Peg},
  1603. X    {22.0000, 22.7500,  2.0000, Peg},
  1604. X    {21.6667, 22.0000,  1.7500, Peg},
  1605. X    {7.0167, 7.2000,  1.5000, CMi},
  1606. X    {3.5833, 4.6167,  0.0000, Tau},
  1607. X    {4.6167, 4.6667,  0.0000, Ori},
  1608. X    {7.2000, 8.0833,  0.0000, CMi},
  1609. X    {14.6667, 15.0833,  0.0000, Vir},
  1610. X    {17.8333, 18.2500,  0.0000, Oph},
  1611. X    {2.6500, 3.2833, -1.7500, Cet},
  1612. X    {3.2833, 3.5833, -1.7500, Tau},
  1613. X    {15.0833, 16.2667, -3.2500, Ser},
  1614. X    {4.6667, 5.0833, -4.0000, Ori},
  1615. X    {5.8333, 6.2417, -4.0000, Ori},
  1616. X    {17.8333, 17.9667, -4.0000, Ser},
  1617. X    {18.2500, 18.5833, -4.0000, Ser},
  1618. X    {18.5833, 18.8667, -4.0000, Aql},
  1619. X    {22.7500, 23.8333, -4.0000, Psc},
  1620. X    {10.7500, 11.5167, -6.0000, Leo},
  1621. X    {11.5167, 11.8333, -6.0000, Vir},
  1622. X    {0.0000, 0.3333, -7.0000, Psc},
  1623. X    {23.8333, 24.0000, -7.0000, Psc},
  1624. X    {14.2500, 14.6667, -8.0000, Vir},
  1625. X    {15.9167, 16.2667, -8.0000, Oph},
  1626. X    {20.0000, 20.5333, -9.0000, Aql},
  1627. X    {21.3333, 21.8667, -9.0000, Aqr},
  1628. X    {17.1667, 17.9667, -10.0000, Oph},
  1629. X    {5.8333, 8.0833, -11.0000, Mon},
  1630. X    {4.9167, 5.0833, -11.0000, Eri},
  1631. X    {5.0833, 5.8333, -11.0000, Ori},
  1632. X    {8.0833, 8.3667, -11.0000, Hya},
  1633. X    {9.5833, 10.7500, -11.0000, Sex},
  1634. X    {11.8333, 12.8333, -11.0000, Vir},
  1635. X    {17.5833, 17.6667, -11.6667, Oph},
  1636. X    {18.8667, 20.0000, -12.0333, Aql},
  1637. X    {4.8333, 4.9167, -14.5000, Eri},
  1638. X    {20.5333, 21.3333, -15.0000, Aqr},
  1639. X    {17.1667, 18.2500, -16.0000, Ser},
  1640. X    {18.2500, 18.8667, -16.0000, Sct},
  1641. X    {8.3667, 8.5833, -17.0000, Hya},
  1642. X    {16.2667, 16.3750, -18.2500, Oph},
  1643. X    {8.5833, 9.0833, -19.0000, Hya},
  1644. X    {10.7500, 10.8333, -19.0000, Crt},
  1645. X    {16.2667, 16.3750, -19.2500, Oph},
  1646. X    {15.6667, 15.9167, -20.0000, Lib},
  1647. X    {12.5833, 12.8333, -22.0000, Crv},
  1648. SHAR_EOF
  1649. true || echo 'restore of constel.c failed'
  1650. fi
  1651. echo 'End of  part 2'
  1652. echo 'File constel.c is continued in part 3'
  1653. echo 3 > _shar_seq_.tmp
  1654. exit 0
  1655. -- 
  1656. --
  1657. Molecular Simulations, Inc.            mail: dcmartin@msi.com
  1658. 796 N. Pastoria Avenue                uucp: uunet!dcmartin
  1659. Sunnyvale, California 94086            at&t: 408/522-9236
  1660.