games-request@tekred.TEK.COM (12/18/87)
Submitted by: Jeff Okamoto <okamoto%hpccc@hplabs.HP.COM>
Comp.sources.games: Volume 3, Issue 22
Archive-name: trek73/Part01
[This is the latest version (4.0) of the famous Trek73 game.
The Makefile is setup for either SYSV or BSD by some simple
editing. I added the new README file (and moved Jeff's to
README2) so you can get an idea of what the game is about
(see below). -br]
#! /bin/sh
# This is a shell archive. Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file". To overwrite existing
# files, type "sh file -c". You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g.. If this archive is complete, you
# will see the following message at the end:
# "End of archive 1 (of 6)."
# Contents: README MANIFEST man src src/bpv.c src/cmds1.c src/cmds2.c
# src/grammar.c
# Wrapped by billr@tekred on Thu Dec 17 11:43:30 1987
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f README -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"README\"
else
echo shar: Extracting \"README\" \(2322 characters\)
sed "s/^X//" >README <<'END_OF_README'
XFrom the first page of the manual:
X
X T R E K 7 3
X
X Version 4.0
X
X A Star Trek Battle Simulation
X
X
X Trek73 is a computer-simulated battle based on the famous
XStar Trek television series and the board game Star Fleet Bat-
Xtles. Via computer terminal, you can clash with enemy battle
Xcruisers, such as Klingon D-7's and Romulan Sparrowhawks, and use
Xthe same strategies that Captain Kirk has used. Like Kirk, you
Xcontrol a Federation vessel similar to the Enterprise; a computer
Xprogram directs the enemy. Victory can fall into several
Xcategories:
X
X Decisive Victory -- You completely destroy or cripple the
Xattacking force.
X
X Tactical Victory -- You out-maneuver the enemy using high-
Xspeed escapes, corbomite bluffs, `play dead' tactics; or the
Xenemy surrenders.
X
X Moral Victory -- You surrender or self-destruct and destroy
Xeach other.
X
X All distances are measured in megameters, one million meters
X(abbreviated `M'). Speed is expressed in `Warp Factors'. Each
Xwarp factor equals 100M per second.[1] All angles are expressed
Xin common degrees from zero to 360, measured counter-clockwise
Xfrom the x-axis, similar to reading a protractor. Only two
Xdimensions are used.[2]
X
X Play is as follows:
X
X 1. You issue one of a number of commands (fire phasers,
Xchange course, launch antimatter pods, surrender, etc.) by typing
Xthe appropriate code number into the keyboard;
X
X 2. The enemy, under programmed instructions, issues a simi-
Xlar command;
X
X 3. Both your commands are executed (phasers are fired,
Xprobes are launched, damages are assessed, courses changed, etc.)
Xwhile the vessels move through space;
X
X 4. Unless certain end-game conditions are met (you destroy
Xthe enemy, the enemy destroys you, your out-maneuver the enemy,
Xyou both destroy each other, or one party surrenders) the above
Xsteps are repeated.
X
X__________________________
X(R) Star Trek is a registered trademark of Paramount Pictures.
X
X(TM) Star Fleet Battles is a trademark held jointly by Task
X Force Games and Amarillo Design Bureau.
X
X 1. Although technically incorrect, it does save the player
X from having to compute cube roots.
X
X 2. This saves the player from having to work out problems in
X spherical trigonometry.
END_OF_README
if test 2322 -ne `wc -c <README`; then
echo shar: \"README\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f MANIFEST -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"MANIFEST\"
else
echo shar: Extracting \"MANIFEST\" \(2034 characters\)
sed "s/^X//" >MANIFEST <<'END_OF_MANIFEST'
X File Name Archive # Description
X-----------------------------------------------------------
X MANIFEST 1 This shipping list
X Makefile 6
X README 1
X README2 2
X man 1
X man/00.t 3
X man/01.t 4
X man/02.t 3
X man/03.t 5
X man/04.5.t 6
X man/04.t 4
X man/05.t 6
X man/06.t 6
X man/07.t 6
X man/08ca.t 6
X man/08cl.t 6
X man/08dd.t 6
X man/08dn.t 6
X man/09ca.t 6
X man/09cl.t 6
X man/09dd.t 6
X man/09dn.t 6
X man/10.t 5
X man/Makefile 5
X man/bpv.6 3
X man/header 5
X man/shipyard.6 6
X man/trek73.6 5
X src 1
X src/Makefile 5
X src/bpv.c 1
X src/cmds1.c 1
X src/cmds2.c 1
X src/cmds3.c 4
X src/cmds4.c 2
X src/command.l 6
X src/damage.c 3
X src/defines.h 5
X src/dist.c 5
X src/endgame.c 5
X src/enemycom.c 2
X src/externs.h 6
X src/firing.c 4
X src/getopt.c 6
X src/globals.c 2
X src/grammar.c 1
X src/grammar.y 3
X src/init.c 3
X src/main.c 4
X src/misc.c 4
X src/mission.c 5
X src/moveships.c 2
X src/parseopts.c 4
X src/parsit.c 5
X src/printships.c 6
X src/save.c 5
X src/ships.c 4
X src/shipyard.c 4
X src/special.c 3
X src/strat1.c 2
X src/structs.h 3
X src/subs.c 5
X src/union.h 6
X src/vers.c 6
END_OF_MANIFEST
if test 2034 -ne `wc -c <MANIFEST`; then
echo shar: \"MANIFEST\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test ! -d man ; then
echo shar: Creating directory \"man\"
mkdir man
fi
if test ! -d src ; then
echo shar: Creating directory \"src\"
mkdir src
fi
if test -f src/bpv.c -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"src/bpv.c\"
else
echo shar: Extracting \"src/bpv.c\" \(1439 characters\)
sed "s/^X//" >src/bpv.c <<'END_OF_src/bpv.c'
X#ident "@(#) TREK73 $Header: bpv.c,v 1.2 87/10/09 15:48:35 okamoto Exp $"
X/*
X * $Source: /ccc/okamoto/src/trek/src/RCS/bpv.c,v $
X *
X * $Header: bpv.c,v 1.2 87/10/09 15:48:35 okamoto Exp $
X *
X * $Log: bpv.c,v $
X * Revision 1.2 87/10/09 15:48:35 15:48:35 okamoto (Jeff Okamoto)
X * Added declaration of round as a function returning a double.
X *
X * Revision 1.1 87/10/09 11:00:29 11:00:29 okamoto (Jeff Okamoto)
X * Initial revision
X *
X */
X/*
X * TREK73: bpv.c
X *
X * Calculate the Basic Point Value of a ships
X *
X */
X
Xvoid
Xcalculate(regen, pods, p_div, t_div, weapons, crew, bpv, eff, turn, max)
Xdouble regen; /* Regeneration */
Xfloat pods; /* Number of antimatter pods */
Xfloat p_div; /* Shield divisor for phasers */
Xfloat t_div; /* Shield divisor for torps */
Xint weapons; /* Number of weapons */
Xint crew; /* Number of crew */
Xdouble *bpv; /* Return for BPV */
Xdouble *eff; /* Return for efficiency */
Xint *turn; /* Turn per segment */
Xint *max; /* Maximum speed */
X{
X double floor(), round();
X
X *bpv = 0.;
X *bpv += regen * 12;
X *bpv += pods / 2;
X *bpv += p_div * 30;
X *bpv += t_div * 40;
X *bpv += weapons * 10;
X *bpv += crew / 15;
X
X *eff = round(4 * (0.0034 * *bpv - 0.78)) / 4.0;
X if (*eff< 0.25)
X *eff= 0.25;
X *turn = (int) (10 - floor(*bpv / 100.0));
X if (*turn < 1)
X *turn = 1;
X *max= (int) round(-0.004 * *bpv + 11.0);
X if (*max < 1)
X *max = 1;
X}
X
Xdouble
Xround(x)
Xdouble x;
X{
X double floor();
X
X return(floor(x + 0.5));
X}
END_OF_src/bpv.c
if test 1439 -ne `wc -c <src/bpv.c`; then
echo shar: \"src/bpv.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f src/cmds1.c -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"src/cmds1.c\"
else
echo shar: Extracting \"src/cmds1.c\" \(14229 characters\)
sed "s/^X//" >src/cmds1.c <<'END_OF_src/cmds1.c'
X#ident "@(#) TREK73 $Header: cmds1.c,v 1.1 87/10/09 11:00:47 okamoto Exp $"
X/*
X * $Source: /ccc/okamoto/src/trek/src/RCS/cmds1.c,v $
X *
X * $Header: cmds1.c,v 1.1 87/10/09 11:00:47 okamoto Exp $
X *
X * $Log: cmds1.c,v $
X * Revision 1.1 87/10/09 11:00:47 11:00:47 okamoto (Jeff Okamoto)
X * Initial revision
X *
X */
X/*
X * TREK73: cmds1.c
X *
X * User Commands
X *
X * fire_phasers, fire_tubes, lock_phasers, lock_tubes,
X * turn_phasers, turn_tubes, load_tubes, launch_probe,
X * probe_control
X *
X */
X
X#include "externs.h"
X
Xint
Xfire_phasers(sp)
Xstruct ship *sp;
X{
X char buf1[20];
X char buf2[20];
X char c;
X int typed[MAXPHASERS];
X register int i;
X register int k;
X
X for (i=0; i < MAXPHASERS; i++)
X typed[i] = 0;
X printf(" fire phasers [1-%d] ", sp->num_phasers);
X (void) Gets(buf1, sizeof(buf1));
X if (buf1[0] == NULL) {
X printf("%s: Belay that order!\n", captain);
X return 0;
X }
X printf(" spread [%d-%d] ", MIN_PHASER_SPREAD,
X MAX_PHASER_SPREAD);
X (void) Gets(buf2, sizeof(buf2));
X if (buf2[0] == NULL) {
X printf("%s: Belay that order!\n", captain);
X return 0;
X }
X i = atoi(buf2);
X if (i < MIN_PHASER_SPREAD || i > MAX_PHASER_SPREAD)
X return 0;
X sp->p_spread = i;
X if (strcmp(buf1, "all") && strcmp(buf1, "ALL"))
X for (i=0; c = buf1[i]; i++) {
X k = c - '1';
X if (k < 0 || k > sp->num_phasers - 1)
X continue;
X typed[k]++;
X if (sp->phasers[k].status & (P_DAMAGED | P_FIRING))
X continue;
X sp->phasers[k].status |= P_FIRING;
X }
X else
X for (i=0; i<sp->num_phasers; i++) {
X typed[i]++;
X if (sp->phasers[i].status & (P_DAMAGED | P_FIRING))
X continue;
X sp->phasers[i].status |= P_FIRING;
X }
X check_p_damage(typed, sp, "fire"); /* Type if damaged */
X check_p_turn(typed, sp, 1);
X return 1;
X}
X
X
Xint
Xfire_tubes(sp)
Xstruct ship *sp;
X{
X char buf1[20];
X char c;
X int typed[MAXTUBES];
X register int i;
X register int j;
X register int k;
X
X for (i=0; i < MAXTUBES; i++)
X typed[i] = 0;
X printf(" fire tubes [1-%d] ", sp->num_tubes);
X (void) Gets(buf1, sizeof(buf1));
X if (buf1[0] == NULL) {
X printf("%s: Belay that order!\n", captain);
X return 0;
X }
X if (strcmp(buf1, "all") && strcmp(buf1, "ALL"))
X for (i=0; c = buf1[i]; i++) {
X k = c - '1';
X if (k < 0 || k > sp->num_tubes - 1)
X continue;
X typed[k]++;
X if (sp->tubes[k].status & (T_DAMAGED | T_FIRING))
X continue;
X sp->tubes[k].status |= T_FIRING;
X }
X else
X for (i=0; i < sp->num_tubes; i++) {
X typed[i]++;
X if (sp->tubes[i].status & (T_DAMAGED | T_FIRING))
X continue;
X sp->tubes[i].status |= T_FIRING;
X }
X check_t_damage(typed, sp, "fire"); /* Type if damaged */
X check_t_turn(typed, sp, 1);
X j = 0;
X for (i=0; i < sp->num_tubes; i++) {
X if ((typed[i] == 0) || (!(sp->tubes[i].status & T_FIRING)))
X continue;
X if (sp->tubes[i].load == 0) {
X if (!j)
X printf("Computer: Tube(s) %d", i + 1);
X else
X printf(", %d", i + 1);
X j++;
X }
X }
X if (j > 1)
X puts(" are not loaded.");
X else if (j == 1)
X puts(" is not loaded.");
X return 0;
X}
X
X
Xint
Xlock_phasers(sp)
Xstruct ship *sp;
X{
X char buf1[20];
X char buf2[20];
X int typed[MAXPHASERS];
X char c;
X struct ship *ep;
X register int i;
X register int k;
X
X for (i=0; i < MAXPHASERS; i++)
X typed[i] = 0;
X if (is_dead(sp, S_COMP)) {
X printf("%s: Impossible %s, our computer is dead.\n",
X science, title);
X return 0;
X }
X if (!syswork(sp, S_COMP)) {
X printf("%s: Our computer is temporarily buggy",
X science);
X return 0;
X }
X printf(" lock phasers [1-%d] ", sp->num_phasers);
X (void) Gets(buf1, sizeof(buf1));
X if (buf1[0] == NULL)
X return 0;
X printf(" onto [whom] ");
X (void) Gets(buf2, sizeof(buf2));
X if (buf2[0] == NULL)
X return 0;
X ep = ship_name(buf2);
X if (ep == NULL)
X return 0;
X if (cantsee(ep)) {
X printf("%s: %s, unable to lock phasers onto %s.\n",
X nav, title, ep->name);
X return 0;
X }
X if (strcmp(buf1, "all") && strcmp(buf1, "ALL"))
X for (i=0; c = buf1[i]; i++) {
X k = c - '1';
X if (k < 0 || k > sp->num_phasers - 1)
X continue;
X typed[k]++;
X if (sp->phasers[k].status & P_DAMAGED)
X continue;
X sp->phasers[k].target = ep;
X }
X else
X for (i=0; i < sp->num_phasers; i++) {
X typed[i]++;
X if (sp->phasers[i].status & P_DAMAGED)
X continue;
X sp->phasers[i].target = ep;
X }
X check_p_damage(typed, sp, "lock");
X check_p_turn(typed, sp, 0);
X return 1;
X}
X
X
Xint
Xlock_tubes(sp)
Xstruct ship *sp;
X{
X char buf1[20];
X char buf2[20];
X int typed[MAXTUBES];
X char c;
X struct ship *ep;
X register int i;
X register int k;
X
X for (i=0; i < sp->num_tubes; i++)
X typed[i] = 0;
X if (is_dead(sp, S_COMP)) {
X printf("%s: Impossible %s, our computer is dead.\n", science, title);
X return 0;
X }
X if (!syswork(sp, S_COMP)) {
X printf("%s: Our computer is temporarily buggy", science);
X return 0;
X }
X printf(" lock tubes [1-%d] ", sp->num_tubes);
X (void) Gets(buf1, sizeof(buf1));
X if (buf1[0] == NULL)
X return 0;
X printf(" onto whom ");
X (void) Gets(buf2, sizeof(buf2));
X if (buf2[0] == NULL)
X return 0;
X ep = ship_name(buf2);
X if (ep == NULL)
X return 0;
X if (cantsee(ep)) {
X printf ("%s: %s, unable to lock tubes onto %s.",
X nav, title, ep->name);
X return 0;
X }
X if (strcmp(buf1, "all") && strcmp(buf1, "ALL"))
X for (i=0; c = buf1[i]; i++) {
X k = c - '1';
X if (k < 0 || k > sp->num_tubes - 1)
X continue;
X typed[k]++;
X if (sp->tubes[k].status & T_DAMAGED)
X continue;
X sp->tubes[k].target = ep;
X }
X else
X for (i=0; i < sp->num_tubes; i++) {
X typed[i]++;
X if (sp->tubes[i].status & T_DAMAGED)
X continue;
X sp->tubes[i].target = ep;
X }
X check_t_damage(typed, sp, "lock");
X check_t_turn(typed, sp, 0);
X return 1;
X}
X
X
Xint
Xturn_phasers(sp)
Xstruct ship *sp;
X{
X char buf1[20];
X char buf2[20];
X char c;
X int typed[MAXPHASERS];
X register int i;
X register float j;
X register int k;
X
X for (i=0; i < MAXPHASERS; i++)
X typed[i] = 0;
X printf(" turn phasers [1-%d] ", sp->num_phasers);
X (void) Gets(buf1, sizeof(buf1));
X if (buf1[0] == NULL)
X return 0;
X printf(" to [0-360] ");
X (void) Gets(buf2, sizeof(buf2));
X if (buf2[0] == NULL)
X return 0;
X j = atof(buf2);
X if (j < 0.0 || j > 360.0)
X return 0;
X if (strcmp(buf1, "all") && strcmp(buf1, "ALL"))
X for (i=0; c = buf1[i]; i++) {
X k = c - '1';
X if (k < 0 || k > sp->num_phasers - 1)
X continue;
X typed[k]++;
X if (sp->phasers[k].status & P_DAMAGED)
X continue;
X sp->phasers[k].target = NULL;
X sp->phasers[k].bearing = j;
X }
X else
X for (i=0; i < sp->num_phasers; i++) {
X typed[i]++;
X if (sp->phasers[i].status & P_DAMAGED)
X continue;
X sp->phasers[i].target = NULL;
X sp->phasers[i].bearing = j;
X }
X check_p_damage(typed, sp, "turn");
X check_p_turn(typed, sp, 0);
X return 1;
X}
X
X
Xint
Xturn_tubes(sp)
Xstruct ship *sp;
X{
X char buf1[20];
X char buf2[20];
X char c;
X int typed[MAXTUBES];
X register int i;
X register float j;
X register int k;
X
X for (i=0; i < MAXTUBES; i++)
X typed[i] = 0;
X printf(" turn tubes [1-%d] ", sp->num_tubes);
X (void) Gets(buf1, sizeof(buf1));
X if (buf1[0] == NULL)
X return 0;
X printf(" to [0-360] ");
X (void) Gets(buf2, sizeof(buf2));
X if (buf2[0] == NULL)
X return 0;
X j = atof(buf2);
X if (j < 0.0 || j > 360.0)
X return 0;
X if (strcmp(buf1, "all") && strcmp(buf1, "ALL"))
X for (i=0; c = buf1[i]; i++) {
X k = c - '1';
X if (k < 0 || k > sp->num_tubes - 1)
X continue;
X typed[k]++;
X if (sp->tubes[k].status & T_DAMAGED)
X continue;
X sp->tubes[k].target = NULL;
X sp->tubes[k].bearing = j;
X }
X else
X for (i=0; i < sp->num_tubes; i++) {
X typed[i]++;
X if (sp->tubes[i].status & T_DAMAGED)
X continue;
X sp->tubes[i].target = NULL;
X sp->tubes[i].bearing = j;
X }
X check_t_damage(typed, sp, "turn");
X check_t_turn(typed, sp, 0);
X return 1;
X}
X
X
Xint
Xload_tubes(sp)
Xstruct ship *sp;
X{
X char buf1[20];
X char buf2[20];
X char c;
X int load;
X struct tube *tp;
X int typed[MAXTUBES];
X register int i;
X register float j;
X register int k;
X
X for (i=0; i<MAXTUBES; i++)
X typed[i] = 0;
X load = 0;
X printf(" [load or unload] ");
X (void) Gets(buf1, sizeof(buf1));
X if (buf1[0] == NULL)
X return 0;
X if (*buf1 == 'l' || *buf1 == 'L')
X load++;
X else if (*buf1 != 'u' && *buf1 != 'U')
X return 0;
X printf(" tubes [1-%d] ", sp->num_tubes);
X (void) Gets(buf2, sizeof(buf2));
X if (buf2[0] == NULL)
X return 0;
X if (strcmp(buf2, "all") && strcmp(buf2, "ALL"))
X for (i=0; c = buf2[i]; i++) {
X k = c - '1';
X if (k < 0 || k > sp->num_tubes - 1)
X continue;
X typed[k]++;
X }
X else
X for (i=0; i < sp->num_tubes; i++)
X typed[i]++;
X for (i = 0; i < sp->num_tubes; i++) {
X tp = &sp->tubes[i];
X if (!typed[i] || tp->status & T_DAMAGED)
X continue;
X if (load) {
X j = min(sp->energy, MAX_TUBE_CHARGE - tp->load);
X if (j <= 0)
X continue;
X sp->energy -= j;
X sp->pods -= j;
X tp->load += j;
X } else {
X j = tp->load;
X if (j <= 0)
X continue;
X sp->energy += j;
X sp->pods += j;
X tp->load = 0;
X }
X }
X printf("%s: Tubes now ", engineer);
X for (i=0; i < sp->num_tubes; i++) {
X if (sp->tubes[i].status & T_DAMAGED)
X printf(" -- ");
X else
X printf(" %-2d ", sp->tubes[i].load);
X }
X printf(" energy at %d/%d\n", (int)sp->energy, (int)sp->pods);
X return 1;
X}
X
X
Xint
Xlaunch_probe(sp)
Xstruct ship *sp;
X{
X char buf1[20];
X int pods, delay, prox;
X float course;
X struct ship *target;
X struct list *lp;
X struct torpedo *pp;
X
X pods = delay = prox = 0;
X course = 0.0;
X target = NULL;
X if (is_dead(sp, S_PROBE)) {
X printf("%s: Probe launcher destroyed!\n", engineer);
X return 0;
X }
X if (!syswork(sp, S_PROBE)) {
X printf("%s: Probe launcher temporarily disabled, %s\n",
X engineer, title);
X return 0;
X }
X if (sp->energy < MIN_PROBE_CHARGE) {
X printf("%s: We've not enough power, Captain.\n", engineer);
X return 0;
X }
X printf("%s: %d pods available.\n", engineer, (int)sp->energy);
X printf("%s: Number to launch [%d+] is ", captain, MIN_PROBE_CHARGE);
X (void) Gets(buf1, sizeof(buf1));
X if (buf1[0] == NULL)
X goto bad_param;
X pods = atoi(buf1);
X if (pods < MIN_PROBE_CHARGE || pods > sp->energy)
X goto bad_param;
X printf(" set time delay to [0-%d] ", MAX_PROBE_DELAY);
X (void) Gets(buf1, sizeof(buf1));
X if (buf1[0] == NULL)
X goto bad_param;
X delay = atoi(buf1);
X if (delay < 0 || delay > MAX_PROBE_DELAY)
X goto bad_param;
X printf(" set proximity delay to [%d+] ", MIN_PROBE_PROX);
X (void) Gets(buf1, sizeof(buf1));
X if (buf1[0] == NULL)
X goto bad_param;
X prox = atoi(buf1);
X if (prox < MIN_PROBE_PROX)
X goto bad_param;
X printf(" launch towards [whom, if anyone] ");
X (void) Gets(buf1, sizeof(buf1));
X if (*buf1) {
X target = ship_name(buf1);
X if (target == NULL)
X goto bad_param;
X if (cantsee(target) || !syswork(sp, S_SENSOR)) {
X printf("%s: %s, unable to lock probe onto the %s.\n",
X helmsman, title, target->name);
X return 0;
X }
X } else {
X printf(" course [0-360] ");
X (void) Gets(buf1, sizeof(buf1));
X if (buf1[0] == NULL)
X goto bad_param;
X course = atof(buf1);
X if (course < 0.0 || course > 360.0)
X goto bad_param;
X target = NULL;
X }
X /*
X * add a new item to the list of items in space
X */
X lp = newitem(I_PROBE);
X lp->data.tp = MKNODE(struct torpedo, *, 1);
X pp = lp->data.tp;
X if (pp == (struct torpedo *)NULL) {
X fprintf(stderr, "launch_probe: malloc failed\n");
X exit(2);
X }
X pp->from = sp;
X pp->fuel = pods;
X pp->timedelay = delay;
X pp->speed = sp->warp;
X pp->newspeed = 3.0;
X pp->prox = prox;
X pp->target = target;
X pp->course = course;
X pp->x = sp->x;
X pp->y = sp->y;
X pp->id = new_slot();
X pp->type = TP_PROBE;
X /*
X * subtract the pods used
X */
X sp->pods -= pods;
X sp->energy -= pods;
X sp->probe_status = PR_LAUNCHING;
X printf("%s: Probe %d away\n",engineer, pp->id);
X return 1;
Xbad_param:
X printf("%s: Bad parameters, %s.\n", science, title);
X return 0;
X}
X
X
Xint
Xprobe_control(sp)
Xstruct ship *sp;
X{
X register struct list *lp;
X register int i;
X register float j;
X register struct torpedo *pp;
X struct torpedo *probes[20];
X int probenum;
X struct ship *ep;
X int pnum;
X float bear;
X int range;
X char buf1[20];
X char *bp;
X
X pnum = 0;
X for (lp = &head; lp != tail; lp = lp->fwd) {
X if (lp->type != I_PROBE)
X continue;
X pp = lp->data.tp;
X if (pp->from != sp)
X continue;
X if (!pnum)
X printf("\nprobe bearng range course time prox units target\n");
X if (pnum >= sizeof probes / sizeof probes[0]) {
X printf("\n%s: There are other probes out but\n",
X nav);
X puts(" these are all we can control at one time.");
X }
X probes[pnum] = pp;
X pnum++;
X range = rangefind(sp->x, pp->x, sp->y, pp->y);
X bear = bearing(sp->x, pp->x, sp->y, pp->y);
X if (pp->target == NULL)
X bp = "NONE";
X else
X bp = pp->target->name;
X printf(" %2d %4.1f %5d %4.0f %4.1f %5d %3d %s\n",
X pp->id, bear, range, pp->course, pp->timedelay,
X pp->prox, pp->fuel, bp);
X }
X if (!pnum) {
X printf("%s: What probes?\n", nav);
X return 0;
X }
X printf("%s: Detonate all probes?\n", nav);
X printf("%s: [yes or no] ", captain);
X (void) Gets(buf1, sizeof(buf1));
X if (buf1[0] != NULL && (*buf1 == 'Y' || *buf1 == 'y')) {
X printf("%s: Aye, %s\n", nav, title);
X for (i=0; i<pnum; i++)
X probes[i]->timedelay = 0.0;
X sp->probe_status = PR_DETONATE;
X return 1;
X }
X printf(" control probe [#] ");
X (void) Gets(buf1, sizeof(buf1));
X if (buf1[0] == NULL)
X return 0;
X probenum = atoi(buf1);
X for (i=0; i < pnum; i++)
X if (probes[i]->id == probenum)
X break;
X if (i == pnum)
X return 0;
X probenum = i;
X printf("%s: Detonate it?\n", nav);
X printf("%s: [yes or no] ", captain);
X (void) Gets(buf1, sizeof(buf1));
X if (buf1[0] != NULL && (*buf1 == 'y' || *buf1 == 'Y')) {
X probes[probenum]->timedelay = 0.;
X sp->probe_status = PR_DETONATE;
X return 1;
X }
X printf(" lock it onto [whom, if anyone] ");
X (void) Gets(buf1, sizeof(buf1));
X if (buf1[0] != NULL) {
X ep = ship_name(buf1);
X if (ep != NULL) {
X sp->probe_status = PR_LOCK;
X if (cansee(ep) && syswork(sp, S_SENSOR)) {
X probes[probenum]->target = ep;
X printf("%s: locking.\n", nav);
X return 1;
X } else {
X printf("%s: %s, unable to lock probe on the %s.\n",
X helmsman, title, ep->name);
X return 0;
X }
X }
X }
X printf(" set it to course [0-360] ");
X (void) Gets(buf1, sizeof(buf1));
X if (buf1[0] == NULL)
X return 0;
X sp->probe_status = PR_LOCK;
X j = atof(buf1);
X if (j < 0.0 || j > 360.0)
X return 0;
X probes[probenum]->course = j;
X probes[probenum]->target = NULL;
X printf("%s: setting in new course.\n", nav);
X return 1;
X}
END_OF_src/cmds1.c
if test 14229 -ne `wc -c <src/cmds1.c`; then
echo shar: \"src/cmds1.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f src/cmds2.c -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"src/cmds2.c\"
else
echo shar: Extracting \"src/cmds2.c\" \(15121 characters\)
sed "s/^X//" >src/cmds2.c <<'END_OF_src/cmds2.c'
X#ident "@(#) TREK73 $Header: cmds2.c,v 1.2 87/10/13 16:00:46 okamoto Exp $"
X/*
X * $Source: /ccc/okamoto/src/trek/src/RCS/cmds2.c,v $
X *
X * $Header: cmds2.c,v 1.2 87/10/13 16:00:46 okamoto Exp $
X *
X * $Log: cmds2.c,v $
X * Revision 1.2 87/10/13 16:00:46 16:00:46 okamoto (Jeff Okamoto)
X * Fixed calls to Gets
X *
X * Revision 1.1 87/10/09 11:01:38 11:01:38 okamoto (Jeff Okamoto)
X * Initial revision
X *
X */
X/*
X * TREK73: cmds2.c
X *
X * User Commands
X *
X * pos_report, pos_display, pursue, elude, helm, self_scan, scan
X *
X * (print_damages)
X *
X */
X
X#include "externs.h"
X#include <ctype.h>
X
Xint
Xpos_report(sp)
Xstruct ship *sp;
X{
X struct ship *sp1;
X struct torpedo *tp;
X struct list *lp;
X int x, y;
X int range;
X float bear;
X float speed;
X float course;
X float relbear;
X float revrelbear;
X int maxlen = 0;
X int incltorp = 0;
X char whitespace[5], who[80];
X#ifdef SHOWTORP
X char buf[20];
X#endif
X
X#ifdef SHOWTORP
X printf("%s: Include torpedoes?\n", science);
X printf("%s: [yes or no] ", captain);
X (void) Gets(buf, sizeof buf);
X if (buf[0] == 'y' || buf[0] == 'Y')
X incltorp = 1;
X#endif
X /*
X * Go through the list of objects and find out the longest
X * name of any of them. This is to insure that no matter
X * what the names of the ship, the position report will
X * come out formatted.
X */
X for (lp = &head; lp != tail; lp = lp->fwd)
X switch(lp->type) {
X case I_SHIP:
X sp1 = lp->data.sp;
X maxlen = max(maxlen, strlen(sp1->name));
X break;
X#ifdef SHOWTORP
X case I_TORPEDO:
X if (!incltorp)
X break;
X tp = lp->data.tp;
X maxlen = max(maxlen, strlen(tp->from->name) + 8);
X break;
X#endif
X case I_PROBE:
X tp = lp->data.tp;
X maxlen = max(maxlen, strlen(tp->from->name) + 9);
X break;
X case I_ENG:
X tp = lp->data.tp;
X maxlen = max(maxlen, strlen(tp->from->name) + 12);
X break;
X }
X maxlen += 2; /* For "cloaked" column */
X /*
X * Construct a string %ns where n is the length of the
X * longest name.
X */
X (void) sprintf(whitespace, "%%%ds", maxlen);
X /*
X * And print out the position report
X */
X printf(whitespace, " ");
X puts(" abs rel rev rel");
X printf(whitespace, " ");
X puts(" class warp course bearing range bearing bearing");
X for (lp = &head; lp != tail; lp = lp->fwd) {
X if (lp->type == 0)
X continue;
X sp1 = NULL;
X tp = NULL;
X if (lp->type == I_SHIP) {
X sp1 = lp->data.sp;
X if (is_dead(sp1, S_DEAD))
X continue;
X if (cansee(sp1)) {
X x = sp1->x;
X y = sp1->y;
X speed = sp1->warp;
X course = sp1->course;
X /* Reset what we know about his position */
X sp1->position.x = sp1->x;
X sp1->position.y = sp1->y;
X sp1->position.warp = sp1->warp;
X sp1->position.course = sp1->course;
X sp1->position.bearing = bearing(sp->x,
X sp1->x, sp->y, sp1->y);
X sp1->position.range = rangefind(sp->x,
X sp1->x, sp->y, sp1->y);
X (void) sprintf(who, "%.*s ",
X sizeof who - 3, sp1->name);
X } else {
X x = sp1->position.x;
X y = sp1->position.y;
X speed = sp1->position.warp;
X course = sp1->position.course;
X (void) sprintf(who, "%.*s *",
X sizeof who - 3, sp1->name);
X }
X } else {
X tp = lp->data.tp;
X if (lp->type == I_TORPEDO && !incltorp)
X continue;
X x = tp->x;
X y = tp->y;
X speed = tp->speed;
X course = tp->course;
X switch(lp->type) {
X#ifdef SHOWTORP
X case I_TORPEDO:
X (void) sprintf(who,"%.*s torp %d ",
X sizeof who - 11, tp->from->name,
X tp->id);
X break;
X#endif
X case I_PROBE:
X (void) sprintf(who, "%.*s probe %d ",
X sizeof who - 12, tp->from->name,
X tp->id);
X break;
X case I_ENG:
X (void) sprintf(who,"%.*s engineering ",
X sizeof who - 15, tp->from->name);
X break;
X default:
X (void) sprintf(who, "lp->type = %d ",
X lp->type);
X break;
X }
X }
X printf(whitespace, who);
X if (sp1)
X printf("%5s", sp1->class);
X else
X printf(" ");
X printf("%6.1f %3.0f ", speed, course);
X if (sp1 == sp) {
X if (sp->target != NULL)
X printf("helm locked on %s", sp->target->name);
X putchar('\n');
X } else {
X bear = bearing(sp->x, x, sp->y, y);
X range = rangefind(sp->x, x, sp->y, y);
X relbear = rectify(round(bear - sp->course));
X revrelbear = rectify(round(bear + 180.0 - course));
X printf(" %3.0f %5d %3.0f %3.0f\n",
X bear, range, relbear, revrelbear);
X }
X }
X return 0;
X}
X
X
Xint
Xpos_display(sp)
Xstruct ship *sp;
X{
X register int i;
X register int j;
X int range;
X char buf1[20];
X int x, y;
X float xf, yf;
X int h, v;
X int hpitch = 10;
X int vpitch = 6;
X char map[13][23]; /* [2*MAXvpitch + 1][2*MAXhpitch + 1] */
X struct list *lp;
X struct ship *sp1;
X struct torpedo *tp;
X char c;
X
X if (is_dead(sp, S_SENSOR)) {
X printf("%s: Sensors are damaged.\n", science);
X return 0;
X }
X if (!syswork(sp, S_SENSOR)) {
X printf("%s: Sensors are temporarily inoperative.\n",
X science);
X return 0;
X }
X printf(" display to [%d-%d] ", MIN_SENSOR_RANGE, MAX_SENSOR_RANGE);
X (void) Gets(buf1, sizeof(buf1));
X if (buf1[0] == NULL)
X return 0;
X range = atoi(buf1);
X if (range < MIN_SENSOR_RANGE || range > MAX_SENSOR_RANGE)
X return 0;
X /*
X * Compensation for aspect ratio of the output device
X */
X x = range/hpitch;
X y = range/vpitch;
X for (i=0; i<=2*vpitch; i++) {
X if (i == 0 || i == 2*vpitch)
X for(j=0; j<=2*hpitch; j++)
X map[i][j] = '-';
X else
X for(j=0; j<=2*hpitch; j++)
X map[i][j] = ' ';
X }
X map[vpitch][hpitch] = '+';
X for (lp = &head; lp != tail; lp = lp->fwd) {
X if (lp->data.sp == sp)
X continue;
X if (lp->type == I_SHIP) {
X sp1 = lp->data.sp;
X if (cansee(sp1)) {
X /* Update the position */
X sp1->position.x = sp1->x;
X sp1->position.y = sp1->y;
X sp1->position.warp = sp1->warp;
X sp1->position.course = sp1->course;
X sp1->position.bearing = bearing(sp->x, x, sp->y, y);
X sp1->position.range = rangefind(sp->x, x, sp->y, y);
X xf = sp1->x - sp->x;
X yf = sp1->y - sp->y;
X } else {
X xf = sp1->position.x - sp->x;
X yf = sp1->position.y - sp->y;
X }
X } else {
X tp = lp->data.tp;
X xf = tp->x - sp->x;
X yf = tp->y - sp->y;
X }
X v = yf/y + vpitch + 0.5;
X h = xf/x + hpitch + 0.5;
X if (v < 0 || v > 2*vpitch)
X continue;
X if (h < 0 || h > 2*hpitch)
X continue;
X switch (lp->type) {
X case I_SHIP:
X c = lp->data.sp->name[0];
X if (cantsee(lp->data.sp))
X c = tolower(c);
X break;
X case I_TORPEDO:
X c = ':';
X break;
X case I_ENG:
X c = '#';
X break;
X case I_PROBE:
X c = '*';
X break;
X default:
X c = '?';
X break;
X }
X map[2*vpitch - v][h] = c;
X }
X for (i=0; i<=2*vpitch; i++) {
X for (j=0; j<=2*hpitch; j++)
X if (map[i][j] != ' ')
X break;
X if (j <= 2*hpitch)
X printf("%.*s", 2*hpitch + 1, map[i]);
X putchar('\n');
X }
X return 0;
X}
X
X
Xint
Xpursue(sp)
Xstruct ship *sp;
X{
X register float i;
X char buf1[20];
X struct ship *ep;
X float warp;
X
X if (is_dead(sp, S_COMP)) {
X printf("%s: Impossible, %s, our computer is dead\n",science ,title);
X return 0;
X }
X if (!syswork(sp, S_COMP)) {
X printf("%s: Main computer down, %s. Rebooting.\n",
X science, title);
X return 0;
X }
X printf(" Mr. %s, pursue [who] ", nav);
X (void) Gets(buf1, sizeof(buf1));
X if (buf1[0] == NULL)
X return 0;
X ep = ship_name(buf1);
X if (ep == NULL)
X return 0;
X if (cantsee(ep)) {
X printf("%s: %s, unable to acquire helm lock.\n", nav, title);
X return 0;
X }
X printf(" Mr. %s, warp factor [-%.2f to %.2f] ", helmsman,
X sp->max_speed, sp->max_speed);
X (void) Gets(buf1, sizeof(buf1));
X if (buf1[0] == NULL)
X return 0;
X warp = atof(buf1);
X if (fabs(warp) > 1.0 && is_dead(sp, S_WARP)) {
X printf("%s: Warp drive is dead, Captain.\n", science);
X warp = (warp < 0.0) ? -1.0 : 1.0;
X }
X if (fabs(warp) > sp->max_speed) {
X printf("%s: %s, the engines canna go that fast!\n",engineer, title);
X warp = (warp < 0.0) ? -sp->max_speed : sp->max_speed;
X }
X sp->newwarp = warp;
X sp->target = ep;
X sp->relbear = 0.0;
X i = bearing(sp->x, ep->x, sp->y, ep->y);
X printf("%s: Aye, %s, coming to course %3.0f.\n", nav, title, i);
X sp->newcourse = i;
X return 1;
X}
X
X
Xint
Xelude(sp)
Xstruct ship *sp;
X{
X register float i;
X char buf1[20];
X struct ship *ep;
X float warp;
X
X if (is_dead(sp, S_COMP)) {
X printf("%s: Impossible, %s, our computer is dead\n",
X science, title);
X return 0;
X }
X if (!syswork(sp, S_COMP)) {
X printf("%s: Main computer down, %s. Rebooting.\n",
X science, title);
X return 0;
X }
X printf(" Mr. %s, elude [who] ", nav);
X (void) Gets(buf1, sizeof(buf1));
X if (buf1[0] == NULL)
X return 0;
X ep = ship_name(buf1);
X if (ep == NULL)
X return 0;
X if (cantsee(ep)) {
X printf("%s: %s, unable to acquire helm lock.\n",
X nav, title);
X return 0;
X }
X
X printf(" Mr. %s, warp factor [-%.2f to %.2f] ", helmsman,
X sp->max_speed, sp->max_speed);
X (void) Gets(buf1, sizeof(buf1));
X if (buf1[0] == NULL)
X return 0;
X warp = (float) atof(buf1);
X if (fabs(warp) > 1.0 && is_dead(sp, S_WARP)) {
X printf("%s: Warp drive is dead, Captain.\n", science);
X warp = (warp < 0.0) ? -1.0 : 1.0;
X }
X if (fabs(warp) > sp->max_speed) {
X printf("%s: %s, the engines canna go that fast!\n",engineer, title);
X warp = (warp < 0.0) ? -sp->max_speed : sp->max_speed;
X }
X sp->newwarp = warp;
X sp->target = ep;
X sp->relbear = 180.0;
X i = bearing(sp->x, ep->x, sp->y, ep->y);
X i = rectify(i + 180.0);
X printf("%s: Aye, %s, coming to course %3.0f.\n", nav, title, i);
X sp->newcourse = i;
X return 1;
X}
X
Xint
Xhelm(sp)
Xstruct ship *sp;
X{
X char buf1[20];
X register float course;
X float warp;
X
X printf(" Mr. %s, come to course [0-359] ", nav);
X (void) Gets(buf1, sizeof(buf1));
X if (buf1[0] == NULL)
X return 0;
X course = atof(buf1);
X if (course < 0.0 || course >= 360.0)
X return 0;
X printf(" Mr. %s, warp factor [-%.2f to %.2f] ", helmsman,
X sp->max_speed, sp->max_speed);
X (void) Gets(buf1, sizeof(buf1));
X if (buf1[0] == NULL)
X return 0;
X warp = (float) atof(buf1);
X if (fabs(warp) > 1.0 && is_dead(sp, S_WARP)) {
X printf("%s: Warp drive is dead, Captain.\n", science);
X warp = (warp < 0.0) ? -1.0 : 1.0;
X }
X if (fabs(warp) > sp->max_speed) {
X printf("%s: %s, the engines canna go that fast!\n",engineer, title);
X warp = (warp < 0.0) ? -sp->max_speed : sp->max_speed;
X }
X sp->newwarp = warp;
X sp->newcourse = course;
X sp->target = NULL;
X sp->relbear = 0.0;
X printf("%s: Aye, %s.\n", nav, title);
X printf("%s: Aye, %s.\n", helmsman, title);
X return 1;
X}
X
Xint
Xself_scan(sp)
Xstruct ship *sp;
X{
X (void) print_damage(sp);
X return 1;
X}
X
Xint
Xscan(sp)
Xstruct ship *sp;
X{
X struct ship *ep = NULL;
X struct torpedo *tp = NULL;
X struct list *lp;
X int item = I_UNDEFINED;
X int probe_num;
X char buf1[20];
X
X printf(" %s, scan [who] ", science);
X (void) Gets(buf1, sizeof(buf1));
X if (buf1[0] == NULL)
X return 0;
X if (buf1[0] == '#') {
X strcpy(buf1,buf1+1);
X if (strlen(buf1) == 0) {
X printf("%s: %s, scan whose engineering?\n", science, title);
X return 0;
X }
X ep = ship_name(buf1);
X if (ep == NULL) {
X printf("%s: %s, no such ship as the %s.\n", science, title, buf1);
X return 0;
X }
X for (lp = &head; lp != NULL; lp = lp->fwd) {
X if (lp == tail)
X break;
X if (lp->type == I_UNDEFINED)
X continue;
X if (lp->type == I_ENG && lp->data.tp->from == ep) {
X tp = lp->data.tp;
X break;
X }
X }
X if (tp == NULL) {
X printf("%s: %s, the %s has not jettisoned it's engineering.\n",
X science, title, ep->name);
X return 0;
X }
X item = I_ENG;
X } else if ((probe_num = atoi(buf1)) > 0) {
X for (lp = &head; lp != NULL; lp = lp->fwd) {
X if (lp == tail)
X break;
X if (lp->type != I_PROBE)
X continue;
X if (lp->data.tp->id == probe_num) {
X tp = lp->data.tp;
X break;
X }
X }
X if (tp == NULL) {
X printf("%s: %s, there is no probe %d", science, title, probe_num);
X return 0;
X }
X item = I_PROBE;
X } else {
X ep = ship_name(buf1);
X if (ep == NULL) {
X printf("%s: %s, no such ship as the %s.\n", science, title, buf1);
X return 0;
X }
X item = I_SHIP;
X if (cantsee(ep)) {
X printf("%s: %s, I am unable to scan the %s.\n",
X science, title, ep->name);
X return 0;
X }
X }
X if ((sp != ep) && (is_dead(sp, S_SENSOR))) {
X printf ("%s: The sensors are damaged, Captain.\n",
X science);
X return 0;
X }
X if ((sp != ep) && (!syswork(sp, S_SENSOR))) {
X printf("%s: %s, sensors are temporarily out.\n",
X science, title);
X return 0;
X }
X if ((sp == ep) && (item == I_SHIP)) {
X printf ("%s: Captain, don't you mean 'Damage Report'?\n", science);
X return 0;
X }
X if (item == I_SHIP)
X (void) print_damage(ep);
X else
X (void) scan_torpedo(tp);
X return 1;
X}
X
Xint
Xprint_damage(ep)
Xstruct ship *ep;
X{
X register int i;
X register int j;
X register float k;
X
X printf("\n\nDamages to the %s\n", ep->name);
X for (i=0; i<S_NUMSYSTEMS + 1; i++) {
X if (is_dead(ep, i))
X printf("%s.\n", statmsg[i]);
X else if (ep->status[i] && i < S_NUMSYSTEMS)
X printf("%s damaged %d%%\n", sysname[i], ep->status[i]);
X }
X printf("Survivors: %d\n", ep->complement);
X printf("Helm lock: ");
X if (ep->target == NULL)
X printf("none.\n");
X else
X printf("%s\n",ep->target);
X printf("\nPhasers Control");
X for (i=0; i<ep->num_phasers; i++) {
X if (ep->phasers[i].status & P_DAMAGED)
X printf("\tdamaged");
X else if (ep->phasers[i].target == NULL)
X printf("\tmanual");
X else
X printf("\t%.7s", ep->phasers[i].target->name);
X }
X printf("\n\t turned");
X for (i=0; i<ep->num_phasers; i++)
X if (ep->phasers[i].status & P_DAMAGED)
X printf("\t");
X else if (ep->phasers[i].target == NULL)
X printf("\t%.0f", ep->phasers[i].bearing);
X else
X printf("\tLOCKED");
X printf("\n\t level");
X for (i=0; i<ep->num_phasers; i++)
X if (ep->phasers[i].status & P_DAMAGED)
X printf("\t");
X else
X printf("\t%-2d", ep->phasers[i].load);
X printf("\n");
X printf("\nTubes\tcontrol");
X for (i=0; i<ep->num_tubes; i++) {
X if (ep->tubes[i].status & T_DAMAGED)
X printf("\tdamaged");
X else if (ep->tubes[i].target == NULL)
X printf("\tmanual");
X else
X printf("\t%.7s", ep->tubes[i].target->name);
X }
X printf("\n\t turned");
X for (i=0; i<ep->num_tubes; i++)
X if (ep->tubes[i].status & T_DAMAGED)
X printf("\t");
X else if (ep->tubes[i].target == NULL)
X printf("\t%.0f", ep->tubes[i].bearing);
X else
X printf("\tLOCKED");
X printf("\n\t level");
X for (i=0; i<ep->num_tubes; i++)
X if (ep->tubes[i].status & T_DAMAGED)
X printf("\t");
X else
X printf("\t%-2d", ep->tubes[i].load);
X printf("\n");
X printf("\nShields\t levels");
X for (i=0; i<SHIELDS; i++) {
X j = 100 * ep->shields[i].eff * ep->shields[i].drain;
X printf("\t%-2d", j);
X }
X printf("\n\t drains");
X for (i=0; i<SHIELDS; i++) {
X k = ep->shields[i].attemp_drain;
X printf("\t%-4.2f", k);
X }
X printf("\n\nEfficiency: %4.1f\tFuel remaining: %d\n",
X ep->eff, (int)ep->energy);
X printf("Regeneration: %4.1f\tFuel capacity: %d\n",
X ep->regen, (int)ep->pods);
X return 1;
X}
X
Xint
Xscan_torpedo(pp)
Xstruct torpedo *pp;
X{
X char kind[20];
X char tgt[20];
X
X printf("\nobject id time prox units target\n");
X if (pp->type == TP_PROBE)
X strcpy(kind, "probe");
X else
X strcpy(kind, "engng");
X if (pp->target == NULL)
X strcpy(tgt, "NONE");
X else
X strcpy(tgt, pp->target->name);
X printf("%-7s%2d %2.1f %4d %3d %s\n",
X kind, pp->id, pp->timedelay, pp->prox, pp->fuel, tgt);
X return 1;
X}
END_OF_src/cmds2.c
if test 15121 -ne `wc -c <src/cmds2.c`; then
echo shar: \"src/cmds2.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f src/grammar.c -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"src/grammar.c\"
else
echo shar: Extracting \"src/grammar.c\" \(17138 characters\)
sed "s/^X//" >src/grammar.c <<'END_OF_src/grammar.c'
X# define NUMBER 257
X# define NAME 258
X# define ABORT 259
X# define ALL 260
X# define CONTROL 261
X# define CORB 262
X# define COURSE 263
X# define DAMAGE 264
X# define DEAD 265
X# define DELAY 266
X# define DEMAND 267
X# define DESTR 268
X# define DET 269
X# define DISPLAY 270
X# define ELUDE 271
X# define ENG 272
X# define FIRE 273
X# define HELP 274
X# define JETT 275
X# define LAUNCH 276
X# define LOAD 277
X# define LOCK 278
X# define PARAM 279
X# define PHASER 280
X# define POWER 281
X# define PROBE 282
X# define PROXIMITY 283
X# define PURSUE 284
X# define ROTATE 285
X# define SAVE 286
X# define SCAN 287
X# define SPREAD 288
X# define STATUS 289
X# define SURREND 290
X# define SURV 291
X# define TACTIC 292
X# define TOWARD 293
X# define TUBE 294
X# define UNLOAD 295
X# define VERSION 296
X# define WARP 297
X
X# line 51 "grammar.y"
X#ident "@(#) TREK73 $Header: grammar.y,v 1.2 87/10/09 12:24:34 okamoto Exp $"
X/*
X * $Source: /ccc/okamoto/src/trek/src/RCS/grammar.y,v $
X *
X * $Header: grammar.y,v 1.2 87/10/09 12:24:34 okamoto Exp $
X *
X * $Log: grammar.y,v $
X * Revision 1.2 87/10/09 12:24:34 12:24:34 okamoto (Jeff Okamoto)
X * Added many extra stuff
X *
X * Revision 1.1 87/10/09 12:22:55 12:22:55 okamoto (Jeff Okamoto)
X * Initial revision
X *
X */
X#include "union.h"
X extern char parsed[];
X char string[80];
X double num1;
X double num2;
X double num3;
X double num4;
X#define yyclearin yychar = -1
X#define yyerrok yyerrflag = 0
Xextern int yychar;
Xextern short yyerrflag;
X#ifndef YYMAXDEPTH
X#define YYMAXDEPTH 150
X#endif
XYYSTYPE yylval, yyval;
X# define YYERRCODE 256
X
X# line 358 "grammar.y"
X
X
X#include "lex.yy.c"
X
Xyywrap() { return(1); }
X
Xyyerror(s) char *s; { fprintf(stderr, "%s", s); }
Xshort yyexca[] ={
X-1, 1,
X 0, -1,
X -2, 0,
X };
X# define YYNPROD 122
X# define YYLAST 287
Xshort yyact[]={
X
X 2, 124, 124, 86, 86, 107, 104, 100, 113, 111,
X 97, 73, 71, 68, 80, 78, 147, 77, 76, 108,
X 105, 101, 151, 128, 127, 83, 98, 137, 95, 94,
X 82, 74, 70, 67, 86, 84, 86, 88, 88, 154,
X 91, 141, 122, 120, 118, 75, 72, 69, 81, 79,
X 149, 124, 150, 86, 87, 85, 35, 123, 34, 33,
X 32, 31, 30, 29, 28, 27, 26, 25, 24, 23,
X 22, 21, 20, 19, 18, 17, 16, 15, 14, 13,
X 12, 11, 10, 9, 8, 7, 6, 5, 4, 1,
X 153, 148, 0, 0, 0, 0, 0, 0, 0, 0,
X 0, 0, 0, 0, 89, 0, 90, 92, 93, 0,
X 0, 96, 0, 0, 0, 0, 0, 0, 0, 0,
X 0, 0, 0, 99, 0, 102, 103, 0, 106, 0,
X 109, 110, 0, 0, 0, 112, 0, 114, 115, 116,
X 117, 0, 0, 119, 0, 121, 0, 125, 0, 0,
X 126, 0, 0, 0, 0, 0, 0, 0, 129, 130,
X 131, 132, 0, 133, 134, 0, 0, 135, 136, 0,
X 0, 0, 0, 0, 138, 0, 139, 0, 0, 0,
X 140, 0, 0, 142, 144, 143, 0, 0, 0, 0,
X 0, 0, 0, 0, 0, 145, 0, 0, 0, 146,
X 0, 0, 0, 0, 0, 152, 0, 0, 0, 0,
X 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
X 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
X 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
X 0, 0, 0, 0, 0, 0, 3, 0, 0, 62,
X 0, 44, 58, 50, 51, 56, 0, 60, 61, 55,
X 47, 49, 0, 36, 66, 54, 43, 41, 37, 57,
X 39, 53, 45, 0, 48, 38, 65, 52, 0, 0,
X 59, 63, 46, 0, 40, 42, 64 };
Xshort yypact[]={
X
X -10,-1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,
X-1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,
X-1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,
X-1000,-1000,-1000,-1000,-1000,-1000,-247,-248,-249,-271,
X-272,-245,-246,-252,-257,-226,-1000,-204,-220,-220,
X-223,-1000,-221,-1000,-243,-244,-220,-1000,-1000,-1000,
X-280,-1000,-242,-1000,-1000,-1000,-1000,-204,-273,-204,
X-204,-274,-204,-275,-204,-204,-1000,-1000,-285,-204,
X-286,-204,-204,-204,-204,-1000,-1000,-253,-1000,-254,
X-255,-204,-1000,-1000,-1000,-220,-1000,-1000,-1000,-264,
X-265,-1000,-1000,-220,-220,-220,-220,-204,-204,-206,
X-206,-1000,-1000,-1000,-1000,-239,-1000,-1000,-204,-1000,
X-204,-1000,-206,-1000,-1000,-256,-1000,-206,-204,-1000,
X-1000,-1000,-1000,-1000,-1000,-1000,-1000,-206,-1000,-1000,
X-1000,-206,-1000,-1000,-1000,-267,-1000,-207,-241,-1000,
X-220,-218,-1000,-1000,-1000 };
Xshort yypgo[]={
X
X 0, 55, 57, 91, 90, 54, 89, 88, 87, 86,
X 85, 84, 83, 82, 81, 80, 79, 78, 77, 76,
X 75, 74, 73, 72, 71, 70, 69, 68, 67, 66,
X 65, 64, 63, 62, 61, 60, 59, 58, 56 };
Xshort yyr1[]={
X
X 0, 6, 6, 6, 6, 6, 6, 6, 6, 6,
X 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
X 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
X 6, 6, 6, 6, 6, 6, 1, 2, 3, 4,
X 5, 7, 7, 7, 7, 7, 8, 8, 8, 9,
X 9, 9, 9, 9, 10, 10, 10, 10, 10, 11,
X 11, 11, 11, 12, 12, 12, 12, 13, 14, 15,
X 15, 15, 15, 15, 15, 16, 16, 16, 16, 16,
X 16, 17, 17, 17, 17, 18, 19, 19, 20, 20,
X 20, 20, 21, 21, 21, 21, 22, 22, 22, 22,
X 22, 22, 23, 24, 24, 24, 25, 26, 27, 27,
X 29, 28, 28, 30, 31, 32, 33, 34, 35, 36,
X 37, 38 };
Xshort yyr2[]={
X
X 0, 0, 1, 1, 1, 1, 1, 1, 1, 1,
X 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
X 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
X 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
X 1, 5, 3, 5, 3, 2, 3, 3, 2, 4,
X 3, 4, 3, 2, 4, 3, 4, 3, 2, 4,
X 3, 4, 3, 4, 3, 4, 3, 2, 2, 3,
X 3, 3, 3, 2, 2, 2, 3, 5, 7, 9,
X 9, 3, 2, 3, 2, 1, 2, 1, 4, 3,
X 2, 1, 4, 3, 2, 1, 4, 3, 2, 5,
X 4, 3, 1, 2, 2, 1, 1, 2, 3, 2,
X 1, 2, 1, 1, 1, 2, 1, 2, 1, 1,
X 1, 1 };
Xshort yychk[]={
X
X-1000, -6, 10, 256, -7, -8, -9, -10, -11, -12,
X -13, -14, -15, -16, -17, -18, -19, -20, -21, -22,
X -23, -24, -25, -26, -27, -28, -29, -30, -31, -32,
X -33, -34, -35, -36, -37, -38, 273, 278, 285, 280,
X 294, 277, 295, 276, 261, 282, 292, 270, 284, 271,
X 263, 264, 287, 281, 275, 269, 265, 279, 262, 290,
X 267, 268, 259, 291, 296, 286, 274, 280, 260, 294,
X 280, 260, 294, 260, 280, 294, 289, 289, 260, 294,
X 260, 294, 282, 282, 261, -1, 257, -5, 258, -5,
X -1, 263, -5, -1, 272, 272, -5, 290, 268, -1,
X 280, 294, -1, -1, 280, 294, -1, 280, 294, -1,
X -1, 294, -1, 294, -1, -1, -1, -1, 297, -1,
X 297, -1, 297, -2, 257, -1, -5, 288, 288, -5,
X -5, -5, -5, -1, -1, -2, -2, 266, -1, -1,
X -2, 297, -2, -2, -1, -2, -2, 283, -3, 257,
X 293, 263, -5, -4, 257 };
Xshort yydef[]={
X
X 1, -2, 2, 3, 4, 5, 6, 7, 8, 9,
X 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
X 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
X 30, 31, 32, 33, 34, 35, 0, 0, 0, 0,
X 0, 0, 0, 0, 0, 0, 85, 87, 91, 95,
X 0, 102, 105, 106, 0, 0, 112, 110, 113, 114,
X 0, 116, 0, 118, 119, 120, 121, 45, 0, 48,
X 53, 0, 58, 0, 0, 0, 67, 68, 0, 73,
X 0, 74, 75, 82, 84, 86, 36, 90, 40, 94,
X 98, 0, 103, 104, 107, 109, 111, 115, 117, 42,
X 44, 47, 46, 50, 52, 57, 55, 60, 64, 62,
X 66, 69, 71, 70, 72, 76, 81, 83, 0, 89,
X 0, 93, 0, 97, 37, 101, 108, 0, 0, 49,
X 51, 56, 54, 59, 63, 61, 65, 0, 88, 92,
X 96, 0, 100, 41, 43, 77, 99, 0, 78, 38,
X 0, 0, 79, 80, 39 };
X#ifndef lint
Xstatic char yaccpar_sccsid[] = "@(#)yaccpar 4.1 (Berkeley) 2/11/83";
X#endif not lint
X
X#
X# define YYFLAG -1000
X# define YYERROR goto yyerrlab
X# define YYACCEPT return(0)
X# define YYABORT return(1)
X
X/* parser for yacc output */
X
X#ifdef YYDEBUG
Xint yydebug = 0; /* 1 for debugging */
X#endif
XYYSTYPE yyv[YYMAXDEPTH]; /* where the values are stored */
Xint yychar = -1; /* current input token number */
Xint yynerrs = 0; /* number of errors */
Xshort yyerrflag = 0; /* error recovery flag */
X
Xyyparse() {
X
X short yys[YYMAXDEPTH];
X short yyj, yym;
X register YYSTYPE *yypvt;
X register short yystate, *yyps, yyn;
X register YYSTYPE *yypv;
X register short *yyxi;
X
X yystate = 0;
X yychar = -1;
X yynerrs = 0;
X yyerrflag = 0;
X yyps= &yys[-1];
X yypv= &yyv[-1];
X
X yystack: /* put a state and value onto the stack */
X
X#ifdef YYDEBUG
X if( yydebug ) printf( "state %d, char 0%o\n", yystate, yychar );
X#endif
X if( ++yyps> &yys[YYMAXDEPTH] ) { yyerror( "yacc stack overflow" ); return(1); }
X *yyps = yystate;
X ++yypv;
X *yypv = yyval;
X
X yynewstate:
X
X yyn = yypact[yystate];
X
X if( yyn<= YYFLAG ) goto yydefault; /* simple state */
X
X if( yychar<0 ) if( (yychar=yylex())<0 ) yychar=0;
X if( (yyn += yychar)<0 || yyn >= YYLAST ) goto yydefault;
X
X if( yychk[ yyn=yyact[ yyn ] ] == yychar ){ /* valid shift */
X yychar = -1;
X yyval = yylval;
X yystate = yyn;
X if( yyerrflag > 0 ) --yyerrflag;
X goto yystack;
X }
X
X yydefault:
X /* default state action */
X
X if( (yyn=yydef[yystate]) == -2 ) {
X if( yychar<0 ) if( (yychar=yylex())<0 ) yychar = 0;
X /* look through exception table */
X
X for( yyxi=yyexca; (*yyxi!= (-1)) || (yyxi[1]!=yystate) ; yyxi += 2 ) ; /* VOID */
X
X while( *(yyxi+=2) >= 0 ){
X if( *yyxi == yychar ) break;
X }
X if( (yyn = yyxi[1]) < 0 ) return(0); /* accept */
X }
X
X if( yyn == 0 ){ /* error */
X /* error ... attempt to resume parsing */
X
X switch( yyerrflag ){
X
X case 0: /* brand new error */
X
X yyerror( "syntax error" );
X yyerrlab:
X ++yynerrs;
X
X case 1:
X case 2: /* incompletely recovered error ... try again */
X
X yyerrflag = 3;
X
X /* find a state where "error" is a legal shift action */
X
X while ( yyps >= yys ) {
X yyn = yypact[*yyps] + YYERRCODE;
X if( yyn>= 0 && yyn < YYLAST && yychk[yyact[yyn]] == YYERRCODE ){
X yystate = yyact[yyn]; /* simulate a shift of "error" */
X goto yystack;
X }
X yyn = yypact[*yyps];
X
X /* the current yyps has no shift onn "error", pop stack */
X
X#ifdef YYDEBUG
X if( yydebug ) printf( "error recovery pops state %d, uncovers %d\n", *yyps, yyps[-1] );
X#endif
X --yyps;
X --yypv;
X }
X
X /* there is no state on the stack with an error shift ... abort */
X
X yyabort:
X return(1);
X
X
X case 3: /* no shift yet; clobber input char */
X
X#ifdef YYDEBUG
X if( yydebug ) printf( "error recovery discards char %d\n", yychar );
X#endif
X
X if( yychar == 0 ) goto yyabort; /* don't discard EOF, quit */
X yychar = -1;
X goto yynewstate; /* try again in the same state */
X
X }
X
X }
X
X /* reduction by production yyn */
X
X#ifdef YYDEBUG
X if( yydebug ) printf("reduce %d\n",yyn);
X#endif
X yyps -= yyr2[yyn];
X yypvt = yypv;
X yypv -= yyr2[yyn];
X yyval = yypv[1];
X yym=yyn;
X /* consult goto table to find next state */
X yyn = yyr1[yyn];
X yyj = yypgo[yyn] + *yyps + 1;
X if( yyj>=YYLAST || yychk[ yystate = yyact[yyj] ] != -yyn ) yystate = yyact[yypgo[yyn]];
X switch(yym){
X
Xcase 3:
X# line 79 "grammar.y"
X{ yyclearin; } break;
Xcase 36:
X# line 115 "grammar.y"
X{ num1 = yylval.dval; } break;
Xcase 37:
X# line 119 "grammar.y"
X{ num2 = yylval.dval; } break;
Xcase 38:
X# line 122 "grammar.y"
X{ num3 = yylval.dval; } break;
Xcase 39:
X# line 125 "grammar.y"
X{ num4 = yylval.dval; } break;
Xcase 40:
X# line 129 "grammar.y"
X{ strcpy(string, yylval.sval); } break;
Xcase 41:
X# line 133 "grammar.y"
X{ sprintf(parsed, "1 %.0f %.0f", num1, num2);} break;
Xcase 42:
X# line 135 "grammar.y"
X{ sprintf(parsed, "1 %.0f", num1); } break;
Xcase 43:
X# line 137 "grammar.y"
X{ sprintf(parsed, "1 all %.0f", num1); } break;
Xcase 44:
X# line 139 "grammar.y"
X{ strcpy(parsed, "1 all"); } break;
Xcase 45:
X# line 141 "grammar.y"
X{ strcpy(parsed, "1"); } break;
Xcase 46:
X# line 145 "grammar.y"
X{ sprintf(parsed, "2 %.0f", num1); } break;
Xcase 47:
X# line 147 "grammar.y"
X{ sprintf(parsed, "2 all"); } break;
Xcase 48:
X# line 149 "grammar.y"
X{ strcpy(parsed, "2"); } break;
Xcase 49:
X# line 153 "grammar.y"
X{ sprintf(parsed, "3 %.0f %s", num1, string);} break;
Xcase 50:
X# line 155 "grammar.y"
X{ sprintf(parsed, "3 %.0f", num1); } break;
Xcase 51:
X# line 157 "grammar.y"
X{ (void)sprintf(parsed, "3 all %s", string); } break;
Xcase 52:
X# line 159 "grammar.y"
X{ strcpy(parsed, "3 all"); } break;
Xcase 53:
X# line 161 "grammar.y"
X{ strcpy(parsed, "3"); } break;
Xcase 54:
X# line 165 "grammar.y"
X{ sprintf(parsed, "4 %.0f %s", num1, string);} break;
Xcase 55:
X# line 167 "grammar.y"
X{ sprintf(parsed, "4 %.0f", num1); } break;
Xcase 56:
X# line 169 "grammar.y"
X{ (void)sprintf(parsed, "4 all %s", string); } break;
Xcase 57:
X# line 171 "grammar.y"
X{ strcpy(parsed, "4 all"); } break;
Xcase 58:
X# line 173 "grammar.y"
X{ strcpy(parsed, "4"); } break;
Xcase 59:
X# line 177 "grammar.y"
X{ sprintf(parsed, "5 all %.0f", num1); } break;
Xcase 60:
X# line 179 "grammar.y"
X{ strcpy(parsed, "5 all"); } break;
Xcase 61:
X# line 181 "grammar.y"
X{ sprintf(parsed,"5 %.0f %.0f", num1, num2); } break;
Xcase 62:
X# line 183 "grammar.y"
X{ sprintf(parsed,"5 %.0f", num1); } break;
Xcase 63:
X# line 187 "grammar.y"
X{ sprintf(parsed, "6 all %.0f", num1); } break;
Xcase 64:
X# line 189 "grammar.y"
X{ strcpy(parsed, "6 all"); } break;
Xcase 65:
X# line 191 "grammar.y"
X{ sprintf(parsed,"6 %.0f %.0f", num1, num2); } break;
Xcase 66:
X# line 193 "grammar.y"
X{ sprintf(parsed,"6 %.0f", num1); } break;
Xcase 67:
X# line 197 "grammar.y"
X{ strcpy(parsed, "7"); } break;
Xcase 68:
X# line 201 "grammar.y"
X{ strcpy(parsed, "8"); } break;
Xcase 69:
X# line 205 "grammar.y"
X{ strcpy(parsed, "9 l all"); } break;
Xcase 70:
X# line 207 "grammar.y"
X{ strcpy(parsed, "9 u all"); } break;
Xcase 71:
X# line 209 "grammar.y"
X{ sprintf(parsed, "9 l %.0f", num1); } break;
Xcase 72:
X# line 211 "grammar.y"
X{ sprintf(parsed, "9 u %.0f", num1); } break;
Xcase 73:
X# line 213 "grammar.y"
X{ strcpy(parsed, "9 l"); } break;
Xcase 74:
X# line 215 "grammar.y"
X{ strcpy(parsed, "9 u"); } break;
Xcase 75:
X# line 219 "grammar.y"
X{ strcpy(parsed, "10"); } break;
Xcase 76:
X# line 221 "grammar.y"
X{ sprintf(parsed, "10 %.0f", num1); } break;
Xcase 77:
X# line 223 "grammar.y"
X{sprintf(parsed, "10 %.0f %.0f", num1, num2); } break;
Xcase 78:
X# line 225 "grammar.y"
X{ sprintf(parsed, "10 %.0f %.0f %.0f", num1, num2, num3); } break;
Xcase 79:
X# line 227 "grammar.y"
X{ sprintf(parsed, "10 %.0f %.0f %.0f %s", num1, num2, num3, string); } break;
Xcase 80:
X# line 229 "grammar.y"
X{ sprintf(parsed, "10 %.0f %.0f %.0f\n\r %.0f", num1, num2, num3, num4); } break;
Xcase 81:
X# line 233 "grammar.y"
X{ sprintf(parsed, "11 %.0f", num1); } break;
Xcase 82:
X# line 235 "grammar.y"
X{ strcpy(parsed, "11"); } break;
Xcase 83:
X# line 237 "grammar.y"
X{ sprintf(parsed, "11 %.0f", num1); } break;
Xcase 84:
X# line 239 "grammar.y"
X{ strcpy(parsed, "11"); } break;
Xcase 85:
X# line 243 "grammar.y"
X{ strcpy(parsed, "12"); } break;
Xcase 86:
X# line 247 "grammar.y"
X{ sprintf(parsed, "13 %.0f", num1); } break;
Xcase 87:
X# line 249 "grammar.y"
X{ strcpy(parsed, "13"); } break;
Xcase 88:
X# line 253 "grammar.y"
X{ sprintf(parsed, "14 %s %f", string, num1);} break;
Xcase 89:
X# line 255 "grammar.y"
X{ sprintf(parsed, "14 %s %f", string, num1);} break;
Xcase 90:
X# line 257 "grammar.y"
X{ sprintf(parsed, "14 %s", string); } break;
Xcase 91:
X# line 259 "grammar.y"
X{ strcpy(parsed, "14"); } break;
Xcase 92:
X# line 263 "grammar.y"
X{ sprintf(parsed, "15 %s %f", string, num1);} break;
Xcase 93:
X# line 265 "grammar.y"
X{ sprintf(parsed, "15 %s %f", string, num1);} break;
Xcase 94:
X# line 267 "grammar.y"
X{ sprintf(parsed, "15 %s", string); } break;
Xcase 95:
X# line 269 "grammar.y"
X{ strcpy(parsed, "15"); } break;
Xcase 96:
X# line 273 "grammar.y"
X{ sprintf(parsed, "16 %.0f %0f", num1, num2);} break;
Xcase 97:
X# line 275 "grammar.y"
X{ sprintf(parsed, "16 %.0f %0f", num1, num2);} break;
Xcase 98:
X# line 277 "grammar.y"
X{ sprintf(parsed, "16 %.0f", num1);} break;
Xcase 99:
X# line 279 "grammar.y"
X{ sprintf(parsed, "16 %.0f %0f", num1, num2);} break;
Xcase 100:
X# line 281 "grammar.y"
X{ sprintf(parsed, "16 %.0f %0f", num1, num2);} break;
Xcase 101:
X# line 283 "grammar.y"
X{ sprintf(parsed, "16 %.0f", num1);} break;
Xcase 102:
X# line 287 "grammar.y"
X{ strcpy(parsed, "17"); } break;
Xcase 103:
X# line 291 "grammar.y"
X{ sprintf(parsed, "18 %s", string); } break;
Xcase 104:
X# line 293 "grammar.y"
X{ sprintf(parsed, "18 %.0f", num1); } break;
Xcase 105:
X# line 295 "grammar.y"
X{ strcpy(parsed, "18"); } break;
Xcase 106:
X# line 299 "grammar.y"
X{ strcpy(parsed, "19"); } break;
Xcase 107:
X# line 303 "grammar.y"
X{ strcpy(parsed, "20"); } break;
Xcase 108:
X# line 307 "grammar.y"
X{ sprintf(parsed, "21 %s", string); } break;
Xcase 109:
X# line 309 "grammar.y"
X{ strcpy(parsed, "21"); } break;
Xcase 110:
X# line 313 "grammar.y"
X{ strcpy(parsed, "22"); } break;
Xcase 111:
X# line 317 "grammar.y"
X{ sprintf(parsed, "23 %s", string); } break;
Xcase 112:
X# line 319 "grammar.y"
X{ strcpy(parsed, "23"); } break;
Xcase 113:
X# line 323 "grammar.y"
X{ strcpy(parsed, "24"); } break;
Xcase 114:
X# line 327 "grammar.y"
X{ strcpy(parsed, "25"); } break;
Xcase 115:
X# line 331 "grammar.y"
X{ strcpy(parsed, "26"); } break;
Xcase 116:
X# line 335 "grammar.y"
X{ strcpy(parsed, "27"); } break;
Xcase 117:
X# line 339 "grammar.y"
X{ strcpy(parsed, "28"); } break;
Xcase 118:
X# line 343 "grammar.y"
X{ strcpy(parsed, "29"); } break;
Xcase 119:
X# line 347 "grammar.y"
X{ strcpy(parsed, "30"); } break;
Xcase 120:
X# line 351 "grammar.y"
X{ strcpy(parsed, "31"); } break;
Xcase 121:
X# line 355 "grammar.y"
X{ strcpy(parsed, "32"); } break;
X }
X goto yystack; /* stack new state and value */
X
X }
END_OF_src/grammar.c
if test 17138 -ne `wc -c <src/grammar.c`; then
echo shar: \"src/grammar.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
echo shar: End of archive 1 \(of 6\).
cp /dev/null ark1isdone
MISSING=""
for I in 1 2 3 4 5 6 ; do
if test ! -f ark${I}isdone ; then
MISSING="${MISSING} ${I}"
fi
done
if test "${MISSING}" = "" ; then
echo You have unpacked all 6 archives.
rm -f ark[1-9]isdone
else
echo You still need to unpack the following archives:
echo " " ${MISSING}
fi
## End of shell archive.
exit 0