home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / x / volume16 / xephem / part01 < prev    next >
Encoding:
Text File  |  1992-03-05  |  50.1 KB  |  1,809 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: v16i112: xephem - astronomical ephemeris program., Part01/24
  5. Message-ID: <csx-16i112-xephem@uunet.UU.NET>
  6. Originator: dcmartin@fascet
  7. Sender: dcmartin@msi.com (David C. Martin - Moderator)
  8. Organization: Molecular Simulations, Inc.
  9. Date: Fri, 6 Mar 1992 13:51:55 GMT
  10. Approved: dcmartin@msi.com
  11.  
  12. Submitted-by: e_downey@hwking.cca.cr.rockwell.com (Elwood Downey)
  13. Posting-number: Volume 16, Issue 112
  14. Archive-name: xephem/part01
  15.  
  16. # This is a shell archive (produced by shar 3.49)
  17. # To extract the files from this archive, save it to a file, remove
  18. # everything above the "!/bin/sh" line above, and type "sh file_name".
  19. #
  20. # made 03/06/1992 13:48 UTC by dcmartin@fascet
  21. # Source directory /home/fascet/csx/todo/xephem
  22. #
  23. # existing files will NOT be overwritten unless -c is specified
  24. #
  25. # This is part 1 of a multipart archive                                    
  26. # do not concatenate these parts, unpack them in order with /bin/sh        
  27. #
  28. # This shar contains:
  29. # length  mode       name
  30. # ------ ---------- ------------------------------------------
  31. #   4774 -rw-r--r-- README
  32. #  12887 -rw-r--r-- xephem.1X
  33. #   2941 -rw-r--r-- Manifest
  34. #   1863 -rw-r--r-- Makefile
  35. #   1249 -rw-r--r-- XEphem
  36. #    146 -rw-r--r-- ephem.cfg
  37. #   1922 -rw-r--r-- aa_hadec.c
  38. #  15399 -rw-r--r-- altaz.c
  39. #    901 -rw-r--r-- anomaly.c
  40. #   3113 -rw-r--r-- cal_mjd.c
  41. #  10858 -rw-r--r-- circum.c
  42. #   2390 -rw-r--r-- comet.c
  43. #  16567 -rw-r--r-- compiler.c
  44. #  20026 -rw-r--r-- constel.c
  45. #  24197 -rw-r--r-- datamenu.c
  46. #   1899 -rw-r--r-- eq_ecl.c
  47. #   3268 -rw-r--r-- flog.c
  48. #   8556 -rw-r--r-- formats.c
  49. #   5658 -rw-r--r-- help.c
  50. #  17844 -rw-r--r-- jupmenu.c
  51. #  13788 -rw-r--r-- listing.c
  52. #  36543 -rw-r--r-- mainmenu.c
  53. #   5143 -rw-r--r-- moon.c
  54. #  12318 -rw-r--r-- moonmenu.c
  55. #   1557 -rw-r--r-- moonnf.c
  56. #   2011 -rw-r--r-- nutation.c
  57. #  41488 -rw-r--r-- obj.c
  58. #    421 -rw-r--r-- obliq.c
  59. #   2301 -rw-r--r-- parallax.c
  60. #   4797 -rw-r--r-- pelement.c
  61. #  17647 -rw-r--r-- plans.c
  62. #  28540 -rw-r--r-- plot.c
  63. #   9197 -rw-r--r-- plot_aux.c
  64. #   2952 -rw-r--r-- precess.c
  65. #   2191 -rw-r--r-- query.c
  66. #   1691 -rw-r--r-- reduce.c
  67. #   1857 -rw-r--r-- refract.c
  68. #   4591 -rw-r--r-- riset.c
  69. #   8189 -rw-r--r-- riset_c.c
  70. #  23357 -rw-r--r-- risetmenu.c
  71. #  23823 -rw-r--r-- sepmenu.c
  72. #   1183 -rw-r--r-- sex_dec.c
  73. #  15221 -rw-r--r-- skydome.c
  74. #  18782 -rw-r--r-- solarsys.c
  75. #  26324 -rw-r--r-- srch.c
  76. #   1760 -rw-r--r-- sun.c
  77. #   3230 -rw-r--r-- time.c
  78. #   1189 -rw-r--r-- utc_gst.c
  79. #  14200 -rw-r--r-- version.c
  80. #  20532 -rw-r--r-- xephem.c
  81. #    620 -rw-r--r-- astro.h
  82. #   2856 -rw-r--r-- circum.h
  83. #   1165 -rw-r--r-- fieldmap.h
  84. #    307 -rw-r--r-- moreobjs.h
  85. #    289 -rw-r--r-- patchlevel.h
  86. #  40159 -rw-r--r-- xephem.hlp
  87. # 390760 -rw-r--r-- ephem.db
  88. # 180275 -rw-r--r-- smallfm.xbm
  89. #
  90. if test -r _shar_seq_.tmp; then
  91.     echo 'Must unpack archives in sequence!'
  92.     echo Please unpack part `cat _shar_seq_.tmp` next
  93.     exit 1
  94. fi
  95. # ============= README ==============
  96. if test -f 'README' -a X"$1" != X"-c"; then
  97.     echo 'x - skipping README (File already exists)'
  98.     rm -f _shar_wnt_.tmp
  99. else
  100. > _shar_wnt_.tmp
  101. echo 'x - extracting README (Text)'
  102. sed 's/^X//' << 'SHAR_EOF' > 'README' &&
  103. Welcome to xephem:
  104. X
  105. XXephem is an interactive astronomical ephemeris program. It has built-in
  106. support for all planets plus support for arbitrary objects given their
  107. heliocentric orbital elements. It generates tabular and schematic views, and
  108. can plot and search for user-defined circumstances. It is a descendent of
  109. ephem, the same program originally designed in the late 80's for dumb terminals.
  110. X
  111. There is only a small manual, but there is quite a lot of help. So, the first
  112. thing to do is to build xephem - see below - then start picking the Help
  113. buttons.
  114. X
  115. Note for you ephem users: the configuration and database files, ephem.cfg and
  116. ephem.db, remain compatible.
  117. X
  118. The release level is contained in a string constant in version.c. All patches
  119. will update this string.
  120. X
  121. Building notes:
  122. X
  123. Select from two methods of dealing with time from the operating system with
  124. the TZA/TZB defines in time.c. If you get link undefines related to time
  125. functions, don't panic; just try changing to the other form. Most AT&T
  126. derivatives seem to want TZA. On Sun systems running OS 4.0.3 (or BSD 4.3) or
  127. Apollo SR 10.1 use TZB and change <time.h> to <sys/time.h>.
  128. X
  129. Have a look at the Makefile and set up things there like you would for any
  130. XX11R4/Motif1.1 project on your system: compile everything with the Motif
  131. include files and link it with the X and Motif libraries; and don't forget
  132. the math library, -lm. A DCL file to build xephem for VMS/DECWindows MOTIF
  133. is included at the end of this file.
  134. X
  135. Now, make xephem. Everything is in .c and .h files except note that moonmenu.c
  136. includes a moon bitmap named smallfm.xbm.
  137. X
  138. There are fallback resources included in the main program so don't worry about
  139. putting XEphem anywhere for now. If you set a different font, the many tabular
  140. displays will work best with one that is fixed width, such as courier.
  141. X
  142. Now, go ahead and run xephem and read some of the Help entries. Soon, you will
  143. want to edit ephem.cfg, the file that contains location information and a few
  144. other things.
  145. X
  146. Let me know what you think!
  147. Elwood Downey, e_downey@hwking.cca.cr.rockwell.com
  148. X
  149. Finally, for your information:
  150. X
  151. The following files are pretty much just pure transliterations from BASIC
  152. into C from machine-readable copies of the programs in Duffett-Smith's book.
  153. They have nothing to do with the rest of ephem so they may be used for
  154. completely different applications if so desired.
  155. X
  156. X    aa_hadec.c anomaly.c astro.h cal_mjd.c comet.c eq_ecl.c moon.c moonnf.c
  157. X    nutation.c obliq.c parallax.c pelement.c plans.c reduce.c refract.c
  158. X    sex_dec.c sun.c utc_gst.c
  159. X
  160. If you would like to gut ephem for just its astronomical functionality, start
  161. with body_cir().
  162. X
  163. The following DCL file will build xephem for VMS/DECwindows MOTIF, courtesy
  164. Ethan VanMatre:
  165. X
  166. $!
  167. $!    Makefile.com -- Command file to compile and link Xephem
  168. $!
  169. $!
  170. $!    A simple minded command file to compile and link Xephem under VAX/VMS
  171. $!    and DECwindows MOTIF 
  172. $!
  173. $!    when        who            what
  174. $!
  175. $!    2-feb-1992    Ethan VanMatre        original from unix makefile
  176. $!
  177. $
  178. $ cc    aa_hadec/opt/obj
  179. $ cc    altaz    /opt/obj
  180. $ cc    anomaly    /opt/obj
  181. $ cc    cal_mjd    /opt/obj
  182. $ cc    circum    /opt/obj
  183. $ cc    comet    /opt/obj
  184. $ cc    compiler/opt/obj
  185. $ cc    constel    /opt/obj
  186. $ cc    datamenu/opt/obj
  187. $ cc    eq_ecl    /opt/obj
  188. $ cc    flog    /opt/obj
  189. $ cc    formats    /opt/obj
  190. $ cc    help    /opt/obj
  191. $ cc    jupmenu    /opt/obj
  192. $ cc    listing    /opt/obj
  193. $ cc    mainmenu/opt/obj
  194. $ cc    moon    /opt/obj
  195. $ cc    moonmenu/opt/obj
  196. $ cc    moonnf    /opt/obj
  197. $ cc    nutation/opt/obj
  198. $ cc    obj    /opt/obj
  199. $ cc    obliq    /opt/obj
  200. $ cc    parallax/opt/obj
  201. $ cc    pelement/opt/obj
  202. $ cc    plans    /opt/obj
  203. $ cc    plot    /opt/obj
  204. $ cc    plot_aux/opt/obj
  205. $ cc    precess    /opt/obj
  206. $ cc    query    /opt/obj
  207. $ cc    reduce    /opt/obj
  208. $ cc    refract    /opt/obj
  209. $ cc    riset    /opt/obj
  210. $ cc    riset_c    /opt/obj
  211. $ cc    risetmenu/opt/obj
  212. $ cc    sepmenu    /opt/obj
  213. $ cc    sex_dec    /opt/obj
  214. $ cc    skydome    /opt/obj
  215. $ cc    solarsys/opt/obj
  216. $ cc    srch    /opt/obj
  217. $ cc    sun    /opt/obj
  218. $ cc    time    /opt/obj
  219. $ cc    utc_gst    /opt/obj
  220. $ cc    version    /opt/obj
  221. $ cc    xephem    /opt/obj
  222. $!
  223. $ LINK    xephem.obj,    -
  224. X    aa_hadec.obj,     -
  225. X    altaz.obj,    -
  226. X    anomaly.obj,    -
  227. X    cal_mjd.obj,    -
  228. X    circum.obj,    -
  229. X    comet.obj,    -
  230. X    compiler.obj,    -
  231. X    constel.obj,    -
  232. X    datamenu.obj,    -
  233. X    eq_ecl.obj,    -
  234. X    flog.obj,    -
  235. X    formats.obj,    -
  236. X    help.obj,    -
  237. X    jupmenu.obj,    -
  238. X    listing.obj,    -
  239. X    mainmenu.obj,    -
  240. X    moon.obj,    -
  241. X    moonmenu.obj,    -
  242. X    moonnf.obj,    -
  243. X    nutation.obj,    -
  244. X    obj.obj,    -
  245. X    obliq.obj,    -
  246. X    parallax.obj,    -
  247. X    pelement.obj,    -
  248. X    plans.obj,    -
  249. X    plot.obj,    -
  250. X    plot_aux.obj,    -
  251. X    precess.obj,    -
  252. X    query.obj,    -
  253. X    reduce.obj,    -
  254. X    refract.obj,    -
  255. X    riset.obj,    -
  256. X    riset_c.obj,    -
  257. X    risetmenu.obj,    -
  258. X    sepmenu.obj,    -
  259. X    sex_dec.obj,    -
  260. X    skydome.obj,    -
  261. X    solarsys.obj,    -
  262. X    srch.obj,    -
  263. X    sun.obj,    -
  264. X    time.obj,    -
  265. X    utc_gst.obj,    -
  266. X    version.obj,    -
  267. X    sys$input/opt
  268. sys$share:decw$dxmlibshr/share
  269. sys$share:decw$xmlibshr/share
  270. sys$share:decw$xlibshr/share
  271. sys$share:vaxcrtl/share
  272. $!
  273. $!clean:
  274. $    purge
  275. $!
  276. SHAR_EOF
  277. chmod 0644 README ||
  278. echo 'restore of README failed'
  279. Wc_c="`wc -c < 'README'`"
  280. test 4774 -eq "$Wc_c" ||
  281.     echo 'README: original size 4774, current size' "$Wc_c"
  282. rm -f _shar_wnt_.tmp
  283. fi
  284. # ============= xephem.1X ==============
  285. if test -f 'xephem.1X' -a X"$1" != X"-c"; then
  286.     echo 'x - skipping xephem.1X (File already exists)'
  287.     rm -f _shar_wnt_.tmp
  288. else
  289. > _shar_wnt_.tmp
  290. echo 'x - extracting xephem.1X (Text)'
  291. sed 's/^X//' << 'SHAR_EOF' > 'xephem.1X' &&
  292. .TH xephem 1X
  293. .SH Name
  294. xephem \- an interative astronomical ephemeris for X
  295. .SH Syntax
  296. \fBxephem\fP [ \fIoptions\fP ] 
  297. .SH Description
  298. .PP
  299. .B Xephem
  300. is a program that displays ephemerides for all the planets, some moons,
  301. plus any two additional objects.  The additional objects may be fixed or
  302. specified via heliocentric elliptical, hyperbolic or parabolic orbital
  303. elements to accommodate solar system objects such as asteroids or comets.
  304. X
  305. Information displayed about each object includes RA and Dec precessed to any
  306. epoch, local azimuth and altitude, heliocentric coordinates, distance from
  307. sun and earth, solar elongation, angular size, visual magnitude, illumination
  308. percentage, local rise, transit and set times, length of time up,
  309. constellation, and angular separations between all combinations of objects.
  310. A special detail of Earth's moon and and Jupiter's moons and central meridian
  311. longitude is also available.
  312. X
  313. Observing circumstance information includes UTC and local date and time,
  314. local sidereal time, times of astronomical twilight, length of day and night,
  315. local temperature, pressure and height above sea level for the refraction
  316. model and a monthly calendar.
  317. X
  318. RA/Dec calculations are geocentric and include the effects of light travel
  319. time, nutation, aberration and precession.  Alt/az and rise/set/transit and,
  320. optionally, angular separation calculations are topocentric and include the
  321. additional effects of parallax and refraction.
  322. X
  323. Plot and listing files of selected field values may be generated as the
  324. program runs.  The plot files are full precision floating point values in
  325. ASCII intended for export to other plotting programs.  The listing files are
  326. tables formatted for more general human reading.  Xephem includes simple
  327. quick-look facilities to view plot files.
  328. X
  329. One may also watch the sky or the solar system with simple dots displays.
  330. X
  331. XXephem may be asked to search for interesting conditions automatically, using
  332. several algorithms. Most fields displayed on the screens may be used as terms
  333. in an arbitrary arithmetic expression that can be solved for local zero or
  334. extrema, or the time of state change of any boolean expression can be found.
  335. X
  336. Finally, xephem contains extensive on-line help. Much of that help is not
  337. duplicated here, so go ahead and run xephem to learn more.
  338. .SH Options
  339. .PP
  340. The following options unique to xephem are supported in addition to the
  341. usual options for any X program.
  342. Be sure that all options unique to xephem follow the generic X options.
  343. .PP
  344. .B \-c \fIconfig_file\fP
  345. specifies the name of an alternate configuration file to use.
  346. The default is ephem.cfg in the current directory.
  347. This may also be set using the 
  348. .I EPHEMCFG
  349. environment variable.
  350. .PP
  351. .B \-d \fIdb_file\fP
  352. specifies the name of an alternate database file to use.
  353. The default is ephem.db in the current directory.
  354. This may also be set using the 
  355. .I EPHEMDB
  356. environment variable.
  357. .PP
  358. .B \-h \fIhelp_file\fP
  359. specifies the name of an alternate help file to use.
  360. The default is xephem.hlp in the current directory.
  361. This may also be set using the 
  362. .I XEPHEMHELP
  363. environment variable.
  364. .PP
  365. Also, all of the variables that may be set from the configuration file can also
  366. be set from the command line. This is done in the form KEYWORD=VALUE; be sure
  367. to quote any meta characters from your shell. See the help on Initialization
  368. available from within the
  369. .B xephem
  370. main menu for the list if available keywords and values.
  371. .PP
  372. .SH Files
  373. .PP
  374. XXephem uses three auxiliary files: an initial configuration, an object data
  375. base and the help text.
  376. .PP
  377. The default name of the configuration file is
  378. .I ephem.cfg,
  379. in the current directory.
  380. This name can also be set using the -c command line argument or by defining
  381. the EPHEMCFG environment variable.
  382. Details of the configuration file format may be found in the main on-line help
  383. for "Initialization".
  384. .PP
  385. The default name of the database file is
  386. .I ephem.db,
  387. in the current directory.
  388. This name can also be set using the -d command line argument or by defining
  389. the EPHEMDB environment variable.
  390. Details of the
  391. database file may be found in the on-line help from the "ObjX/Y" dialog.
  392. .PP
  393. The default name of the help file is
  394. .I xephem.hlp,
  395. in the current directory.
  396. This name can also be set using the -h command line argument or by defining
  397. the XEPHEMHELP environment variable.
  398. .SH Menus
  399. .PP
  400. The
  401. .B xephem
  402. application contains the following menus:
  403. .sp 6p
  404. .nf
  405. File
  406. View
  407. Control
  408. ObjX/Y
  409. Help
  410. .fi
  411. .SH File menu
  412. .PP
  413. The
  414. .I File
  415. menu contains the following items:
  416. .IP Quit 20
  417. Ends
  418. .B xephem.
  419. .SH View menu
  420. .PP
  421. The
  422. .I View 
  423. menu contains the following items:
  424. .IP "General Data" 20
  425. Displays a table of miscellaneous planet and object statistics.
  426. .IP "Rise/Set" 20
  427. Displays a table of rise and set times and azimuths and transit times
  428. and altitudes.
  429. .IP "Separations" 20
  430. Displays a matrix of the angular separations between all pairs of objects.
  431. .IP "Jupiter" 20
  432. Displays the Jovian central meridian longitude and
  433. the locations of each Galilean moon.
  434. The latter are also shown in schematic form.
  435. .IP "Moon" 20
  436. Displays a pixmap image of the moon, properly shaded for current phase.
  437. An alternate schematic view is also selectable.
  438. .IP "Sky dome" 20
  439. Displays a schematic representation of the objects, shown as a dome as in the
  440. center fold of Sky and Telescope.
  441. .IP "Alt/Az sky" 20
  442. Displays a schematic representation of the objects, shown as a rectangular
  443. altitude-azimuth display.
  444. .IP "Solar system" 20
  445. Displays a schematic representation of the solar system. The center is always
  446. the Sun and the eye can be positioned at any desired location.
  447. .SH Control menu
  448. .PP
  449. The 
  450. .I Control
  451. menu contains the following items:
  452. .IP Plot 20
  453. Brings up a dialog allowing data to be saved in a file and later plotted.
  454. .IP Listing 20
  455. Brings up a dialog allowing data to be saved in a file in tabular format
  456. suitable for human consumption.
  457. .IP Search 20
  458. Brings up a dialog that controls the search facility of 
  459. .B xephem.
  460. Arbitrary mathematic functions can be built up from the available displayed
  461. information, and searches conducted automatically for 0 or maxima of the
  462. function.
  463. .SH ObjX/Y Menu
  464. .PP
  465. The
  466. .I ObjX/Y
  467. selection displays a dialog that allows the two user-defined objects to be
  468. defined.
  469. The objects may be defined in terms of their heliocentric orbital elements
  470. or be fixed objects.
  471. The descriptive parameters may be entered individually
  472. or set by making a selection from the database file.
  473. .SH Help
  474. .PP
  475. The 
  476. .I Help
  477. menu contains the following items:
  478. .PP
  479. .IP "on Version" 20
  480. Displays the current version of xephem, the copyright notice and a dynamic logo.
  481. .IP "on References" 20
  482. Displays the reference material used in the construction of xephem.
  483. .IP "Introduction" 20
  484. Displays background information about xephem. This is basically the same
  485. information as appears in the initial portion of this manual page.
  486. .IP "on Initialization" 20
  487. Displays information about where are how xephem uses command line and
  488. configuration file information when it is started.
  489. .IP "on Operation" 20
  490. Displays how xephem operates in terms of controlling its automatic looping
  491. and when time increments are performed.
  492. .IP "on Date and time" 20
  493. Displays information on the format of date and time fields in xephem.
  494. .IP "Notes" 20
  495. Display miscellaneous information about xephem, such as assumptions, known
  496. bugs and a wish list of features.
  497. .SH Resources
  498. .PP
  499. The
  500. .B xephem
  501. application contains fall-back resources and so requires no special
  502. resource initialization.
  503. For reference, a sample XEphem defaults file is
  504. included with the xephem distribution and
  505. the widget hierarchy is included in this manual page.
  506. .PP
  507. The 10 colors used for plotting are in resources named plotColor[0-9].
  508. If any color is not so defined or can not be allocated, PlotDA.foreground
  509. is used.
  510. .SH Widget Hierarchy
  511. .nf
  512. AppShell XEphem
  513. X    MainWindow xephem_main
  514. X    MenuBar menu_bar
  515. X        PulldownMenu file_pane
  516. X        PushButton Quit
  517. X        CascadeButton File
  518. X        PulldownMenu view_pane
  519. X        PushButton GenData
  520. X        PushButton RiSet
  521. X        PushButton Separations
  522. X        Separator ViewSep1
  523. X        PushButton Jupiter
  524. X        PushButton Moon
  525. X        Separator ViewSep2
  526. X        PushButton SkyDome
  527. X        PushButton AltAz
  528. X        PushButton SolSys
  529. X        CascadeButton View
  530. X        PulldownMenu control_pane
  531. X        PushButton Plot
  532. X        PushButton Listing
  533. X        PushButton Search
  534. X        CascadeButton Control
  535. X        CascadeButton ObjX/Y
  536. X        PulldownMenu help_pane
  537. X        PushButton onVersion
  538. X        PushButton onReferences
  539. X        PushButton Introduction
  540. X        PushButton onInitialization
  541. X        PushButton onOperation
  542. X        PushButton onDate
  543. X        PushButton Notes
  544. X        CascadeButton Help
  545. X    Form MainForm
  546. X        PushButton MainButton (many)
  547. X        Label MainLabel (many)
  548. X        Label NewCir
  549. X        PushButton Update
  550. X        Label Status
  551. X        Separator MainCol1
  552. X        Separator MainCol2
  553. X        Separator MainCol3
  554. X        Label Calendar (many)
  555. X    FormDialog Data
  556. X    PushButton DataButton (many)
  557. X    LabelGadget DataLabel (many)
  558. X    ToggleButtonGadget DmObjs (many)
  559. X    PushButtonGadget DataClose
  560. X    PushdButtonGadget DataToggle
  561. X    PushButtonGadget DataHelp
  562. X    FormDialog Riset
  563. X    PushButtonGadget RisetButton (many)
  564. X    LabelGadget RisetLabel (many)
  565. X    ToggleButtonGadget RmObjs (many)
  566. X    PushButtonGadget RisetClose
  567. X    RadioBox HznRadioBox
  568. X        ToggleButtonGadget AdpHznTB
  569. X        ToggleButtonGadget StdHznTB
  570. X    PushdButtonGadget RisetToggle
  571. X    PushButtonGadget RisetHelp
  572. X    FormDialog Separation
  573. X    PushButtonGadget SepButton (many)
  574. X    LabelGadget SepLabel (many)
  575. X    ToggleButtonGadget SmObjs (many)
  576. X    PushButtonGadget SepClose
  577. X    RadioBox CentricRadioBox
  578. X        ToggleButtonGadget TopocentricTB
  579. X        ToggleButtonGadget GeocentricTB
  580. X    PushdButtonGadget SepToggle
  581. X    PushButtonGadget SepHelp
  582. X    FormDialog Jupiter
  583. X    PushButtonGadget JupButton (many)
  584. X    LabelGadget JupLabel (many)
  585. X    PushButtonGadget JupClose
  586. X    Frame JupFrame
  587. X        DrawingArea JupMap
  588. X    FormDialog MoonForm
  589. X    ToggleButtonGadget MEShine
  590. X    ToggleButtonGadget MMapView
  591. X    PushdButtonGadget MClose
  592. X    Frame MoonFrame
  593. X        DrawingArea MoonDA
  594. X    FormDialg SkyDome
  595. X    PushdButtonGadget SDClose
  596. X    ToggleButtonGadget SDBigDots
  597. X    PushdButtonGadget SDToggle
  598. X    ToggleButtonGadget SDTrails
  599. X    ToggleButtonGadget SDPropts (many)
  600. X    LabelGadget SDPickedName
  601. X    LabelGadget North
  602. X    LabelGadget E
  603. X    LabelGadget W
  604. X    LabelGadget South
  605. X    DrawingArea SkyDomeMap
  606. X    FormDialg AltAz
  607. X    PushdButtonGadget AAClose
  608. X    ToggleButtonGadget AABigDots
  609. X    PushdButtonGadget AAToggle
  610. X    ToggleButtonGadget AATrails
  611. X    ToggleButtonGadget AAPropts (many)
  612. X    LabelGadget AAPickedName
  613. X    LabelGadget N
  614. X    LabelGadget E
  615. X    LabelGadget S
  616. X    LabelGadget W
  617. X    LabelGadget N
  618. X    LabelGadget Zenith
  619. X    Frame AltAzFrame
  620. X        DrawingArea AltAzMap
  621. X    FormDialog SolarSystem
  622. X    PushdButtonGadget SSClose
  623. X    PushdButtonGadget SSHelp
  624. X    ToggleButtonGadget SSToggle
  625. X    ToggleButtonGadget SSBigDots
  626. X    ToggleButtonGadget SSTrails
  627. X    ToggleButtonGadget SSPropts (many)
  628. X    LabelGadget SSPickedName
  629. X    Scale HLongScale
  630. X    Scale SSScale
  631. X    Scale HLatScale
  632. X    Frame SolarFrame
  633. X        DrawingArea SolarMap
  634. X    FormDialog Plot - the plot control dialog
  635. X    ToggleButtonGadget PlotSelect
  636. X    ToggleButtonGadget PlotActive
  637. X    ToggleButtonGadget PlotShow
  638. X    PushButtonGadget PlotClose
  639. X    PushButtonGadget PlotHelp
  640. X    Text PlotFilename
  641. X    LabelGadget PlotFnL
  642. X    Text PlotTitle
  643. X    LabelGadget PlotTL
  644. X    LabelGadget PlotPrompt
  645. X    LabelGadget Tag
  646. X    LabelGadget X
  647. X    LabelGadget Z
  648. X    Text PlotTag (many)
  649. X    LabelGadget PlotX (many)
  650. X    LabelGadget PlotY (many)
  651. X    FormDialog PlotD - the dialog containing the actual plot
  652. X    PushButtonGadget Close
  653. X    DrawingArea PlotDA
  654. X    ToggleButtonGadget DAFlipX
  655. X    ToggleButtonGadget DAFlipY
  656. X    ToggleButtonGadget DAGrid
  657. X    FormDialog List
  658. X    ToggleButtonGadget ListSelect
  659. X    ToggleButtonGadget ListActive
  660. X    PushButtonGadget ListClose
  661. X    PushButtonGadget ListHelp
  662. X    Text ListFilename
  663. X    LabelGadget ListFnL
  664. X    Text ListTitle
  665. X    LabelGadget ListTL
  666. X    LabelGadget ListPrompt
  667. X    LabelGadget ListLabel (many)
  668. X    FormDialog Srch
  669. X    SeparatorGadget SrchSep1
  670. X    ToggleButtonGadget On
  671. X    Frame SrchGoalRadioBoxFrame
  672. X        RadioBox SrchGoalRadioBox
  673. X        ToggleButtonGadget SrchExtreme
  674. X        ToggleButtonGadget Srch0
  675. X        ToggleButtonGadget SrchBinary
  676. X    SeparatorGadget SrchSep2
  677. X    LabelGadget SrchAccL
  678. X    PushButtonGadget SrchAcc
  679. X    SeparatorGadget SrchSep3
  680. X    ToggleButtonGadget SrchFields
  681. X    PushButtonGadget SrchCompile
  682. X    Text SrchFunction
  683. X    LabelGadget SrchErrsL
  684. X    PushButtonGadget SrchUse
  685. X    LabelGadget SrchValuL
  686. X    LabelGadget SrchValu
  687. X    PushButtonGadget SrchHelp
  688. X    PushButtonGadget SrchClose
  689. X    FormDialog Obj
  690. X    PushButtonGadget ObjHelp
  691. X    PushButtonGadget Lookup
  692. X    ScrolledList ScrolledList
  693. X    RadioBox ObjXYRadioBox
  694. X        ToggleButtonGadget ObjX
  695. X        ToggleButtonGadget ObjY
  696. X    RadioBox ObjTypeRadioBox
  697. X        ToggleButtonGadget Fixed
  698. X        ToggleButtonGadget Elliptical
  699. X        ToggleButtonGadget Hyperbolic
  700. X        ToggleButtonGadget Parabolic
  701. X    PushButtonGadget ObjClose
  702. X    PushButtonGadget ObjButton (many)
  703. X    PushButtonGadget <fields> (many)
  704. X    FormDialog HelpD
  705. X    PushButton HelpC
  706. X    ScrolledText HelpST
  707. .SH Author
  708. .PP
  709. Elwood Downey
  710. .SH See also
  711. .PP
  712. Ephem, the ancestor of xephem suitable for "dumb" 24x80 character displays.
  713. SHAR_EOF
  714. chmod 0644 xephem.1X ||
  715. echo 'restore of xephem.1X failed'
  716. Wc_c="`wc -c < 'xephem.1X'`"
  717. test 12887 -eq "$Wc_c" ||
  718.     echo 'xephem.1X: original size 12887, current size' "$Wc_c"
  719. rm -f _shar_wnt_.tmp
  720. fi
  721. # ============= Manifest ==============
  722. if test -f 'Manifest' -a X"$1" != X"-c"; then
  723.     echo 'x - skipping Manifest (File already exists)'
  724.     rm -f _shar_wnt_.tmp
  725. else
  726. > _shar_wnt_.tmp
  727. echo 'x - extracting Manifest (Text)'
  728. sed 's/^X//' << 'SHAR_EOF' > 'Manifest' &&
  729. Makefile    just say "make"
  730. Manifest    this file.
  731. README        check here for hints before building.
  732. XXEphem        defaults file (basically the same as fallback ones in xephem.c)
  733. ephem.cfg    initialization file
  734. ephem.db    database file
  735. xephem.1X    manual page, written with the nroff -man macros.
  736. X
  737. The source files:
  738. aa_hadec.c      convert between alt/az and hour angle/dec.
  739. altaz.c        manage the alt/az menu.
  740. anomaly.c       compute anomaly.
  741. astro.h         unit conversion macros and planet defines.
  742. cal_mjd.c       converters to and from modified julian date.
  743. circum.c        main "astronomy" entry point that finds where anything is.
  744. circum.h        defines Now and Sky structures.
  745. comet.c         compute comet position from elements.
  746. compiler.c      compile and execute general expressions with screen fields.
  747. constel.c       handles determing and printing constellation info.
  748. datamenu.c    manage the general data menu.
  749. eq_ecl.c        convert between equitorial and eclipitic coords.
  750. fieldmap.h    typedef to describe dialog layouts.
  751. flog.c          logs and retrieves screen locations for logging purposes.
  752. formats.c       basic date, time, prompts, etc formats.
  753. help.c        manage the help menu and supporting text file.
  754. jupmenu.c    manage the jupiter moon map menu.
  755. listing.c    manage the listing control menu.
  756. mainmenu.c    manage the main menu.
  757. moon.c          compute moon position.
  758. moonmenu.c    manage the moon display menu.
  759. moonnf.c        compute new and full moon dates.
  760. moreobjs.h    aux include to astro.h.
  761. nutation.c      compute nutation correction.
  762. obj.c        manage the objx/y menu and the database file.
  763. obliq.c         compute obliquity.
  764. parallax.c      functions to compute earth rim parallax correction.
  765. pelement.c      basic planet position polynomial coefficients.
  766. plans.c         use polynomials to find planet location at any certain time.
  767. plot.c        manage the plot control menu and write supporting files.
  768. plot_aux.c    manage the actual plotting menu and read supporting files.
  769. precess.c       compute precession correction.
  770. query.c        general purpose menu query tool.
  771. reduce.c        convert elliptical elements from one epoch to another.
  772. refract.c       atmospheric refraction model.
  773. riset.c         find basic rise/set sideral times of a fixed object.
  774. riset_c.c       iteratively solve for local rise/set times of moving objects.
  775. risetmenu.c    manage the rise/set menu.
  776. sepmenu.c    manage the separations menu.
  777. sex_dec.c       convert between sexagesimal and decimal notation.
  778. skydome.c    manage the circular sky dome menu.
  779. smallfm.xbm    moon bitmap.
  780. solarsys.c    manage the solar system menu.
  781. srch.c        manage the search control menu.
  782. sun.c           compute location of sun at any time.
  783. time.c          manage setting and getting the time from the os
  784. utc_gst.c       convert between UT1 and Greenwich sidereal time
  785. version.c       current version notice, and revision history comments.
  786. xephem.c    main() and misc minor support utility functions.
  787. xephem.hlp    help text file.
  788. SHAR_EOF
  789. chmod 0644 Manifest ||
  790. echo 'restore of Manifest failed'
  791. Wc_c="`wc -c < 'Manifest'`"
  792. test 2941 -eq "$Wc_c" ||
  793.     echo 'Manifest: original size 2941, current size' "$Wc_c"
  794. rm -f _shar_wnt_.tmp
  795. fi
  796. # ============= Makefile ==============
  797. if test -f 'Makefile' -a X"$1" != X"-c"; then
  798.     echo 'x - skipping Makefile (File already exists)'
  799.     rm -f _shar_wnt_.tmp
  800. else
  801. > _shar_wnt_.tmp
  802. echo 'x - extracting Makefile (Text)'
  803. sed 's/^X//' << 'SHAR_EOF' > 'Makefile' &&
  804. CFLAGS = -D_NO_PROTO -I/usr/include/X11 -O
  805. LIBS = -lXm -lXt -lX11 -lm
  806. X
  807. .PRECIOUS: xephem
  808. X
  809. XXEPHEM=    aa_hadec.o \
  810. X    altaz.o \
  811. X    anomaly.o \
  812. X    cal_mjd.o \
  813. X    circum.o \
  814. X    comet.o \
  815. X    compiler.o \
  816. X    constel.o \
  817. X    datamenu.o \
  818. X    eq_ecl.o \
  819. X    flog.o \
  820. X    formats.o \
  821. X    help.o \
  822. X    jupmenu.o \
  823. X    listing.o \
  824. X    mainmenu.o \
  825. X    moon.o \
  826. X    moonmenu.o \
  827. X    moonnf.o \
  828. X    nutation.o \
  829. X    obj.o \
  830. X    obliq.o \
  831. X    parallax.o \
  832. X    pelement.o \
  833. X    plans.o \
  834. X    plot.o \
  835. X    plot_aux.o \
  836. X    precess.o \
  837. X    query.o \
  838. X    reduce.o \
  839. X    refract.o \
  840. X    riset.o \
  841. X    riset_c.o \
  842. X    risetmenu.o \
  843. X    sepmenu.o \
  844. X    sex_dec.o \
  845. X    skydome.o \
  846. X    solarsys.o \
  847. X    srch.o \
  848. X    sun.o \
  849. X    time.o \
  850. X    utc_gst.o \
  851. X    version.o \
  852. X    xephem.o
  853. X
  854. xephem:    $(XEPHEM)
  855. X    $(CC) $(LDFLAGS) -o $@ $(XEPHEM) $(LIBS)
  856. X
  857. clean:
  858. X    rm -f $(XEPHEM)
  859. X
  860. clobber: clean
  861. X    rm -f xephem
  862. X
  863. X
  864. aa_hadec.o: astro.h
  865. X
  866. altaz.o: astro.h circum.h moreobjs.h
  867. X
  868. anomaly.o: astro.h
  869. X
  870. cal_mjd.o: astro.h
  871. X
  872. circum.o: astro.h circum.h moreobjs.h
  873. X
  874. comet.o: astro.h
  875. X
  876. compiler.o: fieldmap.h
  877. X
  878. constel.o: astro.h
  879. X
  880. datamenu.o: fieldmap.h astro.h circum.h moreobjs.h
  881. X
  882. eq_ecl.o: astro.h
  883. X
  884. formats.o: astro.h
  885. X
  886. jupmenu.o: fieldmap.h astro.h circum.h moreobjs.h
  887. X
  888. listing.o: fieldmap.h
  889. X
  890. mainmenu.o: fieldmap.h astro.h circum.h moreobjs.h
  891. X
  892. moon.o: astro.h
  893. X
  894. moonmenu.o: astro.h circum.h moreobjs.h smallfm.xbm
  895. X
  896. moonnf.o: astro.h
  897. X
  898. nutation.o: astro.h
  899. X
  900. obj.o: fieldmap.h astro.h circum.h moreobjs.h
  901. X
  902. obliq.o: astro.h
  903. X
  904. parallax.o: astro.h
  905. X
  906. pelement.o: astro.h
  907. X
  908. plans.o: astro.h
  909. X
  910. plot.o: fieldmap.h
  911. X
  912. precess.o: astro.h
  913. X
  914. reduce.o: astro.h
  915. X
  916. refract.o: astro.h
  917. X
  918. riset.o: astro.h
  919. X
  920. riset_c.o: astro.h circum.h moreobjs.h
  921. X
  922. risetmenu.o: fieldmap.h astro.h circum.h moreobjs.h
  923. X
  924. sepmenu.o: fieldmap.h astro.h circum.h moreobjs.h
  925. X
  926. skydome.o: astro.h circum.h moreobjs.h
  927. X
  928. solarsys.o: astro.h circum.h moreobjs.h
  929. X
  930. srch.o: fieldmap.h
  931. X
  932. sun.o: astro.h
  933. X
  934. time.o: astro.h circum.h
  935. X
  936. utc_gst.o: astro.h
  937. X
  938. version.o: astro.h circum.h moreobjs.h patchlevel.h
  939. X
  940. SHAR_EOF
  941. chmod 0644 Makefile ||
  942. echo 'restore of Makefile failed'
  943. Wc_c="`wc -c < 'Makefile'`"
  944. test 1863 -eq "$Wc_c" ||
  945.     echo 'Makefile: original size 1863, current size' "$Wc_c"
  946. rm -f _shar_wnt_.tmp
  947. fi
  948. # ============= XEphem ==============
  949. if test -f 'XEphem' -a X"$1" != X"-c"; then
  950.     echo 'x - skipping XEphem (File already exists)'
  951.     rm -f _shar_wnt_.tmp
  952. else
  953. > _shar_wnt_.tmp
  954. echo 'x - extracting XEphem (Text)'
  955. sed 's/^X//' << 'SHAR_EOF' > 'XEphem' &&
  956. XXEphem*traversalOn:           false
  957. X
  958. XXEphem*highlightOnEnter:    false
  959. XXEphem*highlightThickness:    0
  960. X
  961. XXEphem*XmText*traversalOn:       true
  962. XXEphem*XmText*highlightOnEnter:    false
  963. XXEphem*XmText*highlightThickness:    0
  964. X
  965. XXEphem*xephem_main.x: 50
  966. XXEphem*xephem_main.y: 50
  967. XXEphem*Data.x: 100
  968. XXEphem*Data.y: 200
  969. XXEphem*Riset.x: 150
  970. XXEphem*Riset.y: 250
  971. XXEphem*Separation.x: 200
  972. XXEphem*Separation.y: 300
  973. XXEphem*Jupiter.x: 100
  974. XXEphem*Jupiter.y: 200
  975. XXEphem*SkyDome.x: 150
  976. XXEphem*SkyDome.y: 250
  977. XXEphem*AltAz.x: 200
  978. XXEphem*AltAz.y: 300
  979. XXEphem*SolarSystem.x: 250
  980. XXEphem*SolarSystem.y: 350
  981. XXEphem*Plot.x: 100
  982. XXEphem*Plot.y: 200
  983. XXEphem*List.x: 150
  984. XXEphem*List.y: 250
  985. XXEphem*Srch.x: 200
  986. XXEphem*Srch.y: 300
  987. XXEphem*MoonForm.x: 200
  988. XXEphem*MoonForm.y: 200
  989. X
  990. XXEphem*foreground: #fce089
  991. XXEphem*background: #7c8498
  992. X
  993. XXEphem*fontList: fixed
  994. X
  995. XXEphem*JupMap*background: navy
  996. XXEphem*JupMap*foreground: snow
  997. XXEphem*AltAzMap*background: navy
  998. XXEphem*AltAzMap*foreground: snow
  999. XXEphem*SolarMap*background: navy
  1000. XXEphem*SolarMap*foreground: snow
  1001. XXEphem*SkyDomeMap*background: navy
  1002. XXEphem*SkyDomeMap*foreground: snow
  1003. XXEphem*PlotDA*foreground: #fce089
  1004. XXEphem*PlotDA*background: navy
  1005. XXEphem*MoonDA*foreground: snow
  1006. XXEphem*MoonDA*background: navy
  1007. XXEphem*VMap*foreground: snow
  1008. XXEphem*VMap*background: navy
  1009. SHAR_EOF
  1010. chmod 0644 XEphem ||
  1011. echo 'restore of XEphem failed'
  1012. Wc_c="`wc -c < 'XEphem'`"
  1013. test 1249 -eq "$Wc_c" ||
  1014.     echo 'XEphem: original size 1249, current size' "$Wc_c"
  1015. rm -f _shar_wnt_.tmp
  1016. fi
  1017. # ============= ephem.cfg ==============
  1018. if test -f 'ephem.cfg' -a X"$1" != X"-c"; then
  1019.     echo 'x - skipping ephem.cfg (File already exists)'
  1020.     rm -f _shar_wnt_.tmp
  1021. else
  1022. > _shar_wnt_.tmp
  1023. echo 'x - extracting ephem.cfg (Text)'
  1024. sed 's/^X//' << 'SHAR_EOF' > 'ephem.cfg' &&
  1025. UT=Now
  1026. LONG=91:40:0
  1027. LAT=41:51:0
  1028. HEIGHT=800
  1029. TEMP=60
  1030. PRES=29.5
  1031. STPSZ=RTC
  1032. PROPTS=TSMevmjsunpxy
  1033. EPOCH=2000
  1034. NSTEP=1
  1035. PAUSE=60
  1036. X
  1037. OBJX=Mueller
  1038. OBJY=Gaspra
  1039. SHAR_EOF
  1040. chmod 0644 ephem.cfg ||
  1041. echo 'restore of ephem.cfg failed'
  1042. Wc_c="`wc -c < 'ephem.cfg'`"
  1043. test 146 -eq "$Wc_c" ||
  1044.     echo 'ephem.cfg: original size 146, current size' "$Wc_c"
  1045. rm -f _shar_wnt_.tmp
  1046. fi
  1047. # ============= aa_hadec.c ==============
  1048. if test -f 'aa_hadec.c' -a X"$1" != X"-c"; then
  1049.     echo 'x - skipping aa_hadec.c (File already exists)'
  1050.     rm -f _shar_wnt_.tmp
  1051. else
  1052. > _shar_wnt_.tmp
  1053. echo 'x - extracting aa_hadec.c (Text)'
  1054. sed 's/^X//' << 'SHAR_EOF' > 'aa_hadec.c' &&
  1055. #include <stdio.h>
  1056. #include <math.h>
  1057. #include "astro.h"
  1058. X
  1059. /* given latitude (n+, radians), lat, altitude (up+, radians), alt, and
  1060. X * azimuth (angle round to the east from north+, radians),
  1061. X * return hour angle (radians), ha, and declination (radians), dec.
  1062. X */
  1063. aa_hadec (lat, alt, az, ha, dec)
  1064. double lat;
  1065. double alt, az;
  1066. double *ha, *dec;
  1067. {
  1068. X    aaha_aux (lat, az, alt, ha, dec);
  1069. }
  1070. X
  1071. /* given latitude (n+, radians), lat, hour angle (radians), ha, and declination
  1072. X * (radians), dec,
  1073. X * return altitude (up+, radians), alt, and
  1074. X * azimuth (angle round to the east from north+, radians),
  1075. X */
  1076. hadec_aa (lat, ha, dec, alt, az)
  1077. double lat;
  1078. double ha, dec;
  1079. double *alt, *az;
  1080. {
  1081. X    aaha_aux (lat, ha, dec, az, alt);
  1082. }
  1083. X
  1084. /* the actual formula is the same for both transformation directions so
  1085. X * do it here once for each way.
  1086. X * N.B. all arguments are in radians.
  1087. X */
  1088. static
  1089. aaha_aux (lat, x, y, p, q)
  1090. double lat;
  1091. double x, y;
  1092. double *p, *q;
  1093. {
  1094. X    static double lastlat = -1000.;
  1095. X    static double sinlastlat, coslastlat;
  1096. X    double sy, cy;
  1097. X    double sx, cx;
  1098. X    double sq, cq;
  1099. X    double a;
  1100. X    double cp;
  1101. X
  1102. X    /* latitude doesn't change much, so try to reuse the sin and cos evals.
  1103. X     */
  1104. X    if (lat != lastlat) {
  1105. X        sinlastlat = sin (lat);
  1106. X        coslastlat = cos (lat);
  1107. X        lastlat = lat;
  1108. X    }
  1109. X
  1110. X    sy = sin (y);
  1111. X    cy = cos (y);
  1112. X    sx = sin (x);
  1113. X    cx = cos (x);
  1114. X
  1115. /* define GOODATAN2 if atan2 returns full range -PI through +PI.
  1116. X */
  1117. #ifdef GOODATAN2
  1118. X    *q = asin ((sy*sinlastlat) + (cy*coslastlat*cx));
  1119. X    *p = atan2 (-cy*sx, -cy*cx*sinlastlat + sy*coslastlat);
  1120. #else
  1121. #define    EPS    (1e-20)
  1122. X    sq = (sy*sinlastlat) + (cy*coslastlat*cx);
  1123. X    *q = asin (sq);
  1124. X    cq = cos (*q);
  1125. X    a = coslastlat*cq;
  1126. X    if (a > -EPS && a < EPS)
  1127. X        a = a < 0 ? -EPS : EPS; /* avoid / 0 */
  1128. X    cp = (sy - (sinlastlat*sq))/a;
  1129. X    if (cp >= 1.0)    /* the /a can be slightly > 1 */
  1130. X        *p = 0.0;
  1131. X    else if (cp <= -1.0)
  1132. X        *p = PI;
  1133. X    else
  1134. X        *p = acos ((sy - (sinlastlat*sq))/a);
  1135. X    if (sx>0) *p = 2.0*PI - *p;
  1136. #endif
  1137. }
  1138. SHAR_EOF
  1139. chmod 0644 aa_hadec.c ||
  1140. echo 'restore of aa_hadec.c failed'
  1141. Wc_c="`wc -c < 'aa_hadec.c'`"
  1142. test 1922 -eq "$Wc_c" ||
  1143.     echo 'aa_hadec.c: original size 1922, current size' "$Wc_c"
  1144. rm -f _shar_wnt_.tmp
  1145. fi
  1146. # ============= altaz.c ==============
  1147. if test -f 'altaz.c' -a X"$1" != X"-c"; then
  1148.     echo 'x - skipping altaz.c (File already exists)'
  1149.     rm -f _shar_wnt_.tmp
  1150. else
  1151. > _shar_wnt_.tmp
  1152. echo 'x - extracting altaz.c (Text)'
  1153. sed 's/^X//' << 'SHAR_EOF' > 'altaz.c' &&
  1154. /* code to manage the stuff on the altaz display.
  1155. X */
  1156. X
  1157. #include <stdio.h>
  1158. #include <ctype.h>
  1159. #include <math.h>
  1160. #ifdef VMS
  1161. #include <stdlib.h>
  1162. #endif
  1163. #include <X11/Xlib.h>
  1164. #include <Xm/Xm.h>
  1165. #include <Xm/Form.h>
  1166. #include <Xm/Frame.h>
  1167. #include <Xm/DrawingA.h>
  1168. #include <Xm/LabelG.h>
  1169. #include <Xm/PushBG.h>
  1170. #include <Xm/ToggleBG.h>
  1171. #include <Xm/Text.h>
  1172. #include <Xm/Scale.h>
  1173. #include "astro.h"
  1174. #include "circum.h"
  1175. #include "moreobjs.h"
  1176. X
  1177. extern Now *mm_get_now();
  1178. extern char *objname[];
  1179. extern Widget toplevel_w;
  1180. #define    XtD    XtDisplay(toplevel_w)
  1181. X
  1182. static Widget aaform_w;        /* main altaz form dialog */
  1183. static Widget aada_w;        /* altaz drawring area */
  1184. static Widget picked_name_w;    /* display name of object if picked */
  1185. static Widget objs_w[NOBJ];    /* object selection toggle buttons */
  1186. X
  1187. #define    TRAILS    1
  1188. #define    BIGDOTS    2
  1189. #define    NR    15
  1190. #define    NC    36
  1191. X
  1192. static int trails;
  1193. static int bigdots = 1;
  1194. X
  1195. /* use this string to make a label gadget appear empty.
  1196. X * using "" seems to act like unmanaging it altogether!
  1197. X */
  1198. static char no_name[] = " ";
  1199. X
  1200. /* alt/az coordinates, and enough info to locate it on screen */
  1201. typedef struct {
  1202. X    double alt, az;    /* alt/az coords */
  1203. X    int p;        /* object code */
  1204. X    int sx, sy;        /* screen (window) coords */
  1205. } DLoc;
  1206. X
  1207. static DLoc *points;    /* malloc'd set of points on screen now */
  1208. static int npoints;    /* number of points */
  1209. X
  1210. static unsigned int propts;    /* mask of 1<<obj that are on */
  1211. X
  1212. X
  1213. /* called when the altaz view is activated via the main menu pulldown.
  1214. X * if never called before, create and manage all the widgets as a child of a
  1215. X * form. otherwise, just toggle whether the form is managed.
  1216. X */
  1217. aa_manage ()
  1218. {
  1219. X    if (!aaform_w) {
  1220. X        void aa_activate_cb();
  1221. X        void aa_close_cb();
  1222. X        void aa_da_exp_cb();
  1223. X        void aa_propts_cb();
  1224. X        void aa_toggle_cb();
  1225. X        Widget close_w;
  1226. X        Widget trails_w;
  1227. X        Widget toggle_w;
  1228. X        Widget w, pw;
  1229. X        Widget big_w;
  1230. X        Widget frame_w;
  1231. X        Widget n_w, z_w;
  1232. X        XmString str;
  1233. X        Arg args[20];
  1234. X        int n;
  1235. X        int i, p;
  1236. X
  1237. X        /* create form */
  1238. X        n = 0;
  1239. X        XtSetArg (args[n], XmNautoUnmanage, False); n++;
  1240. X        XtSetArg (args[n], XmNdefaultPosition, False); n++;
  1241. X        XtSetArg (args[n], XmNresizePolicy, XmRESIZE_NONE); n++;
  1242. X        XtSetArg (args[n], XmNwidth, NC*char_width()); n++;
  1243. X        XtSetArg (args[n], XmNheight, NR*char_height()); n++;
  1244. X        aaform_w = XmCreateFormDialog (toplevel_w, "AltAz", args, n);
  1245. X
  1246. X        /* set some stuff in the parent DialogShell.
  1247. X         * setting XmNdialogTitle in the Form didn't work..
  1248. X         */
  1249. X        n = 0;
  1250. X        XtSetArg (args[n], XmNtitle, "xephem Altitude/Azimuth View"); n++;
  1251. X        XtSetValues (XtParent(aaform_w), args, n);
  1252. X
  1253. X        /* "close" push button */
  1254. X
  1255. X        str = XmStringCreate("Close", XmSTRING_DEFAULT_CHARSET);
  1256. X        n = 0;
  1257. X        XtSetArg (args[n], XmNlabelString, str); n++;
  1258. X        XtSetArg (args[n], XmNbottomAttachment, XmATTACH_FORM); n++;
  1259. X        XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++;
  1260. X        close_w = XmCreatePushButtonGadget (aaform_w, "AAClose", args, n);
  1261. X        XtAddCallback (close_w, XmNactivateCallback, aa_close_cb, 0);
  1262. X        XtManageChild (close_w);
  1263. X        XmStringFree (str);
  1264. X
  1265. X        /* "big dots" toggle button */
  1266. X
  1267. X        str = XmStringCreate("Big dots", XmSTRING_DEFAULT_CHARSET);
  1268. X        n = 0;
  1269. X        XtSetArg (args[n], XmNset, bigdots); n++;
  1270. X        XtSetArg (args[n], XmNbottomAttachment, XmATTACH_WIDGET); n++;
  1271. X        XtSetArg (args[n], XmNbottomWidget, close_w); n++;
  1272. X        XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++;
  1273. X        XtSetArg (args[n], XmNlabelString, str); n++;
  1274. X        big_w = XmCreateToggleButtonGadget(aaform_w,"AABigDots",args,n);
  1275. X        XmStringFree (str);
  1276. X        XtManageChild (big_w);
  1277. X        XtAddCallback(big_w, XmNvalueChangedCallback, aa_activate_cb,
  1278. X                                    BIGDOTS);
  1279. X
  1280. X        /* "toggle on/off" push button */
  1281. X
  1282. X        str = XmStringCreate("Toggle On/off", XmSTRING_DEFAULT_CHARSET);
  1283. X        n = 0;
  1284. X        XtSetArg (args[n], XmNlabelString, str); n++;
  1285. X        XtSetArg (args[n], XmNbottomAttachment, XmATTACH_FORM); n++;
  1286. X        XtSetArg (args[n], XmNrightAttachment, XmATTACH_FORM); n++;
  1287. X        toggle_w = XmCreatePushButtonGadget (aaform_w, "AAToggle", args, n);
  1288. X        XtAddCallback (toggle_w, XmNactivateCallback, aa_toggle_cb, 0);
  1289. X        XtManageChild (toggle_w);
  1290. X        XmStringFree (str);
  1291. X
  1292. X        /* "leave trails" toggle button */
  1293. X
  1294. X        str = XmStringCreate("Leave trails", XmSTRING_DEFAULT_CHARSET);
  1295. X        n = 0;
  1296. X        XtSetArg (args[n], XmNbottomAttachment, XmATTACH_WIDGET); n++;
  1297. X        XtSetArg (args[n], XmNbottomWidget, toggle_w); n++;
  1298. X        XtSetArg (args[n], XmNrightAttachment, XmATTACH_FORM); n++;
  1299. X        XtSetArg (args[n], XmNlabelString, str); n++;
  1300. X        trails_w = XmCreateToggleButtonGadget(aaform_w, "AATrails", args,n);
  1301. X        XmStringFree (str);
  1302. X        XtManageChild (trails_w);
  1303. X        XtAddCallback(trails_w, XmNvalueChangedCallback, aa_activate_cb,
  1304. X                                    TRAILS);
  1305. X
  1306. X        /* make the object selection buttons */
  1307. X
  1308. X        for (i = 0, p = nxtbody(-1); p != -1; i++, p = nxtbody(p)) {
  1309. X        str = XmStringCreate (objname[p], XmSTRING_DEFAULT_CHARSET);
  1310. X        n = 0;
  1311. X        XtSetArg (args[n], XmNlabelString, str); n++;
  1312. X        XtSetArg (args[n], XmNset, propts & (1<<p) ? True : False); n++;
  1313. X        XtSetArg (args[n], XmNindicatorOn, False); n++;
  1314. X        XtSetArg (args[n], XmNshadowThickness, 2); n++;
  1315. X        XtSetArg (args[n], XmNbottomAttachment, XmATTACH_WIDGET); n++;
  1316. X        XtSetArg (args[n], XmNbottomWidget, big_w); n++;
  1317. X        XtSetArg (args[n], XmNleftAttachment, XmATTACH_POSITION); n++;
  1318. X        XtSetArg (args[n], XmNleftPosition, i*100/NOBJ); n++;
  1319. X        pw = XmCreateToggleButtonGadget (aaform_w, "AAPropts", args, n);
  1320. X        XtAddCallback(pw, XmNvalueChangedCallback, aa_propts_cb, p);
  1321. X        XtManageChild (pw);
  1322. X        objs_w[p] = pw;
  1323. X        XmStringFree (str);
  1324. X        }
  1325. X
  1326. X        /* make the picked object label */
  1327. X
  1328. X        str = XmStringCreate(no_name, XmSTRING_DEFAULT_CHARSET);
  1329. X        n = 0;
  1330. X        XtSetArg (args[n], XmNlabelString, str); n++;
  1331. X        XtSetArg (args[n], XmNbottomAttachment, XmATTACH_WIDGET); n++;
  1332. X        XtSetArg (args[n], XmNbottomWidget, pw); n++;
  1333. X        XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++;
  1334. X        XtSetArg (args[n], XmNrightAttachment, XmATTACH_FORM); n++;
  1335. X        XtSetArg (args[n], XmNalignment, XmALIGNMENT_CENTER); n++;
  1336. X        picked_name_w = XmCreateLabelGadget (aaform_w, "AAPickedName",
  1337. X                                    args, n);
  1338. X        XtManageChild (picked_name_w);
  1339. X        XmStringFree (str);
  1340. X
  1341. X        /* make the orientation labels */
  1342. X
  1343. X        n = 0;
  1344. X        XtSetArg (args[n], XmNbottomAttachment, XmATTACH_WIDGET); n++;
  1345. X        XtSetArg (args[n], XmNbottomWidget, picked_name_w); n++;
  1346. X        XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++;
  1347. X        n_w = XmCreateLabelGadget (aaform_w, "N", args, n);
  1348. X        XtManageChild (n_w);
  1349. X        n = 0;
  1350. X        XtSetArg (args[n], XmNbottomAttachment, XmATTACH_WIDGET); n++;
  1351. X        XtSetArg (args[n], XmNbottomWidget, picked_name_w); n++;
  1352. X        XtSetArg (args[n], XmNleftAttachment, XmATTACH_POSITION); n++;
  1353. X        XtSetArg (args[n], XmNleftPosition, 23); n++;
  1354. X        w = XmCreateLabelGadget (aaform_w, "E", args, n);
  1355. X        XtManageChild (w);
  1356. X        n = 0;
  1357. X        XtSetArg (args[n], XmNbottomAttachment, XmATTACH_WIDGET); n++;
  1358. X        XtSetArg (args[n], XmNbottomWidget, picked_name_w); n++;
  1359. X        XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++;
  1360. X        XtSetArg (args[n], XmNrightAttachment, XmATTACH_FORM); n++;
  1361. X        XtSetArg (args[n], XmNalignment, XmALIGNMENT_CENTER); n++;
  1362. X        w = XmCreateLabelGadget (aaform_w, "S", args, n);
  1363. X        XtManageChild (w);
  1364. X        n = 0;
  1365. X        XtSetArg (args[n], XmNbottomAttachment, XmATTACH_WIDGET); n++;
  1366. X        XtSetArg (args[n], XmNbottomWidget, picked_name_w); n++;
  1367. X        XtSetArg (args[n], XmNleftAttachment, XmATTACH_POSITION); n++;
  1368. X        XtSetArg (args[n], XmNleftPosition, 73); n++;
  1369. X        w = XmCreateLabelGadget (aaform_w, "W", args, n);
  1370. X        XtManageChild (w);
  1371. X        n = 0;
  1372. X        XtSetArg (args[n], XmNbottomAttachment, XmATTACH_WIDGET); n++;
  1373. X        XtSetArg (args[n], XmNbottomWidget, picked_name_w); n++;
  1374. X        XtSetArg (args[n], XmNrightAttachment, XmATTACH_FORM); n++;
  1375. X        w = XmCreateLabelGadget (aaform_w, "N", args, n);
  1376. X        XtManageChild (w);
  1377. X        n = 0;
  1378. X        str = XmStringCreate ("... Zenith ...", XmSTRING_DEFAULT_CHARSET);
  1379. X        XtSetArg (args[n], XmNlabelString, str); n++;
  1380. X        XtSetArg (args[n], XmNtopAttachment, XmATTACH_FORM); n++;
  1381. X        XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++;
  1382. X        XtSetArg (args[n], XmNrightAttachment, XmATTACH_FORM); n++;
  1383. X        XtSetArg (args[n], XmNalignment, XmALIGNMENT_CENTER); n++;
  1384. X        z_w = XmCreateLabelGadget (aaform_w, "Zenith", args, n);
  1385. X        XtManageChild (z_w);
  1386. X        XmStringFree(str);
  1387. X
  1388. X
  1389. X        /* make a frame for the drawing area */
  1390. X
  1391. X        n = 0;
  1392. X        XtSetArg (args[n], XmNtopAttachment, XmATTACH_WIDGET); n++;
  1393. X        XtSetArg (args[n], XmNtopWidget, z_w); n++;
  1394. X        XtSetArg (args[n], XmNbottomAttachment, XmATTACH_WIDGET); n++;
  1395. X        XtSetArg (args[n], XmNbottomWidget, n_w); n++;
  1396. X        XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++;
  1397. X        XtSetArg (args[n], XmNrightAttachment, XmATTACH_FORM); n++;
  1398. X        XtSetArg (args[n], XmNshadowType, XmSHADOW_ETCHED_OUT); n++;
  1399. X        frame_w = XmCreateFrame (aaform_w, "AltAzFrame", args, n);
  1400. X        XtManageChild (frame_w);
  1401. X
  1402. X        /* make a drawing area in the frame for the sky */
  1403. X
  1404. X        n = 0;
  1405. X        aada_w = XmCreateDrawingArea (frame_w, "AltAzMap", args, n);
  1406. X        XtManageChild (aada_w);
  1407. X        XtAddCallback (aada_w, XmNexposeCallback, aa_da_exp_cb, 0);
  1408. X        XtAddCallback (aada_w, XmNresizeCallback, aa_da_exp_cb, 0);
  1409. X        XtAddCallback (aada_w, XmNinputCallback, aa_da_exp_cb, 0);
  1410. X    }
  1411. X    
  1412. X    if (XtIsManaged(aaform_w))
  1413. X        XtUnmanageChild (aaform_w);
  1414. X    else {
  1415. X        XtManageChild (aaform_w);
  1416. X        aa_update (mm_get_now(), 1);
  1417. X    }
  1418. }
  1419. X
  1420. aa_set_objs_on(mask)
  1421. int mask;
  1422. {
  1423. X    propts = mask;
  1424. }
  1425. X
  1426. aa_ison()
  1427. {
  1428. X    return (aaform_w && XtIsManaged(aaform_w));
  1429. }
  1430. X
  1431. /* called when we are to update our view.
  1432. X * don't bother if we are unmanaged unless trails is on - in that case,
  1433. X * compute the new locations but don't display them.
  1434. X */
  1435. aa_update (np, how_much)
  1436. Now *np;
  1437. int how_much;
  1438. {
  1439. X    double as = how_much ? 0.0 : 3600.0;
  1440. X    Sky sky;
  1441. X    DLoc *lp;
  1442. X    int up;
  1443. X    int p;
  1444. X
  1445. X    up = aaform_w && XtIsManaged(aaform_w);
  1446. X    if (!up && !trails)
  1447. X        return;
  1448. X
  1449. X    if (!trails) {
  1450. X        if (points)
  1451. X        XtFree ((char*)points);
  1452. X        points = 0;
  1453. X        npoints = 0;
  1454. X    }
  1455. X
  1456. X    for (p = 0; p < NOBJ; p++) {
  1457. X        if ((p==OBJX || p==OBJY) && !obj_ison(p))
  1458. X        continue;
  1459. X        (void) body_cir (p, as, np, &sky);
  1460. X        if (sky.s_alt <= 0.0)
  1461. X        continue;
  1462. X        npoints++;
  1463. X        points = (DLoc *) XtRealloc ((char *)points, npoints*sizeof(DLoc));
  1464. X        lp = &points[npoints-1];
  1465. X        lp->alt = sky.s_alt;
  1466. X        lp->az = sky.s_az;
  1467. X        lp->p = p;
  1468. X    }
  1469. X
  1470. X    if (up)
  1471. X        aa_all(!trails);
  1472. X        
  1473. }
  1474. X
  1475. /* callback from the toggle buttons
  1476. X */
  1477. void
  1478. aa_activate_cb (w, client, call)
  1479. Widget w;
  1480. caddr_t client;
  1481. caddr_t call;
  1482. {
  1483. X    int what = (int) client;
  1484. X
  1485. X    switch (what) {
  1486. X    case TRAILS:
  1487. X        trails = XmToggleButtonGadgetGetState(w);
  1488. X        break;
  1489. X    case BIGDOTS:
  1490. X        bigdots = XmToggleButtonGadgetGetState(w);
  1491. X        aa_all(1);
  1492. X        break;
  1493. X    default:
  1494. X        printf ("unknown toggle button\n");
  1495. X        break;
  1496. X    }
  1497. }
  1498. X
  1499. /* callback from the toggle on/off button
  1500. X */
  1501. void
  1502. aa_toggle_cb (w, client, call)
  1503. Widget w;
  1504. caddr_t client;
  1505. caddr_t call;
  1506. {
  1507. X    int p;
  1508. X
  1509. X    for (p = nxtbody(-1); p != -1; p = nxtbody(p)) {
  1510. X        int s = XmToggleButtonGadgetGetState(objs_w[p]);
  1511. X        if (s) propts &= ~(1<<p);
  1512. X        else   propts |= 1<<p;
  1513. X        XmToggleButtonGadgetSetState(objs_w[p], !s, False /*don't invoke*/);
  1514. X    }
  1515. X    aa_all (1);
  1516. X        
  1517. }
  1518. X
  1519. /* callback from the toggle buttons for each object.
  1520. X * set the onoff flag in the points array for the planet whose code is in
  1521. X * client, then redraw.
  1522. X */
  1523. void
  1524. aa_propts_cb (w, client, call)
  1525. Widget w;
  1526. caddr_t client;
  1527. caddr_t call;
  1528. {
  1529. X    int p = (int) client;
  1530. X
  1531. X    if (XmToggleButtonGadgetGetState(w))    propts |= 1<<p;
  1532. X    else                        propts &= ~(1<<p);
  1533. X    aa_all (1);
  1534. }
  1535. X
  1536. /* callback from the Close button.
  1537. X */
  1538. void
  1539. aa_close_cb (w, client, call)
  1540. Widget w;
  1541. caddr_t client;
  1542. caddr_t call;
  1543. {
  1544. X    XtUnmanageChild (aaform_w);
  1545. }
  1546. X
  1547. /* expose (or reconfig) of altaz drawing area.
  1548. X * just redraw the scene to the current window size.
  1549. X * also, input callback when picking a dot for identification.
  1550. X */
  1551. static void
  1552. aa_da_exp_cb (w, client, call)
  1553. Widget w;
  1554. caddr_t client;
  1555. caddr_t call;
  1556. {
  1557. X    XmDrawingAreaCallbackStruct *c = (XmDrawingAreaCallbackStruct *)call;
  1558. X
  1559. X    switch (c->reason) {
  1560. X    case XmCR_RESIZE:
  1561. X        /* seems we can get one resize before the first expose.
  1562. X         * hence, we don't have a good window to use yet. just let it
  1563. X         * go; we'll get the expose soon.
  1564. X         */
  1565. X        if (!XtWindow(w))
  1566. X        return;
  1567. X        break;
  1568. X    case XmCR_EXPOSE: {
  1569. X        XExposeEvent *e = &c->event->xexpose;
  1570. X        /* wait for the last in the series */
  1571. X        if (e->count != 0)
  1572. X        return;
  1573. X        break;
  1574. X        }
  1575. X    case XmCR_INPUT:
  1576. X        aa_identify (c->event);
  1577. X        return;
  1578. X    default:
  1579. X        printf ("Unexpected aada_w event. type=%d\n", c->reason);
  1580. X        return;
  1581. X    }
  1582. X
  1583. X    aa_update (mm_get_now(), 1);
  1584. }
  1585. X
  1586. /* a dot has been picked: find what it is and report it. */
  1587. static
  1588. aa_identify (ev)
  1589. XXEvent *ev;
  1590. {
  1591. #define    PICKRANGE    36    /* sqr of dist allowed from pointer */
  1592. X    int x, y, mind, mini;
  1593. X    int i;
  1594. X    char *name;
  1595. X
  1596. X    switch (ev->type) {
  1597. X    case ButtonPress:
  1598. X        x = ((XButtonPressedEvent *)ev)->x;
  1599. X        y = ((XButtonPressedEvent *)ev)->y;
  1600. X        mini = -1;
  1601. X        for (i = 0; i < npoints; i++) {
  1602. X            if (propts & (1<<points[i].p)) {
  1603. X            int d = (x-points[i].sx)*(x-points[i].sx) +
  1604. X                        (y-points[i].sy)*(y-points[i].sy);
  1605. X            if (mini < 0 || d < mind) {
  1606. X            mini = i;
  1607. X            mind = d;
  1608. X            }
  1609. X        }
  1610. X        }
  1611. X        if (mini >= 0 && mind <= PICKRANGE) {
  1612. X        extern char *obj_getname();
  1613. X        static char *onames[] = {
  1614. X            /* NB: these must correspond to the astro/morobj defines */
  1615. X            "Mercury", "Venus", "Mars", "Jupiter", "Saturn",
  1616. X            "Uranus", "Neptune", "Pluto", "Sun", "Moon"
  1617. X        };
  1618. X        int p = points[mini].p;
  1619. X        if (p >= MERCURY && p <= MOON)
  1620. X            name = onames[p];
  1621. X        else if (p == OBJX || p == OBJY)
  1622. X            name = obj_getname(p);
  1623. X        else
  1624. X            name = "?";
  1625. X        } else
  1626. X        name = no_name;
  1627. X        f_string (picked_name_w, name);
  1628. X        break;
  1629. X    }
  1630. }
  1631. X
  1632. /* draw everything in the points array to the current screen size.
  1633. X * redraw the background too if preclr is set.
  1634. X */
  1635. static
  1636. aa_all(preclr)
  1637. int preclr;
  1638. {
  1639. X    static GC aa_fgc;
  1640. X    unsigned int nx, ny;
  1641. X    Window root;
  1642. X    int x, y;
  1643. X    unsigned int bw, d;
  1644. X    Display *dsp = XtDisplay(aada_w);
  1645. X    Window win = XtWindow(aada_w);
  1646. X    int i;
  1647. X
  1648. X    if (!aa_fgc) {
  1649. X        XGCValues gcv;
  1650. X        unsigned int gcm;
  1651. X
  1652. X        /* if user set the foreground and background resources for the
  1653. X         * AltAzMap use these for our planet gc.
  1654. X         */
  1655. X        gcm = GCForeground;
  1656. X        get_something (aada_w, XmNforeground, (char *)&gcv.foreground);
  1657. X        aa_fgc = XCreateGC (dsp, win, gcm, &gcv);
  1658. X    }
  1659. X
  1660. X    XGetGeometry (dsp, win, &root, &x, &y, &nx, &ny, &bw, &d);
  1661. X
  1662. X    if (preclr)
  1663. X        XClearWindow (dsp, win);
  1664. X
  1665. X    /* display points for objects that are on */
  1666. X    for (i = 0; i < npoints; i++)
  1667. X        if (propts & (1<<points[i].p))
  1668. X        sky_altaz(dsp, win, aa_fgc, i, nx, ny);
  1669. }
  1670. X
  1671. /* draw points[i] on screen of size [nx,ny]. */
  1672. static
  1673. sky_altaz (dsp, win, gc, i, nx, ny)
  1674. Display *dsp;
  1675. Window win;
  1676. GC gc;
  1677. int i;        /* points[] index */
  1678. int nx, ny;    /* size of drawing area, in pixels */
  1679. {
  1680. X    int sx, sy;
  1681. X
  1682. X    points[i].sx = sx = (nx-1)*(points[i].az/(2*PI));
  1683. X    points[i].sy = sy = (ny-1)*(1.0 - points[i].alt/(PI/2));
  1684. X
  1685. X    if (bigdots) {
  1686. X        XDrawPoint (dsp, win, gc, sx, sy);
  1687. X        XDrawPoint (dsp, win, gc, sx+1, sy);
  1688. X        XDrawPoint (dsp, win, gc, sx, sy+1);
  1689. X        XDrawPoint (dsp, win, gc, sx+1, sy+1);
  1690. X    } else
  1691. X        XDrawPoint (dsp, win, gc, sx, sy);
  1692. }
  1693. SHAR_EOF
  1694. chmod 0644 altaz.c ||
  1695. echo 'restore of altaz.c failed'
  1696. Wc_c="`wc -c < 'altaz.c'`"
  1697. test 15399 -eq "$Wc_c" ||
  1698.     echo 'altaz.c: original size 15399, current size' "$Wc_c"
  1699. rm -f _shar_wnt_.tmp
  1700. fi
  1701. # ============= anomaly.c ==============
  1702. if test -f 'anomaly.c' -a X"$1" != X"-c"; then
  1703.     echo 'x - skipping anomaly.c (File already exists)'
  1704.     rm -f _shar_wnt_.tmp
  1705. else
  1706. > _shar_wnt_.tmp
  1707. echo 'x - extracting anomaly.c (Text)'
  1708. sed 's/^X//' << 'SHAR_EOF' > 'anomaly.c' &&
  1709. #include <stdio.h>
  1710. #include <math.h>
  1711. #include "astro.h"
  1712. X
  1713. #define    TWOPI    (2*PI)
  1714. X
  1715. /* given the mean anomaly, ma, and the eccentricity, s, of elliptical motion,
  1716. X * find the true anomaly, *nu, and the eccentric anomaly, *ea.
  1717. X * all angles in radians.
  1718. X */
  1719. anomaly (ma, s, nu, ea)
  1720. double ma, s;
  1721. double *nu, *ea;
  1722. {
  1723. X    double m, fea;
  1724. X
  1725. X    m = ma-TWOPI*(long)(ma/TWOPI);
  1726. X    if (m > PI) m -= TWOPI;
  1727. X    if (m < -PI) m += TWOPI;
  1728. X    fea = m;
  1729. X
  1730. X    if (s < 1.0) {
  1731. X        /* elliptical */
  1732. X        double dla;
  1733. X        while (1) {
  1734. X        dla = fea-(s*sin(fea))-m;
  1735. X        if (fabs(dla)<1e-6)
  1736. X            break;
  1737. X        dla /= 1-(s*cos(fea));
  1738. X        fea -= dla;
  1739. X        }
  1740. X        *nu = 2*atan(sqrt((1+s)/(1-s))*tan(fea/2));
  1741. X        } else {
  1742. X        /* hyperbolic */
  1743. X        double corr = 1;
  1744. X        while (fabs(corr) > 0.000001) {
  1745. X          corr = (m - s * sinh(fea) + fea) / (s*cosh(fea) - 1);
  1746. X          fea += corr;
  1747. X        }
  1748. X        *nu = 2*atan(sqrt((s+1)/(s-1))*tanh(fea/2));
  1749. X    }
  1750. X    *ea = fea;
  1751. }
  1752. SHAR_EOF
  1753. chmod 0644 anomaly.c ||
  1754. echo 'restore of anomaly.c failed'
  1755. Wc_c="`wc -c < 'anomaly.c'`"
  1756. test 901 -eq "$Wc_c" ||
  1757.     echo 'anomaly.c: original size 901, current size' "$Wc_c"
  1758. rm -f _shar_wnt_.tmp
  1759. fi
  1760. # ============= cal_mjd.c ==============
  1761. if test -f 'cal_mjd.c' -a X"$1" != X"-c"; then
  1762.     echo 'x - skipping cal_mjd.c (File already exists)'
  1763.     rm -f _shar_wnt_.tmp
  1764. else
  1765. > _shar_wnt_.tmp
  1766. echo 'x - extracting cal_mjd.c (Text)'
  1767. sed 's/^X//' << 'SHAR_EOF' > 'cal_mjd.c' &&
  1768. #include <stdio.h>
  1769. #include <math.h>
  1770. #include "astro.h"
  1771. X
  1772. /* given a date in months, mn, days, dy, years, yr,
  1773. X * return the modified Julian date (number of days elapsed since 1900 jan 0.5),
  1774. X * *mjd.
  1775. X */
  1776. cal_mjd (mn, dy, yr, mjd)
  1777. int mn, yr;
  1778. double dy;
  1779. double *mjd;
  1780. {
  1781. X    int b, d, m, y;
  1782. X    long c;
  1783. X
  1784. X    m = mn;
  1785. X    y = (yr < 0) ? yr + 1 : yr;
  1786. X    if (mn < 3) {
  1787. X        m += 12;
  1788. X        y -= 1;
  1789. X    }
  1790. X
  1791. X    if (yr < 1582 || yr == 1582 && (mn < 10 || mn == 10 && dy < 15)) 
  1792. X        b = 0;
  1793. X    else {
  1794. X        int a;
  1795. X        a = y/100;
  1796. X        b = 2 - a + a/4;
  1797. SHAR_EOF
  1798. true || echo 'restore of cal_mjd.c failed'
  1799. fi
  1800. echo 'End of  part 1'
  1801. echo 'File cal_mjd.c is continued in part 2'
  1802. echo 2 > _shar_seq_.tmp
  1803. exit 0
  1804. -- 
  1805. --
  1806. Molecular Simulations, Inc.            mail: dcmartin@msi.com
  1807. 796 N. Pastoria Avenue                uucp: uunet!dcmartin
  1808. Sunnyvale, California 94086            at&t: 408/522-9236
  1809.