1
0
Fork 0
mirror of https://codeberg.org/noisytoot/notnotdnethack.git synced 2025-07-27 07:52:25 +01:00

Convert some files to ANSI declarations

src/allmain.c, src/alloc.c, src/pline.c, win/tty/termcap.c,
win/tty/topl.c, win/tty/wintty.c, win/tty/getline.c

Also convert curses declarations with an empty parameter list from ()
to (void) and get rid of *_P macros in windowport code.
This commit is contained in:
Ron Nazarov 2024-05-03 01:06:56 +01:00
parent 2bfbd90e51
commit 31411a8d66
Signed by: noisytoot
GPG key ID: 1D43EF4F4492268B
22 changed files with 297 additions and 468 deletions

View file

@ -25,7 +25,7 @@ E void NDECL(moveloop);
E void NDECL(stop_occupation);
E void NDECL(display_gamewindows);
E void NDECL(newgame);
E void FDECL(welcome, (BOOLEAN_P));
E void FDECL(welcome, (boolean));
E time_t NDECL(get_realtime);
E void NDECL(dogoat);
E void FDECL(dogoat_mon, (struct monst *));
@ -2083,8 +2083,8 @@ E void VDECL(There, (const char *,...)) PRINTF_F(1,2);
E void VDECL(verbalize, (const char *,...)) PRINTF_F(1,2);
E void VDECL(raw_printf, (const char *,...)) PRINTF_F(1,2);
E void VDECL(impossible, (const char *,...)) PRINTF_F(1,2);
E const char *FDECL(align_str, (ALIGNTYP_P));
E const char *FDECL(align_str_proper, (ALIGNTYP_P));
E const char *FDECL(align_str, (aligntyp));
E const char *FDECL(align_str_proper, (aligntyp));
E void FDECL(mdrslotline, (struct monst *));
E void FDECL(mstatusline, (struct monst *));
E void NDECL(ustatusline);
@ -3023,7 +3023,7 @@ E boolean FDECL(bimanual, (struct obj *, struct permonst *));
/* ### windows.c ### */
E void FDECL(choose_windows, (const char *));
E char FDECL(genl_message_menu, (CHAR_P,int,const char *));
E char FDECL(genl_message_menu, (char,int,const char *));
E void FDECL(genl_preference_update, (const char *));
/* ### wizard.c ### */

View file

@ -79,7 +79,7 @@ extern winid curses_create_nhwindow(int type);
extern void curses_clear_nhwindow(winid wid);
extern void curses_display_nhwindow(winid wid, BOOLEAN_P block);
extern void curses_display_nhwindow(winid wid, boolean block);
extern void curses_destroy_nhwindow(winid wid);
@ -87,17 +87,17 @@ extern void curses_curs(winid wid, int x, int y);
extern void curses_putstr(winid wid, int attr, const char *text);
extern void curses_display_file(const char *filename,BOOLEAN_P must_exist);
extern void curses_display_file(const char *filename,boolean must_exist);
extern void curses_start_menu(winid wid);
extern void curses_add_menu(winid wid, int glyph, const ANY_P * identifier,
CHAR_P accelerator, CHAR_P group_accel, int attr,
const char *str, BOOLEAN_P presel);
extern void curses_add_menu(winid wid, int glyph, const anything * identifier,
char accelerator, char group_accel, int attr,
const char *str, boolean presel);
extern void curses_end_menu(winid wid, const char *prompt);
extern int curses_select_menu(winid wid, int how, MENU_ITEM_P **selected);
extern int curses_select_menu(winid wid, int how, menu_item **selected);
extern void curses_update_inventory(void);
@ -107,7 +107,7 @@ extern void curses_wait_synch(void);
extern void curses_cliparound(int x, int y);
extern void curses_print_glyph(winid wid,XCHAR_P x,XCHAR_P y,int glyph);
extern void curses_print_glyph(winid wid,xchar x,xchar y,int glyph);
extern void curses_raw_print(const char *str);
@ -121,7 +121,7 @@ extern void curses_nhbell(void);
extern int curses_doprev_message(void);
extern char curses_yn_function(const char *question, const char *choices, CHAR_P def);
extern char curses_yn_function(const char *question, const char *choices, char def);
extern void curses_getlin(const char *question, char *input);
@ -237,7 +237,7 @@ extern int curses_get_mouse(int *mousex, int *mousey, int *mod);
extern void curses_line_input_dialog(const char *prompt, char *answer, int buffer);
extern int curses_character_input_dialog(const char *prompt, const char *choices, CHAR_P def);
extern int curses_character_input_dialog(const char *prompt, const char *choices, char def);
extern int curses_ext_cmd(void);
@ -245,13 +245,13 @@ extern void curses_create_nhmenu(winid wid);
#ifdef MENU_COLOR
extern boolean get_menu_coloring(char *, int *, int *);
#endif
extern void curses_add_nhmenu_item(winid wid, int glyph, const ANY_P *identifier,
CHAR_P accelerator, CHAR_P group_accel, int attr, const char *str,
BOOLEAN_P presel);
extern void curses_add_nhmenu_item(winid wid, int glyph, const anything *identifier,
char accelerator, char group_accel, int attr, const char *str,
boolean presel);
extern void curses_finalize_nhmenu(winid wid, const char *prompt);
extern int curses_display_nhmenu(winid wid, int how, MENU_ITEM_P **_selected);
extern int curses_display_nhmenu(winid wid, int how, menu_item **_selected);
extern boolean curses_menu_exists(winid wid);
@ -268,7 +268,7 @@ extern void curses_decrement_highlight(void);
/* cursinvt.c */
extern void curses_update_inv(void);
extern void curses_add_inv(int, int, CHAR_P, attr_t, const char *);
extern void curses_add_inv(int, int, char, attr_t, const char *);
/* cursinit.c */

View file

@ -18,17 +18,17 @@ struct window_procs {
void NDECL((*win_resume_nhwindows));
winid FDECL((*win_create_nhwindow), (int));
void FDECL((*win_clear_nhwindow), (winid));
void FDECL((*win_display_nhwindow), (winid, BOOLEAN_P));
void FDECL((*win_display_nhwindow), (winid, boolean));
void FDECL((*win_destroy_nhwindow), (winid));
void FDECL((*win_curs), (winid,int,int));
void FDECL((*win_putstr), (winid, int, const char *));
void FDECL((*win_display_file), (const char *, BOOLEAN_P));
void FDECL((*win_display_file), (const char *, boolean));
void FDECL((*win_start_menu), (winid));
void FDECL((*win_add_menu), (winid,int,const ANY_P *,
CHAR_P,CHAR_P,int,const char *, BOOLEAN_P));
void FDECL((*win_add_menu), (winid,int,const anything *,
char,char,int,const char *, boolean));
void FDECL((*win_end_menu), (winid, const char *));
int FDECL((*win_select_menu), (winid, int, MENU_ITEM_P **));
char FDECL((*win_message_menu), (CHAR_P,int,const char *));
int FDECL((*win_select_menu), (winid, int, menu_item **));
char FDECL((*win_message_menu), (char,int,const char *));
void NDECL((*win_update_inventory));
void NDECL((*win_mark_synch));
void NDECL((*win_wait_synch));
@ -38,14 +38,14 @@ struct window_procs {
#ifdef POSITIONBAR
void FDECL((*win_update_positionbar), (char *));
#endif
void FDECL((*win_print_glyph), (winid,XCHAR_P,XCHAR_P,int));
void FDECL((*win_print_glyph), (winid,xchar,xchar,int));
void FDECL((*win_raw_print), (const char *));
void FDECL((*win_raw_print_bold), (const char *));
int NDECL((*win_nhgetch));
int FDECL((*win_nh_poskey), (int *, int *, int *));
void NDECL((*win_nhbell));
int NDECL((*win_doprev_message));
char FDECL((*win_yn_function), (const char *, const char *, CHAR_P));
char FDECL((*win_yn_function), (const char *, const char *, char));
void FDECL((*win_getlin), (const char *,char *));
int NDECL((*win_get_ext_cmd));
void FDECL((*win_number_pad), (int));

View file

@ -100,7 +100,7 @@ E void FDECL(tty_startup,(int*, int*));
#ifndef NO_TERMS
E void NDECL(tty_shutdown);
#endif
E void FDECL(xputc, (CHAR_P));
E void FDECL(xputc, (char));
E void FDECL(xputs, (const char *));
E void NDECL(cl_end);
E void NDECL(clear_screen);
@ -169,18 +169,18 @@ E void FDECL(tty_suspend_nhwindows, (const char *));
E void NDECL(tty_resume_nhwindows);
E winid FDECL(tty_create_nhwindow, (int));
E void FDECL(tty_clear_nhwindow, (winid));
E void FDECL(tty_display_nhwindow, (winid, BOOLEAN_P));
E void FDECL(tty_display_nhwindow, (winid, boolean));
E void FDECL(tty_dismiss_nhwindow, (winid));
E void FDECL(tty_destroy_nhwindow, (winid));
E void FDECL(tty_curs, (winid,int,int));
E void FDECL(tty_putstr, (winid, int, const char *));
E void FDECL(tty_display_file, (const char *, BOOLEAN_P));
E void FDECL(tty_display_file, (const char *, boolean));
E void FDECL(tty_start_menu, (winid));
E void FDECL(tty_add_menu, (winid,int,const ANY_P *,
CHAR_P,CHAR_P,int,const char *, BOOLEAN_P));
E void FDECL(tty_add_menu, (winid,int,const anything *,
char,char,int,const char *, boolean));
E void FDECL(tty_end_menu, (winid, const char *));
E int FDECL(tty_select_menu, (winid, int, MENU_ITEM_P **));
E char FDECL(tty_message_menu, (CHAR_P,int,const char *));
E int FDECL(tty_select_menu, (winid, int, menu_item **));
E char FDECL(tty_message_menu, (char,int,const char *));
E void NDECL(tty_update_inventory);
E void NDECL(tty_mark_synch);
E void NDECL(tty_wait_synch);
@ -190,14 +190,14 @@ E void FDECL(tty_cliparound, (int, int));
#ifdef POSITIONBAR
E void FDECL(tty_update_positionbar, (char *));
#endif
E void FDECL(tty_print_glyph, (winid,XCHAR_P,XCHAR_P,int));
E void FDECL(tty_print_glyph, (winid,xchar,xchar,int));
E void FDECL(tty_raw_print, (const char *));
E void FDECL(tty_raw_print_bold, (const char *));
E int NDECL(tty_nhgetch);
E int FDECL(tty_nh_poskey, (int *, int *, int *));
E void NDECL(tty_nhbell);
E int NDECL(tty_doprev_message);
E char FDECL(tty_yn_function, (const char *, const char *, CHAR_P));
E char FDECL(tty_yn_function, (const char *, const char *, char));
E void FDECL(tty_getlin, (const char *,char *));
E int NDECL(tty_get_ext_cmd);
E void FDECL(tty_number_pad, (int));

View file

@ -17,15 +17,12 @@ typedef union any {
schar a_schar;
/* add types as needed */
} anything;
#define ANY_P union any /* avoid typedef in prototypes */
/* (buggy old Ultrix compiler) */
/* menu return list */
typedef struct mi {
anything item; /* identifier */
long count; /* count */
} menu_item;
#define MENU_ITEM_P struct mi
/* select_menu() "how" argument types */
#define PICK_NONE 0 /* user picks nothing (display only) */

View file

@ -50,8 +50,7 @@ static void FDECL(invisible_twin_act, (struct monst *));
extern const int monstr[];
static void
digcrater(mtmp)
struct monst *mtmp;
digcrater(struct monst *mtmp)
{
int x,y,i,j;
struct trap *ttmp;
@ -76,8 +75,7 @@ digcrater(mtmp)
}
static void
digcloudcrater(mtmp)
struct monst *mtmp;
digcloudcrater(struct monst *mtmp)
{
int x,y,i,j;
struct trap *ttmp;
@ -93,8 +91,7 @@ digcloudcrater(mtmp)
}
static void
digXchasm(mtmp)
struct monst *mtmp;
digXchasm(struct monst *mtmp)
{
int x,y;
struct trap *ttmp;
@ -205,8 +202,7 @@ digXchasm(mtmp)
}
static void
digYchasm(mtmp)
struct monst *mtmp;
digYchasm(struct monst *mtmp)
{
int x,y;
struct trap *ttmp;
@ -387,7 +383,7 @@ hpnotify_format_str(char *str)
static
void
androidUpkeep()
androidUpkeep(void)
{
//Pay unusual upkeep here, possibly pass out
if(uandroid && !u.usleep){
@ -439,7 +435,7 @@ androidUpkeep()
static
void
mercurial_repair()
mercurial_repair(void)
{
struct obj * uequip[] = WORN_SLOTS;
int i;
@ -466,7 +462,7 @@ mercurial_repair()
static
void
clothes_bite_you()
clothes_bite_you(void)
{
struct obj * uequip[] = WORN_SLOTS;
int i;
@ -490,9 +486,7 @@ static long prev_dgl_extrainfo = 0;
* main game loop
*/
int
you_action_cost(actiontype, affect_game_state)
int actiontype;
boolean affect_game_state;
you_action_cost(int actiontype, boolean affect_game_state)
{
int actiontypes_remaining = actiontype;
int current_action, current_cost, highest_cost = 0;
@ -659,7 +653,7 @@ boolean affect_game_state;
}
void
you_calc_movement()
you_calc_movement(void)
{
int moveamt = 0;
int nmonsclose,nmonsnear,enkispeedlim;
@ -875,7 +869,7 @@ you_calc_movement()
/* perform 1 turn's worth of time-dependent hp modification, mostly silently */
/* NOTES: can rehumanize(), can print You("pass out from exertion!") if moving when overloaded at 1 hp */
void
you_regen_hp()
you_regen_hp(void)
{
int wtcap = near_capacity();
int perX = 0;
@ -1193,7 +1187,7 @@ you_regen_hp()
/* perform 1 turn's worth of time-dependent power modification, silently */
void
you_regen_pw()
you_regen_pw(void)
{
int wtcap = near_capacity();
int perX = 0;
@ -1364,7 +1358,7 @@ you_regen_pw()
/* perform 1 turn's worth of time-dependent sanity modification, silently */
void
you_regen_san()
you_regen_san(void)
{
// Threshold levels based on wis.
int reglevel = ACURR(A_WIS);
@ -1481,7 +1475,7 @@ you_regen_san()
}
void
moveloop()
moveloop(void)
{
int abort_lev, i, j;
struct monst *mtmp, *nxtmon;
@ -3397,7 +3391,7 @@ karemade:
void
stop_occupation()
stop_occupation(void)
{
struct monst *mtmp;
@ -3424,7 +3418,7 @@ stop_occupation()
void
display_gamewindows()
display_gamewindows(void)
{
curses_stupid_hack = 0;
WIN_MESSAGE = create_nhwindow(NHW_MESSAGE);
@ -3443,7 +3437,7 @@ display_gamewindows()
}
void
newgame()
newgame(void)
{
int i;
@ -3606,8 +3600,7 @@ newgame()
}
static int
find_preset_inherited(name)
char * name;
find_preset_inherited(char *name)
{
int i;
char * aname;
@ -3630,7 +3623,7 @@ find_preset_inherited(name)
static int
do_inheritance_menu()
do_inheritance_menu(void)
{
winid tmpwin;
int n, how, i;
@ -3674,8 +3667,7 @@ do_inheritance_menu()
/* show "welcome [back] to nethack" message at program startup */
void
welcome(new_game)
boolean new_game; /* false => restoring an old game */
welcome(boolean new_game) /* false => restoring an old game */
{
char buf[BUFSZ];
char racebuf[BUFSZ];
@ -3763,7 +3755,7 @@ boolean new_game; /* false => restoring an old game */
#ifdef POSITIONBAR
static void
do_positionbar()
do_positionbar(void)
{
static char pbar[COLNO];
char *p;
@ -3776,7 +3768,7 @@ do_positionbar()
*p++ = upstair.sx;
}
if (sstairs.sx && (cmap_at_stair(sstairs) == S_upstair || cmap_at_stair(sstairs) == S_upladder)
|| cmap_at_stair(sstairs) == S_brupstair)) {
|| cmap_at_stair(sstairs) == S_brupstair) {
*p++ = '<';
*p++ = sstairs.sx;
}
@ -3787,7 +3779,7 @@ do_positionbar()
*p++ = dnstair.sx;
}
if (sstairs.sx && (cmap_at_stair(sstairs) == S_dnstair || cmap_at_stair(sstairs) == S_dnladder)
|| cmap_at_stair(sstairs) == S_brdnstair)) {
|| cmap_at_stair(sstairs) == S_brdnstair) {
*p++ = '>';
*p++ = sstairs.sx;
}
@ -3826,7 +3818,7 @@ get_realtime(void)
static
void
printBodies(){
printBodies(void){
FILE *rfile;
register int i, j;
char pbuf[BUFSZ];
@ -3870,7 +3862,7 @@ printBodies(){
static
void
printSanAndInsight(){
printSanAndInsight(void){
FILE *rfile;
register int i, j;
char pbuf[BUFSZ];
@ -3899,7 +3891,7 @@ printSanAndInsight(){
static
void
printDPR(){
printDPR(void){
FILE *rfile;
register int i, j, avdm, mdm, avgperhit, maxperhit;
char pbuf[BUFSZ];
@ -3943,7 +3935,7 @@ printDPR(){
static
void
printMons(){
printMons(void){
FILE *rfile;
register int i;
char pbuf[BUFSZ*100];
@ -4230,7 +4222,7 @@ printMons(){
static
void
printMonNames(){
printMonNames(void){
FILE *rfile;
register int i;
rfile = fopen_datafile("wikiNames.txt", "w", SCOREPREFIX);
@ -4245,9 +4237,7 @@ printMonNames(){
static
void
resFlags(buf, rflags)
char *buf;
unsigned int rflags;
resFlags(char *buf, unsigned int rflags)
{
int i;
boolean b = FALSE;
@ -4278,9 +4268,7 @@ resFlags(buf, rflags)
static
void
printAttacks(buf, ptr)
char *buf;
struct permonst *ptr;
printAttacks(char *buf, struct permonst *ptr)
{
int i;
struct attack *attk;
@ -4333,7 +4321,7 @@ printAttacks(buf, ptr)
}
static void
cthulhu_mind_blast()
cthulhu_mind_blast(void)
{
struct monst *mon, *nmon;
int nd = 1;
@ -4377,8 +4365,7 @@ cthulhu_mind_blast()
}
void
spot_monster(mon)
struct monst *mon;
spot_monster(struct monst *mon)
{
if(couldsee(mon->mx, mon->my) &&
distmin(mon->mx, mon->my, u.ux, u.uy) <= BOLT_LIM &&
@ -4404,7 +4391,7 @@ struct monst *mon;
}
static void
sense_nearby_monsters()
sense_nearby_monsters(void)
{
int dx, dy;
struct monst *mtmp;
@ -4452,8 +4439,7 @@ sense_nearby_monsters()
static
void
unseen_actions(mon)
struct monst *mon;
unseen_actions(struct monst *mon)
{
//Note: May cause mon to change its state, including moving to a different monster chain.
if(mon->mux == u.uz.dnum && mon->muy == u.uz.dlevel && mon->mtyp == PM_BLESSED)
@ -4484,8 +4470,7 @@ static int goatkids[] = {PM_SMALL_GOAT_SPAWN, PM_GOAT_SPAWN, PM_GIANT_GOAT_SPAWN
PM_QUICKLING, PM_DRYAD, PM_NAIAD, PM_OREAD, PM_YUKI_ONNA, PM_DEMINYMPH};
static
void
blessed_spawn(mon)
struct monst *mon;
blessed_spawn(struct monst *mon)
{
struct monst *mtmp;
xchar xlocale, ylocale, xyloc;
@ -4502,8 +4487,7 @@ struct monst *mon;
}
void
alkilith_spawn(mon)
struct monst *mon;
alkilith_spawn(struct monst *mon)
{
struct monst *mtmp;
xchar xlocale, ylocale, xyloc;
@ -4554,8 +4538,7 @@ static int witchspawns[] = {PM_APPRENTICE_WITCH, PM_APPRENTICE_WITCH, PM_APPRENT
PM_LARGE_CAT, PM_PANTHER, PM_TIGER, PM_GIANT_RAT, PM_ENORMOUS_RAT, PM_RODENT_OF_UNUSUAL_SIZE};
static
void
good_neighbor(mon)
struct monst *mon;
good_neighbor(struct monst *mon)
{
struct monst *mtmp;
xchar xlocale, ylocale, xyloc;
@ -4631,8 +4614,7 @@ struct monst *mon;
static
void
good_neighbor_visible(mon)
struct monst *mon;
good_neighbor_visible(struct monst *mon)
{
struct monst *mtmp;
for(mtmp = fmon; mtmp; mtmp = mtmp->nmon){
@ -4712,8 +4694,7 @@ static int toughpharaohspawns[] = {PM_COBRA, PM_SERPENT_NECKED_LIONESS, PM_HUNTI
static
void
dark_pharaoh(mon)
struct monst *mon;
dark_pharaoh(struct monst *mon)
{
struct monst *mtmp;
xchar xlocale, ylocale, xyloc;
@ -4826,8 +4807,7 @@ struct monst *mon;
static
void
dark_pharaoh_visible(mon)
struct monst *mon;
dark_pharaoh_visible(struct monst *mon)
{
struct monst *mtmp;
xchar xlocale, ylocale;
@ -4952,8 +4932,7 @@ struct monst *mon;
static
void
polyp_pickup(mon)
struct monst *mon;
polyp_pickup(struct monst *mon)
{
struct obj *otmp, *otmp2;
register struct monst *mtmp, *mtmp0 = 0, *mtmp2;
@ -5016,8 +4995,7 @@ struct monst *mon;
static
void
unbodied_heal(mon)
struct monst *mon;
unbodied_heal(struct monst *mon)
{
struct obj *otmp, *otmp2;
register struct monst *mtmp, *mtmp0 = 0, *mtmp2;
@ -5081,8 +5059,7 @@ struct monst *mon;
static
void
goat_sacrifice(mon)
struct monst *mon;
goat_sacrifice(struct monst *mon)
{
struct obj *otmp, *otmp2;
struct monst *mtmp, *mtmp0 = 0, *mtmp2;
@ -5186,8 +5163,7 @@ struct monst *mon;
static
void
palid_stranger(mon)
struct monst *mon;
palid_stranger(struct monst *mon)
{
struct obj *otmp, *otmp2;
struct monst *mtmp, *mtmp0 = 0, *mtmp2;
@ -5273,8 +5249,7 @@ struct monst *mon;
static
void
sib_follow(mon)
struct monst *mon;
sib_follow(struct monst *mon)
{
struct obj *otmp, *otmp2;
struct monst *mtmp, *mtmp0 = 0, *mtmp2;
@ -5322,8 +5297,7 @@ struct monst *mon;
}
void
invisible_twin_act(mon)
struct monst *mon;
invisible_twin_act(struct monst *mon)
{
//No actions while "dead"
if(mon->mvar_twin_lifesaved)
@ -5380,14 +5354,13 @@ struct monst *mon;
}
void
dogoat()
dogoat(void)
{
dogoat_mon(&youmonst);
}
void
dogoat_mon(magr)
struct monst *magr;
dogoat_mon(struct monst *magr)
{
struct monst *mdef;
extern const int clockwisex[8];
@ -5537,8 +5510,7 @@ struct monst *magr;
}
void
dochaos_mon(magr)
struct monst *magr;
dochaos_mon(struct monst *magr)
{
struct monst *mdef;
extern const int clockwisex[8];
@ -5628,8 +5600,7 @@ struct monst *magr;
}
void
dohost_mon(magr)
struct monst *magr;
dohost_mon(struct monst *magr)
{
struct monst *mdef;
struct monst *nmon;
@ -5840,8 +5811,7 @@ struct monst *magr;
}
void
donachash(magr)
struct monst *magr;
donachash(struct monst *magr)
{
struct monst *mdef;
extern const int clockwisex[8];
@ -5904,8 +5874,7 @@ struct monst *magr;
}
void
dosnake(magr)
struct monst *magr;
dosnake(struct monst *magr)
{
struct monst *mdef;
extern const int clockwisex[8];
@ -5989,8 +5958,7 @@ struct monst *magr;
}
boolean
doyog(magr)
struct monst *magr;
doyog(struct monst *magr)
{
struct monst *mdef;
extern const int clockwisex[8];
@ -6074,8 +6042,7 @@ struct monst *magr;
}
void
dokraken_mon(magr)
struct monst *magr;
dokraken_mon(struct monst *magr)
{
struct monst *mdef;
extern const int clockwisex[8];
@ -6152,8 +6119,7 @@ struct monst *magr;
}
void
dotailslap(magr)
struct monst *magr;
dotailslap(struct monst *magr)
{
struct monst *mdef;
extern const int clockwisex[8];
@ -6226,8 +6192,7 @@ struct monst *magr;
}
void
dovines(magr)
struct monst *magr;
dovines(struct monst *magr)
{
struct monst *mdef;
extern const int clockwisex[8];
@ -6299,8 +6264,7 @@ struct monst *magr;
}
void
dostarblades(magr)
struct monst *magr;
dostarblades(struct monst *magr)
{
struct monst *mdef;
extern const int clockwisex[8];
@ -6379,8 +6343,7 @@ struct monst *magr;
}
void
dostorm(magr)
struct monst *magr;
dostorm(struct monst *magr)
{
struct monst *mdef;
boolean youagr = (magr == &youmonst);

View file

@ -27,10 +27,8 @@ static boolean tried_heaplog = FALSE;
long *FDECL(alloc,(unsigned int));
extern void VDECL(panic, (const char *,...)) PRINTF_F(1,2);
long *
alloc(lth)
register unsigned int lth;
alloc(unsigned int lth)
{
#ifdef LINT
/*
@ -67,9 +65,7 @@ register unsigned int lth;
/* format a pointer for display purposes; caller supplies the result buffer */
char *
fmt_ptr(ptr, buf)
const genericptr ptr;
char *buf;
fmt_ptr(const genericptr ptr, char *buf)
{
Sprintf(buf, PTR_FMT, (PTR_TYP)ptr);
return buf;
@ -82,7 +78,7 @@ char *buf;
/* If ${NH_HEAPLOG} is defined and we can create a file by that name,
then we'll log the allocation and release information to that file. */
static void
heapmon_init()
heapmon_init(void)
{
char *logname = getenv("NH_HEAPLOG");
@ -92,10 +88,7 @@ heapmon_init()
}
long *
nhalloc(lth, file, line)
unsigned int lth;
const char *file;
int line;
nhalloc(unsigned int lth, const char *file, int line)
{
long *ptr = alloc(lth);
char ptr_address[20];
@ -113,10 +106,7 @@ int line;
}
void
nhfree(ptr, file, line)
genericptr_t ptr;
const char *file;
int line;
nhfree(genericptr_t ptr, const char *file, int line)
{
char ptr_address[20];

View file

@ -10,14 +10,7 @@
/// Malloc path and use the path pointer to return it
boolean
a_star(x, y, gx, gy, mmflags, max_length, path)
int x;
int y;
int gx;
int gy;
long mmflags;
int max_length;
struct pathNode **path;
a_star(int x, int y, int gx, int gy, long mmflags, int max_length, struct pathNode **path)
{
struct mapNode closed[COLNO][ROWNO];
(void) memset((genericptr_t) closed, 0, sizeof(closed));
@ -205,13 +198,7 @@ nextnode->propagate = propagate;
boolean
path_exists(x, y, gx, gy, mvflags, max_length)
int x;
int y;
int gx;
int gy;
long mvflags;
int max_length;
path_exists(int x, int y, int gx, int gy, long mvflags, int max_length)
{
return a_star(x, y, gx, gy, mvflags, max_length, (struct pathNode **) 0);
}

View file

@ -21,9 +21,7 @@ int lastmsg = -1;
void
msgpline_add(typ, pattern)
int typ;
char *pattern;
msgpline_add(int typ, char *pattern)
{
int errnum;
char errbuf[80];
@ -52,7 +50,7 @@ msgpline_add(typ, pattern)
}
void
msgpline_free()
msgpline_free(void)
{
struct _plinemsg *tmp = pline_msg;
struct _plinemsg *tmp2;
@ -70,8 +68,7 @@ msgpline_free()
}
int
msgpline_type(msg)
const char *msg;
msgpline_type(const char *msg)
{
struct _plinemsg *tmp = pline_msg;
while (tmp) {
@ -160,8 +157,7 @@ static char *you_buf = 0;
static int you_buf_siz = 0;
static char *
You_buf(siz)
int siz;
You_buf(int siz)
{
if (siz > you_buf_siz) {
if (you_buf) free((genericptr_t) you_buf);
@ -172,7 +168,7 @@ int siz;
}
void
free_youbuf()
free_youbuf(void)
{
if (you_buf) free((genericptr_t) you_buf), you_buf = (char *)0;
you_buf_siz = 0;
@ -388,8 +384,7 @@ const char * const hallu_alignments[] = {
};
const char *
align_str(alignment)
aligntyp alignment;
align_str(aligntyp alignment)
{
if (Hallucination) {
return hallu_alignments[rn2(SIZE(hallu_alignments))];
@ -426,8 +421,7 @@ align_str(alignment)
}
const char *
align_str_proper(alignment)
aligntyp alignment;
align_str_proper(aligntyp alignment)
{
if(Role_if(PM_EXILE) && Is_astralevel(&u.uz)){
switch ((int)alignment) {
@ -474,8 +468,7 @@ align_str_proper(alignment)
}
void
mdrslotline(mtmp)
register struct monst *mtmp;
mdrslotline(struct monst *mtmp)
{
int slot;
int base, nat_dr, armac;
@ -523,8 +516,7 @@ register struct monst *mtmp;
}
void
mstatusline(mtmp)
register struct monst *mtmp;
mstatusline(struct monst *mtmp)
{
aligntyp alignment;
char info[BUFSZ], monnambuf[BUFSZ];
@ -622,7 +614,7 @@ register struct monst *mtmp;
}
void
ustatusline()
ustatusline(void)
{
char info[BUFSZ];
@ -700,7 +692,7 @@ ustatusline()
}
void
self_invis_message()
self_invis_message(void)
{
if(Role_if(PM_PIRATE)){
pline("%s %s.",
@ -717,8 +709,7 @@ self_invis_message()
}
const char *
replace(st, orig, repl)
const char *st, *orig, *repl;
replace(const char *st, const char *orig, const char *repl)
{
static char retval[TBUFSZ];
char buffer[TBUFSZ];
@ -744,8 +735,7 @@ const char *st, *orig, *repl;
/*Ben Collver's fixes*/
const char *
piratesay(orig)
const char *orig;
piratesay(const char *orig)
{
orig = replace(orig,"You","Ye");
orig = replace(orig,"you","ye");

View file

@ -17,11 +17,11 @@ typedef struct nhmi {
winid wid; /* NetHack window id */
int glyph; /* Menu glyphs */
anything identifier; /* Value returned if item selected */
CHAR_P accelerator; /* Character used to select item from menu */
CHAR_P group_accel; /* Group accelerator for menu item, if any */
char accelerator; /* Character used to select item from menu */
char group_accel; /* Group accelerator for menu item, if any */
int attr; /* Text attributes for item */
const char *str; /* Text of menu item */
BOOLEAN_P presel; /* Whether menu item should be preselected */
boolean presel; /* Whether menu item should be preselected */
boolean selected; /* Whether item is currently selected */
int page_num; /* Display page number for entry */
int line_num; /* Line number on page where entry begins */
@ -148,7 +148,7 @@ curses_line_input_dialog(const char *prompt, char *answer, int buffer)
int
curses_character_input_dialog(const char *prompt, const char *choices,
CHAR_P def)
char def)
{
WINDOW *askwin = NULL;
int answer, count, maxwidth, map_height, map_width;
@ -309,7 +309,7 @@ curses_character_input_dialog(const char *prompt, const char *choices,
/* Return an extended command from the user */
int
curses_ext_cmd()
curses_ext_cmd(void)
{
int count, letter, prompt_width, startx, starty, winx, winy;
int messageh, messagew, maxlen = BUFSZ - 1;
@ -495,9 +495,9 @@ curses_create_nhmenu(winid wid)
/* Add a menu item to the given menu window */
void
curses_add_nhmenu_item(winid wid, int glyph, const ANY_P * identifier,
CHAR_P accelerator, CHAR_P group_accel, int attr,
const char *str, BOOLEAN_P presel)
curses_add_nhmenu_item(winid wid, int glyph, const anything * identifier,
char accelerator, char group_accel, int attr,
const char *str, boolean presel)
{
char *new_str;
nhmenu_item *new_item, *current_items, *menu_item_ptr;
@ -576,13 +576,13 @@ curses_finalize_nhmenu(winid wid, const char *prompt)
/* Display a nethack menu, and return a selection, if applicable */
int
curses_display_nhmenu(winid wid, int how, MENU_ITEM_P ** _selected)
curses_display_nhmenu(winid wid, int how, menu_item ** _selected)
{
nhmenu *current_menu = get_menu(wid);
nhmenu_item *menu_item_ptr;
int num_chosen, count;
WINDOW *win;
MENU_ITEM_P *selected = NULL;
menu_item *selected = NULL;
*_selected = NULL;
@ -622,7 +622,7 @@ curses_display_nhmenu(winid wid, int how, MENU_ITEM_P ** _selected)
curses_destroy_win(win);
if (num_chosen > 0) {
selected = (MENU_ITEM_P *) malloc(num_chosen * sizeof (MENU_ITEM_P));
selected = (menu_item *) malloc(num_chosen * sizeof (menu_item));
count = 0;
menu_item_ptr = current_menu->entries;

View file

@ -14,17 +14,17 @@
void curses_line_input_dialog(const char *prompt, char *answer, int buffer);
int curses_character_input_dialog(const char *prompt, const char *choices,
CHAR_P def);
char def);
int curses_ext_cmd(void);
void curses_create_nhmenu(winid wid);
void curses_add_nhmenu_item(winid wid, int glyph, const ANY_P * identifier,
CHAR_P accelerator, CHAR_P group_accel, int attr,
const char *str, BOOLEAN_P presel);
void curses_add_nhmenu_item(winid wid, int glyph, const anything * identifier,
char accelerator, char group_accel, int attr,
const char *str, boolean presel);
# ifdef MENU_COLOR
boolean get_menu_coloring(char *, int *, int *);
# endif
void curses_finalize_nhmenu(winid wid, const char *prompt);
int curses_display_nhmenu(winid wid, int how, MENU_ITEM_P ** _selected);
int curses_display_nhmenu(winid wid, int how, menu_item ** _selected);
boolean curses_menu_exists(winid wid);
void curses_del_menu(winid wid);

View file

@ -213,10 +213,10 @@ set_window_position(int *winx, int *winy, int *winw, int *winh, int orientation,
}
}
/* Create the "main" nonvolitile windows used by nethack */
/* Create the "main" nonvolatile windows used by nethack */
void
curses_create_main_windows()
curses_create_main_windows(void)
{
int min_message_height = 1;
int message_orientation = 0;
@ -400,7 +400,7 @@ curses_create_main_windows()
/* Initialize curses colors to colors used by NetHack */
void
curses_init_nhcolors()
curses_init_nhcolors(void)
{
#ifdef TEXTCOLOR
if (has_colors()) {
@ -458,7 +458,7 @@ curses_init_nhcolors()
Borrowed from the Gnome window port. */
void
curses_choose_character()
curses_choose_character(void)
{
int n, i, sel, count_off, pick4u;
int count = 0;
@ -984,7 +984,7 @@ curses_character_dialog(const char **choices, const char *prompt, boolean inorde
/* Initialize and display options appropriately */
void
curses_init_options()
curses_init_options(void)
{
set_wc_option_mod_status(WC_ALIGN_MESSAGE | WC_ALIGN_STATUS | WC_COLOR |
WC_HILITE_PET | WC_POPUP_DIALOG, SET_IN_GAME);
@ -1056,7 +1056,7 @@ curses_init_options()
/* Display an ASCII splash screen if the splash_screen option is set */
void
curses_display_splash_window()
curses_display_splash_window(void)
{
int x_start;
int y_start;
@ -1183,7 +1183,7 @@ curses_display_splash_window()
/* Resore colors and cursor state before exiting */
void
curses_cleanup()
curses_cleanup(void)
{
#ifdef TEXTCOLOR
if (has_colors() && can_change_color()) {

View file

@ -49,7 +49,7 @@ curses_update_inv(void)
/* Adds an inventory item. */
void
curses_add_inv(int y, int glyph, CHAR_P accelerator, attr_t attr,
curses_add_inv(int y, int glyph, char accelerator, attr_t attr,
const char *str)
{
WINDOW *win = curses_get_nhwin(INV_WIN);

View file

@ -173,7 +173,7 @@ curses_init_nhwindows(int *argcp, char **argv)
the process. You need to fill in pl_character[0].
*/
void
curses_player_selection()
curses_player_selection(void)
{
curses_choose_character();
}
@ -181,7 +181,7 @@ curses_player_selection()
/* Ask the user for a player name. */
void
curses_askname()
curses_askname(void)
{
curses_line_input_dialog("Who are you?", plname, PL_NSIZ);
}
@ -191,7 +191,7 @@ curses_askname()
A noop for the tty and X window-ports.
*/
void
curses_get_nh_event()
curses_get_nh_event(void)
{
#ifdef PDCURSES
if (is_termresized()) {
@ -242,7 +242,7 @@ curses_suspend_nhwindows(const char *str)
/* Restore the windows after being suspended. */
void
curses_resume_nhwindows()
curses_resume_nhwindows(void)
{
curses_refresh_nethack_windows();
}
@ -287,7 +287,7 @@ curses_clear_nhwindow(winid wid)
--more--, if necessary, in the tty window-port.
*/
void
curses_display_nhwindow(winid wid, BOOLEAN_P block)
curses_display_nhwindow(winid wid, boolean block)
{
menu_item *selected = NULL;
if (curses_is_menu(wid) || curses_is_text(wid)) {
@ -374,7 +374,7 @@ curses_putstr(winid wid, int attr, const char *text)
iff complain is TRUE.
*/
void
curses_display_file(const char *filename, BOOLEAN_P must_exist)
curses_display_file(const char *filename, boolean must_exist)
{
curses_view_file(filename, must_exist);
}
@ -425,9 +425,9 @@ add_menu(winid wid, int glyph, const anything identifier,
menu is displayed, set preselected to TRUE.
*/
void
curses_add_menu(winid wid, int glyph, const ANY_P * identifier,
CHAR_P accelerator, CHAR_P group_accel, int attr,
const char *str, BOOLEAN_P presel)
curses_add_menu(winid wid, int glyph, const anything * identifier,
char accelerator, char group_accel, int attr,
const char *str, boolean presel)
{
int curses_attr = curses_convert_attr(attr);
@ -485,7 +485,7 @@ int select_menu(winid window, int how, menu_item **selected)
create_nhwindow() time.
*/
int
curses_select_menu(winid wid, int how, MENU_ITEM_P ** selected)
curses_select_menu(winid wid, int how, menu_item ** selected)
{
if (inv_update)
return 0;
@ -522,7 +522,7 @@ mark_synch() -- Don't go beyond this point in I/O on any channel until
for the moment
*/
void
curses_mark_synch()
curses_mark_synch(void)
{
}
@ -533,7 +533,7 @@ wait_synch() -- Wait until all pending output is complete (*flush*() for
display is OK when return from wait_synch().
*/
void
curses_wait_synch()
curses_wait_synch(void)
{
}
@ -561,7 +561,7 @@ print_glyph(window, x, y, glyph)
a 1-1 map between glyphs and distinct things on the map).
*/
void
curses_print_glyph(winid wid, XCHAR_P x, XCHAR_P y, int glyph)
curses_print_glyph(winid wid, xchar x, xchar y, int glyph)
{
glyph_t ch;
int color;
@ -612,7 +612,7 @@ int nhgetch() -- Returns a single character input from the user.
Returned character _must_ be non-zero.
*/
int
curses_nhgetch()
curses_nhgetch(void)
{
int ch;
@ -658,7 +658,7 @@ nhbell() -- Beep at user. [This will exist at least until sounds are
redone, since sounds aren't attributable to windows anyway.]
*/
void
curses_nhbell()
curses_nhbell(void)
{
beep();
}
@ -669,7 +669,7 @@ doprev_message()
-- On the tty-port this scrolls WIN_MESSAGE back one line.
*/
int
curses_doprev_message()
curses_doprev_message(void)
{
curses_prev_mesg();
return 0;
@ -695,7 +695,7 @@ char yn_function(const char *ques, const char *choices, char default)
ports might use a popup.
*/
char
curses_yn_function(const char *question, const char *choices, CHAR_P def)
curses_yn_function(const char *question, const char *choices, char def)
{
return (char) curses_character_input_dialog(question, choices, def);
}
@ -723,7 +723,7 @@ int get_ext_cmd(void)
selection, -1 otherwise.
*/
int
curses_get_ext_cmd()
curses_get_ext_cmd(void)
{
return curses_ext_cmd();
}
@ -761,7 +761,7 @@ start_screen() -- Only used on Unix tty ports, but must be declared for
just declare an empty function.
*/
void
curses_start_screen()
curses_start_screen(void)
{
}
@ -770,7 +770,7 @@ end_screen() -- Only used on Unix tty ports, but must be declared for
completeness. The complement of start_screen().
*/
void
curses_end_screen()
curses_end_screen(void)
{
}

View file

@ -163,7 +163,7 @@ curses_block(boolean require_tab)
}
int
curses_more()
curses_more(void)
{
return curses_block(FALSE);
}
@ -172,7 +172,7 @@ curses_more()
/* Clear the message window if one line; otherwise unhighlight old messages */
void
curses_clear_unhighlight_message_window()
curses_clear_unhighlight_message_window(void)
{
int mh, mw, count;
boolean border = curses_window_has_border(MESSAGE_WIN);
@ -213,7 +213,7 @@ curses_clear_unhighlight_message_window()
recent messages. */
void
curses_last_messages()
curses_last_messages(void)
{
boolean border = curses_window_has_border(MESSAGE_WIN);
@ -239,7 +239,7 @@ curses_last_messages()
/* Initialize list for message history */
void
curses_init_mesg_history()
curses_init_mesg_history(void)
{
max_messages = iflags.msg_history;
@ -256,7 +256,7 @@ curses_init_mesg_history()
/* Display previous message window messages in reverse chron order */
void
curses_prev_mesg()
curses_prev_mesg(void)
{
int count;
winid wid;

View file

@ -36,7 +36,7 @@ static int parse_escape_sequence(void);
/* Read a character of input from the user */
int
curses_read_char()
curses_read_char(void)
{
int ch, tmpch;
@ -509,7 +509,7 @@ curses_move_cursor(winid wid, int x, int y)
/* Perform actions that should be done every turn before nhgetch() */
void
curses_prehousekeeping()
curses_prehousekeeping(void)
{
#ifndef PDCURSES
WINDOW *win = curses_get_nhwin(MAP_WIN);
@ -532,7 +532,7 @@ curses_prehousekeeping()
/* Perform actions that should be done every turn after nhgetch() */
void
curses_posthousekeeping()
curses_posthousekeeping(void)
{
curs_set(0);
curses_decrement_highlights(FALSE);
@ -869,7 +869,7 @@ term_start_attr(int attr)
}
extern void
term_end_color()
term_end_color(void)
{
}

View file

@ -14,7 +14,7 @@
/* Global declarations */
void curses_update_stats();
void curses_update_stats(void);
void curses_decrement_highlights(boolean);
attr_t curses_color_attr(int nh_color, int bg_color);

View file

@ -148,7 +148,7 @@ curses_destroy_win(WINDOW * win)
/* Refresh nethack windows if they exist, or base window if not */
void
curses_refresh_nethack_windows()
curses_refresh_nethack_windows(void)
{
WINDOW *status_window, *message_window, *map_window, *inv_window;
@ -681,7 +681,7 @@ curses_draw_map(int sx, int sy, int ex, int ey)
/* Init map array to blanks */
static void
clear_map()
clear_map(void)
{
int x, y;

View file

@ -21,7 +21,6 @@ extern int NDECL(extcmd_via_menu); /* cmd.c */
extern char erase_char, kill_char; /* from appropriate tty.c file */
/*
* Read a line closed with '\n' into the array char bufp[BUFSZ].
* (The '\n' is not stored. The string is closed with a '\0'.)
@ -29,18 +28,13 @@ extern char erase_char, kill_char; /* from appropriate tty.c file */
* resulting string is "\033".
*/
void
tty_getlin(query, bufp)
const char *query;
register char *bufp;
tty_getlin(const char *query, char *bufp)
{
hooked_tty_getlin(query, bufp, (getlin_hook_proc) 0);
}
static void
hooked_tty_getlin(query, bufp, hook)
const char *query;
register char *bufp;
getlin_hook_proc hook;
hooked_tty_getlin(const char *query, char *bufp, getlin_hook_proc hook)
{
register char *obufp = bufp;
register int c;
@ -154,8 +148,7 @@ getlin_hook_proc hook;
}
void
xwaitforspace(s)
register const char *s; /* chars allowed besides return */
xwaitforspace(const char *s) /* chars allowed besides return */
{
register int c, x = ttyDisplay ? (int) ttyDisplay->dismiss_more : '\n';
@ -188,8 +181,7 @@ register const char *s; /* chars allowed besides return */
* + base has enough room to hold our string
*/
static boolean
ext_cmd_getlin_hook(base)
char *base;
ext_cmd_getlin_hook(char *base)
{
int oindex, com_index;
@ -216,7 +208,7 @@ ext_cmd_getlin_hook(base)
* stop when we have found enough characters to make a unique command.
*/
int
tty_get_ext_cmd()
tty_get_ext_cmd(void)
{
int i;
char buf[BUFSZ];

View file

@ -67,8 +67,7 @@ static char tgotobuf[20];
void
tty_startup(wid, hgt)
int *wid, *hgt;
tty_startup(int *wid, int *hgt)
{
register int i;
#ifdef TERMLIB
@ -252,7 +251,7 @@ int *wid, *hgt;
/* note: at present, this routine is not part of the formal window interface */
/* deallocate resources prior to final termination */
void
tty_shutdown()
tty_shutdown(void)
{
#if defined(TEXTCOLOR) && defined(TERMLIB)
kill_hilite();
@ -262,8 +261,7 @@ tty_shutdown()
}
void
tty_number_pad(state)
int state;
tty_number_pad(int state)
{
switch (state) {
case -1: /* activate keypad mode (escape sequences) */
@ -290,7 +288,7 @@ static void NDECL(tty_decgraphics_termcap_fixup);
so this is a convenient hook.
*/
static void
tty_decgraphics_termcap_fixup()
tty_decgraphics_termcap_fixup(void)
{
static char ctrlN[] = "\016";
static char ctrlO[] = "\017";
@ -339,7 +337,7 @@ tty_decgraphics_termcap_fixup()
void
tty_start_screen()
tty_start_screen(void)
{
xputs(TI);
xputs(VS);
@ -353,7 +351,7 @@ tty_start_screen()
}
void
tty_end_screen()
tty_end_screen(void)
{
clear_screen();
xputs(VE);
@ -363,8 +361,7 @@ tty_end_screen()
/* Cursor movements */
void
nocmov(x, y)
int x,y;
nocmov(int x, int y)
{
if ((int) ttyDisplay->cury > y) {
if(UP) {
@ -410,25 +407,21 @@ int x,y;
}
void
cmov(x, y)
register int x, y;
cmov(int x, int y)
{
xputs(tgoto(nh_CM, x, y));
ttyDisplay->cury = y;
ttyDisplay->curx = x;
}
/* See note at OVLx ifdef above. xputc() is a special function. */
void
xputc(c)
char c;
xputc(char c)
{
(void) putchar(c);
}
void
xputs(s)
const char *s;
xputs(const char *s)
{
# ifndef TERMLIB
(void) fputs(s, stdout);
@ -442,7 +435,7 @@ const char *s;
}
void
cl_end()
cl_end(void)
{
if(CE)
xputs(CE);
@ -462,7 +455,7 @@ cl_end()
void
clear_screen()
clear_screen(void)
{
/* note: if CL is null, then termcap initialization failed,
so don't attempt screen-oriented I/O during final cleanup.
@ -475,7 +468,7 @@ clear_screen()
void
home()
home(void)
{
if(HO)
xputs(HO);
@ -487,45 +480,45 @@ home()
}
void
standoutbeg()
standoutbeg(void)
{
if(SO) xputs(SO);
}
void
standoutend()
standoutend(void)
{
if(SE) xputs(SE);
}
#if 0 /* if you need one of these, uncomment it (here and in extern.h) */
void
revbeg()
revbeg(void)
{
if(MR) xputs(MR);
}
void
boldbeg()
boldbeg(void)
{
if(MD) xputs(MD);
}
void
blinkbeg()
blinkbeg(void)
{
if(MB) xputs(MB);
}
void
dimbeg()
dimbeg(void)
/* not in most termcap entries */
{
if(MH) xputs(MH);
}
void
m_end()
m_end(void)
{
if(ME) xputs(ME);
}
@ -533,13 +526,13 @@ m_end()
void
backsp()
backsp(void)
{
xputs(BC);
}
void
tty_nhbell()
tty_nhbell(void)
{
if (flags.silent) return;
(void) putchar('\007'); /* curx does not change */
@ -549,12 +542,12 @@ tty_nhbell()
#ifdef ASCIIGRAPH
void
graph_on() {
graph_on(void) {
if (AS) xputs(AS);
}
void
graph_off() {
graph_off(void) {
if (AE) xputs(AE);
}
#endif
@ -611,7 +604,7 @@ tty_delay_output(int delay)
void
cl_eos() /* free after Robert Viduya */
cl_eos(void) /* free after Robert Viduya */
{ /* must only be called with curx = 1 */
if(nh_CD)
@ -703,7 +696,7 @@ const struct {int ti_color, nh_color, nh_bright_color;} ti_map[6] =
};
static void
init_hilite()
init_hilite(void)
{
register int c;
char *setf, *scratch;
@ -803,7 +796,7 @@ init_hilite()
}
static void
kill_hilite()
kill_hilite(void)
{
/* if colors weren't usable, no freeing needed */
if (hilites[CLR_BLACK] == nh_HI)
@ -833,9 +826,7 @@ kill_hilite()
/* find the foreground and background colors set by nh_HI or nh_HE */
static void
analyze_seq (str, fg, bg)
char *str;
int *fg, *bg;
analyze_seq (char *str, int *fg, int *bg)
{
register int c, code;
int len;
@ -884,7 +875,7 @@ int *fg, *bg;
*/
static void
init_hilite()
init_hilite(void)
{
register int c;
@ -916,7 +907,7 @@ init_hilite()
}
static void
kill_hilite()
kill_hilite(void)
{
register int c;
@ -936,8 +927,7 @@ kill_hilite()
static char nulstr[] = "";
static char *
s_atr2str(n)
int n;
s_atr2str(int n)
{
switch (n) {
case ATR_ULINE:
@ -955,8 +945,7 @@ int n;
}
static char *
e_atr2str(n)
int n;
e_atr2str(int n)
{
switch (n) {
case ATR_ULINE:
@ -972,8 +961,7 @@ int n;
void
term_start_attr(attr)
int attr;
term_start_attr(int attr)
{
if (attr) {
xputs(s_atr2str(attr));
@ -982,8 +970,7 @@ int attr;
void
term_end_attr(attr)
int attr;
term_end_attr(int attr)
{
if(attr) {
xputs(e_atr2str(attr));
@ -992,14 +979,14 @@ int attr;
void
term_start_raw_bold()
term_start_raw_bold(void)
{
xputs(nh_HI);
}
void
term_end_raw_bold()
term_end_raw_bold(void)
{
xputs(nh_HE);
}
@ -1008,8 +995,7 @@ term_end_raw_bold()
#ifdef TEXTCOLOR
void
term_start_bgcolor(color)
int color;
term_start_bgcolor(int color)
{
if (allow_bgcolor) {
char tmp[8];
@ -1021,23 +1007,21 @@ int color;
}
void
term_end_color()
term_end_color(void)
{
xputs(nh_HE);
}
void
term_start_color(color)
int color;
term_start_color(int color)
{
xputs(hilites[color]);
}
int
has_color(color)
int color;
has_color(int color)
{
#ifdef CURSES_GRAPHICS
/* XXX has_color() should be added to windowprocs */

View file

@ -19,9 +19,8 @@ static void FDECL(topl_putsym, (glyph_t));
static void NDECL(remember_topl);
static void FDECL(removetopl, (int));
int
tty_doprev_message()
tty_doprev_message(void)
{
register struct WinDesc *cw = wins[WIN_MESSAGE];
@ -118,8 +117,7 @@ tty_doprev_message()
static void
redotoplin(str)
const char *str;
redotoplin(const char *str)
{
int otoplin = ttyDisplay->toplin;
home();
@ -138,7 +136,7 @@ redotoplin(str)
}
static void
remember_topl()
remember_topl(void)
{
register struct WinDesc *cw = wins[WIN_MESSAGE];
int idx = cw->maxrow;
@ -154,9 +152,7 @@ remember_topl()
cw->maxcol = cw->maxrow = (idx + 1) % cw->rows;
}
void
addtopl(s)
const char *s;
void addtopl(const char *s)
{
register struct WinDesc *cw = wins[WIN_MESSAGE];
@ -168,7 +164,7 @@ const char *s;
void
more()
more(void)
{
struct WinDesc *cw = wins[WIN_MESSAGE];
@ -208,8 +204,7 @@ more()
}
void
update_topl(bp)
register const char *bp;
update_topl(const char *bp)
{
register char *tl, *otl;
register int n0;
@ -257,8 +252,7 @@ update_topl(bp)
static
void
topl_putsym(c)
glyph_t c;
topl_putsym(glyph_t c)
{
register struct WinDesc *cw = wins[WIN_MESSAGE];
@ -289,16 +283,14 @@ topl_putsym(c)
}
void
putsyms(str)
const char *str;
putsyms(const char *str)
{
while(*str)
topl_putsym(*str++);
}
static void
removetopl(n)
register int n;
removetopl(int n)
{
/* assume addtopl() has been done, so ttyDisplay->toplin is already set */
while (n-- > 0) putsyms("\b \b");
@ -307,9 +299,7 @@ register int n;
extern char erase_char; /* from xxxtty.c; don't need kill_char */
char
tty_yn_function(query,resp, def)
const char *query,*resp;
char def;
tty_yn_function(const char *query, const char *resp, char def)
/*
* Generic yes/no function. 'def' is the default (returned by space or
* return; 'esc' returns 'q', or 'n', or the default, depending on

View file

@ -131,19 +131,19 @@ boolean HE_resets_AS; /* see termcap.c */
#endif
static void NDECL(getret);
static void FDECL(erase_menu_or_text, (winid, struct WinDesc *, BOOLEAN_P));
static void FDECL(free_window_info, (struct WinDesc *, BOOLEAN_P));
static void FDECL(erase_menu_or_text, (winid, struct WinDesc *, boolean));
static void FDECL(free_window_info, (struct WinDesc *, boolean));
static void FDECL(dmore,(struct WinDesc *, const char *));
static void FDECL(set_item_state, (winid, int, tty_menu_item *));
static void FDECL(set_all_on_page, (winid,tty_menu_item *,tty_menu_item *));
static void FDECL(unset_all_on_page, (winid,tty_menu_item *,tty_menu_item *));
static void FDECL(invert_all_on_page, (winid,tty_menu_item *,tty_menu_item *, CHAR_P));
static void FDECL(invert_all, (winid,tty_menu_item *,tty_menu_item *, CHAR_P));
static void FDECL(invert_all_on_page, (winid,tty_menu_item *,tty_menu_item *, char));
static void FDECL(invert_all, (winid,tty_menu_item *,tty_menu_item *, char));
static void FDECL(process_menu_window, (winid,struct WinDesc *));
static void FDECL(process_text_window, (winid,struct WinDesc *));
static tty_menu_item *FDECL(reverse, (tty_menu_item *));
const char * FDECL(compress_str, (const char *));
static void FDECL(tty_putsym, (winid, int, int, CHAR_P));
static void FDECL(tty_putsym, (winid, int, int, char));
static char *FDECL(copy_of, (const char *));
static void FDECL(bail, (const char *)); /* __attribute__((noreturn)) */
@ -178,8 +178,7 @@ static const char default_menu_cmds[] = {
int vt_tile_current_window = -2;
void
print_vt_code(i, c)
int i, c;
print_vt_code(int i, int c)
{
if (iflags.vt_nethack) {
if (c >= 0) {
@ -202,8 +201,7 @@ int i, c;
/* clean up and quit */
static void
bail(mesg)
const char *mesg;
bail(const char *mesg)
{
clearlocks();
tty_exit_nhwindows(mesg);
@ -213,7 +211,7 @@ const char *mesg;
#if defined(SIGWINCH) && defined(CLIPPING)
static void
winch()
winch(int sig)
{
int oldLI = LI, oldCO = CO, i;
register struct WinDesc *cw;
@ -269,9 +267,7 @@ winch()
/*ARGSUSED*/
void
tty_init_nhwindows(argcp,argv)
int* argcp;
char** argv;
tty_init_nhwindows(int *argcp, char **argv)
{
int wid, hgt;
@ -329,7 +325,7 @@ char** argv;
}
void
tty_player_selection()
tty_player_selection(void)
{
int i, k, n;
char pick4u = 'n', thisch, lastch = 0;
@ -792,7 +788,7 @@ give_up: /* Quit */
* Always called after init_nhwindows() and before display_gamewindows().
*/
void
tty_askname()
tty_askname(void)
{
static char who_are_you[] = "Who are you? ";
register int c, ct, tryct = 0;
@ -840,13 +836,13 @@ tty_askname()
}
void
tty_get_nh_event()
tty_get_nh_event(void)
{
return;
}
static void
getret()
getret(void)
{
xputs("\n");
if(flags.standout)
@ -860,15 +856,14 @@ getret()
}
void
tty_suspend_nhwindows(str)
const char *str;
tty_suspend_nhwindows(const char *str)
{
settty(str); /* calls end_screen, perhaps raw_print */
if (!str) tty_raw_print(""); /* calls fflush(stdout) */
}
void
tty_resume_nhwindows()
tty_resume_nhwindows(void)
{
gettty();
setftty(); /* calls start_screen */
@ -876,8 +871,7 @@ tty_resume_nhwindows()
}
void
tty_exit_nhwindows(str)
const char *str;
tty_exit_nhwindows(const char *str)
{
winid i;
@ -900,8 +894,7 @@ tty_exit_nhwindows(str)
}
winid
tty_create_nhwindow(type)
int type;
tty_create_nhwindow(int type)
{
struct WinDesc* newwin;
int i;
@ -1004,10 +997,7 @@ tty_create_nhwindow(type)
}
static void
erase_menu_or_text(window, cw, clear)
winid window;
struct WinDesc *cw;
boolean clear;
erase_menu_or_text(winid window, struct WinDesc *cw, boolean clear)
{
if(cw->offx == 0)
if(cw->offy) {
@ -1022,9 +1012,7 @@ erase_menu_or_text(window, cw, clear)
}
static void
free_window_info(cw, free_data)
struct WinDesc *cw;
boolean free_data;
free_window_info(struct WinDesc *cw, boolean free_data)
{
int i;
@ -1066,8 +1054,7 @@ free_window_info(cw, free_data)
}
void
tty_clear_nhwindow(window)
winid window;
tty_clear_nhwindow(winid window)
{
register struct WinDesc *cw = 0;
@ -1111,9 +1098,7 @@ tty_clear_nhwindow(window)
}
static void
dmore(cw, s)
register struct WinDesc *cw;
const char *s; /* valid responses */
dmore(struct WinDesc *cw, const char *s) /* s = valid responses */
{
const char *prompt = cw->morestr ? cw->morestr : defmorestr;
int offset = (cw->type == NHW_TEXT) ? 1 : 2;
@ -1131,10 +1116,7 @@ dmore(cw, s)
}
static void
set_item_state(window, lineno, item)
winid window;
int lineno;
tty_menu_item *item;
set_item_state(winid window, int lineno, tty_menu_item *item)
{
char ch = item->selected ? (item->count == -1L ? '+' : '#') : '-';
tty_curs(window, 4, lineno);
@ -1145,9 +1127,7 @@ set_item_state(window, lineno, item)
}
static void
set_all_on_page(window, page_start, page_end)
winid window;
tty_menu_item *page_start, *page_end;
set_all_on_page(winid window, tty_menu_item *page_start, tty_menu_item *page_end)
{
tty_menu_item *curr;
int n;
@ -1160,9 +1140,7 @@ set_all_on_page(window, page_start, page_end)
}
static void
unset_all_on_page(window, page_start, page_end)
winid window;
tty_menu_item *page_start, *page_end;
unset_all_on_page(winid window, tty_menu_item *page_start, tty_menu_item *page_end)
{
tty_menu_item *curr;
int n;
@ -1176,10 +1154,8 @@ unset_all_on_page(window, page_start, page_end)
}
static void
invert_all_on_page(window, page_start, page_end, acc)
winid window;
tty_menu_item *page_start, *page_end;
char acc; /* group accelerator, 0 => all */
invert_all_on_page(winid window, tty_menu_item *page_start, tty_menu_item *page_end, char acc)
/* acc = group accelerator, 0 => all */
{
tty_menu_item *curr;
int n;
@ -1200,10 +1176,8 @@ invert_all_on_page(window, page_start, page_end, acc)
* zero).
*/
static void
invert_all(window, page_start, page_end, acc)
winid window;
tty_menu_item *page_start, *page_end;
char acc; /* group accelerator, 0 => all */
invert_all(winid window, tty_menu_item *page_start, tty_menu_item *page_end, char acc)
/* acc = group accelerator, 0 => all */
{
tty_menu_item *curr;
boolean on_curr_page;
@ -1231,9 +1205,7 @@ invert_all(window, page_start, page_end, acc)
#ifdef MENU_COLOR
static boolean
get_menu_coloring(str, color, attr)
char *str;
int *color, *attr;
get_menu_coloring(char *str, int *color, int *attr)
{
struct menucoloring *tmpmc;
if (iflags.use_menu_color)
@ -1256,9 +1228,7 @@ int *color, *attr;
#endif /* MENU_COLOR */
static void
process_menu_window(window, cw)
winid window;
struct WinDesc *cw;
process_menu_window(winid window, struct WinDesc *cw)
{
tty_menu_item *page_start, *page_end, *curr;
long count;
@ -1598,9 +1568,7 @@ struct WinDesc *cw;
}
static void
process_text_window(window, cw)
winid window;
struct WinDesc *cw;
process_text_window(winid window, struct WinDesc *cw)
{
int i, n, attr;
register char *cp;
@ -1648,9 +1616,7 @@ struct WinDesc *cw;
/*ARGSUSED*/
void
tty_display_nhwindow(window, blocking)
winid window;
boolean blocking; /* with ttys, all windows are blocking */
tty_display_nhwindow(winid window, boolean blocking) /* with ttys, all windows are blocking */
{
register struct WinDesc *cw = 0;
@ -1726,8 +1692,7 @@ tty_display_nhwindow(window, blocking)
}
void
tty_dismiss_nhwindow(window)
winid window;
tty_dismiss_nhwindow(winid window)
{
register struct WinDesc *cw = 0;
@ -1771,8 +1736,7 @@ tty_dismiss_nhwindow(window)
}
void
tty_destroy_nhwindow(window)
winid window;
tty_destroy_nhwindow(winid window)
{
register struct WinDesc *cw = 0;
@ -1792,10 +1756,9 @@ tty_destroy_nhwindow(window)
}
void
tty_curs(window, x, y)
winid window;
register int x, y; /* not xchar: perhaps xchar is unsigned and
curx-x would be unsigned as well */
tty_curs(winid window, int x, int y)
/* not xchar: perhaps xchar is unsigned and
curx-x would be unsigned as well */
{
struct WinDesc *cw = 0;
int cx = ttyDisplay->curx;
@ -1867,10 +1830,7 @@ register int x, y; /* not xchar: perhaps xchar is unsigned and
}
static void
tty_putsym(window, x, y, ch)
winid window;
int x, y;
char ch;
tty_putsym(winid window, int x, int y, char ch)
{
register struct WinDesc *cw = 0;
@ -1906,8 +1866,7 @@ tty_putsym(window, x, y, ch)
const char*
compress_str(str)
const char *str;
compress_str(const char *str)
{
static char cbuf[BUFSZ];
/* compress in case line too long */
@ -1929,10 +1888,7 @@ const char *str;
}
void
tty_putstr(window, attr, str)
winid window;
int attr;
const char *str;
tty_putstr(winid window, int attr, const char *str)
{
register struct WinDesc *cw = 0;
register char *ob;
@ -2083,9 +2039,7 @@ tty_putstr(window, attr, str)
}
void
tty_display_file(fname, complain)
const char *fname;
boolean complain;
tty_display_file(const char *fname, boolean complain)
{
#ifdef DEF_PAGER /* this implies that UNIX is defined */
{
@ -2158,8 +2112,7 @@ boolean complain;
}
void
tty_start_menu(window)
winid window;
tty_start_menu(winid window)
{
tty_clear_nhwindow(window);
return;
@ -2171,15 +2124,15 @@ tty_start_menu(window)
* later.
*/
void
tty_add_menu(window, glyph, identifier, ch, gch, attr, str, preselected)
winid window; /* window to use, must be of type NHW_MENU */
int glyph; /* glyph to display with item */
const anything *identifier; /* what to return if selected */
char ch; /* keyboard accelerator (0 = pick our own) */
char gch; /* group accelerator (0 = no group) */
int attr; /* attribute for string (like tty_putstr()) */
const char *str; /* menu string */
boolean preselected; /* item is marked as selected */
tty_add_menu(
winid window, /* window to use, must be of type NHW_MENU */
int glyph, /* glyph to display with item */
const anything *identifier, /* what to return if selected */
char ch, /* keyboard accelerator (0 = pick our own) */
char gch, /* group accelerator (0 = no group) */
int attr, /* attribute for string (like tty_putstr()) */
const char *str, /* menu string */
boolean preselected) /* item is marked as selected */
{
register struct WinDesc *cw = 0;
tty_menu_item *item;
@ -2209,8 +2162,7 @@ tty_add_menu(window, glyph, identifier, ch, gch, attr, str, preselected)
/* Invert the given list, can handle NULL as an input. */
static tty_menu_item *
reverse(curr)
tty_menu_item *curr;
reverse(tty_menu_item *curr)
{
tty_menu_item *next, *head = 0;
@ -2228,11 +2180,12 @@ reverse(curr)
* processes the string list. We calculate the # of pages, then assign
* keyboard accelerators as needed. Finally we decide on the width and
* height of the window.
*
* window - menu to use
* prompt - prompt to for menu
*/
void
tty_end_menu(window, prompt)
winid window; /* menu to use */
const char *prompt; /* prompt to for menu */
tty_end_menu(winid window, const char *prompt)
{
struct WinDesc *cw = 0;
tty_menu_item *curr;
@ -2337,10 +2290,7 @@ tty_end_menu(window, prompt)
}
int
tty_select_menu(window, how, menu_list)
winid window;
int how;
menu_item **menu_list;
tty_select_menu(winid window, int how, menu_item **menu_list)
{
register struct WinDesc *cw = 0;
tty_menu_item *curr;
@ -2380,10 +2330,7 @@ tty_select_menu(window, how, menu_list)
/* special hack for treating top line --More-- as a one item menu */
char
tty_message_menu(let, how, mesg)
char let;
int how;
const char *mesg;
tty_message_menu(char let, int how, const char *mesg)
{
/* "menu" without selection; use ordinary pline, no more() */
if (how == PICK_NONE) {
@ -2412,19 +2359,19 @@ const char *mesg;
}
void
tty_update_inventory()
tty_update_inventory(void)
{
return;
}
void
tty_mark_synch()
tty_mark_synch(void)
{
(void) fflush(stdout);
}
void
tty_wait_synch()
tty_wait_synch(void)
{
/* we just need to make sure all windows are synch'd */
if(!ttyDisplay || ttyDisplay->rawprint) {
@ -2448,8 +2395,7 @@ tty_wait_synch()
}
void
docorner(xmin, ymax)
register int xmin, ymax;
docorner(int xmin, int ymax)
{
register int y;
register struct WinDesc *cw = wins[WIN_MAP];
@ -2480,7 +2426,7 @@ docorner(xmin, ymax)
}
void
end_glyphout()
end_glyphout(void)
{
#if defined(ASCIIGRAPH) && !defined(NO_TERMS)
if (GFlag) {
@ -2497,8 +2443,7 @@ end_glyphout()
}
void
g_putch(in_ch)
int in_ch;
g_putch(int in_ch)
{
register char ch = (char)in_ch;
@ -2530,7 +2475,7 @@ int in_ch;
#ifdef CLIPPING
void
setclipped()
setclipped(void)
{
clipping = TRUE;
clipx = clipy = 0;
@ -2539,8 +2484,7 @@ setclipped()
}
void
tty_cliparound(x, y)
int x, y;
tty_cliparound(int x, int y)
{
extern boolean restoring;
int oldx = clipx, oldy = clipy;
@ -2580,10 +2524,7 @@ int x, y;
*/
void
tty_print_glyph(window, x, y, glyph)
winid window;
xchar x, y;
int glyph;
tty_print_glyph(winid window, xchar x, xchar y, int glyph)
{
glyph_t ch;
boolean reverse_on = FALSE;
@ -2676,16 +2617,14 @@ tty_print_glyph(window, x, y, glyph)
}
void
tty_raw_print(str)
const char *str;
tty_raw_print(const char *str)
{
if(ttyDisplay) ttyDisplay->rawprint++;
puts(str); (void) fflush(stdout);
}
void
tty_raw_print_bold(str)
const char *str;
tty_raw_print_bold(const char *str)
{
if(ttyDisplay) ttyDisplay->rawprint++;
term_start_raw_bold();
@ -2696,7 +2635,7 @@ tty_raw_print_bold(str)
}
int
tty_nhgetch()
tty_nhgetch(void)
{
int i;
int tmp;
@ -2747,22 +2686,20 @@ tty_nhgetch()
*/
/*ARGSUSED*/
int
tty_nh_poskey(x, y, mod)
int *x, *y, *mod;
tty_nh_poskey(int *x, int *y, int *mod)
{
return tty_nhgetch();
}
void
win_tty_init()
win_tty_init(void)
{
return;
}
#ifdef POSITIONBAR
void
tty_update_positionbar(posbar)
char *posbar;
tty_update_positionbar(char *posbar)
{
}
#endif
@ -2774,8 +2711,7 @@ char *posbar;
* This is an exact duplicate of copy_of() in X11/winmenu.c.
*/
static char *
copy_of(s)
const char *s;
copy_of(const char *s)
{
if (!s) s = "";
return strcpy((char *) alloc((unsigned) (strlen(s) + 1)), s);