Use separate definitions and extern declarations of variables rather

than linker commons.
This commit is contained in:
jsm 1999-12-28 18:05:24 +00:00
parent 8f5685ec6b
commit 73479d22b8
4 changed files with 82 additions and 45 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: extern.h,v 1.12 1999/09/30 18:01:33 jsm Exp $ */
/* $NetBSD: extern.h,v 1.13 1999/12/28 18:05:24 jsm Exp $ */
/*
* Copyright (c) 1983, 1993
@ -43,20 +43,20 @@
#include "machdep.h"
/* program mode */
int mode;
jmp_buf restart;
extern int mode;
extern jmp_buf restart;
#define MODE_PLAYER 1
#define MODE_DRIVER 2
#define MODE_LOGGER 3
/* command line flags */
char debug; /* -D */
char randomize; /* -x, give first available ship */
char longfmt; /* -l, print score in long format */
char nobells; /* -b, don't ring bell before Signal */
extern char debug; /* -D */
extern char randomize; /* -x, give first available ship */
extern char longfmt; /* -l, print score in long format */
extern char nobells; /* -b, don't ring bell before Signal */
/* other initial modes */
char issetuid; /* running setuid */
extern char issetuid; /* running setuid */
#define die() ((rand() >> 3) % 6 + 1)
#define sqr(a) ((a) * (a))
@ -232,7 +232,7 @@ struct scenario {
struct ship ship[NSHIP]; /* 16 */
};
extern struct scenario scene[];
int nscene;
extern int nscene;
struct shipspecs {
char bs;
@ -257,8 +257,8 @@ struct shipspecs {
};
extern struct shipspecs specs[];
struct scenario *cc; /* the current scenario */
struct ship *ls; /* &cc->ship[cc->vessels] */
extern struct scenario *cc; /* the current scenario */
extern struct ship *ls; /* &cc->ship[cc->vessels] */
#define SHIP(s) (&cc->ship[s])
#define foreachship(sp) for ((sp) = cc->ship; (sp) < ls; (sp)++)
@ -266,19 +266,19 @@ struct ship *ls; /* &cc->ship[cc->vessels] */
struct windeffects {
char A, B, C, D;
};
const struct windeffects WET[7][6];
extern const struct windeffects WET[7][6];
struct Tables {
char H, G, C, R;
};
const struct Tables RigTable[11][6];
const struct Tables HullTable[11][6];
extern const struct Tables RigTable[11][6];
extern const struct Tables HullTable[11][6];
const char AMMO[9][4];
const char HDT[9][10];
const char HDTrake[9][10];
const char QUAL[9][5];
const char MT[9][3];
extern const char AMMO[9][4];
extern const char HDT[9][10];
extern const char HDTrake[9][10];
extern const char QUAL[9][5];
extern const char MT[9][3];
extern const char *const countryname[];
extern const char *const classname[];
@ -290,13 +290,13 @@ extern const char rangeofshot[];
extern const char dr[], dc[];
int winddir;
int windspeed;
int turn;
int game;
int alive;
int people;
char hasdriver;
extern int winddir;
extern int windspeed;
extern int turn;
extern int game;
extern int alive;
extern int people;
extern char hasdriver;
/* assorted.c */
void table __P((int, int, int, struct ship *, struct ship *, int));

View File

@ -1,4 +1,4 @@
/* $NetBSD: globals.c,v 1.7 1999/09/08 21:17:58 jsm Exp $ */
/* $NetBSD: globals.c,v 1.8 1999/12/28 18:05:24 jsm Exp $ */
/*
* Copyright (c) 1983, 1993
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)globals.c 8.2 (Berkeley) 4/28/95";
#else
__RCSID("$NetBSD: globals.c,v 1.7 1999/09/08 21:17:58 jsm Exp $");
__RCSID("$NetBSD: globals.c,v 1.8 1999/12/28 18:05:24 jsm Exp $");
#endif
#endif /* not lint */
@ -544,3 +544,24 @@ const char loadname[] = { '-', 'G', 'C', 'R', 'D', 'E' };
const char dr[] = { 0, 1, 1, 0, -1, -1, -1, 0, 1 };
const char dc[] = { 0, 0, -1, -1, -1, 0, 1, 1, 1 };
int mode;
jmp_buf restart;
char debug; /* -D */
char randomize; /* -x, give first available ship */
char longfmt; /* -l, print score in long format */
char nobells; /* -b, don't ring bell before Signal */
char issetuid;
struct scenario *cc; /* the current scenario */
struct ship *ls; /* &cc->ship[cc->vessels] */
int winddir;
int windspeed;
int turn;
int game;
int alive;
int people;
char hasdriver;

View File

@ -1,4 +1,4 @@
/* $NetBSD: pl_7.c,v 1.12 1999/09/08 21:45:30 jsm Exp $ */
/* $NetBSD: pl_7.c,v 1.13 1999/12/28 18:05:25 jsm Exp $ */
/*
* Copyright (c) 1983, 1993
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)pl_7.c 8.1 (Berkeley) 5/31/93";
#else
__RCSID("$NetBSD: pl_7.c,v 1.12 1999/09/08 21:45:30 jsm Exp $");
__RCSID("$NetBSD: pl_7.c,v 1.13 1999/12/28 18:05:25 jsm Exp $");
#endif
#endif /* not lint */
@ -61,6 +61,22 @@ static const char *sc_prompt;
static const char *sc_buf;
static int sc_line;
WINDOW *view_w;
WINDOW *slot_w;
WINDOW *scroll_w;
WINDOW *stat_w;
WINDOW *turn_w;
char done_curses;
char loaded, fired, changed, repaired;
char dont_adjust;
int viewrow, viewcol;
char movebuf[sizeof SHIP(0)->file->movebuf];
int player;
struct ship *ms; /* memorial structure, &cc->ship[player] */
struct File *mf; /* ms->file */
struct shipspecs *mc; /* ms->specs */
void
initscreen()
{

View File

@ -1,4 +1,4 @@
/* $NetBSD: player.h,v 1.7 1999/04/18 03:30:12 simonb Exp $ */
/* $NetBSD: player.h,v 1.8 1999/12/28 18:05:25 jsm Exp $ */
/*
* Copyright (c) 1983, 1993
@ -98,22 +98,22 @@
#define SCREENTEST() (initscr() != NULL && STAT_R < COLS && SCROLL_Y > 0)
#endif
WINDOW *view_w;
WINDOW *slot_w;
WINDOW *scroll_w;
WINDOW *stat_w;
WINDOW *turn_w;
extern WINDOW *view_w;
extern WINDOW *slot_w;
extern WINDOW *scroll_w;
extern WINDOW *stat_w;
extern WINDOW *turn_w;
char done_curses;
char loaded, fired, changed, repaired;
char dont_adjust;
int viewrow, viewcol;
char movebuf[sizeof SHIP(0)->file->movebuf];
extern char done_curses;
extern char loaded, fired, changed, repaired;
extern char dont_adjust;
extern int viewrow, viewcol;
extern char movebuf[sizeof SHIP(0)->file->movebuf];
extern char version[];
int player;
struct ship *ms; /* memorial structure, &cc->ship[player] */
struct File *mf; /* ms->file */
struct shipspecs *mc; /* ms->specs */
extern int player;
extern struct ship *ms; /* memorial structure, &cc->ship[player] */
extern struct File *mf; /* ms->file */
extern struct shipspecs *mc; /* ms->specs */
/* condition codes for leave() */
#define LEAVE_QUIT 0