v04i109: Additional patches for PC Curses
Steve Creps
creps at silver.bacs.indiana.edu
Sat Oct 1 09:21:30 AEST 1988
Posting-number: Volume 4, Issue 109
Submitted-by: "Steve Creps" <creps at silver.bacs.indiana.edu>
Archive-name: pc-curses/Patch02
About a month ago I posted to this group some unofficial patches to
get the PC Curses package to work properly under MSC 4.0. That article
included some new C code written by me to replace the buggy original
MASM code. Since then it has come to my attention that there was still
a bug in _curseskeytst(). I found that it was always returning zero, so
I fixed it and tested it to make sure it now works. I felt energetic, so
then I decided to run the whole thing through lint (msc /W3), and made
some more changes until lint didn't have anything at all to complain
about. The results are in the following patch file. If you are missing
any of the previous PC Curses postings, the following are available at
a comp.sources.misc archive site (i.e. uunet.uu.net) via anonymous ftp:
- PC Curses source code (which I didn't post myself)
- PC Curses documentation (ditto)
- PC Curses (unofficial) patch 1 (my posting of last month)
- PC Curses (unofficial) patch 2 (this posting)
The files are in the comp.sources.misc directory. The file names are
(or at least were) rather cryptic (coded by date of submission), so you
should probably grab the file called LOGFILE first.
- - - - - - - - - -
Steve Creps, Indiana University, Bloomington, home of the "Hoosiers"
creps at silver.bacs.indiana.edu (192.12.206.2)
{inuxc,rutgers,pyramid,pur-ee}!iuvax!silver!creps
creps at iubacs.bitnet (forwarded)
#! /bin/sh
# This is a shell archive. Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file". To overwrite existing
# files, type "sh file -c". You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g.. If this archive is complete, you
# will see the following message at the end:
# "End of archive 1 (of 1)."
# Contents: patch2.dif
# Wrapped by creps at silver on Mon Sep 26 19:10:21 1988
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'patch2.dif' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'patch2.dif'\"
else
echo shar: Extracting \"'patch2.dif'\" \(14084 characters\)
sed "s/^X//" >'patch2.dif' <<'END_OF_FILE'
X*** old\makefile
X--- makefile
X**************
X*** 15,21
X LIBDIR= \usr\lib
X INCDIR= \usr\include
X MODEL= H
X! CFLAGS= /Ox /A$(MODEL)
X
X # General definitions:
X
X--- 15,21 -----
X LIBDIR= \usr\lib
X INCDIR= \usr\include
X MODEL= H
X! CFLAGS= /Ox /A$(MODEL) /W3
X
X # General definitions:
X
X*** old\charget.c
X--- charget.c
X**************
X*** 16,22
X
X /* NDP 1/88 Moved undef from just sysgetch() to here so it covers
X flushinp(). This caused raw() call to crash */
X! #undef getch /* we use MSC getch() below */
X
X static int rawgetch(); /* get raw char via BIOS */
X static int sysgetch(); /* get char via system */
X--- 16,24 -----
X
X /* NDP 1/88 Moved undef from just sysgetch() to here so it covers
X flushinp(). This caused raw() call to crash */
X! #undef getch /* we use MSC getch() below */
X! #undef ungetch /* make /W3 happy */
X! #include <conio.h>
X
X static int rawgetch(); /* get raw char via BIOS */
X static int sysgetch(); /* get char via system */
X**************
X*** 108,114
X while(_curseskeytst()) /* empty keyboard buffer */
X _curseskey();
X while(kbhit()) /* empty system's buffers */
X! getch();
X gindex = 1; /* set indices to kill buffer */
X pindex = 0;
X ungind = 0; /* clear ungch array */
X--- 110,116 -----
X while(_curseskeytst()) /* empty keyboard buffer */
X _curseskey();
X while(kbhit()) /* empty system's buffers */
X! (void)getch();
X gindex = 1; /* set indices to kill buffer */
X pindex = 0;
X ungind = 0; /* clear ungch array */
X**************
X*** 115,121
X } /* flushinp */
X
X /****************************************************************/
X! /* Wungetch() pushes back it's argument on the input stream. If */
X /* OK, returns 1, otherwise returns 0. */
X /****************************************************************/
X
X--- 117,123 -----
X } /* flushinp */
X
X /****************************************************************/
X! /* Wungetch() pushes back its argument on the input stream. If */
X /* OK, returns 1, otherwise returns 0. */
X /****************************************************************/
X
X**************
X*** 138,144
X int x;
X {
X wmove(stdscr,y,x);
X! wgetch(stdscr);
X } /* mvgetch */
X
X /****************************************************************/
X--- 140,146 -----
X int x;
X {
X wmove(stdscr,y,x);
X! return wgetch(stdscr);
X } /* mvgetch */
X
X /****************************************************************/
X**************
X*** 152,158
X int x;
X {
X wmove(win,y,x);
X! wgetch(win);
X } /* mvwgetch */
X
X /****************************************************************/
X--- 154,160 -----
X int x;
X {
X wmove(win,y,x);
X! return wgetch(win);
X } /* mvwgetch */
X
X /****************************************************************/
X**************
X*** 244,249
X if (pindex > gindex) /* buffered char */
X return(TRUE);
X if (_cursvar.raw) /* raw mode test */
X! return(_curseskeytst());
X! return(kbhit()); /* normal mode test */
X } /* _cursespendch */
X--- 246,251 -----
X if (pindex > gindex) /* buffered char */
X return(TRUE);
X if (_cursvar.raw) /* raw mode test */
X! return((bool)_curseskeytst());
X! return((bool)kbhit()); /* normal mode test */
X } /* _cursespendch */
X*** old\charins.c
X--- charins.c
X**************
X*** 53,59
X int insch(c)
X char c;
X {
X! winsch(stdscr,c);
X } /* insch */
X
X /****************************************************************/
X--- 53,59 -----
X int insch(c)
X char c;
X {
X! return winsch(stdscr,c);
X } /* insch */
X
X /****************************************************************/
X*** old\cursesio.c
X--- cursesio.c
X**************
X*** 105,111
X {
X regs.h.ah = 0x01;
X int86(0x16, ®s, ®s);
X! return (regs.x.cflag & 0x40) ? 1 : 0;
X }
X
X int
X--- 105,111 -----
X {
X regs.h.ah = 0x01;
X int86(0x16, ®s, ®s);
X! return (int)regs.x.cflag;
X }
X
X int
X*** old\getch.c
X--- getch.c
X**************
X*** 25,31
X #define BREAK 3 /* ASCII ^C and ^Break */
X
X int
X! getch(void)
X {
X register int ch;
X union REGS regs;
X--- 25,31 -----
X #define BREAK 3 /* ASCII ^C and ^Break */
X
X int
X! getch()
X {
X register int ch;
X union REGS regs;
X**************
X*** 65,68
X printf("\nInterrupt: \'x\' to quit\n");
X return(1);
X }
X! #endif TESTPROG
X--- 65,68 -----
X printf("\nInterrupt: \'x\' to quit\n");
X return(1);
X }
X! #endif /* TESTPROG */
X*** old\initscr.c
X--- initscr.c
X**************
X*** 13,18
X
X #include <curses.h>
X #include <curspriv.h>
X
X WINDOW *curscr = 0; /* the current screen image */
X WINDOW *stdscr = 0; /* the default screen window */
X--- 13,19 -----
X
X #include <curses.h>
X #include <curspriv.h>
X+ #include <stdlib.h>
X
X WINDOW *curscr = 0; /* the current screen image */
X WINDOW *stdscr = 0; /* the default screen window */
X**************
X*** 34,40
X _cursvar.cbreak = FALSE;
X _cursvar.echo = TRUE;
X _cursvar.refrbrk = FALSE; /* no premature end of refresh */
X! _cursvar.orgcbr = _cursesgcb(); /* original ^BREAK setting */
X
X LINES = 25; /* @@@@ this must be fixed */
X COLS = _cursesgcols();
X--- 35,41 -----
X _cursvar.cbreak = FALSE;
X _cursvar.echo = TRUE;
X _cursvar.refrbrk = FALSE; /* no premature end of refresh */
X! _cursvar.orgcbr = (bool)_cursesgcb(); /* original ^BREAK setting */
X
X LINES = 25; /* @@@@ this must be fixed */
X COLS = _cursesgcols();
X*** old\strget.c
X--- strget.c
X**************
X*** 45,51
X xbeg = w->_curx; /* remember screen start x-position */
X
X wrefresh(w); /* sets cursor at right place */
X! while ((*str = getch()) != '\n')
X {
X if (*str == '\r')
X break;
X--- 45,51 -----
X xbeg = w->_curx; /* remember screen start x-position */
X
X wrefresh(w); /* sets cursor at right place */
X! while ((*str = (char)getch()) != '\n')
X {
X if (*str == '\r')
X break;
X*** old\unctrl.c
X--- unctrl.c
X**************
X*** 29,35
X
X if ((ic >= ' ') && (ic != 0x7f)) /* normal characters */
X {
X! strbuf[0] = ic;
X strbuf[1] = '\0';
X return(strbuf);
X } /* if */
X--- 29,35 -----
X
X if ((ic >= ' ') && (ic != 0x7f)) /* normal characters */
X {
X! strbuf[0] = (char)ic;
X strbuf[1] = '\0';
X return(strbuf);
X } /* if */
X**************
X*** 37,42
X if (c == 0x7f) /* DEL */
X strbuf[1] = '?';
X else /* other control */
X! strbuf[1] = ic + '@';
X return(strbuf);
X } /* unctrl */
X--- 37,42 -----
X if (c == 0x7f) /* DEL */
X strbuf[1] = '?';
X else /* other control */
X! strbuf[1] = (char)ic + '@';
X return(strbuf);
X } /* unctrl */
X*** old\update.c
X--- update.c
X**************
X*** 24,93
X
X static char atrtab[64] = /* attribute encoding table. */
X { /* feel free to edit if your */
X! 7, /* NORMAL (0) */ /* display board supports all */
X! 0x87, /* BLINK */ /* possible combinations */
X! 0, /* BLANK */
X! 0, /* BLINK & BLANK */
X! 0xf, /* BOLD */
X! 0x8f, /* BOLD & BLINK */
X! 0, /* BOLD & BLANK */
X! 0, /* BOLD & BLINK & BLANK */
X! 0x70, /* REVERSE (8) */
X! 0xf0, /* REVERSE & BLINK */
X! 0, /* REVERSE & BLANK */
X! 0, /* REVERSE & BLINK & BLANK */
X! 0x78, /* REVERSE & BOLD */
X! 0xf8, /* REVERSE & BOLD & BLINK */
X! 0, /* REVERSE & BOLD & BLANK */
X! 0, /* REVERSE & BOLD & BLINK & BLANK */
X! 0xf, /* STANDOUT (10) */
X! 0x8f, /* STANDOUT & BLINK */
X! 0, /* STANDOUT & BLANK */
X! 0, /* STANDOUT & BLINK & BLANK */
X! 0xf, /* STANDOUT & BOLD */
X! 0x8f, /* STANDOUT & BOLD & BLINK */
X! 0, /* STANDOUT & BOLD & BLANK */
X! 0, /* STANDOUT & BOLD & BLINK & BLANK */
X! 0x70, /* STANDOUT & REVERSE (18) */
X! 0xf0, /* STANDOUT & REVERSE & BLINK */
X! 0, /* STANDOUT & REVERSE & BLANK */
X! 0, /* STANDOUT & REVERSE & BLINK & BLANK */
X! 0x70, /* STANDOUT & REVERSE & BOLD */
X! 0xf0, /* STANDOUT & REVERSE & BOLD & BLINK */
X! 0, /* STANDOUT & REVERSE & BOLD & BLANK */
X! 0, /* STANDOUT & REVERSE & BOLD & BLINK & BLANK */
X! 1, /* UNDERLINE (20) */
X! 0x81, /* UNDERLINE & BLINK */
X! 0, /* UNDERLINE & BLANK */
X! 0, /* UNDERLINE & BLINK & BLANK */
X! 9, /* UNDERLINE & BOLD */
X! 0x89, /* UNDERLINE & BOLD & BLINK */
X! 0, /* UNDERLINE & BOLD & BLANK */
X! 0, /* UNDERLINE & BOLD & BLINK & BLANK */
X! 0x70, /* UNDERLINE & REVERSE (28) */
X! 0xf0, /* UNDERLINE & REVERSE & BLINK */
X! 0, /* UNDERLINE & REVERSE & BLANK */
X! 0, /* UNDERLINE & REVERSE & BLINK & BLANK */
X! 0x79, /* UNDERLINE & REVERSE & BOLD */
X! 0xf9, /* UNDERLINE & REVERSE & BOLD & BLINK */
X! 0, /* UNDERLINE & REVERSE & BOLD & BLANK */
X! 0, /* UNDERLINE & REVERSE & BOLD & BLINK & BLANK */
X! 9, /* UNDERLINE & STANDOUT (30) */
X! 0x89, /* UNDERLINE & STANDOUT & BLINK */
X! 0, /* UNDERLINE & STANDOUT & BLANK */
X! 0, /* UNDERLINE & STANDOUT & BLINK & BLANK */
X! 9, /* UNDERLINE & STANDOUT & BOLD */
X! 0x89, /* UNDERLINE & STANDOUT & BOLD & BLINK */
X! 0, /* UNDERLINE & STANDOUT & BOLD & BLANK */
X! 0, /* UNDERLINE & STANDOUT & BOLD & BLINK & BLANK */
X! 0x70, /* UNDERLINE & STANDOUT & REVERSE (38) */
X! 0xf0, /* UNDERLINE & STANDOUT & REVERSE & BLINK */
X! 0, /* UNDERLINE & STANDOUT & REVERSE & BLANK */
X! 0, /* UNDERLINE & STANDOUT & REVERSE & BLINK & BLANK */
X! 0x70, /* UNDERLINE & STANDOUT & REVERSE & BOLD */
X! 0xf0, /* UNDERLINE & STANDOUT & REVERSE & BOLD & BLINK */
X! 0, /* UNDERLINE & STANDOUT & REVERSE & BOLD & BLANK */
X! 0, /* UNDERLINE & STANDOUT & REVERSE & BOLD & BLINK & BLANK */
X };
X
X /****************************************************************/
X--- 24,93 -----
X
X static char atrtab[64] = /* attribute encoding table. */
X { /* feel free to edit if your */
X! (char)7, /* NORMAL (0) */ /* display board supports all */
X! (char)0x87, /* BLINK */ /* possible combinations */
X! (char)0, /* BLANK */
X! (char)0, /* BLINK & BLANK */
X! (char)0xf, /* BOLD */
X! (char)0x8f, /* BOLD & BLINK */
X! (char)0, /* BOLD & BLANK */
X! (char)0, /* BOLD & BLINK & BLANK */
X! (char)0x70, /* REVERSE (8) */
X! (char)0xf0, /* REVERSE & BLINK */
X! (char)0, /* REVERSE & BLANK */
X! (char)0, /* REVERSE & BLINK & BLANK */
X! (char)0x78, /* REVERSE & BOLD */
X! (char)0xf8, /* REVERSE & BOLD & BLINK */
X! (char)0, /* REVERSE & BOLD & BLANK */
X! (char)0, /* REVERSE & BOLD & BLINK & BLANK */
X! (char)0xf, /* STANDOUT (10) */
X! (char)0x8f, /* STANDOUT & BLINK */
X! (char)0, /* STANDOUT & BLANK */
X! (char)0, /* STANDOUT & BLINK & BLANK */
X! (char)0xf, /* STANDOUT & BOLD */
X! (char)0x8f, /* STANDOUT & BOLD & BLINK */
X! (char)0, /* STANDOUT & BOLD & BLANK */
X! (char)0, /* STANDOUT & BOLD & BLINK & BLANK */
X! (char)0x70, /* STANDOUT & REVERSE (18) */
X! (char)0xf0, /* STANDOUT & REVERSE & BLINK */
X! (char)0, /* STANDOUT & REVERSE & BLANK */
X! (char)0, /* STANDOUT & REVERSE & BLINK & BLANK */
X! (char)0x70, /* STANDOUT & REVERSE & BOLD */
X! (char)0xf0, /* STANDOUT & REVERSE & BOLD & BLINK */
X! (char)0, /* STANDOUT & REVERSE & BOLD & BLANK */
X! (char)0, /* STANDOUT & REVERSE & BOLD & BLINK & BLANK */
X! (char)1, /* UNDERLINE (20) */
X! (char)0x81, /* UNDERLINE & BLINK */
X! (char)0, /* UNDERLINE & BLANK */
X! (char)0, /* UNDERLINE & BLINK & BLANK */
X! (char)9, /* UNDERLINE & BOLD */
X! (char)0x89, /* UNDERLINE & BOLD & BLINK */
X! (char)0, /* UNDERLINE & BOLD & BLANK */
X! (char)0, /* UNDERLINE & BOLD & BLINK & BLANK */
X! (char)0x70, /* UNDERLINE & REVERSE (28) */
X! (char)0xf0, /* UNDERLINE & REVERSE & BLINK */
X! (char)0, /* UNDERLINE & REVERSE & BLANK */
X! (char)0, /* UNDERLINE & REVERSE & BLINK & BLANK */
X! (char)0x79, /* UNDERLINE & REVERSE & BOLD */
X! (char)0xf9, /* UNDERLINE & REVERSE & BOLD & BLINK */
X! (char)0, /* UNDERLINE & REVERSE & BOLD & BLANK */
X! (char)0, /* UNDERLINE & REVERSE & BOLD & BLINK & BLANK */
X! (char)9, /* UNDERLINE & STANDOUT (30) */
X! (char)0x89, /* UNDERLINE & STANDOUT & BLINK */
X! (char)0, /* UNDERLINE & STANDOUT & BLANK */
X! (char)0, /* UNDERLINE & STANDOUT & BLINK & BLANK */
X! (char)9, /* UNDERLINE & STANDOUT & BOLD */
X! (char)0x89, /* UNDERLINE & STANDOUT & BOLD & BLINK */
X! (char)0, /* UNDERLINE & STANDOUT & BOLD & BLANK */
X! (char)0, /* UNDERLINE & STANDOUT & BOLD & BLINK & BLANK */
X! (char)0x70, /* UNDERLINE & STANDOUT & REVERSE (38) */
X! (char)0xf0, /* UNDERLINE & STANDOUT & REVERSE & BLINK */
X! (char)0, /* UNDERLINE & STANDOUT & REVERSE & BLANK */
X! (char)0, /* UNDERLINE & STANDOUT & REVERSE & BLINK & BLANK */
X! (char)0x70, /* UNDERLINE & STANDOUT & REVERSE & BOLD */
X! (char)0xf0, /* UNDERLINE & STANDOUT & REVERSE & BOLD & BLINK */
X! (char)0, /* UNDERLINE & STANDOUT & REVERSE & BOLD & BLANK */
X! (char)0, /* UNDERLINE & STANDOUT & REVERSE & BOLD & BLINK & BLANK */
X };
X
X /****************************************************************/
X**************
X*** 198,204
X } /* for */
X twin->_minchng[lineno] = _NO_CHANGE;
X twin->_maxchng[lineno] = _NO_CHANGE;
X! return (_cursvar.refrbrk && _cursespendch());
X } /* transformline */
X
X /****************************************************************/
X--- 198,204 -----
X } /* for */
X twin->_minchng[lineno] = _NO_CHANGE;
X twin->_maxchng[lineno] = _NO_CHANGE;
X! return (bool)(_cursvar.refrbrk && _cursespendch());
X } /* transformline */
X
X /****************************************************************/
END_OF_FILE
if test 14084 -ne `wc -c <'patch2.dif'`; then
echo shar: \"'patch2.dif'\" unpacked with wrong size!
fi
# end of 'patch2.dif'
fi
echo shar: End of archive 1 \(of 1\).
cp /dev/null ark1isdone
MISSING=""
for I in 1 ; do
if test ! -f ark${I}isdone ; then
MISSING="${MISSING} ${I}"
fi
done
if test "${MISSING}" = "" ; then
echo You have the archive.
rm -f ark[1-9]isdone
else
echo You still need to unpack the following archives:
echo " " ${MISSING}
fi
## End of shell archive.
exit 0
More information about the Comp.sources.misc
mailing list