switch source tree from k&r to c99

This commit is contained in:
nhmall
2021-01-26 21:06:16 -05:00
parent a2a9cb7b4f
commit f963c5aca7
232 changed files with 12099 additions and 17782 deletions

View File

@@ -5,12 +5,11 @@
#include "hack.h"
static int FDECL(stylus_ok, (struct obj *));
static const char *NDECL(blengr);
static int stylus_ok(struct obj *);
static const char *blengr(void);
char *
random_engraving(outbuf)
char *outbuf;
random_engraving(char *outbuf)
{
const char *rumor;
@@ -78,10 +77,8 @@ static const struct {
/* degrade some of the characters in a string */
void
wipeout_text(engr, cnt, seed)
char *engr;
int cnt;
unsigned seed; /* for semi-controlled randomization */
wipeout_text(char *engr, int cnt,
unsigned seed) /* for semi-controlled randomization */
{
char *s;
int i, j, nxt, use_rubout, lth = (int) strlen(engr);
@@ -142,8 +139,7 @@ unsigned seed; /* for semi-controlled randomization */
/* check whether hero can reach something at ground level */
boolean
can_reach_floor(check_pit)
boolean check_pit;
can_reach_floor(boolean check_pit)
{
struct trap *t;
@@ -168,9 +164,7 @@ boolean check_pit;
/* give a message after caller has determined that hero can't reach */
void
cant_reach_floor(x, y, up, check_pit)
int x, y;
boolean up, check_pit;
cant_reach_floor(int x, int y, boolean up, boolean check_pit)
{
You("can't reach the %s.",
up ? ceiling(x, y)
@@ -180,8 +174,7 @@ boolean up, check_pit;
}
const char *
surface(x, y)
register int x, y;
surface(register int x, register int y)
{
register struct rm *lev = &levl[x][y];
@@ -212,8 +205,7 @@ register int x, y;
}
const char *
ceiling(x, y)
register int x, y;
ceiling(register int x, register int y)
{
register struct rm *lev = &levl[x][y];
const char *what;
@@ -244,8 +236,7 @@ register int x, y;
}
struct engr *
engr_at(x, y)
xchar x, y;
engr_at(xchar x, xchar y)
{
register struct engr *ep = head_engr;
@@ -265,10 +256,7 @@ xchar x, y;
* present if it is intact and is the entire content of the engraving.
*/
int
sengr_at(s, x, y, strict)
const char *s;
xchar x, y;
boolean strict;
sengr_at(const char *s, xchar x, xchar y, boolean strict)
{
register struct engr *ep = engr_at(x, y);
@@ -281,17 +269,14 @@ boolean strict;
}
void
u_wipe_engr(cnt)
int cnt;
u_wipe_engr(int cnt)
{
if (can_reach_floor(TRUE))
wipe_engr_at(u.ux, u.uy, cnt, FALSE);
}
void
wipe_engr_at(x, y, cnt, magical)
xchar x, y, cnt;
boolean magical;
wipe_engr_at(xchar x, xchar y, xchar cnt, boolean magical)
{
register struct engr *ep = engr_at(x, y);
@@ -313,8 +298,7 @@ boolean magical;
}
void
read_engr_at(x, y)
int x, y;
read_engr_at(int x, int y)
{
register struct engr *ep = engr_at(x, y);
int sensed = 0;
@@ -388,11 +372,7 @@ int x, y;
}
void
make_engr_at(x, y, s, e_time, e_type)
int x, y;
const char *s;
long e_time;
xchar e_type;
make_engr_at(int x, int y, const char *s, long e_time, xchar e_type)
{
struct engr *ep;
unsigned smem = strlen(s) + 1;
@@ -417,8 +397,7 @@ xchar e_type;
/* delete any engraving at location <x,y> */
void
del_engr_at(x, y)
int x, y;
del_engr_at(int x, int y)
{
register struct engr *ep = engr_at(x, y);
@@ -430,7 +409,7 @@ int x, y;
* freehand - returns true if player has a free hand
*/
int
freehand()
freehand(void)
{
return (!uwep || !welded(uwep)
|| (!bimanual(uwep) && (!uarms || !uarms->cursed)));
@@ -438,8 +417,7 @@ freehand()
/* getobj callback for an object to engrave with */
static int
stylus_ok(obj)
struct obj *obj;
stylus_ok(struct obj *obj)
{
if (!obj)
return GETOBJ_SUGGEST;
@@ -488,7 +466,7 @@ struct obj *obj;
/* return 1 if action took 1 (or more) moves, 0 if error or aborted */
int
doengrave()
doengrave(void)
{
boolean dengr = FALSE; /* TRUE if we wipe out the current engraving */
boolean doblind = FALSE; /* TRUE if engraving blinds the player */
@@ -1189,7 +1167,7 @@ doengrave()
/* while loading bones, clean up text which might accidentally
or maliciously disrupt player's terminal when displayed */
void
sanitize_engravings()
sanitize_engravings(void)
{
struct engr *ep;
@@ -1199,8 +1177,7 @@ sanitize_engravings()
}
void
save_engravings(nhfp)
NHFILE *nhfp;
save_engravings(NHFILE *nhfp)
{
struct engr *ep, *ep2;
unsigned no_more_engr = 0;
@@ -1225,8 +1202,7 @@ NHFILE *nhfp;
}
void
rest_engravings(nhfp)
NHFILE *nhfp;
rest_engravings(NHFILE *nhfp)
{
struct engr *ep;
unsigned lth = 0;
@@ -1254,10 +1230,7 @@ NHFILE *nhfp;
/* to support '#stats' wizard-mode command */
void
engr_stats(hdrfmt, hdrbuf, count, size)
const char *hdrfmt;
char *hdrbuf;
long *count, *size;
engr_stats(const char *hdrfmt, char *hdrbuf, long *count, long *size)
{
struct engr *ep;
@@ -1270,8 +1243,7 @@ long *count, *size;
}
void
del_engr(ep)
register struct engr *ep;
del_engr(register struct engr *ep)
{
if (ep == head_engr) {
head_engr = ep->nxt_engr;
@@ -1293,8 +1265,7 @@ register struct engr *ep;
/* randomly relocate an engraving */
void
rloc_engr(ep)
struct engr *ep;
rloc_engr(struct engr *ep)
{
int tx, ty, tryct = 200;
@@ -1313,9 +1284,7 @@ struct engr *ep;
* The caller is responsible for newsym(x, y).
*/
void
make_grave(x, y, str)
int x, y;
const char *str;
make_grave(int x, int y, const char *str)
{
char buf[BUFSZ];
@@ -1354,7 +1323,7 @@ static const char blind_writing[][21] = {
};
static const char *
blengr(VOID_ARGS)
blengr(void)
{
return blind_writing[rn2(SIZE(blind_writing))];
}