[comp.sources.misc] v11i032: starchart 3.2 Part 04/32

ccount@ATHENA.MIT.EDU (03/16/90)

Posting-number: Volume 11, Issue 32
Submitted-by: ccount@ATHENA.MIT.EDU
Archive-name: starchart/part04

#! /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 4 (of 32)."
# Contents:  observe/README observe/astlib.c observe/outaltaz.c
#   observe/outeph.c observe/riseset.c starchart/parse_input.c
#   starchart/parse_input.h starchart/star3.h
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'observe/README' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'observe/README'\"
else
echo shar: Extracting \"'observe/README'\" \(5694 characters\)
sed "s/^X//" >'observe/README' <<'END_OF_FILE'
X1)
Xdescrip.mms is for VMS; Observe.MSC  is for Microsoft  C on the IBMPC;
XAstring.h is  for  use  on  the  Atari  ST where   it should  be named
X'strings.h', since this header is apparently not provided with MWC.
X
X2)
XYou may need to change things in main.c, especially the time functions
Xand default location.
X
X3)
XThe following awk scripts may be useful.  They are for use in editing
Xthe .sif files produced when "observe" is used for a range of dates.
XUse dataconv to produce a 'lineread' or 'binfull' file from the
Xresulting editted .sif file.
X
XIf you don't have and can't get awk, you can edit the program to
Xproduce the output you usually want.
X
Xvelim removes the labels from vector commands,
Xe.g. 
Xawk -f velim.awk jan.sif > jan.sif2
Xdataconv -i jan.sif2 sif -o jan.binfull binfull
X
XTo eliminate all the symbols from the file, use 
Xawk '($4 ~ /V./) {print $0}' FS=";" OFS=";" jan.sif > jan.sif2
Xdataconv -i jan.sif2 sif -o jan.binfull binfull
X
Xrange.awk removes all but the first and last labels for each planet,
Xand all but every Nth symbol.  M must equal the number of days in the
Xrange of dates.
Xe.g.
Xawk -f range.awk N=7 M=31 jan.sif > jan.sif2
Xdataconv -i jan.sif2 sif -o jan.binfull binfull
X
X
Xaltaz.awk selects fields from the .altaz file.  Fields are printed in
Xthe order azi alt, for obect NAME at time TIME, where TIME is
X"sunset", "evetwil", morntwil", or "sunrise".
Xe.g.
Xawk -f altaz.awk TIME="evetwil" NAME="Austin" aus.altaz > aus.data
X
Xtimetable.awk selects fields from an .eph file for object NAME.  The
Xfields may be specified as TIME ("rise", "trans", "set" ) or FIELD
Xnumber, e.g.
X
Xawk -f timetable.awk NAME="Austin"  TIME="set" aus.eph > aus.set_times
Xawk -f timetable.awk NAME="Austin"  FIELD=9 aus.eph > aus.mag
X
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 DISCLAIMER OF WARRANTY
X ----------------------
X The author  disclaims all warranties  with regard to  this software to
X the   extent  permitted  by applicable   law,  including all   implied
X warranties  of merchantability  and  fitness. In  no event shall   the
X author be liable for any special, indirect or consequential damages or
X any  damages whatsoever resulting from  loss of use, data or  profits,
X whether in an action of contract, negligence or other tortious action,
X arising  out of  or in connection with the  use or performance of this
X software.
X
X#! /bin/sh
X# This is a shell archive.  Remove anything before this line, then unpack
X# it by saving it into a file and typing "sh file".  To overwrite existing
X# files, type "sh file -c".  You can also feed this as standard input via
X# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
X# will see the following message at the end:
X#		"End of shell archive."
X# Contents:  altaz.awk range.awk timetable.awk velim.awk
XPATH=/bin:/usr/bin:/usr/ucb ; export PATH
Xif test -f 'altaz.awk' -a "${1}" != "-c" ; then 
X  echo shar: Will not clobber existing file \"'altaz.awk'\"
Xelse
Xecho shar: Extracting \"'altaz.awk'\" \(214 characters\)
Xsed "s/^X//" >'altaz.awk' <<'END_OF_FILE'
XXNR == 1 {if (TIME == "sunset")
XX		var = 2
XX	else if (TIME == "evetwil")
XX		var = 4;
XX	else if (TIME == "morntwil")
XX		var = 6;
XX	else if (TIME == "sunrise")
XX		var = 8;
XX	else
XX		var = 4
XX}
XX$1 == NAME {print $(var+1), $var}
XEND_OF_FILE
Xif test 214 -ne `wc -c <'altaz.awk'`; then
X    echo shar: \"'altaz.awk'\" unpacked with wrong size!
Xfi
X# end of 'altaz.awk'
Xfi
Xif test -f 'range.awk' -a "${1}" != "-c" ; then 
X  echo shar: Will not clobber existing file \"'range.awk'\"
Xelse
Xecho shar: Extracting \"'range.awk'\" \(414 characters\)
Xsed "s/^X//" >'range.awk' <<'END_OF_FILE'
XXBEGIN {FS = OFS = ";";
XX	i = 0}
XX# eliminate labels from vectors
XX$4 ~ /V./ {$8 = ""}
XX# eliminate labels except from first and last
XX# NPS = n planet symbol, number of planet lines for this planet 
XX{NPS = 1+(NR-1)/2 - M*i}
XX#{print NPS, (NPS % N)}
XX(($4 ~ /P./) && ((NPS != 1) && (NPS != M))) {$8 = ""}
XX
XX(($4 ~ /V./) || (($4 ~ /P./) && ((NPS == 1) || (NPS == M) || ((NPS % N) == 1)))) {print $0}
XX
XX(NPS == M) {i = i + 1}
XEND_OF_FILE
Xif test 414 -ne `wc -c <'range.awk'`; then
X    echo shar: \"'range.awk'\" unpacked with wrong size!
Xfi
X# end of 'range.awk'
Xfi
Xif test -f 'timetable.awk' -a "${1}" != "-c" ; then 
X  echo shar: Will not clobber existing file \"'timetable.awk'\"
Xelse
Xecho shar: Extracting \"'timetable.awk'\" \(324 characters\)
Xsed "s/^X//" >'timetable.awk' <<'END_OF_FILE'
XXfunction hrtodec(t) {
XX	split(t, tsplit, ":"); return tsplit[1] + (tsplit[2]/60.0)
XX}
XXBEGIN {i = 0}
XXNR == 1  {if (TIME == "rise")
XX		field = 6
XX	else if (TIME == "trans")
XX		field = 7
XX	else if (TIME == "set")
XX		field = 8
XX	else if (FIELD != "")
XX		field = FIELD
XX	else
XX		field = 7
XX}
XX$1 == NAME {i = i + 1; print i, hrtodec($field)}
XEND_OF_FILE
Xif test 324 -ne `wc -c <'timetable.awk'`; then
X    echo shar: \"'timetable.awk'\" unpacked with wrong size!
Xfi
X# end of 'timetable.awk'
Xfi
Xif test -f 'velim.awk' -a "${1}" != "-c" ; then 
X  echo shar: Will not clobber existing file \"'velim.awk'\"
Xelse
Xecho shar: Extracting \"'velim.awk'\" \(54 characters\)
Xsed "s/^X//" >'velim.awk' <<'END_OF_FILE'
XXBEGIN {FS = OFS = ";"}
XX$4 ~ /V./ {$8 = ""}
XX{print $0}
XEND_OF_FILE
Xif test 54 -ne `wc -c <'velim.awk'`; then
X    echo shar: \"'velim.awk'\" unpacked with wrong size!
Xfi
X# end of 'velim.awk'
Xfi
Xecho shar: End of shell archive.
Xexit 0
END_OF_FILE
if test 5694 -ne `wc -c <'observe/README'`; then
    echo shar: \"'observe/README'\" unpacked with wrong size!
fi
# end of 'observe/README'
fi
if test -f 'observe/astlib.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'observe/astlib.c'\"
else
echo shar: Extracting \"'observe/astlib.c'\" \(5704 characters\)
sed "s/^X//" >'observe/astlib.c' <<'END_OF_FILE'
X/*
X * astlib.c
X * misc functions, including precession
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
X
X#ifndef  lint
Xstatic char rcsid[] =
X  "$Header: astlib.c,v 1.7 90/02/23 00:16:22 ccount Exp $";
X#endif
X
X
X#include <math.h>
X#include "degree.h"
X
X/* Rigorous precession */
X/* From Astronomical Ephemeris 1989, p. B18 */
X/*
Xfrom t_0 to t:
X
XA = 
Xsin(alpha - z_A) cos(delta) = sin(alpha_0 + zeta_A) cos(delta_0);
XB =
Xcos(alpha - z_A) cos(delta) = cos(alpha_0 + zeta_A) cos(theta_A) cos(delta_0)
X				- sin(theta_A) sin(delta_0);
XC =
X                 sin(delta) = cos(alpha_0 + zeta_A) sin(theta_A) cos(delta_0)
X				+ cos(theta_A) sin(delta_0);
X
Xdelta = asin(C);
Xalpha = atan2(A/B) + z_A;
X
X
X
Xfrom t to t_0:
X
XA =
Xsin(alpha_0 + zeta_A) cos(delta_0) = sin(alpha - z_A) cos(delta);
X
XB =
Xcos(alpha_0 + zeta_A) cos(delta_0) = cos(alpha - z_A) cos(theta_A) cos(delta)
X				+ sin(theta_A) sin(delta);
XC =
X                      sin(delta_0) = -cos(alpha - z_A) sin(theta_A) cos(delta)
X				+ cos(theta_A) sin(delta)
X
Xdelta_0 = asin(C);
Xalpha_0 = atan2(A,B) - zeta_A;
X*/
X
X
X
X/* For reduction with respect to the standard epoch t_0 = J2000.0
Xzeta_A  = 0.6406161* T + 0.0000839* T*T + 0.0000050* T*T*T
X   Z_A  = 0.6406161* T + 0.0003041* T*T + 0.0000051* T*T*T
Xtheta_A = 0.5567530* T - 0.0001185* T*T + 0.0000116* T*T*T
X
Xin degrees.
X
XT = (jd - 2451545.0)/36525.0;
X
Xalpha2000 = alpha_0;
Xdelta2000 = delta_0;
X*/
X
X
Xvoid precess(from_equinox, to_equinox,
X	     alpha_in, delta_in, alpha_out, delta_out)
X     double from_equinox, to_equinox,
X       alpha_in, delta_in, *alpha_out, *delta_out;
X{
X  double zeta_A, z_A, theta_A;
X  double T;
X  double A, B, C;
X  double alpha, delta;
X  double alpha2000, delta2000;
X  double into_range();
X
X
X  /* From from_equinox to 2000.0 */
X  if (from_equinox != 2000.0) {
X    T = (from_equinox - 2000.0)/100.0;
X    zeta_A  = 0.6406161* T + 0.0000839* T*T + 0.0000050* T*T*T;
X    z_A     = 0.6406161* T + 0.0003041* T*T + 0.0000051* T*T*T;
X    theta_A = 0.5567530* T - 0.0001185* T*T + 0.0000116* T*T*T;
X
X    A = DSIN(alpha_in - z_A) * DCOS(delta_in);
X    B = DCOS(alpha_in - z_A) * DCOS(theta_A) * DCOS(delta_in)
X      + DSIN(theta_A) * DSIN(delta_in);
X    C = -DCOS(alpha_in - z_A) * DSIN(theta_A) * DCOS(delta_in)
X      + DCOS(theta_A) * DSIN(delta_in);
X
X    alpha2000 = into_range(DATAN2(A,B) - zeta_A);
X    delta2000 = DASIN(C);
X  } else {
X    /* should get the same answer, but this could improve accruacy */
X    alpha2000 = alpha_in;
X    delta2000 = delta_in;
X  };
X
X
X  /* From 2000.0 to to_equinox */
X  if (to_equinox != 2000.0) {
X    T = (to_equinox - 2000.0)/100.0;
X    zeta_A  = 0.6406161* T + 0.0000839* T*T + 0.0000050* T*T*T;
X    z_A     = 0.6406161* T + 0.0003041* T*T + 0.0000051* T*T*T;
X    theta_A = 0.5567530* T - 0.0001185* T*T + 0.0000116* T*T*T;
X
X    A = DSIN(alpha2000 + zeta_A) * DCOS(delta2000);
X    B = DCOS(alpha2000 + zeta_A) * DCOS(theta_A) * DCOS(delta2000)
X      - DSIN(theta_A) * DSIN(delta2000);
X    C = DCOS(alpha2000 + zeta_A) * DSIN(theta_A) * DCOS(delta2000)
X      + DCOS(theta_A) * DSIN(delta2000);
X
X    alpha = into_range(DATAN2(A,B) + z_A);
X    delta = DASIN(C);
X  } else {
X    /* should get the same answer, but this could improve accruacy */
X    alpha = alpha2000;
X    delta = delta2000;
X  };
X
X  *alpha_out = alpha;
X  *delta_out = delta;
X}
X
X
X/* Obliquity epsilon 
Xepsilon = 23.439291 - 0.0130042* T - 0.00000016* T*T - 0.000000504* T*T*T;
X*/
Xdouble obl_jd(jd)
Xdouble jd;
X{
X  double T = (jd - 2451545.0)/36525.0;
X
X  return (23.439291 - 0.0130042* T - 0.00000016* T*T - 0.000000504* T*T*T);
X}
X
Xdouble obl_year(year)
Xdouble year;
X{
X  double T = (year - 2000.0)/100.0;
X
X  return (23.439291 - 0.0130042* T - 0.00000016* T*T - 0.000000504* T*T*T);
X}
X
Xvoid anom_calc(M, e, E_p, nu_p)
X     double M, e, *E_p, *nu_p;
X{
X  double corr, e_0, E_0, E_1;
X
X  e_0 = e * RAD_TO_DEG;
X
X  corr = 1;
X  E_0 = M;
X  while (corr > 0.000001) {
X    corr = (M + e_0 * DSIN(E_0) - E_0)/(1 - e * DCOS(E_0));
X    E_1 = E_0 + corr;
X    if (corr < 0) corr *= -1.0;
X    E_0 = E_1;
X  };
X	
X  *E_p = E_1;
X
X  *nu_p = 2.0 * RAD_TO_DEG * atan(sqrt((1+e)/(1-e))*DTAN(E_1/2));
X}
X
X
X/* 
XGMST = 24110.54841 + 8640184.812866 * T_u + 0.093104 *T_u*T_u - 6.2e-6*T_u*T_u*T_u
X
XT_u = (jd - 2451545.0)/36525.0
X
X1.00273790934
XGAST = apparent siderial time
X = GMST + (total nutation in longitude)cos epsilon
X*/
Xdouble gmst0_degrees(jd)
X     double jd;
X{
X  double T;
X  double secs;
X  double into_range();
X
X  T = (jd - 2451545.0)/36525.0;
X  
X  secs = 24110.54841 + 8640184.812866 * T + 0.093104 *T*T - 6.2e-6*T*T*T;
X
X  return into_range(secs/240.0);
X}
X
X
Xdouble into_range(ang)
X     double ang;
X{
X  long i;
X
X  while (ang < 0.0) ang += 360.0;
X  /* Shouldn't be more than once */
X
X  i = (long)floor(ang/360.0);
X
X  ang = ang - i * 360;
X
X  return(ang);
X}
X
Xvoid altaz(jd, lat, lon, zone, height, alpha, delta, hour, alt, azi)
X     double jd;
X     double lat, lon, zone, height;
X     double alpha, delta;
X     double hour;
X     double *alt, *azi;
X{
X  double jd0;
X  double ha;
X
X  jd0 = ((long) (jd + 0.5001)) - .5; /* round to nearest midnight */
X
X  ha = gmst0_degrees(jd0) + (hour*15.0 - zone*15.0) * 1.00273790934
X    + lon - alpha;
X
X  *alt = DASIN(DSIN(delta)*DSIN(lat) + DCOS(delta)*DCOS(lat)*DCOS(ha));
X  *azi = DATAN2(-DCOS(delta)*DSIN(ha),
X	       DSIN(delta)*DCOS(lat) - DCOS(delta)*DCOS(ha)*DSIN(lat));
X  *azi = (*azi < 0.0 ? 360 + *azi: *azi);
X}
END_OF_FILE
if test 5704 -ne `wc -c <'observe/astlib.c'`; then
    echo shar: \"'observe/astlib.c'\" unpacked with wrong size!
fi
# end of 'observe/astlib.c'
fi
if test -f 'observe/outaltaz.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'observe/outaltaz.c'\"
else
echo shar: Extracting \"'observe/outaltaz.c'\" \(4310 characters\)
sed "s/^X//" >'observe/outaltaz.c' <<'END_OF_FILE'
X/*
X * outaltaz.c
X * output altaz file
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
X#ifndef  lint
Xstatic char rcsid[] =
X  "$Header: outaltaz.c,v 1.3 90/02/19 17:20:53 ccount Exp $";
X#endif
X
X
X#include <stdio.h>
X#ifndef SYSV
X#include <strings.h>
X#else
X#include <string.h>
X#endif
X#include "observe.h"
X#include "date.h"
X
X#ifndef FALSE
X#define FALSE 0
X#endif
X#ifndef TRUE
X#define TRUE 1
X#endif
X
X
Xchar *malloc();
X
Xvoid altaz();
X
X
X/* Output altaz file for object(s) */
Xvoid out_altaz(o_altaz, one_day, jd,
X	       lon, lat, zone, height,
X	       sun_data, moon_data, planets, bodies, nbodies, objects, nobjects)
X     FILE *o_altaz;
X     int one_day;		/* only doing one day */
X     double jd;
X     double lon, lat, zone, height;
X     sun_data_t sun_data;
X     moon_data_t moon_data;
X     planet_data_t planets[];
X     wanderer_data_t bodies[];
X     int nbodies;
X     obj_data_t objects[];
X     int nobjects;
X{
X  int i;
X  char datestr[15];
X  double rise_hr, set_hr, eve_twil, morn_twil;
X  double alt1, az1, alt2, az2, alt3, az3, alt4, az4;
X
X  jd_to_str(jd, datestr);
X  if (!one_day) fprintf(o_altaz, "%s  %.3f\n", datestr, jd);
X
X  rise_hr = sun_data.rise_hour;
X  set_hr = sun_data.set_hour;
X  morn_twil = morntwil(jd, lon, lat, zone, height, sun_data);
X  eve_twil = evetwil(jd, lon, lat, zone, height, sun_data);
X  fprintf(o_altaz,
X"name       at sun set    eve. twil.   morn. twil.   at sun rise\n");
X
X
X  altaz(jd, lat, lon, zone, height, sun_data.alpha, sun_data.delta,
X	set_hr, &alt1, &az1);
X  altaz(jd, lat, lon, zone, height, sun_data.alpha, sun_data.delta,
X	eve_twil, &alt2, &az2);
X  altaz(jd, lat, lon, zone, height, sun_data.alpha, sun_data.delta,
X	morn_twil, &alt3, &az3);
X  altaz(jd, lat, lon, zone, height, sun_data.alpha, sun_data.delta,
X	rise_hr, &alt4, &az4);
X  
X  fprintf(o_altaz,
X	  "%-7.7s %6.1f %6.1f %6.1f %6.1f %6.1f %6.1f %6.1f %6.1f\n",
X	  "Sun",
X	  alt1, az1,
X	  alt2, az2,
X	  alt3, az3,
X	  alt4, az4
X	  );
X
X  for (i = 0; i < 7; i++)
X    if (planets[i].name[0]) {
X      altaz(jd, lat, lon, zone, height, planets[i].alpha, planets[i].delta,
X	    set_hr, &alt1, &az1);
X      altaz(jd, lat, lon, zone, height, planets[i].alpha, planets[i].delta,
X	    eve_twil, &alt2, &az2);
X      altaz(jd, lat, lon, zone, height, planets[i].alpha, planets[i].delta,
X	    morn_twil, &alt3, &az3);
X      altaz(jd, lat, lon, zone, height, planets[i].alpha, planets[i].delta,
X	    rise_hr, &alt4, &az4);
X      fprintf(o_altaz,
X	      "%-7.7s %6.1f %6.1f %6.1f %6.1f %6.1f %6.1f %6.1f %6.1f\n",
X	      planets[i].name,
X	      alt1, az1,
X	      alt2, az2,
X	      alt3, az3,
X	      alt4, az4
X	      );
X    };
X
X
X  for (i = 0; i < nbodies; i++) {
X      altaz(jd, lat, lon, zone, height, bodies[i].alpha, bodies[i].delta,
X	    set_hr, &alt1, &az1);
X      altaz(jd, lat, lon, zone, height, bodies[i].alpha, bodies[i].delta,
X	    eve_twil, &alt2, &az2);
X      altaz(jd, lat, lon, zone, height, bodies[i].alpha, bodies[i].delta,
X	    morn_twil, &alt3, &az3);
X      altaz(jd, lat, lon, zone, height, bodies[i].alpha, bodies[i].delta,
X	    rise_hr, &alt4, &az4);
X      fprintf(o_altaz,
X	      "%-7.7s %6.1f %6.1f %6.1f %6.1f %6.1f %6.1f %6.1f %6.1f\n",
X	      bodies[i].name,
X	      alt1, az1,
X	      alt2, az2,
X	      alt3, az3,
X	      alt4, az4
X	      );
X  };
X
X  for (i = 0; i < nobjects; i++) {
X      altaz(jd, lat, lon, zone, height, objects[i].alpha, objects[i].delta,
X	    set_hr, &alt1, &az1);
X      altaz(jd, lat, lon, zone, height, objects[i].alpha, objects[i].delta,
X	    eve_twil, &alt2, &az2);
X      altaz(jd, lat, lon, zone, height, objects[i].alpha, objects[i].delta,
X	    morn_twil, &alt3, &az3);
X      altaz(jd, lat, lon, zone, height, objects[i].alpha, objects[i].delta,
X	    rise_hr, &alt4, &az4);
X      fprintf(o_altaz,
X	      "%-7.7s %6.1f %6.1f %6.1f %6.1f %6.1f %6.1f %6.1f %6.1f\n",
X	      objects[i].name,
X	      alt1, az1,
X	      alt2, az2,
X	      alt3, az3,
X	      alt4, az4
X	      );
X  };
X
X  if (!one_day) fprintf(o_altaz, "\f\n");
X}
END_OF_FILE
if test 4310 -ne `wc -c <'observe/outaltaz.c'`; then
    echo shar: \"'observe/outaltaz.c'\" unpacked with wrong size!
fi
# end of 'observe/outaltaz.c'
fi
if test -f 'observe/outeph.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'observe/outeph.c'\"
else
echo shar: Extracting \"'observe/outeph.c'\" \(5903 characters\)
sed "s/^X//" >'observe/outeph.c' <<'END_OF_FILE'
X/*
X * outeph.c
X * output ephemeris file
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
X#ifndef  lint
Xstatic char rcsid[] =
X  "$Header: outeph.c,v 1.11 90/03/06 00:09:35 ccount Exp $";
X#endif
X
X
X#include <stdio.h>
X#ifndef SYSV
X#include <strings.h>
X#else
X#include <string.h>
X#endif
X#include "observe.h"
X#include "date.h"
X
X#ifndef FALSE
X#define FALSE 0
X#endif
X#ifndef TRUE
X#define TRUE 1
X#endif
X
X
Xvoid raformat(), decformat(), timeformat();
Xchar *malloc();
X
X
X/* Output ephemeris file for object(s) */
Xvoid out_eph(o_eph, one_day, jd,
X	     sun_data, moon_data, planets, bodies, nbodies, objects, nobjects)
X     FILE *o_eph;
X     int one_day;		/* only doing one day */
X     double jd;
X     sun_data_t sun_data;
X     moon_data_t moon_data;
X     planet_data_t planets[];
X     wanderer_data_t bodies[];
X     int nbodies;
X     obj_data_t objects[];
X     int nobjects;
X{
X  int i;
X  char datestr[15];
X  char rastr1[15], rastr2[15];
X  char decstr1[15], decstr2[15];
X  char risestr[6], setstr[6], transitstr[6];
X  char Delta_str[6], r_str[6];
X
X
X  jd_to_str(jd, datestr);
X  if (!one_day) fprintf(o_eph, "%s  %.3f\n", datestr, jd);
X
X
X  fprintf(o_eph,
X"name   RA2000.0  Dec2000.0  RA epoch  Dec epoch  rise  trans set   mag    size   elong. phase Delta r\n");
X
X  raformat(sun_data.alpha2000/15.0, rastr1);
X  raformat(sun_data.alpha/15.0, rastr2);
X  decformat(sun_data.delta2000, decstr1);
X  decformat(sun_data.delta, decstr2);
X  timeformat(sun_data.rise_hour, risestr);
X  timeformat(sun_data.transit_hour, transitstr);
X  timeformat(sun_data.set_hour, setstr);
X  fprintf(o_eph,
X	  "%-7.7s %s %s %s %s %s %s %s %5.1f %6.1f              %5.2f\n",
X	  "Sun",
X	  rastr1, decstr1,
X	  rastr2, decstr2,
X	  risestr, transitstr, setstr,
X	  -26.0, sun_data.size, sun_data.R);
X
X  raformat(moon_data.alpha2000/15.0, rastr1);
X  raformat(moon_data.alpha/15.0, rastr2);
X  decformat(moon_data.delta2000, decstr1);
X  decformat(moon_data.delta, decstr2);
X  timeformat(moon_data.rise_hour, risestr);
X  timeformat(moon_data.transit_hour, transitstr);
X  timeformat(moon_data.set_hour, setstr);
X  fprintf(o_eph,
X	 "%-7.7s %s %s %s %s %s %s %s %5.1f %6.1f        %5.3f %5.2f\n",
X	  "Moon",
X	  rastr1, decstr1,
X	  rastr2, decstr2,
X	  risestr, transitstr, setstr,
X	  moon_data.mag, moon_data.size, moon_data.illum_frac,
X	  moon_data.Delta/10000.0);
X
X 
X
X  for (i = 0; i < 7; i++)
X    if (planets[i].name[0]) {
X      raformat(planets[i].alpha2000/15.0, rastr1);
X      raformat(planets[i].alpha/15.0, rastr2);
X      decformat(planets[i].delta2000, decstr1);
X      decformat(planets[i].delta, decstr2);
X      timeformat(planets[i].eventlist[0].hour, risestr);
X      timeformat(planets[i].eventlist[3].hour, transitstr);
X      timeformat(planets[i].eventlist[6].hour, setstr);
X      fprintf(o_eph,
X        "%-7.7s %s %s %s %s %s %s %s %5.2f %6.1f %6.1f %5.3f %5.2f %5.2f\n",
X	      planets[i].name,
X	      rastr1, decstr1,
X	      rastr2, decstr2,
X	      risestr, transitstr, setstr,
X	      planets[i].mag, planets[i].size,
X	      planets[i].psi, planets[i].illum_frac,
X	      planets[i].Delta, planets[i].r);
X    };
X
X
X  for (i = 0; i < nbodies; i++) {
X    raformat(bodies[i].alpha2000/15.0, rastr1);
X    raformat(bodies[i].alpha/15.0, rastr2);
X    decformat(bodies[i].delta2000, decstr1);
X    decformat(bodies[i].delta, decstr2);
X    timeformat(bodies[i].eventlist[0].hour, risestr);
X    timeformat(bodies[i].eventlist[3].hour, transitstr);
X    timeformat(bodies[i].eventlist[6].hour, setstr);
X    if (bodies[i].Delta < 0.0) {
X      strcpy(Delta_str, "-----");
X    } else {
X      sprintf(Delta_str, "%5.2f", bodies[i].Delta);
X    };
X    if (bodies[i].r < 0.0) {
X      strcpy(r_str, "-----");
X    } else {
X      sprintf(r_str, "%5.2f", bodies[i].r);
X    };
X
X    fprintf(o_eph,
X      "%-7.7s %s %s %s %s %s %s %s %5.2f                     %s %s\n",
X	    bodies[i].name,
X	    rastr1, decstr1,
X	    rastr2, decstr2,
X	    risestr, transitstr, setstr,
X	    bodies[i].mag, Delta_str, r_str);
X  };
X
X  for (i = 0; i < nobjects; i++) {
X    raformat(objects[i].alpha2000/15.0, rastr1);
X    raformat(objects[i].alpha/15.0, rastr2);
X    decformat(objects[i].delta2000, decstr1);
X    decformat(objects[i].delta, decstr2);
X    timeformat(objects[i].rise_hour, risestr);
X    timeformat(objects[i].transit_hour, transitstr);
X    timeformat(objects[i].set_hour, setstr);
X    fprintf(o_eph,
X      "%-7.7s %s %s %s %s %s %s %s %5.2f %6.1f\n",
X	    objects[i].name,
X	    rastr1, decstr1,
X	    rastr2, decstr2,
X	    risestr, transitstr, setstr, objects[i].mag, objects[i].size);
X  };
X  if (!one_day) fprintf(o_eph, "\f\n");
X}
X
Xvoid raformat(ra, str)
X     double ra;
X     char str[];
X{
X  int h, m, s;
X
X  h = ra;
X  m = (ra-h)*60;
X  s = ((ra-h)*60 - m)*60 + .5;
X  if (s == 60) {
X    s = 0;
X    m++;
X  };
X  if (m == 60) {
X    m = 0;
X    h++;
X  }
X  if (h == 24) h = 0;
X  sprintf(str, "%02dh%02dm%02ds", h, m, s);
X}
X
Xvoid decformat(dec, str)
X     double dec;
X     char str[];
X{
X  int h, m, s;
X  char sign_char = ' ';
X
X  if (dec < 0) {
X    sign_char = '-';
X    dec = -dec;
X  };
X
X  h = dec;
X  m = (dec-h)*60;
X  s = ((dec-h)*60 - m)*60 + .5;
X  if (s == 60) {
X    s = 0;
X    m++;
X  };
X  if (m == 60) {
X    m = 0;
X    h++;
X  }
X
X  sprintf(str, "%c%02dd%02dm%02ds", sign_char, h, m, s);
X}
X
Xvoid timeformat(time, str)
X     double time;		/* Hours */
X     char str[];
X{
X  int hrs, mins;
X
X  if (time < 0.0) strcpy(str, "-----");
X  else {
X    hrs = time;
X    mins = (time-hrs)*60.0 + 0.5;
X    if (mins == 60)
X      {
X   	hrs = (hrs == 23) ? 0 :(hrs+1);
X   	mins = 0;
X      }
X    sprintf(str, "%02d:%02d", hrs, mins);
X  };
X}
END_OF_FILE
if test 5903 -ne `wc -c <'observe/outeph.c'`; then
    echo shar: \"'observe/outeph.c'\" unpacked with wrong size!
fi
# end of 'observe/outeph.c'
fi
if test -f 'observe/riseset.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'observe/riseset.c'\"
else
echo shar: Extracting \"'observe/riseset.c'\" \(5175 characters\)
sed "s/^X//" >'observe/riseset.c' <<'END_OF_FILE'
X/*
X * riseset.c
X * calculate rise and set times of objects, sun, moon
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
X#ifndef  lint
Xstatic char rcsid[] =
X  "$Header: riseset.c,v 1.6 90/02/23 00:17:03 ccount Exp $";
X#endif
X
X#include <math.h>
X
X#include "observe.h"
X#include "degree.h"
X
X#ifndef FALSE
X#define FALSE 0
X#endif
X#ifndef TRUE
X#define TRUE 1
X#endif
X
Xdouble gmst0_degrees();
X
Xdouble risetime(rise, jd, alt, lat, lon, zone, height, alpha, delta)
X     int rise;
X     double jd;
X     double alt;
X     double lat, lon, zone, height;
X     double alpha, delta;
X{
X  double H_0;
X  double jd0;
X  double cos_term;
X  double hour;
X
X  jd0 = ((long) (jd + 0.5001)) - .5; /* round to nearest midnight */
X
X  cos_term = (DSIN(alt) - DSIN(lat) * DSIN(delta))/(DCOS(lat)*DCOS(delta));
X
X  if (cos_term < -1.0)		/* Never rises or sets */
X    return -1.0;
X  if (cos_term > 1.0)		/* Never rises or sets */
X    return -1.0;
X
X  H_0 = RAD_TO_DEG * acos(cos_term);
X
X  if (rise) H_0 *= -1.0;
X
X  hour = (H_0 + alpha - gmst0_degrees(jd0) - lon) / 1.00273790934 + zone*15.0;
X
X  hour = into_range(hour);
X
X  return (hour/15.0);
X}
X
Xdouble sunrise(jd, lon, lat, zone, height, sun_data)
X     double jd;
X     double lon, lat, zone, height;
X     sun_data_t sun_data;
X{
X  return risetime(TRUE, jd, -0.566666667, lat, lon, zone, height,
X		  sun_data.alpha, sun_data.delta);
X}
X
Xdouble suntransit(jd, lon, lat, zone, height, sun_data)
X     double jd;
X     double lon, lat, zone, height;
X     sun_data_t sun_data;
X{
X  double hour;
X  double jd0;
X
X
X  jd0 = ((long) (jd + 0.5001)) - .5; /* round to nearest midnight */
X
X  hour = (sun_data.alpha - gmst0_degrees(jd0) - lon) / 1.00273790934
X    + zone*15.0;
X  hour = into_range(hour);
X
X  return (hour/15.0);
X}
X
Xdouble sunset(jd, lon, lat, zone, height, sun_data)
X     double jd;
X     double lon, lat, zone, height;
X     sun_data_t sun_data;
X{
X  return risetime(FALSE, jd, -0.566666667, lat, lon, zone, height,
X		  sun_data.alpha, sun_data.delta);
X}
X
X
Xdouble morntwil(jd, lon, lat, zone, height, sun_data)
X     double jd;
X     double lon, lat, zone, height;
X     sun_data_t sun_data;
X{
X  return risetime(TRUE, jd, -18.0, lat, lon, zone, height,
X		  sun_data.alpha, sun_data.delta);
X}
X
X
Xdouble evetwil(jd, lon, lat, zone, height, sun_data)
X     double jd;
X     double lon, lat, zone, height;
X     sun_data_t sun_data;
X{
X  return risetime(FALSE, jd, -18.0, lat, lon, zone, height,
X		  sun_data.alpha, sun_data.delta);
X}
X
X
Xdouble moonrise(jd, lon, lat, zone, height, moon_data)
X     double jd;
X     double lon, lat, zone, height;
X     moon_data_t moon_data;
X{
X  return risetime(TRUE, jd, -0.566666667, lat, lon, zone, height,
X		  moon_data.alpha, moon_data.delta);
X}
X
Xdouble moontransit(jd, lon, lat, zone, height, moon_data)
X     double jd;
X     double lon, lat, zone, height;
X     moon_data_t moon_data;
X{
X  double hour;
X  double jd0;
X
X
X  jd0 = ((long) (jd + 0.5001)) - .5; /* round to nearest midnight */
X
X  hour = (moon_data.alpha - gmst0_degrees(jd0) - lon) / 1.00273790934
X    + zone*15.0;
X  hour = into_range(hour);
X
X  return (hour/15.0);
X}
X
Xdouble moonset(jd, lon, lat, zone, height, moon_data)
X     double jd;
X     double lon, lat, zone, height;
X     moon_data_t moon_data;
X{
X  return risetime(FALSE, jd, -0.566666667, lat, lon, zone, height,
X		  moon_data.alpha, moon_data.delta);
X}
X
Xdouble objrise(jd, lon, lat, zone, height, alpha, delta)
X     double jd, lon, lat, zone, height, alpha, delta;
X{
X  return risetime(TRUE, jd, -0.566666667, lat, lon, zone, height,
X		  alpha, delta);
X}
X
Xdouble objrise20(jd, lon, lat, zone, height, alpha, delta)
X     double jd, lon, lat, zone, height, alpha, delta;
X{
X  return risetime(TRUE, jd, 20.0, lat, lon, zone, height, alpha, delta);
X}
X
Xdouble objrise30(jd, lon, lat, zone, height, alpha, delta)
X     double jd, lon, lat, zone, height, alpha, delta;
X{
X  return risetime(TRUE, jd, 30.0, lat, lon, zone, height, alpha, delta);
X}
X
Xdouble objtransit(jd, lon, lat, zone, height, alpha, delta)
X     double jd, lon, lat, zone, height, alpha, delta;
X{
X  double hour;
X  double jd0;
X
X
X  jd0 = ((long) (jd + 0.5001)) - .5; /* round to nearest midnight */
X
X  hour = (alpha - gmst0_degrees(jd0) - lon) / 1.00273790934 + zone*15.0;
X
X  hour = into_range(hour);
X
X  return (hour/15.0);
X}
X
Xdouble objset30(jd, lon, lat, zone, height, alpha, delta)
X     double jd, lon, lat, zone, height, alpha, delta;
X{
X  return risetime(FALSE, jd, 30.0, lat, lon, zone, height, alpha, delta);
X}
X
Xdouble objset20(jd, lon, lat, zone, height, alpha, delta)
X     double jd, lon, lat, zone, height, alpha, delta;
X{
X  return risetime(FALSE, jd, 20.0, lat, lon, zone, height, alpha, delta);
X}
X
Xdouble objset(jd, lon, lat, zone, height, alpha, delta)
X     double jd, lon, lat, zone, height, alpha, delta;
X{
X  return risetime(FALSE, jd, -0.566666667, lat, lon, zone, height,
X		  alpha, delta);
X}
X
X
END_OF_FILE
if test 5175 -ne `wc -c <'observe/riseset.c'`; then
    echo shar: \"'observe/riseset.c'\" unpacked with wrong size!
fi
# end of 'observe/riseset.c'
fi
if test -f 'starchart/parse_input.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'starchart/parse_input.c'\"
else
echo shar: Extracting \"'starchart/parse_input.c'\" \(5244 characters\)
sed "s/^X//" >'starchart/parse_input.c' <<'END_OF_FILE'
X/*
X * Parse .rc file and interactive input
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
X
X
Xstatic char rcsid[]="$Header: parse_input.c,v 1.5 90/02/19 17:52:54 ccount Exp $";
X
X#include <ctype.h>
X#include "star3.h"
X#define PARSE_INPUT
X#include "parse_input.h"
X  
X#define LINELEN 81
X
Xstatic char var_name[LINELEN];
X
X/* Parse input line, return data from keyword map in pointers,
X   c_buf is always set to the string after the = if any,
X   otherwise c_buf = v_name
X   return value is TRUE if valid input, FALSE if not.
X   validity of input is determined by the variable_type field in keyword_map
X   if the string can be parsed as that type, return TRUE */
Xint parse_line(sbuf, v_name, r_code, var_type, c_buf, f_buf, i_buf, l_buf)
X     char *sbuf;
X     char **v_name;
X     int *r_code;
X     int *var_type;
X     char **c_buf;		/* parsed as character string */
X     double *f_buf;		/* parsed as double */
X     int *i_buf;		/* parsed as integer */
X     int *l_buf;		/* parsed as logical (TRUE or FALSE) */
X{
X  char *cp;
X  char tbuf1[LINELEN];
X  int i;
X  int i_flag, f_flag, l_flag;	/* parsing successful */
X
X  /* remove trailing \n */
X  i = strlen(sbuf);
X  if (sbuf[i-1] == '\n') sbuf[i-1] = '\0';
X
X  /* eliminate comments */
X  for (i=0; ((i <= LINELEN) && (sbuf[i])); i++)
X    if (sbuf[i] == '#') sbuf[i] = '\0';
X  
X  /* Convert "var_name=value" to "var_name value" */
X  for (i=0; ((i <= LINELEN) && (sbuf[i])); i++)
X      if (sbuf[i] == '=') sbuf[i] = ' ';
X  sbuf[i] = '\0';	
X  
X  /* scan variable name, value */
X  /* everything to first space is var_name */
X  for (i=0; ((i<=LINELEN) && (sbuf[i] != ' ') && (sbuf[i] != '\t')
X	     && (sbuf[i])); i++)
X    var_name[i] = sbuf[i];
X  var_name[i++] = '\0';
X
X  /* everything after is value, put in cp */
X  if (var_name[0]) cp = &sbuf[i];
X  else cp = var_name;
X
X  /* Remove leading and trailing spaces, newlines and tabs from cp */
X  while ((cp[0] == ' ') || (cp[0] == '\t')) cp++;
X  for (i = strlen(cp) - 1;  ((i >= 0) && ((cp[i] == ' ') || (cp[i] == '\t')));
X       i--);
X  if (i != 0) cp[i+1] = '\0';
X
X
X  /* lowercase var_name */
X  for (i = 0; var_name[i]; i++)
X    if (isupper(var_name[i]))
X      var_name[i] = tolower(var_name[i]);
X  
X  
X  
X  /* variable value may be a string, double, integer, or logical value */
X  f_flag = (sscanf(sbuf,"%*s%lf", f_buf) == 1);
X  i_flag = (sscanf(sbuf,"%*s%d", i_buf) == 1);
X  if (i_flag) {
X    l_flag = TRUE;
X    *l_buf = ((*i_buf == 0) ? FALSE : TRUE);
X  } else {
X    l_flag = FALSE;
X  };
X
X  i = 0;
X  while (tbuf1[i] = cp[i]) i++;
X  /* lowercase tbuf1 */
X  for (i = 0; tbuf1[i]; i++)
X    if (isupper(tbuf1[i]))
X      tbuf1[i] = tolower(tbuf1[i]);
X
X  if ((!strcmp(tbuf1,"true"))  || (!strcmp(tbuf1,"on"))) {
X    l_flag = TRUE;
X    *l_buf = TRUE;
X  } else if ((!strcmp(tbuf1,"false")) || (!strcmp(tbuf1,"off"))) {
X    l_flag = TRUE;
X    *l_buf = FALSE;
X  }
X  *v_name = var_name;
X  *c_buf = cp;
X
X  /* Check validity, may be blank line */
X  if ((var_name[0] == 0) && (cp[0] == 0)) {
X    *r_code = R_NONE;
X    *var_type = V_NONE;
X    return TRUE;
X  }
X  
X  i = 0;
X  while (keyword_map[i].word[0]) {
X    if (!strcmp(var_name, keyword_map[i].word)) {
X      *r_code = keyword_map[i].return_code;
X      switch (keyword_map[i].variable_type) {
X      case V_NONE:
X	*c_buf = var_name;
X	return TRUE;
X	break;
X      case V_CHAR:
X	return TRUE;
X	break;
X      case V_FLOAT:
X	return f_flag;
X	break;
X      case V_INT:
X	return i_flag;
X	break;
X      case V_BOOL:
X	return l_flag;
X	break;
X      default:
X	return FALSE;
X      };
X    }
X    i++;
X  }
X
X  return FALSE;
X}
X
X
Xstatic char *tr_vtype(v_ty)
Xint v_ty;
X{
X  switch (v_ty) {
X  case V_NONE:
X    return " (keyword)";
X    break;
X  case V_CHAR:
X    return " = string";
X  case V_FLOAT:
X    return " = floating point (e.g. 3.14 or 6e23)";
X  case V_INT:
X    return " = integer";
X  case V_BOOL:
X    return " = boolean (e.g. 1 or false or off)";
X  default:
X    return "";
X  }
X}
X
X/* send to stdout the keyword_map table */
Xhelp_vars(word)
Xchar *word;
X{
X  int i;
X
X
X  printf("Word = Expected value type\n");
X
X  if (word[0]) {
X    i = 0;
X    while (keyword_map[i].word[0]) {
X      if (!strcmp(word, keyword_map[i].word)) {
X	if (keyword_map[i].synonym[0])
X	  printf("%-20s: synonym for %s\n", word, keyword_map[i].synonym);
X	else
X	  if (keyword_map[i].doc[0])
X	    printf("%-20s%s\n", word, keyword_map[i].doc);
X	  else
X	    printf("%-20s%s\n", word, tr_vtype(keyword_map[i].variable_type));
X	return;
X      }
X      i++;
X    };
X    printf("%-20s is not a valid keyword\n", word);
X  } else {
X    i = 0;
X    while (keyword_map[i].word[0]) {
X	if (keyword_map[i].synonym[0])
X	  printf("%-20s: synonym for %s\n", keyword_map[i].word,
X		 keyword_map[i].synonym);
X	else
X	  if (keyword_map[i].doc[0])
X	    printf("%-20s%s\n", keyword_map[i].word, keyword_map[i].doc);
X	  else
X	    printf("%-20s%s\n", keyword_map[i].word,
X		   tr_vtype(keyword_map[i].variable_type));
X      i++;
X    }
X  }
X}
X
END_OF_FILE
if test 5244 -ne `wc -c <'starchart/parse_input.c'`; then
    echo shar: \"'starchart/parse_input.c'\" unpacked with wrong size!
fi
# end of 'starchart/parse_input.c'
fi
if test -f 'starchart/parse_input.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'starchart/parse_input.h'\"
else
echo shar: Extracting \"'starchart/parse_input.h'\" \(5360 characters\)
sed "s/^X//" >'starchart/parse_input.h' <<'END_OF_FILE'
X/* Header for parse input */
X/*
X *
X * $Header: parse_input.h,v 1.3 90/01/10 02:06:52 ccount Exp $
X * 
X*/
X/* Variable setting */
X
X/* RETURN CODES */
X#define TINT 1000
X#define TFLO 1001
X#define TBOOL 1002
X#define TNONE 1003
X#define TCHAR 1004
X#define TREPORT 1005
X
X#define EXIT 101
X#define END_INPUT 103
X#define HELP_ME 104
X#define SHOW_ME 105
X#define WRITE_RC_FILE 110
X
X#define R_NONE 0
X#define R_RA 1
X#define R_DEC 2
X#define R_SCALE 3
X#define R_NAMELIM 4
X#define R_MAGLIM 5
X#define R_GKLIM 6
X#define R_TITLE 7
X#define R_STARFILE 8
X#define R_INDEXFILE 9
X#define R_NEBFILE 10
X#define R_PLANETFILE 11
X#define R_USERFILE 12
X#define R_MAPFILE 13
X#define R_CONSTFILE 14
X#define R_FINDCONST 15
X#define R_BOUNDFILE 16
X#define R_PATTERNFILE 17
X#define R_CONSTLNAMEFILE 18
X#define R_LAYERS 19
X#define R_POLARMODE 20
X#define R_BIGFLAG 21
X#define R_PROJECTION_MODE 22
X#define R_INVERT 23
X#define R_CHART_TYPE 24
X#define R_VRANGE 25
X#define R_VMAGS 26
X#define R_GRID 27
X#define R_NOGRID 28
X#define R_NOGRID_RA 29
X#define R_NOGRID_DEC 30
X#define R_NOMAGLBLS 31
X#define R_DRIVER_CONTROL 32
X#define R_WRITE_MAPWIN_FILE 33
X#define R_READ_MAPWIN_FILE 34
X#define R_PRECESS_TO 35
X
X/* VARIABLE TYPES */
X#define V_NONE 0
X#define V_CHAR 1
X#define V_FLOAT 2
X#define V_INT 3
X#define V_BOOL 4
X
Xtypedef struct {
X  char *word;
X  int return_code;
X  int variable_type;
X  char *synonym;
X  char *doc;
X} keyword;
X
X#ifdef PARSE_INPUT
Xkeyword keyword_map[] =
X{
X/*
X  {"int", TINT, V_INT, "", ""},
X  {"bool", TBOOL, V_BOOL, "", "Test doc string"},
X  {"none", TNONE, V_NONE, "", ""},
X  {"flo", TFLO, V_FLOAT, "", ""},
X  {"char", TCHAR, V_CHAR, "", ""},
X*/
X  {"exit", EXIT, V_NONE, "", "Exit the program"},
X  {"quit", EXIT, V_NONE, "exit", ""},
X  {"end_input", END_INPUT, V_NONE, "", "End input, display chart"},
X  {"done_input", END_INPUT, V_NONE, "end_input", ""},
X  {"done", END_INPUT, V_NONE, "end_input", ""},
X  {"draw", END_INPUT, V_NONE, "end_input", ""},
X  {"help", HELP_ME, V_NONE, "", ""},
X  {"?", HELP_ME, V_NONE, "help", ""},
X  {"show", SHOW_ME, V_NONE, "", ""},
X  {"ra", R_RA, V_FLOAT, "", "Right Ascension of center of map"},
X  {"dec", R_DEC, V_FLOAT, "", "Declination of center of map"},
X  {"scale", R_SCALE, V_FLOAT, "", "Scale of center of map"},
X  {"title", R_TITLE, V_CHAR, "", "Title of chart"},
X  {"findconst", R_FINDCONST, V_CHAR, "",
X     "Constellation, specification in constfile"},
X  {"constfile", R_CONSTFILE, V_CHAR, "",
X     "Filename for constellation location"},
X  {"namelim", R_NAMELIM, V_FLOAT, "", "Limiting magnitude for object names"},
X  {"lbllim", R_NAMELIM, V_FLOAT, "namelim", ""},
X  {"gklim", R_GKLIM, V_FLOAT, "", "Limiting magnitude for object label"},
X  {"maglim", R_MAGLIM, V_FLOAT, "", "Limiting magnitude for object"},
X  {"starfile", R_STARFILE, V_CHAR, "", "Filename for stars"},
X  {"indexfile", R_INDEXFILE, V_CHAR, "", "Filename for SAO stars"},
X  {"nebfile", R_NEBFILE, V_CHAR, "", "Filename for nebulae"},
X  {"planetfile", R_PLANETFILE, V_CHAR, "", "Filename for planets"},
X  {"userfile", R_USERFILE, V_CHAR, "", "Filename for user file"},
X  {"mapfile", R_MAPFILE, V_CHAR, "",
X     "Filenames for files to replaces starfile etc."},
X  {"boundfile", R_BOUNDFILE, V_CHAR, "",
X     "Filename for constellation boundaries"},
X  {"patternfile", R_PATTERNFILE, V_CHAR, "",
X     "Filename for constellation patterns"},
X  {"constlnamefile", R_CONSTLNAMEFILE, V_CHAR, "",
X     "Filename for constellation names"},
X  {"layers", R_LAYERS, V_CHAR, "",
X     "Order for layers drawn in each window of the chart"},
X  {"all_layer", R_LAYERS, V_CHAR, "layers", ""},
X  {"polarmode", R_POLARMODE, V_BOOL, "", "Use stereographic projection"},
X  {"projection_mode", R_PROJECTION_MODE, V_CHAR, "",
X     "Projection mode (sansons, stereographic, gnomonic, etc."},
X  {"invert", R_INVERT, V_BOOL, "", "Flip north and south"},
X  {"precess_to", R_PRECESS_TO, V_FLOAT, "",
X     "Precess to equinox and ecliptic of year."},
X  {"bigflag", R_BIGFLAG, V_BOOL, "", "Chart contains one large window"},
X  {"chart_type", R_CHART_TYPE, V_CHAR, "",
X     "fullpage for one large window, threepart for thumbscale map\n\
X\t\t\t\tand legend"},
X  {"vrange", R_VRANGE, V_FLOAT, "",
X     "label stars with magnitudes if in range"},
X  {"vmags", R_VMAGS, V_FLOAT, "",
X     "label stars with magnitudes if within (arg2) of (arg1)"},
X  {"grid", R_GRID, V_FLOAT, "",
X     "draw grid: grid ra_space dec_space [ra_start] [dec_start]"},
X  {"nogrid", R_NOGRID, V_BOOL, "", "Don't draw grids"},
X  {"nogrid_ra", R_NOGRID_RA, V_BOOL, "", "Don't draw grid in R.A."},
X  {"nogrid_dec", R_NOGRID_DEC, V_BOOL, "", "Don't draw grid in dec."},
X  {"nomaglbls", R_NOMAGLBLS, V_BOOL, "", "Don't label stars with magnitudes"},
X  {"driver_control", R_DRIVER_CONTROL, V_CHAR, "",
X     "special control string for device driver"},
X  {"drivercontrol", R_DRIVER_CONTROL, V_CHAR, "driver_control", ""},
X  {"additional", R_DRIVER_CONTROL, V_CHAR, "driver_control", ""},
X  {"write_rc_file", WRITE_RC_FILE, V_CHAR, "",
X     "Write current state to .starrc file"},
X  {"write_mapwin_file", R_WRITE_MAPWIN_FILE, V_CHAR, "",
X     "write detailed specification of chart to given filename"},
X  {"read_mapwin_file", R_READ_MAPWIN_FILE, V_CHAR, "",
X     "read detailed specification of chart from given filename"},
X/*  {"report", R_REPORT, V_NONE, "", ""},*/
X  {"", R_NONE, V_NONE, "", ""}
X};
X
X/* longest word  17 characters */
X#endif
END_OF_FILE
if test 5360 -ne `wc -c <'starchart/parse_input.h'`; then
    echo shar: \"'starchart/parse_input.h'\" unpacked with wrong size!
fi
# end of 'starchart/parse_input.h'
fi
if test -f 'starchart/star3.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'starchart/star3.h'\"
else
echo shar: Extracting \"'starchart/star3.h'\" \(5818 characters\)
sed "s/^X//" >'starchart/star3.h' <<'END_OF_FILE'
X/* Header for starchart 3.x */
X/*
X * 
X * $Header: star3.h,v 2.8 90/02/19 17:58:03 ccount Exp $
X *
X*/
X/*
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 * DISCLAIMER OF WARRANTY
X * ----------------------
X * The author  disclaims all warranties  with regard to  this software to
X * the   extent  permitted  by applicable   law,  including all   implied
X * warranties  of merchantability  and  fitness. In  no event shall   the
X * author be liable for any special, indirect or consequential damages or
X * any  damages whatsoever resulting from  loss of use, data or  profits,
X * whether in an action of contract, negligence or other tortious action,
X * arising  out of  or in connection with the  use or performance of this
X * software.
X *
X */
X
X
X#define FALSE 0
X#define TRUE 1
X
X#ifdef MSDOS
X#include "pcstar.h"
X#endif
X
X/* Line Styles */
X/* SOLID is defined for HP's, maybe some others. */
X#ifndef SOLID
X#define SOLID 1
X#define DOTTED 2
X#define DASHED 3
X#define VECSOLID 4
X#define VECDOT 5
X#define VECDASH 6
X#define MAXSTLNS 7
X#define CURNTSTY 100
X#else
X#define DOTTED 2
X#define DASHED 3
X#define VECSOLID 4
X#define VECDOT 5
X#define VECDASH 6
X#define MAXSTLNS 7
X#define CURNTSTY 100
X#endif
X
X/* Functions */
X#define CHRTOUTLN 1
X#define CHRTHTICK 2
X#define CHRTVTICK 3
X#define GRID_RA 4
X#define GRID_DEC 5
X#define ECLIPT 6
X#define CONSTBOUND 7
X#define CONSTPATTRN 8
X#define CONSTNAME 9
X#define CHARTFILE 10
X
X
X/* Fonts */
X#define CURNTFONT 100
X#define TIMESROMAN 10
X#define TIMESBOLD 11
X#define TIMESITAL 12
X#define TIMESBOLDITAL 13
X#define HELV 20
X#define HELVBOLD 21
X#define HELVITAL 22
X#define HELVBOLDITAL 23
X#define COURIER 30
X#define COURBOLD 31
X#define COURITAL 32
X#define COURITALBOLD 33
X
X#define NAMESIZE 10
X
X/* Chart types */
X#define THREEPART 1
X#define FULLPAGE 2
X#define OTHERTYPE 3
X
X/* Inverse Chart types */
Xstatic char *inv_ctypes[] = {
X  "none",
X  "threepart",
X  "fullpage",
X  "none"
X  };
X
X
X/* File types */
X#define LINEREAD 1
X#define INDEXTYPE 2
X#define BINFULL 3
X#define BINOBJ 4
X#define BINSTAR 5
X#define SAOFORMAT 6
X#define GSCTYPE 7
X
X/* inverse file types */
Xstatic char *inv_ftypes[] = {
X  "none",
X  "lineread",
X  "indextype",
X  "binfull",
X  "binobj",
X  "binstar",
X  "saoformat",
X  "gsc"
X  };
X
X/* Projection Modes */
X#define SANSONS 1
X#define STEREOGR 2
X#define GNOMONIC 3
X#define ORTHOGR 4
X#define RECTANGULAR 5
X#define OTHERPROJ 6
X
X/* inverse projection mode */
Xstatic char *inv_projs[] = {
X  "",
X  "sansons",
X  "stereogr",
X  "gnomonic",
X  "orthogr",
X  "rectangular",
X  "otherproj"
X  };
X
X/* map types */
X#define MAINMAP 0
X#define FULLPAGEMAP 1
X#define THUMBNAIL 2
X
X/* Layers */
X#define OUTLINE 1
X#define RA_GRID 2
X#define DEC_GRID 3
X#define ECLIPTIC 4
X#define BOUNDARIES 5
X#define PATTERNS 6
X#define CONSTLNAMES 7
X#define ALLFILES 8
X#define ALLGLYPHS 9
X#define ALLNAMES 10
X#define ALLMAGLBLS 11
X#define ALLVECTORS 12
X#define ALLAREAS 13
X#define LEGENDS	14
X#define SKIP 0
X
X/* inverse layers types */
Xstatic char *inv_layrs[] = {
X  "skip",
X  "outline",
X  "ra_grid",
X  "dec_grid",
X  "ecliptic",
X  "boundaries",
X  "patterns",
X  "constlnames",
X  "allfiles",
X  "allglyphs",
X  "allnames",
X  "allmaglbls",
X  "allvectors",
X  "allareas",
X  "legends"
X  };
X
X
X/* Order of standard files in mapfiles */
X#define YALEF 0
X#define INDXF 1
X#define NEBF 2
X#define PLANF 3
X#define NUMFS 4
X
X#define MAXLAYRS 20
X
X#define MAXUFILES 10	            /* Maximum number of user supplied files */
X#define MAXMAPFILES (MAXUFILES+NUMFS) /* Maximum total number of files
X					 user + standard */
X
Xtypedef struct {
X  char *name;			    /* file name */
X  int type;			    /* file type */
X  double maglim, lbllim, gklim;	    /* limiting mag for glyph, name,
X				       lable */
X  int draw_maglbl;		    /* Label with the magnitude */
X  double maglmin, maglmax;	    /* Minimum and maximum mag to be labeled */
X} datafile;
X
X/* The variables in the first few lines MUST be set by driver */
Xtypedef struct {
X  int width, height, x_offset, y_offset; /* Size and position,
X					    in integer device coords */
X  double maglim, lbllim, gklim;	    /* default limiting mag for glyph, name,
X				       and lable for files */
X
X/* The next several variables SHOULD be set by the driver,
X   but are only used by the driver */
X  int map_type;			    /* Type of map: THUMBNAIL may have
X				       some restrictions */
X  int tag;			    /* May be used by driver for whatever */
X  char *tag_field;		    /* 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  int proj_mode;		    /* Projection mode for this map */
X  int draw_ragrid, draw_decgrid;    /* Draw grids */
X  double ra_step, dec_step;	    /* grid step size */
X  double ra_strt, dec_strt;	    /* grid origin */
X
X  int invert;			    /* Invert (flip north south) */
X
X/* The following are set by the main routines */
X  double racen, dlcen, scale;	    /* R.A. and decl. of center,
X				       scale in degrees */
X  double c_scale;		    /* One second of arc
X				       in display units */
X  int layer[MAXLAYRS];		    /* layer order */
X  int nlayers;			    /* number of layers */
X  datafile file[MAXMAPFILES];	    /* files in this map and their controls */
X  int numfiles;			    /* number of files */
X} mapwindow;
X#define MAXWINDOWS 10
X
X
Xdouble modup(), moddown();
Xdouble ftod(), dtof(), htod();
Xlong size_obj();
X
X/* declared here for VMS and pure-ANSI systems (declared in stdlib.h there) */
Xdouble atof();
X
X
END_OF_FILE
if test 5818 -ne `wc -c <'starchart/star3.h'`; then
    echo shar: \"'starchart/star3.h'\" unpacked with wrong size!
fi
# end of 'starchart/star3.h'
fi
echo shar: End of archive 4 \(of 32\).
cp /dev/null ark4isdone
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