home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume11 / ephem4.13 / part01 next >
Encoding:
Text File  |  1990-04-06  |  57.3 KB  |  2,226 lines

  1. Newsgroups: comp.sources.misc
  2. subject: v11i100: upgrade kit for ephem 4.12 to 4.13
  3. From: ecd@cs.umn.edu@ncs-med.UUCP (Elwood C. Downey)
  4. Sender: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
  5.  
  6. Posting-number: Volume 11, Issue 100
  7. Submitted-by: ecd@cs.umn.edu@ncs-med.UUCP (Elwood C. Downey)
  8. Archive-name: ephem4.13/part01
  9.  
  10. [Invasion of the non-context diffs!  ++bsa]
  11.  
  12. Here is an update to ephem, my interactive astronomical ephemeris program.
  13. It converts v4.12 to v4.13. The changes include:
  14.  
  15.     add support for second user-defined object, "object y".
  16.     fix bug updating object x reference epoch (always used PARABOLIC's).
  17.     fix Turbo C workaround that prevented plotting sun distance.
  18.     fix bug preventing searching on separation column for objx.
  19.     revamp elliptical object definition parameters to match Astro Almanac.
  20.     permit exiting/redrawing properly from within a popup too.
  21.     add a bit more precision to plot labels.
  22.     let plot files have comments too, ie, leading *'s
  23.     add separate database and "Lookup" facility for objects.
  24.     catch SIGFPE and longjmp() back into main interation loop on errors.
  25.     add magnitude to fixed-object database fields.
  26.  
  27. This update is basically a "diff -e" between 4.12 and 4.13. To use this upgrade
  28. kit:
  29.     put all the original source to 4.12 into a directory.
  30.     extract the included shell archive to create:
  31.     Ephem_4.12-13
  32.     ephem.db
  33.     ell_e-ephem
  34.     par_e-ephem
  35.     sac-ephem
  36.     star-ephem
  37.     run the upgrade script:
  38.     sh < Ephem_4.12-13
  39.     this will make all the necessary changes IN PLACE. then you should
  40.     rebuild ephem, keeping the same site configuration changes in mind you
  41.     made when you built 4.12.
  42.  
  43. Note the new database file, ephem.db. This is a new feature that contains
  44. objects ephem uses to set up the used defined objects. You may modify the
  45. list as desired. To assist with this, I have also included four simple
  46. awk-based scripts that will convert from several popular formats into
  47. the form needed by ephem.db. ell_e-ephem and par_e-ephem convert
  48. starchart/observe elliptical and parabolic objects (*.ell_e and *.par_e
  49. files), sac-ephem converts from the Saguaro Astronomy Club deep-sky
  50. database, and star-ephem converts from the Yale.star database.
  51.  
  52. Good luck, enjoy, and please contact me if you have any problems,
  53. suggestions, or comments.
  54.  
  55. Elwood Downey
  56. 612-936-8508
  57. {most any university}!umn-cs!ncs-med!ecd
  58. (umn-cs is U. of Minnesota, CS Dept)
  59. (sorry, no uunet address for me at ncs-med)
  60. -----------------------------------------------------------------------------
  61. # This is the first line of a "shell archive" file.
  62. # This means it contains several files that can be extracted into
  63. # the current directory when run with the sh shell, as follows:
  64. #    sh < this_file_name
  65. # This is file 1.
  66. echo x Ephem_4.12-13
  67. sed -e 's/^X//' << 'EOFxEOF' > D
  68. Xed - Man.txt << '-*-END-*-'
  69. X1565,1575c
  70. X
  71. X
  72. X.
  73. X1554,1563d
  74. X1552d
  75. X1527,1548d
  76. X1525d
  77. X1522d
  78. X1471,1492c
  79. X
  80. X.
  81. X1469d
  82. X1437,1458d
  83. X1434a
  84. X                                       - 24 -
  85. X.
  86. X1397a
  87. X     add search criteria for database objects.
  88. X.
  89. X1381,1392d
  90. X1358,1359d
  91. X1356c
  92. X                                       - 23 -
  93. X.
  94. X1352,1354d
  95. X1349d
  96. X1347d
  97. X1345d
  98. X1339,1343d
  99. X1335,1337d
  100. X1333d
  101. X1331d
  102. X1329d
  103. X1327d
  104. X1325a
  105. X     n    is a number between -23 to 24 indicating the number of hours that are
  106. X          subtracted from GMT to obtain local standard time;
  107. X.
  108. X1324c
  109. X     SSS  is the 3-letter abbreviation for the local standard timezone;
  110. X.
  111. X1322a
  112. X     where
  113. X.
  114. X1321a
  115. X          set TZ=SSSnDDD
  116. X.
  117. X1320a
  118. X     Before running ephem, you should set a DOS environment variable, TZ.  It
  119. X     is is used to establish the timezone name and hours offset whenever the
  120. X     "Now" shorthand is used from ephem, either from the configuration startup
  121. X     file or whenever any time field is changed manually.  Set it in the
  122. X     following form:
  123. X.
  124. X1319a
  125. X     12.1.  Setting TZ
  126. X.
  127. X1318a
  128. X     The distribution floppy contains five files:
  129. X     README describes last minute items and details of this release.
  130. X     MAN.TXT is this manual, hopefully formatted and printable on most any
  131. X     printer.
  132. X     EPHEM.EXE is the executable program.
  133. X     EPHEM.CFG is a sample configuration file.
  134. X     EPHEM.DB is a sample database.
  135. X     To run the program, make working copies of these files in a directory and
  136. X     run "ephem" from that directory.
  137. X.
  138. X1317a
  139. X     You must be running DOS V2.0 or later, though somewhere between V2.0 and
  140. X     V3.21 the behavior of control-c to terminate the program was fixed.  An
  141. X     8087 floating point chip will be used if present.
  142. X.
  143. X1316a
  144. X     12.  DOS Installation Procedure
  145. X.
  146. X1315a
  147. X     The maximum file name length is 14 characters.
  148. X.
  149. X1314a
  150. X     No more than 10 lines may be plotted at once.
  151. X.
  152. X1303a
  153. X
  154. X
  155. X
  156. X
  157. X
  158. X
  159. X
  160. X
  161. X                                       - 22 -
  162. X
  163. X
  164. X     Beware of specifying a year of 0, or of computing with the user-defined
  165. X     objects before they are properly defined. These conditions can cause ephem
  166. X     to blow.
  167. X
  168. X.
  169. X1292,1293c
  170. X     traditional K&R C compilers and the search functions seem to be are far
  171. X     more stable.
  172. X.
  173. X1287,1288c
  174. X     used TDT but I have not yet decided on a suitable algorithm.  Allowing for
  175. X     this manually, (see the Wish List section) comparisons with the
  176. X     Astronomical Almanac are often within a few arcseconds.
  177. X.
  178. X1258,1260d
  179. X1256a
  180. X     Similarly, ephem's searching techniques are not good for eclipses because
  181. X     the moon and sun are close every month; the trick is sorting through the
  182. X     frequent conjunctions for ones that are particularly close. One needs a
  183. X     way of establishing an envelope fit to the local extrema of a cyclic
  184. X     function in order to find a more global extreme.
  185. X.
  186. X1255a
  187. X     first use the plotting or watching facility of ephem to get a broad
  188. X     picture of the general circumstances then use ephem's search facility to
  189. X     refine a given region (or create and inspect a plot file and do your own
  190. X     interpolation directly from it separately).
  191. X.
  192. X1253a
  193. X                                       - 21 -
  194. X.
  195. X1241,1245d
  196. X1236,1239d
  197. X1194a
  198. X     To try the former approach select Search, select "Find 0", specify the
  199. X.
  200. X1193a
  201. X     As an example, let's find when Pluto again becomes the furthest planet
  202. X     from Sol.  You may find when the difference in their sun distance is zero,
  203. X     or you might use a binary search on the condition that Pluto's sun
  204. X     distance is larger then Neptune's.
  205. X.
  206. X1192c
  207. X     10.7.  Example Searches
  208. X.
  209. X1190a
  210. X     If searching is on, this option will also appear on the quick-choice menu
  211. X     and may be selected to turn off the search.
  212. X.
  213. X1189a
  214. X     10.6.  Stop
  215. X.
  216. X1187a
  217. X                                       - 20 -
  218. X.
  219. X1182d
  220. X1177,1180d
  221. X1175d
  222. X1172,1173d
  223. X1170d
  224. X1118,1128d
  225. X1104a
  226. X
  227. X
  228. X
  229. X
  230. X
  231. X
  232. X                                       - 19 -
  233. X
  234. X
  235. X.
  236. X1077,1079c
  237. X     be unique; use "x" or "y" for the user-specified object X or Y.  The
  238. X     column_name is from the following table, depending on which menu is up. In
  239. X     all cases additional characters may be entered but are ignored.
  240. X.
  241. X1052,1062d
  242. X1036a
  243. X
  244. X
  245. X
  246. X
  247. X
  248. X
  249. X
  250. X
  251. X
  252. X                                       - 18 -
  253. X
  254. X
  255. X.
  256. X996a
  257. X     You may set NStep to be quite large and let ephem search unattended or set
  258. X.
  259. X995a
  260. X     Ephem can search for arbitrary conditions to exist among most displayed
  261. X     fields.  You first enter a function, then select from among three forms of
  262. X     equation solvers to iteratively solve for the next time when the function
  263. X     meets the requirements of the solver. The solver selects the next time for
  264. X     which it wants the function evaluated and sets StpSz so that the next
  265. X     iteration will occur at that time. The solvers continue to iterate until
  266. X     either they achieve their goal or NStep reaches 0.
  267. X.
  268. X994c
  269. X     10.  Searching
  270. X.
  271. X992a
  272. X     When you return to the main menu, the last watched time will be maintained
  273. X     as the current time.  The StpSz is not changed.
  274. X.
  275. X990a
  276. X                                       - 17 -
  277. X.
  278. X984d
  279. X976,982d
  280. X974d
  281. X971,972d
  282. X952,955c
  283. X     to roughly fill the screen according to the outer-most active planet.  The
  284. X     screen transformation assumes a screen aspect width/height ratio of 4/3.
  285. X     Down the left column of the screen is the heliocentric altitude of the
  286. X     planet above or below the ecliptic, drawn to the same scale as the
  287. X.
  288. X938c
  289. X     9.2.  Sky
  290. X.
  291. X930a
  292. X
  293. X.
  294. X929a
  295. X     Select: Sky, Solar system, No trails
  296. X.
  297. X928c
  298. X     You may generate a simple drawing on the screen of the sky or the solar
  299. X     system by selecting "Watch".  It will bring up a quick-choice menu as
  300. X     follows:
  301. X.
  302. X926a
  303. X     9.  Watching
  304. X.
  305. X925a
  306. X     Note that due to internal buffering the plot file will not be completely
  307. X     written to disk until plotting is turned off.
  308. X.
  309. X924a
  310. X     by selecting "Begin plotting" again.
  311. X.
  312. X922a
  313. X                                       - 16 -
  314. X.
  315. X917d
  316. X913,915d
  317. X911d
  318. X908,909d
  319. X906d
  320. X853,864d
  321. X839a
  322. X
  323. X
  324. X
  325. X
  326. X
  327. X
  328. X
  329. X
  330. X                                       - 15 -
  331. X
  332. X
  333. X.
  334. X810a
  335. X     7.2.  Database File
  336. X
  337. X     You may save a list of objects in a file to be used for setting OBJX and
  338. X     OBJY. The default name of this file is ephem.db. You may also set it from
  339. X     the command line with the -d option, or set it with the EPHEMDB
  340. X     environment variable.
  341. X
  342. X     The file consists of one object per line. Lines that begin with an
  343. X     asterisk (*) are ignored.  Each line contains several fields, each
  344. X     separated by a comma.  The first field is the name of the object.  The
  345. X     second field is the type of the object, that is, one of the strings
  346. X     "fixed", "elliptical", or "parabolic"; actually, "f", "e" and "p" are
  347. X     sufficient.  The remaining fields depend on the type of object.  They are
  348. X     exactly the same parameters, and in the same order, as ephem asks for when
  349. X     defining the object from the menu.
  350. X
  351. X.
  352. X809c
  353. X     Off the object-X or Y row of information will be erased.
  354. X.
  355. X804a
  356. X
  357. X
  358. X
  359. X
  360. X                                       - 14 -
  361. X
  362. X
  363. X     becomes the current type.
  364. X
  365. X     7.1.5.  On or Off
  366. X
  367. X.
  368. X803d
  369. X799,801d
  370. X796d
  371. X794a
  372. X     If successful, the cursor will move to the type of the new object and it
  373. X.
  374. X793a
  375. X     This option lets you define an object from any of those listed in the
  376. X     database file, described in a subsequent section.
  377. X.
  378. X792a
  379. X     7.1.4.  Lookup
  380. X.
  381. X791a
  382. X     Note that this model does not take into account the phase angle of
  383. X     sunlight on the comet.
  384. X.
  385. X790a
  386. X         m = g + 5*log10(D) + 2.5*k*log10(r)
  387. X       where:
  388. X         m  is the resulting visual magnitude;
  389. X         g  is the absolute visual magnitude;
  390. X         D  is the comet-earth distance, in AU;
  391. X         k  is the luminosity index; and
  392. X         r  is the comet-sun distance.
  393. X.
  394. X789a
  395. X     A simple magnitude model is used to estimate the brightness of comets.
  396. X     This model requires two parameters to be specified.  One, the absolute
  397. X     magnitude, is the visual magnitude of the comet if it were one AU from
  398. X     both the sun and the earth, denoted g.  The other, the luminosity index,
  399. X     characterizes the brightness change of the comet as a function of its
  400. X     distance from the sun, denoted k.  The model may be expressed as:
  401. X.
  402. X787a
  403. X     epoch of perihelion,
  404. X     inclination,
  405. X     argument of perihelion,
  406. X     perihelion distance,
  407. X     longitude of the ascending node,
  408. X     and the reference epoch of the parameters.
  409. X     absolute magnitude, g
  410. X     luminosity index coefficients, k
  411. X.
  412. X785,786c
  413. X     These orbital parameters are, in order:
  414. X.
  415. X782a
  416. X
  417. X     You might have other parameters available that can be converted into
  418. X     these.  For example, we have the following relationships:
  419. X
  420. X
  421. X
  422. X
  423. X
  424. X
  425. X
  426. X
  427. X
  428. X
  429. X
  430. X
  431. X
  432. X
  433. X                                       - 13 -
  434. X
  435. X
  436. X             P = sqrt(a*a*a)
  437. X             p = O + o
  438. X             n = 360/days_per_year/P ~ 0.98563/P
  439. X             T = E - M/n
  440. X             q = a*(1-e)
  441. X         where
  442. X             P = the orbital period, years;
  443. X             p = longitude of perihelion, degrees
  444. X             n = daily motion, degrees per day;
  445. X             T = epoch of perihelion (add multiples of P for desired range)
  446. X             q = perihelion distance, AU
  447. X
  448. X     Note that if you know T you can then set E = T and M = 0.
  449. X
  450. X     7.1.3.  Parabolic
  451. X
  452. X.
  453. X781c
  454. X             i = inclination, degrees
  455. X             O = longitude of ascending node, degrees
  456. X             o = argument of perihelion, degrees
  457. X             a = mean distance (aka semi-major axis), AU
  458. X             n = daily motion, degrees per day
  459. X             e = eccentricity,
  460. X             M = mean anomaly (ie, degrees from perihelion),
  461. X             E = epoch date (ie, time of M),
  462. X             D = the equinox year (ie, time of i/O/o).
  463. X             H = absolute magnitude
  464. X             G = magnitude slope parameter.
  465. X.
  466. X776,779c
  467. X     These elements are the same ones often listed in the Astronomical Almanac.
  468. X     The elements are, in order:
  469. X.
  470. X774c
  471. X     This will begin a series of eleven prompts asking for the parameters that
  472. X.
  473. X772c
  474. X     7.1.2.  Elliptical
  475. X.
  476. X769,770c
  477. X     This selection will present a series of four prompts, one each for the RA,
  478. X     Dec, magnitude and the reference epoch for the coordinates of a fixed
  479. X     object.
  480. X.
  481. X767c
  482. X     7.1.1.  Fixed
  483. X.
  484. X749,750c
  485. X     define an object's position of such type, one parameter at a time.
  486. X
  487. X     You set the current object type and begin to view its parameters by
  488. X.
  489. X738,746d
  490. X736d
  491. X733,734c
  492. X                                       - 12 -
  493. X.
  494. X730d
  495. X722a
  496. X     When you first enter the quick-choice menu the cursor will start out
  497. X.
  498. X720a
  499. X     Select: Fixed, Elliptical, Parabolic, Lookup, On
  500. X.
  501. X718,719c
  502. X     To control the type and the corresponding details for object X or Y,
  503. X     select the corresponding row near the bottom.  (Remember that typing the
  504. X     character "x" or "y" is a shorthand way to move to the bottom rows.) It
  505. X     will bring up a quick-choice menu as follows:
  506. X.
  507. X710,716c
  508. X     7.1.  Controlling Object-X or Y Operation
  509. X.
  510. X703,708c
  511. X     The parameters for each type of object are stored separately, so you may
  512. X     switch between types of objects without losing parameters.
  513. X.
  514. X696,698c
  515. X     You may specify one or two extra objects for ephem to use. The objects may
  516. X     be defined in three different ways:  fixed celestial sphere coordinates,
  517. X     or heliocentric elliptical or parabolic orbital elements.  Elliptical
  518. X.
  519. X694c
  520. X     7.  User Defined Objects: X and Y
  521. X.
  522. X666a
  523. X     6.  Menu options
  524. X
  525. X     When you select "Menu" you can change among the three styles of bottom
  526. X     screens. There are also two options that can be set from the Menu quick-
  527. X.
  528. X663a
  529. X
  530. X
  531. X.
  532. X653,654d
  533. X651d
  534. X627,635d
  535. X625a
  536. X     OBJX=Austin
  537. X     OBJY=Ceres
  538. X.
  539. X623,624c
  540. X     PROPTS=TSMevmjsunpxy
  541. X     EPOCH=2000
  542. X.
  543. X612,614c
  544. X     UT=0:0:0
  545. X     UD=3/21/1990
  546. X.
  547. X601,604c
  548. X               exactly the set specified. This feature was added so that the
  549. X               command line version of using PROPTS could add to the set of
  550. X               planets giving in the configuration file.
  551. X     NSTEP     number of times program will loop before entering command mode.
  552. X               see the discussion under Program Operation.
  553. X     EPOCH     this sets the desired ra/dec precession epoch. you can put any
  554. X               date here or EOD to use the current instant ("Epoch of Date").
  555. X     OBJX
  556. X     OBJY      These fields specify the optional objects "x" and "y" by naming
  557. X               any item in the database file. The form is OBJX=xyz, where xyz
  558. X               must be in the database file, case sensitive.  You may define
  559. X               one object of each type for each of OBJX and OBJY; the last one
  560. X               defined will be the "current" one when ephem gets going.
  561. X.
  562. X574,588d
  563. X567a
  564. X                       y       circumstances for object Y
  565. X.
  566. X534c
  567. X     5.1.  Configuration File fields
  568. X     UD        initial UTC date, such as 10/20/1988, or "NOW" to use the
  569. X               computer clock.
  570. X.
  571. X532c
  572. X     Note:  because of the way unspecified time and date components are left
  573. X     unchanged (see section on Date and Time Formats) always specify the
  574. X     complete time and date for all entries in the configuration file. For
  575. X     example, to initialize the longitude to zero degrees, say 0:0:0, not just
  576. X     0.
  577. X.
  578. X530a
  579. X     Blank lines and lines that begin with an asterisk (*) or whitespace (space
  580. X     or tab) are ignored and may be used for comments.
  581. X.
  582. X529a
  583. X     assumed to start one character after the KEYWORD, regardless.
  584. X.
  585. X527a
  586. X                                       - 9 -
  587. X.
  588. X519,521d
  589. X513,517d
  590. X510,511d
  591. X508d
  592. X502c
  593. X     looks for a configuration file there with the name .ephemrc.
  594. X.
  595. X498c
  596. X         ephem -c <config_file>
  597. X.
  598. X494c
  599. X     You may have several different configuration files if you wish. By
  600. X.
  601. X458,468d
  602. X442a
  603. X
  604. X
  605. X
  606. X
  607. X
  608. X
  609. X
  610. X
  611. X
  612. X
  613. X                                       - 8 -
  614. X
  615. X
  616. X.
  617. X441a
  618. X     Unfortunately, with the format "ddd:mm", there is not enough room for a
  619. X     space between columns when the angle is at least 100 degrees.  To avoid
  620. X     this, I drop the minutes portion if the (rounded) angle is at least 100
  621. X     degrees.
  622. X.
  623. X417,425c
  624. X     Rise Time
  625. X     Rise Az       The local time and azimuth when the upper limb of the object
  626. X                   rises.
  627. X     Transit Time
  628. X     Transit Alt   The local time and altitude when the object crosses the
  629. X                   meridian, ie, when its azimuth is true south or, if no
  630. X                   precession, when the local sidereal time equals the object's
  631. X                   right ascension.
  632. X     Set Time
  633. X     Set Az        The local time and azimuth when the upper limb of the object
  634. X                   sets.
  635. X     Hours Up      The number of hours the object is up on the local date.
  636. X.
  637. X402a
  638. X     Elong(p)      spherical angular separation between sun and given object,
  639. X                   calculated from the their geocentric ecliptic coordinates.
  640. X                   Note this is not just difference in ecliptic longitude. The
  641. X                   sign, however, is simply sign(obj's longitude - sun's
  642. X                   longitude), ie, degrees east.  thus, a positive elongation
  643. X                   means the object rises after the sun.
  644. X.
  645. X399a
  646. X
  647. X.
  648. X384,389d
  649. X380c
  650. X     H Lat(p)      true heliocentric latitude, in degrees.
  651. X.
  652. X378c
  653. X     H Long(p)     true heliocentric longitude, in degrees.  Earth's is
  654. X.
  655. X362,364c
  656. X                   to set to epoch of date.
  657. X.
  658. X336a
  659. X     Plot          controls plotting; see complete discussion below.
  660. X     Menu          controls which menu is in the bottom half of the screen.
  661. X                   See their complete discussion below.
  662. X     LST(p)        the current local sidereal time.  set to "n" to set from
  663. X                   computer clock.
  664. X     Dawn(p)       local time when the sun is approximately 18 degrees below
  665. X                   the horizon before sunrise.
  666. X.
  667. X317,323d
  668. X277c
  669. X     The planets and two additional objects are displayed in a table in the
  670. X.
  671. X270a
  672. X     circumstances, the StpSz value is not added to the first loop.  Note also
  673. X     that after a series of loops, NStep is automatically reset to 1 so "q"
  674. X     will do exactly one loop and return you to command mode.
  675. X
  676. X     To quit the program, type control-d from command mode.  For a little more
  677. X     help, type ?.  The entire screen may be erased and redrawn with control-l.
  678. X
  679. X.
  680. X267d
  681. X257,258d
  682. X253,255d
  683. X244,247c
  684. X     typing one of the characters SMevmjsunpxy.  To avoid conflict with j,
  685. X     jupiter's row must actually be typed as control-j.  "x" and "y" are for
  686. X     the user-defined objects X and y on the bottom rows.  Also, the characters
  687. X     d, o and z move you to the UT Date, Epoch and StpSz fields immediately, if
  688. X     appropriate.
  689. X.
  690. X209,216c
  691. X     several fields.  If OBJX or OBJY is set then a database file is also
  692. X     accessed.  The default configuration file name is ephem.cfg (or .ephemrc
  693. X     if the HOME environment variable directory if set).  The default database
  694. X     file name is ephem.db.  The exact format of these files is described
  695. X     below.  Then ephem processes any additional command line arguments exactly
  696. X     as if they too came from the configuration file.  (See the later section
  697. X     on this manual for a description of the possible entries.) It then draws
  698. X     all fields on the screen with their initial values.  The program then
  699. X     loops advancing time each step, by some amount you may control, and
  700. X     updating all fields each loop.
  701. X.
  702. X204a
  703. X         ephem [-c <config_file>] [-d <database_file>] [field=value  ...]
  704. X
  705. X
  706. X.
  707. X192d
  708. X188,190c
  709. X     To run ephem, just type "ephem".  You may also specify an alternate
  710. X     configuration file, an alternate database file, and specify initial values
  711. X     for several screen fields.  The command line syntax can be summarized as
  712. X     follows:
  713. X.
  714. X167,168c
  715. X     One may watch the sky or the solar system with a simple screen-oriented
  716. X     display.
  717. X.
  718. X141,144c
  719. X     Ephem is a program that displays ephemerides for all the planets plus any
  720. X     two additional objects.  The additional objects may be fixed or specified
  721. X     via heliocentric elliptical or parabolic orbital elements to accommodate
  722. X     solar system objects such as comets or asteroids.
  723. X.
  724. X134,135d
  725. X73,77c
  726. X      10.9.  Caution ..................................................... 20
  727. X      11.  Implementation Notes .......................................... 21
  728. X      11.1.  Program limits .............................................. 22
  729. X      12.  DOS Installation Procedure .................................... 22
  730. X      12.1.  Setting TZ .................................................. 22
  731. X      13.  Wish List ..................................................... 23
  732. X      14.  Sample Screens ................................................ 24
  733. X.
  734. X30,60c
  735. X      7.  User Defined Objects: X and Y .................................. 11
  736. X      7.1.  Controlling Object-X or Y Operation .......................... 11
  737. X      7.1.1.  Fixed ...................................................... 12
  738. X      7.1.2.  Elliptical ................................................. 12
  739. X      7.1.3.  Parabolic .................................................. 13
  740. X      7.1.4.  Lookup ..................................................... 13
  741. X      7.1.5.  On or Off .................................................. 14
  742. X      7.2.  Database File ................................................ 14
  743. X      8.  Plotting ....................................................... 14
  744. X      8.1.  Defining plot fields ......................................... 15
  745. X      8.2.  Displaying a plot file ....................................... 15
  746. X      8.3.  Cartesian or Polar coords .................................... 15
  747. X      8.4.  Begin Plotting ............................................... 15
  748. X      8.5.  Stopping Plotting ............................................ 15
  749. X      9.  Watching ....................................................... 16
  750. X      9.1.  Trails ....................................................... 16
  751. X      9.2.  Sky .......................................................... 16
  752. X      9.3.  Solar System ................................................. 16
  753. X      10.  Searching ..................................................... 17
  754. X      10.1.  Find extreme ................................................ 17
  755. X      10.2.  Find 0 ...................................................... 17
  756. X      10.3.  Binary ...................................................... 17
  757. X      10.4.  Define a New function ....................................... 18
  758. X      10.4.1.  Intrinsic functions ....................................... 18
  759. X      10.4.2.  Field Specifiers .......................................... 18
  760. X      10.4.3.  Constants ................................................. 19
  761. X      10.4.4.  Operators ................................................. 19
  762. X      10.5.  Specifying Search Accuracy .................................. 19
  763. X      10.6.  Stop ........................................................ 20
  764. X      10.7.  Example Searches ............................................ 20
  765. X      10.8.  Another Example ............................................. 20
  766. X.
  767. X27c
  768. X      6.  Menu options ................................................... 11
  769. X.
  770. X25c
  771. X      5.1.  Configuration File fields ....................................  9
  772. X.
  773. X23c
  774. X      4.  Date and Time Formats ..........................................  8
  775. X.
  776. X7c
  777. X                            Ephem V4.13 - April 3, 1990
  778. X.
  779. Xw
  780. Xq
  781. X-*-END-*-
  782. Xed - Readme << '-*-END-*-'
  783. X73,75c
  784. X   will have to hand add string.h or your own extern declarations.
  785. X.
  786. X31,45d
  787. X10c
  788. X2) changes from 4.10 to 4.12:
  789. X.
  790. X8c
  791. X1) changes from 4.12 to 4.13:
  792. X    add support for second user-defined object, "object y"
  793. X    fix bug updating object x reference epoch (always used PARABOLIC's)
  794. X    fix Turbo C workaround that prevented plotting sun distance.
  795. X    fix bug preventing searching on separation column for objx.
  796. X    revamp elliptical object definition parameters to match Astro Almanac.
  797. X    permit exiting/redrawing properly from within a popup too.
  798. X    add a bit more precision to plot labels.
  799. X    let plot files have comments too, ie, leading *'s
  800. X    add separate database and "Lookup" facility for objects.
  801. X    catch SIGFPE and longjmp() back into main interation loop on errors.
  802. X    add magnitude to fixed-object database fields.
  803. X.
  804. X1c
  805. XGeneral Notes for version 4.13:
  806. X.
  807. Xw
  808. Xq
  809. X-*-END-*-
  810. Xed - altmenus.c << '-*-END-*-'
  811. X388,389c
  812. X        sep = acos(spy*sin(*qy) + cpy*cos(*qy)*cos(px-*qx));
  813. X        dsep = raddeg(sep);
  814. X        if (dsep >= (100.0 - 1.0/60.0/2.0))
  815. X            f_int (row, bodycol[q], "%5d:", dsep);
  816. X        else
  817. X            f_angle (row, bodycol[q], sep);
  818. X.
  819. X385,386c
  820. X        if (q != p && (q != OBJX || wantx) && (q != OBJY || wanty)) {
  821. X        double sep, dsep;
  822. X.
  823. X364c
  824. X    int wantx = obj_ison(OBJX);
  825. X    int wanty = obj_ison(OBJY);
  826. X.
  827. X352a
  828. X * we are limited to only 5 columns per object. to make it fit, we display
  829. X *   degrees:minutes if less than 100 degrees, otherwise just whole degrees.
  830. X.
  831. X271,272c
  832. X    /* always recalc OBJX and Y since we don't know it's the same object */
  833. X    if (!riset_cir (p, np, p==OBJX || p==OBJY, alt2_stdhzn?STDHZN:ADPHZN,
  834. X        <r, <s, <t, &azr, &azs, &altt, &status) && !force)
  835. X.
  836. X249,250c
  837. X        f_int (row, col, "%3d", sky.s_phase);
  838. X.
  839. X241d
  840. X237,238c
  841. X        f_double (row, C_MAG, (p==MOON||p==SUN)?"%4.0f":"%4.1f",
  842. X.
  843. X234c
  844. X        if (p != OBJX && p != OBJY)
  845. X.
  846. X196,198c
  847. X    f_string (R_PLANTAB,    C_NEPTUNE,    " Nep");
  848. X    f_string (R_PLANTAB,    C_PLUTO,    "Pluto");
  849. X    f_string (R_PLANTAB,    C_OBJX,        "  X");
  850. X    f_string (R_PLANTAB,    C_OBJY,        "  Y");
  851. X.
  852. X188,194c
  853. X    f_string (R_PLANTAB,    C_SUN,        " Sun");
  854. X    f_string (R_PLANTAB,    C_MOON,        "Moon");
  855. X    f_string (R_PLANTAB,    C_MERCURY,    "Merc");
  856. X    f_string (R_PLANTAB,    C_VENUS,    "Venus");
  857. X    f_string (R_PLANTAB,    C_MARS,        "Mars");
  858. X    f_string (R_PLANTAB,    C_JUPITER,    " Jup");
  859. X    f_string (R_PLANTAB,    C_SATURN,    " Sat");
  860. X.
  861. X171,180c
  862. X    f_string (R_PLANTAB,    C_RISETM-2,    "Rise Time");
  863. X    f_string (R_PLANTAB,    C_RISEAZ,    "Rise Az");
  864. X    f_string (R_PLANTAB,    C_TRANSTM-2,    "Trans Time");
  865. X    f_string (R_PLANTAB,    C_TRANSALT-1,    "Trans Alt");
  866. X    f_string (R_PLANTAB,    C_SETTM-1,    "Set Time");
  867. X    f_string (R_PLANTAB,    C_SETAZ,    "Set Az");
  868. X    f_string (R_PLANTAB,    C_TUP-1,    "Hours Up");
  869. X.
  870. X163d
  871. X160d
  872. X158d
  873. X156d
  874. X154d
  875. X141,152c
  876. X    f_string (R_PLANTAB,    C_RA+2,    "R.A.");
  877. X    f_string (R_PLANTAB,    C_DEC+2,"Dec");
  878. X    f_string (R_PLANTAB,    C_AZ+2,    "Az");
  879. X    f_string (R_PLANTAB,    C_ALT+2,"Alt");
  880. X    f_string (R_PLANTAB,    C_HLONG,"H Long");
  881. X    f_string (R_PLANTAB,    C_HLAT,    "H Lat");
  882. X.
  883. X133c
  884. X        return (nxtpl[p]);
  885. X.
  886. X130c
  887. X    if (p < MERCURY || p >= NOBJ)
  888. X.
  889. X127c
  890. X        NEPTUNE, PLUTO, OBJX, MOON, MERCURY, OBJY, -1
  891. X.
  892. X122,123c
  893. Xnxtbody(p)
  894. Xint p;
  895. X.
  896. X23c
  897. X    C_URANUS, C_NEPTUNE, C_PLUTO, C_SUN, C_MOON, C_OBJX, C_OBJY
  898. X.
  899. X18c
  900. X    R_URANUS, R_NEPTUNE, R_PLUTO, R_SUN, R_MOON, R_OBJX, R_OBJY
  901. X.
  902. Xw
  903. Xq
  904. X-*-END-*-
  905. Xed - circum.c << '-*-END-*-'
  906. X139c
  907. X        (void) riset_cir (SUN,np,0,TWILIGHT,dawn,dusk,&x,&x,&x,&x,status);
  908. X.
  909. X95,96c
  910. X        /* obj_cir already returned the apparent magnitude */
  911. X        if (p != OBJX && p != OBJY)
  912. X.
  913. X92c
  914. X        sp->s_size = (p != OBJX && p != OBJY) ? dia/rho0 : 0.0;
  915. X.
  916. X68,69c
  917. X        if (p == OBJX || p == OBJY)
  918. X        obj_cir(mjd,p,&lpd0,&psi0,&rp0,&rho0,&lam,&bet,&sp->s_mag);
  919. X.
  920. X52c
  921. X    if (p != OBJX && p != OBJY && same_cir (np, &lp->l_now)
  922. X.
  923. X50c
  924. X     * ALWAYS redo objects x and y.
  925. X.
  926. X44a
  927. X    case OBJY: lp = &objylast; break;
  928. X.
  929. X35c
  930. X    Last objxlast, objylast;
  931. X.
  932. X16c
  933. X * we always recompute the user-defined objects' position regardless.
  934. X.
  935. X2c
  936. X *(the user defined objects are in obj.c)
  937. X.
  938. Xw
  939. Xq
  940. X-*-END-*-
  941. Xed - circum.h << '-*-END-*-'
  942. X5d
  943. Xw
  944. Xq
  945. X-*-END-*-
  946. Xed - compiler.c << '-*-END-*-'
  947. X538a
  948. X        break;
  949. X        case 'x':
  950. X                      c = C_OBJX;
  951. X        break;
  952. X        case 'y':
  953. X                      c = C_OBJY;
  954. X.
  955. X475a
  956. X        case 'y':
  957. X                    r = R_OBJY;
  958. X        break;
  959. X.
  960. Xw
  961. Xq
  962. X-*-END-*-
  963. Xed - ephem.cfg << '-*-END-*-'
  964. X15,22c
  965. XOBJX=Austin
  966. XOBJY=Vesta
  967. X.
  968. X11,12c
  969. XPROPTS=TSMevmjsunpxy
  970. XEPOCH=2000
  971. X.
  972. X1,2c
  973. XUT=0:0:0
  974. XUD=3/21/1990
  975. X.
  976. Xw
  977. Xq
  978. X-*-END-*-
  979. Xed - formats.c << '-*-END-*-'
  980. X186a
  981. X/* print the given double as a rounded int, with the given format.
  982. X * this is used to plot full precision, but display far less.
  983. X * N.B. wouldn't need this if Turbo-C 2.0 handled "%X.0f" correctly.
  984. X * N.B. caller beware that we really do expect fmt to refer to an int, not
  985. X *   a long for example. also beware of range that implies.
  986. X */
  987. Xf_int (row, col, fmt, f)
  988. Xint row, col;
  989. Xchar fmt[];
  990. Xdouble f;
  991. X{
  992. X    char str[80];
  993. X    int i;
  994. X
  995. X    (void) flog_log (row, col, f);
  996. X
  997. X    i = (f < 0) ? (int)(f-0.5) : (int)(f+0.5);
  998. X    sprintf (str, fmt, i);
  999. X    f_string (row, col, str);
  1000. X}
  1001. X
  1002. X.
  1003. Xw
  1004. Xq
  1005. X-*-END-*-
  1006. Xed - main.c << '-*-END-*-'
  1007. X779a
  1008. X        break;
  1009. X    case rcfpack (R_OBJY, C_OBJ, 0):
  1010. X        /* this might change which columns are used so erase all when
  1011. X         * returns and redraw if still on.
  1012. X         */
  1013. X        obj_setup (OBJY);
  1014. X        alt_nobody (OBJY);
  1015. X        if (obj_ison (OBJY)) {
  1016. X        oppl |= 1 << OBJY;
  1017. X        print_updating();
  1018. X        alt_body (OBJY, 1, &now);
  1019. X        } else
  1020. X        oppl &= ~(1 << OBJY);    /* already erased; just clear flag */
  1021. X.
  1022. X774c
  1023. X        if (obj_ison (OBJX)) {
  1024. X.
  1025. X772c
  1026. X        obj_setup (OBJX);
  1027. X.
  1028. X655c
  1029. X            (void) sscanf (bp, "%lf", &x);
  1030. X.
  1031. X618c
  1032. X        (void) sscanf (bp, "%lf", &pressure);
  1033. X.
  1034. X605c
  1035. X        (void) sscanf (bp, "%lf", &temp);
  1036. X.
  1037. X594c
  1038. X        (void) sscanf (bp, "%d", &nstep);
  1039. X.
  1040. X582c
  1041. X        (void) sscanf (bp, "%lf", &height);
  1042. X.
  1043. X342c
  1044. X        case 'x': oppl |= (1<<OBJX); obj_on(OBJX); break;
  1045. X        case 'y': oppl |= (1<<OBJY); obj_on(OBJY); break;
  1046. X.
  1047. X324c
  1048. X        obj_filelookup (OBJX, buf+5);
  1049. X    else if (strncmp ("OBJY", buf, 4) == 0)
  1050. X        obj_filelookup (OBJY, buf+5);
  1051. X.
  1052. X283,284c
  1053. X        char why[NC];
  1054. X        sprintf (why, "Bad command line spec: %.*s", sizeof(why)-26,fs);
  1055. X.
  1056. X233,271d
  1057. X228c
  1058. X    f_string (2, 1,
  1059. X        "usage: [-c <configfile>] [-d <database>] [field=value ...]\r\n");
  1060. X.
  1061. X221a
  1062. Xvoid
  1063. Xon_fpe()
  1064. X{
  1065. X    signal (SIGFPE, on_fpe);
  1066. X    f_msg ("Floating point error has occurred - computations aborted.");
  1067. X    longjmp (fpe_err_jmp, 1);
  1068. X}
  1069. X
  1070. X.
  1071. X220a
  1072. X/* this gets called when a floating point error occurs.
  1073. X * we force a jump back into main() with looping terminated.
  1074. X */
  1075. X.
  1076. X211c
  1077. X/* clean up and exit.
  1078. X.
  1079. X165a
  1080. X/* read in ephem's configuration file, if any.
  1081. X * if errors in file, call usage() (which exits).
  1082. X * if use -d, require it; else try ephem.cfg and $HOME/.ephemrc but don't
  1083. X *   complain if can't find these since, after all, one is not required.
  1084. X * skip blank lines and lines that begin with '#', '*', ' ' or '\t'.
  1085. X */
  1086. Xstatic
  1087. Xread_cfgfile()
  1088. X{
  1089. X    char buf[128];
  1090. X    char homefile[128];
  1091. X    FILE *fp;
  1092. X    char *fn;
  1093. X
  1094. X    /* open the config file. 
  1095. X     * only REQUIRED if used -d option.
  1096. X     * if succcessful, fn points to file name.
  1097. X     */
  1098. X    if (cfgfile) {
  1099. X        fn = cfgfile;
  1100. X        fp = fopen (fn, "r");
  1101. X        if (!fp) {
  1102. X        sprintf (buf, "Can not open %s", fn);
  1103. X        usage (buf);    /* does not return */
  1104. X        }
  1105. X    }
  1106. X    fn = cfgdef;
  1107. X    fp = fopen (fn, "r");
  1108. X    if (!fp) {
  1109. X        fn = getenv ("HOME");
  1110. X        if (fn) {
  1111. X        sprintf (homefile, "%s/.ephemrc", fn);
  1112. X        fn = homefile;
  1113. X        fp = fopen (fn, "r");
  1114. X        }
  1115. X    }
  1116. X    if (!fp)
  1117. X        return;    /* oh well; after all, it's not required */
  1118. X
  1119. X    while (fgets (buf, sizeof(buf), fp)) {
  1120. X        switch (buf[0]) {
  1121. X        case '#': case '*': case ' ': case '\t': case '\n':
  1122. X        continue;
  1123. X        }
  1124. X        buf[strlen(buf)-1] = '\0';        /* discard trailing \n */
  1125. X        if (crack_fieldset (buf) < 0) {
  1126. X        char why[NC];
  1127. X        sprintf (why, "Bad field spec in %s: %s\n", fn, buf);
  1128. X        usage (why);
  1129. X        }
  1130. X    }
  1131. X    fclose (fp);
  1132. X}
  1133. X
  1134. X
  1135. X.
  1136. X118a
  1137. X        /* if get a floating error, longjmp() here and stop looping */
  1138. X        if (setjmp (fpe_err_jmp))
  1139. X        nstep = 0;
  1140. X
  1141. X.
  1142. X99a
  1143. X    signal (SIGFPE, on_fpe);
  1144. X.
  1145. X98c
  1146. X    /* set up to clean up screen and tty if interrupted.
  1147. X     * also set up to stop if get floating error.
  1148. X     */
  1149. X.
  1150. X95c
  1151. X    read_cfgfile ();
  1152. X.
  1153. X82a
  1154. X        case 'd': /* set alternate database file name */
  1155. X            if (--ac <= 0) usage("-d but no database file");
  1156. X            obj_setdbfilename (*++av);
  1157. X            break;
  1158. X.
  1159. X59a
  1160. X    void on_fpe();
  1161. X.
  1162. X47,48c
  1163. Xstatic jmp_buf fpe_err_jmp;    /* used to recover from SIGFPE */
  1164. Xstatic char *cfgfile;        /* !0 if -c used */
  1165. Xstatic char cfgdef[] = "ephem.cfg"; /* default configuration file name */
  1166. X.
  1167. X22a
  1168. Xextern char *getenv();
  1169. X.
  1170. X21d
  1171. X15a
  1172. X#include <setjmp.h>
  1173. X.
  1174. Xw
  1175. Xq
  1176. X-*-END-*-
  1177. Xed - mainmenu.c << '-*-END-*-'
  1178. X81a
  1179. X    f_string (R_OBJY,    C_OBJ,    "Y");
  1180. X.
  1181. Xw
  1182. Xq
  1183. X-*-END-*-
  1184. Xed - objx.c << '-*-END-*-'
  1185. X678c
  1186. X        mjd_cal (*p, &m, &d, &y);    /* init with current */
  1187. X.
  1188. X661c
  1189. X        op->o_p.p_k = atof(bp);
  1190. X.
  1191. X654c
  1192. X        f_double (R_PROMPT, C_PROMPT+sizeof(p), "(%g) ", op->o_p.p_k);
  1193. X.
  1194. X652c
  1195. X        static char p[] = "Luminosity index (kappa):";
  1196. X.
  1197. X646c
  1198. X        op->o_p.p_g = atof(bp);
  1199. X.
  1200. X639c
  1201. X        f_double (R_PROMPT, C_PROMPT+sizeof(p), "(%g) ", op->o_p.p_g);
  1202. X.
  1203. X637c
  1204. X        static char p[] = "Absolute magnitude (g):";
  1205. X.
  1206. X631c
  1207. X        crack_year (bp, &op->o_p.p_epoch);
  1208. X.
  1209. X625c
  1210. X        sts = read_line (buf, 20);
  1211. X.
  1212. X623c
  1213. X        mjd_year (op->o_p.p_epoch, &y);
  1214. X.
  1215. X614c
  1216. X        op->o_p.p_om = degrad(atof(bp));
  1217. X.
  1218. X607c
  1219. X        f_double(R_PROMPT,C_PROMPT+sizeof(p),"(%g) ",raddeg(op->o_p.p_om));
  1220. X.
  1221. X599c
  1222. X        op->o_p.p_qp = atof(bp);
  1223. X.
  1224. X592c
  1225. X        f_double (R_PROMPT, C_PROMPT+sizeof(p), "(%g) ", op->o_p.p_qp);
  1226. X.
  1227. X584c
  1228. X        op->o_p.p_ap = degrad(atof(bp));
  1229. X.
  1230. X577c
  1231. X        f_double(R_PROMPT,C_PROMPT+sizeof(p),"(%g) ",raddeg(op->o_p.p_ap));
  1232. X.
  1233. X569c
  1234. X        op->o_p.p_inc = degrad(atof(bp));
  1235. X.
  1236. X562c
  1237. X        f_double(R_PROMPT,C_PROMPT+sizeof(p),"(%g) ",raddeg(op->o_p.p_inc));
  1238. X.
  1239. X554c
  1240. X        crack_year (bp, &op->o_p.p_ep);
  1241. X.
  1242. X548c
  1243. X        sts = read_line (buf, 20);
  1244. X.
  1245. X546c
  1246. X        mjd_cal (op->o_p.p_ep, &m, &d, &y);
  1247. X.
  1248. X535c
  1249. X    op->o_type = PARABOLIC;
  1250. X.
  1251. X528c
  1252. Xobj_dparabolic(op, av)
  1253. XObj *op;
  1254. X.
  1255. X524c
  1256. X * o_type is set to PARABOLIC.
  1257. X.
  1258. X517,519c
  1259. X * 10 args in av, in order, are epoch of perihelion, inclination, argument of
  1260. X *   perihelion, perihelion distance, longitude of ascending node, reference
  1261. X *   epoch, absolute magnitude and luminosity index.
  1262. X.
  1263. X513c
  1264. X        op->o_e.e_H = atof(bp);
  1265. X
  1266. X    if (av) {
  1267. X        bp = av[10];
  1268. X        sts = 1;
  1269. X    } else {
  1270. X        static char p[] = "Magnitude slope parameter (G):";
  1271. X        f_prompt (p);
  1272. X        f_double (R_PROMPT, C_PROMPT+sizeof(p), "(%g) ", op->o_e.e_G);
  1273. X        sts = read_line (buf, 8+1);
  1274. X        if (sts < 0)
  1275. X        return;
  1276. X        bp = buf;
  1277. X    }
  1278. X    if (sts > 0)
  1279. X        op->o_e.e_G = atof(bp);
  1280. X.
  1281. X506c
  1282. X        mjd_year (op->o_e.e_epoch, &y);
  1283. X        printf ("(%g) ", y);
  1284. X        sts = read_line (buf, 20);
  1285. X        if (sts < 0)
  1286. X        return;
  1287. X        bp = buf;
  1288. X    }
  1289. X    if (sts > 0)
  1290. X        crack_year (bp, &op->o_e.e_epoch);
  1291. X
  1292. X
  1293. X    if (av) {
  1294. X        bp = av[9];
  1295. X        sts = 1;
  1296. X    } else {
  1297. X        static char p[] = "Absolute magnitude (H):";
  1298. X        f_prompt (p);
  1299. X        f_double (R_PROMPT, C_PROMPT+sizeof(p), "(%g) ", op->o_e.e_H);
  1300. X.
  1301. X504c
  1302. X        static char p[] = "Equinox year (UT Date, m/d.d/y or year.d): ";
  1303. X        double y;
  1304. X.
  1305. X498c
  1306. X        crack_year (bp, &op->o_e.e_cepoch);
  1307. X.
  1308. X491,492c
  1309. X        mjd_cal (op->o_e.e_cepoch, &m, &d, &y);
  1310. X        printf ("(%d/%g/%d) ", m, d, y);
  1311. X        sts = read_line (buf, 20);
  1312. X.
  1313. X489c
  1314. X        static char p[] = 
  1315. X        "Epoch date (UT Date, m/d.d/y or year.d): ";
  1316. X        int m, y;
  1317. X        double d;
  1318. X.
  1319. X483c
  1320. X        op->o_e.e_M = atof(bp);
  1321. X.
  1322. X476c
  1323. X        f_double (R_PROMPT, C_PROMPT+sizeof(p), "(%g) ", op->o_e.e_M);
  1324. X.
  1325. X474c
  1326. X        static char p[] = "Mean anomaly (degs):";
  1327. X.
  1328. X468c
  1329. X        op->o_e.e_e = atof(bp);
  1330. X.
  1331. X461c
  1332. X        f_double (R_PROMPT, C_PROMPT+sizeof(p), "(%g) ", op->o_e.e_e);
  1333. X.
  1334. X459c
  1335. X        static char p[] = "Eccentricity:";
  1336. X.
  1337. X453c
  1338. X        op->o_e.e_n = atof(bp);
  1339. X.
  1340. X446c
  1341. X        f_double (R_PROMPT, C_PROMPT+sizeof(p), "(%g) ", op->o_e.e_n);
  1342. X.
  1343. X444c
  1344. X        static char p[] = "Daily motion (degs/day):";
  1345. X.
  1346. X438c
  1347. X        op->o_e.e_a = atof(bp);
  1348. X.
  1349. X431c
  1350. X        f_double (R_PROMPT, C_PROMPT+sizeof(p), "(%g) ", op->o_e.e_a);
  1351. X.
  1352. X429c
  1353. X        static char p[] = "Mean distance (AU):";
  1354. X.
  1355. X423c
  1356. X        op->o_e.e_om = atof(bp);
  1357. X.
  1358. X416c
  1359. X        f_double (R_PROMPT, C_PROMPT+sizeof(p), "(%g) ", op->o_e.e_om);
  1360. X.
  1361. X414c
  1362. X        static char p[] = "Argument of Perihelion (degs):";
  1363. X.
  1364. X408c
  1365. X        op->o_e.e_Om = atof(bp);
  1366. X.
  1367. X401c
  1368. X        f_double (R_PROMPT, C_PROMPT+sizeof(p), "(%g) ", op->o_e.e_Om);
  1369. X.
  1370. X399c
  1371. X        static char p[] = "Longitude of ascending node (degs):";
  1372. X.
  1373. X393c
  1374. X        op->o_e.e_inc = atof(bp);
  1375. X.
  1376. X385,387c
  1377. X        f_double (R_PROMPT, C_PROMPT+sizeof(p), "(%g) ", op->o_e.e_inc);
  1378. X        sts = read_line (buf, 8+1);
  1379. X.
  1380. X380,383c
  1381. X        static char p[] = "Inclination (degs):";
  1382. X.
  1383. X374c
  1384. X    op->o_type = ELLIPTICAL;
  1385. X.
  1386. X367c
  1387. Xobj_delliptical(op, av)
  1388. XObj *op;
  1389. X.
  1390. X363c
  1391. X * o_type is set to ELLIPTICAL.
  1392. X.
  1393. X356,358c
  1394. X * 11 args in av, in order, are inclination, longitude of ascending node,
  1395. X *   argument of perihelion, mean distance (aka semi-major axis), daily
  1396. X *   motion, eccentricity, mean anomaly (ie, degrees from perihelion),
  1397. X *   epoch date (ie, time of the mean anomaly value), equinox year
  1398. X *   (ie, time of inc/lon/aop) absolute visual magnitude (H) and magnitude
  1399. X *   slope parameter (G).
  1400. X.
  1401. X352c
  1402. X        crack_year (bp, &op->o_f.f_epoch);
  1403. X.
  1404. X346c
  1405. X        sts = read_line (buf, 20);
  1406. X.
  1407. X344c
  1408. X        mjd_year (op->o_f.f_epoch, &y);
  1409. X.
  1410. X340a
  1411. X        static char p[] = "Magnitude: ";
  1412. X        f_prompt (p);
  1413. X        f_double (R_PROMPT, C_PROMPT+sizeof(p), "(%g) ", op->o_f.f_mag);
  1414. X        sts = read_line (buf, 8+1);
  1415. X        if (sts < 0)
  1416. X        return;
  1417. X        bp = buf;
  1418. X    }
  1419. X    if (sts > 0)
  1420. X        op->o_f.f_mag = atof (bp);
  1421. X
  1422. X    if (av) {
  1423. X        bp = av[3];
  1424. X        sts = 1;
  1425. X    } else {
  1426. X.
  1427. X333,334c
  1428. X        sex_dec (dg, m, s, &op->o_f.f_dec);
  1429. X        op->o_f.f_dec = degrad(op->o_f.f_dec);
  1430. X.
  1431. X331c
  1432. X        f_dec_sexsign (raddeg(op->o_f.f_dec), &dg, &m, &s);
  1433. X.
  1434. X322c
  1435. X        f_angle (R_PROMPT, C_PROMPT+sizeof(p)-1, op->o_f.f_dec);
  1436. X.
  1437. X312,313c
  1438. X        sex_dec (h, m, s, &op->o_f.f_ra);
  1439. X        op->o_f.f_ra = hrrad(op->o_f.f_ra);
  1440. X.
  1441. X310c
  1442. X        f_dec_sexsign (radhr(op->o_f.f_ra), &h, &m, &s);
  1443. X.
  1444. X301c
  1445. X        f_ra (R_PROMPT, C_PROMPT+sizeof(p)-1, op->o_f.f_ra);
  1446. X.
  1447. X293c
  1448. X    op->o_type = FIXED;
  1449. X.
  1450. X286c
  1451. Xobj_dfixed (op, av)
  1452. XObj *op;
  1453. X.
  1454. X282c
  1455. X * o_type is set to FIXED.
  1456. X.
  1457. X277c
  1458. X * args in av, in order, are ra, dec, magnitude and reference epoch.
  1459. X.
  1460. X275a
  1461. X/* search through an ephem database file for an entry and use it to define
  1462. X *   either OBJX or OBJY (as set by p).
  1463. X * if a name, np, is not set then we ask for it.
  1464. X * if -d was used use it; else if EPHEMDB env set use it, else use default.
  1465. X */
  1466. Xobj_filelookup (p, np)
  1467. Xint p;            /* OBJX or OBJY */
  1468. Xchar *np;
  1469. X{
  1470. X    FILE *fp;
  1471. X    char *fn;
  1472. X    int nl;
  1473. X    char buf[160];
  1474. X    char name[64];
  1475. X    int found;
  1476. X
  1477. X    /* open the database file */
  1478. X    if (dbfile)
  1479. X        fn = dbfile;
  1480. X    else {
  1481. X        fn = getenv ("EPHEMDB");
  1482. X        if (!fn)
  1483. X        fn = dbfdef;
  1484. X    }
  1485. X    fp = fopen (fn, "r");
  1486. X    if (!fp) {
  1487. X        sprintf (buf, "Can not open database file %s", fn);
  1488. X        f_msg(buf);
  1489. X        return;
  1490. X    }
  1491. X
  1492. X    /* set up object name in name with a trailing ',' */
  1493. X    if (np) {
  1494. X        (void) strncpy (name, np, sizeof(name)-2);
  1495. X        name[sizeof(name)-2] = '\0';    /* insure trailing '\0' */
  1496. X    } else  {
  1497. X        f_prompt ("Object name: ");
  1498. X        if (read_line (name, sizeof(name)-2) <= 0)
  1499. X        return;
  1500. X    }
  1501. X    (void) strcat (name, ",");
  1502. X
  1503. X    /* search for line beginning with name followed by comma.
  1504. X     * then rest of line is the info.
  1505. X     */
  1506. X    nl = strlen (name);
  1507. X    found = 0;
  1508. X    while (fgets (buf, sizeof(buf), fp))
  1509. X        if (strncmp (name, buf, nl) == 0) {
  1510. X        found = 1;
  1511. X        break;
  1512. X        }
  1513. X    fclose (fp);
  1514. X
  1515. X    if (found)
  1516. X        (void) obj_define (p, buf+nl);
  1517. X    else {
  1518. X        sprintf (buf, "%s not found", name);
  1519. X        f_msg (buf);
  1520. X    }
  1521. X}
  1522. X
  1523. X.
  1524. X269c
  1525. X        f_msg ("Unknown OBJ type");
  1526. X.
  1527. X266c
  1528. X        obj_delliptical (op, av+1);
  1529. X.
  1530. X262,263c
  1531. X        if (ac != 12) {
  1532. X        f_msg ("Need inc,lan,aop,md,dm,ecc,ma,cep,ep,h,g for \"elliptical\" OBJ");
  1533. X.
  1534. X259c
  1535. X        obj_dparabolic (op, av+1);
  1536. X.
  1537. X256c
  1538. X        f_msg ("Need ep,inc,ap,qp,om,epoch,abs,lum for \"parabolic\" OBJ");
  1539. X.
  1540. X252c
  1541. X        obj_dfixed (op, av+1);
  1542. X.
  1543. X248,249c
  1544. X        if (ac != 5) {
  1545. X        f_msg ("Need ra,dec,mag,epoch for \"fixed\" OBJ");
  1546. X.
  1547. X228a
  1548. X    Obj *op = (p == OBJX) ? &objx : &objy;
  1549. X.
  1550. X222c
  1551. Xobj_define (p, s)
  1552. Xint p;    /* OBJX or OBJY */
  1553. X.
  1554. X216,218c
  1555. X/* define obj based on the ephem.cfg line, s.
  1556. X * the "OBJX " or "OBJY " keyword is already skipped and used to set p.
  1557. X * format: type,[other fields, as per corresponding ObjX typedef]
  1558. X.
  1559. X210c
  1560. X
  1561. X        beta = acos((rp*rp + rho*rho - rsn*rsn)/ (2*rp*rho));
  1562. X        psi_t = exp(log(tan(beta/2.0))*0.63);
  1563. X        Psi_1 = exp(-3.33*psi_t);
  1564. X        psi_t = exp(log(tan(beta/2.0))*1.22);
  1565. X        Psi_2 = exp(-1.87*psi_t);
  1566. X        *mag = op->o_e.e_H + 5.0*log10(rp*rho)
  1567. X            - 2.5*log10((1-op->o_e.e_G)*Psi_1 + op->o_e.e_G*Psi_2);
  1568. X
  1569. X.
  1570. X195c
  1571. X        dt = rho*5.775518e-3;    /* light travel time, in days */
  1572. X.
  1573. X188c
  1574. X        lpd = atan(y/clo)+Om;
  1575. X.
  1576. X184d
  1577. X175,181c
  1578. X
  1579. X        reduce_elements (op->o_e.e_epoch, jd-dt, degrad(op->o_e.e_inc),
  1580. X                degrad (op->o_e.e_om), degrad (op->o_e.e_Om),
  1581. X                &inc, &om, &Om);
  1582. X
  1583. X        ma = degrad (op->o_e.e_M
  1584. X                + (jd - op->o_e.e_cepoch - dt) * op->o_e.e_n);
  1585. X        anomaly (ma, e, &nu, &ea);
  1586. X        rp= op->o_e.e_a * (1-e*e) / (1+e*cos(nu));
  1587. X        lo = nu + om;
  1588. X.
  1589. X172a
  1590. X        e = op->o_e.e_e;
  1591. X.
  1592. X161,169d
  1593. X158a
  1594. X        double om;        /* arg of perihelion */
  1595. X        double Om;        /* long of ascending node. */
  1596. X        double psi_t, Psi_1, Psi_2, beta;
  1597. X        double e;
  1598. X.
  1599. X156c
  1600. X        double ma, rp, lo, slo, clo;
  1601. X.
  1602. X153,154c
  1603. X        double dt, lg, lsn, rsn;
  1604. X.
  1605. X151a
  1606. X         * inputs have been changed to match the Astronomical Almanac.
  1607. X         * we have added reduction of elements using reduce_elements().
  1608. X.
  1609. X145c
  1610. X        *mag = op->o_p.p_g + 5*log10(*rho0) + 2.5*op->o_p.p_k*log10(*rp0);
  1611. X.
  1612. X133,135c
  1613. X        reduce_elements (op->o_p.p_epoch, jd-dt, op->o_p.p_inc,
  1614. X                    op->o_p.p_ap, op->o_p.p_om, &inc, &ap, &om);
  1615. X        comet (jd-dt, op->o_p.p_ep, inc, ap, op->o_p.p_qp, om,
  1616. X.
  1617. X122c
  1618. X        *mag = op->o_f.f_mag;
  1619. X.
  1620. X114,117c
  1621. X        xr = op->o_f.f_ra;
  1622. X        xd = op->o_f.f_dec;
  1623. X        if (op->o_f.f_epoch != jd)
  1624. X        precess (op->o_f.f_epoch, jd, &xr, &xd);
  1625. X.
  1626. X111c
  1627. X    Obj *op = (p == OBJX) ? &objx : &objy;
  1628. X
  1629. X    switch (op->o_type) {
  1630. X.
  1631. X109c
  1632. Xdouble *mag;    /* APPARENT magnitude */
  1633. X.
  1634. X102a
  1635. Xint p;        /* OBJX or OBJY */
  1636. X.
  1637. X101c
  1638. Xobj_cir (jd, p, lpd0, psi0, rp0, rho0, lam, bet, mag)
  1639. X.
  1640. X98c
  1641. X * this is called by body_cir() for object x and y just like plans() is called
  1642. X.
  1643. X95c
  1644. X/* set an alternate database file name.
  1645. X * N.B. we assume the storage pointed to by name is permanent.
  1646. X */
  1647. Xobj_setdbfilename (name)
  1648. Xchar *name;
  1649. X{
  1650. X    dbfile = name;
  1651. X}
  1652. X
  1653. X/* fill in info about object x or y.
  1654. X.
  1655. X92c
  1656. X    return ((p == OBJX) ? objx.o_on : objy.o_on);
  1657. X.
  1658. X90c
  1659. Xobj_ison(p)
  1660. Xint p;
  1661. X.
  1662. X85c
  1663. X    if (p == OBJX)
  1664. X        objx.o_on = 0;
  1665. X    else
  1666. X        objy.o_on = 0;
  1667. X.
  1668. X82,83c
  1669. Xobj_off (p)
  1670. Xint p;
  1671. X.
  1672. X80c
  1673. X    if (p == OBJX)
  1674. X        objx.o_on = 1;
  1675. X    else
  1676. X        objy.o_on = 1;
  1677. X.
  1678. X78c
  1679. Xobj_on (p)
  1680. Xint p;
  1681. X.
  1682. X76c
  1683. X/* turn "on" or "off" but don't forget facts about object the object.
  1684. X.
  1685. X67,72c
  1686. X    pr[4] = op->o_on ? "On" : "Off";
  1687. X    switch (f = popup (pr, f, 5)) {
  1688. X    case 0: obj_dfixed(op, (char**)0); goto ask;
  1689. X    case 1: obj_delliptical(op, (char**)0); goto ask;
  1690. X    case 2: obj_dparabolic(op, (char**)0); goto ask;
  1691. X    case 3: obj_filelookup (p, (char *)0); goto rechk;
  1692. X    case 4: op->o_on ^= 1; break;
  1693. X.
  1694. X60c
  1695. X    switch (op->o_type) {
  1696. X.
  1697. X58a
  1698. X    op = (p == OBJX) ? &objx : &objy;
  1699. X
  1700. X    rechk:
  1701. X.
  1702. X57a
  1703. X    Obj *op;
  1704. X.
  1705. X54,55c
  1706. X    static char *pr[5] = {
  1707. X        "Fixed", "Elliptical", "Parabolic", "Lookup"
  1708. X.
  1709. X52c
  1710. Xobj_setup(p)
  1711. Xint p;
  1712. X.
  1713. X49c
  1714. Xstatic Obj objx;
  1715. Xstatic Obj objy;
  1716. X
  1717. X/* run when Objx or y is picked from menu.
  1718. X * we tell which by the planet code.
  1719. X.
  1720. X45,47c
  1721. Xtypedef struct {
  1722. X    int  o_type;    /* see flags, below */
  1723. X    int  o_on;        /* !=0 while object is active */
  1724. X    ObjF o_f;
  1725. X    ObjE o_e;
  1726. X    ObjP o_p;
  1727. X} Obj;
  1728. X#define    FIXED        0    /* just simple ra/dec object */
  1729. X#define    ELLIPTICAL    1    /* elliptical orbital elements */
  1730. X#define    PARABOLIC    2    /* parabolic " */
  1731. X.
  1732. X42c
  1733. X    double p_g, p_k;    /* magnitude model coefficients */
  1734. X.
  1735. X31,33c
  1736. X    double e_Om;    /* longitude of ascending node, degrees */
  1737. X    double e_om;    /* argument of perihelion, degress */
  1738. X    double e_a;        /* mean distance, aka, semi-maj axis, in AU */
  1739. X    double e_n;        /* daily motion, degrees/day */
  1740. X    double e_e;        /* eccentricity */
  1741. X    double e_M;        /* mean anomaly, ie, degrees from perihelion at... */
  1742. X    double e_cepoch;    /* epoch date (M reference), as an mjd */
  1743. X    double e_epoch;    /* equinox year (inc/Om/om reference), as an mjd */
  1744. X    double e_H, e_G;    /* magnitude model coefficients */
  1745. X.
  1746. X26,29d
  1747. X22a
  1748. X    double f_mag;    /* visual magnitude */
  1749. X.
  1750. X18c
  1751. X/* structures to describe objects of various types.
  1752. X.
  1753. X13,16c
  1754. Xstatic char *dbfile;            /* !0 if set by -d option */
  1755. Xstatic char dbfdef[] = "ephem.db";     /* default database file name */
  1756. X.
  1757. X11c
  1758. Xextern char *strcat(), *strcpy(), *strncpy(), *getenv();
  1759. X.
  1760. X5a
  1761. X#include <stdio.h>
  1762. X.
  1763. X1,3c
  1764. X/* functions to save the user-definable objects, referred to as "x" and "y".
  1765. X * this way, once defined, the objects can be quieried for position just like
  1766. X * the other bodies, with obj_cir(). 
  1767. X.
  1768. Xw
  1769. Xq
  1770. X-*-END-*-
  1771. Xed - obliq.c << '-*-END-*-'
  1772. X16c
  1773. X        lasteps = degrad(2.345229444E1
  1774. X            - ((((-1.81E-3*t)+5.9E-3)*t+4.6845E1)*t)/3600.0);
  1775. X.
  1776. Xw
  1777. Xq
  1778. X-*-END-*-
  1779. Xed - plans.c << '-*-END-*-'
  1780. X48c
  1781. X    double lsn, rsn;/* true geocentric longitude of sun and sun-earth rad */
  1782. X.
  1783. Xw
  1784. Xq
  1785. X-*-END-*-
  1786. Xed - plot.c << '-*-END-*-'
  1787. X416c
  1788. X        f_double (NR/2, NC-10, "%g", maxr);
  1789. X.
  1790. X405c
  1791. X        if (sscanf (buf, fmt, &c, &r, &th) != 3)
  1792. X            continue;
  1793. X.
  1794. X388c
  1795. X        if (sscanf (buf, fmt, &c, &r, &th) != 3)
  1796. X        continue;
  1797. X.
  1798. X359,362c
  1799. X        f_double (1, 1, "%g", maxy);
  1800. X        f_double (NR-1, 1, "%g", miny);
  1801. X        f_double (NR, 1, "%g", minx);
  1802. X        f_double (NR, NC-10, "%g", maxx);
  1803. X.
  1804. X350c
  1805. X        if (sscanf (buf, fmt, &c, &x, &y) != 3)
  1806. X            continue;
  1807. X.
  1808. X329c
  1809. X        if (sscanf (buf, fmt, &c, &x, &y) != 3)
  1810. X        continue;
  1811. X.
  1812. X89c
  1813. X            (void) flog_log (R_SRCH, C_SRCH, e);
  1814. X.
  1815. Xw
  1816. Xq
  1817. X-*-END-*-
  1818. Xed - popup.c << '-*-END-*-'
  1819. X62,63c
  1820. X        if (++fn >= nfields)
  1821. X            fn = 0;
  1822. X.
  1823. X58,59c
  1824. X        if (--fn < 0)
  1825. X            fn = nfields - 1;
  1826. X.
  1827. X56c
  1828. X        case '\r': return (fn);
  1829. X.
  1830. X53a
  1831. X        case QUIT:
  1832. X        f_prompt ("Exit ephem? (y) ");
  1833. X        if (read_char() == 'y')
  1834. X            bye();    /* never returns */
  1835. X        goto again;
  1836. X.
  1837. X51c
  1838. X        c_pos (R_PROMPT, fcols[fn]);
  1839. X.
  1840. X49d
  1841. X8a
  1842. Xextern void bye();
  1843. X
  1844. X.
  1845. Xw
  1846. Xq
  1847. X-*-END-*-
  1848. Xed - reduce.c << '-*-END-*-'
  1849. X14c
  1850. Xdouble *om;    /* desired long of ascending node, rads */
  1851. X.
  1852. X11c
  1853. Xdouble om0;    /* initial long of ascending node, rads */
  1854. X.
  1855. Xw
  1856. Xq
  1857. X-*-END-*-
  1858. Xed - riset_c.c << '-*-END-*-'
  1859. X42c
  1860. X    if (!force && same_cir (np, &lp->l_now) && same_lday (np, &lp->l_now)
  1861. X.
  1862. X22a
  1863. Xint force;    /* set !=0 to force computations */
  1864. X.
  1865. X20c
  1866. Xriset_cir (p, np, force, hzn, ltr, lts, ltt, azr, azs, altt, status)
  1867. X.
  1868. Xw
  1869. Xq
  1870. X-*-END-*-
  1871. Xed - screen.h << '-*-END-*-'
  1872. X196c
  1873. X#define    OBJY    (PLUTO+4)    /* the user-defined object */
  1874. X#define    NOBJ    (OBJY+1)    /* total number of objects */
  1875. X.
  1876. X157,166c
  1877. X#define    C_MOON        10
  1878. X#define    C_MERCURY    17
  1879. X#define    C_VENUS        23
  1880. X#define    C_MARS        30
  1881. X#define    C_JUPITER    36
  1882. X#define    C_SATURN    43
  1883. X#define    C_URANUS    49
  1884. X#define    C_NEPTUNE    56
  1885. X#define    C_PLUTO        62
  1886. X#define    C_OBJX        69
  1887. X#define    C_OBJY        75
  1888. X.
  1889. X149,153c
  1890. X#define    C_TRANSTM    29
  1891. X#define    C_TRANSALT    40
  1892. X#define    C_SETTM        51
  1893. X#define    C_SETAZ        62
  1894. X#define    C_TUP        73
  1895. X.
  1896. X147c
  1897. X#define    C_RISETM    7
  1898. X.
  1899. X121,131c
  1900. X#define    R_SUN        (R_PLANTAB+1)
  1901. X#define    R_MOON        (R_PLANTAB+2)
  1902. X#define    R_MERCURY    (R_PLANTAB+3)
  1903. X#define    R_VENUS        (R_PLANTAB+4)
  1904. X#define    R_MARS        (R_PLANTAB+5)
  1905. X#define    R_JUPITER    (R_PLANTAB+6)
  1906. X#define    R_SATURN    (R_PLANTAB+7)
  1907. X#define    R_URANUS    (R_PLANTAB+8)
  1908. X#define    R_NEPTUNE    (R_PLANTAB+9)
  1909. X#define    R_PLUTO        (R_PLANTAB+10)
  1910. X#define    R_OBJX        (R_PLANTAB+11)
  1911. X#define    R_OBJY        (R_PLANTAB+12)
  1912. X
  1913. X/* menu 1 info table */
  1914. X.
  1915. X119c
  1916. X/* planet rows, for all menus */
  1917. X.
  1918. Xw
  1919. Xq
  1920. X-*-END-*-
  1921. Xed - sel_fld.c << '-*-END-*-'
  1922. X530a
  1923. X    case 'y': newf = nearestfld (R_OBJY, 1, flag); break;
  1924. X.
  1925. X341a
  1926. X    rcfpack (R_VENUS,    C_OBJY,        F_MNU3|F_PLT),
  1927. X.
  1928. X310a
  1929. X    rcfpack (R_URANUS,    C_OBJY,        F_MNU3|F_PLT),
  1930. X.
  1931. X278a
  1932. X    rcfpack (R_SUN,    C_OBJY,        F_MNU3|F_PLT),
  1933. X.
  1934. X248a
  1935. X    rcfpack (R_SATURN,    C_OBJY,        F_MNU3|F_PLT),
  1936. X.
  1937. X217a
  1938. X    rcfpack (R_PLUTO,    C_OBJY,        F_MNU3|F_PLT),
  1939. X.
  1940. X201a
  1941. X    rcfpack (R_OBJY,    C_ALT,        F_MNU1|F_PLT),
  1942. X    rcfpack (R_OBJY,    C_AZ,        F_MNU1|F_PLT),
  1943. X    rcfpack (R_OBJY,    C_DEC,        F_MNU1|F_PLT),
  1944. X    rcfpack (R_OBJY,    C_EDIST,    F_MNU1|F_PLT),
  1945. X    rcfpack (R_OBJY,    C_ELONG,    F_MNU1|F_PLT),
  1946. X    rcfpack (R_OBJY,    C_HLAT,        F_MNU1|F_PLT),
  1947. X    rcfpack (R_OBJY,    C_HLONG,    F_MNU1|F_PLT),
  1948. X    rcfpack (R_OBJY,    C_JUPITER,    F_MNU3|F_PLT),
  1949. X    rcfpack (R_OBJY,    C_MAG,        F_MNU1|F_PLT),
  1950. X    rcfpack (R_OBJY,    C_MARS,        F_MNU3|F_PLT),
  1951. X    rcfpack (R_OBJY,    C_MERCURY,    F_MNU3|F_PLT),
  1952. X    rcfpack (R_OBJY,    C_MOON,        F_MNU3|F_PLT),
  1953. X    rcfpack (R_OBJY,    C_NEPTUNE,    F_MNU3|F_PLT),
  1954. X    rcfpack (R_OBJY,    C_OBJ,        F_MMNU|F_CHG),
  1955. X    rcfpack (R_OBJY,    C_OBJX,        F_MNU3|F_PLT),
  1956. X    rcfpack (R_OBJY,    C_PHASE,    F_MNU1|F_PLT),
  1957. X    rcfpack (R_OBJY,    C_PLUTO,    F_MNU3|F_PLT),
  1958. X    rcfpack (R_OBJY,    C_RA,        F_MNU1|F_PLT),
  1959. X    rcfpack (R_OBJY,    C_RISEAZ,    F_MNU2|F_PLT),
  1960. X    rcfpack (R_OBJY,    C_RISETM,    F_MNU2|F_PLT),
  1961. X    rcfpack (R_OBJY,    C_SATURN,    F_MNU3|F_PLT),
  1962. X    rcfpack (R_OBJY,    C_SDIST,    F_MNU1|F_PLT),
  1963. X    rcfpack (R_OBJY,    C_SETAZ,    F_MNU2|F_PLT),
  1964. X    rcfpack (R_OBJY,    C_SETTM,    F_MNU2|F_PLT),
  1965. X    rcfpack (R_OBJY,    C_SUN,        F_MNU3|F_PLT),
  1966. X    rcfpack (R_OBJY,    C_TRANSALT,    F_MNU2|F_PLT),
  1967. X    rcfpack (R_OBJY,    C_TRANSTM,    F_MNU2|F_PLT),
  1968. X    rcfpack (R_OBJY,    C_TUP,        F_MNU2|F_PLT),
  1969. X    rcfpack (R_OBJY,    C_URANUS,    F_MNU3|F_PLT),
  1970. X    rcfpack (R_OBJY,    C_VENUS,    F_MNU3|F_PLT),
  1971. X.
  1972. X186a
  1973. X    rcfpack (R_OBJX,    C_OBJY,        F_MNU3|F_PLT),
  1974. X.
  1975. X155a
  1976. X    rcfpack (R_NEPTUNE,    C_OBJY,        F_MNU3|F_PLT),
  1977. X.
  1978. X125a
  1979. X    rcfpack (R_MOON,    C_OBJY,        F_MNU3|F_PLT),
  1980. X.
  1981. X97a
  1982. X    rcfpack (R_MERCURY,    C_OBJY,        F_MNU3|F_PLT),
  1983. X.
  1984. X67a
  1985. X    rcfpack (R_MARS,    C_OBJY,        F_MNU3|F_PLT),
  1986. X.
  1987. X30a
  1988. X    rcfpack (R_JUPITER,    C_OBJY,        F_MNU3|F_PLT),
  1989. X.
  1990. Xw
  1991. Xq
  1992. X-*-END-*-
  1993. Xed - version.c << '-*-END-*-'
  1994. X7a
  1995. X * 4.13 3/9/90    add support for second user-def object: "object y"
  1996. X *        fix bug updating obj ref epoch (always used PARABOLIC's)
  1997. X *        fix Turbo C workaround that prevented plotting sun dist.
  1998. X *      3/13    fix bug preventing searching on separation column for objx
  1999. X *    3/22    revamp elliptical object definition parameters to match AA.
  2000. X *        permit exiting/redrawing properly from within a popup too.
  2001. X *        add a bit more precision to plot labels.
  2002. X *        let plot files have comments too, ie, leading *'s
  2003. X *    3/23    add "Lookup" to search config file for objects.
  2004. X *    3/30    separate database from config file; add -d and EPHEMDB env var.
  2005. X *        catch SIGFPE and longjmp() back into main interation loop.
  2006. X *    4/3    add magnitude to fixed-object database fields.
  2007. X.
  2008. X5c
  2009. Xstatic char vmsg[] = "Version 4.13 April 3, 1990";
  2010. X.
  2011. Xw
  2012. Xq
  2013. X-*-END-*-
  2014. Xed - watch.c << '-*-END-*-'
  2015. X221c
  2016. X
  2017. X.
  2018. X214,219c
  2019. X        for (p = OBJX; p != -1; p = (p == OBJX) ? OBJY : -1)
  2020. X        if (wbodies & (1<<p)) {
  2021. X            (void) body_cir (p, SSACC, np, &s);
  2022. X            if (s.s_hlong != NOHELIO && s.s_sdist <= scale) {
  2023. X            set_ss (newp+nnew, s.s_sdist/scale, s.s_hlong, s.s_hlat,
  2024. X                                body_tags[p]);
  2025. X            nnew += 2;
  2026. X            }
  2027. X.
  2028. X56c
  2029. X        "Sky", "Solar system"
  2030. X.
  2031. Xw
  2032. Xq
  2033. X-*-END-*-
  2034. EOFxEOF
  2035. len=`wc -c < Ephem_4.12-13`
  2036. if expr $len != 47612 > /dev/null
  2037. then echo Length of Ephem_4.12-13 is $len but it should be 47612.
  2038. fi
  2039. echo x ephem.db
  2040. sed -e 's/^X//' << 'EOFxEOF' > ephem.db
  2041. X* ephem database.
  2042. X*
  2043. X* these are sorted for easy reading but they don't have to be in any order.
  2044. X* things will run faster if you put the objects you use nearer the top.
  2045. X*
  2046. X* elliptical format: inclination, longitude of ascending node,
  2047. X*   argument of perihelion, mean distance (aka semi-major axis),
  2048. X*   daily motion, eccentricity, mean anomaly (ie, degrees from perihelion),
  2049. X*   epoch date (ie, time of M), the equinox year (ie, time of i/O/o).
  2050. X*   absolute magnitude, magnitude slope parameter.
  2051. X*
  2052. X* parabolic format: epoch of perihelion, inclination, argument of perihelion,
  2053. X*   perihelion distance, longitude of the ascending node, reference epoch of
  2054. X*   the parameters, absolute magnitude, luminosity index
  2055. X*
  2056. X* fixed format: ra, dec, magnitude, reference epoch
  2057. X
  2058. X* from IAU circular 4985
  2059. XAustin,p,4/9.9715/1990,58.9574,61.5625,0.349854,75.2223,1950.0,4.5,4
  2060. X* from IAU circular 4986
  2061. XCernis,p,3/17.2967/1990,48.138,100.588,1.06849,347.727,1950,0,0
  2062. X* from IAU circular 4984
  2063. XGeorge,p,4/11.9396/1990,59.3652,137.8482,1.569001,279.3118,1950,0,0
  2064. X
  2065. 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
  2066. 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
  2067. XHalley,e,162.238,58.154,111.857,17.9435,0.0129674,0.9673,0,1986.109,1950,3.66,7.05
  2068. 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
  2069. 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
  2070. 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
  2071. 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
  2072. 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
  2073. 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
  2074. 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
  2075. 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
  2076. 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
  2077. 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
  2078. 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
  2079. 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
  2080. EOFxEOF
  2081. len=`wc -c < ephem.db`
  2082. if expr $len != 2395 > /dev/null
  2083. then echo Length of ephem.db is $len but it should be 2395.
  2084. fi
  2085.  
  2086. echo x ell_e-ephem
  2087. sed -e 's/^X//' << 'EOFxEOF' > ell_e-ephem
  2088. X#!/bin/csh -f
  2089. X# convert a *.ell_e file to the form needed by ephem.db
  2090. X# skip first three lines
  2091. X# trim off leading digits_ in names.
  2092. Xawk '\
  2093. XBEGIN    {    OFS = ","    \
  2094. X    }    \
  2095. X    {    if (NR <= 3 || NF < 15) next    \
  2096. X         nm = $1    \
  2097. X         i = $2    \
  2098. X         O = $3    \
  2099. X         o = $4    \
  2100. X         a = $5    \
  2101. X         n = $6    \
  2102. X         e = $7    \
  2103. X         M = $8    \
  2104. X         Mon = $9    \
  2105. X        if (Mon == "Jan") Mon = 1     \
  2106. X        if (Mon == "Feb") Mon = 2     \
  2107. X        if (Mon == "Mar") Mon = 3     \
  2108. X        if (Mon == "Apr") Mon = 4     \
  2109. X        if (Mon == "May") Mon = 5     \
  2110. X        if (Mon == "Jun") Mon = 6     \
  2111. X        if (Mon == "Jul") Mon = 7     \
  2112. X        if (Mon == "Aug") Mon = 8     \
  2113. X        if (Mon == "Sep") Mon = 9     \
  2114. X        if (Mon == "Oct") Mon = 10     \
  2115. X        if (Mon == "Nov") Mon = 11    \
  2116. X        if (Mon == "Dec") Mon = 12    \
  2117. X         day = $10    \
  2118. X         yr = $11    \
  2119. X         eq = $12    \
  2120. X         H = $14    \
  2121. X         G = $15    \
  2122. X    \
  2123. X         print nm, "e", i, O, o, a, n, e, M, Mon"/"day"/"yr, eq, H, G    \
  2124. X    }' | sed -e 's/^[0-9]*_//'
  2125. EOFxEOF
  2126. len=`wc -c < ell_e-ephem`
  2127. if expr $len != 899 > /dev/null
  2128. then echo Length of ell_e-ephem is $len but it should be 899.
  2129. fi
  2130. echo x par_e-ephem
  2131. sed -e 's/^X//' << 'EOFxEOF' > par_e-ephem
  2132. X#!/bin/csh -f
  2133. X# convert a *.par_e file to the form needed by ephem.db
  2134. X# skip first three lines
  2135. X# trim off leading digits_ in names.
  2136. Xawk '\
  2137. XBEGIN    {    OFS = ","    \
  2138. X    }    \
  2139. X    {    if (NR <= 3) next    \
  2140. X         nm = $1    \
  2141. X         i = $2    \
  2142. X         O = $3    \
  2143. X         o = $4    \
  2144. X         q = $5    \
  2145. X         Mon = $6    \
  2146. X        if (Mon == "Jan") Mon = 1     \
  2147. X        if (Mon == "Feb") Mon = 2     \
  2148. X        if (Mon == "Mar") Mon = 3     \
  2149. X        if (Mon == "Apr") Mon = 4     \
  2150. X        if (Mon == "May") Mon = 5     \
  2151. X        if (Mon == "Jun") Mon = 6     \
  2152. X        if (Mon == "Jul") Mon = 7     \
  2153. X        if (Mon == "Aug") Mon = 8     \
  2154. X        if (Mon == "Sep") Mon = 9     \
  2155. X        if (Mon == "Oct") Mon = 10     \
  2156. X        if (Mon == "Nov") Mon = 11    \
  2157. X        if (Mon == "Dec") Mon = 12    \
  2158. X         day = $7    \
  2159. X         yr = $8    \
  2160. X         eq = $9    \
  2161. X         g = $10    \
  2162. X         k = $11    \
  2163. X    \
  2164. X         print nm, "p", Mon"/"day"/"yr, i, o, q, O, eq, g, k    \
  2165. X    }' | sed -e 's/^[0-9]*_//'
  2166. EOFxEOF
  2167. len=`wc -c < par_e-ephem`
  2168. if expr $len != 831 > /dev/null
  2169. then echo Length of par_e-ephem is $len but it should be 831.
  2170. fi
  2171. echo x sac-ephem
  2172. sed -e 's/^X//' << 'EOFxEOF' > sac-ephem
  2173. X#!/bin/csh -f
  2174. X# convert SAGUARO ASTRONOMY CLUB DATABASE VERSION 5.0 to ephem fixed format
  2175. X
  2176. Xawk '-F"' '\
  2177. XBEGIN    {   OFS = ","    \
  2178. X    }    \
  2179. X    {    \
  2180. X        nm = $1    \
  2181. X        ra = $5    \
  2182. X        ra = substr(ra,1,2)+0 ":" substr (ra,4,2) ":" substr(ra,7,1)*6 \
  2183. X        dec = $6    \
  2184. X        dec = substr(dec,1,3)+0 ":" substr(dec,5,2)    \
  2185. X        mag = $7    \
  2186. X    \
  2187. X        print nm, ra, dec, mag, "2000"    \
  2188. X    }    \
  2189. X'
  2190. EOFxEOF
  2191. len=`wc -c < sac-ephem`
  2192. if expr $len != 361 > /dev/null
  2193. then echo Length of sac-ephem is $len but it should be 361.
  2194. fi
  2195. echo x star-ephem
  2196. sed -e 's/^X//' << 'EOFxEOF' > star-ephem
  2197. X#!/bin/csh -f
  2198. X# convert .star format to "fixed" object ephem format
  2199. X# N.B. this is mighty crude. it does especially poorly with the name portion.
  2200. X
  2201. Xawk '\
  2202. X{    \
  2203. X    if (NF < 2)    \
  2204. X        next    \
  2205. X    name = substr ($2, 4, 100)    \
  2206. X    if (name == "")    \
  2207. X        next    \
  2208. X    rah = substr ($1, 1, 2)    \
  2209. X    ram = substr ($1, 3, 2)    \
  2210. X    ras = substr ($1, 5, 2)    \
  2211. X    decd = substr ($1, 7, 3)    \
  2212. X    decm = substr ($1, 10, 2)    \
  2213. X    mag = substr ($1, 12, 3)    \
  2214. X    if (mag < 0)    \
  2215. X        mag /= 10    \
  2216. X    else    \
  2217. X        mag /= 100    \
  2218. X    printf "%s,f,%d:%d:%d,%d:%d,%g,2000\n", name, rah, ram, ras, decd, decm, mag    \
  2219. X}'
  2220. EOFxEOF
  2221. len=`wc -c < star-ephem`
  2222. if expr $len != 554 > /dev/null
  2223. then echo Length of star-ephem is $len but it should be 554.
  2224. fi
  2225.  
  2226.