Spacing; some more appropriate integer types; spelling. After Bill Gray.

This commit is contained in:
William McBrine
2017-12-11 10:49:03 -05:00
parent 756377a1d1
commit 9fc059fedc
21 changed files with 94 additions and 89 deletions

View File

@@ -20,7 +20,9 @@ short color_table[] =
int main(int argc, char **argv)
{
int i, start, end, row, diff, flag, direction, seed;
time_t seed;
int start, end, row, diff, flag, direction;
short i;
#ifdef XCURSES
Xinitscr(argc, argv);
@@ -39,7 +41,7 @@ int main(int argc, char **argv)
seed = time((time_t *)0);
srand(seed);
flag = 0;
while (getch() == ERR) /* loop until a key is hit */
{
do {

View File

@@ -212,7 +212,8 @@ int main(int argc, char **argv)
{
WINDOW *win;
chtype save[80], ch;
int width, height, w, x, y, i, j, seed;
time_t seed;
int width, height, w, x, y, i, j;
#ifdef XCURSES
Xinitscr(argc, argv);
@@ -220,7 +221,7 @@ int main(int argc, char **argv)
initscr();
#endif
seed = time((time_t *)0);
srand(seed);
srand(seed);
start_color();
# if defined(NCURSES_VERSION) || (defined(PDC_BUILD) && PDC_BUILD > 3000)
@@ -236,7 +237,7 @@ int main(int argc, char **argv)
#endif
noecho();
/* refresh stdscr so that reading from it will not cause it to
/* refresh stdscr so that reading from it will not cause it to
overwrite the other windows that are being created */
refresh();
@@ -265,7 +266,7 @@ int main(int argc, char **argv)
wattrset(win, COLOR_PAIR(2));
box(win, ' ', ' ');
wrefresh(win);
wattrset(win, 0);
/* Do random output of a character */

View File

@@ -55,7 +55,8 @@ static int next_j(int j)
int main(int argc, char *argv[])
{
int x, y, j, r, c, seed;
time_t seed;
int x, y, j, r, c;
static int xpos[5], ypos[5];
#ifdef XCURSES
@@ -64,11 +65,11 @@ int main(int argc, char *argv[])
initscr();
#endif
seed = time((time_t *)0);
srand(seed);
srand(seed);
if (has_colors())
{
int bg = COLOR_BLACK;
short bg = COLOR_BLACK;
start_color();

View File

@@ -63,7 +63,7 @@ static bool incurses = FALSE;
#ifndef PDCURSES
static char wordchar(void)
{
return 0x17; /* ^W */
return 0x17; /* ^W */
}
#endif
@@ -108,13 +108,13 @@ static void initcolor(void)
/* foreground, background */
init_pair(TITLECOLOR & ~A_ATTR, COLOR_BLACK, COLOR_CYAN);
init_pair(MAINMENUCOLOR & ~A_ATTR, COLOR_WHITE, COLOR_CYAN);
init_pair(TITLECOLOR & ~A_ATTR, COLOR_BLACK, COLOR_CYAN);
init_pair(MAINMENUCOLOR & ~A_ATTR, COLOR_WHITE, COLOR_CYAN);
init_pair(MAINMENUREVCOLOR & ~A_ATTR, COLOR_WHITE, COLOR_BLACK);
init_pair(SUBMENUCOLOR & ~A_ATTR, COLOR_WHITE, COLOR_CYAN);
init_pair(SUBMENUREVCOLOR & ~A_ATTR, COLOR_WHITE, COLOR_BLACK);
init_pair(BODYCOLOR & ~A_ATTR, COLOR_WHITE, COLOR_BLUE);
init_pair(STATUSCOLOR & ~A_ATTR, COLOR_WHITE, COLOR_CYAN);
init_pair(SUBMENUCOLOR & ~A_ATTR, COLOR_WHITE, COLOR_CYAN);
init_pair(SUBMENUREVCOLOR & ~A_ATTR, COLOR_WHITE, COLOR_BLACK);
init_pair(BODYCOLOR & ~A_ATTR, COLOR_WHITE, COLOR_BLUE);
init_pair(STATUSCOLOR & ~A_ATTR, COLOR_WHITE, COLOR_CYAN);
init_pair(INPUTBOXCOLOR & ~A_ATTR, COLOR_BLACK, COLOR_CYAN);
init_pair(EDITBOXCOLOR & ~A_ATTR, COLOR_WHITE, COLOR_BLACK);
#endif
@@ -150,7 +150,7 @@ static void colorbox(WINDOW *win, chtype color, int hasbox)
#endif
wbkgd(win, attr);
werase(win);
werase(win);
#ifdef PDCURSES
maxy = getmaxy(win);
@@ -179,14 +179,14 @@ static void idle(void)
tp->tm_hour, tp->tm_min, tp->tm_sec);
mvwaddstr(wtitl, 0, bw - strlen(buf) - 2, buf);
wrefresh(wtitl);
wrefresh(wtitl);
}
static void menudim(menu *mp, int *lines, int *columns)
{
int n, l, mmax = 0;
for (n=0; mp->func; n++, mp++)
for (n = 0; mp->func; n++, mp++)
if ((l = strlen(mp->name)) > mmax) mmax = l;
*lines = n;
@@ -262,7 +262,7 @@ static void mainmenu(menu *mp)
{
if (old != -1)
{
mvwaddstr(wmain, 0, old * barlen,
mvwaddstr(wmain, 0, old * barlen,
prepad(padstr(mp[old].name, barlen - 1), 1));
statusmsg(mp[cur].desc);
@@ -272,7 +272,7 @@ static void mainmenu(menu *mp)
setcolor(wmain, MAINMENUREVCOLOR);
mvwaddstr(wmain, 0, cur * barlen,
mvwaddstr(wmain, 0, cur * barlen,
prepad(padstr(mp[cur].name, barlen - 1), 1));
setcolor(wmain, MAINMENUCOLOR);
@@ -470,7 +470,7 @@ void domenu(menu *mp)
if (cur != old)
{
if (old != -1)
mvwaddstr(wmenu, old + 1, 1,
mvwaddstr(wmenu, old + 1, 1,
prepad(padstr(mp[old].name, barlen - 1), 1));
setcolor(wmenu, SUBMENUREVCOLOR);
@@ -594,7 +594,7 @@ static void repainteditbox(WINDOW *win, int x, char *buf)
werase(win);
mvwprintw(win, 0, 0, "%s", padstr(buf, maxx));
wmove(win, 0, x);
wrefresh(win);
wrefresh(win);
}
/*
@@ -603,8 +603,8 @@ static void repainteditbox(WINDOW *win, int x, char *buf)
Description:
The initial value of 'str' with a maximum length of 'field' - 1,
which is supplied by the calling routine, is editted. The user's
erase (^H), kill (^U) and delete word (^W) chars are interpreted.
which is supplied by the calling routine, is editted. The user's
erase (^H), kill (^U) and delete word (^W) chars are interpreted.
The PC insert or Tab keys toggle between insert and edit mode.
Escape aborts the edit session, leaving 'str' unchanged.
Enter, Up or Down Arrow are used to accept the changes to 'str'.
@@ -624,7 +624,8 @@ int weditstr(WINDOW *win, char *buf, int field)
{
char org[MAXSTRLEN], *tp, *bp = buf;
bool defdisp = TRUE, stop = FALSE, insert = FALSE;
int cury, curx, begy, begx, oldattr;
int cury, curx, begy, begx;
chtype oldattr;
WINDOW *wedit;
int c = 0;
@@ -705,9 +706,9 @@ int weditstr(WINDOW *win, char *buf, int field)
{
tp = bp;
while ((bp > buf) && (*(bp - 1) == ' '))
while ((bp > buf) && (*(bp - 1) == ' '))
bp--;
while ((bp > buf) && (*(bp - 1) != ' '))
while ((bp > buf) && (*(bp - 1) != ' '))
bp--;
memmove((void *)bp, (const void *)tp, strlen(tp) + 1);
@@ -737,7 +738,7 @@ int weditstr(WINDOW *win, char *buf, int field)
if (!*bp)
bp[1] = '\0';
*bp++ = c;
}
}
@@ -782,7 +783,7 @@ int getstrings(char *desc[], char *buf[], int field)
getyx(wbody, oldy, oldx);
getmaxyx(wbody, maxy, maxx);
winput = mvwinputbox(wbody, (maxy - nlines) / 2, (maxx - ncols) / 2,
winput = mvwinputbox(wbody, (maxy - nlines) / 2, (maxx - ncols) / 2,
nlines, ncols);
for (i = 0; i < n; i++)

View File

@@ -29,7 +29,7 @@
void address(void)
{
char *fieldname[6] =
char *fieldname[6] =
{
"Name", "Street", "City", "State", "Country", (char *)0
};

View File

@@ -154,7 +154,8 @@ int main(int argc, char *argv[])
const struct options *op;
struct worm *w;
short **ref, *ip;
int x, y, n, h, last, bottom, seed;
time_t seed;
int x, y, n, h, last, bottom;
for (x = 1; x < argc; x++)
{
@@ -222,7 +223,7 @@ int main(int argc, char *argv[])
#ifdef A_COLOR
if (has_colors())
{
int bg = COLOR_BLACK;
short bg = COLOR_BLACK;
start_color();
# if defined(NCURSES_VERSION) || (defined(PDC_BUILD) && PDC_BUILD > 3000)

View File

@@ -70,7 +70,7 @@ void PDC_gotoyx(int row, int col)
PDCINT(0x10, regs);
}
/* update the given physical line to look like the corresponding line in
/* update the given physical line to look like the corresponding line in
curscr */
void PDC_transform_line(int lineno, int x, int len, const chtype *srcp)

View File

@@ -121,7 +121,7 @@ typedef union
struct
{
unsigned short di, di_hi, si, si_hi, bp, bp_hi, res, res_hi,
bx, bx_hi, dx, dx_hi, cx, cx_hi, ax, ax_hi,
bx, bx_hi, dx, dx_hi, cx, cx_hi, ax, ax_hi,
flags, es, ds, fs, gs, ip, cs, sp, ss;
} w;

View File

@@ -82,10 +82,10 @@ static int _get_font(void)
return retval;
}
/* _set_font() - Sets the current font size, if the adapter allows such a
change. It is an error to attempt to change the font size on a
"bogus" adapter. The reason for this is that we have a known video
adapter identity problem. e.g. Two adapters report the same identifying
/* _set_font() - Sets the current font size, if the adapter allows such a
change. It is an error to attempt to change the font size on a
"bogus" adapter. The reason for this is that we have a known video
adapter identity problem. e.g. Two adapters report the same identifying
characteristics. */
static void _set_font(int size)
@@ -152,7 +152,7 @@ static void _set_font(int size)
pdc_font = _get_font();
}
/* _set_80x25() - force a known screen state: 80x25 text mode. Forces the
/* _set_80x25() - force a known screen state: 80x25 text mode. Forces the
appropriate 80x25 alpha mode given the display adapter. */
static void _set_80x25(void)
@@ -191,7 +191,7 @@ static int _get_scrn_mode(void)
return (int)regs.h.al;
}
/* _set_scrn_mode() - Sets the BIOS Video Mode Number only if it is
/* _set_scrn_mode() - Sets the BIOS Video Mode Number only if it is
different from the current video mode. */
static void _set_scrn_mode(int new_mode)
@@ -211,7 +211,7 @@ static void _set_scrn_mode(int new_mode)
COLS = PDC_get_columns();
}
/* _sanity_check() - A video adapter identification sanity check. This
/* _sanity_check() - A video adapter identification sanity check. This
routine will force sane values for various control flags. */
static int _sanity_check(int adapter)
@@ -228,7 +228,7 @@ static int _sanity_check(int adapter)
switch (rows)
{
case 25:
case 43:
case 43:
break;
default:
pdc_bogus_adapter = TRUE;
@@ -443,7 +443,7 @@ static int _query_adapter_type(void)
return _sanity_check(retval);
}
/* close the physical screen -- may restore the screen to its state
/* close the physical screen -- may restore the screen to its state
before PDC_scr_open(); miscellaneous cleanup */
void PDC_scr_close(void)
@@ -501,7 +501,7 @@ void PDC_scr_free(void)
pdc_atrtab = (unsigned char *)NULL;
}
/* open the physical screen -- allocate SP, miscellaneous intialization,
/* open the physical screen -- allocate SP, miscellaneous intialization,
and may save the existing screen for later restoration */
int PDC_scr_open(int argc, char **argv)
@@ -541,7 +541,7 @@ int PDC_scr_open(int argc, char **argv)
SP->mouse_wait = PDC_CLICK_PERIOD;
SP->audible = TRUE;
/* If the environment variable PDCURSES_BIOS is set, the DOS int10()
/* If the environment variable PDCURSES_BIOS is set, the DOS int10()
BIOS calls are used in place of direct video memory access. */
if (getenv("PDCURSES_BIOS"))
@@ -594,7 +594,7 @@ int PDC_resize_screen(int nlines, int ncols)
PDC_LOG(("PDC_resize_screen() - called. Lines: %d Cols: %d\n",
nlines, ncols));
/* Trash the stored value of orig_cursor -- it's only good if the
/* Trash the stored value of orig_cursor -- it's only good if the
video mode doesn't change */
SP->orig_cursor = 0x0607;

View File

@@ -258,9 +258,9 @@ static bool _screen_mode_equals(VIOMODEINFO *oldmode)
return ((current.cb == oldmode->cb) &&
(current.fbType == oldmode->fbType) &&
(current.color == oldmode->color) &&
(current.color == oldmode->color) &&
(current.col == oldmode->col) &&
(current.row == oldmode->row) &&
(current.row == oldmode->row) &&
(current.hres == oldmode->vres) &&
(current.vres == oldmode->vres));
}

View File

@@ -128,7 +128,7 @@ int wattron(WINDOW *win, chtype attrs)
if (!win)
return ERR;
if ((win->_attrs & A_COLOR) && (attrs & A_COLOR))
if ((win->_attrs & A_COLOR) && (attrs & A_COLOR))
{
oldcolr = win->_attrs & A_COLOR;
oldattr = win->_attrs ^ oldcolr;

View File

@@ -148,8 +148,8 @@ int init_pair(short pair, short fg, short bg)
_normalize(&fg, &bg);
/* To allow the PDC_PRESERVE_SCREEN option to work, we only reset
curscr if this call to init_pair() alters a color pair created by
/* To allow the PDC_PRESERVE_SCREEN option to work, we only reset
curscr if this call to init_pair() alters a color pair created by
the user. */
if (pair_set[pair])
@@ -199,7 +199,7 @@ int color_content(short color, short *red, short *green, short *blue)
return PDC_color_content(color, red, green, blue);
else
{
/* Simulated values for platforms that don't support palette
/* Simulated values for platforms that don't support palette
changing */
short maxval = (color & 8) ? 1000 : 680;
@@ -280,8 +280,7 @@ int PDC_set_line_color(short color)
void PDC_init_atrtab(void)
{
int i;
short fg, bg;
short i, fg, bg;
if (pdc_color_started && !default_colors)
{

View File

@@ -176,7 +176,7 @@ int wgetch(WINDOW *win)
else
if (win->_delayms)
{
/* Can't really do millisecond intervals, so delay in
/* Can't really do millisecond intervals, so delay in
1/20ths of a second (50ms) */
waitcount = win->_delayms / 50;
@@ -184,7 +184,7 @@ int wgetch(WINDOW *win)
waitcount = 1;
}
/* refresh window when wgetch is called if there have been changes
/* refresh window when wgetch is called if there have been changes
to it and it is not a pad */
if (!(win->_flags & _PAD) && ((!win->_leaveit &&
@@ -243,7 +243,7 @@ int wgetch(WINDOW *win)
if (!win->_use_keypad)
key = -1;
/* filter mouse events; translate mouse clicks in the slk
/* filter mouse events; translate mouse clicks in the slk
area to function keys */
else if (key == KEY_MOUSE)

View File

@@ -134,7 +134,7 @@ int wgetnstr(WINDOW *win, char *str, int n)
case _ECHAR: /* CTRL-H -- Delete character */
if (p > str)
{
if (oldecho)
if (oldecho)
waddstr(win, "\b \b");
ch = (unsigned char)(*--p);
if ((ch < ' ') && (oldecho))
@@ -146,7 +146,7 @@ int wgetnstr(WINDOW *win, char *str, int n)
case _DLCHAR: /* CTRL-U -- Delete line */
while (p > str)
{
if (oldecho)
if (oldecho)
waddstr(win, "\b \b");
ch = (unsigned char)(*--p);
if ((ch < ' ') && (oldecho))
@@ -159,7 +159,7 @@ int wgetnstr(WINDOW *win, char *str, int n)
while ((p > str) && (*(p - 1) == ' '))
{
if (oldecho)
if (oldecho)
waddstr(win, "\b \b");
--p; /* remove space */
@@ -167,7 +167,7 @@ int wgetnstr(WINDOW *win, char *str, int n)
}
while ((p > str) && (*(p - 1) != ' '))
{
if (oldecho)
if (oldecho)
waddstr(win, "\b \b");
ch = (unsigned char)(*--p);
@@ -180,7 +180,7 @@ int wgetnstr(WINDOW *win, char *str, int n)
case '\n':
case '\r':
stop = TRUE;
if (oldecho)
if (oldecho)
waddch(win, '\n');
break;
@@ -190,7 +190,7 @@ int wgetnstr(WINDOW *win, char *str, int n)
if (!SP->key_code && ch < 0x100)
{
*p++ = ch;
if (oldecho)
if (oldecho)
waddch(win, ch);
chars++;
}
@@ -318,7 +318,7 @@ int wgetn_wstr(WINDOW *win, wint_t *wstr, int n)
{
if (chars < n)
{
if (oldecho)
if (oldecho)
waddch(win, ch);
*p++ = ch;
++chars;
@@ -331,7 +331,7 @@ int wgetn_wstr(WINDOW *win, wint_t *wstr, int n)
case _ECHAR: /* CTRL-H -- Delete character */
if (p > wstr)
{
if (oldecho)
if (oldecho)
waddstr(win, "\b \b");
ch = *--p;
if ((ch < ' ') && (oldecho))
@@ -343,7 +343,7 @@ int wgetn_wstr(WINDOW *win, wint_t *wstr, int n)
case _DLCHAR: /* CTRL-U -- Delete line */
while (p > wstr)
{
if (oldecho)
if (oldecho)
waddstr(win, "\b \b");
ch = *--p;
if ((ch < ' ') && (oldecho))
@@ -356,7 +356,7 @@ int wgetn_wstr(WINDOW *win, wint_t *wstr, int n)
while ((p > wstr) && (*(p - 1) == ' '))
{
if (oldecho)
if (oldecho)
waddstr(win, "\b \b");
--p; /* remove space */
@@ -364,7 +364,7 @@ int wgetn_wstr(WINDOW *win, wint_t *wstr, int n)
}
while ((p > wstr) && (*(p - 1) != ' '))
{
if (oldecho)
if (oldecho)
waddstr(win, "\b \b");
ch = *--p;
@@ -396,7 +396,7 @@ int wgetn_wstr(WINDOW *win, wint_t *wstr, int n)
beep();
break;
}
wrefresh(win);

View File

@@ -172,7 +172,7 @@ WINDOW *Xinitscr(int argc, char *argv[])
PDC_slk_initialize();
LINES -= SP->slklines;
/* We have to sort out ripped off lines here, and reduce the height
/* We have to sort out ripped off lines here, and reduce the height
of stdscr by the number of lines ripped off */
for (i = 0; i < linesrippedoff; i++)
@@ -250,7 +250,7 @@ int endwin(void)
bool isendwin(void)
{
PDC_LOG(("isendwin() - called\n"));
return SP ? !(SP->alive) : FALSE;
}

View File

@@ -196,7 +196,7 @@ int curs_set(int visibility)
ret_vis = PDC_curs_set(visibility);
/* If the cursor is changing from invisible to visible, update
/* If the cursor is changing from invisible to visible, update
its position */
if (visibility && !ret_vis)

View File

@@ -307,7 +307,7 @@ mmask_t mousemask(mmask_t mask, mmask_t *oldmask)
if (oldmask)
*oldmask = SP->_trap_mbe;
/* The ncurses interface doesn't work with our move events, so
/* The ncurses interface doesn't work with our move events, so
filter them here */
mask &= ~(BUTTON1_MOVED | BUTTON2_MOVED | BUTTON3_MOVED);

View File

@@ -46,7 +46,7 @@ overlay
**man-end****************************************************************/
/* Thanks to Andreas Otte <venn@@uni-paderborn.de> for the
/* Thanks to Andreas Otte <venn@@uni-paderborn.de> for the
corrected overlay()/overwrite() behavior. */
static int _copy_win(const WINDOW *src_w, WINDOW *dst_w, int src_tr,
@@ -88,7 +88,7 @@ static int _copy_win(const WINDOW *src_w, WINDOW *dst_w, int src_tr,
if (fc == _NO_CHANGE)
fc = col + dst_tc;
lc = col + dst_tc;
}
@@ -131,7 +131,7 @@ int _copy_overlap(const WINDOW *src_w, WINDOW *dst_w, bool overlay)
last_col = min(src_w->_begx + src_w->_maxx, dst_w->_begx + dst_w->_maxx);
last_line = min(src_w->_begy + src_w->_maxy, dst_w->_begy + dst_w->_maxy);
/* determine the overlapping region of the two windows in real
/* determine the overlapping region of the two windows in real
coordinates */
/* if no overlapping region, do nothing */

View File

@@ -37,7 +37,7 @@ Building
for convenience; both panel and curses functions are in the main
library.
You can also give the optional parameter "WIDE=Y", to build the
You can also give the optional parameter "WIDE=Y", to build the
library with wide-character (Unicode) support:
make -f mingwin32.mak WIDE=Y

View File

@@ -18,7 +18,7 @@ clipboard
PDC_getclipboard() gets the textual contents of the system's
clipboard. This function returns the contents of the clipboard
in the contents argument. It is the responsibilitiy of the
in the contents argument. It is the responsibility of the
caller to free the memory returned, via PDC_freeclipboard().
The length of the clipboard contents is returned in the length
argument.

View File

@@ -28,8 +28,8 @@ static short curstoreal[16], realtocurs[16] =
enum { PDC_RESTORE_NONE, PDC_RESTORE_BUFFER };
/* Struct for storing console registry keys, and for use with the
undocumented WM_SETCONSOLEINFO message. Originally by James Brown,
/* Struct for storing console registry keys, and for use with the
undocumented WM_SETCONSOLEINFO message. Originally by James Brown,
www.catch22.net. */
static struct
@@ -50,13 +50,13 @@ static struct
ULONG QuickEdit;
ULONG AutoPosition;
ULONG InsertMode;
USHORT ScreenColors;
USHORT PopupColors;
ULONG HistoryNoDup;
ULONG HistoryBufferSize;
ULONG NumberOfHistoryBuffers;
COLORREF ColorTable[16];
ULONG CodePage;
@@ -121,8 +121,8 @@ static HWND _find_console_handle(void)
#define WM_SETCONSOLEINFO (WM_USER + 201)
/* Wrapper around WM_SETCONSOLEINFO. We need to create the necessary
section (file-mapping) object in the context of the process which
/* Wrapper around WM_SETCONSOLEINFO. We need to create the necessary
section (file-mapping) object in the context of the process which
owns the console, before posting the message. Originally by JB. */
static void _set_console_info(void)
@@ -151,7 +151,7 @@ static void _set_console_info(void)
/* Open the process which "owns" the console */
GetWindowThreadProcessId(console_info.Hwnd, &dwConsoleOwnerPid);
hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, dwConsoleOwnerPid);
/* Create a SECTION object backed by page-file, then map a view of
@@ -222,7 +222,7 @@ static void _init_console_info(void)
console_info.AutoPosition = 0x10000;
console_info.ScreenColors = SP->orig_back << 4 | SP->orig_fore;
console_info.PopupColors = 0xf5;
console_info.HistoryNoDup = FALSE;
console_info.HistoryBufferSize = 50;
console_info.NumberOfHistoryBuffers = 4;
@@ -469,8 +469,8 @@ int PDC_scr_open(int argc, char **argv)
return OK;
}
/* Calls SetConsoleWindowInfo with the given parameters, but fits them
if a scoll bar shrinks the maximum possible value. The rectangle
/* Calls SetConsoleWindowInfo with the given parameters, but fits them
if a scoll bar shrinks the maximum possible value. The rectangle
must at least fit in a half-sized window. */
static BOOL _fit_console_window(HANDLE con_out, CONST SMALL_RECT *rect)