v05i024: PCcurses version 1.3, part 2/5

Steve Creps creps at silver.bacs.indiana.edu
Mon Oct 31 12:51:25 AEST 1988


Posting-number: Volume 5, Issue 24
Submitted-by: "Steve Creps" <creps at silver.bacs.indiana.edu>
Archive-name: pc-curses-1.3/Part2

#! /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 2 (of 5)."
# Contents:  attrib.c boxes.c chardel.c charins.c clrtobot.c clrtoeol.c
#   curspriv.h linedel.c lineins.c options.c overlay.c refresh.c
#   setmode.c setterm.c
# Wrapped by creps at silver on Fri Oct 28 17:43:07 1988
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'attrib.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'attrib.c'\"
else
echo shar: Extracting \"'attrib.c'\" \(3805 characters\)
sed "s/^X//" >'attrib.c' <<'END_OF_FILE'
X/****************************************************************/
X/* Character attribute routines of the PCcurses package		*/
X/*								*/
X/****************************************************************/
X/* This version of curses is based on ncurses, a curses version	*/
X/* originally written by Pavel Curtis at Cornell University.	*/
X/* I have made substantial changes to make it run on IBM PC's,	*/
X/* and therefore consider myself free make it public domain.	*/
X/*		Bjorn Larsson (...mcvax!enea!infovax!bl)	*/
X/****************************************************************/
X/* 1.0:	Release:					870515	*/
X/* 1.2:	Rcsid[] string for maintenance:			881002	*/
X/* 1.3:	MSC -W3, Turbo'C' -w -w-pro checkes:		881005	*/
X/****************************************************************/
X
X#include <curses.h>
X#include <curspriv.h>
X
Xchar _curses_attrib_rcsid[] = "@(#)attrib.c v1.3 - 881005";
X
X/****************************************************************/
X/* Wattrset() sets the attributes as specified in window 'win'.	*/
X/****************************************************************/
X
Xvoid wattrset(win,attrs)
X  WINDOW	*win;
X  int		 attrs;
X  {
X  win->_attrs = attrs & ATR_MSK;
X  } /* wattrset */
X
X/****************************************************************/
X/* Wattron() sets the specified attribute(s) in window 'win'.	*/
X/****************************************************************/
X
Xvoid	wattron(win,attrs)
X  WINDOW	*win;
X  int		 attrs;
X  {
X  win->_attrs |= (attrs & ATR_MSK);
X  } /* wattron */
X
X/****************************************************************/
X/* Wattroff() clears the specified attribute(s) in window	*/
X/* 'win'.							*/
X/****************************************************************/
X
Xvoid	wattroff(win,attrs)
X  WINDOW	*win;
X  int		 attrs;
X  {
X  win->_attrs &= (~attrs & ATR_MSK);
X  } /* wattroff */
X
X/****************************************************************/
X/* Wstandout() starts standout mode in window 'win'.		*/
X/****************************************************************/
X
Xvoid	wstandout(win)
X  WINDOW	*win;
X  {
X  win->_attrs = A_STANDOUT;
X  } /* wstandout */
X
X/****************************************************************/
X/* Wstandend() clears all special attributes in window 'win'.	*/
X/****************************************************************/
X
Xvoid	wstandend(win)
X  WINDOW	*win;
X  {
X  win->_attrs = ATR_NRM;
X  } /* wstandend */
X
X/****************************************************************/
X/* Attrset() sets the attributes as specified in stdscr.	*/
X/****************************************************************/
X
Xvoid	attrset(attrs)
X  int attrs;
X  {
X  stdscr->_attrs = attrs & ATR_MSK;
X  } /* attrset */
X
X/****************************************************************/
X/* Attron() sets the specified attribute(s) in stdscr.		*/
X/****************************************************************/
X
Xvoid	attron(attrs)
X  int		 attrs;
X  {
X  stdscr->_attrs |= (attrs & ATR_MSK);
X  } /* attron */
X
X/****************************************************************/
X/* Attroff() clears the specified attribute(s) in stdscr.	*/
X/****************************************************************/
X
Xvoid	attroff(attrs)
X  int		 attrs;
X  {
X  stdscr->_attrs &= (~attrs & ATR_MSK);
X  } /* attroff */
X
X/****************************************************************/
X/* Standout() starts standout mode in stdscr.			*/
X/****************************************************************/
X
Xvoid	standout()
X  {
X  stdscr->_attrs = A_STANDOUT;
X  } /* standout */
X
X/****************************************************************/
X/* Standend() clears all special attributes in stdscr.		*/
X/****************************************************************/
X
Xvoid	standend()
X  {
X  stdscr->_attrs = ATR_NRM;
X  } /* standend */
END_OF_FILE
if test 3805 -ne `wc -c <'attrib.c'`; then
    echo shar: \"'attrib.c'\" unpacked with wrong size!
fi
# end of 'attrib.c'
fi
if test -f 'boxes.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'boxes.c'\"
else
echo shar: Extracting \"'boxes.c'\" \(4197 characters\)
sed "s/^X//" >'boxes.c' <<'END_OF_FILE'
X/****************************************************************/
X/* Box() routines of the PCcurses package			*/
X/*								*/
X/****************************************************************/
X/* This version of curses is based on ncurses, a curses version	*/
X/* originally written by Pavel Curtis at Cornell University.	*/
X/* I have made substantial changes to make it run on IBM PC's,	*/
X/* and therefore consider myself free to make it public domain.	*/
X/*		Bjorn Larsson (...mcvax!enea!infovax!bl)	*/
X/****************************************************************/
X/* 1.0:	Release:					870515	*/
X/* 1.2:	Max limits off by 1. Fixed thanks to S. Creps:	881002	*/
X/* 1.3:	MSC '-W3', Turbo'C' '-w -w-pro' checks. Support		*/
X/*	for border(), wborder() functions:		881005	*/
X/****************************************************************/
X
X#include <curses.h>
X#include <curspriv.h>
X
Xchar _curses_boxes_rcsid[] = "@(#)boxes.c v1.3 - 881005";
X
X/****************************************************************/
X/* wbox(win,ymin,xmin,ymax,xmax,v,h) draws a box in window	*/
X/* 'win', enclosing the area xmin-xmax and ymin-xmax. If	*/
X/* xmax and/or ymax is 0, the window max value is used. 'v' and	*/
X/* 'h' are the vertical and horizontal characters to use. If	*/
X/* 'v' and 'h' are PC grapics lines, wbox will make the corners	*/
X/* in a pretty way.						*/
X/****************************************************************/
X
Xint	wbox(win,ymin,xmin,ymax,xmax,v,h)
X  WINDOW	*win;
X  int		 ymin;
X  int		 xmin;
X  int		 ymax;
X  int		 xmax;
X  char		 v;
X  char		 h;
X  {
X  static int	 l, r, t, b, tl, tr, bl,br;	/* border chars */
X  int		 i;
X
X  if (ymax == 0)
X    ymax = win->_maxy - 1;
X  if (xmax == 0)
X    xmax = win->_maxx - 1;
X
X  if (ymin >= win->_maxy || ymax > win->_maxy ||
X      xmin >= win->_maxx || xmax > win->_maxx ||
X      ymin >= ymax || xmin >= xmax
X     )
X     return(ERR);
X
X  l = r = v & 0xff;			/* get rid of sign-extended int */
X  t = b = h & 0xff;
X  tl = tr = bl = br = v;		/* default same as vertical */
X
X  if (l == 0xba)			/* vertical double bars */
X    {
X    if (t == 0xcd)			/* horizontal too? */
X      {tl=0xc9;tr=0xbb;bl=0xc8;br=0xbc;}/* use double bar corners */
X    else
X      {tl=0xd6;tr=0xb7;bl=0xd3;br=0xbd;}/* use hor-s vert-d corners */
X    } /* if */
X
X  if (l == 0xb3)			/* vertical single bars */
X    {
X    if (t == 0xcd)			
X      {tl=0xd5;tr=0xb8;bl=0xd4;br=0xbe;}/* horizontal double bars */
X    else				
X      {tl=0xda;tr=0xbf;bl=0xc0;br=0xd9;}/* use hor-s vert-s bars */
X    } /* if */
X 
X  if (win->_borderchars[0])		/* border() settings override parms */
X    l = win->_borderchars[0];
X  if (win->_borderchars[3])
X    r = win->_borderchars[1];
X  if (win->_borderchars[3])
X    t = win->_borderchars[2];
X  if (win->_borderchars[3])
X    b = win->_borderchars[3];
X  if (win->_borderchars[4])
X    tl = win->_borderchars[4];
X  if (win->_borderchars[5])
X    tr = win->_borderchars[5];
X  if (win->_borderchars[6])
X    bl = win->_borderchars[6];
X  if (win->_borderchars[7])
X    br = win->_borderchars[7];
X
X  for (i = xmin+1;i <= xmax-1;i++)
X    {
X    win->_line[ymin][i] = t | win->_attrs;
X    win->_line[ymax][i] = b | win->_attrs;
X    }
X  for (i = ymin+1;i <= ymax-1;i++)
X    {
X    win->_line[i][xmin] = l | win->_attrs;
X    win->_line[i][xmax] = r | win->_attrs;
X    }
X  win->_line[ymin][xmin] = tl | win->_attrs;
X  win->_line[ymin][xmax] = tr | win->_attrs;
X  win->_line[ymax][xmin] = bl | win->_attrs;
X  win->_line[ymax][xmax] = br | win->_attrs;
X
X  for (i=ymin; i <= ymax ; i++)
X    {
X    if (win->_minchng[i] == _NO_CHANGE)
X      {
X      win->_minchng[i] = xmin;
X      win->_maxchng[i] = xmax;
X      } /* if */
X    else
X      {
X      win->_minchng[i] = min(win->_minchng[i], xmin);
X      win->_maxchng[i] = max(win->_maxchng[i], xmax);
X      } /* else */
X    } /* for */
X  return(OK);
X  } /* box */
X
X/****************************************************************/
X/* box(win,v,h) draws a box around window window 'win'. 'v' and	*/
X/* 'h' are the vertical and horizontal characters to use.	*/
X/****************************************************************/
X
Xvoid	box(win,v,h)
X  WINDOW	*win;
X  char		 v;
X  char		 h;
X  {
X  wbox(win,0,0,0,0,v,h);
X  } /* box */
END_OF_FILE
if test 4197 -ne `wc -c <'boxes.c'`; then
    echo shar: \"'boxes.c'\" unpacked with wrong size!
fi
# end of 'boxes.c'
fi
if test -f 'chardel.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'chardel.c'\"
else
echo shar: Extracting \"'chardel.c'\" \(3106 characters\)
sed "s/^X//" >'chardel.c' <<'END_OF_FILE'
X/****************************************************************/
X/* Wdelch() routine of the PCcurses package			*/
X/*								*/
X/****************************************************************/
X/* This version of curses is based on ncurses, a curses version	*/
X/* originally written by Pavel Curtis at Cornell University.	*/
X/* I have made substantial changes to make it run on IBM PC's,	*/
X/* and therefore consider myself free to make it public domain.	*/
X/*		Bjorn Larsson (...mcvax!enea!infovax!bl)	*/
X/****************************************************************/
X/* 1.0:	Release:					870515	*/
X/* 1.2:	Max limits off by 1. Fixed thanks to S. Creps:	881002	*/
X/* 1.3:	MSC -W3, Turbo'C' -w -w-pro checkes:		881005	*/
X/****************************************************************/
X
X#include <curses.h>
X#include <curspriv.h>
X
Xchar _curses_chardel_rcsid[] = "@(#)chardel.c v1.3 - 881005";
X
X/****************************************************************/
X/* Wdelch() deletes the character at the window cursor, and the	*/
X/* characters to the right of it are shifted left, inserting a	*/
X/* space at the last position of the line.			*/
X/****************************************************************/
X
Xint	wdelch(win)
X  WINDOW	*win;
X  {
X  int		*temp1;
X  int		*temp2;
X  int		*end;
X  short	 y = win->_cury;
X  short	 x = win->_curx;
X  short	 maxx = win->_maxx - 1;
X
X  end = &win->_line[y][maxx];
X  temp1 = &win->_line[y][x];
X  temp2 = temp1 + 1;
X  while (temp1 < end)
X    *temp1++ = *temp2++;
X  *temp1 = ' ' | (win->_attrs & ATR_MSK);
X  win->_maxchng[y] = maxx;
X  if (win->_minchng[y] == _NO_CHANGE || win->_minchng[y] > x)
X    win->_minchng[y] = x;
X  return(OK);
X  } /* wdelch */
X
X/****************************************************************/
X/* Delch() deletes the character at the stdscr cursor, and the	*/
X/* characters to the right of it are shifted left, inserting a	*/
X/* space at the last position of the line.			*/
X/****************************************************************/
X
Xint delch()
X  {
X  return(wdelch(stdscr));
X  } /* delch */
X
X/****************************************************************/
X/* Mvdelch() moves the stdscr cursor to a new position, then	*/
X/* deletes the character at the stdscr cursor, and the charac-	*/
X/* ters to the right of it are shifted left, inserting a space	*/
X/* at the last position of the line.				*/
X/****************************************************************/
X
Xint mvdelch(y,x)
X  int y;
X  int x;
X  {
X  if (wmove(stdscr,y,x) == ERR)
X    return(ERR);
X  return(wdelch(stdscr));
X  } /* mvdelch */
X
X/****************************************************************/
X/* Mvwdelch() moves the cursor of window 'win' to a new posi-	*/
X/* tion, then deletes the character at the stdscr cursor, and	*/
X/* the characters to the right of it are shifted left, inser-	*/
X/* ting a space at the last position of the line.		*/
X/****************************************************************/
X
Xint mvwdelch(win,y,x)
X  WINDOW *win;
X  int y;
X  int x;
X  {
X  if (wmove(win,y,x) == ERR)
X    return(ERR);
X  return(wdelch(win));
X  } /* mvwdelch */
END_OF_FILE
if test 3106 -ne `wc -c <'chardel.c'`; then
    echo shar: \"'chardel.c'\" unpacked with wrong size!
fi
# end of 'chardel.c'
fi
if test -f 'charins.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'charins.c'\"
else
echo shar: Extracting \"'charins.c'\" \(5462 characters\)
sed "s/^X//" >'charins.c' <<'END_OF_FILE'
X/****************************************************************/
X/* Winsch() routine of the PCcurses package			*/
X/*								*/
X/****************************************************************/
X/* This version of curses is based on ncurses, a curses version	*/
X/* originally written by Pavel Curtis at Cornell University.	*/
X/* I have made substantial changes to make it run on IBM PC's,	*/
X/* and therefore consider myself free to make it public domain.	*/
X/*		Bjorn Larsson (...mcvax!enea!infovax!bl)	*/
X/****************************************************************/
X/* 1.0:	Release:					870515	*/
X/* 1.1:	Added 'raw' output routines (allows PC charac-		*/
X/*	ters < 0x20 to be displayed:			880306	*/
X/* 1.2:	Max limits off by 1. Fixed thanks to S. Creps:	881002	*/
X/* 1.3:	MSC -W3, Turbo'C' -w -w-pro checkes:		881005	*/
X/****************************************************************/
X
X#include <curses.h>
X#include <curspriv.h>
X
Xchar _curses_charins_rcsid[] = "@(#)charins.c v1.3 - 881005";
X
X/****************************************************************/
X/* _Chins() inserts character 'c' at the cursor position in	*/
X/* window 'win'. If xlat is true, normal character translation	*/
X/* is performed; If xlat is false, the character is output 'as	*/
X/* is'.								*/
X/****************************************************************/
X
Xstatic	int	_chins(win,c,xlat)
X  WINDOW	*win;
X  char		 c;
X  bool		 xlat;
X  {
X  int		*temp1;
X  int		*temp2;
X  int		*end;
X  int		 x = win->_curx;
X  int		 y = win->_cury;
X  int		 maxx = win->_maxx - 1;
X
X  if((c < ' ') && (c == '\n' || c == '\r' || c == '\t' || c == '\b'))
X    return(_chadd(win,c,xlat));
X  end = &win->_line[y][x];
X  temp1 = &win->_line[y][maxx];
X  temp2 = temp1 - 1;
X  if((c < ' ') && xlat)			/* if CTRL-char make space for 2 */
X    temp2--;
X  while (temp1 > end)
X    *temp1-- = *temp2--;
X  win->_maxchng[y] = maxx;
X  if ((win->_minchng[y] == _NO_CHANGE) || (win->_minchng[y] > x))
X    win->_minchng[y] = x;
X  return(_chadd(win,c,xlat));		/* fixes CTRL-chars too */
X  } /* _chins */
X
X/****************************************************************/
X/* Insch() inserts character 'c' at the cursor position in	*/
X/* stdscr. The cursor is advanced.				*/
X/****************************************************************/
X
Xint insch(c)
X  char c;
X  {
X  return(_chins(stdscr,c,TRUE));
X  } /* insch */
X
X/****************************************************************/
X/* Winsch() inserts character 'c' at the cursor position in	*/
X/* window 'win'. The cursor is advanced.			*/
X/****************************************************************/
X
Xint winsch(win,c)
X  WINDOW *win;
X  char c;
X  {
X  return(_chins(win,c,TRUE));
X  } /* winsch */
X
X/****************************************************************/
X/* Mvinsch() moves the stdscr cursor to a new position, then	*/
X/* inserts character 'c' at the cursor position in stdscr. The	*/
X/* cursor is advanced.						*/
X/****************************************************************/
X
Xint mvinsch(y,x,c)
X  int  y;
X  int  x;
X  char c;
X  {
X  if (wmove(stdscr,y,x) == ERR)
X    return(ERR);
X  return(_chins(stdscr,c,TRUE));
X  } /* mvinsch */
X
X/****************************************************************/
X/* Mvwinsch() moves the cursor of window 'win' to a new posi-	*/
X/* tion, then inserts character 'c' at the cursor position in	*/
X/* window 'win'. The cursor is advanced.			*/
X/****************************************************************/
X
Xint mvwinsch(win,y,x,c)
X  WINDOW *win;
X  int  y;
X  int  x;
X  char c;
X  {
X  if (wmove(win,y,x) == ERR)
X    return(ERR);
X  return(_chins(win,c,TRUE));
X  } /* mvwinsch */
X
X/****************************************************************/
X/* Insrawch() inserts character 'c' at the cursor position in	*/
X/* stdscr. Control characters are not interpreted, and the	*/
X/* cursor is advanced.						*/
X/****************************************************************/
X
Xint insrawch(c)
X  char c;
X  {
X  return(_chins(stdscr,c,FALSE));
X  } /* insrawch */
X
X/****************************************************************/
X/* Winsrawch() inserts character 'c' at the cursor position in	*/
X/* window 'win'. Control characters are not interpreted, and	*/
X/* the cursor is advanced.					*/
X/****************************************************************/
X
Xint winsrawch(win,c)
X  WINDOW *win;
X  char c;
X  {
X  return(_chins(win,c,FALSE));
X  } /* winsrawch */
X
X/****************************************************************/
X/* Mvinsrawch() moves the stdscr cursor to a new position, then	*/
X/* inserts character 'c' at the cursor position in stdscr.	*/
X/* Control characters are not interpreted, and	the cursor is	*/
X/* advanced.							*/
X/****************************************************************/
X
Xint mvinsrawch(y,x,c)
X  int  y;
X  int  x;
X  char c;
X  {
X  if (wmove(stdscr,y,x) == ERR)
X    return(ERR);
X  return(_chins(stdscr,c,FALSE));
X  } /* mvinsrawch */
X
X/****************************************************************/
X/* Mvwinsrawch() moves the cursor of window 'win' to a new	*/
X/* position, then inserts character 'c' at the cursor position	*/
X/* in window 'win'. Control characters are not interpreted, and	*/
X/* the cursor is advanced.					*/
X/****************************************************************/
X
Xint mvwinsrawch(win,y,x,c)
X  WINDOW *win;
X  int  y;
X  int  x;
X  char c;
X  {
X  if (wmove(win,y,x) == ERR)
X    return(ERR);
X  return(_chins(win,c,FALSE));
X  } /* mvwinsrawch */
END_OF_FILE
if test 5462 -ne `wc -c <'charins.c'`; then
    echo shar: \"'charins.c'\" unpacked with wrong size!
fi
# end of 'charins.c'
fi
if test -f 'clrtobot.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'clrtobot.c'\"
else
echo shar: Extracting \"'clrtobot.c'\" \(3336 characters\)
sed "s/^X//" >'clrtobot.c' <<'END_OF_FILE'
X/****************************************************************/
X/* Wclrtobot() routine of the PCcurses package			*/
X/*								*/
X/****************************************************************/
X/* This version of curses is based on ncurses, a curses version	*/
X/* originally written by Pavel Curtis at Cornell University.	*/
X/* I have made substantial changes to make it run on IBM PC's,	*/
X/* and therefore consider myself free to make it public domain.	*/
X/*		Bjorn Larsson (...mcvax!enea!infovax!bl)	*/
X/****************************************************************/
X/* 1.0:	Release:					870515	*/
X/* 1.1:	Renamed clrbot() to clrtobot(). Reported by		*/
X/*	Eric Rosco:					870907	*/
X/* 1.2:	Max limits off by 1. Fixed thanks to S. Creps:	881002	*/
X/* 1.3:	MSC -W3, Turbo'C' -w -w-pro checkes:		881005	*/
X/****************************************************************/
X
X#include <curses.h>
X#include <curspriv.h>
X
Xchar _curses_clrtobot_rcsid[] = "@(#)clrtobot.c v1.3 - 881005";
X
X/****************************************************************/
X/* Wclrtobot() fills the right half of the cursor line of	*/
X/* window 'win', and all lines below it with blanks.		*/
X/****************************************************************/
X
Xint	wclrtobot(win)
X  WINDOW	*win;
X  {
X  int	 y;
X  int   minx;
X  static int	 startx;
X  static int	*ptr;
X  static int    *end;
X  static int    *maxx;
X  static int     blank;
X
X  blank = ' ' | (win->_attrs & ATR_MSK);
X  startx = win->_curx;
X  for (y = win->_cury; y <= win->_regbottom; y++)
X    {
X    minx = _NO_CHANGE;
X    end = &win->_line[y][win->_maxx - 1];
X    for (ptr = &win->_line[y][startx]; ptr <= end; ptr++)
X      {
X      if (*ptr != blank)
X	{
X	maxx = ptr;
X	if (minx == _NO_CHANGE)
X	  minx = ptr - win->_line[y];
X	*ptr = blank;
X	} /* if */
X      } /* for */
X    if (minx != _NO_CHANGE)
X      {
X      if ((win->_minchng[y] > minx) ||  (win->_minchng[y] == _NO_CHANGE))
X	win->_minchng[y] = minx;
X      if (win->_maxchng[y] < maxx - win->_line[y])
X	win->_maxchng[y] = maxx - win->_line[y];
X      } /* if */
X    startx = 0;
X    } /* for */
X  return(OK);
X  } /* wclrtobot */
X
X/****************************************************************/
X/* Clrtobot() fills the right half of the cursor line of	*/
X/* stdscr, and all lines below it with blanks.			*/
X/****************************************************************/
X
Xint clrtobot()
X  {
X  return(wclrtobot(stdscr));
X  } /* clrtobot */
X
X/****************************************************************/
X/* Mvclrtobot() moves the cursor to a new position in stdscr	*/
X/* and fills the right half of the cursor line, and all lines	*/
X/* below it with blanks.					*/
X/****************************************************************/
X
Xint mvclrtobot(y,x)
X  int y;
X  int x;
X  {
X  if (wmove(stdscr,y,x) == ERR)
X    return(ERR);
X  return(wclrtobot(stdscr));
X  } /* mvclrtobot */
X
X/****************************************************************/
X/* Mvwclrtobot() moves the cursor to a new position in window	*/
X/* 'win', and fills the right half of the cursor line, and all	*/
X/* lines below it with blanks.					*/
X/****************************************************************/
X
Xint mvwclrtobot(win,y,x)
X  WINDOW *win;
X  int y;
X  int x;
X  {
X  if (wmove(win,y,x) == ERR)
X    return(ERR);
X  return(wclrtobot(win));
X  } /* mvwclrtobot */
END_OF_FILE
if test 3336 -ne `wc -c <'clrtobot.c'`; then
    echo shar: \"'clrtobot.c'\" unpacked with wrong size!
fi
# end of 'clrtobot.c'
fi
if test -f 'clrtoeol.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'clrtoeol.c'\"
else
echo shar: Extracting \"'clrtoeol.c'\" \(3119 characters\)
sed "s/^X//" >'clrtoeol.c' <<'END_OF_FILE'
X/****************************************************************/
X/* Wclrtoeol() routine of the PCcurses package			*/
X/*								*/
X/****************************************************************/
X/* This version of curses is based on ncurses, a curses version	*/
X/* originally written by Pavel Curtis at Cornell University.	*/
X/* I have made substantial changes to make it run on IBM PC's,	*/
X/* and therefore consider myself free to make it public domain.	*/
X/*		Bjorn Larsson (...mcvax!enea!infovax!bl)	*/
X/****************************************************************/
X/* 1.0:	Release:					870515	*/
X/* 1.2:	Max limits off by 1. Fixed thanks to S. Creps:	880210	*/
X/* 1.3:	MSC -W3, Turbo'C' -w -w-pro checkes:		881005	*/
X/****************************************************************/
X
X#include <curses.h>
X#include <curspriv.h>
X
Xchar _curses_clrtoeol_rcsid[] = "@(#)clrtoeol.c v1.3 - 881005";
X
X/****************************************************************/
X/* Wclrtoeol() fills the half of the cursor line to the right	*/
X/* of the cursor in window 'win' with blanks.			*/
X/****************************************************************/
X
Xint	wclrtoeol(win)
X   WINDOW	*win;
X  {
X  int		*maxx;
X  int		*ptr;
X  int		*end;
X  static int	 y;
X  static int	 x;
X  static int	 minx;
X  static int 	 blank;
X  
X  y = win->_cury;
X  x = win->_curx;
X  blank = ' ' | (win->_attrs & ATR_MSK);
X
X  end = &win->_line[y][win->_maxx - 1];
X  minx = _NO_CHANGE;
X  maxx = &win->_line[y][x];
X  for (ptr = maxx; ptr <= end; ptr++)
X    {
X    if (*ptr != blank)
X      {
X      maxx = ptr;
X      if (minx == _NO_CHANGE)
X	minx = ptr - win->_line[y];
X      *ptr = blank;
X      } /* if */
X    } /* for */
X
X  if (minx != _NO_CHANGE)
X    {
X    if (win->_minchng[y] > minx || win->_minchng[y] == _NO_CHANGE)
X      win->_minchng[y] = minx;
X    if (win->_maxchng[y] < maxx - win->_line[y])
X      win->_maxchng[y] = maxx - win->_line[y];
X    } /* if */
X  return(OK);
X  } /* wclrtoeol */
X
X/****************************************************************/
X/* Clrtoeol() fills the half of the cursor line to the right	*/
X/* of the cursor in stdscr with blanks.				*/
X/****************************************************************/
X
Xint clrtoeol()
X  {
X  return(wclrtoeol(stdscr));
X  } /* clrtoeol */
X
X/****************************************************************/
X/* Mvclrtoeol() moves the cursor to a new position in stdscr	*/
X/* and fills the right half of the cursor line with blanks.	*/
X/****************************************************************/
X
Xint mvcltoreol(y,x)
X  int y;
X  int x;
X  {
X  if (wmove(stdscr,y,x) == ERR)
X    return(ERR);
X  return(wclrtoeol(stdscr));
X  } /* mvclrtoeol */
X
X/****************************************************************/
X/* Mvwclrtoeol() moves the cursor to a new position in window	*/
X/* 'win', and fills the right half of the cursor line with	*/
X/* blanks.							*/
X/****************************************************************/
X
Xint mvwclrtoeol(win,y,x)
X  WINDOW *win;
X  int y;
X  int x;
X  {
X  if (wmove(win,y,x) == ERR)
X    return(ERR);
X  return(wclrtoeol(win));
X  } /* mvwclrtoeol */
END_OF_FILE
if test 3119 -ne `wc -c <'clrtoeol.c'`; then
    echo shar: \"'clrtoeol.c'\" unpacked with wrong size!
fi
# end of 'clrtoeol.c'
fi
if test -f 'curspriv.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'curspriv.h'\"
else
echo shar: Extracting \"'curspriv.h'\" \(3818 characters\)
sed "s/^X//" >'curspriv.h' <<'END_OF_FILE'
X/****************************************************************/
X/*			   CURSPRIV.H				*/
X/* Header file for definitions and declarations for the		*/
X/* PCcurses package. These definitions should not be gene-	*/
X/* rally accessible to programmers.				*/
X/****************************************************************/
X/* This version of curses is based on ncurses, a curses version	*/
X/* originally written by Pavel Curtis at Cornell University.	*/
X/* I have made substantial changes to make it run on IBM PC's,	*/
X/* and therefore consider myself free to make it public domain.	*/
X/*		Bjorn Larsson (...mcvax!enea!infovax!bl)	*/
X/****************************************************************/
X/* 1.0:	Release:					870515	*/
X/* 1.1:	Add _chadd() for raw output routines:		880306	*/
X/* 1.2:	Support (by #ifdef UCMASM) for uppercase-only		*/
X/*	assembly routine names. If UCMASM if defined,		*/
X/*	all assembler names are #defined as upper case.		*/
X/*	Not needed if you do "MASM /MX. Also missing		*/
X/* 	declaration of cursesscroll(). Fixes thanks to		*/
X/*	N.D. Pentcheff:					881002	*/ 
X/* 1.3:	All modules lint-checked with MSC '-W3' and		*/
X/*	turbo'C' '-w -w-pro' switches:			881005	*/
X/****************************************************************/
X
X/* window properties */
X
X#define	_SUBWIN		1		/* window is a subwindow */
X#define	_ENDLINE	2		/* last winline is last screen line */
X#define	_FULLWIN	4		/* window fills screen */
X#define	_SCROLLWIN	8		/* window lwr rgt is screen lwr rgt */
X
X/* Miscellaneous */
X
X#define	_INBUFSIZ	200		/* size of terminal input buffer */
X#define	_NO_CHANGE	-1		/* flags line edge unchanged */
X
X#define	_BREAKCHAR	0x03		/* ^C character */
X#define _DCCHAR		0x08		/* Delete Char char (BS) */
X#define _DLCHAR		0x1b		/* Delete Line char (ESC) */
X#define	_GOCHAR		0x11		/* ^Q character */
X#define	_PRINTCHAR	0x10		/* ^P character */
X#define	_STOPCHAR	0x13		/* ^S character */
X#define	 NUNGETCH	10		/* max # chars to ungetch() */
X
X/* character mask definitions */
X
X#define CHR_MSK	((int) 0x00ff)		/* ASCIIZ character mask */
X#define	ATR_MSK	((int) 0xff00)		/* attribute mask */
X#define ATR_NRM	((int) 0x0000)		/* no special attributes */
X
X/* type declarations */
X
Xtypedef	struct
X  {
X  WINDOW  *tmpwin;			/* window used for updates */
X  int	   cursrow;			/* position of physical cursor */
X  int	   curscol;
X  bool	   autocr;			/* if lf -> crlf */
X  bool	   cbreak;			/* if terminal unbuffered */
X  bool	   echo;			/* if terminal echo */
X  bool	   raw;				/* if terminal raw mode */
X  bool	   refrbrk;			/* if premature refresh brk allowed */
X  bool     orgcbr;			/* original MSDOS ^-BREAK setting */
X  }	cursv;
X
X/* External variables */
X
Xextern	cursv   _cursvar;		/* curses variables */
X
X/* 'C' standard library function declarations */
X
Xextern	char	*calloc();
Xextern	char	*malloc();
Xextern	void	 free();
Xextern	int	 sprintf();
Xextern	int	 sscanf();
X
X/* Curses internal functions, not to be used by programmers */
X
X/* #Define UCMASM if your version of MASM does not support */
X/*  the '/MX' switch, or if you use another assembler */
X
X#ifdef	UCMASM
X#define	_cursescattr	_CURSESCATTR
X#define	_cursescmode	_CURSESCMODE
X#define	_cursescursor	_CURSESCURSOR
X#define	_cursesgcb	_CURSESGCB
X#define	_cursesgcmode	_CURSESGCMODE
X#define	_cursesgcols	_CURSESGCOLS
X#define	_curseskey	_CURSESKEY
X#define	_cursesscroll	_CURSESSCROLL
X#define	_curseskeytst	_CURSESKEYTST
X#define	_cursesputc	_CURSESPUTC
X#define	_cursesscb	_CURSESSCB
X#endif
X 
Xextern	int	_chadd();
Xextern	void	_cursescattr();
Xextern	void	_cursescmode();
Xextern	void	_cursescursor();
Xextern	int	_cursesgcb();
Xextern	int	_cursesgcmode();
Xextern	int	_cursesgcols();
Xextern	int	_curseskey();
Xextern	bool	_curseskeytst();
Xextern	void	_cursesscroll();
Xextern	bool	_cursespendch();
Xextern	void	_cursesputc();
Xextern	void	_cursesscb();
END_OF_FILE
if test 3818 -ne `wc -c <'curspriv.h'`; then
    echo shar: \"'curspriv.h'\" unpacked with wrong size!
fi
# end of 'curspriv.h'
fi
if test -f 'linedel.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'linedel.c'\"
else
echo shar: Extracting \"'linedel.c'\" \(3128 characters\)
sed "s/^X//" >'linedel.c' <<'END_OF_FILE'
X/****************************************************************/
X/* Wdeleteln() routine of the PCcurses package			*/
X/*								*/
X/****************************************************************/
X/* This version of curses is based on ncurses, a curses version	*/
X/* originally written by Pavel Curtis at Cornell University.	*/
X/* I have made substantial changes to make it run on IBM PC's,	*/
X/* and therefore consider myself free to make it public domain.	*/
X/*		Bjorn Larsson (...mcvax!enea!infovax!bl)	*/
X/****************************************************************/
X/* 1.0:	Release:					870515	*/
X/* 1.2:	max limits off by 1. Fixed thanks to S. Creps:	881002	*/
X/* 1.3:	MSC -W3, Turbo'C' -w -w-pro checkes:		881005	*/
X/****************************************************************/
X
X#include <curses.h>
X#include <curspriv.h>
X
Xchar _curses_linedel_rcsid[] = "@(#)linedel.c v1.3 - 881005";
X
X/****************************************************************/
X/* Wdeleteln() deletes the line at the window cursor, and the	*/
X/* lines below it are shifted up, inserting a blank line at	*/
X/* the bottom of the window.					*/
X/****************************************************************/
X
Xint	wdeleteln(win)
X  WINDOW	*win;
X  {
X  int		*end;
X  int		*temp;
X  short	 y;
X  static   int	 blank;
X  
X  blank = ' ' | (win->_attrs & ATR_MSK);
X
X  temp = win->_line[win->_cury];
X  for (y = win->_cury; y < win->_regbottom; y++)
X    {
X    win->_line[y] = win->_line[y+1];
X    win->_minchng[y] = 0;
X    win->_maxchng[y] = win->_maxx - 1;
X    }
X  win->_minchng[y] = 0;
X  win->_maxchng[y] = win->_maxx - 1;
X  win->_line[win->_regbottom] = temp;
X  for (end = &(temp[win->_maxx -1]); temp <= end;)
X    *temp++ = blank;
X  return(OK);
X  } /* wdeleteln */
X
X/****************************************************************/
X/* Deleteln() deletes the line at the stdscr cursor, and the	*/
X/* lines below it are shifted up, inserting a blank line at	*/
X/* the bottom of stdscr.					*/
X/****************************************************************/
X
Xint deleteln()
X  {
X  return(wdeleteln(stdscr));
X  } /* deleteln */
X
X/****************************************************************/
X/* Mvdeleteln() moves the cursor to a new position in stdscr,	*/
X/* then deletes the line at the window cursor, and the lines	*/
X/* below it are shifted up, inserting a blank line at the bot-	*/
X/* tom of stdscr.						*/
X/****************************************************************/
X
Xint mvdeleteln(y,x)
X  int y;
X  int x;
X  {
X  if (wmove(stdscr,y,x) == ERR)
X    return(ERR);
X  return(wdeleteln(stdscr));
X  } /* mvdeleteln */
X
X/****************************************************************/
X/* Mvwdeleteln() moves the cursor to a new position in a win-	*/
X/* dow, then deletes the line at the window cursor, and the	*/
X/* lines below it are shifted up, inserting a blank line at	*/
X/* the bottom of the window.					*/
X/****************************************************************/
X
Xint mvwdeleteln(win,y,x)
X  WINDOW *win;
X  int y;
X  int x;
X  {
X  if (wmove(win,y,x) == ERR)
X    return(ERR);
X  return(wdeleteln(win));
X  } /* mvwdeleteln */
END_OF_FILE
if test 3128 -ne `wc -c <'linedel.c'`; then
    echo shar: \"'linedel.c'\" unpacked with wrong size!
fi
# end of 'linedel.c'
fi
if test -f 'lineins.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'lineins.c'\"
else
echo shar: Extracting \"'lineins.c'\" \(3010 characters\)
sed "s/^X//" >'lineins.c' <<'END_OF_FILE'
X/****************************************************************/
X/* Winsertln() routine of the PCcurses package			*/
X/*								*/
X/****************************************************************/
X/* This version of curses is based on ncurses, a curses version	*/
X/* originally written by Pavel Curtis at Cornell University.	*/
X/* I have made substantial changes to make it run on IBM PC's,	*/
X/* and therefore consider myself free to make it public domain.	*/
X/*		Bjorn Larsson (...mcvax!enea!infovax!bl)	*/
X/****************************************************************/
X/* 1.0:	Release:					870515	*/
X/* 1.1:	Mvinsertln() and friends were misrenamed:	880305	*/
X/* 1.2:	Max limits off by 1. Fixed thanks to S. Creps:	881002	*/
X/* 1.3:	MSC -W3, Turbo'C' -w -w-pro checkes:		881005	*/
X/****************************************************************/
X
X#include <curses.h>
X#include <curspriv.h>
X
Xchar _curses_lineins_rcsid[] = "@(#)lineins.c v1.3 - 881005";
X
X/****************************************************************/
X/* Winsertln() inserts a blank line instead of the cursor line	*/
X/* in window 'win' and pushes other lines down.			*/
X/****************************************************************/
X
Xint	winsertln(win)
X  WINDOW	*win;
X  {
X  int		*temp;
X  int		*end;
X  short	 y;
X  static   int	 blank;
X  
X  blank = ' ' | (win->_attrs & ATR_MSK);
X  temp = win->_line[win->_regbottom];
X  for (y = win->_regbottom;  y > win->_cury;  y--)
X    {
X    win->_line[y] = win->_line[y-1];
X    win->_minchng[y] = 0;
X    win->_maxchng[y] = win->_maxx - 1;
X    } /* for */
X  win->_line[win->_cury] = temp;
X  for (end = &temp[win->_maxx -1];  temp <= end;  temp++)
X    *temp = blank;
X  win->_minchng[win->_cury] = 0;
X  win->_maxchng[win->_cury] = win->_maxx - 1;
X  return(OK);
X  } /* winsertln */
X
X/****************************************************************/
X/* Insertln() inserts a blank line instead of the cursor line	*/
X/* in stdscr and pushes other lines down.			*/
X/****************************************************************/
X
Xint insertln()
X  {
X  return(winsertln(stdscr));
X  } /* insertln */
X
X/****************************************************************/
X/* Mvinsertln() moves the stdscr cursor to a new positions, in-	*/
X/* serts a blank line instead of the cursor line and pushes	*/
X/* other lines down.						*/
X/****************************************************************/
X
Xint mvinsertln(y,x)
X  int y;
X  int x;
X  {
X  if (wmove(stdscr,y,x) == ERR)
X    return(ERR);
X  return(winsertln(stdscr));
X  } /* mvinsertln */
X
X/****************************************************************/
X/* Mvwinsertln() moves the cursor in window 'win' to a new po-	*/
X/* si tions, inserts a blank line instead of the cursor line	*/
X/* and pushes other lines down.					*/
X/****************************************************************/
X
Xint mvwinsertln(win,y,x)
X  WINDOW *win;
X  int y;
X  int x;
X  {
X  if (wmove(win,y,x) == ERR)
X    return(ERR);
X  return(winsertln(win));
X  } /* mvwinsertln */
END_OF_FILE
if test 3010 -ne `wc -c <'lineins.c'`; then
    echo shar: \"'lineins.c'\" unpacked with wrong size!
fi
# end of 'lineins.c'
fi
if test -f 'options.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'options.c'\"
else
echo shar: Extracting \"'options.c'\" \(4288 characters\)
sed "s/^X//" >'options.c' <<'END_OF_FILE'
X/****************************************************************/
X/* Idlok(), clearok(), leaveok(), scrollok(), nodelay(), key-	*/
X/* pad(), meta(), cursoff() and curson() routines of the	*/
X/* PCcurses package.						*/
X/*								*/
X/****************************************************************/
X/* This version of curses is based on ncurses, a curses version	*/
X/* originally written by Pavel Curtis at Cornell University.	*/
X/* I have made substantial changes to make it run on IBM PC's,	*/
X/* and therefore consider myself free to make it public domain.	*/
X/*		Bjorn Larsson (...mcvax!enea!infovax!bl)	*/
X/****************************************************************/
X/* 1.0:	Release:					870515	*/
X/* 1.2:	Rcsid[] string for maintenance:			881002	*/
X/* 1.3:	MSC -W3, Turbo'C' -w -w-pro checkes:		881005	*/
X/****************************************************************/
X
X#include <curses.h>
X#include <curspriv.h>
X
Xchar _curses_options_rcsid[] = "@(#)option.c v1.3 - 881005";
X
Xstatic bool	hasold = FALSE;		/* for remembering old cursor type */
Xstatic int	oldmode;
X
X/****************************************************************/
X/* Idlok() is used to set  flag for using the terminal insert/	*/
X/* delete line capabilities. This is not relevant for the PC	*/
X/* version of curses, and thus nothing is done.			*/
X/****************************************************************/
X
Xvoid idlok()
X  {
X  } /* idlok */
X
X/****************************************************************/
X/* Clearok() marks window 'win' to cause screen clearing and	*/
X/* redraw the next time a refresh is done.			*/
X/****************************************************************/
X
Xvoid clearok(win, flag)
X  WINDOW	*win;
X  bool		 flag;
X  {
X  if (win == curscr)
X    _cursvar.tmpwin->_clear = flag;
X  else
X    win->_clear = flag;
X  } /* clearok */
X
X/****************************************************************/
X/* Leaveok() marks window 'win' to allow the update routines	*/
X/* to leave the hardware cursor where it happens to be at the	*/
X/* end of update. Usually used in combination with cursoff().	*/
X/****************************************************************/
X
Xvoid leaveok(win, flag)
X  WINDOW	*win;
X  bool		 flag;
X  {
X  win->_leave = flag;
X  } /* leaveok */
X
X/****************************************************************/
X/* Scrollok() marks window 'win' to allow the scrolling region	*/
X/* of it to actually scroll.					*/
X/****************************************************************/
X
Xvoid scrollok(win, flag)
X  WINDOW	*win;
X  bool		 flag;
X  {
X  win->_scroll = flag;
X  } /* scrollok */
X
X/****************************************************************/
X/* Nodelay() marks the window to make character input non-	*/
X/* waiting, i.e. if there is no character to get, -1 will be	*/
X/* returned.							*/
X/****************************************************************/
X
Xvoid nodelay(win, flag)
X  WINDOW	*win;
X  bool		 flag;
X  {
X  win->_nodelay = flag;
X  } /* nodelay */
X
X/****************************************************************/
X/* Keypad() marks window 'win' to use the special keypad mode.	*/
X/****************************************************************/
X
Xvoid keypad(win, flag)
X  WINDOW	*win;
X  bool		 flag;
X  {
X  win->_keypad = flag;
X  } /* keypad */
X
X/****************************************************************/
X/* Meta() allows use of any alternate character set allowed by	*/
X/* the terminal. We always allow this on the PC, so this one	*/
X/* does nothing.						*/
X/****************************************************************/
X
Xvoid meta()
X  {
X  } /* meta */
X
X/****************************************************************/
X/* Cursoff() turns off the hardware cursor.			*/
X/****************************************************************/
X
Xvoid cursoff()
X  {
X  if (!hasold)
X    {
X    oldmode = _cursesgcmode();		/* get old cursor type */
X    hasold = TRUE;
X    }
X  _cursescmode(31,30);			/* turn it off */
X  } /* cursoff */
X
X/****************************************************************/
X/* Curson() turns on the hardware cursor.			*/
X/****************************************************************/
X
Xvoid curson()
X  {
X  if (hasold)
X    {
X    _cursescmode(oldmode >> 8,oldmode);
X    hasold = FALSE;
X    }
X  } /* curson */
END_OF_FILE
if test 4288 -ne `wc -c <'options.c'`; then
    echo shar: \"'options.c'\" unpacked with wrong size!
fi
# end of 'options.c'
fi
if test -f 'overlay.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'overlay.c'\"
else
echo shar: Extracting \"'overlay.c'\" \(3687 characters\)
sed "s/^X//" >'overlay.c' <<'END_OF_FILE'
X/****************************************************************/
X/* Overlay() and overwrite() functions of the PCcurses package	*/
X/*								*/
X/****************************************************************/
X/* This version of curses is based on ncurses, a curses version	*/
X/* originally written by Pavel Curtis at Cornell University.	*/
X/* I have made substantial changes to make it run on IBM PC's,	*/
X/* and therefore consider myself free to make it public domain.	*/
X/*		Bjorn Larsson (...mcvax!enea!infovax!bl)	*/
X/****************************************************************/
X/* 1.0:	Release:					870515	*/
X/* 1.2:	Max limits off by 1. Fixed thanks to S. Creps:	881002	*/
X/* 1.3:	MSC -W3, Turbo'C' -w -w-pro checkes:		881005	*/
X/****************************************************************/
X
X#include <curses.h>
X#include <curspriv.h>
X
Xchar _curses_overlay_rcsid[] = "@(#)overlay.c v1.3 - 881005";
X
X/****************************************************************/
X/* Overlay() overwrites 'win1' upon 'win2', with origins alig-	*/
X/* ned. Overlay is transparent; blanks from 'win1' are not	*/
X/* copied to 'win2'.						*/
X/****************************************************************/
X
Xvoid overlay(win1, win2)
X  WINDOW	*win1, *win2;
X  {
X  int		*minchng;
X  int		*maxchng;
X  int		*w1ptr;
X  int		*w2ptr;
X  int		 attrs;
X  int		 col;
X  int		 line;
X  int		 last_line;
X  int		 last_col;
X
X  last_col = min(win1->_maxx, win2->_maxx) - 1;
X  last_line = min(win1->_maxy, win2->_maxy) - 1;
X  attrs = win2->_attrs & ATR_MSK;
X  minchng = win2->_minchng;
X  maxchng = win2->_maxchng;
X
X  for(line = 0;  line <= last_line;  line++)
X    {
X    register short   fc, lc;
X    w1ptr = win1->_line[line];
X    w2ptr = win2->_line[line];
X    fc = _NO_CHANGE;
X    for(col = 0;  col <= last_col;  col++)
X      {
X      if ((*w1ptr & CHR_MSK) != ' ')
X	{
X	*w2ptr = (*w1ptr & CHR_MSK) | attrs;
X	if (fc == _NO_CHANGE)
X	  fc = col;
X	lc = col;
X	} /* if */
X      w1ptr++;
X      w2ptr++;
X      } /* for */
X
X    if (*minchng == _NO_CHANGE)
X      {
X      *minchng = fc;
X      *maxchng = lc;
X      } /* if */
X    else
X      if (fc != _NO_CHANGE)
X	{
X	if (fc < *minchng)
X	  *minchng = fc;
X	if (lc > *maxchng)
X	  *maxchng = lc;
X	} /* else if */
X    minchng++;
X    maxchng++;
X    } /* for */
X  } /* overlay */
X
X/****************************************************************/
X/* Overwrite() overwrites 'win1' upon 'win2', with origins	*/
X/* aligned. Overwrite is non-transparent; blanks from 'win1'	*/
X/* are copied to 'win2'.					*/
X/****************************************************************/
X
Xvoid	overwrite(win1, win2)
X  WINDOW	*win1, *win2;
X  {
X  int		*minchng;
X  int		*maxchng;
X  int		*w1ptr;
X  int		*w2ptr;
X  int		 attrs;
X  int		 col;
X  int		 line;
X  int		 last_line;
X  int		 last_col;
X
X  last_col = min(win1->_maxx, win2->_maxx) - 1;
X  last_line = min(win1->_maxy, win2->_maxy) - 1;
X  attrs = win2->_attrs & ATR_MSK;
X  minchng = win2->_minchng;
X  maxchng = win2->_maxchng;
X
X  for(line = 0;  line <= last_line;  line++)
X    {
X    register short   fc, lc;
X
X    w1ptr = win1->_line[line];
X    w2ptr = win2->_line[line];
X    fc = _NO_CHANGE;
X
X    for(col = 0;  col <= last_col;  col++)
X      {
X      if ((*w1ptr & CHR_MSK) != (*w2ptr & CHR_MSK))
X	{
X	*w2ptr = (*w1ptr & CHR_MSK) | attrs;
X
X	if (fc == _NO_CHANGE)
X	  fc = col;
X	lc = col;
X	} /* if */
X
X      w1ptr++;
X      w2ptr++;
X      } /* for */
X
X    if (*minchng == _NO_CHANGE)
X      {
X      *minchng = fc;
X      *maxchng = lc;
X      } /* if */
X    else
X      if (fc != _NO_CHANGE)
X	{
X	if (fc < *minchng)
X	  *minchng = fc;
X	if (lc > *maxchng)
X	  *maxchng = lc;
X	} /* else if */
X    minchng++;
X    maxchng++;
X    } /* for */
X  } /* overwrite */
END_OF_FILE
if test 3687 -ne `wc -c <'overlay.c'`; then
    echo shar: \"'overlay.c'\" unpacked with wrong size!
fi
# end of 'overlay.c'
fi
if test -f 'refresh.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'refresh.c'\"
else
echo shar: Extracting \"'refresh.c'\" \(3441 characters\)
sed "s/^X//" >'refresh.c' <<'END_OF_FILE'
X/****************************************************************/
X/* Wrefresh() and wnoutrefresh() routines of the PCcurses	*/
X/* package							*/
X/*								*/
X/****************************************************************/
X/* This version of curses is based on ncurses, a curses version	*/
X/* originally written by Pavel Curtis at Cornell University.	*/
X/* I have made substantial changes to make it run on IBM PC's,	*/
X/* and therefore consider myself free to make it public domain.	*/
X/*		Bjorn Larsson (...mcvax!enea!infovax!bl)	*/
X/****************************************************************/
X/* 1.0:	Release:					870515	*/
X/* 1.2:	Max limits off by 1. Fixed thanks to S. Creps:	881002	*/
X/* 1.3:	MSC -W3, Turbo'C' -w -w-pro checkes:		881005	*/
X/****************************************************************/
X
X#include <curses.h>
X#include <curspriv.h>
X
Xchar _curses_refresh_rcsid[] = "@(#)refresh.c v1.3 - 881005";
X
X/****************************************************************/
X/* Wrefresh() updates window win's area of the physical screen.	*/
X/****************************************************************/
X
Xvoid wrefresh(win)
X  WINDOW	*win;
X  {
X  if (win == curscr)
X    curscr->_clear = TRUE;
X  else
X    wnoutrefresh(win);
X  doupdate();
X  } /* wrefresh */
X
X/****************************************************************/
X/* Wnoutrefresh() updates the image of the desired screen,	*/
X/* without doing physical update (copies window win's image to	*/
X/* the _cursvar.tmpwin window, which is hidden from the user).	*/
X/****************************************************************/
X
Xvoid wnoutrefresh(win)
X  register WINDOW	*win;
X  {
X  register int	  *dst;			/* start destination in temp window */
X  register int    *end;			/* end destination in temp window */
X  register int    *src;			/* source in user window */
X  register int     first;		/* first changed char on line */
X  register int     last;		/* last changed char on line */
X  static   WINDOW *nscr;
X  static   int	   begy;		/* window's place on screen */
X  static   int	   begx;
X  static   int	   i;
X  static   int	   j;
X
X  nscr = _cursvar.tmpwin;
X  begy = win->_begy;
X  begx = win->_begx;
X
X  for (i=0, j=begy; i < win->_maxy; i++, j++)
X    {
X    if (win->_minchng[i] != _NO_CHANGE)
X      {
X      first = win->_minchng[i];
X      last  = win->_maxchng[i];
X      dst   = &(nscr->_line[j][begx + first]);
X      end   = &(nscr->_line[j][begx + last]);
X      src   = &(win->_line[i][first]);
X
X      while (dst <= end) 		/* copy user line to temp window */
X	*dst++ = *src++;
X
X      first += begx;			/* nscr's min/max change positions */
X      last  += begx;
X
X      if ((nscr->_minchng[j] == _NO_CHANGE)||(nscr->_minchng[j] > first))
X	nscr->_minchng[j] = first;
X      if (last > nscr->_maxchng[j])
X	nscr->_maxchng[j] = last;
X      
X      win->_minchng[i] = _NO_CHANGE;	/* updated now */
X      } /* if */
X    win->_maxchng[i] = _NO_CHANGE;	/* updated now */
X    } /* for */
X
X  if (win->_clear)
X    {
X    win->_clear = FALSE;
X    nscr->_clear = TRUE;
X    } /* if */
X
X  if (!win->_leave)
X    {
X    nscr->_cury = win->_cury + begy;
X    nscr->_curx = win->_curx + begx;
X    } /* if */
X  } /* wnoutrefresh */
X
X/****************************************************************/
X/* Refresh() updates stdscr's area of the physical screen.	*/
X/****************************************************************/
X
Xvoid refresh()
X  {
X  wrefresh(stdscr);
X  } /* refresh */
END_OF_FILE
if test 3441 -ne `wc -c <'refresh.c'`; then
    echo shar: \"'refresh.c'\" unpacked with wrong size!
fi
# end of 'refresh.c'
fi
if test -f 'setmode.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'setmode.c'\"
else
echo shar: Extracting \"'setmode.c'\" \(3268 characters\)
sed "s/^X//" >'setmode.c' <<'END_OF_FILE'
X/****************************************************************/
X/* Terminal mode routines of the PCcurses package.		*/
X/*								*/
X/****************************************************************/
X/* This version of curses is based on ncurses, a curses version	*/
X/* originally written by Pavel Curtis at Cornell University.	*/
X/* I have made substantial changes to make it run on IBM PC's,	*/
X/* and therefore consider myself free make it public domain.	*/
X/*		Bjorn Larsson (...mcvax!enea!infovax!bl)	*/
X/****************************************************************/
X/* BUT: this particular module was written by			*/
X/*	N. Dean Pentcheff  (dean at violet.berkeley.edu)		*/
X/* It provides PC Curses versions of:				*/
X/*	reset_prog_mode();					*/
X/*	reset_shell_mode();					*/
X/*	set_prog_mode();					*/
X/*	set_shell_mode();					*/
X/*								*/
X/* B. Larsson took the liberty to modify its style slightly	*/
X/* when incorporating it into PCcurses v.1.2. The routines in	*/
X/* this module do a similar thing to savetty() and resetty().	*/
X/****************************************************************/
X/* 1.2:	Style clean-up, rcsid[] string for maintenance:	881002	*/
X/* 1.3:	MSC -W3, Turbo'C' -w -w-pro checkes:		881005	*/
X/****************************************************************/
X
X#include <curses.h>
X#include <curspriv.h>
X
Xstruct cttyset
X  {
X  bool	been_set;
X  bool	oautocr;
X  bool	ocbreak;
X  bool	oecho;
X  bool	oraw;
X  };
X	
Xchar _curses_setmode_rcsid[] = "@(#)setmode.c v1.3 - 881005";
X
Xstatic	struct cttyset sh_tty = {FALSE};/* tty modes for shell_mode */
Xstatic	struct cttyset pr_tty = {FALSE};/* tty modes for prog_mode  */
X
X/****************************************************************/
X/* Def_prog_mode() saves the current tty status, to be recalled	*/
X/* later by reset_prog_mode.					*/
X/****************************************************************/
X
Xvoid def_prog_mode()
X  {
X  pr_tty.been_set = TRUE;
X  pr_tty.oautocr = _cursvar.autocr;
X  pr_tty.ocbreak = _cursvar.cbreak;
X  pr_tty.oecho	= _cursvar.echo;
X  pr_tty.oraw	= _cursvar.raw;
X  } /* def_prog_mode */
X
X/****************************************************************/
X/* Reset_prog_mode() resets tty modes to the values saved in a	*/
X/* call to def_prog_mode.					*/
X/****************************************************************/
X
Xvoid reset_prog_mode()
X  {
X  if (pr_tty.been_set == TRUE)
X    {
X    _cursvar.autocr	= pr_tty.oautocr;
X    _cursvar.cbreak	= pr_tty.ocbreak;
X    _cursvar.echo	= pr_tty.oecho;
X    _cursvar.raw	= pr_tty.oraw;
X    } /* if */
X  } /* reset_prog_mode */
X
X/****************************************************************/
X/* Def_shell_mode() saves the tty status, to be recalled by	*/
X/* reset_shell_mode. A noop in PCcurses.			*/
X/****************************************************************/
X
Xvoid def_shell_mode()
X  {
X  } /* def_shell_mode */
X
X/****************************************************************/
X/* Reset_shell_mode() resets the tty status to the status it	*/
X/* had before curses began.					*/
X/****************************************************************/
X
Xvoid reset_shell_mode()
X  {
X  _cursvar.autocr	= TRUE;
X  _cursvar.cbreak	= FALSE;
X  _cursvar.echo	= TRUE;
X  _cursvar.raw	= FALSE;
X  } /* reset_shell_mode */
END_OF_FILE
if test 3268 -ne `wc -c <'setmode.c'`; then
    echo shar: \"'setmode.c'\" unpacked with wrong size!
fi
# end of 'setmode.c'
fi
if test -f 'setterm.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'setterm.c'\"
else
echo shar: Extracting \"'setterm.c'\" \(3007 characters\)
sed "s/^X//" >'setterm.c' <<'END_OF_FILE'
X/****************************************************************/
X/* Raw(), noraw(), echo(), noecho(), nl(), nonl(),  cbreak(),	*/
X/* nocbreak(), crmode(), nocrmode() and refrbrk() routines of	*/
X/* the PCcurses package.					*/
X/*								*/
X/****************************************************************/
X/* This version of curses is based on ncurses, a curses version	*/
X/* originally written by Pavel Curtis at Cornell University.	*/
X/* I have made substantial changes to make it run on IBM PC's,	*/
X/* and therefore consider myself free to make it public domain.	*/
X/*		Bjorn Larsson (...mcvax!enea!infovax!bl)	*/
X/****************************************************************/
X/* 1.0:	Release:					870515	*/
X/* 1.2:	Rcsid[] string for maintenance:			881002	*/
X/* 1.3:	MSC -W3, Turbo'C' -w -w-pro checkes:		881005	*/
X/****************************************************************/
X
X#include <curses.h>
X#include <curspriv.h>
X
Xchar _curses_setterm_rcsid[] = "@(#)setterm.c v1.3 - 881005";
X
X/****************************************************************/
X/* Raw() and noraw() sets or clears raw mode.			*/
X/****************************************************************/
X
Xvoid  raw()
X  {
X  _cursvar.raw = TRUE;
X  _cursesscb(FALSE);			/* disallow ^BREAK on disk I/O */
X  flushinp();
X  } /* raw */
X
Xvoid  noraw()
X  {
X  _cursvar.raw = FALSE;
X  _cursesscb(_cursvar.orgcbr);		/* restore original ^BREAK status */
X  } /* noraw */
X
X/****************************************************************/
X/* Echo() and noecho() sets or clears echo mode.		*/
X/****************************************************************/
X
Xvoid  echo()
X  {
X  _cursvar.echo = TRUE;
X  } /* echo */
X
Xvoid  noecho()
X  {
X  _cursvar.echo = FALSE;
X  } /* noecho */
X
X/****************************************************************/
X/* Nl() and nonl() sets or clears autocr mapping mode.		*/
X/****************************************************************/
X
Xvoid  nl()
X  {
X  _cursvar.autocr = TRUE;
X  } /* nl */
X
Xvoid  nonl()
X  {
X  _cursvar.autocr = FALSE;
X  } /* nonl */
X
X/****************************************************************/
X/* Cbreak(), nocbreak(), crmode() amd nocrmode()  sets or	*/
X/* clears cbreak mode.						*/
X/****************************************************************/
X
Xvoid  cbreak()
X  {
X  _cursvar.cbreak = TRUE;
X  } /* cbreak */
X
Xvoid  nocbreak()
X  {
X  _cursvar.cbreak = FALSE;
X  } /* nocbreak */
X
Xvoid  crmode()
X  {
X  _cursvar.cbreak = TRUE;
X  } /* crmode */
X
Xvoid  nocrmode()
X  {
X  _cursvar.cbreak = FALSE;
X  } /* nocrmode */
X
X/****************************************************************/
X/* Refrbrk() sets or unsets the screen refresh break flag. If	*/
X/* this flag is set, and there is any input available, any	*/
X/* screen refresh will be prematurely terminated, anticipating	*/
X/* more screen updates. This flag is FALSE by default.		*/
X/****************************************************************/
X
Xvoid	refrbrk(bf)
X  bool	bf;
X  {
X  _cursvar.refrbrk = bf;
X  } /* refrbrk */
END_OF_FILE
if test 3007 -ne `wc -c <'setterm.c'`; then
    echo shar: \"'setterm.c'\" unpacked with wrong size!
fi
# end of 'setterm.c'
fi
echo shar: End of archive 2 \(of 5\).
cp /dev/null ark2isdone
MISSING=""
for I in 1 2 3 4 5 ; do
    if test ! -f ark${I}isdone ; then
	MISSING="${MISSING} ${I}"
    fi
done
if test "${MISSING}" = "" ; then
    echo You have unpacked all 5 archives.
    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