switch source tree from k&r to c99

This commit is contained in:
nhmall
2021-01-26 21:06:16 -05:00
parent a2a9cb7b4f
commit f963c5aca7
232 changed files with 12099 additions and 17782 deletions

View File

@@ -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]);