Move a few prototypes and static'ed a few functions
Moved prototypes for initialise() and action() from main.c to advent.h Made the following functions static, so they wouldn't require prototypes: sig_handler (main.c) spotted_by_pirate (main.c) light (actions.c)
This commit is contained in:
parent
14c83ede8e
commit
a3485d2a41
4 changed files with 9 additions and 6 deletions
3
Makefile
3
Makefile
|
@ -26,6 +26,8 @@ VERS=1.0
|
||||||
|
|
||||||
CC?=gcc
|
CC?=gcc
|
||||||
CCFLAGS+=-std=c99 -D _DEFAULT_SOURCE -Wall -Wpedantic -Wextra -g
|
CCFLAGS+=-std=c99 -D _DEFAULT_SOURCE -Wall -Wpedantic -Wextra -g
|
||||||
|
CCFLAGS+=-Wstrict-prototypes
|
||||||
|
CCFLAGS+=-Wmissing-prototypes
|
||||||
LIBS=
|
LIBS=
|
||||||
UNAME_S := $(shell uname -s)
|
UNAME_S := $(shell uname -s)
|
||||||
ifeq ($(UNAME_S),Linux)
|
ifeq ($(UNAME_S),Linux)
|
||||||
|
@ -75,6 +77,7 @@ clean:
|
||||||
rm -f newdb.c newdb.h
|
rm -f newdb.c newdb.h
|
||||||
rm -f README advent.6 MANIFEST *.tar.gz
|
rm -f README advent.6 MANIFEST *.tar.gz
|
||||||
rm -f *~
|
rm -f *~
|
||||||
|
rm -f .*~
|
||||||
cd tests; $(MAKE) --quiet clean
|
cd tests; $(MAKE) --quiet clean
|
||||||
|
|
||||||
check: advent
|
check: advent
|
||||||
|
|
|
@ -633,7 +633,7 @@ static int inven(void)
|
||||||
return GO_CLEAROBJ;
|
return GO_CLEAROBJ;
|
||||||
}
|
}
|
||||||
|
|
||||||
int light(token_t verb, token_t obj)
|
static int light(token_t verb, token_t obj)
|
||||||
/* Light. Applicable only to lamp and urn. */
|
/* Light. Applicable only to lamp and urn. */
|
||||||
{
|
{
|
||||||
int spk = ACTSPK[verb];
|
int spk = ACTSPK[verb];
|
||||||
|
|
3
advent.h
3
advent.h
|
@ -171,6 +171,9 @@ extern long AMBER, ATTACK, AXE, BACK, BATTER, BEAR,
|
||||||
|
|
||||||
enum speechpart {unknown, intransitive, transitive};
|
enum speechpart {unknown, intransitive, transitive};
|
||||||
|
|
||||||
|
void initialise(void);
|
||||||
|
int action(FILE *input, enum speechpart part, long verb, token_t obj);
|
||||||
|
|
||||||
/* Phase codes for action returns.
|
/* Phase codes for action returns.
|
||||||
* These were at one time FORTRAN line numbers.
|
* These were at one time FORTRAN line numbers.
|
||||||
* The values don't matter, but perturb their order at your peril.
|
* The values don't matter, but perturb their order at your peril.
|
||||||
|
|
7
main.c
7
main.c
|
@ -48,10 +48,7 @@ bool oldstyle = false;
|
||||||
bool editline = true;
|
bool editline = true;
|
||||||
bool prompt = true;
|
bool prompt = true;
|
||||||
|
|
||||||
extern void initialise();
|
static void sig_handler(int signo)
|
||||||
extern int action(FILE *, long, long, long);
|
|
||||||
|
|
||||||
void sig_handler(int signo)
|
|
||||||
{
|
{
|
||||||
if (signo == SIGINT){
|
if (signo == SIGINT){
|
||||||
if (logfp != NULL)
|
if (logfp != NULL)
|
||||||
|
@ -268,7 +265,7 @@ static void checkhints(FILE *cmdin)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool spotted_by_pirate(int i)
|
static bool spotted_by_pirate(int i)
|
||||||
{
|
{
|
||||||
if (i != PIRATE)
|
if (i != PIRATE)
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue