*BSD News Article 9663


Return to BSD News archive

Received: by minnie.vk1xwt.ampr.org with NNTP
	id AA6226 ; Wed, 06 Jan 93 04:13:10 EST
Path: sserve!manuel.anu.edu.au!munnari.oz.au!sgiblab!darwin.sura.net!haven.umd.edu!uunet!mcsun!fuug!kiae!demos!newsserv
From: "Andrew A. Chernov, Black Mage" <ache@astral.msk.su>
Newsgroups: comp.unix.bsd
Subject: [386bsd] Patch #2 for curses, make it clean 8-bit
Date: Fri, 08 Jan 93 18:51:32 +0300
Distribution: world
Organization: Ha-oh-lahm Yetzirah
Message-ID: <YI4CQJh8l6@astral.msk.su>
Sender: news-service@newcom.kiae.su
Reply-To: ache@astral.msk.su
Lines: 116

I don't think, that any programs wish to use internal curses
attribute _STANDOUT directly, in expressions like:
	addch( ch | _STANDOUT );
Normal interface use standout() and standend() functions instead.
Many programs use 'char' type (with sign extention) for input characters
and sign extention becomes _STANDOUT mode in this case.
So, I refuse this future and allow 8-bit characters for programs,
which is designed for 7-bit only ('char' type using instead of
'unsigned char').

ATTENTION: use my first patch before this

*** addch.c.pl1	Fri Jan  8 15:40:46 1993
--- addch.c	Fri Jan  8 18:26:21 1993
***************
*** 43,49 ****
   */
  waddch(win, c)
  WINDOW	*win;
! chtype c;
  {
!     return _waddbytes(win, &c, 1);
  }
--- 43,50 ----
   */
  waddch(win, c)
  WINDOW	*win;
! char c;
  {
!     chtype ch = (unsigned char) c;
!     return _waddbytes(win, &ch, 1);
  }
*** box.c.pl1	Fri Jan  8 17:00:54 1993
--- box.c	Fri Jan  8 18:26:21 1993
***************
*** 44,50 ****
   */
  box(win, vert, hor)
  reg WINDOW	*win;
! chtype vert, hor; {
  
  	reg int		i;
  	reg int		endy, endx;
--- 44,50 ----
   */
  box(win, vert, hor)
  reg WINDOW	*win;
! char vert, hor; {
  
  	reg int		i;
  	reg int		endy, endx;
***************
*** 55,64 ****
  	fp = win->_y[0];
  	lp = win->_y[endy];
  	for (i = 0; i < endx; i++)
! 		fp[i] = lp[i] = hor;
  	endx--;
  	for (i = 0; i <= endy; i++)
! 		win->_y[i][0] = (win->_y[i][endx] = vert);
  	if (!win->_scroll && (win->_flags&_SCROLLWIN))
  		fp[0] = fp[endx] = lp[0] = lp[endx] = ' ';
  	touchwin(win);
--- 55,64 ----
  	fp = win->_y[0];
  	lp = win->_y[endy];
  	for (i = 0; i < endx; i++)
! 		fp[i] = lp[i] = (unsigned char) hor;
  	endx--;
  	for (i = 0; i <= endy; i++)
! 		win->_y[i][0] = (win->_y[i][endx] = (unsigned char) vert);
  	if (!win->_scroll && (win->_flags&_SCROLLWIN))
  		fp[0] = fp[endx] = lp[0] = lp[endx] = ' ';
  	touchwin(win);
*** insch.c.pl1	Fri Jan  8 16:11:22 1993
--- insch.c	Fri Jan  8 18:28:48 1993
***************
*** 44,50 ****
   */
  winsch(win, c)
  reg WINDOW	*win;
! chtype          c; {
  
  	reg chtype      *temp1, *temp2;
  	reg chtype      *end;
--- 44,50 ----
   */
  winsch(win, c)
  reg WINDOW	*win;
! char c; {
  
  	reg chtype      *temp1, *temp2;
  	reg chtype      *end;
***************
*** 54,60 ****
  	temp2 = temp1 - 1;
  	while (temp1 > end)
  		*temp1-- = *temp2--;
! 	*temp1 = c;
  	touchline(win, win->_cury, win->_curx, win->_maxx - 1);
  	if (win->_cury == LINES - 1 && win->_y[LINES-1][COLS-1] != ' ')
  		if (win->_scroll) {
--- 54,60 ----
  	temp2 = temp1 - 1;
  	while (temp1 > end)
  		*temp1-- = *temp2--;
! 	*temp1 = (unsigned char) c;
  	touchline(win, win->_cury, win->_curx, win->_maxx - 1);
  	if (win->_cury == LINES - 1 && win->_y[LINES-1][COLS-1] != ' ')
  		if (win->_scroll) {
-- 
In-This-Life:  Andrew A. Chernov    |  "Hay mas dicha, mas contento
Internet:      ache@astral.msk.su   |  "Que adorar una hermosura
Organization:  The RELCOM Corp.,    |  "Brujuleada entre los lejos
               Moscow, Russia       |  "De lo imposible?!"  (Calderon)