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

@@ -14,26 +14,25 @@
#include "hack.h"
static void FDECL(enlght_out, (const char *));
static void FDECL(enlght_line, (const char *, const char *, const char *,
const char *));
static char *FDECL(enlght_combatinc, (const char *, int, int, char *));
static void FDECL(enlght_halfdmg, (int, int));
static boolean NDECL(walking_on_water);
static boolean FDECL(cause_known, (int));
static char *FDECL(attrval, (int, int, char *));
static void FDECL(background_enlightenment, (int, int));
static void FDECL(basics_enlightenment, (int, int));
static void FDECL(characteristics_enlightenment, (int, int));
static void FDECL(one_characteristic, (int, int, int));
static void FDECL(status_enlightenment, (int, int));
static void FDECL(weapon_insight, (int));
static void FDECL(attributes_enlightenment, (int, int));
static void FDECL(show_achievements, (int));
static int FDECL(CFDECLSPEC vanqsort_cmp, (const genericptr,
const genericptr));
static int NDECL(set_vanq_order);
static int NDECL(num_extinct);
static void enlght_out(const char *);
static void enlght_line(const char *, const char *, const char *,
const char *);
static char *enlght_combatinc(const char *, int, int, char *);
static void enlght_halfdmg(int, int);
static boolean walking_on_water(void);
static boolean cause_known(int);
static char *attrval(int, int, char *);
static void background_enlightenment(int, int);
static void basics_enlightenment(int, int);
static void characteristics_enlightenment(int, int);
static void one_characteristic(int, int, int);
static void status_enlightenment(int, int);
static void weapon_insight(int);
static void attributes_enlightenment(int, int);
static void show_achievements(int);
static int CFDECLSPEC vanqsort_cmp(const genericptr, const genericptr);
static int set_vanq_order(void);
static int num_extinct(void);
extern const char *hu_stat[]; /* hunger status from eat.c */
extern const char *enc_stat[]; /* encumbrance status from botl.c */
@@ -56,8 +55,7 @@ static const char have_been[] = "have been ", have_never[] = "have never ",
enl_msg(You_, have, (const char *) "", something, "")
static void
enlght_out(buf)
const char *buf;
enlght_out(const char *buf)
{
if (g.en_via_menu) {
anything any;
@@ -70,8 +68,8 @@ const char *buf;
}
static void
enlght_line(start, middle, end, ps)
const char *start, *middle, *end, *ps;
enlght_line(const char *start, const char *middle, const char *end,
const char *ps)
{
char buf[BUFSZ];
@@ -81,10 +79,7 @@ const char *start, *middle, *end, *ps;
/* format increased chance to hit or damage or defense (Protection) */
static char *
enlght_combatinc(inctyp, incamt, final, outbuf)
const char *inctyp;
int incamt, final;
char *outbuf;
enlght_combatinc(const char *inctyp, int incamt, int final, char *outbuf)
{
const char *modif, *bonus;
boolean invrt;
@@ -121,9 +116,7 @@ char *outbuf;
/* report half physical or half spell damage */
static void
enlght_halfdmg(category, final)
int category;
int final;
enlght_halfdmg(int category, int final)
{
const char *category_name;
char buf[BUFSZ];
@@ -146,7 +139,7 @@ int final;
/* is hero actively using water walking capability on water (or lava)? */
static boolean
walking_on_water()
walking_on_water(void)
{
if (u.uinwater || Levitation || Flying)
return FALSE;
@@ -156,10 +149,7 @@ walking_on_water()
/* describe u.utraptype; used by status_enlightenment() and self_lookat() */
char *
trap_predicament(outbuf, final, wizxtra)
char *outbuf;
int final;
boolean wizxtra;
trap_predicament(char *outbuf, int final, boolean wizxtra)
{
struct trap *t;
@@ -193,8 +183,7 @@ boolean wizxtra;
confers the target property; item must have been seen and its type
discovered but it doesn't necessarily have to be fully identified */
static boolean
cause_known(propindx)
int propindx; /* index of a property which can be conveyed by worn item */
cause_known(int propindx) /* index of a property which can be conveyed by worn item */
{
register struct obj *o;
long mask = W_ARMOR | W_AMUL | W_RING | W_TOOL;
@@ -213,9 +202,8 @@ int propindx; /* index of a property which can be conveyed by worn item */
/* format a characteristic value, accommodating Strength's strangeness */
static char *
attrval(attrindx, attrvalue, resultbuf)
int attrindx, attrvalue;
char resultbuf[]; /* should be at least [7] to hold "18/100\0" */
attrval(int attrindx, int attrvalue,
char resultbuf[]) /* should be at least [7] to hold "18/100\0" */
{
if (attrindx != A_STR || attrvalue <= 18)
Sprintf(resultbuf, "%d", attrvalue);
@@ -227,9 +215,9 @@ char resultbuf[]; /* should be at least [7] to hold "18/100\0" */
}
void
enlightenment(mode, final)
int mode; /* BASICENLIGHTENMENT | MAGICENLIGHTENMENT (| both) */
int final; /* ENL_GAMEINPROGRESS:0, ENL_GAMEOVERALIVE, ENL_GAMEOVERDEAD */
enlightenment(int mode, /* BASICENLIGHTENMENT | MAGICENLIGHTENMENT (| both) */
int final) /* ENL_GAMEINPROGRESS:0, ENL_GAMEOVERALIVE,
ENL_GAMEOVERDEAD */
{
char buf[BUFSZ], tmpbuf[BUFSZ];
@@ -305,9 +293,7 @@ int final; /* ENL_GAMEINPROGRESS:0, ENL_GAMEOVERALIVE, ENL_GAMEOVERDEAD */
/*ARGSUSED*/
/* display role, race, alignment and such to en_win */
static void
background_enlightenment(unused_mode, final)
int unused_mode UNUSED;
int final;
background_enlightenment(int unused_mode UNUSED, int final)
{
const char *role_titl, *rank_titl;
int innategend, difgend, difalgn;
@@ -559,9 +545,7 @@ int final;
doesn't fit very well in other categories */
/*ARGSUSED*/
static void
basics_enlightenment(mode, final)
int mode UNUSED;
int final;
basics_enlightenment(int mode UNUSED, int final)
{
static char Power[] = "energy points (spell power)";
char buf[BUFSZ];
@@ -644,9 +628,7 @@ int final;
/* characteristics: expanded version of bottom line strength, dexterity, &c */
static void
characteristics_enlightenment(mode, final)
int mode;
int final;
characteristics_enlightenment(int mode, int final)
{
char buf[BUFSZ];
@@ -665,8 +647,7 @@ int final;
/* display one attribute value for characteristics_enlightenment() */
static void
one_characteristic(mode, final, attrindx)
int mode, final, attrindx;
one_characteristic(int mode, int final, int attrindx)
{
extern const char *const attrname[]; /* attrib.c */
boolean hide_innate_value = FALSE, interesting_alimit;
@@ -760,9 +741,7 @@ int mode, final, attrindx;
/* status: selected obvious capabilities, assorted troubles */
static void
status_enlightenment(mode, final)
int mode;
int final;
status_enlightenment(int mode, int final)
{
boolean magic = (mode & MAGICENLIGHTENMENT) ? TRUE : FALSE;
int cap;
@@ -1073,8 +1052,7 @@ int final;
/* extracted from status_enlightenment() to reduce clutter there */
static void
weapon_insight(final)
int final;
weapon_insight(int final)
{
char buf[BUFSZ];
int wtype;
@@ -1279,9 +1257,7 @@ int final;
/* attributes: intrinsics and the like, other non-obvious capabilities */
static void
attributes_enlightenment(unused_mode, final)
int unused_mode UNUSED;
int final;
attributes_enlightenment(int unused_mode UNUSED, int final)
{
static NEARDATA const char if_surroundings_permitted[] =
" if surroundings permitted";
@@ -1742,7 +1718,7 @@ int final;
/* ^X command */
int
doattributes(VOID_ARGS)
doattributes(void)
{
int mode = BASICENLIGHTENMENT;
@@ -1755,9 +1731,8 @@ doattributes(VOID_ARGS)
}
void
youhiding(via_enlghtmt, msgflag)
boolean via_enlghtmt; /* englightment line vs topl message */
int msgflag; /* for variant message phrasing */
youhiding(boolean via_enlghtmt, /* englightment line vs topl message */
int msgflag) /* for variant message phrasing */
{
char *bp, buf[BUFSZ];
@@ -1815,7 +1790,7 @@ int msgflag; /* for variant message phrasing */
/* #conduct command [KMH]; shares enlightenment's tense handling */
int
doconduct(VOID_ARGS)
doconduct(void)
{
show_conduct(0);
return 0;
@@ -1823,8 +1798,7 @@ doconduct(VOID_ARGS)
/* display conducts; for doconduct(), also disclose() and dump_everything() */
void
show_conduct(final)
int final;
show_conduct(int final)
{
char buf[BUFSZ];
int ngenocided;
@@ -1964,8 +1938,7 @@ int final;
*/
static void
show_achievements(final)
int final; /* used "behind the curtain" by enl_foo() macros */
show_achievements(int final) /* used "behind the curtain" by enl_foo() macros */
{
int i, achidx, absidx, acnt;
char title[QBUFSZ], buf[QBUFSZ];
@@ -2124,8 +2097,7 @@ int final; /* used "behind the curtain" by enl_foo() macros */
/* record an achievement (add at end of list unless already present) */
void
record_achievement(achidx)
schar achidx;
record_achievement(schar achidx)
{
int i, absidx;
@@ -2152,8 +2124,7 @@ schar achidx;
/* discard a recorded achievement; return True if removed, False otherwise */
boolean
remove_achievement(achidx)
schar achidx;
remove_achievement(schar achidx)
{
int i;
@@ -2171,7 +2142,7 @@ schar achidx;
/* used to decide whether there are any achievements to display */
int
count_achievements()
count_achievements(void)
{
int i, acnt = 0;
@@ -2183,8 +2154,7 @@ count_achievements()
/* convert a rank index to an achievement number; encode it when female
in order to subsequently report gender-specific ranks accurately */
schar
achieve_rank(rank)
int rank; /* 1..8 */
achieve_rank(int rank) /* 1..8 */
{
schar achidx = (schar) ((rank - 1) + ACH_RNK1);
@@ -2195,7 +2165,7 @@ int rank; /* 1..8 */
/* return True if sokoban branch has been entered, False otherwise */
boolean
sokoban_in_play()
sokoban_in_play(void)
{
int achidx;
@@ -2224,9 +2194,7 @@ static const char *vanqorders[NUM_VANQ_ORDER_MODES] = {
};
static int CFDECLSPEC
vanqsort_cmp(vptr1, vptr2)
const genericptr vptr1;
const genericptr vptr2;
vanqsort_cmp(const genericptr vptr1, const genericptr vptr2)
{
int indx1 = *(short *) vptr1, indx2 = *(short *) vptr2,
mlev1, mlev2, mstr1, mstr2, uniq1, uniq2, died1, died2, res;
@@ -2306,7 +2274,7 @@ const genericptr vptr2;
/* returns -1 if cancelled via ESC */
static int
set_vanq_order()
set_vanq_order(void)
{
winid tmpwin;
menu_item *selected;
@@ -2342,7 +2310,7 @@ set_vanq_order()
/* #vanquished command */
int
dovanquished()
dovanquished(void)
{
list_vanquished('a', FALSE);
return 0;
@@ -2350,7 +2318,7 @@ dovanquished()
/* #wizborn extended command */
int
doborn()
doborn(void)
{
static const char fmt[] = "%4i %4i %c %-30s";
int i;
@@ -2388,9 +2356,7 @@ doborn()
#define done_stopprint g.program_state.stopprint
void
list_vanquished(defquery, ask)
char defquery;
boolean ask;
list_vanquished(char defquery, boolean ask)
{
register int i;
int pfx, nkilled;
@@ -2520,7 +2486,7 @@ boolean ask;
/* number of monster species which have been genocided */
int
num_genocides()
num_genocides(void)
{
int i, n = 0;
@@ -2536,7 +2502,7 @@ num_genocides()
}
static int
num_extinct()
num_extinct(void)
{
int i, n = 0;
@@ -2550,9 +2516,7 @@ num_extinct()
}
void
list_genocided(defquery, ask)
char defquery;
boolean ask;
list_genocided(char defquery, boolean ask)
{
register int i;
int ngenocided, nextinct;
@@ -2632,8 +2596,7 @@ boolean ask;
*/
const char *
align_str(alignment)
aligntyp alignment;
align_str(aligntyp alignment)
{
switch ((int) alignment) {
case A_CHAOTIC:
@@ -2650,9 +2613,7 @@ aligntyp alignment;
/* used for self-probing */
char *
piousness(showneg, suffix)
boolean showneg;
const char *suffix;
piousness(boolean showneg, const char *suffix)
{
static char buf[32]; /* bigger than "insufficiently neutral" */
const char *pio;
@@ -2692,8 +2653,7 @@ const char *suffix;
/* stethoscope or probing applied to monster -- one-line feedback */
void
mstatusline(mtmp)
struct monst *mtmp;
mstatusline(struct monst *mtmp)
{
aligntyp alignment = mon_aligntyp(mtmp);
char info[BUFSZ], monnambuf[BUFSZ];
@@ -2790,7 +2750,7 @@ struct monst *mtmp;
/* stethoscope or probing applied to hero -- one-line feedback */
void
ustatusline()
ustatusline(void)
{
char info[BUFSZ];