switch source tree from k&r to c99
This commit is contained in:
176
src/pager.c
176
src/pager.c
@@ -9,31 +9,30 @@
|
||||
#include "hack.h"
|
||||
#include "dlb.h"
|
||||
|
||||
static boolean FDECL(is_swallow_sym, (int));
|
||||
static int FDECL(append_str, (char *, const char *));
|
||||
static void FDECL(look_at_object, (char *, int, int, int));
|
||||
static void FDECL(look_at_monster, (char *, char *, struct monst *, int, int));
|
||||
static struct permonst *FDECL(lookat, (int, int, char *, char *));
|
||||
static void FDECL(checkfile, (char *, struct permonst *,
|
||||
BOOLEAN_P, BOOLEAN_P, char *));
|
||||
static void FDECL(look_all, (BOOLEAN_P,BOOLEAN_P));
|
||||
static void FDECL(do_supplemental_info, (char *, struct permonst *,
|
||||
BOOLEAN_P));
|
||||
static void NDECL(whatdoes_help);
|
||||
static void NDECL(docontact);
|
||||
static void NDECL(dispfile_help);
|
||||
static void NDECL(dispfile_shelp);
|
||||
static void NDECL(dispfile_optionfile);
|
||||
static void NDECL(dispfile_license);
|
||||
static void NDECL(dispfile_debughelp);
|
||||
static void NDECL(hmenu_doextversion);
|
||||
static void NDECL(hmenu_dohistory);
|
||||
static void NDECL(hmenu_dowhatis);
|
||||
static void NDECL(hmenu_dowhatdoes);
|
||||
static void NDECL(hmenu_doextlist);
|
||||
static void NDECL(domenucontrols);
|
||||
static boolean is_swallow_sym(int);
|
||||
static int append_str(char *, const char *);
|
||||
static void look_at_object(char *, int, int, int);
|
||||
static void look_at_monster(char *, char *, struct monst *, int, int);
|
||||
static struct permonst *lookat(int, int, char *, char *);
|
||||
static void checkfile(char *, struct permonst *, boolean, boolean,
|
||||
char *);
|
||||
static void look_all(boolean,boolean);
|
||||
static void do_supplemental_info(char *, struct permonst *, boolean);
|
||||
static void whatdoes_help(void);
|
||||
static void docontact(void);
|
||||
static void dispfile_help(void);
|
||||
static void dispfile_shelp(void);
|
||||
static void dispfile_optionfile(void);
|
||||
static void dispfile_license(void);
|
||||
static void dispfile_debughelp(void);
|
||||
static void hmenu_doextversion(void);
|
||||
static void hmenu_dohistory(void);
|
||||
static void hmenu_dowhatis(void);
|
||||
static void hmenu_dowhatdoes(void);
|
||||
static void hmenu_doextlist(void);
|
||||
static void domenucontrols(void);
|
||||
#ifdef PORT_HELP
|
||||
extern void NDECL(port_help);
|
||||
extern void port_help(void);
|
||||
#endif
|
||||
|
||||
static const char invisexplain[] = "remembered, unseen, creature",
|
||||
@@ -41,8 +40,7 @@ static const char invisexplain[] = "remembered, unseen, creature",
|
||||
|
||||
/* Returns "true" for characters that could represent a monster's stomach. */
|
||||
static boolean
|
||||
is_swallow_sym(c)
|
||||
int c;
|
||||
is_swallow_sym(int c)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -58,9 +56,7 @@ int c;
|
||||
* It is expected that buf is of size BUFSZ.
|
||||
*/
|
||||
static int
|
||||
append_str(buf, new_str)
|
||||
char *buf;
|
||||
const char *new_str;
|
||||
append_str(char *buf, const char *new_str)
|
||||
{
|
||||
int space_left; /* space remaining in buf */
|
||||
|
||||
@@ -77,8 +73,7 @@ const char *new_str;
|
||||
|
||||
/* shared by monster probing (via query_objlist!) as well as lookat() */
|
||||
char *
|
||||
self_lookat(outbuf)
|
||||
char *outbuf;
|
||||
self_lookat(char *outbuf)
|
||||
{
|
||||
char race[QBUFSZ], trapbuf[QBUFSZ];
|
||||
|
||||
@@ -104,10 +99,7 @@ char *outbuf;
|
||||
|
||||
/* format description of 'mon's health for look_at_monster(), done_in_by() */
|
||||
char *
|
||||
monhealthdescr(mon, addspace, outbuf)
|
||||
struct monst *mon;
|
||||
boolean addspace;
|
||||
char *outbuf;
|
||||
monhealthdescr(struct monst *mon, boolean addspace, char *outbuf)
|
||||
{
|
||||
int mhp_max = max(mon->mhpmax, 1), /* bullet proofing */
|
||||
pct = (mon->mhp * 100) / mhp_max;
|
||||
@@ -131,10 +123,10 @@ char *outbuf;
|
||||
/* describe a hidden monster; used for look_at during extended monster
|
||||
detection and for probing; also when looking at self */
|
||||
void
|
||||
mhidden_description(mon, altmon, outbuf)
|
||||
struct monst *mon;
|
||||
boolean altmon; /* for probing: if mimicking a monster, say so */
|
||||
char *outbuf;
|
||||
mhidden_description(struct monst *mon,
|
||||
boolean altmon, /* for probing: if mimicking a monster,
|
||||
say so */
|
||||
char *outbuf)
|
||||
{
|
||||
struct obj *otmp;
|
||||
boolean fakeobj, isyou = (mon == &g.youmonst);
|
||||
@@ -189,9 +181,7 @@ char *outbuf;
|
||||
|
||||
/* extracted from lookat(); also used by namefloorobj() */
|
||||
boolean
|
||||
object_from_map(glyph, x, y, obj_p)
|
||||
int glyph, x, y;
|
||||
struct obj **obj_p;
|
||||
object_from_map(int glyph, int x, int y, struct obj **obj_p)
|
||||
{
|
||||
boolean fakeobj = FALSE, mimic_obj = FALSE;
|
||||
struct monst *mtmp;
|
||||
@@ -265,9 +255,8 @@ struct obj **obj_p;
|
||||
}
|
||||
|
||||
static void
|
||||
look_at_object(buf, x, y, glyph)
|
||||
char *buf; /* output buffer */
|
||||
int x, y, glyph;
|
||||
look_at_object(char *buf, /* output buffer */
|
||||
int x, int y, int glyph)
|
||||
{
|
||||
struct obj *otmp = 0;
|
||||
boolean fakeobj = object_from_map(glyph, x, y, &otmp);
|
||||
@@ -300,10 +289,10 @@ int x, y, glyph;
|
||||
}
|
||||
|
||||
static void
|
||||
look_at_monster(buf, monbuf, mtmp, x, y)
|
||||
char *buf, *monbuf; /* buf: output, monbuf: optional output */
|
||||
struct monst *mtmp;
|
||||
int x, y;
|
||||
look_at_monster(char *buf,
|
||||
char *monbuf, /* buf: output, monbuf: optional output */
|
||||
struct monst *mtmp,
|
||||
int x, int y)
|
||||
{
|
||||
char *name, monnambuf[BUFSZ], healthbuf[BUFSZ];
|
||||
boolean accurate = !Hallucination;
|
||||
@@ -425,9 +414,7 @@ int x, y;
|
||||
* If not hallucinating and the glyph is a monster, also monster data.
|
||||
*/
|
||||
static struct permonst *
|
||||
lookat(x, y, buf, monbuf)
|
||||
int x, y;
|
||||
char *buf, *monbuf;
|
||||
lookat(int x, int y, char *buf, char *monbuf)
|
||||
{
|
||||
struct monst *mtmp = (struct monst *) 0;
|
||||
struct permonst *pm = (struct permonst *) 0;
|
||||
@@ -587,11 +574,8 @@ char *buf, *monbuf;
|
||||
* Therefore, we create a copy of inp _just_ for data.base lookup.
|
||||
*/
|
||||
static void
|
||||
checkfile(inp, pm, user_typed_name, without_asking, supplemental_name)
|
||||
char *inp;
|
||||
struct permonst *pm;
|
||||
boolean user_typed_name, without_asking;
|
||||
char *supplemental_name;
|
||||
checkfile(char *inp, struct permonst *pm, boolean user_typed_name,
|
||||
boolean without_asking, char *supplemental_name)
|
||||
{
|
||||
dlb *fp;
|
||||
char buf[BUFSZ], newstr[BUFSZ], givenname[BUFSZ];
|
||||
@@ -874,13 +858,9 @@ char *supplemental_name;
|
||||
}
|
||||
|
||||
int
|
||||
do_screen_description(cc, looked, sym, out_str, firstmatch, for_supplement)
|
||||
coord cc;
|
||||
boolean looked;
|
||||
int sym;
|
||||
char *out_str;
|
||||
const char **firstmatch;
|
||||
struct permonst **for_supplement;
|
||||
do_screen_description(coord cc, boolean looked, int sym, char *out_str,
|
||||
const char **firstmatch,
|
||||
struct permonst **for_supplement)
|
||||
{
|
||||
static const char mon_interior[] = "the interior of a monster",
|
||||
unreconnoitered[] = "unreconnoitered";
|
||||
@@ -1229,9 +1209,7 @@ struct permonst **for_supplement;
|
||||
const char what_is_an_unknown_object[] = "an unknown object";
|
||||
|
||||
int
|
||||
do_look(mode, click_cc)
|
||||
int mode;
|
||||
coord *click_cc;
|
||||
do_look(int mode, coord *click_cc)
|
||||
{
|
||||
boolean quick = (mode == 1); /* use cursor; don't search for "more info" */
|
||||
boolean clicklook = (mode == 2); /* right mouse-click method */
|
||||
@@ -1448,9 +1426,8 @@ coord *click_cc;
|
||||
}
|
||||
|
||||
static void
|
||||
look_all(nearby, do_mons)
|
||||
boolean nearby; /* True => within BOLTLIM, False => entire map */
|
||||
boolean do_mons; /* True => monsters, False => objects */
|
||||
look_all(boolean nearby, /* True => within BOLTLIM, False => entire map */
|
||||
boolean do_mons) /* True => monsters, False => objects */
|
||||
{
|
||||
winid win;
|
||||
int x, y, lo_x, lo_y, hi_x, hi_y, glyph, count = 0;
|
||||
@@ -1561,10 +1538,7 @@ static const char *suptext2[] = {
|
||||
};
|
||||
|
||||
static void
|
||||
do_supplemental_info(name, pm, without_asking)
|
||||
char *name;
|
||||
struct permonst *pm;
|
||||
boolean without_asking;
|
||||
do_supplemental_info(char *name, struct permonst *pm, boolean without_asking)
|
||||
{
|
||||
const char **textp;
|
||||
winid datawin = WIN_ERR;
|
||||
@@ -1628,21 +1602,21 @@ boolean without_asking;
|
||||
|
||||
/* the '/' command */
|
||||
int
|
||||
dowhatis()
|
||||
dowhatis(void)
|
||||
{
|
||||
return do_look(0, (coord *) 0);
|
||||
}
|
||||
|
||||
/* the ';' command */
|
||||
int
|
||||
doquickwhatis()
|
||||
doquickwhatis(void)
|
||||
{
|
||||
return do_look(1, (coord *) 0);
|
||||
}
|
||||
|
||||
/* the '^' command */
|
||||
int
|
||||
doidtrap()
|
||||
doidtrap(void)
|
||||
{
|
||||
register struct trap *trap;
|
||||
int x, y, tt, glyph;
|
||||
@@ -1721,7 +1695,7 @@ doidtrap()
|
||||
*/
|
||||
|
||||
static void
|
||||
whatdoes_help()
|
||||
whatdoes_help(void)
|
||||
{
|
||||
dlb *fp;
|
||||
char *p, buf[BUFSZ];
|
||||
@@ -1755,14 +1729,10 @@ struct wd_stack_frame {
|
||||
Bitfield(else_seen, 1);
|
||||
};
|
||||
|
||||
static boolean FDECL(whatdoes_cond, (char *, struct wd_stack_frame *,
|
||||
int *, int));
|
||||
static boolean whatdoes_cond(char *, struct wd_stack_frame *, int *, int);
|
||||
|
||||
static boolean
|
||||
whatdoes_cond(buf, stack, depth, lnum)
|
||||
char *buf;
|
||||
struct wd_stack_frame *stack;
|
||||
int *depth, lnum;
|
||||
whatdoes_cond(char *buf, struct wd_stack_frame *stack, int *depth, int lnum)
|
||||
{
|
||||
const char badstackfmt[] = "cmdhlp: too many &%c directives at line %d.";
|
||||
boolean newcond, neg, gotopt;
|
||||
@@ -1881,9 +1851,7 @@ int *depth, lnum;
|
||||
#endif /* 0 */
|
||||
|
||||
char *
|
||||
dowhatdoes_core(q, cbuf)
|
||||
char q;
|
||||
char *cbuf;
|
||||
dowhatdoes_core(char q, char *cbuf)
|
||||
{
|
||||
char buf[BUFSZ];
|
||||
#if 0
|
||||
@@ -1962,7 +1930,7 @@ char *cbuf;
|
||||
}
|
||||
|
||||
int
|
||||
dowhatdoes()
|
||||
dowhatdoes(void)
|
||||
{
|
||||
static boolean once = FALSE;
|
||||
char bufr[BUFSZ];
|
||||
@@ -2007,7 +1975,7 @@ dowhatdoes()
|
||||
}
|
||||
|
||||
static void
|
||||
docontact(VOID_ARGS)
|
||||
docontact(void)
|
||||
{
|
||||
winid cwin = create_nhwindow(NHW_TEXT);
|
||||
char buf[BUFSZ];
|
||||
@@ -2037,67 +2005,67 @@ docontact(VOID_ARGS)
|
||||
}
|
||||
|
||||
static void
|
||||
dispfile_help(VOID_ARGS)
|
||||
dispfile_help(void)
|
||||
{
|
||||
display_file(HELP, TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
dispfile_shelp(VOID_ARGS)
|
||||
dispfile_shelp(void)
|
||||
{
|
||||
display_file(SHELP, TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
dispfile_optionfile(VOID_ARGS)
|
||||
dispfile_optionfile(void)
|
||||
{
|
||||
display_file(OPTIONFILE, TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
dispfile_license(VOID_ARGS)
|
||||
dispfile_license(void)
|
||||
{
|
||||
display_file(LICENSE, TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
dispfile_debughelp(VOID_ARGS)
|
||||
dispfile_debughelp(void)
|
||||
{
|
||||
display_file(DEBUGHELP, TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
hmenu_doextversion(VOID_ARGS)
|
||||
hmenu_doextversion(void)
|
||||
{
|
||||
(void) doextversion();
|
||||
}
|
||||
|
||||
static void
|
||||
hmenu_dohistory(VOID_ARGS)
|
||||
hmenu_dohistory(void)
|
||||
{
|
||||
(void) dohistory();
|
||||
}
|
||||
|
||||
static void
|
||||
hmenu_dowhatis(VOID_ARGS)
|
||||
hmenu_dowhatis(void)
|
||||
{
|
||||
(void) dowhatis();
|
||||
}
|
||||
|
||||
static void
|
||||
hmenu_dowhatdoes(VOID_ARGS)
|
||||
hmenu_dowhatdoes(void)
|
||||
{
|
||||
(void) dowhatdoes();
|
||||
}
|
||||
|
||||
static void
|
||||
hmenu_doextlist(VOID_ARGS)
|
||||
hmenu_doextlist(void)
|
||||
{
|
||||
(void) doextlist();
|
||||
}
|
||||
|
||||
static void
|
||||
domenucontrols(VOID_ARGS)
|
||||
domenucontrols(void)
|
||||
{
|
||||
winid cwin = create_nhwindow(NHW_TEXT);
|
||||
show_menu_controls(cwin, FALSE);
|
||||
@@ -2107,7 +2075,7 @@ domenucontrols(VOID_ARGS)
|
||||
|
||||
/* data for dohelp() */
|
||||
static const struct {
|
||||
void NDECL((*f));
|
||||
void (*f)(void);
|
||||
const char *text;
|
||||
} help_menu_items[] = {
|
||||
{ hmenu_doextversion, "About NetHack (version information)." },
|
||||
@@ -2127,12 +2095,12 @@ static const struct {
|
||||
{ port_help, "%s-specific help and commands." },
|
||||
#endif
|
||||
{ dispfile_debughelp, "List of wizard-mode commands." },
|
||||
{ (void NDECL((*))) 0, (char *) 0 }
|
||||
{ (void (*)(void)) 0, (char *) 0 }
|
||||
};
|
||||
|
||||
/* the '?' command */
|
||||
int
|
||||
dohelp()
|
||||
dohelp(void)
|
||||
{
|
||||
winid tmpwin = create_nhwindow(NHW_MENU);
|
||||
char helpbuf[QBUFSZ];
|
||||
@@ -2169,7 +2137,7 @@ dohelp()
|
||||
|
||||
/* the 'V' command; also a choice for '?' */
|
||||
int
|
||||
dohistory()
|
||||
dohistory(void)
|
||||
{
|
||||
display_file(HISTORY, TRUE);
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user