[comp.sources.atari.st] v01i092: starchrt -- Diffs to Unix starchart program for ST part01/02

koreth@ssyx.ucsc.edu (Steven Grimm) (01/19/89)

Submitted-by: cs.buffalo.edu!sigmast!dgy
Posting-number: Volume 1, Issue 92
Archive-name: starchrt/part01

This archive contains the patches needed to get starchart 2.0 running on the
ST, along with the driver for the ST's color monitor and the utility programs
provided with the companion posting in comp.binaries.atari.st.

#!/bin/sh
# shar:	Shell Archiver  (v1.22)
#
# This is part 1 of a multipart archive                                    
# do not concatenate these parts, unpack them in order with /bin/sh        
#
#	Run the following text with /bin/sh to create:
#	  Makefile.st
#	  README
#	  README.2
#	  moonphse.dif
#	  planet.dif
#	  staranim.c
#	  starargs.c
#	  starchrt.dif
#	  starlase.dif
#	  starpost.dif
#	  starst.c
#
if test -r s2_seq_.tmp
then echo "Must unpack archives in sequence!"
     next=`cat s2_seq_.tmp`; echo "Please unpack part $next next"
     exit 1; fi
sed 's/^X//' << 'SHAR_EOF' > Makefile.st &&
X#
X# Author: Petri Launiainen, Intrinsic Oy, Tampere, FINLAND (pl@intrin.FI)
X#
X# Based on the work of Alan W. Paeth
X#
X# Modified by Dave Yearke (dgy@sigmast) for the Atari ST,
X# using Mark Williams C, version 3.0.6.
X
XLOCAL=-DST_MWC
X#
X# put the Yale Star Catalog file path here: because the yale.star is
X# static (stars don't change so often :->), consider using some static
X# library path here - relative one is used for quick testing
X
XSTAR = "yale.str"
X
X# similarly assign the Messier file path:
X
XMESS = "messier.str"
X
X# and the constellation finder file:
X
XCONS = "con.loc"
X
X# put the planet position file path here: it should be preferably
X# relative, thus allowing everyone to change planet positions according
X# to their interests.  This file changes when the 'planet' program is
X# executed
X
XPLANET = "planet.str"
X
X# notice that starchart.o and planet are made dependent on Makefile, due
X# to the STARFILE, MESSFILE, CONSTFILE and PLANETFILE definitions here
X
XCFLAGS = -VCOMPAC -VPEEP -DSTARFILE='$(STAR)' -DPLANETFILE='$(PLANET)' \
X         -DCONSTFILE='$(CONS)' -DMESSFILE='$(MESS)' $(LOCAL)
X# MWC needs -f to include floating point printf() routines
XLFLAGS = -s -f
XLIBS= -lm
X
X# star chart calculation routine file
X
XCOBJ = starchrt.o
X
X# default binary names: if you change these, change also the corresponding
X# make tags
X
XBINS = epoch.ttp moonphse.tos planet.ttp starlase.ttp starpost.ttp starst.ttp
X
Xtest:
X	starst -c ori
X
Xall:	\
X	planet.ttp\
X	starpost.ttp\
X	starlase.ttp\
X	starst.ttp\
X	epoch.ttp\
X	moonphse.tos
X	@echo Everything has been compiled.
X
Xstarchrt.o: starchrt.c Makefile starchrt.h
X
Xmoonphse.tos: moonphse.c
X	cc $(CFLAGS) $(LFLAGS) moonphse.c $(LIBS) -o $@
X
Xepoch.ttp: epoch.c
X	cc $(CFLAGS) $(LFLAGS) epoch.c $(LIBS) -o $@
X
X# DO NOT use -DCOMPAC on planet or the linker will go nuts!
Xtest.ttp: test.c Makefile
X	cc $(LFLAGS) $(LOCAL) -DPLANETFILE='$(PLANET)' -VPEEP \
X	   test.c $(LIBS) -o $@
X
Xplanet.ttp: planet.c Makefile
X	cc $(LFLAGS) $(LOCAL) -DPLANETFILE='$(PLANET)' -VPEEP \
X	   planet.c $(LIBS) -o $@
X
Xstarlase.ttp: $(COBJ) starlase.o starimag.o
X	cc $(LFLAGS) $(COBJ) starlase.o starimag.o $(LIBS) -o $@
X
Xstarpost.ttp: $(COBJ) starpost.o
X	cc $(LFLAGS) $(COBJ) starpost.o $(LIBS) -o $@
X
X# Recompile starchrt.o to elide the die() function.
Xstarst.ttp: starst.o
X	cc $(CFLAGS) -DINTERACTIVE -c starchrt.c
X	cc $(LFLAGS) $(COBJ) starst.o $(LIBS) -laes -lvdi -o $@
X	rm starchrt.o
X
Xstarargs.tos: starargs.c
X	cc -s -VSMALL -VPEEP starargs.c -o $@
X
Xstaranim.ttp: staranim.c
X	cc -s -VSMALL -VPEEP staranim.c -o $@
Xclean:
X	rm -f *.o mlog core
SHAR_EOF
chmod 0600 Makefile.st || echo "restore of Makefile.st fails"
sed 's/^X//' << 'SHAR_EOF' > README &&
XA hack is used to determine if "moonphse," "planet," "starst," or "staranim"
Xis running from the desktop or the shell.  If the environment variable "PATH"
Xis not set or has a null value, the program assumes it was run from the
Xdesktop and will wait for a keypress before exiting.  If "PATH" is set, it
Xassumes it was run from a shell (since "PATH" is meaningless to the desktop)
Xand will usually exit immediately, the exception being "STARST.TTP" as
Xdescribed in the readme file for the executables.
X
XTwo defines were added to starchart:  ST_MWC defines the Atari ST with the
XMark Williams C compiler, and INTERACTIVE means that the program must reset
Xthe terminal before exiting, so the function die() is located in the driver
Xsource file instead of in starchrt.c for better portability.
X
XReally, very few changes were necessary.  A couple of frustrating bugs turned
Xout to be caused by Mark Williams C's definition of an "int" as 16 bits, which
Xcaused very large numbers to become smaller, negative ones.  Casting them to
X"long" solved the problem, but, as usual, fixing the problem was much easier
Xthan finding it.
X
XNames of programs were changed as follows because of the ST's MS-DOS-like file
Xstructure:
X     moonphase.c --> moonphse.c
X     starchart.c --> starchrt.c
X     starchart.h --> starchrt.h
X     starimages.c --> starimag.c
X     starlaser.c --> starlase.c
X
XBe warned that compiling "planet" requires almost a full megabyte of memory.
XWith my 1040 I had to remove ALL desk accessories and AUTO folder programs,
Xand even then had to redirect the output of "make -n planet.ttp" into a file
Xand invoke it as a shell script, due to the overhead of running "make."
X
XSee the file "readme.2" for the readme files that were included with the
Xoriginal distributions.
X
XObligatory Caveat:  I make no guarantees as to the robustness or accuracy of
Xthis port of starchart.  While I am sure there are no devestating bugs in it,
Xshould one appear I am not responsible for any damage or misinformation it
Xmay cause.
X
XAll programs were compiled with Mark Williams C, version 3.0.6; portions of
Xthese programs copyright 1984, Mark Williams Company.
X
Xquestions or comments on the ST version only should go to:
Xdgy@sigmast.UUCP (Dave Yearke, Sigma Systems Technology, Inc.)
SHAR_EOF
chmod 0600 README || echo "restore of README fails"
sed 's/^X//' << 'SHAR_EOF' > README.2 &&
XREADME1 ==================================================================
X
XSTARCHART (rev 2)
X----------------------------------------------------------------------------
XNote: This version is upward compatable with the original "starchart" software
Xfamily, both in user interface and in continued support of the original
Xreduced Yale catalog. Thus, it may supplant old copies of the software without
Xfear that either shell scripts or file formats will become invalid.
X
XHowever, both the new user interface and the extended catalog are
Xsuperior, as are extensions for additional labelling (Greek characters,
Xdouble star indicators, Messier objects), plus a mnemonic "finder" facility.
X----------------------------------------------------------------------------
X
XINSTALLATION INSTRUCTIONS:
X
X[1]
XSave the new posting of the reduced Yale Star Catalog under the name
X"yale.star" (or use a copy of the old version). If the save directory is other
Xthan the one in which the program lives, then check out the Makefile, which
Xallows path names to be specified for compilation.
X
XSites without much disk space may truncate the file yale.star at any point,
Xas the data is sorted in order of increasing magnitude (dimming).
X
XAdditonally, the optional files "messier.star" and "con.locs" should be
Xplaced in the chosen directory. Entries in these files are unsorted. The
Xoptional file "planet.star" is created on an as-needed basis by the softwaare
X"planet.c", and might want a home in some less permanent (writable) location.
X
X[2]
XDo a "make all" to compile all software. They are described in the man pages
X"starchart.1" and "planet.1" . All compile using starchart.c as the mainline,
Xwith device driver specifics in modules of appropriate name.
X
X[3]
XYou may now try "man test" to make an Orion pic file similar to the one
Xposted to the net. Or you may test by outputting to the tty display, using the
Xversion "stardsp". This is described in the EXAMPLE section of the man page.
X
XVERSION NOTES:
X
XTty display users (*sigh*) may which to alter "stardsp" to output
Xto the display using an appropriate number of of rows and columns
Xon the screen. (Presently 31x79 for a 32x80 display. 23x79 is a
Xbit sparse).  Find the ROWS and COLS #defines in stardsp.c
Xand update. Or be really ambitious and recode them as run time
Xvariables.
X
XTektronix emulator users may wish to alter scaling parameters based on the
Xactual physical dimensions of the display raster, to get the cleanest possible
Xstar glyphs on output. This is described at length in the beginning of the
Xdriver "startek.c".
X
XPic file users: the #define PICFRAG can be adjusted downward
X(presently 8) should your pic input overflow pic's buffers. This
Xhappens when a long move,draw,draw,...,draw sequence happens.
XSmaller  PICFRAGs make larger files, by forming fragmented
Xmove,draw commands.
X
XPostScript users: you may wish to play with the boiler-plate macros which
Xdefine star shapes (e.g. 's1' does first magnitude stars). This is mentioned
Xat the end of starchart.c
X
XLaserjet users: the output of starlaser must be directed to
Xlaserjet via raw connection, because it is largely sent in binary
X8-bit format. The graphics memory might overflow if you use the
Xstandard (oldest) 59k buffer laserjet (*sigh*). Anyway, I haven't
Xever lost any relevant data on the sheet: the overflow has occurred on
Xthe last few blank pixel rows of the graphics area. If you use
Xlaserjet plus, you shouldn't have any problems.
X
XOther devices: don't expect the authors to write a new driver for you :-)
XLook through the sources - it's not so difficult after all... The module
X"starimages.c" provides support for bitmap devices; the PostScript driver
Xis a good example of generating output in some graphics language.
X
XMore ambitious programmers may wish to extend the usefulness of these programs.
XBe our guest, but carefully consider the proposed list of suggestions which
Xintentionally accompanies the main source code body "starchart.c". It is hoped
Xthat future changes and major revisions and their subsequent integration will
Xbe kept relatively simple by coordinating efforts and by not duplicating work.
X
Xawpaeth@watcgl (original author and revisions editor)
Xinp@amber.berkeley.EDU (revisionist for user interface)
Xpl@sibelius.intrin.FI (support for mini-Yale, Messier and finder catalogs)
X
XREADME2 ==================================================================
X
X[ from awpaeth: ]
XThis is the SOFTWARE update kit for StarChart version #2
Xwhich was released in Nov/Dec 1987. The kit performs an upgrade to ver #2.1
XNo upgrades to yale.star or other .star files occurs.
X
XThis kit updates StarChart version #2 software as it appeared in that release -
Xno other patches should already be in place. Virgin copies of version #2 are
Xavailable from the moderator of comp.sources.unix.
X
X
XOverview of Changes
X
XMore portability across sysV and IRIS UNIX installations.
XA particularly nasty bug in planet.c was removed.
XTwo new device drivers were added (Unix Plot(5) and Iris).
XStarChart now performs full clipping of vectors.
XAdditional flags for creating stylized output and larger displays.
XPostScript now has nicer symbols for non-stellar objects.
XMore detailed patch and upgrade notes appear in the source code.
X
XFILES
X
XName			Description/Instructions
X----			------------------------
XREADME			this file
Xpatch-*			patches for moonphase.c, planet.c, drivers, yaleformat
Xpatchall		runs the above patches on the originals
Xstarchart.1		new man page
Xstarchart.c		rewritten main driver (easier to reinstall then patch)
Xstarchart.h		accompanying new .h file for above (ditto)
Xstariris.c		new IRIS driver		
Xstaruplot.c		new UNIX Plot(5) driver
X
XREADME3 ==================================================================
X
XOver the last few weeks I have generated a database of constellation 
Xboundaries.  This database does NOT include the constellation figures, just
Xthe boundaries defining the area of the sky the constellation contains.
XThis database is in the 'old starchart' format, thus it will work for the
Xrecently posted starchart version 2.0 and the original starchart 1.0.
X
XThis data was hand compiled from the Sky_Atlas_2000.0.  Each constellation 
Xhas it's entire boundary defined, thus each adjacent constellation will define 
Xthe same vector (it will exist twice in the database).
X
XTo make this work for the starchart program, a modification is needed in the
X'chartobjects' procedure.  I have included the entire procedure in the
Xshar file following this message.  The only changes were at the top where
XI added some simple window clipping checks for the vectors and a couple
Xof new variables.  Any vector outside the defined window will be converted 
Xto a 'move' command and placed at the window edge.  You can either replace
Xthe entire procedure or just make the necessary changes.
X
XIf you wish the boundaries to always be charted, you should modify the 
Xstarchart.c module to read in and chart the boundary.star file just like 
Xthe other databases.  If you only rarely chart them, then just use the
X'-f' option in starchart version 2.0
X
XHave fun.
XDave
X
XUUCP: {decvax,ucbvax,ihnp4,hplabs,sun,ames,prls}!decwrl!mips!vanthof
Xor    vanthof@mips.com     (really Dave Van't Hof)
XUSPS: MIPS Computer Systems, 930 Arques, Sunnyvale, CA 94086, (408) 991-0242
X"Always? No. Never question authority."  What I say is mine.
SHAR_EOF
chmod 0600 README.2 || echo "restore of README.2 fails"
sed 's/^X//' << 'SHAR_EOF' > moonphse.dif &&
X*** ../starchart/moonphase.c	Mon Sep 19 09:11:06 1988
X--- moonphse.c	Mon Sep 26 08:00:23 1988
X***************
X*** 12,17 ****
X--- 12,21 ----
X  ! modified by awpaeth@watcgl, December 1987 for sysV compatability
X  ****************************************************************************/
X  
X+ #ifdef ST_MWC /* Mark Williams C for the Atari ST */
X+ #define SYSV /* MWC is almost SYSV compatible */
X+ #endif  /* ST_MWC */
X+ 
X  #include <stdio.h>
X  #ifndef SYSV
X  #include <sys/time.h>
X***************
X*** 19,25 ****
X--- 23,35 ----
X  #include <time.h>
X  #endif
X  #include <math.h>
X+ #ifdef ST_MWC
X+ #include <osbind.h> /* Needed for Cconws() and Crawcin() */
X+ #define cfree() free() /* MWC doesn't have cfree() */
X+ #endif /* ST_MWC */
X+ #ifndef PI
X  #define PI         3.141592654
X+ #endif
X  #define EPOCH   1983
X  #define EPSILONg 279.103035     /* solar ecliptic long at EPOCH */
X  #define RHOg     282.648015     /* solar ecliptic long of perigee at EPOCH */
X***************
X*** 34,40 ****
X--- 44,55 ----
X  double adj360();
X  double potm();
X  
X+ #ifdef ST_MWC
X+ extern char *getenv(); /* Used to see if we're running from the desktop */
X+ time_t lo;
X+ #else /* !ST_MWC */
X  long *lo = (long *) calloc (1, sizeof(long)); /* used by time calls */
X+ #endif /* ST_MWC */
X  struct tm *pt; /* ptr to time structure */
X  
X  double days;   /* days since EPOCH */
X***************
X*** 42,50 ****
X--- 57,70 ----
X  double phase2; /* percent of lunar surface illuminated one day later */
X  int i = EPOCH;
X  
X+ #ifdef ST_MWC
X+ time (&lo);  /* get system time */
X+ pt = gmtime(&lo);  /* get ptr to gmt time struct */
X+ #else /* !ST_MWC */
X  time (lo);  /* get system time */
X  pt = gmtime(lo);  /* get ptr to gmt time struct */
X  cfree(lo);
X+ #endif /* ST_MWC */
X  
X  /* calculate days since EPOCH */
X  days = (pt->tm_yday +1) + ((pt->tm_hour + (pt->tm_min / 60.0)
X***************
X*** 82,87 ****
X--- 102,115 ----
X        printf("Waning ");
X     printf("Crescent (%1.0f%% of Full)\n", phase);
X     }
X+ #ifdef ST_MWC /* We want to hold the screen if invoked from the GEM desktop; */
X+            /* the desktop doesn't usually set any environment variables, */
X+            /* and if getenv() does find anything, it's probably empty */
X+ if (((getenv("PATH")) == 0) || (strlen(getenv("PATH")) == 0)) {
X+      Cconws("press any key to continue: "); /* Hold screen if desktop */
X+      i = Crawcin(); /* Read raw character input */
X+ }
X+ #endif /* ST_MWC */
X  }
X  
X  double potm(days)
SHAR_EOF
chmod 0600 moonphse.dif || echo "restore of moonphse.dif fails"
sed 's/^X//' << 'SHAR_EOF' > planet.dif &&
X*** ../starchart/planet.c	Mon Sep 19 09:11:43 1988
X--- planet.c	Mon Sep 26 08:00:31 1988
X***************
X*** 45,57 ****
X  #include <stdio.h>
X  #include <math.h>
X  
X  #ifndef SYSV
X  #include <sys/time.h>	/* for getting current GMT (generic Unix) */
X  #else
X  #include <time.h>	/* for getting current GMT (sysV version) */
X  #endif
X  
X! #define CURYEAR	1987	/* default year -- needs to be maintained */
X  
X  #ifndef PLANETFILE
X  #define PLANETFILE "./planet.star"
X--- 45,62 ----
X  #include <stdio.h>
X  #include <math.h>
X  
X+ #ifdef ST_MWC /* Mark Williams C for the Atari ST */
X+ #define SYSV /* MWC is almost SYSV compatible */
X+ #include <osbind.h> /* Needed for Cconws() and Crawcin() */
X+ #endif /* ST_MWC */
X+ 
X  #ifndef SYSV
X  #include <sys/time.h>	/* for getting current GMT (generic Unix) */
X  #else
X  #include <time.h>	/* for getting current GMT (sysV version) */
X  #endif
X  
X! #define CURYEAR	1989	/* default year -- needs to be maintained */
X  
X  #ifndef PLANETFILE
X  #define PLANETFILE "./planet.star"
X***************
X*** 68,73 ****
X--- 73,84 ----
X  #define MAGURA 590
X  #define MAGNEP 800
X  
X+ #ifdef ST_MWC
X+ #define daylight tt.tm_isdst
X+ extern char *getenv(); /* used to see if we're running from the desktop */
X+ struct tm_t *tt;
X+ #endif /* ST_MWC */
X+ 
X  double pie, rad;
X  double htod(), atof(), kepler(), truean();
X  double longi(), lati(), poly(), aint(), range();
X***************
X*** 119,125 ****
X--- 130,138 ----
X      gettimeofday(&tv, &tz);
X      return(GMT1970 + tv.tv_sec/SECSPERDAY);
X  #else
X+ #ifndef ST_MWC
X      long time();
X+ #endif /* ST_MWC */
X      return(GMT1970 + (double)time((long *)0)/SECSPERDAY);
X  #endif
X      }
X***************
X*** 201,207 ****
X      aa1 = (int) (year/100);
X      bb1 = 2 - aa1 + (int)(aa1/4);
X      jd = aint(365.25*year) + aint(30.6001*(month + 1));
X!     jd = jd  + day + 1720994.5;
X      if((year + month/100) > 1582.10) jd = jd + bb1;
X      return(jd);
X      }
X--- 214,220 ----
X      aa1 = (int) (year/100);
X      bb1 = 2 - aa1 + (int)(aa1/4);
X      jd = aint(365.25*year) + aint(30.6001*(month + 1));
X!     jd += day + 1720994.5;
X      if((year + month/100) > 1582.10) jd = jd + bb1;
X      return(jd);
X      }
X***************
X*** 218,224 ****
X--- 231,243 ----
X  	double N,D,epli,thapp,omeg;
X  	double nu2,P,Q,S,V,W,ze,l1pert,epert,w1pert,apert;
X  	double psi,H,G,eta,th;
X+ #ifdef ST_MWC
X+ 	time_t now;
X  
X+ 	now = time((long) 0);
X+ 	tt = localtime(&now);
X+ #endif /* ST_MWC */
X+ 
X  #define WRITEMODE "w"
X  #define OPENFAIL 0
X  	progname = argv[0];
X***************
X*** 321,327 ****
X  		RA = atan2(N,D)/rad;
X  		DEC = asin(sin(epli*rad)*sin(thapp*rad))/rad;
X  		speak(RA,DEC,Sr, MAGSOL, "PS", "Sol");
X! /* tansformation of coordinates on Mercury and output */
X  		trans(r,b,ll,Stheta,Sr,epli, MAGMER, "PM", "Mercury");
X  		
X  /* Now start on Venus */
X--- 340,346 ----
X  		RA = atan2(N,D)/rad;
X  		DEC = asin(sin(epli*rad)*sin(thapp*rad))/rad;
X  		speak(RA,DEC,Sr, MAGSOL, "PS", "Sol");
X! /* transformation of coordinates on Mercury and output */
X  		trans(r,b,ll,Stheta,Sr,epli, MAGMER, "PM", "Mercury");
X  		
X  /* Now start on Venus */
X***************
X*** 373,380 ****
X  	radpert = 0.000022501 * cos((2*M-2*M2-58.208)*rad)
X  		 +0.000019045 * cos((3*M-3*M2+92.577)*rad)
X  		 +0.000006887 * cos((M5-M2-118.090)*rad)
X! 		 +0.000005172 * cos((M-M2-29.110)*rad)
X! 		 +0.000003620 * cos((5*M-4*M2-104.208)*rad)
X  		 +0.000003283 * cos((4*M-4*M2+63.513)*rad)
X  		 +0.000003074 * cos((2*M5-2*M2-55.167)*rad);
X  	r = r + radpert;
X--- 392,399 ----
X  	radpert = 0.000022501 * cos((2*M-2*M2-58.208)*rad)
X  		 +0.000019045 * cos((3*M-3*M2+92.577)*rad)
X  		 +0.000006887 * cos((M5-M2-118.090)*rad)
X! 		 +0.000005172 * cos((M-M2-29.110)*rad);
X! 	radpert+= 0.000003620 * cos((5*M-4*M2-104.208)*rad)
X  		 +0.000003283 * cos((4*M-4*M2+63.513)*rad)
X  		 +0.000003074 * cos((2*M5-2*M2-55.167)*rad);
X  	r = r + radpert;
X***************
X*** 425,432 ****
X  	lonpert = 0.00705*cos((M5-M4-48.958)*rad)
X  		 +0.00607*cos((2*M5-M4-188.350)*rad)
X  		 +0.00445*cos((2*M5-2*M4-191.897)*rad)
X! 		 +0.00388*cos((M-2*M4+20.495)*rad)
X! 		 +0.00238*cos((M-M4+35.097)*rad)
X  		 +0.00204*cos((2*M-3*M4+158.638)*rad)
X  		 +0.00177*cos((3*M4-M2-57.602)*rad)
X  		 +0.00136*cos((2*M-4*M4+154.093)*rad)
X--- 444,451 ----
X  	lonpert = 0.00705*cos((M5-M4-48.958)*rad)
X  		 +0.00607*cos((2*M5-M4-188.350)*rad)
X  		 +0.00445*cos((2*M5-2*M4-191.897)*rad)
X! 		 +0.00388*cos((M-2*M4+20.495)*rad);
X! 	lonpert+= 0.00238*cos((M-M4+35.097)*rad)
X  		 +0.00204*cos((2*M-3*M4+158.638)*rad)
X  		 +0.00177*cos((3*M4-M2-57.602)*rad)
X  		 +0.00136*cos((2*M-4*M4+154.093)*rad)
X***************
X*** 445,452 ****
X  	radpert+= 0.000007914*cos((3*M5-2*M4-139.737)*rad)
X  		 +0.000007004*cos((2*M5-3*M4-102.888)*rad)
X  		 +0.000006620*cos((M-2*M4+113.202)*rad)
X! 		 +0.000004930*cos((3*M5-3*M4-76.243)*rad)
X! 		 +0.000004693*cos((3*M-5*M4+190.603)*rad)
X  		 +0.000004571*cos((2*M-4*M4+244.702)*rad)
X  		 +0.000004409*cos((3*M5-M4-115.828)*rad);
X  	r = r + radpert;
X--- 464,471 ----
X  	radpert+= 0.000007914*cos((3*M5-2*M4-139.737)*rad)
X  		 +0.000007004*cos((2*M5-3*M4-102.888)*rad)
X  		 +0.000006620*cos((M-2*M4+113.202)*rad)
X! 		 +0.000004930*cos((3*M5-3*M4-76.243)*rad);
X! 	radpert+= 0.000004693*cos((3*M-5*M4+190.603)*rad)
X  		 +0.000004571*cos((2*M-4*M4+244.702)*rad)
X  		 +0.000004409*cos((3*M5-M4-115.828)*rad);
X  	r = r + radpert;
X***************
X*** 507,513 ****
X  	-(0.003083 + 0.000275*nu2 - 0.000489*nu2*nu2)*sin(2*V)
X  	+0.002472*sin(W)
X  	+0.013619*sin(ze)
X! 	+0.018472*sin(2*ze)
X  	+0.006717*sin(3*ze)
X  	+0.002775*sin(4*ze)
X  	+(0.007275 - 0.001253*nu2)*sin(ze)*sin(Q)
X--- 526,533 ----
X  	-(0.003083 + 0.000275*nu2 - 0.000489*nu2*nu2)*sin(2*V)
X  	+0.002472*sin(W)
X  	+0.013619*sin(ze)
X! 	+0.018472*sin(2*ze);
X! l1pert = l1pert
X  	+0.006717*sin(3*ze)
X  	+0.002775*sin(4*ze)
X  	+(0.007275 - 0.001253*nu2)*sin(ze)*sin(Q)
X***************
X*** 519,525 ****
X  	-(0.035681 + 0.001208*nu2)*sin(ze)*cos(Q)
X  	-0.004261*sin(2*ze)*cos(Q)
X  	+0.002178*cos(Q)
X! 	+(-0.006333 + 0.001161*nu2)*cos(ze)*cos(Q)
X  	-0.006675*cos(2*ze)*cos(Q)
X  	-0.002664*cos(3*ze)*cos(Q)
X  	-0.002572*sin(ze)*sin(2*Q)
X--- 539,546 ----
X  	-(0.035681 + 0.001208*nu2)*sin(ze)*cos(Q)
X  	-0.004261*sin(2*ze)*cos(Q)
X  	+0.002178*cos(Q)
X! 	+(-0.006333 + 0.001161*nu2)*cos(ze)*cos(Q);
X! l1pert = l1pert
X  	-0.006675*cos(2*ze)*cos(Q)
X  	-0.002664*cos(3*ze)*cos(Q)
X  	-0.002572*sin(ze)*sin(2*Q)
X***************
X*** 532,538 ****
X  	-.0006764*sin(ze)*sin(Q)
X  	-.0001110*sin(2*ze)*sin(Q)
X  	-.0000224*sin(3*ze)*sin(Q)
X! 	-.0000204*sin(Q)
X  	+(.0001284 + .0000116*nu2)*cos(ze)*sin(Q)
X  	+.0000188*cos(2*ze)*sin(Q)
X  	+(.0001460 + .0000130*nu2)*sin(ze)*cos(Q)
X--- 553,560 ----
X  	-.0006764*sin(ze)*sin(Q)
X  	-.0001110*sin(2*ze)*sin(Q)
X  	-.0000224*sin(3*ze)*sin(Q)
X! 	-.0000204*sin(Q);
X! epert = epert
X  	+(.0001284 + .0000116*nu2)*cos(ze)*sin(Q)
X  	+.0000188*cos(2*ze)*sin(Q)
X  	+(.0001460 + .0000130*nu2)*sin(ze)*cos(Q)
X***************
X*** 544,550 ****
X  	+.0000508*cos(3*ze)*cos(Q)
X  	+.0000230*cos(4*ze)*cos(Q)
X  	+.0000108*cos(5*ze)*cos(Q)
X! 	-(.0000956 + .0000073*nu2)*sin(ze)*sin(2*Q)
X  	+.0000448*sin(2*ze)*sin(2*Q)
X  	+.0000137*sin(3*ze)*sin(2*Q)
X  	+(-.0000997 + .0000108*nu2)*cos(ze)*sin(2*Q)
X--- 566,573 ----
X  	+.0000508*cos(3*ze)*cos(Q)
X  	+.0000230*cos(4*ze)*cos(Q)
X  	+.0000108*cos(5*ze)*cos(Q)
X! 	-(.0000956 + .0000073*nu2)*sin(ze)*sin(2*Q);
X! epert = epert
X  	+.0000448*sin(2*ze)*sin(2*Q)
X  	+.0000137*sin(3*ze)*sin(2*Q)
X  	+(-.0000997 + .0000108*nu2)*cos(ze)*sin(2*Q)
X***************
X*** 554,560 ****
X  	+(-.0000956 +.0000099*nu2)*sin(ze)*cos(2*Q)
X  	+.0000490*sin(2*ze)*cos(2*Q)
X  	+.0000158*sin(3*ze)*cos(2*Q)
X! 	+.0000179*cos(2*Q)
X  	+(.0001024 + .0000075*nu2)*cos(ze)*cos(2*Q)
X  	-.0000437*cos(2*ze)*cos(2*Q)
X  	-.0000132*cos(3*ze)*cos(2*Q);
X--- 577,584 ----
X  	+(-.0000956 +.0000099*nu2)*sin(ze)*cos(2*Q)
X  	+.0000490*sin(2*ze)*cos(2*Q)
X  	+.0000158*sin(3*ze)*cos(2*Q)
X! 	+.0000179*cos(2*Q);
X! epert = epert
X  	+(.0001024 + .0000075*nu2)*cos(ze)*cos(2*Q)
X  	-.0000437*cos(2*ze)*cos(2*Q)
X  	-.0000132*cos(3*ze)*cos(2*Q);
X***************
X*** 562,568 ****
X  w1pert = (0.007192 - 0.003147*nu2)*sin(V)
X  	+(-0.020428 - 0.000675*nu2 + 0.000197*nu2*nu2)*cos(V)
X  	+(0.007269 + 0.000672*nu2)*sin(ze)*sin(Q)
X! 	-0.004344*sin(Q)
X  	+0.034036*cos(ze)*sin(Q)
X  	+0.005614*cos(2*ze)*sin(Q)
X  	+0.002964*cos(3*ze)*sin(Q)
X--- 586,593 ----
X  w1pert = (0.007192 - 0.003147*nu2)*sin(V)
X  	+(-0.020428 - 0.000675*nu2 + 0.000197*nu2*nu2)*cos(V)
X  	+(0.007269 + 0.000672*nu2)*sin(ze)*sin(Q)
X! 	-0.004344*sin(Q);
X! w1pert = w1pert
X  	+0.034036*cos(ze)*sin(Q)
X  	+0.005614*cos(2*ze)*sin(Q)
X  	+0.002964*cos(3*ze)*sin(Q)
X***************
X*** 573,579 ****
X  	-0.006603*cos(ze)*cos(Q)
X  	-0.005356*sin(ze)*sin(2*Q)
X  	+0.002722*sin(2*ze)*sin(2*Q)
X! 	+0.004483*cos(ze)*sin(2*Q)
X  	-0.002642*cos(2*ze)*sin(2*Q)
X  	+0.004403*sin(ze)*cos(2*Q)
X  	-0.002536*sin(2*ze)*cos(2*Q)
X--- 598,605 ----
X  	-0.006603*cos(ze)*cos(Q)
X  	-0.005356*sin(ze)*sin(2*Q)
X  	+0.002722*sin(2*ze)*sin(2*Q)
X! 	+0.004483*cos(ze)*sin(2*Q);
X! w1pert = w1pert
X  	-0.002642*cos(2*ze)*sin(2*Q)
X  	+0.004403*sin(ze)*cos(2*Q)
X  	-0.002536*sin(2*ze)*cos(2*Q)
X***************
X*** 591,597 ****
X  	+.000693*cos(2*ze)
X  	+.000312*cos(3*ze)
X  	+.000147*cos(4*ze)
X! 	+.000299*sin(ze)*sin(Q)
X  	+.000181*cos(2*ze)*sin(Q)
X  	+.000204*sin(2*ze)*cos(Q)
X  	+.000111*sin(3*ze)*cos(Q)
X--- 617,624 ----
X  	+.000693*cos(2*ze)
X  	+.000312*cos(3*ze)
X  	+.000147*cos(4*ze)
X! 	+.000299*sin(ze)*sin(Q);
X! apert = apert
X  	+.000181*cos(2*ze)*sin(Q)
X  	+.000204*sin(2*ze)*cos(Q)
X  	+.000111*sin(3*ze)*cos(Q)
X***************
X*** 645,651 ****
X  l1pert = (-0.814181 + 0.018150*nu2 + 0.016714*nu2*nu2)*sin(V)
X  	 +(-0.010497 + 0.160906*nu2 - 0.004100*nu2*nu2)*cos(V)
X  	 +0.007581*sin(2*V)
X! 	 -0.007986*sin(W)
X  	 -0.148811*sin(ze)
X  	 -0.040786*sin(2*ze)
X  	 -0.015208*sin(3*ze)
X--- 672,679 ----
X  l1pert = (-0.814181 + 0.018150*nu2 + 0.016714*nu2*nu2)*sin(V)
X  	 +(-0.010497 + 0.160906*nu2 - 0.004100*nu2*nu2)*cos(V)
X  	 +0.007581*sin(2*V)
X! 	 -0.007986*sin(W);
X! l1pert = l1pert
X  	 -0.148811*sin(ze)
X  	 -0.040786*sin(2*ze)
X  	 -0.015208*sin(3*ze)
X***************
X*** 655,661 ****
X  	+(0.008931 + 0.002728*nu2)*sin(ze)*sin(Q)
X  	-0.016500*sin(2*ze)*sin(Q)
X  	-0.005775*sin(3*ze)*sin(Q)
X! 	+(0.081344 + 0.003206*nu2)*cos(ze)*sin(Q)
X  	+0.015019*cos(2*ze)*sin(Q)
X  	+(0.085581 + 0.002494*nu2)*sin(ze)*cos(Q)
X  	+(0.025328 - 0.003117*nu2)*cos(ze)*cos(Q);
X--- 683,690 ----
X  	+(0.008931 + 0.002728*nu2)*sin(ze)*sin(Q)
X  	-0.016500*sin(2*ze)*sin(Q)
X  	-0.005775*sin(3*ze)*sin(Q)
X! 	+(0.081344 + 0.003206*nu2)*cos(ze)*sin(Q);
X! l1pert = l1pert
X  	+0.015019*cos(2*ze)*sin(Q)
X  	+(0.085581 + 0.002494*nu2)*sin(ze)*cos(Q)
X  	+(0.025328 - 0.003117*nu2)*cos(ze)*cos(Q);
X***************
X*** 663,669 ****
X  	+0.014394*cos(2*ze)*cos(Q)
X  	+0.006319*cos(3*ze)*cos(Q)
X  	+0.006369*sin(ze)*sin(2*Q)
X! 	+0.009156*sin(2*ze)*sin(2*Q)
X  	+0.007525*sin(3*psi)*sin(2*Q)
X  	-0.005236*cos(ze)*cos(2*Q)
X  	-0.007736*cos(2*ze)*cos(2*Q)
X--- 692,699 ----
X  	+0.014394*cos(2*ze)*cos(Q)
X  	+0.006319*cos(3*ze)*cos(Q)
X  	+0.006369*sin(ze)*sin(2*Q)
X! 	+0.009156*sin(2*ze)*sin(2*Q);
X! l1pert = l1pert
X  	+0.007525*sin(3*psi)*sin(2*Q)
X  	-0.005236*cos(ze)*cos(2*Q)
X  	-0.007736*cos(2*ze)*cos(2*Q)
X***************
X*** 673,679 ****
X  	+(.0013381 + .0001226*nu2 -.0000253*nu2*nu2)*cos(V)
X  	+(.0000248 - .0000121*nu2)*sin(2*V)
X  	-(.0000305 + .0000091*nu2)*cos(2*V)
X! 	+.0000412*sin(2*ze)
X  	+.0012415*sin(Q)
X  	+(.0000390 -.0000617*nu2)*sin(ze)*sin(Q)
X  	+(.0000165 - .0000204*nu2)*sin(2*ze)*sin(Q)
X--- 703,710 ----
X  	+(.0013381 + .0001226*nu2 -.0000253*nu2*nu2)*cos(V)
X  	+(.0000248 - .0000121*nu2)*sin(2*V)
X  	-(.0000305 + .0000091*nu2)*cos(2*V)
X! 	+.0000412*sin(2*ze);
X! epert = epert
X  	+.0012415*sin(Q)
X  	+(.0000390 -.0000617*nu2)*sin(ze)*sin(Q)
X  	+(.0000165 - .0000204*nu2)*sin(2*ze)*sin(Q)
X***************
X*** 684,690 ****
X  	-.0000821*cos(4*ze)*sin(Q)
X  	-.0000377*cos(5*ze)*sin(Q)
X  	+.0000497*cos(2*psi)*sin(Q)
X! 	+(.0000163 - .0000611*nu2)*cos(Q)
X  	-.0012696*sin(ze)*cos(Q)
X  	-.0004200*sin(2*ze)*cos(Q)
X  	-.0001503*sin(3*ze)*cos(Q)
X--- 715,722 ----
X  	-.0000821*cos(4*ze)*sin(Q)
X  	-.0000377*cos(5*ze)*sin(Q)
X  	+.0000497*cos(2*psi)*sin(Q)
X! 	+(.0000163 - .0000611*nu2)*cos(Q);
X! epert = epert
X  	-.0012696*sin(ze)*cos(Q)
X  	-.0004200*sin(2*ze)*cos(Q)
X  	-.0001503*sin(3*ze)*cos(Q)
X***************
X*** 695,701 ****
X  	+(-.0000086 + .0000230*nu2)*cos(2*ze)*cos(Q)
X  	+.0000461*sin(2*psi)*cos(Q)
X  	-.0000350*sin(2*Q)
X! 	+(.0002211 - .0000286*nu2)*sin(ze)*sin(2*Q)
X  	-.0002208*sin(2*ze)*sin(2*Q)
X  	-.0000568*sin(3*ze)*sin(2*Q)
X  	-.0000346*sin(4*ze)*sin(2*Q)
X--- 727,734 ----
X  	+(-.0000086 + .0000230*nu2)*cos(2*ze)*cos(Q)
X  	+.0000461*sin(2*psi)*cos(Q)
X  	-.0000350*sin(2*Q)
X! 	+(.0002211 - .0000286*nu2)*sin(ze)*sin(2*Q);
X! epert = epert
X  	-.0002208*sin(2*ze)*sin(2*Q)
X  	-.0000568*sin(3*ze)*sin(2*Q)
X  	-.0000346*sin(4*ze)*sin(2*Q)
X***************
X*** 707,713 ****
X  	+.0000467*cos(3*psi)*sin(2*Q)
X  	-.0000490*cos(2*Q)
X  	-(.0002842 + .0000279*nu2)*sin(ze)*cos(2*Q)
X! 	+(.0000128 + .0000226*nu2)*sin(2*ze)*cos(2*Q)
X  	+.0000224*sin(3*ze)*cos(2*Q)
X  	+(-.0001594 + .0000282*nu2)*cos(ze)*cos(2*Q)
X  	+(.0002162 - .0000207*nu2)*cos(2*ze)*cos(2*Q)
X--- 740,747 ----
X  	+.0000467*cos(3*psi)*sin(2*Q)
X  	-.0000490*cos(2*Q)
X  	-(.0002842 + .0000279*nu2)*sin(ze)*cos(2*Q)
X! 	+(.0000128 + .0000226*nu2)*sin(2*ze)*cos(2*Q);
X! epert = epert
X  	+.0000224*sin(3*ze)*cos(2*Q)
X  	+(-.0001594 + .0000282*nu2)*cos(ze)*cos(2*Q)
X  	+(.0002162 - .0000207*nu2)*cos(2*ze)*cos(2*Q)
X***************
X*** 716,722 ****
X  	+.0000343*cos(4*ze)*cos(2*Q)
X  	+.0000469*sin(3*psi)*cos(2*Q)
X  	-.0000242*cos(3*psi)*cos(2*Q)
X! 	-.0000205*sin(ze)*sin(3*Q)
X  	+.0000262*sin(3*ze)*sin(3*Q)
X  	+.0000208*cos(ze)*cos(3*Q)
X  	-.0000271*cos(3*ze)*cos(3*Q)
X--- 750,757 ----
X  	+.0000343*cos(4*ze)*cos(2*Q)
X  	+.0000469*sin(3*psi)*cos(2*Q)
X  	-.0000242*cos(3*psi)*cos(2*Q)
X! 	-.0000205*sin(ze)*sin(3*Q);
X! epert = epert
X  	+.0000262*sin(3*ze)*sin(3*Q)
X  	+.0000208*cos(ze)*cos(3*Q)
X  	-.0000271*cos(3*ze)*cos(3*Q)
X***************
X*** 728,734 ****
X  	-0.007075*sin(ze)
X  	-0.075825*sin(ze)*sin(Q)
X  	-0.024839*sin(2*ze)*sin(Q)
X! 	-0.008631*sin(3*ze)*sin(Q)
X  	-0.072586*cos(Q)
X  	-0.150383*cos(ze)*cos(Q)
X  	+0.026897*cos(2*ze)*cos(Q)
X--- 763,770 ----
X  	-0.007075*sin(ze)
X  	-0.075825*sin(ze)*sin(Q)
X  	-0.024839*sin(2*ze)*sin(Q)
X! 	-0.008631*sin(3*ze)*sin(Q);
X! w1pert = w1pert
X  	-0.072586*cos(Q)
X  	-0.150383*cos(ze)*cos(Q)
X  	+0.026897*cos(2*ze)*cos(Q)
X***************
X*** 737,743 ****
X  	-(0.013597 +0.001719*nu2)*sin(ze)*sin(2*Q)
X  	+(-0.007742 + 0.001517*nu2)*cos(ze)*sin(2*Q)
X  	+(0.013586 - 0.001375*nu2)*cos(2*ze)*sin(2*Q)
X! 	+(-0.013667 + 0.001239*nu2)*sin(ze)*cos(2*Q)
X  	+0.011981*sin(2*ze)*cos(2*Q)
X  	+(0.014861 + 0.001136*nu2)*cos(ze)*cos(2*Q)
X  	-(0.013064 + 0.001628*nu2)*cos(2*ze)*cos(2*Q);
X--- 773,780 ----
X  	-(0.013597 +0.001719*nu2)*sin(ze)*sin(2*Q)
X  	+(-0.007742 + 0.001517*nu2)*cos(ze)*sin(2*Q)
X  	+(0.013586 - 0.001375*nu2)*cos(2*ze)*sin(2*Q)
X! 	+(-0.013667 + 0.001239*nu2)*sin(ze)*cos(2*Q);
X! w1pert = w1pert
X  	+0.011981*sin(2*ze)*cos(2*Q)
X  	+(0.014861 + 0.001136*nu2)*cos(ze)*cos(2*Q)
X  	-(0.013064 + 0.001628*nu2)*cos(2*ze)*cos(2*Q);
X***************
X*** 751,757 ****
X  apert = .000572*sin(V) -.001590*sin(2*ze)*cos(Q)
X  	+.002933*cos(V) -.000647*sin(3*ze)*cos(Q)
X  	+.033629*cos(ze) -.000344*sin(4*ze)*cos(Q)
X! 	-.003081*cos(2*ze) +.002885*cos(ze)*cos(Q)
X  	-.001423*cos(3*ze) +(.002172 + .000102*nu2)*cos(2*ze)*cos(Q)
X  	-.000671*cos(4*ze) +.000296*cos(3*ze)*cos(Q)
X  	-.000320*cos(5*ze) -.000267*sin(2*ze)*sin(2*Q);
X--- 788,795 ----
X  apert = .000572*sin(V) -.001590*sin(2*ze)*cos(Q)
X  	+.002933*cos(V) -.000647*sin(3*ze)*cos(Q)
X  	+.033629*cos(ze) -.000344*sin(4*ze)*cos(Q)
X! 	-.003081*cos(2*ze) +.002885*cos(ze)*cos(Q);
X! apert = apert
X  	-.001423*cos(3*ze) +(.002172 + .000102*nu2)*cos(2*ze)*cos(Q)
X  	-.000671*cos(4*ze) +.000296*cos(3*ze)*cos(Q)
X  	-.000320*cos(5*ze) -.000267*sin(2*ze)*sin(2*Q);
X***************
X*** 763,769 ****
X  	-.000393*sin(3*ze)*sin(Q)
X  	-.000228*sin(4*ze)*sin(Q)
X  	+.002138*cos(ze)*sin(Q)
X! 	-.000999*cos(2*ze)*sin(Q)
X  	-.000642*cos(3*ze)*sin(Q)
X  	-.000325*cos(4*ze)*sin(Q)
X  	-.000890*cos(Q)
X--- 801,808 ----
X  	-.000393*sin(3*ze)*sin(Q)
X  	-.000228*sin(4*ze)*sin(Q)
X  	+.002138*cos(ze)*sin(Q)
X! 	-.000999*cos(2*ze)*sin(Q);
X! apert = apert
X  	-.000642*cos(3*ze)*sin(Q)
X  	-.000325*cos(4*ze)*sin(Q)
X  	-.000890*cos(Q)
X***************
X*** 772,778 ****
X  	-.000856*sin(ze)*cos(2*Q)
X  	+.000441*sin(2*ze)*cos(2*Q)
X  	+.000296*cos(2*ze)*cos(2*Q)
X! 	+.000211*cos(3*ze)*cos(2*Q)
X  	-.000427*sin(ze)*sin(3*Q)
X  	+.000398*sin(3*ze)*sin(3*Q)
X  	+.000344*cos(ze)*cos(3*Q)
X--- 811,818 ----
X  	-.000856*sin(ze)*cos(2*Q)
X  	+.000441*sin(2*ze)*cos(2*Q)
X  	+.000296*cos(2*ze)*cos(2*Q)
X! 	+.000211*cos(3*ze)*cos(2*Q);
X! apert = apert
X  	-.000427*sin(ze)*sin(3*Q)
X  	+.000398*sin(3*ze)*sin(3*Q)
X  	+.000344*cos(ze)*cos(3*Q)
X***************
X*** 1002,1009 ****
X  	+.001051*cos(2*th);
X  trans(r,b,ll,Stheta,Sr,epli, MAGNEP, "PN", "Neptune");
X  
X  putchar('\n');
X! close(logfile);
X  exit(0);
X  } /* end of program main */
X  
X--- 1042,1061 ----
X  	+.001051*cos(2*th);
X  trans(r,b,ll,Stheta,Sr,epli, MAGNEP, "PN", "Neptune");
X  
X+ #ifdef ST_MWC
X+ Cconws("\r\n");
X+ #else /* !ST_MWC */
X  putchar('\n');
X! #endif /* ST_MWC */
X! fclose(logfile);
X! #ifdef ST_MWC /* We want to hold the screen if invoked from the GEM desktop; */
X!            /* the desktop doesn't usually set any environment variables, */
X!            /* and if getenv() does find anything, it's probably empty */
X! if (((getenv("PATH")) == 0) || (strlen(getenv("PATH")) == 0)) {
X!      Cconws("press any key to continue: "); /* Hold screen if desktop */
X!      i = Crawcin(); /* Read raw character input */
SHAR_EOF
echo "End of part 1, continue with part 2"
echo "2" > s2_seq_.tmp
exit 0