summaryrefslogtreecommitdiffstats
path: root/trek
diff options
context:
space:
mode:
authorjsm <jsm@NetBSD.org>1999-09-17 17:06:08 +0000
committerjsm <jsm@NetBSD.org>1999-09-17 17:06:08 +0000
commitf3b72bb6f00ed3af77a9c2fb10fff4678f05e99b (patch)
tree83cf89d7d58b69572e9f1673bca3cbd4992c9033 /trek
parent355508ed2dd35340121bb735ee97c2586e7a99f6 (diff)
downloadbsdgames-darwin-f3b72bb6f00ed3af77a9c2fb10fff4678f05e99b.tar.gz
bsdgames-darwin-f3b72bb6f00ed3af77a9c2fb10fff4678f05e99b.tar.zst
bsdgames-darwin-f3b72bb6f00ed3af77a9c2fb10fff4678f05e99b.zip
Use `extern' for header variable declarations in trek(6).
Diffstat (limited to 'trek')
-rw-r--r--trek/externs.c22
-rw-r--r--trek/trek.h48
2 files changed, 44 insertions, 26 deletions
diff --git a/trek/externs.c b/trek/externs.c
index cc00600c..e06aaa6e 100644
--- a/trek/externs.c
+++ b/trek/externs.c
@@ -1,4 +1,4 @@
-/* $NetBSD: externs.c,v 1.5 1999/07/21 13:19:10 hubertf Exp $ */
+/* $NetBSD: externs.c,v 1.6 1999/09/17 17:06:08 jsm Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)externs.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: externs.c,v 1.5 1999/07/21 13:19:10 hubertf Exp $");
+__RCSID("$NetBSD: externs.c,v 1.6 1999/09/17 17:06:08 jsm Exp $");
#endif
#endif /* not lint */
@@ -103,3 +103,21 @@ const char *const Systemname[NINHAB] =
"Epsilon Eridani IV",
"Exo III"
};
+
+struct quad Quad[NQUADS][NQUADS];
+
+/* current sector map */
+char Sect[NSECTS][NSECTS];
+
+const struct device Device[NDEV];
+
+struct event Event[MAXEVENTS]; /* dynamic event list; one entry per pending event */
+
+struct Ship_struct Ship;
+struct Game_struct Game;
+struct Move_struct Move;
+struct Param_struct Param;
+struct Now_struct Now;
+struct Etc_struct Etc;
+
+int Trace;
diff --git a/trek/trek.h b/trek/trek.h
index db330782..eaede63b 100644
--- a/trek/trek.h
+++ b/trek/trek.h
@@ -1,4 +1,4 @@
-/* $NetBSD: trek.h,v 1.7 1999/09/08 21:45:33 jsm Exp $ */
+/* $NetBSD: trek.h,v 1.8 1999/09/17 17:06:08 jsm Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -45,12 +45,6 @@
**
** So far as I know, nothing in here must be preinitialized to
** zero.
-**
-** You may have problems from the loader if you move this to a
-** different machine. These things actually get allocated in each
-** source file, which UNIX allows; however, you may (on other
-** systems) have to change everything in here to be "extern" and
-** actually allocate stuff in "externs.c"
*/
/* external function definitions */
@@ -93,7 +87,7 @@ struct quad /* definition for each quadrant */
extern const char *const Systemname[NINHAB];
/* quadrant definition */
-struct quad Quad[NQUADS][NQUADS];
+extern struct quad Quad[NQUADS][NQUADS];
/* defines for sector map (below) */
# define EMPTY '.'
@@ -106,7 +100,7 @@ struct quad Quad[NQUADS][NQUADS];
# define HOLE ' '
/* current sector map */
-char Sect[NSECTS][NSECTS];
+extern char Sect[NSECTS][NSECTS];
@@ -137,7 +131,7 @@ struct device
const char *person; /* the person who fixes it */
};
-const struct device Device[NDEV];
+extern const struct device Device[NDEV];
/*************************** EVENTS ****************************/
@@ -177,7 +171,7 @@ struct event
# define MAXEVENTS 25 /* max number of concurrently pending events */
-struct event Event[MAXEVENTS]; /* dynamic event list; one entry per pending event */
+extern struct event Event[MAXEVENTS]; /* dynamic event list; one entry per pending event */
/***************************** KLINGONS *******************************/
@@ -225,7 +219,7 @@ extern const struct cvntab Lentab[];
/* information regarding the state of the starship */
-struct
+struct Ship_struct
{
double warp; /* warp factor */
double warp2; /* warp factor squared */
@@ -248,12 +242,13 @@ struct
const char *shipname; /* name of current starship */
char ship; /* current starship */
int distressed; /* number of distress calls */
-} Ship;
+};
+extern struct Ship_struct Ship;
/* sinsbad is set if SINS is working but not calibrated */
/* game related information, mostly scoring */
-struct
+struct Game_struct
{
int killk; /* number of klingons killed */
int deaths; /* number of deaths onboard Enterprise */
@@ -269,10 +264,11 @@ struct
char snap; /* set if snapshot taken */
char helps; /* number of help calls */
int captives; /* total number of captives taken */
-} Game;
+};
+extern struct Game_struct Game;
/* per move information */
-struct
+struct Move_struct
{
char free; /* set if a move is free */
char endgame; /* end of game flag */
@@ -280,10 +276,11 @@ struct
char newquad; /* set if just entered this quadrant */
char resting; /* set if this move is a rest */
double time; /* time used this move */
-} Move;
+};
+extern struct Move_struct Move;
/* parametric information */
-struct
+struct Param_struct
{
unsigned char bases; /* number of starbases */
char klings; /* number of klingons */
@@ -314,12 +311,13 @@ struct
int klingcrew; /* number of Klingons in a crew */
double srndrprob; /* surrender probability */
int energylow; /* low energy mark (cond YELLOW) */
-} Param;
+};
+extern struct Param_struct Param;
/* Sum of damage probabilities must add to 1000 */
/* other information kept in a snapshot */
-struct
+struct Now_struct
{
unsigned char bases; /* number of starbases */
char klings; /* number of klingons */
@@ -329,10 +327,11 @@ struct
char distressed; /* number of currently distressed quadrants */
struct event *eventptr[NEVENTS]; /* pointer to event structs */
struct xy base[MAXBASES]; /* locations of starbases */
-} Now;
+};
+extern struct Now_struct Now;
/* Other stuff, not dumped in a snapshot */
-struct
+struct Etc_struct
{
struct kling klingon[MAXKLQUAD]; /* sorted Klingon list */
short nkling; /* number of Klingons in this sector */
@@ -341,7 +340,8 @@ struct
struct xy starbase; /* starbase in current quadrant */
char snapshot[sizeof Quad + sizeof Event + sizeof Now]; /* snapshot for time warp */
char statreport; /* set to get a status report on a srscan */
-} Etc;
+};
+extern struct Etc_struct Etc;
/*
* eventptr is a pointer to the event[] entry of the last
@@ -375,7 +375,7 @@ struct
/* Trace info */
# define xTRACE 1
-int Trace;
+extern int Trace;
/* abandon.c */
void abandon __P((int));