home *** CD-ROM | disk | FTP | other *** search
Text File | 1990-03-27 | 41.4 KB | 1,699 lines |
- #! /bin/sh
- # This is a shell archive. Remove anything before this line, then unpack
- # it by saving it into a file and typing "sh file". To overwrite existing
- # files, type "sh file -c". You can also feed this as standard input via
- # unshar, or by typing "sh <file", e.g.. If this archive is complete, you
- # will see the following message at the end:
- # "End of archive 8 (of 32)."
- # Contents: doc/starchart.1 starchart/starXawHelp.c
- # starchart/starlaser.c
- PATH=/bin:/usr/bin:/usr/ucb ; export PATH
- if test -f 'doc/starchart.1' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'doc/starchart.1'\"
- else
- echo shar: Extracting \"'doc/starchart.1'\" \(13012 characters\)
- sed "s/^X//" >'doc/starchart.1' <<'END_OF_FILE'
- X.TH STARCHART LOCAL "15 July 1989"
- X.ad b
- X.SH NAME
- Xstardsp, starlaser, starpost, starsunv, startool, startek, staruplot,
- XstarX10, starX11, starXaw, starXtk \- print astronomical star charts.
- X.SH SYNOPSIS
- Xstar____
- X[
- X.BI \-c " constellation"
- X[
- X.I constell_data_file
- X]
- X]
- X.br
- X.if t .ti +.5i
- X[
- X.BI \-r " R.A."
- X.BI \-d " Declination"
- X]
- X[
- X.BI \-s " scale"
- X]
- X[
- X.BI \-m " maglim"
- X]
- X.br
- X.if t .ti +.5i
- X[
- X.BI \-l " lbllim"
- X]
- X[
- X.BI \-g " grklim"
- X]
- X[
- X.BI \-t " title"
- X]
- X.br
- X.if t .ti +.5i
- X[
- X.BI \-p
- X[
- X.I projection_mode
- X]
- X]
- X.br
- X.if t .ti +.5i
- X[
- X.BI \-f " user1.star"
- X[
- X.I file_format
- X]
- X]
- X.br
- X.if t .ti +.5i
- X[
- X.BI \-y " yale.star"
- X[
- X.I file_format
- X]
- X]
- X.br
- X.if t .ti +.5i
- X[
- X.BI \-n " neb.star"
- X[
- X.I file_format
- X]
- X]
- X.br
- X.if t .ti +.5i
- X[
- X.BI \-w " planet.star"
- X[
- X.I file_format
- X]
- X]
- X[
- X.BI \-h " index.indx"
- X]
- X.br
- X.if t .ti +.5i
- X[
- X.BI \-v " center_mag mag_range"
- X]
- X.br
- X.if t .ti +.5i
- X[
- X.BI \-x " ra_spacing de_spacing"
- X[
- X.I ra_origin de_origin
- X]
- X]
- X.br
- X.if t .ti +.5i
- X[
- X.BI \-b
- X]
- X[
- X.BI \-i
- X]
- X[
- X.BI \-u
- X]
- X[
- X.BI \-e " extra_commands_file"
- X]
- X.br
- X.if t .ti +.5i
- X[
- X.BI \-a " device_control_string"
- X]
- X.SH DESCRIPTION
- XThese programs generate star charts based on data extracted from the Yale
- Xpublic domain star catalog, the SAO catalog, the RNGC catalog, and
- Xother databases.
- XOutput is to the terminal
- X.RI ( stardsp ),
- XHewlett-Packard Laserjet printer format
- X.RI ( starlaser ),
- XPostScript format
- X.RI ( starpost ),
- XSun Sunview format
- X.RI ( starsunv ),
- XSun Sunview using
- X.B tooltool
- X.RI ( startool ),
- XTektronix vector format
- X.RI ( startek ),
- XUnix Plot(5) format
- X.RI ( staruplot ),
- XX Version 10
- X.RI ( starX10 ),
- XX Version 11
- X.RI ( starX11 ),
- XX Version 11 using Athena widgets
- X.RI ( starXaw ),
- Xand X Version 11 using Athena widgets with a different interface
- X.RI ( starXtk ).
- X.PP
- XStar data is optionally overlayed with other cosmic objects, such as planets.
- XIf limiting magnitudes are properly set and the databases are available,
- XNGC objects, constellation boundaries and names, and constellation
- Xpatterns are also printed.
- X.PP
- XThe starchart center is specified by two parameters: Right
- XAscension [0.00 to 24.00 hours] and Declination [-90.00 to +90.00 degrees].
- XAn optional scale parameter defines either the N/S range of the output
- Xwindow, in degrees of declination or the radius of the map in
- Xdegrees, depending on the map projection. Digits after decimal point
- Xare taken as minutes: object positions can therefore be taken
- Xdirectly from a star catalog.
- X.PP
- XOther parameters are:
- X.TP
- X.B \-r
- XRight ascension.
- X.TP
- X.B \-d
- XDeclination.
- X.TP
- X.B \-s
- XScale.
- X.TP
- X.B \-c
- XA three or four character mnemonic follows, which is a search string for a
- Xmatching line-item entry in the file
- X.IR constell_data_file .
- XIf found, then the
- Xinitial values for Ra, Decl, Scale and Title are taken from that file.
- XBecause the command line is parsed from left to right, subsequent switches
- Xmight change the scale, title, or otherwise fine-tune the new defaults.
- X.TP
- X.B \-m
- XStar limiting magnitude. This sets limits on the faintest stars displayed
- Xon the ``master'' view. Default limits are device driver dependent
- X(more below). The ``thumbnail'' finder view is set to a related
- Xlimit.
- X.TP
- X.B \-l
- XName label limiting magnitude. The Yale database contains both a small set of
- Xfamiliar names (for stars and special objects), plus an extensive list of
- Xlabels (Greek Bayer letter or Flamsteed numbers). Star names (including planet
- Xnames) always print for this small set. To avoid clutter, the labels may be
- Xomitted below a cut-off magnitude by specifying this value.
- X.TP
- X.B \-g
- XGreek/Flamsteed annotation magnitude. Labels printed for stars dimmer than
- Xthis value will use a Bayer or numerical label in favor of a proper name.
- XThe default (2.05) includes nearly all well-known proper names including
- XPolaris, and excludes but a small number (such as Algol). Large values
- Xgenerate charts full of obscure Arabian names, small (zero or negative) values
- Xproduce non-verbose charts, e.g. ``a'', in Greek where possible, instead of
- X``Sirius''.
- X.TP
- X.B \-t
- XTitle.
- X.TP
- X.B \-p
- XProjection mode. With no argument, selects STEREOGRAPHIC projection
- Xinstead of the default SANSONS. Argument may be used to select
- XGNOMONIC, ORTHOGRAPHIC or RECTANGULAR.
- X.TP
- X.B \-b
- XThis switch provides a single full-page of output, without a thumbnail-sized
- Xfinder map. The legend placard is replaced with a single line banner giving
- Xtitle, right ascension, declination and limiting magnitude. This mode is
- Xuseful for the construction of atlas pages. Because the page depicts the same
- Xvertical scale in degrees of declination, the output will cover a slightly
- Xreduced extent in right ascension.
- X.TP
- X.B \-f
- XThe argument is the name of a user-supplied file containing objects in
- Xthe yale.star (a.k.a. ``lineread'') format, which will overlay the output.
- XThis is useful for generating asteroid finder charts, planet or
- Xsatellite tracks, or other special needs. Files are processed
- Xsequentially. Thus, order may take on meaning for devices which
- Xprovide a 2-1/2D page description, such as PostScript. The file
- Xformat may be ``lineread'', ``binfull'', ``binobj'', ``binstar'' or ``gsc''.
- X.TP
- X.B \-y \-n \-w \-h
- XThese switches allow for the redefinition of the bright star, nebula,
- Xplanet, and star index files, respectively. The files are in
- X``lineread'' format unless a \fIfile_format\fR is specified.
- X.TP
- X.B \-v
- Xmag range. The stars in a range of magnitudes are labeled with their
- Xmagnitude, as for variable star or asteroid finder charts. The first
- Xargument is the center magnitude, and the second a range: stars within
- Xplus or minus range of the center magnitude are labeled.
- X.TP
- X.B \-x
- Xra_spacing de_spacing [ra_origin de_origin]. A grid is drawn, with arbitrary
- Xspacing in ra and dec. The optional third and fourth arguments
- Xallow the origin of the grid to be moved.
- X.TP
- X.B \-i
- Xinvert. The main map of the chart is dawn with north and south
- Xflipped, to produce an inverted view.
- X.TP
- X.B \-e
- Xextra. The argument is a file containing a detailed description of
- Xthe chart, by setting many control variables. These include those
- Xwhich may be controlled by command line switches, and many more.
- XThis file may be in either ``mapwin'' format or ``.starrc'' format.
- XThe ``mapwin'' format specifies the detailed configuration of each
- Xmap in the chart.
- X.TP
- X.B \-a
- Xadditional. This argument is passed to the device dependent routines,
- Xto allow for special controls. See the man page for the particular
- Xprogram, e.g. starX11(1). If the \fB-a\fR argument is supported,
- Xthere should be a separate man page.
- X.TP
- X.B \-u
- Xuser input. If the program has been compiled for this option,
- Xcontrols of the sort which may be placed in a ``.starrc'' file may be
- Xtyped by the user interactively. The ``end_input'' command causes the
- Xchart to be drawn, ``quit'' exits the program.
- X.PP
- X
- X.SH THE .starrc AND -e CONTROL FILE
- X
- XDetailed control of the chart is provided through files containing
- Xvariable names and values. A ``.starrc'' file may be used to set
- Xpersonal preferences. Additionally, the
- X.B \-e
- Xargument allows additional files to be read. These files set
- Xparameters which may be overridden by later command line arguments.
- X.PP
- XThe \fB-e\fR file may be in ``.starrc'' format or in ``mapwin''
- Xformat. Exact specifications for each map in a chart are contained in
- Xsuch a ``mapwin'' file.
- X.PP
- XFor a detailed explanation, see the ``astro.texinfo'' document and the
- Xsample .rc files.
- X
- X.SH SPECIAL ARGUMENTS
- XThe
- X.B \-a
- Xargument is used by individual driver programs for device-specific
- Xcontrols. See the manual page (if there is one) for that program for
- Xdetails.
- X
- X.SH INTERACTION
- XThe \fB-u\fR option activates interactive mode, where the same
- Xcommands as in the ``.starrc'' file may be typed to control the
- Xprogram options. In addition, ``end_input'' ends interactive input
- Xand draws the chart. After the chart is drawn, control returns to the
- Xkeyboard. The ``quit'' command exits the program. The command
- X``show'' shows the current state of the control variables. The
- Xcommand ``help'' may be used to get a brief description of the
- Xcommands and controls available.
- X.PP
- XSome, especially window based, versions will allow the user final
- Xcontrol over each map of the chart. The chart is specified by an
- Xarray of large \fBC\fR structures, one for each map on the page. The
- X``mapwin'' file contains the values in this structure. Advanced
- Xinteractive versions of starchart, such as starXaw, allow the
- Xcomponents of the structures to be edited individually, providing full
- Xaccess to the flexible controls of the program.
- X.PP
- XThe sequence of control of the program is:
- X.br
- X1) read the ``.starrc'' file.
- X2) process the command line: options are processed in order, later
- Xarguments may override earlier arguments, additional ``.starrc''
- Xformat files are read as they are encountered in \fB-e\fR options.
- XHowever, if the file specified in the \fB-e\fR option is in ``mapwin''
- Xformat, it is read later. After the command line is processed, if the
- X\fB-u\fR option is active, keyboard interaction is performed. Next,
- Xany ``mapwin'' format files are read. If there is more interaction
- Xavailable (e.g. as in starXaw), the details of the chart may now be
- Xcontrolled. If a ``mapwin'' file is to be written, it is written now.
- XThen the chart is drawn to specification. Finally, after the chart is
- Xdrawn, the program returns to the first interaction (i.e. returns to
- Xthe point after the command line has been processed).
- X.PP
- XOne more form of interaction is available on some systems: A mouse or
- Xother pointing device may be used to either select points on a map and
- Xthe coordinates of that point are displayed, or the databases may be
- Xsearched for objects near the selected point and the database entries
- Xfor the objects found are displayed.
- X.SH OUTPUT
- XThe present implementations draw two maps: a ``master'' map plus a
- X``thumbnail'' overview map with brighter limiting magnitude and a larger
- Xcoverage area. Their location and the limiting magnitude is specified
- Xby records in the device driver, allowing the chart layout be tuned on
- Xa per-device basis. The
- X.B -b
- Xflag selects a ``fullpage'' option, with a larger ``master'' map and
- Xno ``thumbnail''.
- X.PP
- XObjects are represented by glyphs defined by each display driver. Vector-only
- Xdevices rely on the parent module ``starimages.c'' to provide shape tables;
- Xother devices plot special characters (stardsp) or private symbols
- X(PostScript). The latter additionally provides distinctions between object
- Xsubclasses, e.g. planetary vs diffuse nebula.
- X.PP
- XSanson's sinusoidal projection is used to map coordinates by default.
- XThis projection preserves both area and linearity in Declination (y axis).
- XIt gives good conformality (angle correctness) near the equator, so it is
- Xuseful along the Ecliptic.
- XLines of RA converge at the poles (unlike cylindrical projections),
- Xthough Cassiopeia and the Dipper reproduce well.
- X.PP
- XAlternative projections currently include: stereographic, which
- Xpreserves circles and allows an entire hemisphere to be drawn;
- Xorthographic, which may also display an entire hemisphere, but with
- Xgreat distortion; gnomonic, in which great circles appear as
- Xlines, but distorts for large areas, and rectangular, which is a
- Xdirect mapping of longitude and latitude to the map. Gnomonic is
- Xuseful for meteor path plotting charts. Rectangular is useful for
- Xdisplaying the entire ecliptic.
- X
- X.SH EXAMPLES
- X.nf
- X# Sagittarius: a nice bunch of Messier objects.
- Xstarpost -c sgr -t Sagittarius >sag.PS
- X.sp
- X# Orion: the belt lies near 5h40m in RA, just below the CE.
- Xstardsp -r 5.32 -d -5 -s 12 -t "Trapezium (Orion)" -m 8 -l 5 | more
- X.sp
- X# nowhere in particular
- XstarX11 -r 20.15 -d 19.5 -s 12 -m 10 -l 2 -g 6 -t "demo title" -p
- Xgnomonic -f test.star binstar -y alternate.star -w ceres.bin binfull
- X-v 6 1.5 -x 0.5 5 -b -i -u -e ovverride
- X
- X.fi
- X.SH FILES
- XNote that the names may have been changed for your particular site.
- X.nf
- X.ta \w'boundaries.star 'u
- Xyale.star stellar information (mandatory)
- Xneb.star nebulae (optional)
- Xplanet.star planets (optional)
- Xboundaries.star constellation boundaries (optional)
- Xcnames.star constellation names (optional)
- Xpatterns.star constellation patterns (optional)
- Xindex.indx index file for additional star files (optional)
- Xcon.locs default mnemonic locations
- X.fi
- X.br
- X.sp
- XThese default paths can be easily changed in the Makefile.
- X.PP
- XAll data file coordinates are for epoch and equinox 2000.0.
- X.SH BUGS
- X.PP
- XIf <minutes> part of the parameters is greater than 59 it is silently
- Xtruncated to 59.
- X.SH SEE ALSO
- Xdataconv(1), sif_to_text(1), tosize(1), observe(1).
- X.SH AUTHORS/EDITORS
- XCraig Counterman
- X.br
- XAlan Paeth, University of Waterloo
- X.SH MAJOR CONTRIBUTORS
- XSteve Kennedy
- X.br
- XHolger Zessel and Markus Kempf.
- X.br
- XTom Horsley
- X.br
- XDave Van't Hof
- X.br
- XDave Van't Hof
- X.br
- XMichael Campanella
- X.br
- XRobert Tidd
- X.br
- XJoe Wang
- X.br
- XPetri Launiainen
- X.br
- XJyrki Yli-Nokari
- X.br
- XSjoerd Mullender
- X.br
- Xand
- X.br
- XDean Payne <deanp@hplsla.hp.com>
- X.br
- XDavid Smith <smith@hpldrs.hp.com>
- X.br
- XTim Pointing <tim@zorac.dciem.dnd.ca>
- X.br
- Xand others
- END_OF_FILE
- if test 13012 -ne `wc -c <'doc/starchart.1'`; then
- echo shar: \"'doc/starchart.1'\" unpacked with wrong size!
- fi
- # end of 'doc/starchart.1'
- fi
- if test -f 'starchart/starXawHelp.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'starchart/starXawHelp.c'\"
- else
- echo shar: Extracting \"'starchart/starXawHelp.c'\" \(13385 characters\)
- sed "s/^X//" >'starchart/starXawHelp.c' <<'END_OF_FILE'
- X/*
- X * Help for starXaw
- X *
- X * Copyright (c) 1990 by Craig Counterman. All rights reserved.
- X *
- X * This software may be redistributed freely, not sold.
- X * This copyright notice and disclaimer of warranty must remain
- X * unchanged.
- X *
- X * No representation is made about the suitability of this
- X * software for any purpose. It is provided "as is" without express or
- X * implied warranty, to the extent permitted by applicable law.
- X *
- X */
- X
- Xstatic char rcsid[]="$Header: starXawHelp.c,v 1.7 90/03/10 15:34:07 ccount Exp $";
- X
- X#include <stdio.h>
- X#include <math.h>
- X
- X#include "star3.h"
- X#include "starXaw.h"
- X
- X#ifndef SYSV
- X#include <strings.h>
- X#else
- X#include <string.h>
- X#endif
- X
- X#include <X11/cursorfont.h>
- X#include <X11/Intrinsic.h>
- X#include <X11/StringDefs.h>
- X#include <X11/Shell.h>
- X#ifdef X11R4
- X#include <X11/Xaw/Command.h>
- X#include <X11/Xaw/Form.h>
- X#include <X11/Xaw/Box.h>
- X#define ASCII_STRING
- X#define XAW_BC
- X#include <X11/Xaw/AsciiText.h>
- X#else
- X#include <X11/Command.h>
- X#include <X11/Form.h>
- X#include <X11/Box.h>
- X#include <X11/AsciiText.h>
- X#endif
- X
- X
- XWidget help_wid;
- X
- X/*
- X123456789 123456789 123456789 1234567.
- X2
- X3
- X4
- X5
- X6
- X7
- X8
- X9
- X0
- X1
- X2
- X3
- X4
- X5
- X6
- X7
- X8
- X9
- X0
- X1
- X2
- X3
- X4
- X5
- X6
- X7
- X823456789 123456789 123456789 1234567.
- X*/
- X
- Xstatic char *help_pages[] = {
- X" Welcome to StarXaw\n\
- X\n\
- XThis is the X11 Athena Widgets\n\
- Xinterface to Starchart, version 3.1.\n\
- X\n\
- XThis is the first help page. For more\n\
- Xinformation, press the Help button\n\
- Xbelow.\n\
- X\n\
- XThe Quit button exits the program.\n\
- X\n\
- XThe Controls buttons open a new window\n\
- Xfor changing the variables which\n\
- Xcontrol the appearance of the chart.\n\
- X\n\
- XDraw Chart draws the chart as\n\
- Xspecified by the options set above.\n\
- X\n\
- XExceptions: Save / Load File and\n\
- XAdditional Controls have options which\n\
- Xonly take effect when Draw Chart is\n\
- Xselected.\n\
- X\n\
- X\n\
- XPress the Help button for the next\n\
- Xhelp page. When you reach the last\n\
- Xpage, you will return to this page.",
- X
- X
- X"Page 2\n\
- X\n\
- XThe Output region is used to display\n\
- Xthe status of the program, and some\n\
- Xother output. Note that some errors\n\
- Xare written to the standard error\n\
- Xoutput, and do not appear in this\n\
- Xspace. \n\
- X\n\
- XThis Help space will also be used to\n\
- Xprovide details about the selected\n\
- Xcontrol.\n\
- X\n\
- X\n\
- X\n\
- X\n\
- X\n\
- X\n\
- X\n\
- X\n\
- X\n\
- X\n\
- X\n\
- X\n\
- X\n\
- XPress the Help button for the next\n\
- Xhelp page.",
- X
- X
- X"Page 3 The Controls\n\
- X\n\
- XThe buttons and what they control: \n\
- X\n\
- XChart - Center coordinates and scale\n\
- X of chart, and title.\n\
- XType - Chart type: currently either\n\
- X one large map or one large and\n\
- X one smaller map of a larger\n\
- X region (The thumbnail map).\n\
- XMagnitudes - Limiting magnitudes.\n\
- XLayers - Layer drawing order. Each\n\
- X map is drawn as several\n\
- X layers, which may be drawn in\n\
- X any order.\n\
- XData Files - The data files and their\n\
- X file formats.\n\
- XProjection Mode - The projection\n\
- X transformation used for the\n\
- X main map.\n\
- XMagnitude Labels - Labelling of stars\n\
- X with their magnitudes.\n\
- XGrid - Right Ascension and\n\
- X Declination grid lines.\n\
- X\n\
- XPress the Help button for the next\n\
- Xhelp page.",
- X
- X"Page 4 More Controls\n\
- X\n\
- XThe following controls allow further\n\
- Xcontrol, and some are specific to the\n\
- XX11 version of Starchart.\n\
- X\n\
- XAdditional Control - Allows for\n\
- X detailed editing of the\n\
- X structure which specifies\n\
- X each map in the chart\n\
- X (the ``Mapwin'' structure).\n\
- XX Parameters - Controls specific to\n\
- X the X11 version.\n\
- XSave / Load File - input and output of\n\
- X Mapwin format files, and\n\
- X output of the current settings\n\
- X into a ``Starrc'' format file.\n\
- X\n\
- XAdditional information about each\n\
- Xbutton will appear here when the\n\
- Xbutton is selected.\n\
- X\n\
- X\n\
- X\n\
- X\n\
- XPress the Help button for the next\n\
- Xhelp page.",
- X
- X"Page 5\n\
- X\n\
- XEach control window has a Dismiss\n\
- Xbutton and a Cancel button. Some\n\
- Xadditionally have an Apply button.\n\
- X\n\
- XIf there is an Apply button, it must\n\
- Xbe pressed for the settings to take\n\
- Xeffect.\n\
- X\n\
- XThe Dismiss button closes the window.\n\
- XIf there is an Apply button, some\n\
- Xsettings will not take effect.\n\
- X\n\
- XThe Cancel button cancels any changes\n\
- Xmade, and closes the window.\n\
- X\n\
- X\n\
- X\n\
- X\n\
- X\n\
- X\n\
- X\n\
- X\n\
- X\n\
- XPress the Help button to return to the\n\
- Xfirst help page."
- X};
- X#define Nhelp_pages 5
- X
- X#define HELPSIZE 30*40
- X/* Can display 27*(38+\n) characters in 6x13 font */
- Xchar help_buffer[HELPSIZE];
- X
- Xstatic int hpg_no = 0;
- X
- X
- Xvoid show_help()
- X{
- X Arg args[2];
- X
- X
- X XtSetArg(args[0], XtNlabel, help_buffer);
- X XtSetValues(help_wid, args, (Cardinal)1);
- X XtTextSetLastPos(help_wid, strlen(help_buffer));
- X}
- X
- Xvoid XHelp(widget,closure,callData)
- X Widget widget;
- X caddr_t closure; /* Widget */
- X caddr_t callData;
- X{
- X hpg_no++;
- X if (hpg_no == Nhelp_pages)
- X hpg_no = 0;
- X
- X strcpy(help_buffer, help_pages[hpg_no]);
- X show_help();
- X}
- X
- X
- Xint start_help()
- X{
- X strcpy(help_buffer, help_pages[hpg_no]);
- X return sizeof(help_buffer);
- X}
- X
- Xun_help()
- X{
- X strcpy(help_buffer, help_pages[hpg_no]);
- X show_help();
- X}
- X
- X
- X
- X/* Chart */
- Xstatic char chart_page[] =
- X " Chart\n\
- X\n\
- XHere, the coordinates of the center of\n\
- Xthe chart, the scale of the main map,\n\
- Xand the title of the chart are set.\n\
- X\n\
- XEither specify these values directly,\n\
- Xor read them for a given constellation\n\
- Xfrom the constellation data file.\n\
- X\n\
- XThe values for R.A. and Dec. are given\n\
- Xin hh.mm and dd.mm format respectively,\n\
- Xe.g. an R.A. of 18.30 means 18 hrs.,\n\
- X30 min.\n\
- X\n\
- XIn addition, the main map may be\n\
- Xdrawin flipped top to bottom (for use\n\
- Xwith inverting telescopes), if so\n\
- Xspecified by the ``Normal/Inverted''\n\
- Xbutton.";
- X
- Xchart_help()
- X{
- X strcpy(help_buffer, chart_page);
- X show_help();
- X}
- X
- X/* Type */
- Xstatic char type_page[] =
- X " Type\n\
- X\n\
- XCurrently, two standard chart types\n\
- Xare defined.\n\
- X\n\
- XIn the first, there is a large main\n\
- Xmap, a smaller thumbnail map showing\n\
- Xa larger area, and a legend.\n\
- X\n\
- XIn the second, there is only one large\n\
- Xmap.";
- X
- Xtype_help()
- X{
- X strcpy(help_buffer, type_page);
- X show_help();
- X}
- X
- X/* Magnitudes */
- Xstatic char magnitudes_page[] =
- X " Magnitudes\n\
- X\n\
- XThere are three limiting magnitudes.\n\
- X\n\
- XThe first controls the display of the\n\
- Xobject name, e.g. Betelgeuse.\n\
- X\n\
- XThe second controls the display of the\n\
- XBayer or Flamsteed label for a star,\n\
- Xe.g. 28, or RY, or <alpha>.\n\
- X\n\
- XThe third controls the display of the\n\
- Xsymbol for the object.";
- X
- Xmagnitudes_help()
- X{
- X strcpy(help_buffer, magnitudes_page);
- X show_help();
- X}
- X
- X/* Layers */
- Xstatic char layers_page[] =
- X " Layers\n\
- X\n\
- XEach map is drawn as several layers.\n\
- XThis controls which layers are drawn,\n\
- Xand the order in which they are drawn.\n\
- X\n\
- XThe outline (including tick marks when\n\
- Xpossible), R.A. and Declination grids\n\
- X(if specified), ecliptic,\n\
- Xconstellation boundaries,\n\
- Xconstellation patterns, and\n\
- Xconstellation names, are all separate\n\
- Xlayers. The legend is also considered\n\
- Xas a separate layer.\n\
- X\n\
- XIn addition, the data from the object\n\
- Xfiles may be drawn either as the\n\
- Xobject is read (``All Files''), or as\n\
- Xseparate layers for the: symbol, name,\n\
- Xmagnitude label, vectors, and areas\n\
- Xspecified in the files.\n\
- X\n\
- XPressing a button causes the layer for\n\
- Xthat position to cycle through the\n\
- Xpossiblilities.";
- X
- Xlayers_help()
- X{
- X strcpy(help_buffer, layers_page);
- X show_help();
- X}
- X
- X/* Map_Files */
- Xstatic char dfiles_page[] =
- X " Data Files\n\
- X\n\
- XThe data files, and the order in which\n\
- Xthey are read, are set in this dialog.\n\
- X\n\
- XEach file has a name and a type. The\n\
- Xtype specifies the format of the file.\n\
- XPressing the type button cycles\n\
- Xthrough the possiblilties.";
- X
- Xdfiles_help()
- X{
- X strcpy(help_buffer, dfiles_page);
- X show_help();
- X}
- X
- X/* Pmode */
- Xstatic char pmode_page[] =
- X " Projection Mode\n\
- X\n\
- XThere are currently five projection\n\
- Xtransformations available. Press the\n\
- Xbutton to cycle through the\n\
- Xpossiblilties.";
- X
- Xpmode_help()
- X{
- X strcpy(help_buffer, pmode_page);
- X show_help();
- X}
- X
- X/* Maglabels */
- Xstatic char maglabels_page[] =
- X " Magnitude Labels\n\
- X\n\
- XIt is often useful to have stars in a\n\
- Xgiven range of magnitudes labeled with\n\
- Xtheir magnitudes, e.g. in an asteroid\n\
- Xfinding chart, or a variable star\n\
- Xchart.\n\
- X\n\
- XSet bright and faint limits to the\n\
- Xrange, and specify ``Label stars with\n\
- Xtheir magnitudes''.";
- X
- Xmaglabels_help()
- X{
- X strcpy(help_buffer, maglabels_page);
- X show_help();
- X}
- X
- X/* Grid */
- Xstatic char grid_page[] =
- X " Grid\n\
- X\n\
- XA coordinate lines in right\n\
- Xascension and declination may be\n\
- Xdrawn, with a specified spacing and\n\
- Xstarting coordinates.\n\
- X\n\
- XThe values for R.A. and Dec. are given\n\
- Xin hh.mm and dd.mm format\n\
- Xrespectively, e.g. an R.A. Step of\n\
- X0.30 means draw the R.A. lines with a\n\
- Xseparation of 30 min.\n\
- X\n\
- XThe ``Show R.A. grid'' and ``Show Dec.\n\
- Xgrid'' buttons control the display of\n\
- Xthe lines for R.A. and Dec., respectively.";
- X
- Xgrid_help()
- X{
- X strcpy(help_buffer, grid_page);
- X show_help();
- X}
- X
- X/* Emapwins */
- Xstatic char emapwins_page[] =
- X " Additional Control\n\
- X\n\
- XEach map in the chart is controlled by\n\
- Xa structure.\n\
- X\n\
- XThe other buttons control default\n\
- Xsettings for values in these\n\
- Xstructures.\n\
- X\n\
- XBy choosing ``Edit'', you will be\n\
- Xgiven the chance to control the\n\
- Xdetailed appearance of each map, and\n\
- Xadd additional maps to the chart.";
- X
- Xemapwins_help()
- X{
- X strcpy(help_buffer, emapwins_page);
- X show_help();
- X}
- X
- X/* Xparms */
- Xstatic char xparms_page[] =
- X " X Parameters\n\
- X\n\
- XThere are several controls specific to\n\
- XX11, and starXaw.\n\
- X\n\
- XYou may use flexible window dimensions\n\
- Xto set the window size when the chart\n\
- Xwindow is opened, or you may use fixed\n\
- Xwindow dimensions specified in the\n\
- Xwidth and height fields, or you may\n\
- Xuse dimensions which will duplicate\n\
- Xthe appearance of the page produced by\n\
- Xthe starpost program.\n\
- X\n\
- XYou may use an X backing store if your\n\
- XX display has sufficient memory. This\n\
- Xallows the window to be repainted if\n\
- Xit is overwritten.\n\
- X\n\
- XYou may specify that color should not\n\
- Xbe used, even if it is available.";
- X
- Xxparms_help()
- X{
- X strcpy(help_buffer, xparms_page);
- X show_help();
- X}
- X
- X/* Svld */
- Xstatic char svld_page[] =
- X " Save / Load File\n\
- X\n\
- XA ``mapwin'' file contains the map\n\
- Xdescription structures for the chart\n\
- X(see ``Additional Control'' for more\n\
- Xinfo). These files may be read,\n\
- Xor written for future use, including\n\
- Xuse by other starchart programs.\n\
- X\n\
- XA ``.starrc'' file contains the global\n\
- Xspecifications for the chart set by\n\
- Xthe other buttons.";
- X
- Xsvld_help()
- X{
- X strcpy(help_buffer, svld_page);
- X show_help();
- X}
- X
- X
- X/* D_mapwininput */
- Xstatic char mwinin_page[] =
- X " Edit mapwindow structure\n\
- X\n\
- XNote that if you change the number of\n\
- Xstructures, the first structure is\n\
- Xused for the defaults in the new\n\
- Xstructure.\n\
- X\n\
- XNote also that since the Legend is\n\
- Xdrawn as a layer for a window, you\n\
- Xmust edit the Layers for the\n\
- Xstructures to ensure that the correct\n\
- Xlegend, and only the correct legend,\n\
- Xis drawn.";
- X
- Xmwinin_help()
- X{
- X strcpy(help_buffer, mwinin_page);
- X show_help();
- X}
- X
- X/* edit_structs */
- Xstatic char estru_page[] =
- X " Edit Structure\n\
- X\n\
- XNote that the magnitude limits are set\n\
- Xindividually for each data file.\n\
- X\n\
- XPress the Next button (if any) to move\n\
- Xto the next structure, press the Prev\n\
- Xbutton (if any) to move to the\n\
- Xprevious structure.";
- X
- Xestru_help()
- X{
- X strcpy(help_buffer, estru_page);
- X show_help();
- X}
- X
- X/* edit_layers */
- Xstatic char elay_page[] =
- X " Edit Layers\n\
- X\n\
- XEach map is drawn as several layers.\n\
- XThis controls which layers are drawn,\n\
- Xand the order in which they are drawn.\n\
- X\n\
- XThe outline (including tick marks when\n\
- Xpossible), R.A. and Declination grids\n\
- X(if specified), ecliptic,\n\
- Xconstellation boundaries,\n\
- Xconstellation patterns, and\n\
- Xconstellation names, are all separate\n\
- Xlayers. The legend is also considered\n\
- Xas a separate layer.\n\
- X\n\
- XIn addition, the data from the object\n\
- Xfiles may be drawn either as the\n\
- Xobject is read (``All Files''), or as\n\
- Xseparate layers for the: symbol, name,\n\
- Xmagnitude label, vectors, and areas\n\
- Xspecified in the files.\n\
- X\n\
- XPressing a button causes the layer for\n\
- Xthat position to cycle through the\n\
- Xpossiblilities.";
- X
- Xelay_help()
- X{
- X strcpy(help_buffer, elay_page);
- X show_help();
- X}
- X
- X/* edit_files */
- Xstatic char efiles_page[] =
- X " Edit Files\n\
- X\n\
- XPress the Next button (if any) to move\n\
- Xto the next file, press the Prev\n\
- Xbutton (if any) to move to the\n\
- Xprevious file.";
- X
- Xefiles_help()
- X{
- X strcpy(help_buffer, efiles_page);
- X show_help();
- X}
- X
- X
- X
- X
- X
- X
- X/* Pointer input */
- Xstatic char pointer_page[] =
- X "Press the left mouse button\n\
- Xor equivalent to\n\
- Xdisplay the coordinates at the\n\
- Xpointer location.\n\
- X\n\
- XPress the right mouse button\n\
- Xor equivalent to\n\
- Xidentify objects near the\n\
- Xpointer location.\n\
- X\n\
- XResults appear in the\n\
- XOutput window and on\n\
- Xthe standard error output.\n\
- X\n";
- X
- X
- Xpointer_help()
- X{
- X strcpy(help_buffer, pointer_page);
- X show_help();
- X}
- X
- END_OF_FILE
- if test 13385 -ne `wc -c <'starchart/starXawHelp.c'`; then
- echo shar: \"'starchart/starXawHelp.c'\" unpacked with wrong size!
- fi
- # end of 'starchart/starXawHelp.c'
- fi
- if test -f 'starchart/starlaser.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'starchart/starlaser.c'\"
- else
- echo shar: Extracting \"'starchart/starlaser.c'\" \(12103 characters\)
- sed "s/^X//" >'starchart/starlaser.c' <<'END_OF_FILE'
- X/*
- X** Hewlett-Packard Laserjet (2686a) laser printer driver
- X** for starchart.
- X** Low-level routines (starting with 'HPLJET') written and copyrighted by
- X** Jyrki Yli-Nokari (jty@intrin.FI),
- X** Petri Launiainen (pl@intrin.FI),
- X** Intrinsic, Ltd., FINLAND.
- X**
- X** You may use this code as you wish if credit is given and this message
- X** is retained.
- X*/
- X
- X/*
- X ! patched December, 1987 by Alan Paeth (awpaeth@watcgl),
- X !
- X ! [1] "bigmaster" chart layout now added
- X ! [2] different XOFF and YOFF values adopted for better margins
- X !
- X */
- X/*
- X ! Modified for 3.0 January 1989 by Craig Counterman
- X ! (email: ccount@royal.mit.edu)
- X */
- X
- Xstatic char rcsid[]="$Header: starlaser.c,v 2.4 90/03/10 15:34:47 ccount Exp $";
- X
- X/*
- X** This code is intended for ALL Laserjet family printers.
- X** Because the base version has only 59 k raster buffer, the
- X** stars are not completely round, but not too ugly either.
- X*/
- X
- X#include <stdio.h>
- X#include <math.h>
- X
- X#include "star3.h"
- X
- Xchar *calloc ();
- X
- X#define SCALEU 29L /* graphics scaling */
- X#define SCALEL 40L
- X
- X#define TSCALEU 69L /* text mode scaling */
- X#define TSCALEL 10L
- X
- X#define XOFF 520 /* text centering offset (in decipoints) */
- X#define YOFF (-50) /* previously, XOFF=1060; YOFF=(-80) */
- X
- X#define HPLJETXMAX 743 /* Number of pixels in X-axis */
- X#define HPLJETYMAX 557 /* Number of pixels in Y-axis */
- X
- X
- X/* Externs */
- Xextern int g_argc;
- Xextern char **g_argv;
- X
- Xextern char *title; /* Title of page */
- X
- Xextern mapwindow *mapwin[MAXWINDOWS];
- Xextern int numwins;
- X
- X
- X
- Xextern int cur_function;
- Xextern int cur_map_type;
- Xextern int cur_map_tag;
- Xextern char *cur_tag_field;
- X
- X/* Scale multiplier, minimum,
- X mangitude change, maximum, for thumbnail,*/
- X#define THSMUL 1.2
- X#define THSMIN 12.0
- X#define THMADJ 2.5
- X#define THMMAX 5.0
- X
- X
- X/* Exports */
- X
- X/* The variables in the first few lines MUST be set by driver */
- Xmapwindow fullpage = {
- X 880, 700, 20, 65, /* width, height, x and y offsets */
- X 8.0, 2.0, 2.05, /* default limiting mags for glyph, name, label */
- X
- X/* The next several variables SHOULD be set by the driver,
- X but are only used by the driver */
- X FULLPAGEMAP, /* Type of map: THUMBNAIL may have
- X some restrictions */
- X 0, /* May be used by driver for whatever */
- X "String", /* May be used by driver for whatever */
- X
- X/* The next several variables may be set by the driver, but the main routines
- X may reset them (and the driver routines may then override that) */
- X SANSONS, /* Projection mode */
- X FALSE, FALSE, /* Draw grids */
- X 0.5, 5.0, /* grid step size */
- X 0.0, 0.0, /* grid origin */
- X
- X FALSE, /* Invert (flip north south) */
- X};
- X
- X/* The variables in the first few lines MUST be set by driver */
- Xmapwindow mainmap = {
- X 880, 500, 20, 265, /* width, height, x and y offsets */
- X 8.0, 2.0, 2.05, /* default limiting mags for glyph, name, label */
- X
- X/* The next several variables SHOULD be set by the driver,
- X but are only used by the driver */
- X MAINMAP, /* Type of map: THUMBNAIL may have
- X some restrictions */
- X 0, /* May be used by driver for whatever */
- X "String", /* May be used by driver for whatever */
- X
- X/* The next several variables may be set by the driver, but the main routines
- X may reset them (and the driver routines may then override that) */
- X SANSONS, /* Projection mode */
- X FALSE, FALSE, /* Draw grids */
- X 0.5, 5.0, /* grid step size */
- X 0.0, 0.0, /* grid origin */
- X
- X FALSE, /* Invert (flip north south) */
- X};
- X
- X
- X/* The variables in the first few lines MUST be set by driver */
- Xmapwindow thumbmap = {
- X 480, 195, 420, 35, /* width, height, x and y offsets */
- X 5.5+THMADJ, 1.0+THMADJ, 2.05+THMADJ,
- X /* default limiting mags for glyph, name, label */
- X
- X/* The next several variables SHOULD be set by the driver,
- X but are only used by the driver */
- X THUMBNAIL, /* Type of map: THUMBNAIL may have
- X some restrictions */
- X 0, /* May be used by driver for whatever */
- X "String", /* May be used by driver for whatever */
- X
- X/* The next several variables may be set by the driver, but the main routines
- X may reset them (and the driver routines may then override that) */
- X SANSONS, /* Projection mode */
- X FALSE, FALSE, /* Draw grids */
- X 0.5, 5.0, /* grid step size */
- X 0.0, 0.0, /* grid origin */
- X
- X FALSE, /* Invert (flip north south) */
- X};
- X
- X/* h & v tick text controls */
- Xint htick_lim = 2;
- Xint htext_lim = 80;
- Xint htext_xoff = 2;
- Xint htext_yoff = 17;
- Xint vtick_lim = 2;
- Xint vtext_lim = 20;
- Xint vtext_xoff = 24;
- Xint vtext_yoff = 0;
- X
- X/* externs for labels */
- Xint x_nameoffset = 10, y_nameoffset = 0;
- Xint x_lbloffset = 0, y_lbloffset = 10;
- Xint x_magoffset = 7, y_magoffset = -15;
- X
- X/* externs for legend: variables of positioning are here */
- Xint l_til=220;
- Xint l_stil=185;
- X
- Xint l_lmar1=40;
- Xint l_lmar2=65;
- Xint l_ltext=95;
- Xint l_rmar1=205;
- Xint l_rmar2=230;
- Xint l_rtext=260;
- X
- Xint l_line1=150;
- Xint l_line2=125;
- Xint l_line3=100;
- Xint l_line4=75;
- Xint l_line5=50;
- Xint l_line6=25;
- X
- X/* Point sizes for font calls */
- Xint titlesize=16;
- Xint subtlsize=12;
- Xint namesize=10;
- Xint lblsize=8;
- Xint magsize=8;
- X
- X/* Fonts for font calls */
- Xint namefnt=TIMESROMAN;
- Xint lblfnt=HELV;
- Xint magfnt=COURIER;
- Xint titlefnt=TIMESBOLD;
- Xint subtlfnt=TIMESROMAN;
- X
- X/* Scale multiplier, minimum,
- X mangitude change, maximum, for thumbnail,*/
- Xdouble th_smul=THSMUL;
- Xdouble th_smin=THSMIN;
- Xdouble th_madj=THMADJ;
- Xdouble th_mmax=THMMAX;
- X
- X#define MAX(a,b) ((a)>(b)?(a):(b))
- X#define MIN(a,b) ((a)<(b)?(a):(b))
- X
- X/* Device control argument */
- XD_control_arg(s)
- Xchar *s;
- X{
- X int i = 0;
- X int c;
- X
- X while (c = s[i++]) switch (c) {
- X default:
- X break;
- X }
- X}
- X
- X/* Open the device */
- XD_open()
- X{
- X HPLJETorient ();
- X r_makeraster (HPLJETXMAX, HPLJETYMAX);
- X
- X return TRUE ; /* open successful */
- X}
- X
- X/* Close the device */
- XD_close()
- X{
- X HPLJETdump ();
- X}
- X
- X
- X/* Move to (x, y) */
- XD_move(x, y)
- X int x, y;
- X{
- X x = (x*SCALEU)/SCALEL; /* adjust to bitmap size */
- X y = (y*SCALEU)/SCALEL;
- X
- X HPLJETmove (x, y);
- X}
- X
- X/* Draw a line of style line_style from the current point to (x, y) */
- X/* Note, this replaces vecdraw vecdrawdot and vecdrawhyph */
- XD_draw(x, y, line_style)
- X int x, y;
- X int line_style; /* SOLID, DOTTED, DASHED, etc. */
- X{
- X x = (x*SCALEU)/SCALEL; /* adjust to bitmap size */
- X y = (y*SCALEU)/SCALEL;
- X
- X/* all styles are the same */
- X HPLJETdraw (x, y);
- X}
- X/* This routine is encouraged to look at the extern cur_funtion
- X and change the line style drawn as desired */
- X
- X
- X/* Move to (x1, y1) then draw a line of style line_style to (x2, y2) */
- XD_movedraw(x1, y1, x2, y2, line_style)
- X int x1, y1, x2, y2;
- X int line_style; /* SOLID, DOTTED, DASHED, etc. */
- X{
- X/* all styles are the same */
- X x1 = (x1*SCALEU)/SCALEL; /* adjust to bitmap size */
- X y1 = (y1*SCALEU)/SCALEL;
- X
- X x2 = (x2*SCALEU)/SCALEL; /* adjust to bitmap size */
- X y2 = (y2*SCALEU)/SCALEL;
- X
- X HPLJETmove (x1, y1);
- X HPLJETdraw (x2, y2);
- X}
- X
- X
- X/* Set the color to be used for lines and text */
- X/* color_str is a 2 char (+ '\0') string
- X containing a specification for a color,
- X e.g. "G2" for the color of a star of spectral class G2, or "r7" for
- X red, level seven. The interpretation of the color string is left to
- X the device driver */
- XD_color(color_str)
- X char *color_str;
- X{
- X switch (color_str[0]) {
- X case 'O':
- X break;
- X case 'B':
- X break;
- X case 'A':
- X break;
- X case 'F':
- X break;
- X case 'G':
- X break;
- X case 'K':
- X break;
- X case 'M':
- X break;
- X case 'R':
- X case 'N':
- X case 'S':
- X break;
- X case ' ':
- X default:
- X break;
- X }
- X}
- X
- X/* Set the font and font size to be used for text. */
- X/* Note order of args */
- XD_fontsize(fsize, font)
- X int fsize; /* Size of font */
- X int font; /* e.g. TIMES, HELV, TIMES+ITALIC */
- X{
- X}
- X/* This routine is encouraged to look at the extern cur_funtion
- X and change the font used as desired */
- X
- X/*
- X** Text handling is a pain because of separate text/graphics mode
- X** and separated axises
- X*/
- X
- X/* Display text string str at x,y, in current font and font size.
- X if star_lbl is TRUE, string is a star label, use
- X greek characters (if possible) */
- XD_text(x, y, str, star_lbl)
- X int x, y;
- X char *str;
- X int star_lbl;
- X{
- X y = 767 - y; /* change y axis on text output */
- X y -= 5; /* center character strings */
- X x = (x*TSCALEU)/TSCALEL + XOFF; /* adjust to bitmap size */
- X y = (y*TSCALEU)/TSCALEL + YOFF;
- X
- X if (star_lbl) {
- X /* remove leading spaces */
- X while (*str == ' ') str++;
- X /* can't display greek characters */
- X }
- X
- X printf ("\033&a%dh%dV%s", x, y, str);
- X}
- X
- X
- X/* Return input coordinate in device coords where there are pointing devices */
- XD_inxy(x, y)
- X int *x, *y;
- X{
- X}
- X
- X/* Put non-displayed comment in output. Allowed in postscript, but
- X few other drivers will be able to support this. */
- XD_comment(str)
- X char *str;
- X{
- X/*
- X fprintf(stderr, "%s\n", str);
- X*/
- X}
- X
- X
- X/**
- XHigher level functions
- X**/
- X
- Xdrawlen(x, y, dx, dy, len)
- X int x, y, dx, dy, len;
- X{
- X x = (x*SCALEU)/SCALEL; /* adjust to bitmap size */
- X y = (y*SCALEU)/SCALEL;
- X
- X HPLJETmove (x + dx, y + dy);
- X HPLJETdraw (x + dx + len - 1, y+dy);
- X}
- X
- X
- X/*
- X** Low Level Laserjet Plotting Routines
- X*/
- X
- XHPLJETorient () /* switch to portrait text orientation mode */
- X{
- X printf ("\033E"); /* Restore defaults */
- X printf ("\033&l1O");
- X}
- X
- XHPLJETmove (x, y) /* move to (x,y) */
- X int x, y;
- X{
- X r_move (x, y);
- X}
- X
- XHPLJETdraw (x, y) /* draw to (x,y) */
- X int x, y;
- X{
- X r_draw (x, y);
- X}
- X
- X#define IN(i,size) ((unsigned)i < size)
- Xtypedef char ritem;
- Xtypedef ritem *raster[];
- X
- Xstatic raster *r_p; /* global pointer to raster */
- Xstatic int r_currx, r_curry; /* the current coordinates */
- Xstatic int r_xsize, r_ysize; /* the size of the raster */
- X
- X/*
- X** set pixel (x,y) to value val (zero or nonzero).
- X*/
- Xvoid r_setpixel(x, y, val)
- X int x, y;
- X ritem val;
- X{
- X if (IN(x, r_xsize) && IN(y, r_ysize)) {
- X *(((*r_p)[y]) + x) = val;
- X }
- X}
- X
- X/*
- X** get pixel (x,y) value (0 or 1)
- X*/
- Xint r_getpixel(x, y)
- X int x, y;
- X{
- X if (IN(x, r_xsize) && IN(y, r_ysize)) {
- X return *(((*r_p)[y]) + x);
- X }
- X else
- X return (0);
- X}
- X
- X/*
- X** allocate the raster
- X*/
- Xr_makeraster(x, y)
- X unsigned x, y;
- X{
- X register int j;
- X
- X /* allocate row pointers */
- X if ((r_p = (raster *)calloc(y, sizeof(ritem *))) == NULL) {
- X perror("Raster buffer allocation failure");
- X exit(1);
- X }
- X for (j = 0; j < y; j++) {
- X if (((*r_p)[j] = (ritem *)calloc(x, sizeof(ritem))) == NULL) {
- X perror("Raster buffer allocation failure");
- X exit(1);
- X }
- X }
- X r_xsize = x; r_ysize = y;
- X r_currx = r_curry = 0;
- X}
- X
- X/*
- X** plot a line from (x0,y0) to (x1,y1)
- X*/
- Xr_plot(x0, y0, x1, y1)
- X int x0, y0, x1, y1;
- X{
- X int e, hx, hy, dx, dy, i;
- X /*
- X ** We use Bresenham's alorithm for plotting
- X ** (IBM system journal 4(1):25-30, 1965)
- X */
- X hx = abs(x1 - x0);
- X hy = abs(y1 - y0);
- X dx = (x1 > x0) ? 1 : -1;
- X dy = (y1 > y0) ? 1 : -1;
- X
- X if (hx > hy) {
- X /*
- X ** loop over x-axis
- X */
- X e = hy + hy - hx;
- X for (i = 0; i <= hx; i++) {
- X r_setpixel(x0, y0, 1);
- X if (e > 0) {
- X y0 += dy;
- X e += hy + hy - hx - hx;
- X } else {
- X e += hy + hy;
- X }
- X x0 += dx;
- X }
- X } else {
- X /*
- X ** loop over y-axis
- X */
- X e = hx + hx - hy;
- X for (i = 0; i <= hy; i++) {
- X r_setpixel(x0, y0, 1);
- X if (e > 0) {
- X x0 += dx;
- X e += hx + hx - hy - hy;
- X } else {
- X e += hx + hx;
- X }
- X y0 += dy;
- X }
- X }
- X}
- X
- X/*
- X** move to (x,y)
- X*/
- Xr_move(x, y)
- X int x, y;
- X{
- X r_currx = x;
- X r_curry = y;
- X}
- X
- X/*
- X** draw to (x,y)
- X** (move pen down)
- X*/
- Xr_draw(x, y)
- X int x, y;
- X{
- X r_plot(r_currx, r_curry, x, y);
- X r_currx = x;
- X r_curry = y;
- X}
- X
- X/*
- X** free the allocated raster
- X*/
- Xr_freeraster()
- X{
- X int y;
- X
- X for (y = 0; y < r_ysize; y++) {
- X free((char *)(*r_p)[y]);
- X }
- X free((char *)r_p);
- X}
- X
- XHPLJETdump ()
- X{
- X int x, y, i;
- X unsigned v;
- X
- X printf("\033*t75R\033&a0r\033&a135C\033&a-2R\033*r1A");
- X for (x = r_xsize-1; x >= 0; x--) {
- X printf("\033*b%dW", r_ysize/8);
- X for (y = r_ysize-8; y >= 0; y -= 8) {
- X v = 0;
- X for (i = 7; i >= 0; i--) {
- X v = (v << 1) | r_getpixel(x, y + i);
- X }
- X putc((char) v, stdout);
- X }
- X }
- X r_freeraster();
- X printf("\033*rB\033&l0O");
- X /* Change of orientation seems to produce form feed */
- X}
- X
- END_OF_FILE
- if test 12103 -ne `wc -c <'starchart/starlaser.c'`; then
- echo shar: \"'starchart/starlaser.c'\" unpacked with wrong size!
- fi
- # end of 'starchart/starlaser.c'
- fi
- echo shar: End of archive 8 \(of 32\).
- cp /dev/null ark8isdone
- MISSING=""
- 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
- if test ! -f ark${I}isdone ; then
- MISSING="${MISSING} ${I}"
- fi
- done
- if test "${MISSING}" = "" ; then
- echo You have unpacked all 32 archives.
- rm -f ark[1-9]isdone ark[1-9][0-9]isdone
- else
- echo You still need to unpack the following archives:
- echo " " ${MISSING}
- fi
- ## End of shell archive.
- exit 0
-
-
-