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

@@ -7,14 +7,14 @@
#ifdef USE_ISAAC64
#include "isaac64.h"
static int FDECL(whichrng, (int FDECL((*fn), (int))));
static int whichrng(int (*fn)(int));
#if 0
static isaac64_ctx rng_state;
#endif
struct rnglist_t {
int FDECL((*fn), (int));
int (*fn)(int);
boolean init;
isaac64_ctx rng_state;
};
@@ -27,8 +27,7 @@ static struct rnglist_t rnglist[] = {
};
int
whichrng(fn)
int FDECL((*fn), (int));
whichrng(int (*fn)(int))
{
int i;
@@ -39,9 +38,7 @@ int FDECL((*fn), (int));
}
void
init_isaac64(seed, fn)
unsigned long seed;
int FDECL((*fn), (int));
init_isaac64(unsigned long seed, int (*fn)(int))
{
unsigned char new_rng_state[sizeof seed];
unsigned i;
@@ -68,8 +65,7 @@ RND(int x)
used in cases where the answer doesn't affect gameplay and we don't
want to give users easy control over the main RNG sequence. */
int
rn2_on_display_rng(x)
register int x;
rn2_on_display_rng(register int x)
{
return (isaac64_next_uint64(&rnglist[DISP].rng_state) % x);
}
@@ -78,7 +74,7 @@ register int x;
/* "Rand()"s definition is determined by [OS]conf.h */
#if defined(LINT) && defined(UNIX) /* rand() is long... */
extern int NDECL(rand);
extern int rand(void);
#define RND(x) (rand() % x)
#else /* LINT */
#if defined(UNIX) || defined(RANDOM)
@@ -89,8 +85,7 @@ extern int NDECL(rand);
#endif
#endif /* LINT */
int
rn2_on_display_rng(x)
register int x;
rn2_on_display_rng(register int x)
{
static unsigned seed = 1;
seed *= 2739110765;
@@ -100,8 +95,7 @@ register int x;
/* 0 <= rn2(x) < x */
int
rn2(x)
register int x;
rn2(register int x)
{
#if (NH_DEVEL_STATUS != NH_STATUS_RELEASED)
if (x <= 0) {
@@ -118,8 +112,7 @@ register int x;
/* 0 <= rnl(x) < x; sometimes subtracting Luck;
good luck approaches 0, bad luck approaches (x-1) */
int
rnl(x)
register int x;
rnl(register int x)
{
register int i, adjustment;
@@ -162,8 +155,7 @@ register int x;
/* 1 <= rnd(x) <= x */
int
rnd(x)
register int x;
rnd(register int x)
{
#if (NH_DEVEL_STATUS != NH_STATUS_RELEASED)
if (x <= 0) {
@@ -177,8 +169,7 @@ register int x;
/* d(N,X) == NdX == dX+dX+...+dX N times; n <= d(n,x) <= (n*x) */
int
d(n, x)
register int n, x;
d(register int n, register int x)
{
register int tmp = n;
@@ -195,8 +186,7 @@ register int n, x;
/* 1 <= rne(x) <= max(u.ulevel/3,5) */
int
rne(x)
register int x;
rne(register int x)
{
register int tmp, utmp;
@@ -218,8 +208,7 @@ register int x;
/* rnz: everyone's favorite! */
int
rnz(i)
int i;
rnz(int i)
{
#ifdef LINT
int x = i;