home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume11 / starchart / part08 < prev    next >
Text File  |  1990-03-15  |  43KB  |  1,707 lines

  1. Newsgroups: comp.sources.misc
  2. subject: v11i036: starchart 3.2 Part 08/32
  3. from: ccount@ATHENA.MIT.EDU
  4. Sender: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
  5.  
  6. Posting-number: Volume 11, Issue 36
  7. Submitted-by: ccount@ATHENA.MIT.EDU
  8. Archive-name: starchart/part08
  9.  
  10. #! /bin/sh
  11. # This is a shell archive.  Remove anything before this line, then unpack
  12. # it by saving it into a file and typing "sh file".  To overwrite existing
  13. # files, type "sh file -c".  You can also feed this as standard input via
  14. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  15. # will see the following message at the end:
  16. #        "End of archive 8 (of 32)."
  17. # Contents:  doc/starchart.1 starchart/starXawHelp.c
  18. #   starchart/starlaser.c
  19. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  20. if test -f 'doc/starchart.1' -a "${1}" != "-c" ; then 
  21.   echo shar: Will not clobber existing file \"'doc/starchart.1'\"
  22. else
  23. echo shar: Extracting \"'doc/starchart.1'\" \(13012 characters\)
  24. sed "s/^X//" >'doc/starchart.1' <<'END_OF_FILE'
  25. X.TH STARCHART LOCAL "15 July 1989"
  26. X.ad b
  27. X.SH NAME
  28. Xstardsp, starlaser, starpost, starsunv, startool, startek, staruplot,
  29. XstarX10, starX11, starXaw, starXtk \- print astronomical star charts.
  30. X.SH SYNOPSIS
  31. Xstar____
  32. X[
  33. X.BI \-c " constellation"
  34. X[
  35. X.I constell_data_file
  36. X]
  37. X]
  38. X.br
  39. X.if t .ti +.5i
  40. X[
  41. X.BI \-r " R.A."
  42. X.BI \-d " Declination"
  43. X]
  44. X[
  45. X.BI \-s " scale"
  46. X]
  47. X[
  48. X.BI \-m "  maglim"
  49. X]
  50. X.br
  51. X.if t .ti +.5i
  52. X[
  53. X.BI \-l " lbllim"
  54. X]
  55. X[
  56. X.BI \-g " grklim"
  57. X]
  58. X[
  59. X.BI \-t " title"
  60. X]
  61. X.br
  62. X.if t .ti +.5i
  63. X[
  64. X.BI \-p
  65. X[
  66. X.I projection_mode
  67. X]
  68. X]
  69. X.br
  70. X.if t .ti +.5i
  71. X[
  72. X.BI \-f " user1.star"
  73. X[
  74. X.I file_format
  75. X]
  76. X]
  77. X.br
  78. X.if t .ti +.5i
  79. X[
  80. X.BI \-y " yale.star"
  81. X[
  82. X.I file_format
  83. X]
  84. X]
  85. X.br
  86. X.if t .ti +.5i
  87. X[
  88. X.BI \-n " neb.star"
  89. X[
  90. X.I file_format
  91. X]
  92. X]
  93. X.br
  94. X.if t .ti +.5i
  95. X[
  96. X.BI \-w " planet.star"
  97. X[
  98. X.I file_format
  99. X]
  100. X]
  101. X[
  102. X.BI \-h " index.indx"
  103. X]
  104. X.br
  105. X.if t .ti +.5i
  106. X[
  107. X.BI \-v " center_mag mag_range"
  108. X]
  109. X.br
  110. X.if t .ti +.5i
  111. X[
  112. X.BI \-x " ra_spacing de_spacing"
  113. X[
  114. X.I ra_origin de_origin
  115. X]
  116. X]
  117. X.br
  118. X.if t .ti +.5i
  119. X[
  120. X.BI \-b
  121. X]
  122. X[
  123. X.BI \-i
  124. X]
  125. X[
  126. X.BI \-u
  127. X]
  128. X[
  129. X.BI \-e " extra_commands_file"
  130. X]
  131. X.br
  132. X.if t .ti +.5i
  133. X[
  134. X.BI \-a " device_control_string"
  135. X]
  136. X.SH DESCRIPTION
  137. XThese programs generate star charts based on data extracted from the Yale
  138. Xpublic domain star catalog, the SAO catalog, the RNGC catalog, and
  139. Xother databases.
  140. XOutput is to the terminal 
  141. X.RI ( stardsp ),
  142. XHewlett-Packard Laserjet printer format
  143. X.RI ( starlaser ),
  144. XPostScript format
  145. X.RI ( starpost ),
  146. XSun Sunview format
  147. X.RI ( starsunv ),
  148. XSun Sunview using
  149. X.B tooltool
  150. X.RI ( startool ),
  151. XTektronix vector format
  152. X.RI ( startek ),
  153. XUnix Plot(5) format
  154. X.RI ( staruplot ),
  155. XX Version 10
  156. X.RI ( starX10 ),
  157. XX Version 11
  158. X.RI ( starX11 ),
  159. XX Version 11 using Athena widgets
  160. X.RI ( starXaw ),
  161. Xand X Version 11 using Athena widgets with a different interface
  162. X.RI ( starXtk ).
  163. X.PP
  164. XStar data is optionally overlayed with other cosmic objects, such as planets.
  165. XIf limiting magnitudes are properly set and the databases are available,
  166. XNGC objects, constellation boundaries and names, and constellation
  167. Xpatterns are also printed.
  168. X.PP
  169. XThe starchart center is specified by two parameters: Right
  170. XAscension [0.00 to 24.00 hours] and Declination [-90.00 to +90.00 degrees].
  171. XAn optional scale parameter defines either the N/S range of the output
  172. Xwindow, in degrees of declination or the radius of the map in
  173. Xdegrees, depending on the map projection.  Digits after decimal point
  174. Xare taken as minutes:  object positions can therefore be taken
  175. Xdirectly from a star catalog. 
  176. X.PP
  177. XOther parameters are:
  178. X.TP
  179. X.B \-r
  180. XRight ascension.
  181. X.TP
  182. X.B \-d
  183. XDeclination.
  184. X.TP
  185. X.B \-s
  186. XScale.
  187. X.TP
  188. X.B \-c
  189. XA three or four character mnemonic follows, which is a search string for a
  190. Xmatching line-item entry in the file
  191. X.IR constell_data_file .
  192. XIf found, then the
  193. Xinitial values for Ra, Decl, Scale and Title are taken from that file.
  194. XBecause the command line is parsed from left to right, subsequent switches
  195. Xmight change the scale, title, or otherwise fine-tune the new defaults.
  196. X.TP
  197. X.B \-m
  198. XStar limiting magnitude. This sets limits on the faintest stars displayed
  199. Xon the ``master'' view. Default limits are device driver dependent
  200. X(more below).  The ``thumbnail'' finder view is set to a related
  201. Xlimit. 
  202. X.TP
  203. X.B \-l
  204. XName label limiting magnitude. The Yale database contains both a small set of
  205. Xfamiliar names (for stars and special objects), plus an extensive list of
  206. Xlabels (Greek Bayer letter or Flamsteed numbers). Star names (including planet
  207. Xnames) always print for this small set. To avoid clutter, the labels may be
  208. Xomitted below a cut-off magnitude by specifying this value.
  209. X.TP
  210. X.B \-g
  211. XGreek/Flamsteed annotation magnitude. Labels printed for stars dimmer than
  212. Xthis value will use a Bayer or numerical label in favor of a proper name.
  213. XThe default (2.05) includes nearly all well-known proper names including
  214. XPolaris, and excludes but a small number (such as Algol). Large values
  215. Xgenerate charts full of obscure Arabian names, small (zero or negative) values
  216. Xproduce non-verbose charts, e.g. ``a'', in Greek where possible, instead of
  217. X``Sirius''.
  218. X.TP
  219. X.B \-t
  220. XTitle.
  221. X.TP
  222. X.B \-p
  223. XProjection mode.  With no argument, selects STEREOGRAPHIC projection
  224. Xinstead of the default SANSONS.  Argument may be used to select
  225. XGNOMONIC, ORTHOGRAPHIC or RECTANGULAR.
  226. X.TP
  227. X.B \-b
  228. XThis switch provides a single full-page of output, without a thumbnail-sized
  229. Xfinder map. The legend placard is replaced with a single line banner giving
  230. Xtitle, right ascension, declination and limiting magnitude. This mode is
  231. Xuseful for the construction of atlas pages. Because the page depicts the same
  232. Xvertical scale in degrees of declination, the output will cover a slightly
  233. Xreduced extent in right ascension.
  234. X.TP
  235. X.B \-f
  236. XThe argument is the name of a user-supplied file containing objects in
  237. Xthe yale.star (a.k.a. ``lineread'') format, which will overlay the output.
  238. XThis is useful for generating asteroid finder charts, planet or
  239. Xsatellite tracks, or other special needs. Files are processed
  240. Xsequentially. Thus, order may take on meaning for devices which
  241. Xprovide a 2-1/2D page description, such as PostScript.  The file
  242. Xformat may be ``lineread'', ``binfull'', ``binobj'', ``binstar'' or ``gsc''.
  243. X.TP
  244. X.B \-y \-n \-w \-h
  245. XThese switches allow for the redefinition of the bright star, nebula,
  246. Xplanet, and star index files, respectively.  The files are in
  247. X``lineread'' format unless a \fIfile_format\fR is specified.
  248. X.TP
  249. X.B \-v
  250. Xmag range.  The stars in a range of magnitudes are labeled with their
  251. Xmagnitude, as for variable star or asteroid finder charts. The first
  252. Xargument is the center magnitude, and the second a range: stars within
  253. Xplus or minus range of the center magnitude are labeled.
  254. X.TP
  255. X.B \-x
  256. Xra_spacing de_spacing [ra_origin de_origin].  A grid is drawn, with arbitrary
  257. Xspacing in ra and dec.  The optional third and fourth arguments
  258. Xallow the origin of the grid to be moved.
  259. X.TP
  260. X.B \-i
  261. Xinvert.  The main map of the chart is dawn with north and south
  262. Xflipped, to produce an inverted view.
  263. X.TP
  264. X.B \-e
  265. Xextra.  The argument is a file containing a detailed description of
  266. Xthe chart, by setting many control variables.  These include those
  267. Xwhich may be controlled by command line switches, and many more.
  268. XThis file may be in either ``mapwin'' format or ``.starrc'' format.
  269. XThe ``mapwin'' format specifies the detailed configuration of each
  270. Xmap in the chart.
  271. X.TP
  272. X.B \-a
  273. Xadditional.  This argument is passed to the device dependent routines,
  274. Xto allow for special controls.  See the man page for the particular
  275. Xprogram, e.g. starX11(1).  If the \fB-a\fR argument is supported,
  276. Xthere should be a separate man page.
  277. X.TP
  278. X.B \-u
  279. Xuser input.  If the program has been compiled for this option,
  280. Xcontrols of the sort which may be placed in a ``.starrc'' file may be
  281. Xtyped by the user interactively.  The ``end_input'' command causes the
  282. Xchart to be drawn, ``quit'' exits the program.
  283. X.PP
  284. X
  285. X.SH THE .starrc AND -e CONTROL FILE
  286. X
  287. XDetailed control of the chart is provided through files containing
  288. Xvariable names and values.  A ``.starrc'' file may be used to set
  289. Xpersonal preferences.  Additionally, the
  290. X.B \-e
  291. Xargument allows additional files to be read.  These files set
  292. Xparameters which may be overridden by later command line arguments.
  293. X.PP
  294. XThe \fB-e\fR file may be in ``.starrc'' format or in ``mapwin''
  295. Xformat.  Exact specifications for each map in a chart are contained in
  296. Xsuch a ``mapwin'' file.
  297. X.PP
  298. XFor a detailed explanation, see the ``astro.texinfo'' document and the
  299. Xsample .rc files.
  300. X
  301. X.SH SPECIAL ARGUMENTS
  302. XThe
  303. X.B \-a
  304. Xargument is used by individual driver programs for device-specific
  305. Xcontrols.  See the manual page (if there is one) for that program for
  306. Xdetails.
  307. X
  308. X.SH INTERACTION
  309. XThe \fB-u\fR option activates interactive mode, where the same
  310. Xcommands as in the ``.starrc'' file may be typed to control the
  311. Xprogram options.  In addition, ``end_input'' ends interactive input
  312. Xand draws the chart.  After the chart is drawn, control returns to the
  313. Xkeyboard.  The ``quit'' command exits the program.  The command
  314. X``show'' shows the current state of the control variables.  The
  315. Xcommand ``help'' may be used to get a brief description of the
  316. Xcommands and controls available.
  317. X.PP
  318. XSome, especially window based, versions will allow the user final
  319. Xcontrol over each map of the chart.  The chart is specified by an
  320. Xarray of large \fBC\fR structures, one for each map on the page.  The
  321. X``mapwin'' file contains the values in this structure.  Advanced
  322. Xinteractive versions of starchart, such as starXaw, allow the
  323. Xcomponents of the structures to be edited individually, providing full
  324. Xaccess to the flexible controls of the program.
  325. X.PP
  326. XThe sequence of control of the program is:
  327. X.br
  328. X1) read the ``.starrc'' file.
  329. X2) process the command line: options are processed in order, later
  330. Xarguments may override earlier arguments, additional ``.starrc''
  331. Xformat files are read as they are encountered in \fB-e\fR options.
  332. XHowever, if the file specified in the \fB-e\fR option is in ``mapwin''
  333. Xformat, it is read later.  After the command line is processed, if the
  334. X\fB-u\fR option is active, keyboard interaction is performed.  Next,
  335. Xany ``mapwin'' format files are read.  If there is more interaction
  336. Xavailable (e.g. as in starXaw), the details of the chart may now be
  337. Xcontrolled.  If a ``mapwin'' file is to be written, it is written now.
  338. XThen the chart is drawn to specification.  Finally, after the chart is
  339. Xdrawn, the program returns to the first interaction (i.e. returns to
  340. Xthe point after the command line has been processed).
  341. X.PP
  342. XOne more form of interaction is available on some systems:  A mouse or
  343. Xother pointing device may be used to either select points on a map and
  344. Xthe coordinates of that point are displayed, or the databases may be
  345. Xsearched for objects near the selected point and the database entries
  346. Xfor the objects found are displayed.
  347. X.SH OUTPUT
  348. XThe present implementations draw two maps: a ``master'' map plus a
  349. X``thumbnail'' overview map with brighter limiting magnitude and a larger
  350. Xcoverage area.  Their location and the limiting magnitude is specified
  351. Xby records in the device driver, allowing the chart layout be tuned on
  352. Xa per-device basis.  The
  353. X.B -b
  354. Xflag selects a ``fullpage'' option, with a larger ``master'' map and
  355. Xno ``thumbnail''.
  356. X.PP
  357. XObjects are represented by glyphs defined by each display driver. Vector-only
  358. Xdevices rely on the parent module ``starimages.c'' to provide shape tables;
  359. Xother devices plot special characters (stardsp) or private symbols
  360. X(PostScript). The latter additionally provides distinctions between object
  361. Xsubclasses, e.g. planetary vs diffuse nebula.
  362. X.PP
  363. XSanson's sinusoidal projection is used to map coordinates by default.
  364. XThis projection preserves both area and linearity in Declination (y axis).
  365. XIt gives good conformality (angle correctness) near the equator, so it is
  366. Xuseful along the Ecliptic.
  367. XLines of RA converge at the poles (unlike cylindrical projections),
  368. Xthough Cassiopeia and the Dipper reproduce well.
  369. X.PP
  370. XAlternative projections currently include: stereographic, which
  371. Xpreserves circles and allows an entire hemisphere to be drawn;
  372. Xorthographic, which may also display an entire hemisphere, but with
  373. Xgreat distortion; gnomonic, in which great circles appear as
  374. Xlines, but distorts for large areas, and rectangular, which is a
  375. Xdirect mapping of longitude and latitude to the map.  Gnomonic is
  376. Xuseful for meteor path plotting charts.  Rectangular is useful for
  377. Xdisplaying the entire ecliptic.
  378. X
  379. X.SH EXAMPLES 
  380. X.nf
  381. X# Sagittarius: a nice bunch of Messier objects.
  382. Xstarpost -c sgr -t Sagittarius >sag.PS
  383. X.sp
  384. X# Orion: the belt lies near 5h40m in RA, just below the CE.
  385. Xstardsp -r 5.32 -d -5 -s 12 -t "Trapezium (Orion)" -m 8 -l 5 | more
  386. X.sp
  387. X# nowhere in particular
  388. XstarX11 -r 20.15 -d 19.5 -s 12 -m 10 -l 2 -g 6 -t "demo title" -p
  389. Xgnomonic -f test.star binstar -y alternate.star -w ceres.bin binfull
  390. X-v 6 1.5 -x 0.5 5 -b -i -u -e ovverride
  391. X
  392. X.fi
  393. X.SH FILES
  394. XNote that the names may have been changed for your particular site.
  395. X.nf
  396. X.ta \w'boundaries.star    'u
  397. Xyale.star    stellar information (mandatory)
  398. Xneb.star    nebulae (optional)
  399. Xplanet.star    planets (optional)
  400. Xboundaries.star    constellation boundaries (optional)
  401. Xcnames.star    constellation names (optional)
  402. Xpatterns.star    constellation patterns (optional)
  403. Xindex.indx    index file for additional star files (optional)
  404. Xcon.locs    default mnemonic locations
  405. X.fi
  406. X.br
  407. X.sp
  408. XThese default paths can be easily changed in the Makefile.
  409. X.PP
  410. XAll data file coordinates are for epoch and equinox 2000.0.
  411. X.SH BUGS
  412. X.PP
  413. XIf <minutes> part of the parameters is greater than 59 it is silently
  414. Xtruncated to 59.
  415. X.SH SEE ALSO
  416. Xdataconv(1), sif_to_text(1), tosize(1), observe(1).
  417. X.SH AUTHORS/EDITORS
  418. XCraig Counterman
  419. X.br
  420. XAlan Paeth, University of Waterloo
  421. X.SH MAJOR CONTRIBUTORS
  422. XSteve Kennedy
  423. X.br
  424. XHolger Zessel and Markus Kempf.
  425. X.br
  426. XTom Horsley
  427. X.br
  428. XDave Van't Hof
  429. X.br
  430. XDave Van't Hof
  431. X.br
  432. XMichael Campanella
  433. X.br
  434. XRobert Tidd
  435. X.br
  436. XJoe Wang
  437. X.br
  438. XPetri Launiainen
  439. X.br
  440. XJyrki Yli-Nokari
  441. X.br
  442. XSjoerd Mullender
  443. X.br
  444. Xand
  445. X.br
  446. XDean Payne <deanp@hplsla.hp.com>
  447. X.br
  448. XDavid Smith <smith@hpldrs.hp.com>
  449. X.br
  450. XTim Pointing <tim@zorac.dciem.dnd.ca>
  451. X.br
  452. Xand others
  453. END_OF_FILE
  454. if test 13012 -ne `wc -c <'doc/starchart.1'`; then
  455.     echo shar: \"'doc/starchart.1'\" unpacked with wrong size!
  456. fi
  457. # end of 'doc/starchart.1'
  458. fi
  459. if test -f 'starchart/starXawHelp.c' -a "${1}" != "-c" ; then 
  460.   echo shar: Will not clobber existing file \"'starchart/starXawHelp.c'\"
  461. else
  462. echo shar: Extracting \"'starchart/starXawHelp.c'\" \(13385 characters\)
  463. sed "s/^X//" >'starchart/starXawHelp.c' <<'END_OF_FILE'
  464. X/*
  465. X * Help for starXaw
  466. X *
  467. X * Copyright (c) 1990 by Craig Counterman. All rights reserved.
  468. X *
  469. X * This software may be redistributed freely, not sold.
  470. X * This copyright notice and disclaimer of warranty must remain
  471. X *    unchanged. 
  472. X *
  473. X * No representation is made about the suitability of this
  474. X * software for any purpose.  It is provided "as is" without express or
  475. X * implied warranty, to the extent permitted by applicable law.
  476. X *
  477. X */
  478. X
  479. Xstatic char rcsid[]="$Header: starXawHelp.c,v 1.7 90/03/10 15:34:07 ccount Exp $";
  480. X
  481. X#include <stdio.h>
  482. X#include <math.h>
  483. X
  484. X#include "star3.h"
  485. X#include "starXaw.h"
  486. X
  487. X#ifndef SYSV
  488. X#include <strings.h>
  489. X#else
  490. X#include <string.h>
  491. X#endif
  492. X
  493. X#include <X11/cursorfont.h>
  494. X#include <X11/Intrinsic.h>
  495. X#include <X11/StringDefs.h>
  496. X#include <X11/Shell.h>
  497. X#ifdef X11R4
  498. X#include <X11/Xaw/Command.h>
  499. X#include <X11/Xaw/Form.h>
  500. X#include <X11/Xaw/Box.h>
  501. X#define ASCII_STRING
  502. X#define XAW_BC
  503. X#include <X11/Xaw/AsciiText.h>
  504. X#else
  505. X#include <X11/Command.h>
  506. X#include <X11/Form.h>
  507. X#include <X11/Box.h>
  508. X#include <X11/AsciiText.h>
  509. X#endif
  510. X
  511. X
  512. XWidget help_wid;
  513. X
  514. X/*
  515. X123456789 123456789 123456789 1234567.
  516. X2
  517. X3
  518. X4
  519. X5
  520. X6
  521. X7
  522. X8
  523. X9
  524. X0
  525. X1
  526. X2
  527. X3
  528. X4
  529. X5
  530. X6
  531. X7
  532. X8
  533. X9
  534. X0
  535. X1
  536. X2
  537. X3
  538. X4
  539. X5
  540. X6
  541. X7
  542. X823456789 123456789 123456789 1234567.
  543. X*/
  544. X
  545. Xstatic char *help_pages[] = {
  546. X"          Welcome to StarXaw\n\
  547. X\n\
  548. XThis is the X11 Athena Widgets\n\
  549. Xinterface to Starchart, version 3.1.\n\
  550. X\n\
  551. XThis is the first help page.  For more\n\
  552. Xinformation, press the Help button\n\
  553. Xbelow.\n\
  554. X\n\
  555. XThe Quit button exits the program.\n\
  556. X\n\
  557. XThe Controls buttons open a new window\n\
  558. Xfor changing the variables which\n\
  559. Xcontrol the appearance of the chart.\n\
  560. X\n\
  561. XDraw Chart draws the chart as\n\
  562. Xspecified by the options set above.\n\
  563. X\n\
  564. XExceptions: Save / Load File and\n\
  565. XAdditional Controls have options which\n\
  566. Xonly take effect when Draw Chart is\n\
  567. Xselected.\n\
  568. X\n\
  569. X\n\
  570. XPress the Help button for the next\n\
  571. Xhelp page.  When you reach the last\n\
  572. Xpage, you will return to this page.",
  573. X
  574. X
  575. X"Page 2\n\
  576. X\n\
  577. XThe Output region is used to display\n\
  578. Xthe status of the program, and some\n\
  579. Xother output.  Note that some errors\n\
  580. Xare written to the standard error\n\
  581. Xoutput, and do not appear in this\n\
  582. Xspace. \n\
  583. X\n\
  584. XThis Help space will also be used to\n\
  585. Xprovide details about the selected\n\
  586. Xcontrol.\n\
  587. X\n\
  588. X\n\
  589. X\n\
  590. X\n\
  591. X\n\
  592. X\n\
  593. X\n\
  594. X\n\
  595. X\n\
  596. X\n\
  597. X\n\
  598. X\n\
  599. X\n\
  600. XPress the Help button for the next\n\
  601. Xhelp page.",
  602. X
  603. X
  604. X"Page 3      The Controls\n\
  605. X\n\
  606. XThe buttons and what they control: \n\
  607. X\n\
  608. XChart - Center coordinates and scale\n\
  609. X        of chart, and title.\n\
  610. XType  - Chart type: currently either\n\
  611. X        one large map or one large and\n\
  612. X        one smaller map of a larger\n\
  613. X        region (The thumbnail map).\n\
  614. XMagnitudes - Limiting magnitudes.\n\
  615. XLayers - Layer drawing order.  Each\n\
  616. X        map is drawn as several\n\
  617. X    layers, which may be drawn in\n\
  618. X    any order.\n\
  619. XData Files - The data files and their\n\
  620. X        file formats.\n\
  621. XProjection Mode - The projection\n\
  622. X        transformation used for the\n\
  623. X        main map.\n\
  624. XMagnitude Labels - Labelling of stars\n\
  625. X        with their magnitudes.\n\
  626. XGrid -  Right Ascension and\n\
  627. X        Declination grid lines.\n\
  628. X\n\
  629. XPress the Help button for the next\n\
  630. Xhelp page.",
  631. X
  632. X"Page 4     More Controls\n\
  633. X\n\
  634. XThe following controls allow further\n\
  635. Xcontrol, and some are specific to the\n\
  636. XX11 version of Starchart.\n\
  637. X\n\
  638. XAdditional Control - Allows for\n\
  639. X        detailed editing of the\n\
  640. X        structure which specifies\n\
  641. X        each map in the chart\n\
  642. X        (the ``Mapwin'' structure).\n\
  643. XX Parameters - Controls specific to\n\
  644. X        the X11 version.\n\
  645. XSave / Load File - input and output of\n\
  646. X        Mapwin format files, and\n\
  647. X        output of the current settings\n\
  648. X        into a ``Starrc'' format file.\n\
  649. X\n\
  650. XAdditional information about each\n\
  651. Xbutton will appear here when the\n\
  652. Xbutton is selected.\n\
  653. X\n\
  654. X\n\
  655. X\n\
  656. X\n\
  657. XPress the Help button for the next\n\
  658. Xhelp page.",
  659. X
  660. X"Page 5\n\
  661. X\n\
  662. XEach control window has a Dismiss\n\
  663. Xbutton and a Cancel button.  Some\n\
  664. Xadditionally have an Apply button.\n\
  665. X\n\
  666. XIf there is an Apply button, it must\n\
  667. Xbe pressed for the settings to take\n\
  668. Xeffect.\n\
  669. X\n\
  670. XThe Dismiss button closes the window.\n\
  671. XIf there is an Apply button, some\n\
  672. Xsettings will not take effect.\n\
  673. X\n\
  674. XThe Cancel button cancels any changes\n\
  675. Xmade, and closes the window.\n\
  676. X\n\
  677. X\n\
  678. X\n\
  679. X\n\
  680. X\n\
  681. X\n\
  682. X\n\
  683. X\n\
  684. X\n\
  685. XPress the Help button to return to the\n\
  686. Xfirst help page."
  687. X};
  688. X#define Nhelp_pages 5
  689. X
  690. X#define HELPSIZE 30*40
  691. X/* Can display 27*(38+\n) characters in 6x13 font */
  692. Xchar help_buffer[HELPSIZE];
  693. X
  694. Xstatic int hpg_no = 0;
  695. X
  696. X
  697. Xvoid show_help()
  698. X{
  699. X  Arg args[2];
  700. X
  701. X
  702. X  XtSetArg(args[0], XtNlabel, help_buffer);
  703. X  XtSetValues(help_wid, args, (Cardinal)1);
  704. X  XtTextSetLastPos(help_wid, strlen(help_buffer));
  705. X}
  706. X
  707. Xvoid XHelp(widget,closure,callData)
  708. X     Widget widget;
  709. X     caddr_t closure;        /* Widget */
  710. X     caddr_t callData;
  711. X{
  712. X  hpg_no++;
  713. X  if (hpg_no == Nhelp_pages)
  714. X    hpg_no = 0;
  715. X
  716. X  strcpy(help_buffer, help_pages[hpg_no]);
  717. X  show_help();
  718. X}
  719. X
  720. X
  721. Xint start_help()
  722. X{
  723. X  strcpy(help_buffer, help_pages[hpg_no]);
  724. X  return sizeof(help_buffer);
  725. X}
  726. X
  727. Xun_help()
  728. X{
  729. X  strcpy(help_buffer, help_pages[hpg_no]);
  730. X  show_help();
  731. X}
  732. X
  733. X
  734. X
  735. X/* Chart */
  736. Xstatic char chart_page[] =
  737. X  "                Chart\n\
  738. X\n\
  739. XHere, the coordinates of the center of\n\
  740. Xthe chart, the scale of the main map,\n\
  741. Xand the title of the chart are set.\n\
  742. X\n\
  743. XEither specify these values directly,\n\
  744. Xor read them for a given constellation\n\
  745. Xfrom the constellation data file.\n\
  746. X\n\
  747. XThe values for R.A. and Dec. are given\n\
  748. Xin hh.mm and dd.mm format respectively,\n\
  749. Xe.g. an R.A. of 18.30 means 18 hrs.,\n\
  750. X30 min.\n\
  751. X\n\
  752. XIn addition, the main map may be\n\
  753. Xdrawin flipped top to bottom (for use\n\
  754. Xwith inverting telescopes), if so\n\
  755. Xspecified by the ``Normal/Inverted''\n\
  756. Xbutton.";
  757. X
  758. Xchart_help()
  759. X{
  760. X  strcpy(help_buffer, chart_page);
  761. X  show_help();
  762. X}
  763. X
  764. X/* Type */
  765. Xstatic char type_page[] =
  766. X  "                 Type\n\
  767. X\n\
  768. XCurrently, two standard chart types\n\
  769. Xare defined.\n\
  770. X\n\
  771. XIn the first, there is a large main\n\
  772. Xmap, a smaller thumbnail map showing\n\
  773. Xa larger area, and a legend.\n\
  774. X\n\
  775. XIn the second, there is only one large\n\
  776. Xmap.";
  777. X
  778. Xtype_help()
  779. X{
  780. X  strcpy(help_buffer, type_page);
  781. X  show_help();
  782. X}
  783. X
  784. X/* Magnitudes */
  785. Xstatic char magnitudes_page[] =
  786. X  "              Magnitudes\n\
  787. X\n\
  788. XThere are three limiting magnitudes.\n\
  789. X\n\
  790. XThe first controls the display of the\n\
  791. Xobject name, e.g. Betelgeuse.\n\
  792. X\n\
  793. XThe second controls the display of the\n\
  794. XBayer or Flamsteed label for a star,\n\
  795. Xe.g. 28, or RY, or <alpha>.\n\
  796. X\n\
  797. XThe third controls the display of the\n\
  798. Xsymbol for the object.";
  799. X
  800. Xmagnitudes_help()
  801. X{
  802. X  strcpy(help_buffer, magnitudes_page);
  803. X  show_help();
  804. X}
  805. X
  806. X/* Layers */
  807. Xstatic char layers_page[] =
  808. X  "                Layers\n\
  809. X\n\
  810. XEach map is drawn as several layers.\n\
  811. XThis controls which layers are drawn,\n\
  812. Xand the order in which they are drawn.\n\
  813. X\n\
  814. XThe outline (including tick marks when\n\
  815. Xpossible), R.A. and Declination grids\n\
  816. X(if specified), ecliptic,\n\
  817. Xconstellation boundaries,\n\
  818. Xconstellation patterns, and\n\
  819. Xconstellation names, are all separate\n\
  820. Xlayers.  The legend is also considered\n\
  821. Xas a separate layer.\n\
  822. X\n\
  823. XIn addition, the data from the object\n\
  824. Xfiles may be drawn either as the\n\
  825. Xobject is read (``All Files''), or as\n\
  826. Xseparate layers for the: symbol, name,\n\
  827. Xmagnitude label, vectors, and areas\n\
  828. Xspecified in the files.\n\
  829. X\n\
  830. XPressing a button causes the layer for\n\
  831. Xthat position to cycle through the\n\
  832. Xpossiblilities.";
  833. X
  834. Xlayers_help()
  835. X{
  836. X  strcpy(help_buffer, layers_page);
  837. X  show_help();
  838. X}
  839. X
  840. X/* Map_Files */
  841. Xstatic char dfiles_page[] =
  842. X  "              Data Files\n\
  843. X\n\
  844. XThe data files, and the order in which\n\
  845. Xthey are read, are set in this dialog.\n\
  846. X\n\
  847. XEach file has a name and a type.  The\n\
  848. Xtype specifies the format of the file.\n\
  849. XPressing the type button cycles\n\
  850. Xthrough the possiblilties.";
  851. X
  852. Xdfiles_help()
  853. X{
  854. X  strcpy(help_buffer, dfiles_page);
  855. X  show_help();
  856. X}
  857. X
  858. X/* Pmode */
  859. Xstatic char pmode_page[] =
  860. X  "           Projection Mode\n\
  861. X\n\
  862. XThere are currently five projection\n\
  863. Xtransformations available.  Press the\n\
  864. Xbutton to cycle through the\n\
  865. Xpossiblilties.";
  866. X
  867. Xpmode_help()
  868. X{
  869. X  strcpy(help_buffer, pmode_page);
  870. X  show_help();
  871. X}
  872. X
  873. X/* Maglabels */
  874. Xstatic char maglabels_page[] =
  875. X  "           Magnitude Labels\n\
  876. X\n\
  877. XIt is often useful to have stars in a\n\
  878. Xgiven range of magnitudes labeled with\n\
  879. Xtheir magnitudes, e.g. in an asteroid\n\
  880. Xfinding chart, or a variable star\n\
  881. Xchart.\n\
  882. X\n\
  883. XSet bright and faint limits to the\n\
  884. Xrange, and specify ``Label stars with\n\
  885. Xtheir magnitudes''.";
  886. X
  887. Xmaglabels_help()
  888. X{
  889. X  strcpy(help_buffer, maglabels_page);
  890. X  show_help();
  891. X}
  892. X
  893. X/* Grid */
  894. Xstatic char grid_page[] =
  895. X  "                 Grid\n\
  896. X\n\
  897. XA coordinate lines in right\n\
  898. Xascension and declination may be\n\
  899. Xdrawn, with a specified spacing and\n\
  900. Xstarting coordinates.\n\
  901. X\n\
  902. XThe values for R.A. and Dec. are given\n\
  903. Xin hh.mm and dd.mm format\n\
  904. Xrespectively, e.g. an R.A. Step of\n\
  905. X0.30 means draw the R.A. lines with a\n\
  906. Xseparation of 30 min.\n\
  907. X\n\
  908. XThe ``Show R.A. grid'' and ``Show Dec.\n\
  909. Xgrid'' buttons control the display of\n\
  910. Xthe lines for R.A. and Dec., respectively.";
  911. X
  912. Xgrid_help()
  913. X{
  914. X  strcpy(help_buffer, grid_page);
  915. X  show_help();
  916. X}
  917. X
  918. X/* Emapwins */
  919. Xstatic char emapwins_page[] =
  920. X  "          Additional Control\n\
  921. X\n\
  922. XEach map in the chart is controlled by\n\
  923. Xa structure.\n\
  924. X\n\
  925. XThe other buttons control default\n\
  926. Xsettings for values in these\n\
  927. Xstructures.\n\
  928. X\n\
  929. XBy choosing ``Edit'', you will be\n\
  930. Xgiven the chance to control the\n\
  931. Xdetailed appearance of each map, and\n\
  932. Xadd additional maps to the chart.";
  933. X
  934. Xemapwins_help()
  935. X{
  936. X  strcpy(help_buffer, emapwins_page);
  937. X  show_help();
  938. X}
  939. X
  940. X/* Xparms */
  941. Xstatic char xparms_page[] =
  942. X  "             X Parameters\n\
  943. X\n\
  944. XThere are several controls specific to\n\
  945. XX11, and starXaw.\n\
  946. X\n\
  947. XYou may use flexible window dimensions\n\
  948. Xto set the window size when the chart\n\
  949. Xwindow is opened, or you may use fixed\n\
  950. Xwindow dimensions specified in the\n\
  951. Xwidth and height fields, or you may\n\
  952. Xuse dimensions which will duplicate\n\
  953. Xthe appearance of the page produced by\n\
  954. Xthe starpost program.\n\
  955. X\n\
  956. XYou may use an X backing store if your\n\
  957. XX display has sufficient memory.  This\n\
  958. Xallows the window to be repainted if\n\
  959. Xit is overwritten.\n\
  960. X\n\
  961. XYou may specify that color should not\n\
  962. Xbe used, even if it is available.";
  963. X
  964. Xxparms_help()
  965. X{
  966. X  strcpy(help_buffer, xparms_page);
  967. X  show_help();
  968. X}
  969. X
  970. X/* Svld */
  971. Xstatic char svld_page[] =
  972. X  "           Save / Load File\n\
  973. X\n\
  974. XA ``mapwin'' file contains the map\n\
  975. Xdescription structures for the chart\n\
  976. X(see ``Additional Control'' for more\n\
  977. Xinfo).  These files may be read,\n\
  978. Xor written for future use, including\n\
  979. Xuse by other starchart programs.\n\
  980. X\n\
  981. XA ``.starrc'' file contains the global\n\
  982. Xspecifications for the chart set by\n\
  983. Xthe other buttons.";
  984. X
  985. Xsvld_help()
  986. X{
  987. X  strcpy(help_buffer, svld_page);
  988. X  show_help();
  989. X}
  990. X
  991. X
  992. X/* D_mapwininput */
  993. Xstatic char mwinin_page[] =
  994. X  "       Edit mapwindow structure\n\
  995. X\n\
  996. XNote that if you change the number of\n\
  997. Xstructures, the first structure is\n\
  998. Xused for the defaults in the new\n\
  999. Xstructure.\n\
  1000. X\n\
  1001. XNote also that since the Legend is\n\
  1002. Xdrawn as a layer for a window, you\n\
  1003. Xmust edit the Layers for the\n\
  1004. Xstructures to ensure that the correct\n\
  1005. Xlegend, and only the correct legend,\n\
  1006. Xis drawn.";
  1007. X
  1008. Xmwinin_help()
  1009. X{
  1010. X  strcpy(help_buffer, mwinin_page);
  1011. X  show_help();
  1012. X}
  1013. X
  1014. X/* edit_structs */
  1015. Xstatic char estru_page[] =
  1016. X  "            Edit Structure\n\
  1017. X\n\
  1018. XNote that the magnitude limits are set\n\
  1019. Xindividually for each data file.\n\
  1020. X\n\
  1021. XPress the Next button (if any) to move\n\
  1022. Xto the next structure,  press the Prev\n\
  1023. Xbutton (if any) to move to the\n\
  1024. Xprevious structure.";
  1025. X
  1026. Xestru_help()
  1027. X{
  1028. X  strcpy(help_buffer, estru_page);
  1029. X  show_help();
  1030. X}
  1031. X
  1032. X/* edit_layers */
  1033. Xstatic char elay_page[] =
  1034. X  "             Edit Layers\n\
  1035. X\n\
  1036. XEach map is drawn as several layers.\n\
  1037. XThis controls which layers are drawn,\n\
  1038. Xand the order in which they are drawn.\n\
  1039. X\n\
  1040. XThe outline (including tick marks when\n\
  1041. Xpossible), R.A. and Declination grids\n\
  1042. X(if specified), ecliptic,\n\
  1043. Xconstellation boundaries,\n\
  1044. Xconstellation patterns, and\n\
  1045. Xconstellation names, are all separate\n\
  1046. Xlayers.  The legend is also considered\n\
  1047. Xas a separate layer.\n\
  1048. X\n\
  1049. XIn addition, the data from the object\n\
  1050. Xfiles may be drawn either as the\n\
  1051. Xobject is read (``All Files''), or as\n\
  1052. Xseparate layers for the: symbol, name,\n\
  1053. Xmagnitude label, vectors, and areas\n\
  1054. Xspecified in the files.\n\
  1055. X\n\
  1056. XPressing a button causes the layer for\n\
  1057. Xthat position to cycle through the\n\
  1058. Xpossiblilities.";
  1059. X
  1060. Xelay_help()
  1061. X{
  1062. X  strcpy(help_buffer, elay_page);
  1063. X  show_help();
  1064. X}
  1065. X
  1066. X/* edit_files */
  1067. Xstatic char efiles_page[] =
  1068. X  "              Edit Files\n\
  1069. X\n\
  1070. XPress the Next button (if any) to move\n\
  1071. Xto the next file,  press the Prev\n\
  1072. Xbutton (if any) to move to the\n\
  1073. Xprevious file.";
  1074. X
  1075. Xefiles_help()
  1076. X{
  1077. X  strcpy(help_buffer, efiles_page);
  1078. X  show_help();
  1079. X}
  1080. X
  1081. X
  1082. X
  1083. X
  1084. X
  1085. X
  1086. X/* Pointer input */
  1087. Xstatic char pointer_page[] =
  1088. X  "Press the left mouse button\n\
  1089. Xor equivalent to\n\
  1090. Xdisplay the coordinates at the\n\
  1091. Xpointer location.\n\
  1092. X\n\
  1093. XPress the right mouse button\n\
  1094. Xor equivalent to\n\
  1095. Xidentify objects near the\n\
  1096. Xpointer location.\n\
  1097. X\n\
  1098. XResults appear in the\n\
  1099. XOutput window and on\n\
  1100. Xthe standard error output.\n\
  1101. X\n";
  1102. X
  1103. X
  1104. Xpointer_help()
  1105. X{
  1106. X  strcpy(help_buffer, pointer_page);
  1107. X  show_help();
  1108. X}
  1109. X
  1110. END_OF_FILE
  1111. if test 13385 -ne `wc -c <'starchart/starXawHelp.c'`; then
  1112.     echo shar: \"'starchart/starXawHelp.c'\" unpacked with wrong size!
  1113. fi
  1114. # end of 'starchart/starXawHelp.c'
  1115. fi
  1116. if test -f 'starchart/starlaser.c' -a "${1}" != "-c" ; then 
  1117.   echo shar: Will not clobber existing file \"'starchart/starlaser.c'\"
  1118. else
  1119. echo shar: Extracting \"'starchart/starlaser.c'\" \(12103 characters\)
  1120. sed "s/^X//" >'starchart/starlaser.c' <<'END_OF_FILE'
  1121. X/*
  1122. X** Hewlett-Packard Laserjet (2686a) laser printer driver
  1123. X** for starchart.
  1124. X** Low-level routines (starting with 'HPLJET') written and copyrighted by
  1125. X** Jyrki Yli-Nokari (jty@intrin.FI),
  1126. X** Petri Launiainen (pl@intrin.FI),
  1127. X** Intrinsic, Ltd.,  FINLAND.
  1128. X**
  1129. X** You may use this code as you wish if credit is given and this message
  1130. X** is retained.
  1131. X*/
  1132. X
  1133. X/*
  1134. X ! patched December, 1987 by Alan Paeth (awpaeth@watcgl),
  1135. X !
  1136. X ! [1] "bigmaster" chart layout now added
  1137. X ! [2] different XOFF and YOFF values adopted for better margins
  1138. X !
  1139. X */
  1140. X/*
  1141. X ! Modified for 3.0 January 1989 by Craig Counterman
  1142. X !                                  (email: ccount@royal.mit.edu)
  1143. X */
  1144. X
  1145. Xstatic char rcsid[]="$Header: starlaser.c,v 2.4 90/03/10 15:34:47 ccount Exp $";
  1146. X
  1147. X/*
  1148. X** This code is intended for ALL Laserjet family printers.
  1149. X** Because the base version has only 59 k raster buffer, the
  1150. X** stars are not completely round, but not too ugly either.
  1151. X*/
  1152. X
  1153. X#include <stdio.h>
  1154. X#include <math.h>
  1155. X
  1156. X#include "star3.h"
  1157. X
  1158. Xchar *calloc ();
  1159. X
  1160. X#define SCALEU    29L        /* graphics scaling */
  1161. X#define SCALEL    40L
  1162. X
  1163. X#define TSCALEU    69L        /* text mode scaling */
  1164. X#define TSCALEL    10L
  1165. X
  1166. X#define XOFF    520        /* text centering offset (in decipoints) */
  1167. X#define YOFF    (-50)        /* previously, XOFF=1060; YOFF=(-80) */
  1168. X
  1169. X#define HPLJETXMAX 743        /* Number of pixels in X-axis */
  1170. X#define HPLJETYMAX 557        /* Number of pixels in Y-axis */
  1171. X
  1172. X
  1173. X/* Externs */
  1174. Xextern int g_argc;
  1175. Xextern char **g_argv;
  1176. X
  1177. Xextern char *title;    /* Title of page */
  1178. X
  1179. Xextern mapwindow *mapwin[MAXWINDOWS];
  1180. Xextern int numwins;
  1181. X
  1182. X
  1183. X
  1184. Xextern int cur_function;
  1185. Xextern int cur_map_type;
  1186. Xextern int cur_map_tag;
  1187. Xextern char *cur_tag_field;
  1188. X
  1189. X/* Scale multiplier, minimum,
  1190. X   mangitude change, maximum, for thumbnail,*/
  1191. X#define THSMUL 1.2
  1192. X#define THSMIN 12.0
  1193. X#define THMADJ 2.5
  1194. X#define THMMAX 5.0
  1195. X
  1196. X
  1197. X/* Exports */
  1198. X
  1199. X/* The variables in the first few lines MUST be set by driver */
  1200. Xmapwindow fullpage = {
  1201. X  880, 700, 20, 65,    /* width, height, x and y offsets */
  1202. X  8.0, 2.0, 2.05,    /* default limiting mags for glyph, name, label */
  1203. X
  1204. X/* The next several variables SHOULD be set by the driver,
  1205. X   but are only used by the driver */
  1206. X  FULLPAGEMAP,        /* Type of map: THUMBNAIL may have
  1207. X               some restrictions */
  1208. X  0,            /* May be used by driver for whatever */
  1209. X  "String",        /* May be used by driver for whatever */
  1210. X
  1211. X/* The next several variables may be set by the driver, but the main routines
  1212. X   may reset them (and the driver routines may then override that) */
  1213. X  SANSONS,        /* Projection mode */
  1214. X  FALSE, FALSE,        /* Draw grids */
  1215. X  0.5, 5.0,        /* grid step size */
  1216. X  0.0, 0.0,        /* grid origin */
  1217. X
  1218. X  FALSE,        /* Invert (flip north south) */
  1219. X};
  1220. X
  1221. X/* The variables in the first few lines MUST be set by driver */
  1222. Xmapwindow mainmap = {
  1223. X  880, 500, 20, 265,    /* width, height, x and y offsets */
  1224. X  8.0, 2.0, 2.05,    /* default limiting mags for glyph, name, label */
  1225. X
  1226. X/* The next several variables SHOULD be set by the driver,
  1227. X   but are only used by the driver */
  1228. X  MAINMAP,        /* Type of map: THUMBNAIL may have
  1229. X               some restrictions */
  1230. X  0,            /* May be used by driver for whatever */
  1231. X  "String",        /* May be used by driver for whatever */
  1232. X
  1233. X/* The next several variables may be set by the driver, but the main routines
  1234. X   may reset them (and the driver routines may then override that) */
  1235. X  SANSONS,        /* Projection mode */
  1236. X  FALSE, FALSE,        /* Draw grids */
  1237. X  0.5, 5.0,        /* grid step size */
  1238. X  0.0, 0.0,        /* grid origin */
  1239. X
  1240. X  FALSE,        /* Invert (flip north south) */
  1241. X};
  1242. X
  1243. X
  1244. X/* The variables in the first few lines MUST be set by driver */
  1245. Xmapwindow thumbmap = {
  1246. X  480, 195, 420, 35,    /* width, height, x and y offsets */
  1247. X  5.5+THMADJ, 1.0+THMADJ, 2.05+THMADJ,
  1248. X            /* default limiting mags for glyph, name, label */
  1249. X
  1250. X/* The next several variables SHOULD be set by the driver,
  1251. X   but are only used by the driver */
  1252. X  THUMBNAIL,        /* Type of map: THUMBNAIL may have
  1253. X               some restrictions */
  1254. X  0,            /* May be used by driver for whatever */
  1255. X  "String",        /* May be used by driver for whatever */
  1256. X
  1257. X/* The next several variables may be set by the driver, but the main routines
  1258. X   may reset them (and the driver routines may then override that) */
  1259. X  SANSONS,        /* Projection mode */
  1260. X  FALSE, FALSE,        /* Draw grids */
  1261. X  0.5, 5.0,        /* grid step size */
  1262. X  0.0, 0.0,        /* grid origin */
  1263. X
  1264. X  FALSE,        /* Invert (flip north south) */
  1265. X};
  1266. X
  1267. X/* h & v tick text controls */
  1268. Xint htick_lim = 2;
  1269. Xint htext_lim = 80;
  1270. Xint htext_xoff = 2;
  1271. Xint htext_yoff = 17;
  1272. Xint vtick_lim = 2;
  1273. Xint vtext_lim = 20;
  1274. Xint vtext_xoff = 24;
  1275. Xint vtext_yoff = 0;
  1276. X
  1277. X/* externs for labels */
  1278. Xint x_nameoffset = 10, y_nameoffset = 0;
  1279. Xint x_lbloffset = 0, y_lbloffset = 10;
  1280. Xint x_magoffset = 7, y_magoffset = -15;
  1281. X
  1282. X/* externs for legend: variables of positioning are here */
  1283. Xint l_til=220;
  1284. Xint l_stil=185;
  1285. X
  1286. Xint l_lmar1=40;
  1287. Xint l_lmar2=65;
  1288. Xint l_ltext=95;
  1289. Xint l_rmar1=205;
  1290. Xint l_rmar2=230;
  1291. Xint l_rtext=260;
  1292. X
  1293. Xint l_line1=150;
  1294. Xint l_line2=125;
  1295. Xint l_line3=100;
  1296. Xint l_line4=75;
  1297. Xint l_line5=50;
  1298. Xint l_line6=25;
  1299. X
  1300. X/* Point sizes for font calls */
  1301. Xint titlesize=16;
  1302. Xint subtlsize=12;
  1303. Xint namesize=10;
  1304. Xint lblsize=8;
  1305. Xint magsize=8;
  1306. X
  1307. X/* Fonts for font calls */
  1308. Xint namefnt=TIMESROMAN;
  1309. Xint lblfnt=HELV;
  1310. Xint magfnt=COURIER;
  1311. Xint titlefnt=TIMESBOLD;
  1312. Xint subtlfnt=TIMESROMAN;
  1313. X
  1314. X/* Scale multiplier, minimum,
  1315. X   mangitude change, maximum, for thumbnail,*/
  1316. Xdouble th_smul=THSMUL;
  1317. Xdouble th_smin=THSMIN;
  1318. Xdouble th_madj=THMADJ;
  1319. Xdouble th_mmax=THMMAX;
  1320. X
  1321. X#define MAX(a,b) ((a)>(b)?(a):(b))
  1322. X#define MIN(a,b) ((a)<(b)?(a):(b))
  1323. X
  1324. X/* Device control argument */
  1325. XD_control_arg(s)
  1326. Xchar *s;
  1327. X{
  1328. X  int i = 0;
  1329. X  int c;
  1330. X
  1331. X  while (c = s[i++]) switch (c) {
  1332. X  default:
  1333. X    break;
  1334. X  }
  1335. X}
  1336. X
  1337. X/* Open the device */
  1338. XD_open()
  1339. X{
  1340. X  HPLJETorient ();
  1341. X  r_makeraster (HPLJETXMAX, HPLJETYMAX);
  1342. X
  1343. X  return TRUE ;                /* open successful */
  1344. X}
  1345. X
  1346. X/* Close the device */
  1347. XD_close()
  1348. X{
  1349. X  HPLJETdump ();
  1350. X}
  1351. X
  1352. X
  1353. X/* Move to (x, y) */
  1354. XD_move(x, y)
  1355. X     int x, y;
  1356. X{
  1357. X  x = (x*SCALEU)/SCALEL;        /* adjust to bitmap size */
  1358. X  y = (y*SCALEU)/SCALEL;
  1359. X
  1360. X  HPLJETmove (x, y);
  1361. X}
  1362. X
  1363. X/* Draw a line of style line_style from the current point to (x, y) */
  1364. X/* Note, this replaces vecdraw vecdrawdot and vecdrawhyph */
  1365. XD_draw(x, y, line_style)
  1366. X     int x, y;
  1367. X     int line_style;    /* SOLID, DOTTED, DASHED, etc. */
  1368. X{
  1369. X  x = (x*SCALEU)/SCALEL;        /* adjust to bitmap size */
  1370. X  y = (y*SCALEU)/SCALEL;
  1371. X
  1372. X/* all styles are the same */
  1373. X  HPLJETdraw (x, y);
  1374. X}
  1375. X/* This routine is encouraged to look at the extern cur_funtion
  1376. X   and change the line style drawn as desired */
  1377. X
  1378. X
  1379. X/* Move to (x1, y1) then draw a line of style line_style to (x2, y2) */
  1380. XD_movedraw(x1, y1, x2, y2, line_style)
  1381. X     int x1, y1, x2, y2;
  1382. X     int line_style;    /* SOLID, DOTTED, DASHED, etc. */
  1383. X{
  1384. X/* all styles are the same */
  1385. X  x1 = (x1*SCALEU)/SCALEL;        /* adjust to bitmap size */
  1386. X  y1 = (y1*SCALEU)/SCALEL;
  1387. X
  1388. X  x2 = (x2*SCALEU)/SCALEL;        /* adjust to bitmap size */
  1389. X  y2 = (y2*SCALEU)/SCALEL;
  1390. X
  1391. X  HPLJETmove (x1, y1);
  1392. X  HPLJETdraw (x2, y2);
  1393. X}
  1394. X
  1395. X
  1396. X/* Set the color to be used for lines and text */
  1397. X/* color_str is a 2 char (+ '\0') string
  1398. X   containing a specification for a color,
  1399. X   e.g. "G2" for the color of a star of spectral class G2, or "r7" for
  1400. X   red, level seven.  The interpretation of the color string is left to
  1401. X   the device driver */
  1402. XD_color(color_str)
  1403. X     char *color_str;
  1404. X{
  1405. X  switch (color_str[0]) {
  1406. X  case 'O':
  1407. X    break;
  1408. X  case 'B':
  1409. X    break;
  1410. X  case 'A':
  1411. X    break;
  1412. X  case 'F':
  1413. X    break;
  1414. X  case 'G':
  1415. X    break;
  1416. X  case 'K':
  1417. X    break;
  1418. X  case 'M':
  1419. X    break;
  1420. X  case 'R':
  1421. X  case 'N':
  1422. X  case 'S':
  1423. X    break;
  1424. X  case ' ':
  1425. X  default:
  1426. X    break;
  1427. X  }
  1428. X}
  1429. X
  1430. X/* Set the font and font size to be used for text. */
  1431. X/* Note order of args */
  1432. XD_fontsize(fsize, font)
  1433. X     int fsize;        /* Size of font */
  1434. X     int font;        /* e.g. TIMES, HELV, TIMES+ITALIC */
  1435. X{
  1436. X}
  1437. X/* This routine is encouraged to look at the extern cur_funtion
  1438. X   and change the font used as desired */
  1439. X
  1440. X/*
  1441. X** Text handling is a pain because of separate text/graphics mode
  1442. X** and separated axises
  1443. X*/
  1444. X
  1445. X/* Display text string str at x,y, in current font and font size.
  1446. X   if star_lbl is TRUE, string is a star label, use
  1447. X     greek characters (if possible) */
  1448. XD_text(x, y, str, star_lbl)
  1449. X     int x, y;
  1450. X     char *str;
  1451. X     int star_lbl;
  1452. X{
  1453. X  y = 767 - y;                /* change y axis on text output */
  1454. X  y -= 5;                /* center character strings */
  1455. X  x = (x*TSCALEU)/TSCALEL + XOFF;    /* adjust to bitmap size */
  1456. X  y = (y*TSCALEU)/TSCALEL + YOFF;
  1457. X
  1458. X  if (star_lbl) {
  1459. X    /* remove leading spaces */
  1460. X    while (*str == ' ') str++;
  1461. X    /* can't display greek characters */
  1462. X  }
  1463. X
  1464. X  printf ("\033&a%dh%dV%s", x, y, str);
  1465. X}
  1466. X
  1467. X
  1468. X/* Return input coordinate in device coords where there are pointing devices */
  1469. XD_inxy(x, y)
  1470. X     int *x, *y;
  1471. X{
  1472. X}
  1473. X
  1474. X/* Put non-displayed comment in output.  Allowed in postscript, but
  1475. X   few other drivers will be able to support this. */ 
  1476. XD_comment(str)
  1477. X     char *str;
  1478. X{
  1479. X/*
  1480. X  fprintf(stderr, "%s\n", str);
  1481. X*/
  1482. X}
  1483. X
  1484. X
  1485. X/**
  1486. XHigher level functions
  1487. X**/
  1488. X
  1489. Xdrawlen(x, y, dx, dy, len)
  1490. X     int x, y, dx, dy, len;
  1491. X{
  1492. X  x = (x*SCALEU)/SCALEL;         /* adjust to bitmap size */
  1493. X  y = (y*SCALEU)/SCALEL;
  1494. X
  1495. X  HPLJETmove (x + dx, y + dy);
  1496. X  HPLJETdraw (x + dx + len - 1, y+dy);
  1497. X}
  1498. X
  1499. X
  1500. X/*
  1501. X** Low Level Laserjet Plotting Routines
  1502. X*/
  1503. X
  1504. XHPLJETorient ()    /* switch to portrait text orientation mode */
  1505. X{
  1506. X  printf ("\033E");    /* Restore defaults */
  1507. X  printf ("\033&l1O");
  1508. X}
  1509. X
  1510. XHPLJETmove (x, y)    /* move to (x,y) */
  1511. X     int x, y;
  1512. X{
  1513. X  r_move (x, y);
  1514. X}
  1515. X
  1516. XHPLJETdraw (x, y)    /* draw to (x,y) */
  1517. X     int x, y;
  1518. X{
  1519. X  r_draw (x, y);
  1520. X}
  1521. X
  1522. X#define IN(i,size)    ((unsigned)i < size)
  1523. Xtypedef char ritem;
  1524. Xtypedef ritem *raster[];
  1525. X
  1526. Xstatic raster *r_p;    /* global pointer to raster */
  1527. Xstatic int r_currx, r_curry;    /* the current coordinates */
  1528. Xstatic int r_xsize, r_ysize;    /* the size of the raster */
  1529. X
  1530. X/*
  1531. X** set pixel (x,y) to value val (zero or nonzero).
  1532. X*/
  1533. Xvoid r_setpixel(x, y, val)
  1534. X     int x, y;
  1535. X     ritem val;
  1536. X{
  1537. X  if (IN(x, r_xsize) && IN(y, r_ysize)) {
  1538. X    *(((*r_p)[y]) + x) = val;
  1539. X  }
  1540. X}
  1541. X
  1542. X/*
  1543. X** get pixel (x,y) value (0 or 1)
  1544. X*/
  1545. Xint r_getpixel(x, y)
  1546. X     int x, y;
  1547. X{
  1548. X  if (IN(x, r_xsize) && IN(y, r_ysize)) {
  1549. X    return *(((*r_p)[y]) + x);
  1550. X  }
  1551. X  else
  1552. X    return (0);
  1553. X}
  1554. X
  1555. X/*
  1556. X** allocate the raster
  1557. X*/
  1558. Xr_makeraster(x, y)
  1559. X     unsigned x, y;
  1560. X{
  1561. X  register int j;
  1562. X    
  1563. X  /* allocate row pointers */
  1564. X  if ((r_p = (raster *)calloc(y, sizeof(ritem *))) == NULL) {
  1565. X    perror("Raster buffer allocation failure");
  1566. X    exit(1);
  1567. X  }
  1568. X  for (j = 0; j < y; j++) {
  1569. X    if (((*r_p)[j] = (ritem *)calloc(x, sizeof(ritem))) == NULL) {
  1570. X      perror("Raster buffer allocation failure");
  1571. X      exit(1);
  1572. X    }
  1573. X  }
  1574. X  r_xsize = x; r_ysize = y;
  1575. X  r_currx = r_curry = 0;
  1576. X}
  1577. X
  1578. X/*
  1579. X** plot a line from (x0,y0) to (x1,y1)
  1580. X*/
  1581. Xr_plot(x0, y0, x1, y1)
  1582. X     int x0, y0, x1, y1;
  1583. X{
  1584. X  int e, hx, hy, dx, dy, i;
  1585. X  /*
  1586. X   ** We use Bresenham's alorithm for plotting
  1587. X   ** (IBM system journal 4(1):25-30, 1965)
  1588. X   */
  1589. X  hx = abs(x1 - x0);
  1590. X  hy = abs(y1 - y0);
  1591. X  dx = (x1 > x0) ? 1 : -1;
  1592. X  dy = (y1 > y0) ? 1 : -1;
  1593. X
  1594. X  if (hx > hy) {
  1595. X    /*
  1596. X     ** loop over x-axis
  1597. X     */
  1598. X    e = hy + hy - hx;
  1599. X    for (i = 0; i <= hx; i++) {
  1600. X      r_setpixel(x0, y0, 1);
  1601. X      if (e > 0) {
  1602. X    y0 += dy;
  1603. X    e += hy + hy - hx - hx;
  1604. X      } else {
  1605. X    e += hy + hy;
  1606. X      }
  1607. X      x0 += dx;
  1608. X    }
  1609. X  } else {
  1610. X    /*
  1611. X     ** loop over y-axis
  1612. X     */
  1613. X    e = hx + hx - hy;
  1614. X    for (i = 0; i <= hy; i++) {
  1615. X      r_setpixel(x0, y0, 1);
  1616. X      if (e > 0) {
  1617. X    x0 += dx;
  1618. X    e += hx + hx - hy - hy;
  1619. X      } else {
  1620. X    e += hx + hx;
  1621. X      }
  1622. X      y0 += dy;
  1623. X    }
  1624. X  }
  1625. X}
  1626. X
  1627. X/*
  1628. X** move to (x,y)
  1629. X*/
  1630. Xr_move(x, y)
  1631. X     int x, y;
  1632. X{
  1633. X  r_currx = x;
  1634. X  r_curry = y;
  1635. X}
  1636. X
  1637. X/*
  1638. X** draw to (x,y)
  1639. X** (move pen down)
  1640. X*/
  1641. Xr_draw(x, y)
  1642. X     int x, y;
  1643. X{
  1644. X  r_plot(r_currx, r_curry, x, y);
  1645. X  r_currx = x;
  1646. X  r_curry = y;
  1647. X}
  1648. X
  1649. X/*
  1650. X** free the allocated raster
  1651. X*/
  1652. Xr_freeraster()
  1653. X{
  1654. X  int y;
  1655. X
  1656. X  for (y = 0; y < r_ysize; y++) {
  1657. X    free((char *)(*r_p)[y]);
  1658. X  }
  1659. X  free((char *)r_p);
  1660. X}
  1661. X
  1662. XHPLJETdump ()
  1663. X{
  1664. X  int x, y, i;
  1665. X  unsigned v;
  1666. X
  1667. X  printf("\033*t75R\033&a0r\033&a135C\033&a-2R\033*r1A");
  1668. X  for (x = r_xsize-1; x >= 0; x--) {
  1669. X    printf("\033*b%dW", r_ysize/8);
  1670. X    for (y = r_ysize-8; y >= 0; y -= 8) {
  1671. X      v = 0;
  1672. X      for (i = 7; i >= 0; i--) {
  1673. X    v = (v << 1) | r_getpixel(x, y + i);
  1674. X      }
  1675. X      putc((char) v, stdout);
  1676. X    }
  1677. X  }
  1678. X  r_freeraster();
  1679. X  printf("\033*rB\033&l0O");
  1680. X    /* Change of orientation seems to produce form feed */
  1681. X}
  1682. X
  1683. END_OF_FILE
  1684. if test 12103 -ne `wc -c <'starchart/starlaser.c'`; then
  1685.     echo shar: \"'starchart/starlaser.c'\" unpacked with wrong size!
  1686. fi
  1687. # end of 'starchart/starlaser.c'
  1688. fi
  1689. echo shar: End of archive 8 \(of 32\).
  1690. cp /dev/null ark8isdone
  1691. MISSING=""
  1692. for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 ; do
  1693.     if test ! -f ark${I}isdone ; then
  1694.     MISSING="${MISSING} ${I}"
  1695.     fi
  1696. done
  1697. if test "${MISSING}" = "" ; then
  1698.     echo You have unpacked all 32 archives.
  1699.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  1700. else
  1701.     echo You still need to unpack the following archives:
  1702.     echo "        " ${MISSING}
  1703. fi
  1704. ##  End of shell archive.
  1705. exit 0
  1706.  
  1707.