v01i016: Calendar/planning tool: Part 07/09
Charles Mcgrew
mcgrew at dartagnan.rutgers.edu
Sun May 28 07:13:59 AEST 1989
Submitted-by: Bill Randle <billr at saab.cna.tek.com>
Posting-number: Volume 1, Issue 16
Archive-name: calentool/part07
#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create the files:
# patchlevel.h
# put_aentry.c
# ras2ps.c
# read_sched.c
# rev.icon
# riseset.c
# riseset.h
# This archive created: Sat May 27 13:13:32 1989
export PATH; PATH=/bin:$PATH
echo shar: extracting "'patchlevel.h'" '(155 characters)'
if test -f 'patchlevel.h'
then
echo shar: will not over-write existing file "'patchlevel.h'"
else
sed 's/^ X//' << \SHAR_EOF > 'patchlevel.h'
X/*
X * $Header: patchlevel.h,v 2.3 89/05/16 16:31:28 billr Exp $
X */
X/*
X * patchlevel.h - current patchlevel of calentool program
X */
X
X#define PATCHLEVEL 2
SHAR_EOF
if test 155 -ne "`wc -c < 'patchlevel.h'`"
then
echo shar: error transmitting "'patchlevel.h'" '(should have been 155 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'put_aentry.c'" '(3174 characters)'
if test -f 'put_aentry.c'
then
echo shar: will not over-write existing file "'put_aentry.c'"
else
sed 's/^ X//' << \SHAR_EOF > 'put_aentry.c'
X/*
X * $Header: put_aentry.c,v 2.1 89/05/09 14:19:36 billr Exp $
X */
X/*
X * put_aentry - write calentool style files
X *
X * Author: Bill Randle, Tektronix, Inc. <billr at saab.CNA.TEK.COM>
X *
X * Copyright (C) 1989 Tektronix, Inc. All Rights Reserved
X *
X * Permission is hereby granted to use and modify this code in source
X * or binary form as long as it is not sold for profit and this copyright
X * notice remains intact.
X */
X
X#include "ct.h"
X#include <stdio.h>
X#include <ctype.h>
X
X/*
X * put entry into appointments file
X */
Xint
Xput_aentry(apts_file, appt)
XFILE *apts_file;
Xstruct appt_entry *appt;
X{
X char *to_str();
X char inbuf[512];
X int one_based = 1;
X
X if (appt->flags & READONLY)
X /* don't copy include file entries */
X /* (the include directive is copied as a comment) */
X return(0);
X if (appt->flags & A_COMMENT) {
X fputs(inbuf, apts_file);
X return(ferror(apts_file));
X }
X if (appt->flags & ALL_YEARS)
X fputs("** ", apts_file);
X else if (appt->year > 99)
X fprintf(apts_file, "%03d ", appt->year);
X else
X fprintf(apts_file, "%02d ", appt->year);
X if (appt->flags & ALL_MONTHS)
X fputs("** ", apts_file);
X else
X fprintf(apts_file, "%02d ", one_based ? appt->month+1 : appt->month);
X if (appt->flags & ALL_DAYS)
X fputs("** ", apts_file);
X else if (appt->flags & EVERY_SOMEDAY) {
X switch (appt->flags & EVERY_SOMEDAY) {
X case EVERY_SUN:
X fputs("Su ", apts_file);
X break;
X case EVERY_MON:
X fputs("Mo ", apts_file);
X break;
X case EVERY_TUE:
X fputs("Tu ", apts_file);
X break;
X case EVERY_WED:
X fputs("We ", apts_file);
X break;
X case EVERY_THU:
X fputs("Th ", apts_file);
X break;
X case EVERY_FRI:
X fputs("Fr ", apts_file);
X break;
X case EVERY_SAT:
X fputs("Sa ", apts_file);
X break;
X }
X } else
X fprintf(apts_file, "%02d ", one_based ? appt->day : appt->day-1);
X if (appt->flags & A_NOTE) {
X appt->hour = 99;
X appt->minute = 0; /* assume unmarked note */
X }
X if ((appt->flags & MARKED_NOTE) == MARKED_NOTE)
X appt->minute = 99;
X if (!(appt->flags & (ALL_DAYS|DELETED)) && appt->flags & REPEAT) {
X if (appt->flags & EVERY_SOMEDAY)
X fprintf(apts_file, "%02d %02d %02d %s ", appt->hour, appt->minute, appt->arrows, to_str(appt->repeat));
X else
X fprintf(apts_file, "%02d %02d %02d [%d] ", appt->hour, appt->minute, appt->arrows, appt->repeat);
X } else
X fprintf(apts_file, "%02d %02d %02d ", appt->hour, appt->minute, appt->arrows);
X
X if (appt->flags & LOOKAHEAD)
X fprintf(apts_file, "<%d> ", appt->lookahead);
X if (appt->flags & DELETED)
X fprintf(apts_file, "# %s", appt->str);
X else
X fprintf(apts_file, "%s", appt->str);
X
X /* check for failure (e.g. file system full) */
X return(ferror(apts_file));
X}
X
Xchar rptstr[10];
X
X/* convert repeat bit map to printable string */
Xchar *
Xto_str(repeat)
Xint repeat;
X{
X int i, j = 0;
X
X if (repeat == ALL_WEEKS)
X /* if it's every week, then don't write [] spec */
X rptstr[0] = '\0';
X else {
X rptstr[j++] = '[';
X for (i=0; i<5; i++) {
X if (repeat & (0x1<<i)) {
X rptstr[j++] = i+1 + '0';
X rptstr[j++] = ',';
X }
X }
X if (repeat & LAST_WEEK) {
X rptstr[j++] = 'L';
X rptstr[j++] = ',';
X }
X rptstr[j] = '\0';
X rptstr[--j] = ']';
X }
X return (rptstr);
X}
SHAR_EOF
if test 3174 -ne "`wc -c < 'put_aentry.c'`"
then
echo shar: error transmitting "'put_aentry.c'" '(should have been 3174 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'ras2ps.c'" '(11700 characters)'
if test -f 'ras2ps.c'
then
echo shar: will not over-write existing file "'ras2ps.c'"
else
sed 's/^ X//' << \SHAR_EOF > 'ras2ps.c'
X/*
X * $Header: ras2ps.c,v 2.1 89/05/09 14:19:40 billr Exp $
X */
X/*
X * ras2ps - convert Sun raster file to RLL Postscript file
X *
X * Based on the sun2ps program by Glenn Boysko and modified slightly
X * by Bill Randle, Tektronix, Inc.
X * Original source of unknown copyright status; modifications Copyright
X * 1989, Tektronix, Inc.
X */
X#include "ct.h" /* for the NO_PRINTER #define */
X#ifndef NO_PRINTER
X/******************************************************************************
X* *
X* File: sun2ps.c *
X* Author: Glenn Boysko *
X* Organization: Case Western Reserve University *
X* EMail: {decvax, sun}!mandrill!boysko *
X* boysko at mandrill.cwru.edu *
X* Created: Wed Mar 23 9:25pm *
X* Contents: Sun Rasterfile to PostScript image (using a run-length *
X* encoding scheme.) *
X* *
X* (Adapted from "postimage" filter by J. R. Bammi.) *
X* *
X* @(#)sun2ps.c 1.8
X******************************************************************************/
X
X/* Sun standard raster file format (as obtained by screendump(1)).
X *
X * Header (8 16-bit quantities)
X * Color Map
X * Image
X *
X */
X
X/* Header Format:
X *
X * ras_magic (int) Raster Magic number 0x59a66a95
X * ras_width (int) Width of image in pixels.
X * ras_height (int) Height of image in pixels.
X * ras_depth (int) Bits per pixel. Either 1 or 8 bits.
X * ras_length (int) Length of image in bytes, after line padding.
X * ras_type (int) Type of file. Assumed to be RT_STANDARD (1) if
X * produced by a screendump command.
X * ras_maptype (int) Type of color map.
X * ras_maplength (int) Length of color map in bytes.
X *
X */
X
X/* Ras_maplength bytes of Color map data. */
X
X/* Ras_length bytes of Image data. */
X
X#include <stdio.h>
X#include <pixrect/pixrect_hs.h>
X
X/* Buffer and Input Modes... */
X#define LITERAL 0
X#define COPY 1
X#define IGNORE 2
X
X/* Transmission Variables. */
Xint BufCount;
X
Xunsigned char Buffer[128],
X CurrByte,
X NextByte,
X *BufferP = Buffer;
X
XFILE *ofile;
X
X/* Diagnostic Variables. */
Xint DiagNLongRuns = 0,
X DiagMaxRunLength = 0,
X DiagNumRuns = 0;
Xdouble DiagSumRunLength = 0;
X
Xras2ps(infile, outfile)
XFILE *infile, *outfile;
X{
X double sizex, sizey, transx, transy, rotate;
X struct rasterfile rh;
X int i, BS, pad,inv;
X
X
X extern double atof();
X
X sizex = 7.5;
X sizey = 10.0;
X transx = transy = 0.5;
X inv = 0;
X ofile = outfile;
X
X if (pr_load_header(infile, &rh) != 0)
X Error("Can't read rasterfile header\n");
X
X#ifdef EXTRADIAGS
X fprintf(stderr, "Ras_width = %d, Ras_height = %d, Ras_depth = %d\n",
X rh.ras_width, rh.ras_height, rh.ras_depth);
X fprintf(stderr, "Ras_length = %d, Ras_type = %d, Ras_maplength = %d\n",
X rh.ras_length, rh.ras_type, rh.ras_maplength);
X#endif
X
X if (rh.ras_magic != RAS_MAGIC)
X {
X Error("Input file is not a Sun Rasterfile!\n");
X }
X
X if (rh.ras_type != RT_STANDARD)
X {
X Error("Input file is not in Sun Standard Rasterfile format.\n");
X }
X
X /* Scan off color table */
X if (rh.ras_maptype != RMT_NONE && rh.ras_maplength > 0)
X pr_load_colormap(infile, &rh, NULL);
X
X if ( pad = 16 - (rh.ras_width%16) ) {
X rh.ras_width += pad;
X#ifdef EXTRADIAGS
X fprintf(stderr, "Ras_width changed to %d\n",rh.ras_width);
X#endif
X }
X
X PrintPostScriptRoutines(rh.ras_height, rh.ras_width, rh.ras_depth,
X transx, transy, sizex, sizey, rotate);
X
X BS = Encode(infile, rh.ras_length, inv);
X
X#ifdef DIAGS
X fprintf(stderr, "Encoded %d bytes into %d. (Ratio=%d%%)\n",
X rh.ras_length, BS, 100 - (100 * BS) / rh.ras_length);
X Diags();
X#endif
X fclose(infile);
X
X PrintPostScriptClosing();
X fclose(outfile);
X}
X
X/******************************************************************************
X* I/O Routines. *
X******************************************************************************/
Xint
Xgb(Fp) /* Get a byte from Fp. */
XFILE *Fp;
X{
X int byte;
X
X if (!feof(Fp))
X byte = getc(Fp);
X else
X Error("Premature EOF.\n");
X if (ferror(Fp))
X Error("I/O Error.\n");
X return(byte);
X}
X
Xint
Xgw(Fp) /* Get a word (int) from Fp. */
XFILE *Fp;
X{
X int word;
X
X if (!feof(Fp))
X word = getw(Fp);
X else
X Error("Premature EOF.\n");
X if (ferror(Fp))
X Error("I/O Error.\n");
X return(word);
X}
X
XSendHex(Byte) /* Send a Hex char to Stdout. */
Xunsigned char Byte;
X{
X static int LineCount = 0;
X
X fprintf(ofile, "%02x", 0xff & Byte);
X if (++LineCount == 16)
X {
X fputc('\n', ofile);
X LineCount = 0;
X }
X}
X
Xint
XSendBuffer(Inv) /* Send a buffer to Stdout. Return BytesSent. */
Xint Inv;
X{
X int i, BytesSent;
X
X if (BufferMode() == LITERAL)
X {
X SendHex( (unsigned char) 0xff & BufCount );
X for (i = 0; i < BufCount+1; i++)
X {
X SendHex( (Inv) ? Buffer[i] : ~Buffer[i]);
X }
X BytesSent = BufCount+2;
X }
X else if (BufferMode() == COPY)
X {
X SendHex( (unsigned char) 0xff & (0x100 + BufCount) );
X SendHex( (Inv) ? Buffer[0] : ~Buffer[0]);
X BytesSent = 2;
X DiagRecLRun(mag(BufCount)+1);
X }
X return(BytesSent);
X}
X
X/******************************************************************************
X* Utility Routines. *
X******************************************************************************/
Xint
Xmag(Byte) /* Magitude of a signed char. */
Xint Byte;
X{
X if (Byte & 0x80)
X {
X /* Signed */
X Byte = ~(--Byte);
X }
X return( 0xff & Byte );
X}
X
X/******************************************************************************
X* Buffer Management Routines. *
X******************************************************************************/
Xint
XInputMode()
X{
X if (CurrByte == NextByte)
X return(COPY);
X return(LITERAL);
X}
X
Xint
XBufferMode()
X{
X if (BufCount >= 0 && BufCount <= 127)
X return(LITERAL);
X else if (BufCount >= -127 && BufCount <= -1)
X return(COPY);
X return(IGNORE);
X}
X
XInitLitMode(Fp, NBytes, Inv)
XFILE *Fp;
Xint *NBytes, Inv;
X{
X BufferP = Buffer;
X BufCount = -1;
X ContLitMode(Fp, NBytes, Inv);
X}
X
XContLitMode(Fp, NBytes, Inv)
XFILE *Fp;
Xint *NBytes, Inv;
X{
X if (BufCount == 127)
X {
X SendBuffer(Inv);
X BufferP = Buffer;
X BufCount = -1;
X }
X *BufferP++ = CurrByte;
X BufCount++;
X CurrByte = NextByte;
X NextByte = (unsigned char) gb(Fp);
X (*NBytes)--;
X}
X
XInitCopyMode(Fp, NBytes, Inv)
XFILE *Fp;
Xint *NBytes, Inv;
X{
X BufferP = Buffer;
X *BufferP++ = CurrByte;
X BufCount = -1;
X CurrByte = (unsigned char) gb(Fp);
X NextByte = (unsigned char) gb(Fp);
X *NBytes -= 2;
X}
X
XContCopyMode(Fp, NBytes, Inv)
XFILE *Fp;
Xint *NBytes, Inv;
X{
X if (BufCount == -127)
X {
X SendBuffer(Inv);
X InitCopyMode(Fp, NBytes, Inv);
X DiagNLongRuns++;
X }
X BufCount--;
X CurrByte = NextByte;
X NextByte = gb(Fp);
X (*NBytes)--;
X}
X
X/******************************************************************************
X* Encoding Algorithm. *
X******************************************************************************/
Xint
XEncode(Fp, NBytes, Inv)
XFILE *Fp;
Xint NBytes, Inv;
X{
X int BytesSent = 0;
X
X /* Initialize Buffer, BufCount, NextByte, CurrByte */
X CurrByte = (unsigned char) gb(Fp);
X NextByte = (unsigned char) gb(Fp);
X if (InputMode() == LITERAL)
X {
X InitLitMode(Fp, &NBytes, Inv);
X }
X else
X {
X InitCopyMode(Fp, &NBytes, Inv);
X }
X while (NBytes > 3)
X {
X switch(BufferMode())
X {
X case LITERAL:
X if (InputMode() == COPY)
X {
X BytesSent += SendBuffer(Inv);
X InitCopyMode(Fp, &NBytes, Inv);
X }
X else
X {
X ContLitMode(Fp, &NBytes, Inv);
X }
X break;
X case COPY:
X if (CurrByte == Buffer[0])
X {
X ContCopyMode(Fp, &NBytes, Inv);
X }
X else
X {
X BytesSent += SendBuffer(Inv);
X if (InputMode() == COPY)
X {
X InitCopyMode(Fp, &NBytes, Inv);
X }
X else
X {
X InitLitMode(Fp, &NBytes, Inv);
X }
X }
X break;
X default:
X Error("Bad Buffer Mode... Sorry\n");
X break;
X }
X }
X BytesSent += SendBuffer(Inv);
X /* Send out rem'g 2-3 bytes in LITERAL mode. */
X Buffer[0] = CurrByte;
X Buffer[1] = NextByte;
X if (NBytes == 3)
X Buffer[2] = gb(Fp);
X BufCount = NBytes-1;
X BytesSent += SendBuffer(Inv);
X return(BytesSent);
X}
X
X/******************************************************************************
X* Diagnostic Routines. *
X******************************************************************************/
XDiagRecLRun(Rlength)
Xint Rlength;
X{
X#ifdef DIAGS
X if (Rlength > DiagMaxRunLength)
X DiagMaxRunLength = Rlength;
X DiagSumRunLength += Rlength;
X DiagNumRuns++;
X#endif
X}
X
XDiags()
X{
X#ifdef DIAGS
X fprintf(stderr, "Longest Run (<= 128) = %d\n", DiagMaxRunLength);
X fprintf(stderr, "Number of Runs over 128 = %d\n", DiagNLongRuns);
X fprintf(stderr, "Average Run Length of %d. (%d Runs)\n",
X (int) DiagSumRunLength / DiagNumRuns, DiagNumRuns);
X#endif
X}
X
X/******************************************************************************
X* PostScript Output Routines. *
X******************************************************************************/
XPrintPostScriptRoutines(ras_h, ras_w, ras_d, tx, ty, sx, sy, rot)
Xint ras_h, ras_w, ras_d;
Xdouble tx, ty, sx, sy, rot;
X{
X fprintf(ofile, "%%!\n/inch {72 mul} def\n");
X fprintf(ofile, "/bpp %d def\n", ras_d);
X fprintf(ofile, "/scanlines %d def\n", ras_h);
X fprintf(ofile, "/scansize %d def\n", ras_w);
X fprintf(ofile, "/bitmapx\n{");
X fprintf(ofile, " %d %d %d [%d 0 0 %d 0 %d] ", ras_w, ras_h, ras_d, ras_w,
X -ras_h, ras_h);
X fprintf(ofile, "{currentfile readrlehexstring pop } image\n} def\n");
X fprintf(ofile, "gsave\n");
X fprintf(ofile, "%f inch %f inch translate\n",tx, ty);
X fprintf(ofile, "%f rotate\n", rot );
X fprintf(ofile, "%f inch %f inch scale\n", sx, sy);
X fprintf(ofile, "/readrlehexstring\t%% rle_file => decoded_string boolean\n");
X fprintf(ofile, "{\n\t/fileptr exch def\n\tfileptr 1 string readhexstring {");
X fprintf(ofile, "\n\t\t0 get dup 128 and 0 eq\n");
X fprintf(ofile, "\t\t{ 1 add /Buffer exch string def\n");
X fprintf(ofile, "\t\t\tfileptr Buffer readhexstring\n\t\t}\n\t\t{");
X fprintf(ofile, " 256 exch sub /BufCount exch def\n");
X fprintf(ofile, "\t\t\t/Buffer BufCount 1 add string def\n");
X fprintf(ofile, "\t\t\t/RunInt fileptr 1 string readhexstring");
X fprintf(ofile, " pop 0 get def\n");
X fprintf(ofile, "\t\t\t0 1 BufCount { RunInt Buffer 3 1 roll put } for\n");
X fprintf(ofile, "\t\t\tBuffer true\n\t\t} ifelse\n\t}\n\t{ false } ifelse\n");
X fprintf(ofile, "} def\n");
X fprintf(ofile, "/clipathx\n{\tnewpath\n\t0 0 moveto\n\t%f inch 0", sx);
X fprintf(ofile, " lineto\n\t%f inch %f inch lineto\n\t0 %f inch lineto\n",
X sx, sy, sy);
X fprintf(ofile, "\tclosepath\n} def\nclipathx clip\n");
X fprintf(ofile, "bitmapx\n");
X}
X
XPrintPostScriptClosing()
X{
X fprintf(ofile, "\ngrestore\n");
X fprintf(ofile, "showpage\n");
X}
X
X/******************************************************************************
X* Error Routine. *
X******************************************************************************/
XError(S1)
Xchar *S1;
X{
X *(S1 + strlen(S1)) = '\0'; /* delete trailing \n */
X err_rpt(S1, FATAL);
X}
X#endif /* NO_PRINTER */
SHAR_EOF
if test 11700 -ne "`wc -c < 'ras2ps.c'`"
then
echo shar: error transmitting "'ras2ps.c'" '(should have been 11700 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'read_sched.c'" '(2393 characters)'
if test -f 'read_sched.c'
then
echo shar: will not over-write existing file "'read_sched.c'"
else
sed 's/^ X//' << \SHAR_EOF > 'read_sched.c'
X/*
X * $Header: read_sched.c,v 2.1 89/05/09 15:40:50 billr Exp $
X */
X/*
X * This routine has been extracted from the month(1L) program.
X */
X/***********************************************************
X * Month - Visual Monthly Calendar and Time/Event Browser
X *
X * Original Author: Tim Stoehn (zeus!tims)
X * "Book code" originally written by Scott Turner (srt at ucla-cs.ARPA)
X * Subsequent Modifications: Jim Hull (hull at hpda) and
X * Michael Morrell (morrell at hpda)
X *
X *
X ***********************************************************/
X#ifndef lint
Xstatic char rcsid[] = "read_sched.c,v 8.4 88/04/04 11:00:49 hull Exp";
X#endif
X
X#include <stdio.h>
X#include "month.h"
X#include <sys/file.h>
X
Xextern struct event_rec events;
X
Xread_schedule(m_dir, read_mode)
Xchar *m_dir;
Xshort read_mode;
X{
X char *schedule_file_name;
X unsigned rec_size;
X short file_version;
X int fd;
X struct event_rec event_buf, *event_ptr, *chain_ptr;
X extern float get_version();
X extern char *strcat(), *strcpy();
X
X schedule_file_name = malloc((unsigned) strlen(m_dir)+8);
X if (schedule_file_name == NULL) {
X fprintf(stderr, "mt2ct: out of memory\n");
X exit(1);
X }
X strcpy(schedule_file_name, m_dir);
X strcat(schedule_file_name, "/.month");
X
X rec_size = sizeof(struct event_rec);
X umask(0);
X
X chain_ptr = events.next_event; /* free old events */
X while (chain_ptr) {
X event_ptr = chain_ptr;
X chain_ptr = chain_ptr->next_event;
X free((char *)event_ptr);
X }
X events.next_event = 0;
X
X fd = open(schedule_file_name, O_RDONLY);
X free(schedule_file_name);
X
X if (fd != -1) {
X if (read(fd, (char *) &file_version, sizeof(file_version))
X == sizeof(file_version)) {
X if (file_version != (int) get_version()) {
X close(fd);
X fd = -1;
X return(file_version);
X }
X } else { /* no version field so assume empty file */
X if (read_mode == READ_ONLY) {
X close(fd);
X fd = -1;
X }
X return(1);
X }
X
X chain_ptr = &events;
X
X while (read(fd, &event_buf, rec_size) == rec_size) {
X if (event_ptr = (struct event_rec *)malloc(rec_size)) {
X chain_ptr->next_event = event_ptr;
X chain_ptr = event_ptr;
X *chain_ptr = event_buf;
X chain_ptr->next_event = (struct event_rec *)0;
X } else
X break;
X }
X if (read_mode == READ_ONLY) {
X close(fd);
X fd = -1;
X }
X return(0);
X }
X /* if here, open failed */
X return(-1);
X}
X
Xfloat
Xget_version()
X{
X return (8.7);
X}
SHAR_EOF
if test 2393 -ne "`wc -c < 'read_sched.c'`"
then
echo shar: error transmitting "'read_sched.c'" '(should have been 2393 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'rev.icon'" '(2591 characters)'
if test -f 'rev.icon'
then
echo shar: will not over-write existing file "'rev.icon'"
else
sed 's/^ X//' << \SHAR_EOF > 'rev.icon'
X/* Format_version=1, Width=64, Height=64, Depth=1, Valid_bits_per_item=16
X *
X * $Header: rev.icon,v 2.1 89/05/09 14:30:50 billr Exp $
X * Copyright (C) 1988, The Regents of the University of California
X * All rights Reserved
X * Author: R. P. C. Rodgers, M.D.
X *
X * Redistribution and use in source and binary forms are permitted
X * provided that this notice is preserved and that due credit is given
X * to the University of California at San Francisco. The name of the University
X * may not be used to endorse or promote products derived from this
X * software without specific prior written permission. This software
X * is provided ``as is'' without express or implied warranty.
X */
X 0x0000,0x0000,0x0000,0x0000,0x7FFF,0xFFFF,0xFFFF,0xFFFE,
X 0x7FFF,0xFFFF,0xFFFF,0xFFFE,0x7FFF,0xE7FF,0xFBFF,0xFE7E,
X 0x7E39,0xF79D,0x70E7,0x9F7E,0x7DFE,0xF76C,0xBBDB,0x6F7E,
X 0x7DF8,0xF71D,0xBBDB,0x6F7E,0x7DF6,0xF77D,0xBBDB,0x6F7E,
X 0x7E3A,0xF78D,0xBCE7,0x9F7E,0x7FFF,0xFFFF,0xFFFF,0xFFFE,
X 0x7FFF,0xFFFE,0x1FFF,0xFFFE,0x7FFF,0xFFF8,0x07FF,0xFFFE,
X 0x7FFF,0xFFF3,0xF3FF,0xFFFE,0x7FFF,0xFFE7,0xF9FF,0xFFFE,
X 0x7C00,0x0024,0xC900,0x000E,0x79FF,0xFFE6,0x99FF,0xFFEE,
X 0x71FF,0xFFE6,0x59FF,0xFFEE,0x65FF,0xFFE6,0xD9FF,0xFFEE,
X 0x6DFF,0xFFE6,0x99FF,0xFFEE,0x69C0,0x01E6,0x59E0,0x00EE,
X 0x65FF,0xFFE6,0xD9FF,0xFFEE,0x6DFF,0xFFC2,0x90FF,0xFFEE,
X 0x69C0,0x01C2,0x50E0,0x00EE,0x65FF,0xFFC2,0xD0FF,0xFFEE,
X 0x6DFF,0xFFE6,0x99FF,0xFFEE,0x69C0,0x01FE,0x5FE0,0x00EE,
X 0x65FF,0xFFFE,0xDFFF,0xFFEE,0x6DFF,0xFFFE,0x9FFF,0xFFEE,
X 0x69C0,0x01FE,0x5FE0,0x00EE,0x65FF,0xFFFE,0xDFFF,0xFFEE,
X 0x6DFF,0xFFFE,0x9FFF,0xFFEE,0x69C0,0x01FF,0xFFE0,0x00EE,
X 0x65FF,0xFFFE,0x1FFF,0xFFEE,0x6DFF,0xFFF8,0x07FF,0xFFEE,
X 0x69C0,0x01F3,0xF3E0,0x00EE,0x65FF,0xFFE6,0x59FF,0xFFEE,
X 0x6DFF,0xFFE6,0xD9FF,0xFFEE,0x69C0,0x01E6,0x99E0,0x00EE,
X 0x65FF,0xFFE6,0x59FF,0xFFEE,0x6DFF,0xFFE6,0xD9FF,0xFFEE,
X 0x69C0,0x01E6,0x99E0,0x00EE,0x65FF,0xFFE6,0x59FF,0xFFEE,
X 0x6DFF,0xFFE6,0xD9FF,0xFFEE,0x69C0,0x01C2,0x90E0,0x00EE,
X 0x65FF,0xFFC2,0x50FF,0xFFEE,0x6DFF,0xFFC2,0xD0FF,0xFFEE,
X 0x69FF,0xFFE6,0x99FF,0xFFEE,0x65FF,0xFFFE,0x5FFF,0xFFEE,
X 0x6DFF,0xFFFE,0xDFFF,0xFFEE,0x69FF,0xFFFE,0x9FFF,0xFFEE,
X 0x65FF,0xFFFE,0x5FFF,0xFFEE,0x6DFF,0xFFFE,0xDFFF,0xFFEE,
X 0x69FF,0xFFFE,0x9FFF,0xFFEE,0x65FF,0xFFFE,0x5FFF,0xFFEE,
X 0x6DFF,0xFFFE,0xDFFF,0xFFEE,0x69FF,0xFFFE,0x9FFF,0xFFEE,
X 0x65FF,0xFFFE,0x5FFF,0xFFEE,0x6C00,0x0000,0xC000,0x000E,
X 0x69B6,0xDB6D,0xB6DB,0x6D9E,0x636D,0xB6DB,0x6DB6,0xDB3E,
X 0x6000,0x0000,0x0000,0x007E,0x7FFF,0xFFFF,0xFFFF,0xFFFE,
X 0x7FFF,0xFFFF,0xFFFF,0xFFFE,0x0000,0x0000,0x0000,0x0000
SHAR_EOF
if test 2591 -ne "`wc -c < 'rev.icon'`"
then
echo shar: error transmitting "'rev.icon'" '(should have been 2591 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'riseset.c'" '(13167 characters)'
if test -f 'riseset.c'
then
echo shar: will not over-write existing file "'riseset.c'"
else
sed 's/^ X//' << \SHAR_EOF > 'riseset.c'
X/*
X * $Header: riseset.c,v 2.1 89/05/09 14:19:49 billr Exp $
X */
X/*
X * riseset.c
X *
X * Compute various useful times
X *
X * Written by Marc T. Kaufman
X * 14100 Donelson Place
X * Los Altos Hills, CA 94022
X * (415) 948-3777
X *
X * Based on : "Explanatory Supplement to the Astronomical Ephemeris
X * and the American Ephemeris and Nautical Almanac",
X * H.M. Nautical Almanac Office, London. Updated from
X * equations in the 1985 Astronomical Almanac.
X *
X * Copyright 1986 by Marc Kaufman
X *
X * Permission to use this program is granted, provided it is not sold.
X *
X * This program was originally written on a VAX, under 4.2bsd.
X * it was then ported to a 68000 system under REGULUS (Alcyon's version
X * of UNIX system III). Major differences included: no 'double' and
X * a default integer length of 'short'. Having been through all that,
X * porting to your machine should be easy. Watch out for 'time' related
X * functions and make sure your 'atan2' program works right.
X *
X * 850210 revised to 1985 Ephemeris - mtk
X *
X * Modified 1/26/89 by Bill Randle, Tektronix, Inc., to interface
X * to the calentool program. Also removed some of the REGULUS stuff.
X * Modifications Copyright (C) 1989, Tektronix, Inc. All Rights Reserved
X *
X * Permission is hereby granted to use and modify this code in source
X * or binary form as long as it is not sold for profit and this copyright
X * notice remains intact.
X */
X#include "ct.h" /* for the NO_SUN_MOON #define */
X#ifndef NO_SUN_MOON
X
X#include <stdio.h>
X#include <sys/time.h>
X#include <math.h>
X#include "riseset.h"
X
Xextern char *daynames[], *monthnames[];
X
Xlong UTC, TDT, tim, tim2;
Xdouble Julian_Day, MJD, Tu, Ru, T70, Local, GMST, LST;
Xdouble Eqt, Tua, L, G, e, eps, g, alpha, delta, sd, cd, lha, lhr, sh, ch;
Xdouble la, lf, S, C, sp, cp, tp, Az, alt;
Xdouble Lm, lm, px, SD, am, dm;
Xdouble zs, x;
Xdouble fabs(), fmod(), asin(), acos();
Xstruct tm *ltm, *t, *gmtime(), *localtime();
Xchar *tdate, *gmctime(), *asctime(), *timezone();
Xstruct timeval tvp;
Xstruct timezone tzp;
Xchar riseset_buf[B_SIZE][64];
Xchar rbuf[24];
X
X#define Pi 3.1415926535
X#define Degree_to_Radian ((2.0 * Pi)/ 360.)
X#define Asec_Radian ((2.0 * Pi)/(360. * 60. * 60.))
X#define Tsec_to_Radian ((2.0 * Pi)/( 24. * 60.* 60.))
X#define Asec_to_Tsec (24./360.)
X#define Sec_per_day (24 * 60 * 60)
X#define Round 0.5 /* for rounding to integer */
X
X#define J1900 /* 24 */15020.0 /* Julian Day number at Epoch 1900.0 */
X#define J1970 /* 24 */40587.5 /* VAX clock Epoch 1970 Jan 1 (0h UT) */
X#define J1985 /* 24 */46065.5 /* Epoch 1985 Jan 1 (0h UT) */
X#define J2000 /* 24 */51545.0 /* Epoch 2000 Jan 1 (12h UT) */
X#define Delta_T (54.6 + 0.9*(Julian_Day - J1985)/365.) /* TDT - UT */
X/* (This is the position of my house ) */
X#ifndef LONG_DEGREES
X# define Longitude 0.
X#else
X# define Longitude (((LONG_DEGREES)*60. + LONG_MINUTES)*60. + LONG_SECONDS) /* Arc-seconds West */
X#endif
X#ifndef LAT_DEGREES
X# define Latitude 37.*360.
X#else
X# define Latitude (((LAT_DEGREES)*60. + LAT_MINUTES)*60. + LAT_SECONDS) /* Arc-seconds North */
X#endif
X#define f1 (1. - (1./298.25)) /* 1 - flattening of Earth */
X/* the following alternate values are useful when debugging */
X/*#define Longitude (((000.)*60. + 0.)*60. + 0.) /* Arc-seconds West */
X/*#define Latitude ((( 35.)*60. + 0.)*60. + 0.) /* Arc-seconds North */
X/*#define f1 1. /* 1 - flattening of Earth */
X
Xriseset(epoch_seconds)
Xlong epoch_seconds;
X{
X char *moonrise(), *sunrise();
X
X/* at this point we digress to discuss UNIX differences.
X * In UCB UNIX we dont have ctime(), but do instead have asctime(),
X * which works from the structures created by gmtime() and localtime().
X * However, system time is kept in UTC (Greenwich), and the localtime
X * routine correctly handles daylight savings time.
X * Since the Regulus system only knows local time, a few direct
X * fiddles are needed.
X */
X
X/* correct apparent latitude for shape of Earth */
X
X lf= atan(f1*f1 * tan(Latitude * Asec_Radian));
X sp= sin(lf);
X cp= cos(lf);
X tp= sp/cp;
X
X UTC = epoch_seconds;
X gettimeofday(&tvp, &tzp); /* for timezone info */
X#ifdef LONG_DEGREES
X Local = - Longitude/15.; /* Local apparent time correction */
X#else
X Local = (double)(-tzp.minuteswest * 60.);
X#endif
X
X sprintf(riseset_buf[B_GMT], "%.24s GMT", gmctime(&UTC));
X
X stuff(UTC); /* start with local time info */
X
X/* Compute Terrestrial Dynamical Time (this used to be called Ephemeris Time) */
X
X TDT = UTC + (long)(Delta_T + Round);
X tdate= gmctime(&TDT);
X *(tdate+19) = '\0';
X sprintf(riseset_buf[B_TDT], " %.8s Terrestrial Dynamical Time", tdate+11);
X
X ltm = localtime(&UTC);
X sprintf(riseset_buf[B_LCT], "%.24s Local Civil Time", asctime(ltm));
X
X sprintf(riseset_buf[B_DMY], "%s %s %d, %d", daynames[ltm->tm_wday],
X monthnames[ltm->tm_mon], ltm->tm_mday, ltm->tm_year+1900);
X tim2 = UTC + (long)(Local + Round); /* Compute Local Solar Time */
X tdate= gmctime(&tim2);
X *(tdate+19) = '\0';
X sprintf(riseset_buf[B_LMT], " %.8s Local Mean Time", tdate+11);
X
X/* compute phase of moon */
X
X moondata(UTC);
X Lm = fmod(Lm-L, 360.); /* phase is Lm - L (longitude of Sun) */
X lm = fmod(Lm, 90.); /* excess over phase boundary */
X sprintf(riseset_buf[B_POM], "The Moon is %3.1f days past ", lm*36525./481267.883);
X if (Lm < 90.) strcat(riseset_buf[B_POM], "New");
X else if (Lm < 180.) strcat(riseset_buf[B_POM], "First Quarter");
X else if (Lm < 270.) strcat(riseset_buf[B_POM], "Full");
X else strcat(riseset_buf[B_POM], "Last Quarter");
X
X sprintf(riseset_buf[B_JLD], "Julian Day 24%10.4f", Julian_Day);
X
X tim2 = GMST + Round;
X tdate= gmctime(&tim2);
X *(tdate+19) = '\0';
X sprintf(riseset_buf[B_GST], " %.8s Greenwich Mean Sidereal Time", tdate+11);
X
X tim2 = LST + Round;
X tdate= gmctime(&tim2);
X *(tdate+19) = '\0';
X sprintf(riseset_buf[B_LST], " %.8s Local Sidereal Time", tdate+11);
X
X tim2= lha + Round;
X tdate= gmctime(&tim2);
X *(tdate+19) = '\0';
X sprintf(riseset_buf[B_LHA], "L.H.A. of Sun %.8s", tdate+11);
X sprintf(riseset_buf[B_SDE], " Declination %6.3f Degrees",delta/3600.);
X sprintf(riseset_buf[B_SAZ], " Azimuth %6.3f Degrees",Az/3600.);
X sprintf(riseset_buf[B_SEL], " Elevation %6.3f Degrees",alt/3600.);
X
X /* compute sunrise and sunset */
X t= localtime(&UTC); /* compute start of day */
X tim = UTC - (3600L * t->tm_hour + 60L * t->tm_min + t->tm_sec)
X + Sec_per_day/2; /* about noon */
X
X zs = 90. + 50./60.; /* zenith angle of rise/set */
X strcpy(riseset_buf[B_SRD], sunrise(tim, -1.0, zs));
X strcpy(riseset_buf[B_SSD], sunrise(tim, 1.0, zs));
X strcpy(riseset_buf[B_SRT], sunrise((long)(tim+Sec_per_day), -1.0, zs));
X strcpy(riseset_buf[B_SST], sunrise((long)(tim+Sec_per_day), 1.0, zs));
X
X /* compute moonrise and moonset */
X tim = tim - Sec_per_day/2 - 31; /* about start of day */
X
X zs = 90. + 34./60.; /* zenith angle of rise/set */
X strcpy(riseset_buf[B_MRD], moonrise(tim, -1.0, zs));
X strcpy(riseset_buf[B_MSD], moonrise(tim, 1.0, zs));
X strcpy(riseset_buf[B_MRT], moonrise((long)(tim+Sec_per_day), -1.0, zs));
X strcpy(riseset_buf[B_MST], moonrise((long)(tim+Sec_per_day), 1.0, zs));
X}
X
Xchar *
Xsunrise(t0, rs, z)
X long t0;
X double rs, z;
X{
X double cz, dh;
X long dt;
X struct tm *ltm;
X
X cz = cos(z * Degree_to_Radian); /* zenith distance of phenomonon */
X
X do { /* iterate */
X stuff(t0); /* compute declination and current hour angle */
X dh= -tp*sd/cd + cz/(cp*cd);
X if ((dh < -1.0) || (dh > 1.0))
X return("none");
X dh=acos(dh)*rs;
X dt= (dh - lhr) / Tsec_to_Radian;
X t0 += dt;
X } while (dt);
X
X t0 += 30 /* seconds, rounding to nearest minute */;
X ltm = localtime(&t0);
X sprintf(rbuf, "%02d:%02d %s", ltm->tm_hour, ltm->tm_min, timezone(tzp.tz_minuteswest, ltm->tm_isdst));
X return(rbuf);
X}
X
Xchar *
Xmoonrise(t0, rs, z)
X long t0;
X double rs, z;
X{
X#define SRATE 1.033863192 /* ratio of Moon's motion to Sun's motion */
X double cz, dh, sd, cd;
X long t1, dt;
X struct tm *ltm;
X
X moondata(t0); /* get starting declination of Moon */
X
X /* compute zenith distance of phenomonon */
X cz = cos(z * Degree_to_Radian + SD /* -px */);
X
X /* first iteraton is forward only (to approx. phenom time) */
X sd = sin(dm);
X cd = cos(dm);
X dh= -tp*sd/cd + cz/(cp*cd);
X if ((dh < -1.0) || (dh > 1.0))
X return("none");
X dh= acos(dh)*rs;
X dt= fmod((dh - am), 2.0*Pi) * SRATE / Tsec_to_Radian;
X t1 = t0 + dt;
X
X do { /* iterate */
X moondata(t1); /* compute declination and current hour angle */
X cz = cos(z * Degree_to_Radian + SD /* -px */);
X sd = sin(dm);
X cd = cos(dm);
X
X dh= -tp*sd/cd + cz/(cp*cd);
X if ((dh < -1.0) || (dh > 1.0))
X return("none");
X dh= acos(dh)*rs;
X dt= (dh - am) * SRATE / Tsec_to_Radian;
X t1 += dt;
X } while (dt);
X
X if ((t1 - t0) >= Sec_per_day)
X return("none");
X t1 += 30 /* seconds, rounding to nearest minute */;
X ltm = localtime(&t1);
X sprintf(rbuf, "%02d:%02d %s", ltm->tm_hour, ltm->tm_min, timezone(tzp.tz_minuteswest, ltm->tm_isdst));
X return(rbuf);
X}
X
Xstuff(tim)
Xlong tim;
X{ /* main computation loop */
X
X timedata(tim);
X
X/* where is the Sun (angles are in seconds of arc) */
X/* Low precision elements from 1985 Almanac */
X
X L= 280.460 + 0.9856474 * MJD; /* Mean Longitde */
X L = fmod(L, 360.); /* corrected for aberration */
X
X g= 357.528 + 0.9856003 * MJD; /* Mean Anomaly */
X g = fmod(g, 360.);
X
X eps= 23.439 - 0.0000004 * MJD; /* Mean Obiquity of Ecliptic */
X
X { /* convert to R.A. and DEC */
X double Lr, gr, epsr, lr, ca, sa, R;
X double sA, cA, gphi;
X
X Lr = L * Degree_to_Radian;
X gr = g * Degree_to_Radian;
X epsr = eps * Degree_to_Radian;
X
X lr = (L + 1.915*sin(gr) + 0.020*sin(2.0*gr)) * Degree_to_Radian;
X
X sd = sin(lr) * sin(epsr);
X cd = sqrt(1.0 - sd*sd);
X sa = sin(lr) * cos(epsr);
X ca = cos(lr);
X
X delta = asin(sd);
X alpha = atan2(sa, ca);
X
X /* equation of time */
X Eqt= (Lr - alpha) / Tsec_to_Radian;
X
X delta = delta / Asec_Radian;
X alpha = alpha / Tsec_to_Radian;
X
X lhr = (LST - alpha) * Tsec_to_Radian;
X sh = sin(lhr);
X ch = cos(lhr);
X lhr= atan2(sh, ch); /* normalized -pi to pi */
X lha= lhr / Tsec_to_Radian + Sec_per_day/2;
X
X /* convert to Azimuth and altitude */
X
X alt = asin(sd*sp + cd*ch*cp);
X ca = cos(alt);
X sA = -cd * sh / ca;
X cA = (sd*cp - cd*ch*sp) / ca;
X Az = atan2(sA, cA) / Asec_Radian;
X Az = fmod(Az, 1296000. /* 360.*3600. */);
X alt = alt / Asec_Radian;
X }
X}
X
Xmoondata(tim)
Xlong tim;
X{
X double lst, beta, rm, sa, ca, sl, cl, sb, cb, x, y, z, l, m, n;
X
X/* compute location of the moon */
X/* Ephemeris elements from 1985 Almanac */
X
X timedata(tim);
X
X Lm= 218.32 + 481267.883*Tu
X + 6.29 * sin((134.9 + 477198.85*Tu)*Degree_to_Radian)
X - 1.27 * sin((259.2 - 413335.38*Tu)*Degree_to_Radian)
X + 0.66 * sin((235.7 + 890534.23*Tu)*Degree_to_Radian)
X + 0.21 * sin((269.9 + 954397.70*Tu)*Degree_to_Radian)
X - 0.19 * sin((357.5 + 35999.05*Tu)*Degree_to_Radian)
X - 0.11 * sin((186.6 + 966404.05*Tu)*Degree_to_Radian);
X
X beta= 5.13 * sin(( 93.3 + 483202.03*Tu)*Degree_to_Radian)
X + 0.28 * sin((228.2 + 960400.87*Tu)*Degree_to_Radian)
X - 0.28 * sin((318.3 + 6003.18*Tu)*Degree_to_Radian)
X - 0.17 * sin((217.6 - 407332.20*Tu)*Degree_to_Radian);
X
X px= 0.9508
X + 0.0518 * cos((134.9 + 477198.85*Tu)*Degree_to_Radian)
X + 0.0095 * cos((259.2 - 413335.38*Tu)*Degree_to_Radian)
X + 0.0078 * cos((235.7 + 890534.23*Tu)*Degree_to_Radian)
X + 0.0028 * cos((269.9 + 954397.70*Tu)*Degree_to_Radian);
X
X/* SD= 0.2725 * px; */
X
X rm= 1.0 / sin(px * Degree_to_Radian);
X
X lst= (100.46 + 36000.77*Tu) * Degree_to_Radian
X + ((tim % Sec_per_day) + Local) * Tsec_to_Radian;
X
X/* form geocentric direction cosines */
X
X sl= sin(Lm * Degree_to_Radian);
X cl= cos(Lm * Degree_to_Radian);
X sb= sin(beta* Degree_to_Radian);
X cb= cos(beta * Degree_to_Radian);
X
X l= cb * cl;
X m= 0.9175 * cb * sl - 0.3978 * sb;
X n= 0.3978 * cb * sl + 0.9175 * sb;
X
X/* R.A. and Dec of Moon, geocentric*/
X
X am= atan2(m, l);
X dm= asin(n);
X
X/* topocentric rectangular coordinates */
X
X cd= cos(dm);
X sd= n;
X ca= cos(am);
X sa= sin(am);
X sl= sin(lst);
X cl= cos(lst);
X
X x= rm * cd *ca - cp * cl;
X y= rm * cd * sa - cp * sl;
X z= rm * sd - sp;
X
X/* finally, topocentric Hour-Angle and Dec */
X
X am = lst - atan2(y, x);
X ca = cos(am);
X sa = sin(am);
X am = atan2(sa,ca);
X rm = sqrt(x*x + y*y + z*z);
X dm = asin(z/rm);
X px = asin(1.0 / rm);
X SD = 0.2725 * px;
X}
X
Xtimedata(tim)
Xlong tim;
X{
X
X/* compute seconds from 2000 Jan 1.5 UT (Ephemeris Epoch) */
X/* the VAX Epoch is 1970 Jan 1.0 UT (Midnight on Jan 1) */
X
X Julian_Day = (tim/Sec_per_day) +
X (double)(tim % Sec_per_day)/Sec_per_day + J1970;
X MJD= Julian_Day -J2000; /* Julian Days past Epoch */
X Tu = MJD/36525.; /* Julian Centuries past Epoch */
X
X/* compute Sidereal time */
X
X Ru= 24110.54841 + Tu * (8640184.812866
X + Tu * (0.09304 - Tu * 6.2e-6)); /* seconds */
X GMST = (tim % Sec_per_day) + Sec_per_day + fmod(Ru, (double)Sec_per_day);
X LST = GMST + Local;
X}
X
X/* time functions */
Xchar *gmctime(t)
Xlong *t;
X{
X return(asctime(gmtime(t)));
X}
X
X/* double precision modulus, put in range 0 <= result < m */
Xdouble fmod(x, m)
Xdouble x, m;
X{
X long i;
X
X i = fabs(x)/m; /* compute integer part of x/m */
X if (x < 0) return( x + (i+1)*m);
X else return( x - i*m);
X}
X#endif /* NO_SUN_MOON */
SHAR_EOF
if test 13167 -ne "`wc -c < 'riseset.c'`"
then
echo shar: error transmitting "'riseset.c'" '(should have been 13167 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'riseset.h'" '(2432 characters)'
if test -f 'riseset.h'
then
echo shar: will not over-write existing file "'riseset.h'"
else
sed 's/^ X//' << \SHAR_EOF > 'riseset.h'
X/*
X * $Header: riseset.h,v 2.1 89/05/09 14:25:32 billr Exp $
X */
X/*
X * riseset.h
X *
X * Author: Bill Randle, Tektronix, Inc. <billr at saab.CNA.TEK.COM>
X *
X * Copyright (C) 1989, Tektronix, Inc. All Rights Reserved
X *
X * Permission is hereby granted to use and modify this code in source
X * or binary form as long as it is not sold for profit and this copyright
X * notice remains intact.
X */
X/*
X * Geographic coordinates of this physical location (if known).
X * [121-08'-56"W x 44-15'-15"N == Redmond, Oregon, USA]
X * [122-15'-12"W x 37-29'-00"N == Golden Gate Park, San Francisco, CA, USA]
X * If the longitude is not known, the local time offset is derived
X * from the timezone information (tzp.tz_minuteswest). If the
X * latitude is not known, the default used is 34-0'-0" - the approximate
X * centerline of the U.S.
X *
X * To find your local coordinates, call the local Flight Service Station
X * (in the U.S., look under Transportation, Department of - FSS) and
X * ask for the latitude and longitude of your local airport. That
X * will probably be close enough. Other useful sources are a local
X * planetarium, science museum, Dept. of Astronomy, or library.
X */
X#define LONG_DEGREES 121. /* if unknown comment this out */
X#define LONG_MINUTES 08.
X#define LONG_SECONDS 56.
X#define LAT_DEGREES 44. /* if unknown comment this out */
X#define LAT_MINUTES 15.
X#define LAT_SECONDS 15.
X
X/*#undef LONG_DEGREES /* if longitude unknown, uncomment this line */
X/*#undef LAT_DEGREES /* if latitude unknown, uncomment this line */
X
X/*
X * index into riseset_buf[]
X */
X#define B_GMT 0 /* Greenwich Mean Time (GMT) (==UTC) */
X#define B_TDT 1 /* Terrestrial Dynamical Time */
X#define B_LCT 2 /* Local Civil Time */
X#define B_LMT 3 /* Local Mean Time */
X#define B_POM 4 /* Phase Of Moon */
X#define B_JLD 5 /* Julian Day */
X#define B_GST 6 /* Greenwich Mean Sideral Time */
X#define B_LST 7 /* Local Sidereal Time */
X#define B_LHA 8 /* L.H.A. of Sun */
X#define B_SDE 9 /* Declination of Sun */
X#define B_SAZ 10 /* Azimuth of Sun */
X#define B_SEL 11 /* Elevation of Sun */
X#define B_SRD 12 /* Sun Rise Today */
X#define B_SSD 13 /* Sun Set Today */
X#define B_SRT 14 /* Sun Rise Tomorrow */
X#define B_SST 15 /* Sun Set Tomorrow */
X#define B_MRD 16 /* Moon Rise Today */
X#define B_MSD 17 /* Moon Set Today */
X#define B_MRT 19 /* Moon Rise Tomorrow */
X#define B_MST 20 /* Moon Set Tomorrow */
X#define B_DMY 21 /* Day-Month-Year */
X
X#define B_SIZE (B_DMY+1)
SHAR_EOF
if test 2432 -ne "`wc -c < 'riseset.h'`"
then
echo shar: error transmitting "'riseset.h'" '(should have been 2432 characters)'
fi
fi # end of overwriting check
# End of shell archive
exit 0
More information about the Comp.sources.sun
mailing list