switch source tree from k&r to c99
This commit is contained in:
@@ -16,13 +16,12 @@
|
||||
|
||||
char morc = 0; /* tell the outside world what char you chose */
|
||||
static boolean suppress_history;
|
||||
static boolean FDECL(ext_cmd_getlin_hook, (char *));
|
||||
static boolean ext_cmd_getlin_hook(char *);
|
||||
|
||||
typedef boolean FDECL((*getlin_hook_proc), (char *));
|
||||
typedef boolean (*getlin_hook_proc)(char *);
|
||||
|
||||
static void FDECL(hooked_tty_getlin,
|
||||
(const char *, char *, getlin_hook_proc));
|
||||
extern int NDECL(extcmd_via_menu); /* cmd.c */
|
||||
static void hooked_tty_getlin(const char *, char *, getlin_hook_proc);
|
||||
extern int extcmd_via_menu(void); /* cmd.c */
|
||||
|
||||
extern char erase_char, kill_char; /* from appropriate tty.c file */
|
||||
|
||||
@@ -33,19 +32,14 @@ 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, register char *bufp)
|
||||
{
|
||||
suppress_history = FALSE;
|
||||
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, register char *bufp, getlin_hook_proc hook)
|
||||
{
|
||||
register char *obufp = bufp;
|
||||
register int c;
|
||||
@@ -210,8 +204,7 @@ getlin_hook_proc hook;
|
||||
}
|
||||
|
||||
void
|
||||
xwaitforspace(s)
|
||||
register const char *s; /* chars allowed besides return */
|
||||
xwaitforspace(register const char *s) /* chars allowed besides return */
|
||||
{
|
||||
register int c, x = ttyDisplay ? (int) ttyDisplay->dismiss_more : '\n';
|
||||
|
||||
@@ -253,8 +246,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;
|
||||
|
||||
@@ -284,7 +276,7 @@ char *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];
|
||||
|
||||
@@ -12,19 +12,19 @@
|
||||
|
||||
#define Tgetstr(key) (tgetstr(key, &tbufptr))
|
||||
|
||||
static char *FDECL(s_atr2str, (int));
|
||||
static char *FDECL(e_atr2str, (int));
|
||||
static char *s_atr2str(int);
|
||||
static char *e_atr2str(int);
|
||||
|
||||
void FDECL(cmov, (int, int));
|
||||
void FDECL(nocmov, (int, int));
|
||||
void cmov(int, int);
|
||||
void nocmov(int, int);
|
||||
#if defined(TEXTCOLOR) && defined(TERMLIB)
|
||||
#if (!defined(UNIX) || !defined(TERMINFO)) && !defined(TOS)
|
||||
static void FDECL(analyze_seq, (char *, int *, int *));
|
||||
static void analyze_seq(char *, int *, int *);
|
||||
#endif
|
||||
#endif
|
||||
#if defined(TEXTCOLOR) && (defined(TERMLIB) || defined(ANSI_DEFAULT))
|
||||
static void NDECL(init_hilite);
|
||||
static void NDECL(kill_hilite);
|
||||
static void init_hilite(void);
|
||||
static void kill_hilite(void);
|
||||
#endif
|
||||
|
||||
/* (see tcap.h) -- nh_CM, nh_ND, nh_CD, nh_HI,nh_HE, nh_US,nh_UE, ul_hack */
|
||||
@@ -66,8 +66,7 @@ static char tgotobuf[20];
|
||||
#endif /* TERMLIB */
|
||||
|
||||
void
|
||||
tty_startup(wid, hgt)
|
||||
int *wid, *hgt;
|
||||
tty_startup(int *wid, int *hgt)
|
||||
{
|
||||
#ifdef TERMLIB
|
||||
register const char *term;
|
||||
@@ -310,7 +309,7 @@ int *wid, *hgt;
|
||||
*/
|
||||
/* deallocate resources prior to final termination */
|
||||
void
|
||||
tty_shutdown()
|
||||
tty_shutdown(void)
|
||||
{
|
||||
/* we only attempt to clean up a few individual termcap variables */
|
||||
#if defined(TEXTCOLOR) && (defined(TERMLIB) || defined(ANSI_DEFAULT))
|
||||
@@ -327,8 +326,7 @@ tty_shutdown()
|
||||
}
|
||||
|
||||
void
|
||||
tty_number_pad(state)
|
||||
int state;
|
||||
tty_number_pad(int state)
|
||||
{
|
||||
switch (state) {
|
||||
case -1: /* activate keypad mode (escape sequences) */
|
||||
@@ -346,8 +344,8 @@ int state;
|
||||
}
|
||||
|
||||
#ifdef TERMLIB
|
||||
extern void NDECL((*decgraphics_mode_callback)); /* defined in symbols.c */
|
||||
static void NDECL(tty_decgraphics_termcap_fixup);
|
||||
extern void (*decgraphics_mode_callback)(void); /* defined in symbols.c */
|
||||
static void tty_decgraphics_termcap_fixup(void);
|
||||
|
||||
/*
|
||||
We call this routine whenever DECgraphics mode is enabled, even if it
|
||||
@@ -357,7 +355,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";
|
||||
@@ -419,15 +417,15 @@ tty_decgraphics_termcap_fixup()
|
||||
#endif /* TERMLIB */
|
||||
|
||||
#if defined(ASCIIGRAPH) && defined(PC9800)
|
||||
extern void NDECL((*ibmgraphics_mode_callback)); /* defined in drawing.c */
|
||||
extern void (*ibmgraphics_mode_callback)(void); /* defined in drawing.c */
|
||||
#endif
|
||||
|
||||
#ifdef PC9800
|
||||
extern void NDECL((*ascgraphics_mode_callback)); /* defined in drawing.c */
|
||||
static void NDECL(tty_ascgraphics_hilite_fixup);
|
||||
extern void (*ascgraphics_mode_callback)(void); /* defined in drawing.c */
|
||||
static void tty_ascgraphics_hilite_fixup(void);
|
||||
|
||||
static void
|
||||
tty_ascgraphics_hilite_fixup()
|
||||
tty_ascgraphics_hilite_fixup(void)
|
||||
{
|
||||
register int c;
|
||||
|
||||
@@ -444,7 +442,7 @@ tty_ascgraphics_hilite_fixup()
|
||||
#endif /* PC9800 */
|
||||
|
||||
void
|
||||
tty_start_screen()
|
||||
tty_start_screen(void)
|
||||
{
|
||||
xputs(TI);
|
||||
xputs(VS);
|
||||
@@ -472,7 +470,7 @@ tty_start_screen()
|
||||
}
|
||||
|
||||
void
|
||||
tty_end_screen()
|
||||
tty_end_screen(void)
|
||||
{
|
||||
clear_screen();
|
||||
xputs(VE);
|
||||
@@ -488,8 +486,7 @@ tty_end_screen()
|
||||
then action must be taken in trampoli.[ch]. */
|
||||
|
||||
void
|
||||
nocmov(x, y)
|
||||
int x, y;
|
||||
nocmov(int x, int y)
|
||||
{
|
||||
if ((int) ttyDisplay->cury > y) {
|
||||
if (UP) {
|
||||
@@ -538,8 +535,7 @@ int x, y;
|
||||
}
|
||||
|
||||
void
|
||||
cmov(x, y)
|
||||
register int x, y;
|
||||
cmov(register int x, register int y)
|
||||
{
|
||||
xputs(tgoto(nh_CM, x, y));
|
||||
ttyDisplay->cury = y;
|
||||
@@ -548,8 +544,7 @@ register int x, y;
|
||||
|
||||
/* See note above. xputc() is a special function for overlays. */
|
||||
int
|
||||
xputc(c)
|
||||
int c; /* actually char, but explicitly specify its widened type */
|
||||
xputc(int c) /* actually char, but explicitly specify its widened type */
|
||||
{
|
||||
/*
|
||||
* Note: xputc() as a direct all to putchar() doesn't make any
|
||||
@@ -570,8 +565,7 @@ int c; /* actually char, but explicitly specify its widened type */
|
||||
}
|
||||
|
||||
void
|
||||
xputs(s)
|
||||
const char *s;
|
||||
xputs(const char *s)
|
||||
{
|
||||
#ifndef TERMLIB
|
||||
(void) fputs(s, stdout);
|
||||
@@ -581,7 +575,7 @@ const char *s;
|
||||
}
|
||||
|
||||
void
|
||||
cl_end()
|
||||
cl_end(void)
|
||||
{
|
||||
if (CE) {
|
||||
xputs(CE);
|
||||
@@ -600,7 +594,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.
|
||||
@@ -612,7 +606,7 @@ clear_screen()
|
||||
}
|
||||
|
||||
void
|
||||
home()
|
||||
home(void)
|
||||
{
|
||||
if (HO)
|
||||
xputs(HO);
|
||||
@@ -624,14 +618,14 @@ home()
|
||||
}
|
||||
|
||||
void
|
||||
standoutbeg()
|
||||
standoutbeg(void)
|
||||
{
|
||||
if (SO)
|
||||
xputs(SO);
|
||||
}
|
||||
|
||||
void
|
||||
standoutend()
|
||||
standoutend(void)
|
||||
{
|
||||
if (SE)
|
||||
xputs(SE);
|
||||
@@ -639,28 +633,28 @@ standoutend()
|
||||
|
||||
#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)
|
||||
@@ -668,7 +662,7 @@ dimbeg()
|
||||
}
|
||||
|
||||
void
|
||||
m_end()
|
||||
m_end(void)
|
||||
{
|
||||
if (ME)
|
||||
xputs(ME);
|
||||
@@ -676,13 +670,13 @@ m_end()
|
||||
#endif /*0*/
|
||||
|
||||
void
|
||||
backsp()
|
||||
backsp(void)
|
||||
{
|
||||
xputs(BC);
|
||||
}
|
||||
|
||||
void
|
||||
tty_nhbell()
|
||||
tty_nhbell(void)
|
||||
{
|
||||
if (flags.silent)
|
||||
return;
|
||||
@@ -692,14 +686,14 @@ tty_nhbell()
|
||||
|
||||
#ifdef ASCIIGRAPH
|
||||
void
|
||||
graph_on()
|
||||
graph_on(void)
|
||||
{
|
||||
if (AS)
|
||||
xputs(AS);
|
||||
}
|
||||
|
||||
void
|
||||
graph_off()
|
||||
graph_off(void)
|
||||
{
|
||||
if (AE)
|
||||
xputs(AE);
|
||||
@@ -722,7 +716,7 @@ static const short tmspc10[] = { /* from termcap */
|
||||
|
||||
/* delay 50 ms */
|
||||
void
|
||||
tty_delay_output()
|
||||
tty_delay_output(void)
|
||||
{
|
||||
#if defined(MICRO)
|
||||
register int i;
|
||||
@@ -770,7 +764,7 @@ tty_delay_output()
|
||||
|
||||
/* must only be called with curx = 1 */
|
||||
void
|
||||
cl_eos() /* free after Robert Viduya */
|
||||
cl_eos(void) /* free after Robert Viduya */
|
||||
{
|
||||
if (nh_CD) {
|
||||
xputs(nh_CD);
|
||||
@@ -866,7 +860,7 @@ const struct {
|
||||
static char nilstring[] = "";
|
||||
|
||||
static void
|
||||
init_hilite()
|
||||
init_hilite(void)
|
||||
{
|
||||
register int c;
|
||||
char *setf, *scratch;
|
||||
@@ -941,7 +935,7 @@ init_hilite()
|
||||
}
|
||||
|
||||
static void
|
||||
kill_hilite()
|
||||
kill_hilite(void)
|
||||
{
|
||||
/* if colors weren't available, no freeing needed */
|
||||
if (hilites[CLR_BLACK] == nh_HI)
|
||||
@@ -988,9 +982,7 @@ kill_hilite()
|
||||
#ifndef TOS
|
||||
/* 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;
|
||||
@@ -1051,7 +1043,7 @@ int *fg, *bg;
|
||||
*/
|
||||
|
||||
static void
|
||||
init_hilite()
|
||||
init_hilite(void)
|
||||
{
|
||||
register int c;
|
||||
#ifdef TOS
|
||||
@@ -1133,7 +1125,7 @@ init_hilite()
|
||||
}
|
||||
|
||||
static void
|
||||
kill_hilite()
|
||||
kill_hilite(void)
|
||||
{
|
||||
#ifndef TOS
|
||||
register int c;
|
||||
@@ -1156,7 +1148,7 @@ kill_hilite()
|
||||
static char adef_nilstring[] = "";
|
||||
|
||||
static void
|
||||
init_hilite()
|
||||
init_hilite(void)
|
||||
{
|
||||
register int c;
|
||||
|
||||
@@ -1190,7 +1182,7 @@ init_hilite()
|
||||
}
|
||||
|
||||
static void
|
||||
kill_hilite()
|
||||
kill_hilite(void)
|
||||
{
|
||||
register int c;
|
||||
|
||||
@@ -1215,8 +1207,7 @@ kill_hilite()
|
||||
static char nulstr[] = "";
|
||||
|
||||
static char *
|
||||
s_atr2str(n)
|
||||
int n;
|
||||
s_atr2str(int n)
|
||||
{
|
||||
switch (n) {
|
||||
case ATR_BLINK:
|
||||
@@ -1248,8 +1239,7 @@ int n;
|
||||
}
|
||||
|
||||
static char *
|
||||
e_atr2str(n)
|
||||
int n;
|
||||
e_atr2str(int n)
|
||||
{
|
||||
switch (n) {
|
||||
case ATR_ULINE:
|
||||
@@ -1273,8 +1263,7 @@ int n;
|
||||
/* suppress nonfunctional highlights so render_status() might be able to
|
||||
optimize more; keep this in sync with s_atr2str() */
|
||||
int
|
||||
term_attr_fixup(msk)
|
||||
int msk;
|
||||
term_attr_fixup(int msk)
|
||||
{
|
||||
/* underline is converted to bold if its start sequence isn't available */
|
||||
if ((msk & HL_ULINE) && (!nh_US || !*nh_US)) {
|
||||
@@ -1294,8 +1283,7 @@ int msk;
|
||||
}
|
||||
|
||||
void
|
||||
term_start_attr(attr)
|
||||
int attr;
|
||||
term_start_attr(int attr)
|
||||
{
|
||||
if (attr) {
|
||||
const char *astr = s_atr2str(attr);
|
||||
@@ -1306,8 +1294,7 @@ int attr;
|
||||
}
|
||||
|
||||
void
|
||||
term_end_attr(attr)
|
||||
int attr;
|
||||
term_end_attr(int attr)
|
||||
{
|
||||
if (attr) {
|
||||
const char *astr = e_atr2str(attr);
|
||||
@@ -1318,13 +1305,13 @@ 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);
|
||||
}
|
||||
@@ -1332,14 +1319,13 @@ term_end_raw_bold()
|
||||
#ifdef TEXTCOLOR
|
||||
|
||||
void
|
||||
term_end_color()
|
||||
term_end_color(void)
|
||||
{
|
||||
xputs(nh_HE);
|
||||
}
|
||||
|
||||
void
|
||||
term_start_color(color)
|
||||
int color;
|
||||
term_start_color(int color)
|
||||
{
|
||||
if (color < CLR_MAX && hilites[color] && *hilites[color])
|
||||
xputs(hilites[color]);
|
||||
|
||||
@@ -14,14 +14,14 @@
|
||||
#define C(c) (0x1f & (c))
|
||||
#endif
|
||||
|
||||
static void FDECL(redotoplin, (const char *));
|
||||
static void FDECL(topl_putsym, (CHAR_P));
|
||||
static void FDECL(removetopl, (int));
|
||||
static void FDECL(msghistory_snapshot, (BOOLEAN_P));
|
||||
static void FDECL(free_msghistory_snapshot, (BOOLEAN_P));
|
||||
static void redotoplin(const char *);
|
||||
static void topl_putsym(char);
|
||||
static void removetopl(int);
|
||||
static void msghistory_snapshot(boolean);
|
||||
static void free_msghistory_snapshot(boolean);
|
||||
|
||||
int
|
||||
tty_doprev_message()
|
||||
tty_doprev_message(void)
|
||||
{
|
||||
register struct WinDesc *cw = wins[WIN_MESSAGE];
|
||||
winid prevmsg_win;
|
||||
@@ -123,8 +123,7 @@ tty_doprev_message()
|
||||
}
|
||||
|
||||
static void
|
||||
redotoplin(str)
|
||||
const char *str;
|
||||
redotoplin(const char *str)
|
||||
{
|
||||
int otoplin = ttyDisplay->toplin;
|
||||
|
||||
@@ -145,8 +144,7 @@ const char *str;
|
||||
|
||||
/* for use by tty_putstr() */
|
||||
void
|
||||
show_topl(str)
|
||||
const char *str;
|
||||
show_topl(const char *str)
|
||||
{
|
||||
struct WinDesc *cw = wins[WIN_MESSAGE];
|
||||
|
||||
@@ -166,7 +164,7 @@ const char *str;
|
||||
|
||||
/* used by update_topl(); also by tty_putstr() */
|
||||
void
|
||||
remember_topl()
|
||||
remember_topl(void)
|
||||
{
|
||||
register struct WinDesc *cw = wins[WIN_MESSAGE];
|
||||
int idx = cw->maxrow;
|
||||
@@ -188,8 +186,7 @@ remember_topl()
|
||||
}
|
||||
|
||||
void
|
||||
addtopl(s)
|
||||
const char *s;
|
||||
addtopl(const char *s)
|
||||
{
|
||||
register struct WinDesc *cw = wins[WIN_MESSAGE];
|
||||
|
||||
@@ -200,7 +197,7 @@ const char *s;
|
||||
}
|
||||
|
||||
void
|
||||
more()
|
||||
more(void)
|
||||
{
|
||||
struct WinDesc *cw = wins[WIN_MESSAGE];
|
||||
|
||||
@@ -244,8 +241,7 @@ more()
|
||||
}
|
||||
|
||||
void
|
||||
update_topl(bp)
|
||||
register const char *bp;
|
||||
update_topl(register const char *bp)
|
||||
{
|
||||
register char *tl, *otl;
|
||||
register int n0;
|
||||
@@ -297,10 +293,8 @@ register const char *bp;
|
||||
redotoplin(g.toplines);
|
||||
}
|
||||
|
||||
static
|
||||
void
|
||||
topl_putsym(c)
|
||||
char c;
|
||||
static void
|
||||
topl_putsym(char c)
|
||||
{
|
||||
register struct WinDesc *cw = wins[WIN_MESSAGE];
|
||||
|
||||
@@ -342,16 +336,14 @@ char c;
|
||||
}
|
||||
|
||||
void
|
||||
putsyms(str)
|
||||
const char *str;
|
||||
putsyms(const char *str)
|
||||
{
|
||||
while (*str)
|
||||
topl_putsym(*str++);
|
||||
}
|
||||
|
||||
static void
|
||||
removetopl(n)
|
||||
register int n;
|
||||
removetopl(register int n)
|
||||
{
|
||||
/* assume addtopl() has been done, so ttyDisplay->toplin is already set */
|
||||
while (n-- > 0)
|
||||
@@ -362,9 +354,7 @@ extern char erase_char; /* from xxxtty.c; don't need kill_char */
|
||||
|
||||
/* returns a single keystroke; also sets 'yn_number' */
|
||||
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
|
||||
@@ -550,8 +540,8 @@ static char **snapshot_mesgs = 0;
|
||||
/* collect currently available message history data into a sequential array;
|
||||
optionally, purge that data from the active circular buffer set as we go */
|
||||
static void
|
||||
msghistory_snapshot(purge)
|
||||
boolean purge; /* clear message history buffer as we copy it */
|
||||
msghistory_snapshot(boolean purge) /* clear message history buffer
|
||||
as we copy it */
|
||||
{
|
||||
char *mesg;
|
||||
int i, inidx, outidx;
|
||||
@@ -596,8 +586,8 @@ boolean purge; /* clear message history buffer as we copy it */
|
||||
|
||||
/* release memory allocated to message history snapshot */
|
||||
static void
|
||||
free_msghistory_snapshot(purged)
|
||||
boolean purged; /* True: took history's pointers, False: just cloned them */
|
||||
free_msghistory_snapshot(boolean purged) /* True: took history's pointers,
|
||||
False: just cloned them */
|
||||
{
|
||||
if (snapshot_mesgs) {
|
||||
/* snapshot pointers are no longer in use */
|
||||
@@ -627,8 +617,7 @@ boolean purged; /* True: took history's pointers, False: just cloned them */
|
||||
* included among the output of the subsequent calls.
|
||||
*/
|
||||
char *
|
||||
tty_getmsghistory(init)
|
||||
boolean init;
|
||||
tty_getmsghistory(boolean init)
|
||||
{
|
||||
static int nxtidx;
|
||||
char *nextmesg;
|
||||
@@ -668,9 +657,7 @@ boolean init;
|
||||
* into message history for ^P recall without having displayed it.
|
||||
*/
|
||||
void
|
||||
tty_putmsghistory(msg, restoring_msghist)
|
||||
const char *msg;
|
||||
boolean restoring_msghist;
|
||||
tty_putmsghistory(const char *msg, boolean restoring_msghist)
|
||||
{
|
||||
static boolean initd = FALSE;
|
||||
int idx;
|
||||
|
||||
388
win/tty/wintty.c
388
win/tty/wintty.c
@@ -144,8 +144,8 @@ winid BASE_WINDOW;
|
||||
struct WinDesc *wins[MAXWIN];
|
||||
struct DisplayDesc *ttyDisplay; /* the tty display descriptor */
|
||||
|
||||
extern void FDECL(cmov, (int, int)); /* from termcap.c */
|
||||
extern void FDECL(nocmov, (int, int)); /* from termcap.c */
|
||||
extern void cmov(int, int); /* from termcap.c */
|
||||
extern void nocmov(int, int); /* from termcap.c */
|
||||
#if defined(UNIX) || defined(VMS)
|
||||
static char obuf[BUFSIZ]; /* BUFSIZ is defined in stdio.h */
|
||||
#endif
|
||||
@@ -166,7 +166,7 @@ static int clipy = 0, clipymax = 0;
|
||||
#endif /* CLIPPING */
|
||||
|
||||
#if defined(USE_TILES) && defined(MSDOS)
|
||||
extern void FDECL(adjust_cursor_flags, (struct WinDesc *));
|
||||
extern void adjust_cursor_flags(struct WinDesc *);
|
||||
#endif
|
||||
|
||||
#if defined(ASCIIGRAPH) && !defined(NO_TERMS)
|
||||
@@ -178,47 +178,43 @@ boolean HE_resets_AS; /* see termcap.c */
|
||||
static const char to_continue[] = "to continue";
|
||||
#define getret() getreturn(to_continue)
|
||||
#else
|
||||
static void NDECL(getret);
|
||||
static void getret(void);
|
||||
#endif
|
||||
static void FDECL(bail, (const char *)); /* __attribute__((noreturn)) */
|
||||
static void NDECL(new_status_window);
|
||||
static void FDECL(erase_menu_or_text, (winid, struct WinDesc *,
|
||||
BOOLEAN_P));
|
||||
static void FDECL(free_window_info, (struct WinDesc *, BOOLEAN_P));
|
||||
static boolean FDECL(toggle_menu_curr, (winid, tty_menu_item *, int,
|
||||
BOOLEAN_P, BOOLEAN_P, long));
|
||||
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(toggle_menu_attr, (BOOLEAN_P, int, int));
|
||||
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 *));
|
||||
static const char *FDECL(compress_str, (const char *));
|
||||
static void FDECL(tty_putsym, (winid, int, int, CHAR_P));
|
||||
static void FDECL(setup_rolemenu, (winid, BOOLEAN_P, int, int, int));
|
||||
static void FDECL(setup_racemenu, (winid, BOOLEAN_P, int, int, int));
|
||||
static void FDECL(setup_gendmenu, (winid, BOOLEAN_P, int, int, int));
|
||||
static void FDECL(setup_algnmenu, (winid, BOOLEAN_P, int, int, int));
|
||||
static boolean NDECL(reset_role_filtering);
|
||||
static void bail(const char *); /* __attribute__((noreturn)) */
|
||||
static void new_status_window(void);
|
||||
static void erase_menu_or_text(winid, struct WinDesc *, boolean);
|
||||
static void free_window_info(struct WinDesc *, boolean);
|
||||
static boolean toggle_menu_curr(winid, tty_menu_item *, int, boolean,
|
||||
boolean, long);
|
||||
static void dmore(struct WinDesc *, const char *);
|
||||
static void set_item_state(winid, int, tty_menu_item *);
|
||||
static void set_all_on_page(winid, tty_menu_item *, tty_menu_item *);
|
||||
static void unset_all_on_page(winid, tty_menu_item *, tty_menu_item *);
|
||||
static void invert_all_on_page(winid, tty_menu_item *, tty_menu_item *,
|
||||
char);
|
||||
static void invert_all(winid, tty_menu_item *, tty_menu_item *, char);
|
||||
static void toggle_menu_attr(boolean, int, int);
|
||||
static void process_menu_window(winid, struct WinDesc *);
|
||||
static void process_text_window(winid, struct WinDesc *);
|
||||
static tty_menu_item *reverse(tty_menu_item *);
|
||||
static const char *compress_str(const char *);
|
||||
static void tty_putsym(winid, int, int, char);
|
||||
static void setup_rolemenu(winid, boolean, int, int, int);
|
||||
static void setup_racemenu(winid, boolean, int, int, int);
|
||||
static void setup_gendmenu(winid, boolean, int, int, int);
|
||||
static void setup_algnmenu(winid, boolean, int, int, int);
|
||||
static boolean reset_role_filtering(void);
|
||||
#ifdef STATUS_HILITES
|
||||
static boolean FDECL(check_fields, (BOOLEAN_P, int *));
|
||||
static void NDECL(render_status);
|
||||
static void FDECL(tty_putstatusfield, (const char *, int, int));
|
||||
static boolean NDECL(check_windowdata);
|
||||
static void NDECL(set_condition_length);
|
||||
static int FDECL(make_things_fit, (BOOLEAN_P));
|
||||
static void FDECL(shrink_enc, (int));
|
||||
static void FDECL(shrink_dlvl, (int));
|
||||
static boolean check_fields(boolean, int *);
|
||||
static void render_status(void);
|
||||
static void tty_putstatusfield(const char *, int, int);
|
||||
static boolean check_windowdata(void);
|
||||
static void set_condition_length(void);
|
||||
static int make_things_fit(boolean);
|
||||
static void shrink_enc(int);
|
||||
static void shrink_dlvl(int);
|
||||
#if (NH_DEVEL_STATUS != NH_STATUS_RELEASED)
|
||||
static void NDECL(status_sanity_check);
|
||||
static void status_sanity_check(void);
|
||||
#endif /* NH_DEVEL_STATUS */
|
||||
#endif
|
||||
|
||||
@@ -266,8 +262,7 @@ int i, c, d;
|
||||
|
||||
#ifdef TTY_SOUND_ESCCODES
|
||||
void
|
||||
print_vt_soundcode_idx(idx, v)
|
||||
int idx, v;
|
||||
print_vt_soundcode_idx(int idx, int v)
|
||||
{
|
||||
HUPSKIP();
|
||||
if (iflags.vt_sounddata) {
|
||||
@@ -285,8 +280,7 @@ int idx, v;
|
||||
|
||||
/* clean up and quit */
|
||||
static void
|
||||
bail(mesg)
|
||||
const char *mesg;
|
||||
bail(const char *mesg)
|
||||
{
|
||||
clearlocks();
|
||||
tty_exit_nhwindows(mesg);
|
||||
@@ -295,7 +289,7 @@ const char *mesg;
|
||||
}
|
||||
|
||||
#if defined(SIGWINCH) && defined(CLIPPING) && !defined(NO_SIGNAL)
|
||||
static void FDECL(winch_handler, (int));
|
||||
static void winch_handler(int);
|
||||
|
||||
/*
|
||||
* This really ought to just set a flag like the hangup handler does,
|
||||
@@ -306,10 +300,10 @@ static void FDECL(winch_handler, (int));
|
||||
*
|
||||
* 'winch_seen' has been "notyet" for a long time....
|
||||
*/
|
||||
/* signal handler is called with at least 1 arg */
|
||||
/*ARGUSED*/
|
||||
static void
|
||||
winch_handler(sig_unused) /* signal handler is called with at least 1 arg */
|
||||
int sig_unused UNUSED;
|
||||
winch_handler(int sig_unused UNUSED)
|
||||
{
|
||||
int oldLI = LI, oldCO = CO, i;
|
||||
register struct WinDesc *cw;
|
||||
@@ -374,7 +368,7 @@ int sig_unused UNUSED;
|
||||
/* destroy and recreate status window; extracted from winch_handler()
|
||||
and augmented for use by tty_preference_update() */
|
||||
static void
|
||||
new_status_window()
|
||||
new_status_window(void)
|
||||
{
|
||||
if (WIN_STATUS != WIN_ERR) {
|
||||
/* if it's shrinking, clear it before destroying so that
|
||||
@@ -408,9 +402,7 @@ new_status_window()
|
||||
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
tty_init_nhwindows(argcp, argv)
|
||||
int *argcp UNUSED;
|
||||
char **argv UNUSED;
|
||||
tty_init_nhwindows(int *argcp UNUSED, char **argv UNUSED)
|
||||
{
|
||||
int wid, hgt, i;
|
||||
|
||||
@@ -476,8 +468,7 @@ char **argv UNUSED;
|
||||
}
|
||||
|
||||
void
|
||||
tty_preference_update(pref)
|
||||
const char *pref;
|
||||
tty_preference_update(const char *pref)
|
||||
{
|
||||
if (!strcmp(pref, "statuslines") && iflags.window_inited) {
|
||||
new_status_window();
|
||||
@@ -498,7 +489,7 @@ const char *pref;
|
||||
#define ALGN flags.initalign
|
||||
|
||||
void
|
||||
tty_player_selection()
|
||||
tty_player_selection(void)
|
||||
{
|
||||
int i, k, n, choice, nextpick;
|
||||
boolean getconfirmation, picksomething;
|
||||
@@ -1047,7 +1038,7 @@ tty_player_selection()
|
||||
}
|
||||
|
||||
static boolean
|
||||
reset_role_filtering()
|
||||
reset_role_filtering(void)
|
||||
{
|
||||
winid win;
|
||||
anything any;
|
||||
@@ -1104,10 +1095,10 @@ reset_role_filtering()
|
||||
|
||||
/* add entries a-Archeologist, b-Barbarian, &c to menu being built in 'win' */
|
||||
static void
|
||||
setup_rolemenu(win, filtering, race, gend, algn)
|
||||
winid win;
|
||||
boolean filtering; /* True => exclude filtered roles; False => filter reset */
|
||||
int race, gend, algn; /* all ROLE_NONE for !filtering case */
|
||||
setup_rolemenu(winid win,
|
||||
boolean filtering, /* True => exclude filtered roles;
|
||||
False => filter reset */
|
||||
int race, int gend, int algn) /* all ROLE_NONE for !filtering case */
|
||||
{
|
||||
anything any;
|
||||
int i;
|
||||
@@ -1153,10 +1144,7 @@ int race, gend, algn; /* all ROLE_NONE for !filtering case */
|
||||
}
|
||||
|
||||
static void
|
||||
setup_racemenu(win, filtering, role, gend, algn)
|
||||
winid win;
|
||||
boolean filtering;
|
||||
int role, gend, algn;
|
||||
setup_racemenu(winid win, boolean filtering, int role, int gend, int algn)
|
||||
{
|
||||
anything any;
|
||||
boolean race_ok;
|
||||
@@ -1190,10 +1178,7 @@ int role, gend, algn;
|
||||
}
|
||||
|
||||
static void
|
||||
setup_gendmenu(win, filtering, role, race, algn)
|
||||
winid win;
|
||||
boolean filtering;
|
||||
int role, race, algn;
|
||||
setup_gendmenu(winid win, boolean filtering, int role, int race, int algn)
|
||||
{
|
||||
anything any;
|
||||
boolean gend_ok;
|
||||
@@ -1225,10 +1210,7 @@ int role, race, algn;
|
||||
}
|
||||
|
||||
static void
|
||||
setup_algnmenu(win, filtering, role, race, gend)
|
||||
winid win;
|
||||
boolean filtering;
|
||||
int role, race, gend;
|
||||
setup_algnmenu(winid win, boolean filtering, int role, int race, int gend)
|
||||
{
|
||||
anything any;
|
||||
boolean algn_ok;
|
||||
@@ -1266,7 +1248,7 @@ int role, race, gend;
|
||||
* Always called after init_nhwindows() and before display_gamewindows().
|
||||
*/
|
||||
void
|
||||
tty_askname()
|
||||
tty_askname(void)
|
||||
{
|
||||
static const char who_are_you[] = "Who are you? ";
|
||||
register int c, ct, tryct = 0;
|
||||
@@ -1372,14 +1354,14 @@ tty_askname()
|
||||
}
|
||||
|
||||
void
|
||||
tty_get_nh_event()
|
||||
tty_get_nh_event(void)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
#if !defined(MICRO) && !defined(WIN32CON)
|
||||
static void
|
||||
getret()
|
||||
getret(void)
|
||||
{
|
||||
HUPSKIP();
|
||||
xputs("\n");
|
||||
@@ -1395,8 +1377,7 @@ getret()
|
||||
#endif
|
||||
|
||||
void
|
||||
tty_suspend_nhwindows(str)
|
||||
const char *str;
|
||||
tty_suspend_nhwindows(const char *str)
|
||||
{
|
||||
settty(str); /* calls end_screen, perhaps raw_print */
|
||||
if (!str)
|
||||
@@ -1404,7 +1385,7 @@ const char *str;
|
||||
}
|
||||
|
||||
void
|
||||
tty_resume_nhwindows()
|
||||
tty_resume_nhwindows(void)
|
||||
{
|
||||
gettty();
|
||||
setftty(); /* calls start_screen */
|
||||
@@ -1412,8 +1393,7 @@ tty_resume_nhwindows()
|
||||
}
|
||||
|
||||
void
|
||||
tty_exit_nhwindows(str)
|
||||
const char *str;
|
||||
tty_exit_nhwindows(const char *str)
|
||||
{
|
||||
winid i;
|
||||
|
||||
@@ -1456,8 +1436,7 @@ const char *str;
|
||||
}
|
||||
|
||||
winid
|
||||
tty_create_nhwindow(type)
|
||||
int type;
|
||||
tty_create_nhwindow(int type)
|
||||
{
|
||||
struct WinDesc *newwin;
|
||||
int i, rowoffset;
|
||||
@@ -1571,10 +1550,7 @@ int 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) {
|
||||
@@ -1591,9 +1567,7 @@ boolean 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;
|
||||
|
||||
@@ -1639,8 +1613,7 @@ boolean free_data;
|
||||
}
|
||||
|
||||
void
|
||||
tty_clear_nhwindow(window)
|
||||
winid window;
|
||||
tty_clear_nhwindow(winid window)
|
||||
{
|
||||
int i, j, m, n;
|
||||
register struct WinDesc *cw = 0;
|
||||
@@ -1695,12 +1668,8 @@ winid window;
|
||||
}
|
||||
|
||||
static boolean
|
||||
toggle_menu_curr(window, curr, lineno, in_view, counting, count)
|
||||
winid window;
|
||||
tty_menu_item *curr;
|
||||
int lineno;
|
||||
boolean in_view, counting;
|
||||
long count;
|
||||
toggle_menu_curr(winid window, tty_menu_item *curr, int lineno,
|
||||
boolean in_view, boolean counting, long count)
|
||||
{
|
||||
if (curr->selected) {
|
||||
if (counting && count > 0) {
|
||||
@@ -1734,9 +1703,8 @@ long count;
|
||||
}
|
||||
|
||||
static void
|
||||
dmore(cw, s)
|
||||
register struct WinDesc *cw;
|
||||
const char *s; /* valid responses */
|
||||
dmore(register struct WinDesc *cw,
|
||||
const char *s) /* valid responses */
|
||||
{
|
||||
const char *prompt = cw->morestr ? cw->morestr : defmorestr;
|
||||
int offset = (cw->type == NHW_TEXT) ? 1 : 2;
|
||||
@@ -1755,10 +1723,7 @@ const char *s; /* valid responses */
|
||||
}
|
||||
|
||||
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 ? '+' : '#') : '-';
|
||||
|
||||
@@ -1771,9 +1736,8 @@ tty_menu_item *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;
|
||||
@@ -1786,9 +1750,8 @@ tty_menu_item *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;
|
||||
@@ -1802,10 +1765,9 @@ tty_menu_item *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) /* group accelerator, 0 => all */
|
||||
{
|
||||
tty_menu_item *curr;
|
||||
int n;
|
||||
@@ -1829,10 +1791,9 @@ char acc; /* group accelerator, 0 => all */
|
||||
* Invert all entries that match the give group accelerator (or all if 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) /* group accelerator, 0 => all */
|
||||
{
|
||||
tty_menu_item *curr;
|
||||
boolean on_curr_page;
|
||||
@@ -1862,9 +1823,7 @@ char acc; /* group accelerator, 0 => all */
|
||||
|
||||
/* support menucolor in addition to caller-supplied attribute */
|
||||
static void
|
||||
toggle_menu_attr(on, color, attr)
|
||||
boolean on;
|
||||
int color, attr;
|
||||
toggle_menu_attr(boolean on, int color, int attr)
|
||||
{
|
||||
if (on) {
|
||||
term_start_attr(attr);
|
||||
@@ -1886,9 +1845,7 @@ int color, attr;
|
||||
}
|
||||
|
||||
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;
|
||||
@@ -2262,9 +2219,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;
|
||||
boolean linestart;
|
||||
@@ -2341,9 +2296,8 @@ 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;
|
||||
short s_maxcol;
|
||||
@@ -2437,8 +2391,7 @@ boolean blocking; /* with ttys, all windows are blocking */
|
||||
}
|
||||
|
||||
void
|
||||
tty_dismiss_nhwindow(window)
|
||||
winid window;
|
||||
tty_dismiss_nhwindow(winid window)
|
||||
{
|
||||
register struct WinDesc *cw = 0;
|
||||
|
||||
@@ -2484,8 +2437,7 @@ winid window;
|
||||
}
|
||||
|
||||
void
|
||||
tty_destroy_nhwindow(window)
|
||||
winid window;
|
||||
tty_destroy_nhwindow(winid window)
|
||||
{
|
||||
register struct WinDesc *cw = 0;
|
||||
|
||||
@@ -2505,10 +2457,10 @@ winid 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,
|
||||
register int x, register int y) /* not xchar: perhaps xchar is
|
||||
unsigned and curx-x would be
|
||||
unsigned as well */
|
||||
{
|
||||
struct WinDesc *cw = 0;
|
||||
int cx = ttyDisplay->curx;
|
||||
@@ -2606,10 +2558,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;
|
||||
|
||||
@@ -2639,8 +2588,7 @@ char ch;
|
||||
}
|
||||
|
||||
static const char *
|
||||
compress_str(str)
|
||||
const char *str;
|
||||
compress_str(const char *str)
|
||||
{
|
||||
static char cbuf[BUFSZ];
|
||||
|
||||
@@ -2670,10 +2618,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;
|
||||
@@ -2843,9 +2788,7 @@ const char *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 */
|
||||
{
|
||||
@@ -2937,9 +2880,7 @@ boolean complain;
|
||||
}
|
||||
|
||||
void
|
||||
tty_start_menu(window, mbehavior)
|
||||
winid window;
|
||||
unsigned long mbehavior;
|
||||
tty_start_menu(winid window, unsigned long mbehavior)
|
||||
{
|
||||
wins[window]->mbehavior = mbehavior;
|
||||
tty_clear_nhwindow(window);
|
||||
@@ -2952,15 +2893,15 @@ unsigned long mbehavior;
|
||||
* later.
|
||||
*/
|
||||
void
|
||||
tty_add_menu(window, glyphinfo, identifier, ch, gch, attr, str, itemflags)
|
||||
winid window; /* window to use, must be of type NHW_MENU */
|
||||
const glyph_info *glyphinfo UNUSED; /* glyph info w/glyph to display w/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 */
|
||||
unsigned int itemflags; /* itemflags such as MENU_ITEMFLAGS_SELECTED */
|
||||
tty_add_menu(winid window, /* window to use, must be of type NHW_MENU */
|
||||
const glyph_info *glyphinfo UNUSED, /* glyph info with 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 */
|
||||
unsigned int itemflags) /* itemflags such as MENU_ITEMFLAGS_SELECTED */
|
||||
{
|
||||
boolean preselected = ((itemflags & MENU_ITEMFLAGS_SELECTED) != 0);
|
||||
register struct WinDesc *cw = 0;
|
||||
@@ -3009,8 +2950,7 @@ unsigned int itemflags; /* itemflags such as MENU_ITEMFLAGS_SELECTED */
|
||||
|
||||
/* 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;
|
||||
|
||||
@@ -3030,9 +2970,8 @@ tty_menu_item *curr;
|
||||
* height of the window.
|
||||
*/
|
||||
void
|
||||
tty_end_menu(window, prompt)
|
||||
winid window; /* menu to use */
|
||||
const char *prompt; /* prompt to for menu */
|
||||
tty_end_menu(winid window, /* menu to use */
|
||||
const char *prompt) /* prompt to for menu */
|
||||
{
|
||||
struct WinDesc *cw = 0;
|
||||
tty_menu_item *curr;
|
||||
@@ -3141,10 +3080,7 @@ const char *prompt; /* prompt to for menu */
|
||||
}
|
||||
|
||||
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;
|
||||
@@ -3185,10 +3121,7 @@ menu_item **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)
|
||||
{
|
||||
HUPSKIP();
|
||||
/* "menu" without selection; use ordinary pline, no more() */
|
||||
@@ -3219,20 +3152,20 @@ const char *mesg;
|
||||
}
|
||||
|
||||
void
|
||||
tty_update_inventory()
|
||||
tty_update_inventory(void)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
tty_mark_synch()
|
||||
tty_mark_synch(void)
|
||||
{
|
||||
HUPSKIP();
|
||||
(void) fflush(stdout);
|
||||
}
|
||||
|
||||
void
|
||||
tty_wait_synch()
|
||||
tty_wait_synch(void)
|
||||
{
|
||||
HUPSKIP();
|
||||
/* we just need to make sure all windows are synch'd */
|
||||
@@ -3258,8 +3191,7 @@ tty_wait_synch()
|
||||
}
|
||||
|
||||
void
|
||||
docorner(xmin, ymax)
|
||||
register int xmin, ymax;
|
||||
docorner(register int xmin, register int ymax)
|
||||
{
|
||||
register int y;
|
||||
register struct WinDesc *cw = wins[WIN_MAP];
|
||||
@@ -3311,7 +3243,7 @@ register int xmin, ymax;
|
||||
}
|
||||
|
||||
void
|
||||
end_glyphout()
|
||||
end_glyphout(void)
|
||||
{
|
||||
HUPSKIP();
|
||||
#if defined(ASCIIGRAPH) && !defined(NO_TERMS)
|
||||
@@ -3330,8 +3262,7 @@ end_glyphout()
|
||||
|
||||
#ifndef WIN32
|
||||
void
|
||||
g_putch(in_ch)
|
||||
int in_ch;
|
||||
g_putch(int in_ch)
|
||||
{
|
||||
register char ch = (char) in_ch;
|
||||
|
||||
@@ -3370,7 +3301,7 @@ int in_ch;
|
||||
|
||||
#ifdef CLIPPING
|
||||
void
|
||||
setclipped()
|
||||
setclipped(void)
|
||||
{
|
||||
clipping = TRUE;
|
||||
clipx = clipy = 0;
|
||||
@@ -3379,8 +3310,7 @@ setclipped()
|
||||
}
|
||||
|
||||
void
|
||||
tty_cliparound(x, y)
|
||||
int x, y;
|
||||
tty_cliparound(int x, int y)
|
||||
{
|
||||
int oldx = clipx, oldy = clipy;
|
||||
|
||||
@@ -3417,15 +3347,13 @@ int x, y;
|
||||
*/
|
||||
|
||||
void
|
||||
tty_print_glyph(window, x, y, glyphinfo, bkglyphinfo)
|
||||
winid window;
|
||||
xchar x, y;
|
||||
tty_print_glyph(winid window, xchar x, xchar y,
|
||||
#if defined(TTY_TILES_ESCCODES) || defined(MSDOS)
|
||||
const glyph_info *glyphinfo;
|
||||
const glyph_info *glyphinfo,
|
||||
#else
|
||||
const glyph_info *glyphinfo UNUSED;
|
||||
const glyph_info *glyphinfo UNUSED,
|
||||
#endif
|
||||
const glyph_info *bkglyphinfo UNUSED;
|
||||
const glyph_info *bkglyphinfo UNUSED)
|
||||
{
|
||||
boolean inverse_on = FALSE;
|
||||
int ch, color;
|
||||
@@ -3519,8 +3447,7 @@ const glyph_info *bkglyphinfo UNUSED;
|
||||
}
|
||||
|
||||
void
|
||||
tty_raw_print(str)
|
||||
const char *str;
|
||||
tty_raw_print(const char *str)
|
||||
{
|
||||
HUPSKIP();
|
||||
if (ttyDisplay)
|
||||
@@ -3535,8 +3462,7 @@ const char *str;
|
||||
}
|
||||
|
||||
void
|
||||
tty_raw_print_bold(str)
|
||||
const char *str;
|
||||
tty_raw_print_bold(const char *str)
|
||||
{
|
||||
HUPSKIP();
|
||||
if (ttyDisplay)
|
||||
@@ -3558,7 +3484,7 @@ const char *str;
|
||||
}
|
||||
|
||||
int
|
||||
tty_nhgetch()
|
||||
tty_nhgetch(void)
|
||||
{
|
||||
int i;
|
||||
#ifdef UNIX
|
||||
@@ -3620,11 +3546,10 @@ tty_nhgetch()
|
||||
*/
|
||||
/*ARGSUSED*/
|
||||
int
|
||||
tty_nh_poskey(x, y, mod)
|
||||
#if defined(WIN32CON)
|
||||
int *x, *y, *mod;
|
||||
tty_nh_poskey(int *x, int *y, int *mod)
|
||||
#else
|
||||
int *x UNUSED, *y UNUSED, *mod UNUSED;
|
||||
tty_nh_poskey(int *x UNUSED, int *y UNUSED, int *mod UNUSED)
|
||||
#endif
|
||||
{
|
||||
int i;
|
||||
@@ -3652,8 +3577,7 @@ int *x UNUSED, *y UNUSED, *mod UNUSED;
|
||||
}
|
||||
|
||||
void
|
||||
win_tty_init(dir)
|
||||
int dir;
|
||||
win_tty_init(int dir)
|
||||
{
|
||||
if (dir != WININIT)
|
||||
return;
|
||||
@@ -3662,8 +3586,7 @@ int dir;
|
||||
|
||||
#ifdef POSITIONBAR
|
||||
void
|
||||
tty_update_positionbar(posbar)
|
||||
char *posbar;
|
||||
tty_update_positionbar(char *posbar)
|
||||
{
|
||||
#ifdef MSDOS
|
||||
video_update_positionbar(posbar);
|
||||
@@ -3737,9 +3660,9 @@ extern winid WIN_STATUS;
|
||||
|
||||
#ifdef STATUS_HILITES
|
||||
#ifdef TEXTCOLOR
|
||||
static int FDECL(condcolor, (long, unsigned long *));
|
||||
static int condcolor(long, unsigned long *);
|
||||
#endif
|
||||
static int FDECL(condattr, (long, unsigned long *));
|
||||
static int condattr(long, unsigned long *);
|
||||
static unsigned long *tty_colormasks;
|
||||
static long tty_condition_bits;
|
||||
static struct tty_status_fields tty_status[2][MAXBLSTATS]; /* 2: NOW,BEFORE */
|
||||
@@ -3809,7 +3732,7 @@ static int do_field_opt =
|
||||
* -- call genl_status_init() to initialize the general data.
|
||||
*/
|
||||
void
|
||||
tty_status_init()
|
||||
tty_status_init(void)
|
||||
{
|
||||
#ifdef STATUS_HILITES
|
||||
int i, num_rows;
|
||||
@@ -3837,11 +3760,8 @@ tty_status_init()
|
||||
}
|
||||
|
||||
void
|
||||
tty_status_enablefield(fieldidx, nm, fmt, enable)
|
||||
int fieldidx;
|
||||
const char *nm;
|
||||
const char *fmt;
|
||||
boolean enable;
|
||||
tty_status_enablefield(int fieldidx, const char *nm, const char *fmt,
|
||||
boolean enable)
|
||||
{
|
||||
genl_status_enablefield(fieldidx, nm, fmt, enable);
|
||||
}
|
||||
@@ -3924,10 +3844,8 @@ boolean enable;
|
||||
*/
|
||||
|
||||
void
|
||||
tty_status_update(fldidx, ptr, chg, percent, color, colormasks)
|
||||
int fldidx, chg UNUSED, percent, color;
|
||||
genericptr_t ptr;
|
||||
unsigned long *colormasks;
|
||||
tty_status_update(int fldidx, genericptr_t ptr, int chg UNUSED, int percent,
|
||||
int color, unsigned long *colormasks)
|
||||
{
|
||||
int attrmask;
|
||||
long *condptr = (long *) ptr;
|
||||
@@ -4047,8 +3965,7 @@ unsigned long *colormasks;
|
||||
}
|
||||
|
||||
static int
|
||||
make_things_fit(force_update)
|
||||
boolean force_update;
|
||||
make_things_fit(boolean force_update)
|
||||
{
|
||||
int trycnt, fitting = 0, requirement;
|
||||
int rowsz[3], num_rows, condrow, otheroptions = 0;
|
||||
@@ -4111,9 +4028,7 @@ boolean force_update;
|
||||
* This is now done at an individual field case-by-case level.
|
||||
*/
|
||||
static boolean
|
||||
check_fields(forcefields, sz)
|
||||
boolean forcefields;
|
||||
int sz[3];
|
||||
check_fields(boolean forcefields, int sz[3])
|
||||
{
|
||||
int c, i, row, col, num_rows, idx;
|
||||
boolean valid = TRUE, matchprev, update_right;
|
||||
@@ -4214,7 +4129,7 @@ int sz[3];
|
||||
|
||||
#if (NH_DEVEL_STATUS != NH_STATUS_RELEASED)
|
||||
static void
|
||||
status_sanity_check(VOID_ARGS)
|
||||
status_sanity_check(void)
|
||||
{
|
||||
int i;
|
||||
static boolean in_sanity_check = FALSE;
|
||||
@@ -4262,9 +4177,7 @@ status_sanity_check(VOID_ARGS)
|
||||
* This is what places a field on the tty display.
|
||||
*/
|
||||
static void
|
||||
tty_putstatusfield(text, x, y)
|
||||
const char *text;
|
||||
int x, y;
|
||||
tty_putstatusfield(const char *text, int x, int y)
|
||||
{
|
||||
int i, n, ncols, nrows, lth = 0;
|
||||
struct WinDesc *cw = 0;
|
||||
@@ -4305,7 +4218,7 @@ int x, y;
|
||||
|
||||
/* caller must set cond_shrinklvl (0..2) before calling us */
|
||||
static void
|
||||
set_condition_length()
|
||||
set_condition_length(void)
|
||||
{
|
||||
long mask;
|
||||
int c, lth = 0;
|
||||
@@ -4321,8 +4234,7 @@ set_condition_length()
|
||||
}
|
||||
|
||||
static void
|
||||
shrink_enc(lvl)
|
||||
int lvl;
|
||||
shrink_enc(int lvl)
|
||||
{
|
||||
/* shrink or restore the encumbrance word */
|
||||
if (lvl <= 2) {
|
||||
@@ -4333,8 +4245,7 @@ int lvl;
|
||||
}
|
||||
|
||||
static void
|
||||
shrink_dlvl(lvl)
|
||||
int lvl;
|
||||
shrink_dlvl(int lvl)
|
||||
{
|
||||
/* try changing Dlvl: to Dl: */
|
||||
char buf[BUFSZ];
|
||||
@@ -4354,7 +4265,7 @@ int lvl;
|
||||
* blank and null-terminated.
|
||||
*/
|
||||
static boolean
|
||||
check_windowdata(VOID_ARGS)
|
||||
check_windowdata(void)
|
||||
{
|
||||
if (WIN_STATUS == WIN_ERR || wins[WIN_STATUS] == (struct WinDesc *) 0) {
|
||||
paniclog("check_windowdata", " null status window.");
|
||||
@@ -4372,9 +4283,7 @@ check_windowdata(VOID_ARGS)
|
||||
* be displayed in based on user settings.
|
||||
*/
|
||||
static int
|
||||
condcolor(bm, bmarray)
|
||||
long bm;
|
||||
unsigned long *bmarray;
|
||||
condcolor(long bm, unsigned long *bmarray)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -4394,9 +4303,7 @@ unsigned long *bmarray;
|
||||
#endif /* TEXTCOLOR */
|
||||
|
||||
static int
|
||||
condattr(bm, bmarray)
|
||||
long bm;
|
||||
unsigned long *bmarray;
|
||||
condattr(long bm, unsigned long *bmarray)
|
||||
{
|
||||
int attr = 0;
|
||||
int i;
|
||||
@@ -4460,7 +4367,7 @@ unsigned long *bmarray;
|
||||
} while (0)
|
||||
|
||||
static void
|
||||
render_status(VOID_ARGS)
|
||||
render_status(void)
|
||||
{
|
||||
long mask, bits;
|
||||
int i, x, y, idx, c, ci, row, tlth, num_rows, coloridx = 0, attrmask = 0;
|
||||
@@ -4685,8 +4592,7 @@ render_status(VOID_ARGS)
|
||||
|
||||
#if defined(USER_SOUNDS) && defined(TTY_SOUND_ESCCODES)
|
||||
void
|
||||
play_usersound_via_idx(idx, volume)
|
||||
int idx, volume;
|
||||
play_usersound_via_idx(int idx, int volume)
|
||||
{
|
||||
print_vt_soundcode_idx(idx, volume);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user