Rendered here in C is a star system generator called st, and some
postcript processing routines which apparently draw subsector maps (I
wouldn't know, since I don't have access to any postcript
devices/tools/etc.).
This is apparently a partial implementation of the Book 6--Scouts
Expanded Star System Generation system, which determines what orbits
exist around the main star and their satellites, etc. It does not
conform to any output standard that I know of (like my gensec and mapsub
use an expanded form of the Marc Miller system standard). It also does
not generate anything other than Solitary star systems -- no binaries or
trinaries.
I found this source in comp.sources.misc, and thought I would share it
with all of you. I am attempting to contact the author so I can ask him
some questions.
To unpack this shar archive, you must first make two subdirectories,
sysgen and sysprint. sysgen has the generator source (st) and Makefile,
and sysprint has the postscript post-processing stuff.
- ----------------------------------------------------------------------
James T. Perkins Traveller Mailing List Administrator
Tektronix Logic Analyzers "Load Auto/Evade, Beowulf!"
- ----------------------------------------------------------------------
INTERNET: [email removed]
CSNET: [email removed]
UUCP: {decvax,gatech,hplabs,ihnp4}!tektronix!dadla!traveller-request
- ------- Forwarded Message
Article: 346 of comp.sources.misc
Path: [email removed]
From: [email removed] (Phill Everson)
Newsgroups: comp.sources.misc
Subject: v02i020: Traveller (FRP) programs
Message-ID: [email removed]
Date: 26 Jan 88 04:10:58 GMT
Sender: [email removed]
Organization: Dept of Computer Science, University of Bristol, UK.
Lines: 1888
Approved: [email removed]
X-Archive: comp.sources.misc/8801/20
Comp.sources.misc: Volume 2, Issue 20
Submitted-By: Phill Everson [email removed]
Archive-Name: traveller
Comp.sources.misc: Volume 2, Issue 20
Submitted-By: Phill Everson [email removed]
Archive-Name: traveller
I don't know which newsgroup would be appropriate for the following,
perhaps it should go in comp.sources.misc with some cross-postings?
We are unable to post into rec.games.frp at present, so could you
post it in the most suitable place please? [Here. Most non-source
groups frown on sources the way source groups frown on binaries. ++bsa]
# This is a shell archive. Remove anything before this line, then
# unpack it by saving it in a file and typing "sh file". (Files
# unpacked will be owned by you and have default permissions.)
#
# This archive contains:
# README COPYRIGHT sysgen/Makefile sysgen/const.h sysgen/glob.c sysgen/glob.h sysgen/init.c sysgen/main.c sysgen/planets.c sysgen/print.c sysgen/rnd.c sysgen/sats.c sysgen/st.c sysgen/stuff.h sysgen/sub.c sysgen/support.c sysgen/system.c sysgen/types.h sysprint/Makefile sysprint/mass sysprint/stars.ps sysprint/tr22 sysprint/trconv sysprint/trmult.c sysprint/ts
echo x - README
cat > "README" << '//E*O*F README//'
Usage of Traveller Programs
===========================
Create Two subdirectories sysgen & sysprint : Then unbundle the files.
The directories will contain :
sysgen:
Makefile const.h glob.c glob.h init.c main.c planets.c print.c rnd.c sats.c st.c
stuff.h sub.c support.c system.c types.h
sysprint:
Makefile mass stars.ps tr22 trconv trmult trmult.c ts
To generate complete listings of star systems (an allegedly complete
implementation of Single-Star Systems according to the rules in Book 6)
it is necessary to compile the files in sysgen (by typing make) and then
running the program st. Be warned this produces voluminous output.
To generate a postscript file representing the star system, run st with
the -m option. This produces a file which lists the major features in the
system.
The command trconv file in the sysprint directory will then
produce a postscript file. Trading routes can be added to the system
description file by the DM as required.
Multiple systems can be printed using the trmult command. For example
trmult 2 2 stars.ps file1 file2 file3 file4
will place 4 systems on a piece of paper. But be warned: the order is not
the most obvious imaginable.
NOTE: the st command takes an argument which is an integer defining the
system. This allows the st program to be run many times with predictable
results.
tr22 & mass are historical examples of using trmult.
//E*O*F README//
echo x - COPYRIGHT
cat > "COPYRIGHT" << '//E*O*F COPYRIGHT//'
Copyright 1988 Gareth Waddell and Phill Everson
This notice and any statement of authorship must be reproduced
on all copies. The author does not make any warranty expressed
or implied, or assumes any liability or responsiblity for the
use of this software.
Any distributor of copies of this software shall grant the
recipient permission for further redistribution as permitted
by this notice. Any distributor must distribute this software
without any fee or other monetary gains, unless expressed written
permission is granted by the author.
This software or its use shall not be: sold, rented, leased,
traded, or otherwise marketed without the expressed written
permission of the author.
If the software is modified in a manner creating derivative
copyrights, appropriate legends may be placed on derivative
work in addition to that set forth above.
Permission is hereby granted to copy, reproduce, redistribute or
otherwise use this software as long as the conditions above
are met.
All rights not granted by this notice are reserved.
Authors: Gareth Waddell ([email removed])
and Phill Everson ([email removed])
//E*O*F COPYRIGHT//
echo x - sysgen/Makefile
cat > "sysgen/Makefile" << '//E*O*F sysgen/Makefile//'
#
# Copyright 1988 Gareth Waddell and Phill Everson
#
# Refer to the COPYRIGHT file for an explicit listing of the terms
# of this copyright and your responsibilities as distributor.
#
CFLAGS=
PRFLAGS=-l60
OBJS =rnd.o init.o print.o glob.o st.o system.o support.o planets.o sats.o main.o sub.o
SOURCES=rnd.c init.c print.c glob.c st.c system.c support.c planets.c sats.c main.c sub.c
HDRS=const.h types.h glob.h
PRG=st
LIBS=-lm
$(PRG): $(OBJS)
cc $(CFLAGS) $(OBJS) $(LIBS) -o $(PRG)
$(OBJS) : stuff.h
stuff.h: $(HDRS)
@touch stuff.h
wc:
@wc $(SOURCES) $(HDRS)
lint:
@lint $(HDRS) $(SOURCES)
pr:
@pr $(PRFLAGS) $(HDRS) $(SOURCES)
objs:
@echo $(SOURCES)
@echo $(HDRS)
//E*O*F sysgen/Makefile//
echo x - sysgen/const.h
cat > "sysgen/const.h" << '//E*O*F sysgen/const.h//'
/*
Copyright 1988 Gareth Waddell and Phill Everson
Refer to the COPYRIGHT file for an explicit listing of the terms
of this copyright and your responsibilities as distributor.
*/
#define DIE 6
//E*O*F sysgen/const.h//
echo x - sysgen/glob.c
cat > "sysgen/glob.c" << '//E*O*F sysgen/glob.c//'
/*
Copyright 1988 Gareth Waddell and Phill Everson
Refer to the COPYRIGHT file for an explicit listing of the terms
of this copyright and your responsibilities as distributor.
*/
#include "stuff.h"
int orbits[]={ 0.2, 0.4, 0.7, 1.0, 1.6, 2.8, 5.2, 10.0, 19.6, 38.8,
77.2, 154.0, 307.6, 614.8, 1229.2, 2458.0, 4915.6, 9830.6,
19661.2, 39322.0 };
char lt[]="aeioubcdfghjklmnpqrstvwxyz";
int freq[]={ 82, 209, 278, 353, 380, 395, 422, 466, 488, 508, 569,
572, 580, 620, 644, 712, 731, 734, 792, 855, 947, 957,
980, 981, 1000, 1001 };
int vowel=380;
SYSDATA syst;
char nature[]="SSSSSSSSBBBBTT";
char ptypet[]="BBAMMMMMKGFFFF";
int psizet[]={ 0, 1, 2, 3, 4, 5, 5,
5, 5, 5, 5, 6, 7, 7 };
char ctypet[]="BBAFFGGKKMMMMM";
int csizet[]={ 0, 1, 2, 3, 4, 7, 7,
5, 5, 6, 7, 7, 7, 7 };
int natDM= -1;
int typeDM=0;
int sizeDM=0;
char zones[][13][16]={ "--------IIIIIHO",
"-------IIIIIHOO",
"-------IIIIIHOO",
"-------IIIIIHOO",
"------IIIIIIHOO",
"------IIIIIHOOO",
"-------IIIIIHOO",
"-------IIIIIHOO",
"-------IIIIIHOO",
"-------IIIIIHOO",
"-------IIIIIHOO",
"--------IIIIHOO",
"--------IIIIHOO",
"--------IIIIIHO",
"------IIIIIHOOO",
"-----IIIIIIHOOO",
"-----IIIIIHOOOO",
"-----IIIIIHOOOO",
"----IIIIIIHOOOO",
"----IIIIIIHOOOO",
"-----IIIIIHOOOO",
"-----IIIIIHOOOO",
"------IIIIIHOOO",
"------IIIIIHOOO",
"-------IIIIIHOO",
"--------IIIIHOO",
"-------IIIIIHOO",
"-----IIIIIIHOOO",
"---IIIIIIHOOOOO",
"--IIIIIIHOOOOOO",
"--IIIIIIHOOOOOO",
"--IIIIIIHOOOOOO",
"--IIIIIIHOOOOOO",
"--IIIIIIHOOOOOO",
"--IIIIIIIHOOOOO",
"---IIIIIIHOOOOO",
"----IIIIIIHOOOO",
"------IIIIIHOOO",
"------IIIIIHOOO",
"-------IIIIIHOO",
"-----IIIIIHOOOO",
"-IIIIIIIHOOOOOO",
"-IIIIIIHOOOOOOO",
"-IIIIIHOOOOOOOO",
"-IIIIIHOOOOOOOO",
"-IIIIIHOOOOOOOO",
"-IIIIIIHOOOOOOO",
"-IIIIIIHOOOOOOO",
"-IIIIIIIHOOOOOO",
"--IIIIIIHOOOOOO",
"----IIIIIHOOOOO",
"-----IIIIHOOOOO",
"-------IIIIIHOO",
"---IIIIIIHOOOOO",
"-IIIIIIHOOOOOOO",
"IIIIIIHOOOOOOOO",
"IIIIIIHOOOOOOOO",
"IIIIIHOOOOOOOOO",
"IIIIIHOOOOOOOOO",
"IIIIIHOOOOOOOOO",
"IIIIHOOOOOOOOOO",
"---------------",
"---------------",
"---------------",
"---------------",
"------IIIIIIHOO",
"---IIIIIIHOOOOO",
"IIIIIIIHOOOOOOO",
"IIIIIIHOOOOOOOO",
"IIIIIHOOOOOOOOO",
"IIIIHOOOOOOOOOO",
"IIIHOOOOOOOOOOO",
"IIHOOOOOOOOOOOO",
"IIHOOOOOOOOOOOO",
"HOOOOOOOOOOOOOO",
"HOOOOOOOOOOOOOO",
"OOOOOOOOOOOOOOO",
"OOOOOOOOOOOOOOO",
"---------------",
"---------------",
"---------------",
"---------------",
"---------------",
"IIIHOOOOOOOOOOO",
"IIHOOOOOOOOOOOO",
"IHOOOOOOOOOOOOO",
"IHOOOOOOOOOOOOO",
"OOOOOOOOOOOOOOO",
"OOOOOOOOOOOOOOO",
"OOOOOOOOOOOOOOO",
"OOOOOOOOOOOOOOO",
"HOOOOOOOOOOOOOO",
"HOOOOOOOOOOOOOO",
"OOOOOOOOOOOOOOO",
"OOOOOOOOOOOOOOO",
"OOOOOOOOOOOOOOO",
"OOOOOOOOOOOOOOO",
"OOOOOOOOOOOOOOO",
"OOOOOOOOOOOOOOO",
"OOOOOOOOOOOOOOO",
"OOOOOOOOOOOOOOO",
"OOOOOOOOOOOOOOO",
"OOOOOOOOOOOOOOO",
"OOOOOOOOOOOOOOO" };
int ggno[]={ 0, 1, 1, 1, 2, 2, 3,
3, 4, 4, 4, 5, 5, 5 };
int plno[]={ 3, 2, 2, 2, 2, 2, 2,
1, 1, 1, 1, 1, 1, 1 };
int ggDM, plDM;
int ring[]={ 1, 1, 1, 1, 2, 2, 3 };
int clos[]={ 1, 2, 3, 4, 5, 6, 7,
8, 9, 10, 11, 12, 13 };
int far[]={ 5, 10, 15, 20, 25, 30, 35,
40, 45, 50, 55, 60, 65 };
int extreme[]={ 75, 100, 125, 150, 175, 200,
225, 250, 275, 300, 325 };
char starport[]="AAAAABBCCDEEX";
char spaceport[]="YYYHGGF";
int tech[][17]={0,0,0,0,0,0,0,0,0,0,6,4,2,0,0,0,-4,
2,2,2,1,1,1,0,0,0,0,0,0,0,0,0,0,0,
1,1,1,1,0,0,0,0,0,0,1,1,1,1,1,0,0,
0,0,0,0,0,0,0,0,0,1,2,0,0,0,0,0,0,
0,1,1,1,1,1,0,0,0,2,4,0,0,0,0,0,0,
1,0,0,0,0,1,0,0,0,0,0,0,0,-2,0,0,0 };
int mwatm,mwpop,mwgov,mwlaw,mwtech,mwind,mwpoor;
int base;
SUBDATA *subsect,*css;
int grtab[]={ 0,0,0,0,5,5,10,10,
15,15,40,50,60,15,10,0 };
int cloud[]={ 0,0,10,10,20,30,40,50,60,70,70 };
double lumtab[][13]={ 560000,204000,107000,81000,61000,51000,67000,89000,
97000,107000,117000,129000,141000,
270000,46700,15000,11700,7400,5100,6100,8100,11700,
20400,46000,89000,117000,
170000,18600,2200,850,600,510,560,740,890,2450,4600,
14900,16200,
107000,6700,280,90,53,43,50,75,95,320,470,2280,2690,
81000,2000,156,37,19,12,6.5,4.9,4.67,0,0,0,0,
56000,1400,90,16,8.1,3.5,1.21,.67,.42,.08,.04,.007,.001,
0,0,0,0,0,.977,.322,.186,.117,.025,.011,.002,.00006,
.046,.01,.005,.0009,.0003,.00015,.00006,.00005,.00004,
.00004,.00003,.00003,.00003 };
double dtab[]={ .2,.4,.7,1,1.6,2.8,5.2,10,19.6,38.8,77.2,154,307.6,614.8,
1229.2,2458,4915.6,9380.8,19661.2,39322 };
char spa[50][50];
int mapflag;
//E*O*F sysgen/glob.c//
echo x - sysgen/glob.h
cat > "sysgen/glob.h" << '//E*O*F sysgen/glob.h//'
/*
Copyright 1988 Gareth Waddell and Phill Everson
Refer to the COPYRIGHT file for an explicit listing of the terms
of this copyright and your responsibilities as distributor.
*/
extern int orbits[];
extern char lt[];
extern int freq[];
extern int vowel;
extern SYSDATA syst;
extern char nature[], ptypet[], ctypet[];
extern int psizet[], csizet[], natDM, typeDM, sizeDM;
extern char zones[][13][16];
extern int ggno[], plno[];
extern int ggDM, plDM;
extern int ring[], clos[], far[], extreme[];
extern char starport[],spaceport[];
extern int tech[][17];
extern int mwatm,mwpop,mwgov,mwlaw,mwtech,mwind,mwpoor;
extern int base;
extern SUBDATA *subsect,*css;
extern int grtab[],cloud[];
extern double lumtab[][13], dtab[];
extern char spa[][50];
extern int mapflag;
//E*O*F sysgen/glob.h//
echo x - sysgen/init.c
cat > "sysgen/init.c" << '//E*O*F sysgen/init.c//'
/*
Copyright 1988 Gareth Waddell and Phill Everson
Refer to the COPYRIGHT file for an explicit listing of the terms
of this copyright and your responsibilities as distributor.
*/
#include "stuff.h"
init(argc,argv,maxx,maxy)
char **argv;
int *maxx,*maxy;
{
subsect=(SUBDATA *)malloc(sizeof(SUBDATA));
subsect->next=NULL;
css=subsect;
if (argc>1 && argv[1][0]=='-')
{
if (argv[1][1]=='m')
mapflag=1;
argv++;
argc--;
}
switch(argc)
{
case 1:
iseed(42);
*maxx=8;
*maxy=10;
break;
case 2:
iseed(atoi(argv[1]));
*maxx=8;
*maxy=10;
break;
case 3:
iseed(atoi(argv[1]));
*maxx=8;
*maxy=atoi(argv[2]);
break;
case 4:
iseed(atoi(argv[1]));
*maxx=atoi(argv[3]);
*maxy=atoi(argv[2]);
break;
}
}
//E*O*F sysgen/init.c//
echo x - sysgen/main.c
cat > "sysgen/main.c" << '//E*O*F sysgen/main.c//'
/*
Copyright 1988 Gareth Waddell and Phill Everson
Refer to the COPYRIGHT file for an explicit listing of the terms
of this copyright and your responsibilities as distributor.
*/
#include "stuff.h"
mworld(s)
SYSDATA *s;
{
int pop;
PLANDATA *p,*mp;
SATDATA *sat,*ms;
pop=0;
mp=NULL;
for (p=s->orb0; p; p=p->next)
{
if (p->type=='P' || p->type=='W')
{
if (p->pop>pop || p->pop==pop && p->zone=='H')
{
pop=p->pop;
mp=p;
ms=NULL;
}
}
for (sat=p->sats; sat; sat=sat->next)
if (sat->pop>pop || sat->pop==pop && p->zone=='H')
{
pop=sat->pop;
mp=p;
ms=sat;
}
}
if (mp==NULL)
return;
for (p=s->orb0; p && p!=mp; p=p->next)
;
if (ms==NULL)
{
p->main=1;
p->gov=gov(p->pop);
p->law=law(p->gov);
if (p->pop>0) p->sport=starport[die(2)]; else p->sport='X';
p->tech=die(1)+tech[0][p->sport]+tech[1][p->size+1]+tech[2][p->atm]
+tech[3][p->hyd]+tech[4][p->pop]+tech[5][p->gov];
if (p->tech<0) p->tech=0;
else if (p->tech>15) p->tech=15;
trade(&p->notes,p->size,p->atm,p->hyd,p->pop,p->gov,p->law,p->tech);
if (die(2)>7 && (p->sport=='A' || p->sport=='B'))
addstr(&p->notes,"Naval");
if (scb(p->sport)) addstr(&p->notes,"Scout");
mwatm=p->atm;
mwpop=p->pop;
mwgov=p->gov;
mwlaw=p->law;
mwtech=p->tech;
return;
}
for (sat=p->sats; sat && sat!=ms; sat=sat->next)
;
sat->main=1;
sat->gov=gov(sat->pop);
sat->law=law(sat->gov);
sat->sport=starport[die(2)];
sat->tech=die(1)+tech[0][sat->size]+tech[1][sat->atm]+tech[2][sat->hyd]
+tech[3][sat->pop]+tech[4][sat->gov];
if (sat->tech<0) sat->tech=0;
else if (sat->tech>15) sat->tech=15;
trade(&sat->notes,sat->size,sat->atm,sat->hyd,sat->pop,sat->gov,
sat->law,sat->tech);
if (die(2)>7 && (sat->sport=='A' || sat->sport=='B'))
addstr(&sat->notes,"Naval");
if (scb(sat->sport)) addstr(&sat->notes,"Scout");
mwgov=sat->gov;
mwlaw=sat->law;
mwtech=sat->tech;
}
gov(pop)
{
int g;
g=die(2)-7+pop;
if (g<0) return 0;
else if (g>15) return 15;
else return g;
}
law(gov)
{
int l;
l=die(2)-7+gov;
if (l<0) return 0;
else if (l>9) return 9;
else return l;
}
scb(sp)
char sp;
{
int DM;
switch(sp)
{
case 'C':
DM= -1;
break;
case 'B':
DM= -2;
break;
case 'A':
DM= -3;
break;
}
if (sp!='E' && sp!='X')
return (die(2)+DM>6);
else
return 0;
}
trade(notes,size,atm,hyd,pop,gov,law)
char **notes;
{
mwind=mwpoor=0;
if (atm>=4 && atm<=9 && hyd>=4 && hyd<=8 && pop>=5 && pop<=7)
addstr(notes,"Agr");
if (atm<=3 && hyd<=3 && pop>=6)
addstr(notes,"Non-Agr");
if ((atm>=0 && atm<=2 || atm==4 || atm==7 || atm==9) && pop>=9)
{
addstr(notes,"Ind");
mwind=1;
}
if (pop<=6)
addstr(notes,"Non-Ind");
if ((atm==6 || atm==9) && gov>=4 && gov<=9 && pop>=6 && pop<=8)
addstr(notes,"Rich");
if (atm>=2 && atm<=5 && hyd<=3)
{
addstr(notes,"Poor");
mwpoor=1;
}
if (hyd==10)
addstr(notes,"Water");
if (atm>=2 && hyd==0)
addstr(notes,"Desert");
if (atm==0)
addstr(notes,"Vacuum");
if (size==0)
addstr(notes,"Asteroid");
if (atm>=0 && atm<=1 && hyd>=1)
addstr(notes,"Ice-Capped");
}
//E*O*F sysgen/main.c//
echo x - sysgen/planets.c
cat > "sysgen/planets.c" << '//E*O*F sysgen/planets.c//'
/*
Copyright 1988 Gareth Waddell and Phill Everson
Refer to the COPYRIGHT file for an explicit listing of the terms
of this copyright and your responsibilities as distributor.
*/
#include "stuff.h"
new_planets(p,n,size,type,dec)
PLANDATA **p;
char type;
{
PLANDATA *q,*r;
int z1,z2;
char *name();
switch(type)
{
case 'B':
z1=0;
case 'A':
z1=2;
case 'F':
z1=4;
case 'G':
z1=6;
case 'K':
z1=8;
case 'M':
z1=10;
}
if (dec>=5)
z1++;
if (type=='M' && dec==9)
z1++;
z2=size;
for (r=NULL,n--;n>=0;n--,r=q)
{
q=(PLANDATA *)malloc(sizeof(PLANDATA));
strcpy(q->name,name());
q->type=' ';
q->orbit=n;
q->zone=zones[z2][z1][(n<15)?n:14];
q->main=0;
q->sats=NULL;
q->notes=NULL;
q->next=r;
}
*p=r;
}
empty(s)
SYSDATA *s;
{
int n;
PLANDATA *p;
if (die(1)>=5)
{
n=die(1);
switch (n)
{
case 1:
case 2:
n=1;
break;
case 3:
n=2;
break;
default:
n=3;
break;
}
if (n>s->free)
n=s->free;
while (n>0)
for (p=s->orb0; p!=NULL && n>0; p=p->next)
if (die(1)==6)
{
p->type='E';
n--;
s->free--;
}
}
}
capt(s)
SYSDATA *s;
{
int n;
PLANDATA *p;
if (die(1)>=5)
{
n=(die(1)+1)/2;
if (n>s->orbits)
n=s->orbits;
while (n>0)
for (p=s->orb0; p!=NULL && n>0; p=p->next)
if (die(1)==6)
{
p->capt=die(2)-7;
n--;
}
}
}
gasgiants(s)
SYSDATA *s;
{
int n;
PLANDATA *p;
if (die(2)<10)
{
n=ggno[die(2)+ggDM];
if (n>s->free)
n=s->free;
if (n==0)
{
n=1;
s->orbits++;
s->free++;
for (p=s->orb0; p->next; p=p->next)
;
p->next=(PLANDATA *)malloc(sizeof(PLANDATA));
if (p->zone=='I')
p->next->zone='I';
else
p->next->zone='O';
strcpy(p->next->name,name());
p->next->type=' ';
p->next->orbit=p->orbit+1;
p->next->main=0;
p->next->sats=NULL;
p->next->notes=NULL;
p->next->next=NULL;
}
s->gg=n;
while (n>0)
for (p=s->orb0; p && n>0;p=p->next)
if (p->type==' ' && die(1)==6)
{
p->type=(die(1)<4)?'L':'S';
n--;
s->free--;
}
}
}
planetoids(s)
SYSDATA *s;
{
int n;
PLANDATA *p;
if (die(2)-s->gg<=6)
{
n=die(2)-s->gg;
n=plno[(n<0)?0:n];
if (n>s->free)
n=s->free;
if (n!=0)
{
for (p=s->orb0;p && n>0;p=p->next)
if (p->type==' ' && p->next && (p->next->type=='S' || p->next->type=='L'))
{
p->type='P';
n--;
s->free--;
}
while (n>0)
for (p=s->orb0;p && n>0; p=p->next)
if (p->type==' ' && die(1)==6)
{
p->type='P';
n--;
s->free--;
}
}
}
}
wsize(s)
SYSDATA *s;
{
PLANDATA *p;
for (p=s->orb0; p; p=p->next)
{
if (p->type=='P')
p->size=0;
if (p->type!=' ')
continue;
p->type='W';
p->size=die(2)-2;
if (p->orbit==0) p->size-=5;
if (p->orbit==1) p->size-=4;
if (p->orbit==2) p->size-=2;
if (s->ptype=='M') p->size-=2;
if (p->size<=0) p->size= -1;
}
}
watm(s)
SYSDATA *s;
{
PLANDATA *p;
for (p=s->orb0; p; p=p->next)
{
if (p->type!='W' && p->type!='P')
continue;
p->atm=die(2)-7+p->size;
if (p->zone=='I') p->atm-=2;
if (p->zone=='O') p->atm-=4;
if (p->size==0) p->atm=0;
if (p->atm<0) p->atm=0;
if (p->atm>15) p->atm=15;
}
}
whyd(s)
SYSDATA *s;
{
PLANDATA *p;
for (p=s->orb0; p; p=p->next)
{
if (p->type!='W' && p->type!='P')
continue;
p->hyd=die(2)-7+p->size;
if (p->zone=='I') p->hyd=0;
if (p->zone=='O') p->hyd-=2;
if (p->size<2) p->hyd=0;
if (p->atm<2 || p->atm>9) p->hyd-=4;
if (p->hyd<0) p->hyd=0;
if (p->hyd>10) p->hyd=10;
}
}
wpop(s)
SYSDATA *s;
{
PLANDATA *p;
for (p=s->orb0; p; p=p->next)
{
if (p->type!='W' && p->type!='P')
continue;
p->pop=die(2)-2;
if (p->zone=='I') p->pop-=5;
if (p->zone=='O') p->pop-=3;
if (p->atm!=0 && p->atm!=5 && p->atm!=6 && p->atm!=8) p->pop-=2;
if (p->pop<0) p->pop=0;
}
}
//E*O*F sysgen/planets.c//
echo x - sysgen/print.c
cat > "sysgen/print.c" << '//E*O*F sysgen/print.c//'
/*
Copyright 1988 Gareth Waddell and Phill Everson
Refer to the COPYRIGHT file for an explicit listing of the terms
of this copyright and your responsibilities as distributor.
*/
#include "stuff.h"
print(s)
SYSDATA *s;
{
PLANDATA *p;
SATDATA *sat;
char *prss();
if (mapflag) return;
printf(" %-15s %c%d %-2s\n",s->name,s->ptype,
s->pdec,prss(s->psize));
for (p=s->orb0; p; p=p->next)
{
putchar(' ');
if (p->zone=='H') putchar('*'); else putchar(' ');
printf(" %2d ",p->orbit);
if (p->type=='L')
printf(" %-15s Large GG\n",p->name);
else if (p->type=='S')
printf(" %-15s Small GG\n",p->name);
else if (p->type!='E')
prpl(p,s);
else
{
printf(" Orbit Empty \n");
continue;
}
for (sat=p->sats; sat; sat=sat->next)
{
printf(" %3d", sat->orbit);
prsat(sat);
}
}
}
prpl(p,s)
PLANDATA *p;
SYSDATA *s;
{
char hex(),pshex(),sshex();
if (mapflag) return;
printf(" %-15s ",p->name);
printf(" %c",p->sport);
if (p->type=='P') putchar('0'); else putchar(pshex(p->size));
printf("%c%c%c%c%c %c ",hex(p->atm),hex(p->hyd),hex(p->pop),
hex(p->gov),hex(p->law),hex(p->tech));
if (s!=0) plfacts(p,s);
if (p->notes)
printf(" %s",p->notes);
putchar('\n');
}
prsat(p)
SATDATA *p;
{
char hex(),pshex(),sshex();
if (mapflag) return;
printf(" %-15s ",p->name);
printf(" %c",p->sport);
putchar(sshex(p->size));
printf("%c%c%c%c%c %c ",hex(p->atm),hex(p->hyd),hex(p->pop),
hex(p->gov),hex(p->law),hex(p->tech));
if (p->notes)
printf(" %s",p->notes);
putchar('\n');
}
char *prss(n)
{
switch(n)
{
case 0:
return "Ia";
break;
case 1:
return "Ib";
break;
case 2:
return "II";
break;
case 3:
return "III";
break;
case 4:
return "IV";
break;
case 5:
return "V";
break;
case 6:
return "VI";
break;
case 7:
return "D";
break;
}
}
char hex(n)
{
if (n<0) return '0';
if (n<10) return '0'+n;
return n-10+'A';
}
char pshex(n)
{
if (n<=0) return 'S';
else return hex(n);
}
char sshex(n)
{
if (n<0) return 'S';
else if (n==0) return 'R';
else return hex(n);
}
plfacts(p,s)
PLANDATA *p;
SYSDATA *s;
{
FACDATA f;
int w,l,i,cl,z1;
double lum,dist;
double sqrt();
f.green=grtab[p->atm];
f.cloud=cloud[p->hyd];
if (p->atm>=10) f.cloud+=4;
if (p->atm<=3) f.cloud-=2;
if (p->atm==14) f.cloud=(f.cloud-4)/2;
w=p->hyd*10;
l=100-p->hyd;
i=l/10;
l-=i/2;
w-=i/2;
f.land=l;
f.water=w;
f.ice=i;
cl=100-f.cloud;
l=l*cl/100;
w=w*cl/100;
i=i*cl/100;
f.albedo=l*15+w*2+f.cloud*60+i*55;
switch(s->ptype)
{
case 'B':
z1=0;
case 'A':
z1=2;
case 'F':
z1=4;
case 'G':
z1=6;
case 'K':
z1=8;
case 'M':
z1=10;
}
if (s->pdec>=5)
z1++;
if (s->ptype=='M' && s->pdec==9)
z1++;
lum=lumtab[s->psize][z1];
dist=dtab[p->orbit];
f.temp=374.025*f.green*(100-f.albedo)*sqrt(sqrt(lum))/sqrt(dist);
}
//E*O*F sysgen/print.c//
echo x - sysgen/rnd.c
cat > "sysgen/rnd.c" << '//E*O*F sysgen/rnd.c//'
/*
Copyright 1988 Gareth Waddell and Phill Everson
Refer to the COPYRIGHT file for an explicit listing of the terms
of this copyright and your responsibilities as distributor.
*/
#include "stuff.h"
static s;
rand(n)
{
double rnd();
return (random()%n+1);
}
iseed(q)
int q;
{
srandom(q);
}
char *name()
{
static char st[20];
int i,j,l;
l=rand(7)+3;
st[l+1]='\0';
i=rand(1000);
for (j=0;freq[j]<i;j++)
;
st[l--]=lt[j];
while (l>=0)
{
if (i<vowel)
i=rand(1000-vowel)+vowel;
else
i=rand(vowel);
for (j=0;freq[j]<i;j++)
;
st[l--]=lt[j];
}
st[0]=toupper(st[0]);
return st;
}
die(n)
{
int i,j;
j=0;
for (i=0;i<n;i++)
j+=rand(DIE);
return j;
}
//E*O*F sysgen/rnd.c//
echo x - sysgen/sats.c
cat > "sysgen/sats.c" << '//E*O*F sysgen/sats.c//'
/*
Copyright 1988 Gareth Waddell and Phill Everson
Refer to the COPYRIGHT file for an explicit listing of the terms
of this copyright and your responsibilities as distributor.
*/
#include "stuff.h"
sats(s)
SYSDATA *s;
{
PLANDATA *p;
for (p=s->orb0; p; p=p->next)
switch(p->type)
{
case 'L':
new_sats(&p->sats,die(2));
break;
case 'S':
new_sats(&p->sats,die(2)-4);
break;
case 'W':
new_sats(&p->sats,die(1)-3);
break;
default:
p->sats=NULL;
}
}
new_sats(p,n)
SATDATA **p;
{
SATDATA *r, *q;
char *name();
if (n<=0)
*p=NULL;
else
{
for (r=NULL;n;r=q,n--)
{
q=(SATDATA *)malloc(sizeof(SATDATA));
strcpy(q->name,name());
q->main=0;
q->notes=NULL;
q->next=r;
}
*p=r;
}
}
satwsize(s)
SYSDATA *s;
{
PLANDATA *p;
for (p=s->orb0; p; p=p->next)
satsize(p);
}
satsize(p)
PLANDATA *p;
{
SATDATA *s;
for (s=p->sats; s; s=s->next)
{
switch(p->type)
{
case 'L':
s->size=die(2)-4;
break;
case 'S':
s->size=die(2)-6;
break;
case 'W':
s->size=p->size-die(1);
break;
}
if (s->size<0) s->size= -1; /*SMALL*/
if (s->size>10) s->size= 10;
}
}
satworbit(s)
SYSDATA *s;
{
PLANDATA *p;
for (p=s->orb0; p; p=p->next)
satorbit(p);
}
satorbit(p)
PLANDATA *p;
{
SATDATA *s,*r;
int otype,swap;
int DM;
DM=0;
for (s=p->sats; s; s=s->next,DM++)
{
otype=die(2)-DM;
if (s->size==0) s->orbit=ring[die(1)];
else if (otype<8) s->orbit=clos[die(2)];
else if (otype==12 && (p->type=='L' || p->type=='S'))
s->orbit=extreme[die(2)];
else if (otype>7) s->orbit=far[die(2)];
}
swap=1;
s=p->sats;
while (s && s->next && swap)
{
s=p->sats;
swap=0;
if (s->orbit>s->next->orbit)
{
p->sats=s->next;
s->next=p->sats->next;
p->sats->next=s;
swap=1;
}
for (s=p->sats; s->next->next; s=s->next)
{
r=s->next;
if (r->orbit>r->next->orbit)
{
s->next=r->next;
r->next=r->next->next;
s->next->next=r;
swap=1;
}
}
}
for (s=p->sats; s && s->next;)
if (s->orbit==s->next->orbit)
{
r=s->next;
s->next=r->next;
free(r);
}
else
s=s->next;
}
satwatm(s)
SYSDATA *s;
{
PLANDATA *p;
for (p=s->orb0; p; p=p->next)
satatm(p);
}
satatm(p)
PLANDATA *p;
{
SATDATA *s;
for (s=p->sats; s; s=s->next)
{
s->atm=die(2)-7+s->size;
if (p->zone=='I') s->atm-=4;
if (p->zone=='O') s->atm-=4;
if (s->size<2) s->atm=0;
if (s->atm<0) s->atm=0;
if (s->atm>15) s->atm=15;
}
}
satwhyd(s)
SYSDATA *s;
{
PLANDATA *p;
for (p=s->orb0; p; p=p->next)
sathyd(p);
}
sathyd(p)
PLANDATA *p;
{
SATDATA *s;
for (s=p->sats; s; s=s->next)
{
s->hyd=die(2)-7+s->size;
if (p->zone=='I') s->hyd=0;
if (p->zone=='O') s->hyd-=4;
if (s->size<=0) s->hyd=0;
if (s->atm<2 || s->atm>9) s->hyd-=4;
if (s->hyd<0) s->hyd=0;
if (s->hyd>10) s->hyd=10;
}
}
satwpop(s)
SYSDATA *s;
{
PLANDATA *p;
for (p=s->orb0; p; p=p->next)
satpop(p);
}
satpop(p)
PLANDATA *p;
{
SATDATA *s;
for (s=p->sats; s; s=s->next)
{
s->pop=die(2)-2;
if (p->zone=='I') s->pop-=5;
if (p->zone=='O') s->pop-=4;
if (s->atm!=5 && s->atm!=6 && s->atm!=8) s->pop-=2;
if (s->size<5) s->pop-=2;
if (s->size==0) s->pop=0;
if (s->pop<0) s->pop=0;
if (s->pop>10) s->pop=10;
}
}
//E*O*F sysgen/sats.c//
echo x - sysgen/st.c
cat > "sysgen/st.c" << '//E*O*F sysgen/st.c//'
/*
Copyright 1988 Gareth Waddell and Phill Everson
Refer to the COPYRIGHT file for an explicit listing of the terms
of this copyright and your responsibilities as distributor.
*/
#include "stuff.h"
main(argc,argv)
char **argv;
{
int i,j,mxi,mxj;
char sysnat(), stype();
init(argc,argv,&mxi,&mxj);
for (i=1;i<=mxi;i++)
{
for (j=1;j<=mxj;j++)
{
spa[i][j]=' ';
if (syspres(0))
{
if (!mapflag) printf("\fSystem At (%02d%02d)\n\n",i,j);
strcpy(syst.name,name());
syst.nature=sysnat();
syst.ptype=stype(0);
syst.psize=ssize(0,syst.ptype);
syst.pdec=rand(10)-1;
if (syst.nature!='S')
{
syst.ctype=stype(1);
syst.csize=ssize(1,syst.ctype);
syst.cdec=rand(10)-1;
}
syst.orbits=nbrorbs(syst.psize,syst.ptype);
syst.free=syst.orbits;
new_planets(&syst.orb0,syst.orbits,syst.psize,syst.ptype,
syst.pdec);
syst.notes=NULL;
empty(&syst);
capt(&syst);
gasgiants(&syst);
planetoids(&syst);
wsize(&syst);
watm(&syst);
whyd(&syst);
wpop(&syst);
sats(&syst);
satwsize(&syst);
satworbit(&syst);
satwatm(&syst);
satwhyd(&syst);
satwpop(&syst);
mworld(&syst);
sub(&syst);
print(&syst);
css->x=i;
css->y=j;
spa[i][j]=freeup(&syst);
}
}
}
if (!mapflag)
{
putchar('\f');
for (css=subsect; css->next; css=css->next)
{
printf("%02d%02d ",css->x,css->y);
if (!css->planet && !css->sat) printf(" %s system UNINHABITED\n",css->name);
if (css->planet) prpl(css->planet,0);
if (css->sat) prsat(css->sat,0);
}
printf("\f ");
for (i=1;i<=mxi;i++)
printf("%02dxx ",i);
putchar('\n');
for (j=1;j<=mxj;j++)
{
printf(" xx%02d ",j);
for (i=1;i<=mxi;i+=2)
printf(" %2c ",spa[i][j]);
printf("\n ");
for (i=2;i<=mxi;i+=2)
printf(" %2c ",spa[i][j]);
putchar('\n');
}
}
else
{
for (css=subsect;css->next;css=css->next)
{
printf("%d %d ",css->x-1,css->y-1);
if (!css->planet && !css->sat) printf("%s %c\n",css->name,spa[css->x][css->y]);
if (css->planet) printf("%s %c\n",css->planet->name,css->planet->sport);
if (css->sat) printf("%s %c\n",css->sat->name,css->sat->sport);
}
printf("99\n");
}
}
//E*O*F sysgen/st.c//
echo x - sysgen/stuff.h
cat > "sysgen/stuff.h" << '//E*O*F sysgen/stuff.h//'
/*
Copyright 1988 Gareth Waddell and Phill Everson
Refer to the COPYRIGHT file for an explicit listing of the terms
of this copyright and your responsibilities as distributor.
*/
#include <stdio.h>
#include <ctype.h>
#include "const.h"
#include "types.h"
#include "glob.h"
//E*O*F sysgen/stuff.h//
echo x - sysgen/sub.c
cat > "sysgen/sub.c" << '//E*O*F sysgen/sub.c//'
/*
Copyright 1988 Gareth Waddell and Phill Everson
Refer to the COPYRIGHT file for an explicit listing of the terms
of this copyright and your responsibilities as distributor.
*/
#include "stuff.h"
sub(s)
SYSDATA *s;
{
PLANDATA *p;
SATDATA *sat;
int sp;
for (p=s->orb0; p; p=p->next)
{
if (!p->main && p->type!='L' && p->type!='S')
{
p->gov=die(1);
if (mwgov==6) p->gov=6;
if (mwgov>=7) p->gov+=2;
if (p->pop==0) p->gov=0;
p->law=die(1)-3+mwlaw;
if (p->gov==0) p->law=0;
p->tech=mwtech-1+facility(&p->notes,p->zone,p->size,p->atm,p->hyd,
p->pop,p->gov,p->law);
if (p->pop==0) p->tech=0;
sp=die(1);
if (p->pop>=6) sp+=2;
if (p->pop<2) sp-=2;
if (sp<1) sp=1;
if (sp>6) sp=6;
if (p->pop>0) p->sport=spaceport[sp]; else p->sport='Y';
}
for (sat=p->sats; sat; sat=sat->next)
{
if (!sat->main)
{
sat->gov=die(1);
if (mwgov==6) sat->gov=6;
if (mwgov>=7) sat->gov+=2;
if (sat->pop==0) sat->gov=0;
sat->law=die(1)-3+mwlaw;
if (sat->gov==0) sat->law=0;
sat->tech=mwtech-1+facility(&sat->notes,p->zone,sat->size,
sat->atm,sat->hyd,sat->pop,sat->gov,sat->law);
if (sat->pop==0) sat->tech=0;
sp=die(1);
if (sat->pop>=6) sp+=2;
if (sat->pop<2) sp-=2;
if (sp<1) sp=1;
if (sp>6) sp=6;
if (sat->pop>0) sat->sport=spaceport[sp]; else sat->sport='Y';
}
}
}
}
facility(notes,zone,size,atm,hyd,pop,gov,law)
char **notes;
char zone;
{
int bonus; /* TL bonus for lab or base */
bonus=0;
if (zone=='H' && atm>=4 && atm<=9 && hyd>=4 && hyd<=8 && pop>=2)
addstr(notes,"Farming");
if (mwind && pop>=2)
addstr(notes,"Mining");
if (gov==6 && pop>=5)
addstr(notes,"Colony");
if ((die(2)+((mwtech>=10)?2:0)>=11) && mwtech>8 && pop>0)
{
addstr(notes,"Lab.");
bonus=1;
}
if (die(2)+((mwpop>=8)?1:0)+((atm==mwatm)?2:0)+(base?1:0)>=12 && pop>0 &&
!mwpoor)
{
addstr(notes,"Mil. Base");
bonus=1;
}
return bonus;
}
//E*O*F sysgen/sub.c//
echo x - sysgen/support.c
cat > "sysgen/support.c" << '//E*O*F sysgen/support.c//'
/*
Copyright 1988 Gareth Waddell and Phill Everson
Refer to the COPYRIGHT file for an explicit listing of the terms
of this copyright and your responsibilities as distributor.
*/
#include "stuff.h"
char *malloc(), *realloc(), *strcpy(), *strcat();
addstr(p,q)
char **p,*q;
{
if (*p==NULL)
*p=strcpy(malloc(strlen(q)+1),q);
else
*p=strcat(strcat(realloc(*p,strlen(*p)+strlen(q)+2)," "),q);
}
freeup(s)
SYSDATA *s;
{
PLANDATA *p;
SATDATA *sat;
char sp;
sp='X';
css->planet=NULL;
css->sat=NULL;
css->name=strcpy(malloc(strlen(s->name)+1),s->name);
for (p=s->orb0; p; p=p->next)
{
for (sat=p->sats; sat; sat=sat->next)
if (sat->main)
{
css->sat=sat;
sp=sat->sport;
}
else
free(sat);
if (p->main)
{
p->sats=NULL;
css->planet=p;
sp=p->sport;
}
else
free(p);
}
css->next=(SUBDATA *)malloc(sizeof(SUBDATA));
css=css->next;
css->planet=NULL;
css->sat=NULL;
css->next=NULL;
return sp;
}
//E*O*F sysgen/support.c//
echo x - sysgen/system.c
cat > "sysgen/system.c" << '//E*O*F sysgen/system.c//'
/*
Copyright 1988 Gareth Waddell and Phill Everson
Refer to the COPYRIGHT file for an explicit listing of the terms
of this copyright and your responsibilities as distributor.
*/
#include "stuff.h"
syspres(fudge)
{
if (die(1)+fudge>=4)
return 1;
else
return 0;
}
char sysnat()
{
return nature[die(2)+natDM];
}
char stype(f)
{
if (f==0)
return ptypet[die(2)+typeDM];
else
return ctypet[die(2)+typeDM];
}
ssize(f,t)
char t;
{
int s;
if (f==0)
s=psizet[die(2)+sizeDM];
else
s=csizet[die(2)+sizeDM];
if (s==4 && (t=='K' || t=='M'))
s=5;
if (s==6 && (t=='B' || t=='A' || t=='F'))
s=5;
return s;
}
nbrorbs(s,t)
char t;
{
int o;
o=die(2);
if (s==3) o+=4;
if (s<=2) o+=8;
if (t=='M') o-=4;
if (t=='K') o-=2;
if (o<1) o=1;
return o;
}
//E*O*F sysgen/system.c//
echo x - sysgen/types.h
cat > "sysgen/types.h" << '//E*O*F sysgen/types.h//'
/*
Copyright 1988 Gareth Waddell and Phill Everson
Refer to the COPYRIGHT file for an explicit listing of the terms
of this copyright and your responsibilities as distributor.
*/
typedef struct factors {
int cloud;
int albedo;
int green;
int land;
int water;
int ice;
int temp;
int tilt;
int ecc;
} FACDATA;
typedef struct subsector {
int x;
int y;
struct planet *planet;
struct sat *sat;
char *name;
struct subsector *next;
} SUBDATA;
typedef struct system {
char name[20];
char nature;
char ptype;
int pdec;
int psize;
char ctype;
int cdec;
int csize;
int orbits;
int free;
int gg;
char *notes;
struct planet *orb0;
} SYSDATA;
typedef struct planet {
char name[20];
int orbit;
char zone;
char type;
int capt;
char sport;
int size;
int atm;
int hyd;
int pop;
int gov;
int law;
int tech;
int main;
char *notes;
struct sat *sats;
struct planet *next;
} PLANDATA;
typedef struct sat {
char name[20];
int orbit;
char sport;
int size;
int atm;
int hyd;
int pop;
int gov;
int law;
int tech;
int main;
char *notes;
struct sat *next;
} SATDATA;
//E*O*F sysgen/types.h//
echo x - sysprint/Makefile
cat > "sysprint/Makefile" << '//E*O*F sysprint/Makefile//'
#
# Copyright 1988 Gareth Waddell and Phill Everson
#
# Refer to the COPYRIGHT file for an explicit listing of the terms
# of this copyright and your responsibilities as distributor.
#
#
# Copyright 1988 Gareth Waddell and Phill Everson
#
# Refer to the COPYRIGHT file for an explicit listing of the terms
# of this copyright and your responsibilities as distributor.
#
all: trmult
trmult: trmult.o
cc -o trmult trmult.o
//E*O*F sysprint/Makefile//
echo x - sysprint/mass
cat > "sysprint/mass" << '//E*O*F sysprint/mass//'
#
# Copyright 1988 Gareth Waddell and Phill Everson
#
# Refer to the COPYRIGHT file for an explicit listing of the terms
# of this copyright and your responsibilities as distributor.
#
#
# Copyright 1988 Gareth Waddell and Phill Everson
#
# Refer to the COPYRIGHT file for an explicit listing of the terms
# of this copyright and your responsibilities as distributor.
#
trmult 4 4 stars.ps m1[3456]00 m900 m1[012]00 m[5678]00 m[1234]00
//E*O*F sysprint/mass//
echo x - sysprint/stars.ps
cat > "sysprint/stars.ps" << '//E*O*F sysprint/stars.ps//'
/incx { 126 } def
/incy { 72 } def
/offset { 15 } def
/coffset { 35 } def
/stdfont { /Times-Roman findfont } def
/add36 { 36 sub } def
/setgrey { setgray } def
/grey4 { 0.1 setgrey 6 setlinewidth} def
/black1 {0 setgrey 1 setlinewidth} def
/grid { % - GRID -
- -21 36 rmoveto
- -21 -36 rlineto
21 -36 rlineto
42 0 rlineto
21 36 rlineto
- -21 36 rlineto
21 -36 rmoveto
42 0 rlineto
} def
/top { % - TOP -
- -21 36 rmoveto
42 0 rlineto
} def
/right { % - RIGHT -
84 0 rmoveto
21 -36 rlineto
- -21 -36 rlineto
} def
/bottom { % - BOTTOM -
21 -36 rmoveto
21 -36 rlineto
42 0 rlineto
21 36 rlineto
} def
/coords { % string COORDS -
0 24 rmoveto
dup % duplicate string
stringwidth
pop
2 div neg
0
rmoveto
show % second copy of string
} def
/starport { % string STARPORT -
dup
stringwidth
offset add exch
2 div neg exch
rmoveto
show
} def
/name { % string NAME -
dup
stringwidth
pop offset neg exch
2 div neg exch
rmoveto
show
} def
/conv2 { % x (0:7) y (0:9) CONV2 x (minx:maxx) y (miny:maxy)
9 exch sub % 9-y
incy mul % (9-y)*incy
miny add % (9-y)*incy+miny
exch % stack: y x
dup % dup to give us second value for test
2 mod 0 ne % test for even column
exch % stack: y bool x
incx 2 div mul% x*incx
minx add % x*incx+minx
3 1 roll % stack: x y bool
{add36} if % make y correction
} def
/conv { % x (0:7) y (0:9) CONV -
conv2
moveto
} def
/pname { % string x y PNAME -
conv
name
} def
/pport { % string x y PNAME -
conv
starport
} def
/ccord { % string x y CCORD -
conv
coords
} def
/route { % x y x y ROUTE -
4 setlinewidth
conv
conv2
lineto
stroke
} def
/Nbord { % 0 Nbord -
pop
-21 36 rmoveto
42 0 rlineto
grey4
stroke
black1
} def
/NEbord { % - NEbord -
21 36 rmoveto
21 -36 rlineto
grey4
stroke
black1
} def
/SEbord { % - SEbord -
42 0 rmoveto
-21 -36 rlineto
grey4
stroke
black1
} def
/NSEbord { % side NSEBORD -
1 eq {NEbord} {SEbord} ifelse
} def
/border { % side x y BORDER -
conv
dup
0 eq {Nbord} {NSEbord} ifelse
} def
/planet { % x y PLANET -
conv2
2 copy
moveto
-6 -10 rmoveto
stdfont 30 scalefont setfont
1 setgray
(\267) show
moveto
-4 -7 rmoveto
stdfont 20 scalefont setfont
0 setgray
(\267) show
stdfont 10 scalefont setfont
} def
/grid2 { % horiz vert GRID2 horiz
2 copy
moveto
grid
pop
} def
/grid1 { % horiz GRID1 -
maxy incy neg miny {grid2} for
dup
maxy moveto top
miny moveto bottom
} def
/dogrid { % - DOGRID -
minx incx maxx {grid1} for
} def
/right1 { % horiz vert RIGHT1 horiz
2 copy
moveto
right
pop
} def
/doright { % - DORIGHT -
maxx
maxy incy neg miny {right1} for
pop
} def
//E*O*F sysprint/stars.ps//
echo x - sysprint/tr22
cat > "sysprint/tr22" << '//E*O*F sysprint/tr22//'
#
# Copyright 1988 Gareth Waddell and Phill Everson
#
# Refer to the COPYRIGHT file for an explicit listing of the terms
# of this copyright and your responsibilities as distributor.
#
#
# Copyright 1988 Gareth Waddell and Phill Everson
#
# Refer to the COPYRIGHT file for an explicit listing of the terms
# of this copyright and your responsibilities as distributor.
#
trmult 2 2 stars.ps m${1}00 m${2}00 m${3}00 m${4}00
//E*O*F sysprint/tr22//
echo x - sysprint/trconv
cat > "sysprint/trconv" << '//E*O*F sysprint/trconv//'
#
# Copyright 1988 Gareth Waddell and Phill Everson
#
# Refer to the COPYRIGHT file for an explicit listing of the terms
# of this copyright and your responsibilities as distributor.
#
trmult 1 1 stars.ps $*
//E*O*F sysprint/trconv//
echo x - sysprint/trmult.c
cat > "sysprint/trmult.c" << '//E*O*F sysprint/trmult.c//'
/*
Copyright 1988 Gareth Waddell and Phill Everson
Refer to the COPYRIGHT file for an explicit listing of the terms
of this copyright and your responsibilities as distributor.
*/
#include <stdio.h>
#define MAX 80
#define MAXC 30
#define MAXX 396
#define MINX 18
#define MAXY 702
#define MINY 54
#define INCX 126
#define INCY 72
main(argc,argv)
char **argv;
{
char name[MAXC],sport[MAXC];
FILE *fp;
int c;
int x,y,dx,dy,xa[MAX],ya[MAX];
int i,k;
int xsiz,ysiz;
int xl,yl;
if (argc<5)
{
fprintf(stderr,"Usage: %s x y psfile starsfile ...\n",argv[0]);
exit(-1);
}
xsiz=atoi(argv[1]);
ysiz=atoi(argv[2]);
if (argc!=xsiz*ysiz+4)
{
fprintf(stderr,"You must specify %d stars files\n",xsiz*ysiz);
exit(-1);
}
printf("36 36 translate\n");
printf("1 %d div 1 %d div scale\n",xsiz,ysiz);
printf("/maxx { %d } def\n",MAXX);
printf("/minx { %d } def\n",MINX);
printf("/maxy { %d } def\n",MAXY);
printf("/miny { %d } def\n",MINY);
if (!(fp=fopen(argv[3],"r")))
{
fprintf(stderr,"Could not open %s\n",argv[3]);
exit(-1);
}
printf("36 36 translate\n");
while ((c=getc(fp))!=EOF)
putchar(c);
fclose(fp);
for (yl=0,argv+=4;yl<ysiz;yl++)
{
if (yl!=0) printf("%d %d translate\n",(1-xsiz)*(MAXX-MINX+INCX),MAXY-MINY+INCY);
for (xl=0;xl<xsiz;xl++,argv++)
{
if (xl!=0) printf("%d 0 translate\n",MAXX-MINX+INCX);
printf("stdfont 10 scalefont setfont\n");
printf("dogrid\n");
printf("doright\n");
printf("1 setlinewidth\n");
printf("stroke\n");
if (!(fp=fopen(*argv,"r")))
{
fprintf(stderr,"Could not open %s\n",*argv);
exit(-1);
}
for (i=0;;i++)
{
if ((c=fscanf(fp,"%d",&x))!=1)
{
if (c==EOF)
break;
fprintf(stderr,"Data Format Error! File %s Line %d\n",*argv,i);
exit(-1);
}
if (x==99)
break;
if ((c=fscanf(fp,"%d %s %s",&y,name,sport))!=3)
{
fprintf(stderr,"Data Format Error! File %s Line %d\n",*argv,i);
exit(-1);
}
xa[i]=x;
ya[i]=y;
printf("(%s) %d %d pname\n",name,x,y);
printf("(%s) %d %d pport\n",sport,x,y);
}
for (k=i++;;i++)
{
if ((c=fscanf(fp,"%d",&x))!=1)
{
if (c==EOF)
break;
fprintf(stderr,"Border Format Error! Line %d\n",i);
exit(-1);
}
if (x==99)
break;
if ((c=fscanf(fp,"%d %d",&y,&dx))!=2)
{
fprintf(stderr,"Border Format Error! Line %d\n",i);
exit (-1);
}
printf("%d %d %d border\n",dx,x-1,y-1);
}
for (i++;;i++)
{
if ((c=fscanf(fp,"%d",&x))!=1)
{
if (c==EOF)
break;
fprintf(stderr,"Route Format Error! Line %d\n",i);
exit(-1);
}
if (x==99)
break;
if ((c=fscanf(fp,"%d %d %d",&y,&dx,&dy))!=3)
{
fprintf(stderr,"Route Format Error! File %s Line %d\n",*argv,i);
exit(-1);
}
printf("%d %d %d %d route\n",x-1,y-1,dx-1,dy-1);
}
for (i=0;i<k;i++)
printf("%d %d planet\n",xa[i],ya[i]);
for (k=0;k<10;k++)
for (i=0;i<8;i++)
printf("(%02d%02d) %d %d ccord\n",i+1,k+1,i,k);
}
}
printf("showpage\n");
}
//E*O*F sysprint/trmult.c//
echo x - sysprint/ts
cat > "sysprint/ts" << '//E*O*F sysprint/ts//'
#
# Copyright 1988 Gareth Waddell and Phill Everson
#
# Refer to the COPYRIGHT file for an explicit listing of the terms
# of this copyright and your responsibilities as distributor.
#
#Csh
foreach i (`nbrs $1 $2 $3`)
st -m $i >m$i
end
//E*O*F sysprint/ts//
exit 0
- ------- End of Forwarded Message