Prepare curses for the possibility of changing from termcap to terminfo.

term.h #defines lines, pad_char and no_color_video macros which conflict
with existing curses code. We change lines to alines and nlines depending
on use, pad_char to padchar and no_color_video becomes no_color_attributes
but with a strong alias from no_color_video.
This commit is contained in:
roy 2009-07-22 16:57:14 +00:00
parent e304eddfd2
commit 43d5eb454b
40 changed files with 457 additions and 452 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: add_wch.c,v 1.2 2007/05/28 15:01:53 blymn Exp $ */
/* $NetBSD: add_wch.c,v 1.3 2009/07/22 16:57:14 roy Exp $ */
/*
* Copyright (c) 2005 The NetBSD Foundation Inc.
@ -36,7 +36,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: add_wch.c,v 1.2 2007/05/28 15:01:53 blymn Exp $");
__RCSID("$NetBSD: add_wch.c,v 1.3 2009/07/22 16:57:14 roy Exp $");
#endif /* not lint */
#include <stdlib.h>
@ -114,11 +114,11 @@ wadd_wch(WINDOW *win, const cchar_t *wch)
int i;
for (i = 0; i < win->maxy; i++) {
assert(win->lines[i]->sentinel == SENTINEL_VALUE);
assert(win->alines[i]->sentinel == SENTINEL_VALUE);
}
__CTRACE(__CTRACE_INPUT, "wadd_wch: win(%p)", win);
#endif
lnp = win->lines[y];
lnp = win->alines[y];
return _cursesi_addwchar(win, &lnp, &y, &x, wch);
#endif /* HAVE_WCHAR */
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: add_wchstr.c,v 1.2 2007/05/28 15:01:53 blymn Exp $ */
/* $NetBSD: add_wchstr.c,v 1.3 2009/07/22 16:57:14 roy Exp $ */
/*
* Copyright (c) 2005 The NetBSD Foundation Inc.
@ -36,7 +36,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: add_wchstr.c,v 1.2 2007/05/28 15:01:53 blymn Exp $");
__RCSID("$NetBSD: add_wchstr.c,v 1.3 2009/07/22 16:57:14 roy Exp $");
#endif /* not lint */
#include <stdlib.h>
@ -195,8 +195,8 @@ wadd_wchnstr(WINDOW *win, const cchar_t *wchstr, int n)
chp = wchstr;
x = win->curx;
y = win->cury;
lp = &win->lines[y]->line[x];
lnp = win->lines[y];
lp = &win->alines[y]->line[x];
lnp = win->alines[y];
cw = WCOL(*lp);
if (cw >= 0) {
@ -320,9 +320,9 @@ wadd_wchnstr(WINDOW *win, const cchar_t *wchstr, int n)
#ifdef DEBUG
for (i = sx; i < ex; i++) {
__CTRACE(__CTRACE_INPUT, "wadd_wchnstr: (%d,%d)=(%x,%x,%p)\n",
win->cury, i, win->lines[win->cury]->line[i].ch,
win->lines[win->cury]->line[i].attr,
win->lines[win->cury]->line[i].nsp);
win->cury, i, win->alines[win->cury]->line[i].ch,
win->alines[win->cury]->line[i].attr,
win->alines[win->cury]->line[i].nsp);
}
#endif /* DEBUG */
lnp->flags |= __ISDIRTY;

View File

@ -1,4 +1,4 @@
/* $NetBSD: addbytes.c,v 1.34 2008/07/04 16:52:10 tnozaki Exp $ */
/* $NetBSD: addbytes.c,v 1.35 2009/07/22 16:57:14 roy Exp $ */
/*
* Copyright (c) 1987, 1993, 1994
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)addbytes.c 8.4 (Berkeley) 5/4/94";
#else
__RCSID("$NetBSD: addbytes.c,v 1.34 2008/07/04 16:52:10 tnozaki Exp $");
__RCSID("$NetBSD: addbytes.c,v 1.35 2009/07/22 16:57:14 roy Exp $");
#endif
#endif /* not lint */
@ -118,7 +118,7 @@ __waddbytes(WINDOW *win, const char *bytes, int count, attr_t attr)
int i;
for (i = 0; i < win->maxy; i++) {
assert(win->lines[i]->sentinel == SENTINEL_VALUE);
assert(win->alines[i]->sentinel == SENTINEL_VALUE);
}
__CTRACE(__CTRACE_INPUT, "ADDBYTES: add %d bytes\n", count);
@ -126,7 +126,7 @@ __waddbytes(WINDOW *win, const char *bytes, int count, attr_t attr)
err = OK;
SYNCH_IN;
lp = win->lines[y];
lp = win->alines[y];
#ifdef HAVE_WCHAR
(void)mbrtowc(NULL, NULL, (size_t)0, &st);
@ -178,7 +178,7 @@ __waddbytes(WINDOW *win, const char *bytes, int count, attr_t attr)
#ifdef DEBUG
for (i = 0; i < win->maxy; i++) {
assert(win->lines[i]->sentinel == SENTINEL_VALUE);
assert(win->alines[i]->sentinel == SENTINEL_VALUE);
}
#endif
@ -214,7 +214,7 @@ _cursesi_addbyte(WINDOW *win, __LINE **lp, int *y, int *x, int c,
#endif
if ((*lp)->flags & __ISPASTEOL) {
newline:
new_line:
*x = 0;
(*lp)->flags &= ~__ISPASTEOL;
if (*y == win->scr_b) {
@ -231,7 +231,7 @@ _cursesi_addbyte(WINDOW *win, __LINE **lp, int *y, int *x, int c,
} else {
(*y)++;
}
*lp = win->lines[*y];
*lp = win->alines[*y];
if (c == '\n')
break;
}
@ -246,8 +246,8 @@ _cursesi_addbyte(WINDOW *win, __LINE **lp, int *y, int *x, int c,
__CTRACE(__CTRACE_INPUT,
"ADDBYTES: 1: y = %d, x = %d, firstch = %d, "
"lastch = %d\n",
*y, *x, *win->lines[*y]->firstchp,
*win->lines[*y]->lastchp);
*y, *x, *win->alines[*y]->firstchp,
*win->alines[*y]->lastchp);
#endif
/*
* Always update the change pointers. Otherwise,
@ -290,15 +290,15 @@ _cursesi_addbyte(WINDOW *win, __LINE **lp, int *y, int *x, int c,
__CTRACE(__CTRACE_INPUT,
"ADDBYTES: 2: y = %d, x = %d, firstch = %d, "
"lastch = %d\n",
*y, *x, *win->lines[*y]->firstchp,
*win->lines[*y]->lastchp);
*y, *x, *win->alines[*y]->firstchp,
*win->alines[*y]->lastchp);
#endif
break;
case '\n':
PSYNCH_OUT;
wclrtoeol(win);
PSYNCH_IN;
goto newline;
goto new_line;
case '\r':
*x = 0;
break;
@ -324,7 +324,7 @@ _cursesi_addwchar(WINDOW *win, __LINE **lnp, int *y, int *x,
return (ERR);
#else
int sx = 0, ex = 0, cw = 0, i = 0, newx = 0;
__LDATA *lp = &win->lines[*y]->line[*x], *tp = NULL;
__LDATA *lp = &win->alines[*y]->line[*x], *tp = NULL;
nschar_t *np = NULL;
cchar_t cc;
attr_t attributes;
@ -407,8 +407,8 @@ _cursesi_addwchar(WINDOW *win, __LINE **lnp, int *y, int *x,
} else {
(*y)++;
}
(*lnp) = win->lines[*y];
lp = &win->lines[*y]->line[*x];
(*lnp) = win->alines[*y];
lp = &win->alines[*y]->line[*x];
}
/* clear out the current character */
cw = WCOL(*lp);
@ -421,7 +421,7 @@ _cursesi_addwchar(WINDOW *win, __LINE **lnp, int *y, int *x,
"_cursesi_addwchar: clear current char (%d,%d)\n",
*y, sx);
#endif /* DEBUG */
tp = &win->lines[*y]->line[sx];
tp = &win->alines[*y]->line[sx];
tp->ch = (wchar_t) btowc((int) win->bch);
if (_cursesi_copy_nsp(win->bnsp, tp) == ERR)
return ERR;
@ -469,8 +469,8 @@ _cursesi_addwchar(WINDOW *win, __LINE **lnp, int *y, int *x,
} else {
(*y)++;
}
lp = &win->lines[*y]->line[0];
(*lnp) = win->lines[*y];
lp = &win->alines[*y]->line[0];
(*lnp) = win->alines[*y];
}
win->cury = *y;
@ -553,7 +553,7 @@ _cursesi_addwchar(WINDOW *win, __LINE **lnp, int *y, int *x,
/* clear the remining of the current characer */
if (*x && *x < win->maxx) {
ex = sx + cw;
tp = &win->lines[*y]->line[ex];
tp = &win->alines[*y]->line[ex];
while (ex < win->maxx && WCOL(*tp) < 0) {
#ifdef DEBUG
__CTRACE(__CTRACE_INPUT,

View File

@ -1,4 +1,4 @@
/* $NetBSD: background.c,v 1.14 2008/04/28 20:23:01 martin Exp $ */
/* $NetBSD: background.c,v 1.15 2009/07/22 16:57:14 roy Exp $ */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: background.c,v 1.14 2008/04/28 20:23:01 martin Exp $");
__RCSID("$NetBSD: background.c,v 1.15 2009/07/22 16:57:14 roy Exp $");
#endif /* not lint */
#include <stdlib.h>
@ -103,17 +103,17 @@ wbkgd(WINDOW *win, chtype ch)
for (y = 0; y < win->maxy; y++)
for (x = 0; x < win->maxx; x++) {
/* Copy character if space */
if (ch & A_CHARTEXT && win->lines[y]->line[x].ch == ' ')
win->lines[y]->line[x].ch = ch & __CHARTEXT;
if (ch & A_CHARTEXT && win->alines[y]->line[x].ch == ' ')
win->alines[y]->line[x].ch = ch & __CHARTEXT;
/* Merge attributes */
if (win->lines[y]->line[x].attr & __ALTCHARSET)
win->lines[y]->line[x].attr =
if (win->alines[y]->line[x].attr & __ALTCHARSET)
win->alines[y]->line[x].attr =
(ch & __ATTRIBUTES) | __ALTCHARSET;
else
win->lines[y]->line[x].attr =
win->alines[y]->line[x].attr =
ch & __ATTRIBUTES;
#ifdef HAVE_WCHAR
SET_WCOL(win->lines[y]->line[x], 1);
SET_WCOL(win->alines[y]->line[x], 1);
#endif
}
__touchwin(win);

View File

@ -1,4 +1,4 @@
/* $NetBSD: border.c,v 1.11 2008/04/28 20:23:01 martin Exp $ */
/* $NetBSD: border.c,v 1.12 2009/07/22 16:57:14 roy Exp $ */
/*
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: border.c,v 1.11 2008/04/28 20:23:01 martin Exp $");
__RCSID("$NetBSD: border.c,v 1.12 2009/07/22 16:57:14 roy Exp $");
#endif /* not lint */
#include <stdlib.h>
@ -125,18 +125,18 @@ wborder(WINDOW *win, chtype left, chtype right, chtype top, chtype bottom,
endx = win->maxx - 1;
endy = win->maxy - 1;
fp = win->lines[0]->line;
lp = win->lines[endy]->line;
fp = win->alines[0]->line;
lp = win->alines[endy]->line;
/* Sides */
for (i = 1; i < endy; i++) {
win->lines[i]->line[0].ch = (wchar_t) left & __CHARTEXT;
win->lines[i]->line[0].attr = (attr_t) left & __ATTRIBUTES;
win->lines[i]->line[endx].ch = (wchar_t) right & __CHARTEXT;
win->lines[i]->line[endx].attr = (attr_t) right & __ATTRIBUTES;
win->alines[i]->line[0].ch = (wchar_t) left & __CHARTEXT;
win->alines[i]->line[0].attr = (attr_t) left & __ATTRIBUTES;
win->alines[i]->line[endx].ch = (wchar_t) right & __CHARTEXT;
win->alines[i]->line[endx].attr = (attr_t) right & __ATTRIBUTES;
#ifdef HAVE_WCHAR
SET_WCOL(win->lines[i]->line[0], 1);
SET_WCOL(win->lines[i]->line[endx], 1);
SET_WCOL(win->alines[i]->line[0], 1);
SET_WCOL(win->alines[i]->line[endx], 1);
#endif
}
for (i = 1; i < endx; i++) {
@ -273,75 +273,75 @@ int wborder_set(WINDOW *win, const cchar_t *ls, const cchar_t *rs,
/* left border */
cw = wcwidth( left.vals[ 0 ]);
for ( j = 0; j < cw; j++ ) {
win->lines[i]->line[j].ch = left.vals[ 0 ];
win->lines[i]->line[j].attr = left.attributes;
np = win->lines[i]->line[j].nsp;
win->alines[i]->line[j].ch = left.vals[ 0 ];
win->alines[i]->line[j].attr = left.attributes;
np = win->alines[i]->line[j].nsp;
if (np) {
while ( np ) {
tnp = np->next;
free( np );
np = tnp;
}
win->lines[i]->line[j].nsp = NULL;
win->alines[i]->line[j].nsp = NULL;
}
if ( j )
SET_WCOL( win->lines[i]->line[j], -j );
SET_WCOL( win->alines[i]->line[j], -j );
else {
SET_WCOL( win->lines[i]->line[j], cw );
SET_WCOL( win->alines[i]->line[j], cw );
if ( left.elements > 1 ) {
for (k = 1; k < left.elements; k++) {
np = (nschar_t *)malloc(sizeof(nschar_t));
if (!np)
return ERR;
np->ch = left.vals[ k ];
np->next = win->lines[i]->line[j].nsp;
win->lines[i]->line[j].nsp
np->next = win->alines[i]->line[j].nsp;
win->alines[i]->line[j].nsp
= np;
}
}
}
}
for ( j = cw; WCOL( win->lines[i]->line[j]) < 0; j++ ) {
for ( j = cw; WCOL( win->alines[i]->line[j]) < 0; j++ ) {
#ifdef DEBUG
__CTRACE(__CTRACE_INPUT,
"wborder_set: clean out partial char[%d]", j);
#endif /* DEBUG */
win->lines[i]->line[j].ch = ( wchar_t )btowc(win->bch);
win->alines[i]->line[j].ch = ( wchar_t )btowc(win->bch);
if (_cursesi_copy_nsp(win->bnsp,
&win->lines[i]->line[j]) == ERR)
&win->alines[i]->line[j]) == ERR)
return ERR;
SET_WCOL( win->lines[i]->line[j], 1 );
SET_WCOL( win->alines[i]->line[j], 1 );
}
/* right border */
cw = wcwidth( right.vals[ 0 ]);
pcw = WCOL( win->lines[i]->line[endx - cw]);
pcw = WCOL( win->alines[i]->line[endx - cw]);
for ( j = endx - cw + 1; j <= endx; j++ ) {
win->lines[i]->line[j].ch = right.vals[ 0 ];
win->lines[i]->line[j].attr = right.attributes;
np = win->lines[i]->line[j].nsp;
win->alines[i]->line[j].ch = right.vals[ 0 ];
win->alines[i]->line[j].attr = right.attributes;
np = win->alines[i]->line[j].nsp;
if (np) {
while ( np ) {
tnp = np->next;
free( np );
np = tnp;
}
win->lines[i]->line[j].nsp = NULL;
win->alines[i]->line[j].nsp = NULL;
}
if ( j == endx - cw + 1 ) {
SET_WCOL( win->lines[i]->line[j], cw );
SET_WCOL( win->alines[i]->line[j], cw );
if ( right.elements > 1 ) {
for (k = 1; k < right.elements; k++) {
np = (nschar_t *)malloc(sizeof(nschar_t));
if (!np)
return ERR;
np->ch = right.vals[ k ];
np->next = win->lines[i]->line[j].nsp;
win->lines[i]->line[j].nsp
np->next = win->alines[i]->line[j].nsp;
win->alines[i]->line[j].nsp
= np;
}
}
} else
SET_WCOL( win->lines[i]->line[j],
SET_WCOL( win->alines[i]->line[j],
endx - cw + 1 - j );
}
if ( pcw != 1 ) {
@ -352,13 +352,13 @@ int wborder_set(WINDOW *win, const cchar_t *ls, const cchar_t *rs,
#endif /* DEBUG */
k = pcw < 0 ? endx -cw + pcw : endx - cw;
for ( j = endx - cw; j >= k; j-- ) {
win->lines[i]->line[j].ch
win->alines[i]->line[j].ch
= (wchar_t)btowc(win->bch);
if (_cursesi_copy_nsp(win->bnsp,
&win->lines[i]->line[j]) == ERR)
&win->alines[i]->line[j]) == ERR)
return ERR;
win->lines[i]->line[j].attr = win->battr;
SET_WCOL( win->lines[i]->line[j], 1 );
win->alines[i]->line[j].attr = win->battr;
SET_WCOL( win->alines[i]->line[j], 1 );
}
}
}
@ -370,29 +370,29 @@ int wborder_set(WINDOW *win, const cchar_t *ls, const cchar_t *rs,
cw = wcwidth( top.vals[ 0 ]);
for (i = tlcw; i <= min( endx - cw, endx - trcw ); i += cw ) {
for ( j = 0; j < cw; j++ ) {
win->lines[ 0 ]->line[i + j].ch = top.vals[ 0 ];
win->lines[ 0 ]->line[i + j].attr = top.attributes;
np = win->lines[ 0 ]->line[i + j].nsp;
win->alines[ 0 ]->line[i + j].ch = top.vals[ 0 ];
win->alines[ 0 ]->line[i + j].attr = top.attributes;
np = win->alines[ 0 ]->line[i + j].nsp;
if (np) {
while ( np ) {
tnp = np->next;
free( np );
np = tnp;
}
win->lines[ 0 ]->line[i + j].nsp = NULL;
win->alines[ 0 ]->line[i + j].nsp = NULL;
}
if ( j )
SET_WCOL( win->lines[ 0 ]->line[ i + j ], -j );
SET_WCOL( win->alines[ 0 ]->line[ i + j ], -j );
else {
SET_WCOL( win->lines[ 0 ]->line[ i + j ], cw );
SET_WCOL( win->alines[ 0 ]->line[ i + j ], cw );
if ( top.elements > 1 ) {
for ( k = 1; k < top.elements; k++ ) {
np = (nschar_t *)malloc(sizeof(nschar_t));
if (!np)
return ERR;
np->ch = top.vals[ k ];
np->next = win->lines[0]->line[i + j].nsp;
win->lines[0]->line[i + j].nsp
np->next = win->alines[0]->line[i + j].nsp;
win->alines[0]->line[i + j].nsp
= np;
}
}
@ -400,54 +400,54 @@ int wborder_set(WINDOW *win, const cchar_t *ls, const cchar_t *rs,
}
}
while ( i <= endx - trcw ) {
win->lines[0]->line[i].ch =
win->alines[0]->line[i].ch =
( wchar_t )btowc(( int ) win->bch );
if (_cursesi_copy_nsp(win->bnsp,
&win->lines[0]->line[i]) == ERR)
&win->alines[0]->line[i]) == ERR)
return ERR;
win->lines[ 0 ]->line[ i ].attr = win->battr;
SET_WCOL( win->lines[ 0 ]->line[ i ], 1 );
win->alines[ 0 ]->line[ i ].attr = win->battr;
SET_WCOL( win->alines[ 0 ]->line[ i ], 1 );
i++;
}
/* lower border */
for (i = blcw; i <= min( endx - cw, endx - brcw ); i += cw ) {
for ( j = 0; j < cw; j++ ) {
win->lines[ endy ]->line[i + j].ch = bottom.vals[ 0 ];
win->lines[endy]->line[i + j].attr = bottom.attributes;
np = win->lines[ endy ]->line[i + j].nsp;
win->alines[ endy ]->line[i + j].ch = bottom.vals[ 0 ];
win->alines[endy]->line[i + j].attr = bottom.attributes;
np = win->alines[ endy ]->line[i + j].nsp;
if (np) {
while ( np ) {
tnp = np->next;
free( np );
np = tnp;
}
win->lines[ endy ]->line[i + j].nsp = NULL;
win->alines[ endy ]->line[i + j].nsp = NULL;
}
if ( j )
SET_WCOL( win->lines[endy]->line[i + j], -j);
SET_WCOL( win->alines[endy]->line[i + j], -j);
else {
SET_WCOL( win->lines[endy]->line[i + j], cw );
SET_WCOL( win->alines[endy]->line[i + j], cw );
if ( bottom.elements > 1 ) {
for ( k = 1; k < bottom.elements;
k++ ) {
if ( !( np = ( nschar_t *)malloc( sizeof( nschar_t ))))
return ERR;
np->ch = bottom.vals[ k ];
np->next = win->lines[endy]->line[i + j].nsp;
win->lines[endy]->line[i + j].nsp = np;
np->next = win->alines[endy]->line[i + j].nsp;
win->alines[endy]->line[i + j].nsp = np;
}
}
}
}
}
while ( i <= endx - brcw ) {
win->lines[endy]->line[i].ch =
win->alines[endy]->line[i].ch =
(wchar_t)btowc((int) win->bch );
if (_cursesi_copy_nsp(win->bnsp,
&win->lines[endy]->line[i]) == ERR)
&win->alines[endy]->line[i]) == ERR)
return ERR;
win->lines[ endy ]->line[ i ].attr = win->battr;
SET_WCOL( win->lines[ endy ]->line[ i ], 1 );
win->alines[ endy ]->line[ i ].attr = win->battr;
SET_WCOL( win->alines[ endy ]->line[ i ], 1 );
i++;
}
@ -455,21 +455,21 @@ int wborder_set(WINDOW *win, const cchar_t *ls, const cchar_t *rs,
if (!(win->maxx == LINES && win->maxy == COLS &&
(win->flags & __SCROLLOK) && (win->flags & __SCROLLWIN))) {
for ( i = 0; i < tlcw; i++ ) {
win->lines[ 0 ]->line[i].ch = topleft.vals[ 0 ];
win->lines[ 0 ]->line[i].attr = topleft.attributes;
np = win->lines[ 0 ]->line[i].nsp;
win->alines[ 0 ]->line[i].ch = topleft.vals[ 0 ];
win->alines[ 0 ]->line[i].attr = topleft.attributes;
np = win->alines[ 0 ]->line[i].nsp;
if (np) {
while ( np ) {
tnp = np->next;
free( np );
np = tnp;
}
win->lines[ 0 ]->line[i].nsp = NULL;
win->alines[ 0 ]->line[i].nsp = NULL;
}
if ( i )
SET_WCOL( win->lines[ 0 ]->line[ i ], -i );
SET_WCOL( win->alines[ 0 ]->line[ i ], -i );
else {
SET_WCOL( win->lines[ 0 ]->line[ i ], tlcw );
SET_WCOL( win->alines[ 0 ]->line[ i ], tlcw );
if ( topleft.elements > 1 ) {
for ( k = 1; k < topleft.elements;
k++ ) {
@ -477,27 +477,27 @@ int wborder_set(WINDOW *win, const cchar_t *ls, const cchar_t *rs,
if (!np)
return ERR;
np->ch = topleft.vals[ k ];
np->next = win->lines[ 0 ]->line[i].nsp;
win->lines[ 0 ]->line[i].nsp
np->next = win->alines[ 0 ]->line[i].nsp;
win->alines[ 0 ]->line[i].nsp
= np;
}
}
}
}
for ( i = endx - trcw + 1; i <= endx; i++ ) {
win->lines[ 0 ]->line[i].ch = topright.vals[ 0 ];
win->lines[ 0 ]->line[i].attr = topright.attributes;
np = win->lines[ 0 ]->line[i].nsp;
win->alines[ 0 ]->line[i].ch = topright.vals[ 0 ];
win->alines[ 0 ]->line[i].attr = topright.attributes;
np = win->alines[ 0 ]->line[i].nsp;
if (np) {
while ( np ) {
tnp = np->next;
free( np );
np = tnp;
}
win->lines[ 0 ]->line[i].nsp = NULL;
win->alines[ 0 ]->line[i].nsp = NULL;
}
if ( i == endx - trcw + 1 ) {
SET_WCOL( win->lines[ 0 ]->line[ i ], trcw );
SET_WCOL( win->alines[ 0 ]->line[ i ], trcw );
if ( topright.elements > 1 ) {
for ( k = 1; k < topright.elements;
k++ ) {
@ -505,31 +505,31 @@ int wborder_set(WINDOW *win, const cchar_t *ls, const cchar_t *rs,
if (!np)
return ERR;
np->ch = topright.vals[ k ];
np->next = win->lines[0]->line[i].nsp;
win->lines[ 0 ]->line[i].nsp
np->next = win->alines[0]->line[i].nsp;
win->alines[ 0 ]->line[i].nsp
= np;
}
}
} else
SET_WCOL( win->lines[ 0 ]->line[ i ],
SET_WCOL( win->alines[ 0 ]->line[ i ],
endx - trcw + 1 - i );
}
for ( i = 0; i < blcw; i++ ) {
win->lines[ endy ]->line[i].ch = botleft.vals[ 0 ];
win->lines[ endy ]->line[i].attr = botleft.attributes;
np = win->lines[ endy ]->line[i].nsp;
win->alines[ endy ]->line[i].ch = botleft.vals[ 0 ];
win->alines[ endy ]->line[i].attr = botleft.attributes;
np = win->alines[ endy ]->line[i].nsp;
if (np) {
while ( np ) {
tnp = np->next;
free( np );
np = tnp;
}
win->lines[ endy ]->line[i].nsp = NULL;
win->alines[ endy ]->line[i].nsp = NULL;
}
if ( i )
SET_WCOL( win->lines[endy]->line[i], -i );
SET_WCOL( win->alines[endy]->line[i], -i );
else {
SET_WCOL( win->lines[endy]->line[i], blcw );
SET_WCOL( win->alines[endy]->line[i], blcw );
if ( botleft.elements > 1 ) {
for ( k = 1; k < botleft.elements;
k++ ) {
@ -537,27 +537,27 @@ int wborder_set(WINDOW *win, const cchar_t *ls, const cchar_t *rs,
if (!np)
return ERR;
np->ch = botleft.vals[ k ];
np->next = win->lines[endy]->line[i].nsp;
win->lines[endy]->line[i].nsp
np->next = win->alines[endy]->line[i].nsp;
win->alines[endy]->line[i].nsp
= np;
}
}
}
}
for ( i = endx - brcw + 1; i <= endx; i++ ) {
win->lines[ endy ]->line[i].ch = botright.vals[ 0 ];
win->lines[ endy ]->line[i].attr = botright.attributes;
np = win->lines[ endy ]->line[i].nsp;
win->alines[ endy ]->line[i].ch = botright.vals[ 0 ];
win->alines[ endy ]->line[i].attr = botright.attributes;
np = win->alines[ endy ]->line[i].nsp;
if (np) {
while ( np ) {
tnp = np->next;
free( np );
np = tnp;
}
win->lines[ endy ]->line[i].nsp = NULL;
win->alines[ endy ]->line[i].nsp = NULL;
}
if ( i == endx - brcw + 1 ) {
SET_WCOL( win->lines[ endy ]->line[ i ],
SET_WCOL( win->alines[ endy ]->line[ i ],
brcw );
if ( botright.elements > 1 ) {
for ( k = 1; k < botright.elements; k++ ) {
@ -565,13 +565,13 @@ int wborder_set(WINDOW *win, const cchar_t *ls, const cchar_t *rs,
if (!np)
return ERR;
np->ch = botright.vals[ k ];
np->next = win->lines[endy]->line[i].nsp;
win->lines[endy]->line[i].nsp
np->next = win->alines[endy]->line[i].nsp;
win->alines[endy]->line[i].nsp
= np;
}
}
} else
SET_WCOL( win->lines[ endy ]->line[ i ],
SET_WCOL( win->alines[ endy ]->line[ i ],
endx - brcw + 1 - i );
}
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: chgat.c,v 1.3 2009/07/09 22:08:45 joerg Exp $ */
/* $NetBSD: chgat.c,v 1.4 2009/07/22 16:57:14 roy Exp $ */
/*
* Copyright (c) 2009 The NetBSD Foundation, Inc.
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__RCSID("$NetBSD: chgat.c,v 1.3 2009/07/09 22:08:45 joerg Exp $");
__RCSID("$NetBSD: chgat.c,v 1.4 2009/07/22 16:57:14 roy Exp $");
#include "curses.h"
#include "curses_private.h"
@ -71,7 +71,7 @@ mvwchgat(WINDOW *win , int y, int x, int count, attr_t attr, short color,
if (count < 0 || count > win->maxx - x)
count = win->maxx - x;
lp = win->lines[y];
lp = win->alines[y];
lc = &lp->line[x];
if (x + win->ch_off < *lp->firstchp)

View File

@ -1,4 +1,4 @@
/* $NetBSD: clrtobot.c,v 1.20 2007/05/29 11:10:56 blymn Exp $ */
/* $NetBSD: clrtobot.c,v 1.21 2009/07/22 16:57:14 roy Exp $ */
/*
* Copyright (c) 1981, 1993, 1994
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)clrtobot.c 8.2 (Berkeley) 5/4/94";
#else
__RCSID("$NetBSD: clrtobot.c,v 1.20 2007/05/29 11:10:56 blymn Exp $");
__RCSID("$NetBSD: clrtobot.c,v 1.21 2009/07/22 16:57:14 roy Exp $");
#endif
#endif /* not lint */
@ -70,7 +70,7 @@ wclrtobot(WINDOW *win)
#ifdef __GNUC__
maxx = NULL; /* XXX gcc -Wuninitialized */
#endif
if (win->lines[win->cury]->flags & __ISPASTEOL) {
if (win->alines[win->cury]->flags & __ISPASTEOL) {
starty = win->cury + 1;
startx = 0;
} else {
@ -83,8 +83,8 @@ wclrtobot(WINDOW *win)
attr = 0;
for (y = starty; y < win->maxy; y++) {
minx = -1;
end = &win->lines[y]->line[win->maxx];
for (sp = &win->lines[y]->line[startx]; sp < end; sp++) {
end = &win->alines[y]->line[win->maxx];
for (sp = &win->alines[y]->line[startx]; sp < end; sp++) {
#ifndef HAVE_WCHAR
if (sp->ch != win->bch || sp->attr != attr) {
#else
@ -93,7 +93,7 @@ wclrtobot(WINDOW *win)
#endif /* HAVE_WCHAR */
maxx = sp;
if (minx == -1)
minx = (int)(sp - win->lines[y]->line);
minx = (int)(sp - win->alines[y]->line);
sp->attr = attr;
#ifdef HAVE_WCHAR
sp->ch = ( wchar_t )btowc(( int ) win->bch);
@ -108,7 +108,7 @@ wclrtobot(WINDOW *win)
if (minx != -1)
__touchline(win, y, minx,
(int) (maxx - win->lines[y]->line));
(int) (maxx - win->alines[y]->line));
startx = 0;
}
return (OK);

View File

@ -1,4 +1,4 @@
/* $NetBSD: clrtoeol.c,v 1.24 2007/05/29 11:10:56 blymn Exp $ */
/* $NetBSD: clrtoeol.c,v 1.25 2009/07/22 16:57:14 roy Exp $ */
/*
* Copyright (c) 1981, 1993, 1994
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)clrtoeol.c 8.2 (Berkeley) 5/4/94";
#else
__RCSID("$NetBSD: clrtoeol.c,v 1.24 2007/05/29 11:10:56 blymn Exp $");
__RCSID("$NetBSD: clrtoeol.c,v 1.25 2009/07/22 16:57:14 roy Exp $");
#endif
#endif /* not lint */
@ -69,9 +69,9 @@ wclrtoeol(WINDOW *win)
y = win->cury;
x = win->curx;
if (win->lines[y]->flags & __ISPASTEOL) {
if (win->alines[y]->flags & __ISPASTEOL) {
if (y < win->maxy - 1) {
win->lines[y]->flags &= ~__ISPASTEOL;
win->alines[y]->flags &= ~__ISPASTEOL;
y++;
x = 0;
win->cury = y;
@ -79,9 +79,9 @@ wclrtoeol(WINDOW *win)
} else
return (OK);
}
end = &win->lines[y]->line[win->maxx];
end = &win->alines[y]->line[win->maxx];
minx = -1;
maxx = &win->lines[y]->line[x];
maxx = &win->alines[y]->line[x];
if (__using_color && win != curscr)
attr = win->battr & __COLOR;
else
@ -96,7 +96,7 @@ wclrtoeol(WINDOW *win)
#endif /* HAVE_WCHAR */
maxx = sp;
if (minx == -1)
minx = (int) (sp - win->lines[y]->line);
minx = (int) (sp - win->alines[y]->line);
sp->attr = attr;
#ifdef HAVE_WCHAR
sp->ch = ( wchar_t )btowc(( int ) win->bch);
@ -110,8 +110,8 @@ wclrtoeol(WINDOW *win)
#ifdef DEBUG
__CTRACE(__CTRACE_ERASE, "CLRTOEOL: y = %d, minx = %d, maxx = %d, "
"firstch = %d, lastch = %d\n",
y, minx, (int) (maxx - win->lines[y]->line),
*win->lines[y]->firstchp, *win->lines[y]->lastchp);
y, minx, (int) (maxx - win->alines[y]->line),
*win->alines[y]->firstchp, *win->alines[y]->lastchp);
#endif
/* Update firstch and lastch for the line. */
return (__touchline(win, y, x, (int) win->maxx - 1));

View File

@ -1,4 +1,4 @@
/* $NetBSD: color.c,v 1.33 2008/04/28 20:23:01 martin Exp $ */
/* $NetBSD: color.c,v 1.34 2009/07/22 16:57:14 roy Exp $ */
/*
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: color.c,v 1.33 2008/04/28 20:23:01 martin Exp $");
__RCSID("$NetBSD: color.c,v 1.34 2009/07/22 16:57:14 roy Exp $");
#endif /* not lint */
#include "curses.h"
@ -244,8 +244,8 @@ start_color(void)
win->battr |= __default_color;
for (y = 0; y < win->maxy; y++) {
for (x = 0; x < win->maxx; x++) {
win->lines[y]->line[x].attr &= ~__COLOR;
win->lines[y]->line[x].attr |= __default_color;
win->alines[y]->line[x].attr &= ~__COLOR;
win->alines[y]->line[x].attr |= __default_color;
}
}
__touchwin(win);
@ -489,12 +489,17 @@ assume_default_colors(short fore, short back)
return(OK);
}
/* no_color_video is a terminfo macro, but we need to retain binary compat */
#ifdef __strong_alias
#undef no_color_video
__strong_alias(no_color_video, no_color_attributes)
#endif
/*
* no_color_video --
* no_color_attributes --
* Return attributes that cannot be combined with color.
*/
attr_t
no_color_video(void)
no_color_attributes(void)
{
return(_cursesi_screen->nca);
}
@ -636,7 +641,7 @@ __change_pair(short pair)
"__change_pair: win == curscr\n");
#endif
for (y = 0; y < curscr->maxy; y++) {
lp = curscr->lines[y];
lp = curscr->alines[y];
for (x = 0; x < curscr->maxx; x++) {
if ((lp->line[x].attr & __COLOR) == cl)
lp->line[x].attr &= ~__COLOR;
@ -645,7 +650,7 @@ __change_pair(short pair)
} else {
/* Mark dirty those positions with colour pair "pair" */
for (y = 0; y < win->maxy; y++) {
lp = win->lines[y];
lp = win->alines[y];
for (x = 0; x < win->maxx; x++)
if ((lp->line[x].attr &
__COLOR) == cl) {
@ -662,12 +667,12 @@ __change_pair(short pair)
*lp->lastchp = x;
}
#ifdef DEBUG
if ((win->lines[y]->flags & __ISDIRTY))
if ((win->alines[y]->flags & __ISDIRTY))
__CTRACE(__CTRACE_COLOR,
"__change_pair: first = %d, "
"last = %d\n",
*win->lines[y]->firstchp,
*win->lines[y]->lastchp);
*win->alines[y]->firstchp,
*win->alines[y]->lastchp);
#endif
}
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: copywin.c,v 1.14 2007/11/08 06:39:31 jdc Exp $ */
/* $NetBSD: copywin.c,v 1.15 2009/07/22 16:57:14 roy Exp $ */
/*-
* Copyright (c) 1998-1999 Brett Lymn
@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: copywin.c,v 1.14 2007/11/08 06:39:31 jdc Exp $");
__RCSID("$NetBSD: copywin.c,v 1.15 2009/07/22 16:57:14 roy Exp $");
#endif /* not lint */
#include <ctype.h>
@ -102,7 +102,7 @@ int copywin(const WINDOW *srcwin, WINDOW *dstwin,
#endif
for (; dminrow <= dmaxrow; sminrow++, dminrow++) {
sp = &srcwin->lines[sminrow]->line[smincol];
sp = &srcwin->alines[sminrow]->line[smincol];
end = sp + dmaxcol - dmincol;
for (dcol = dmincol; sp <= end; dcol++, sp++) {
/* XXX: Perhaps this should check for the

View File

@ -1,4 +1,4 @@
/* $NetBSD: cr_put.c,v 1.27 2008/07/23 13:32:41 tnozaki Exp $ */
/* $NetBSD: cr_put.c,v 1.28 2009/07/22 16:57:14 roy Exp $ */
/*
* Copyright (c) 1981, 1993, 1994
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)cr_put.c 8.3 (Berkeley) 5/4/94";
#else
__RCSID("$NetBSD: cr_put.c,v 1.27 2008/07/23 13:32:41 tnozaki Exp $");
__RCSID("$NetBSD: cr_put.c,v 1.28 2009/07/22 16:57:14 roy Exp $");
#endif
#endif /* not lint */
@ -403,19 +403,19 @@ dontcr:while (outline < destline) {
plodcnt--;
else {
#ifndef HAVE_WCHAR
i = curscr->lines[outline]->line[outcol].ch
i = curscr->alines[outline]->line[outcol].ch
& __CHARTEXT;
if (curscr->lines[outline]->line[outcol].attr
if (curscr->alines[outline]->line[outcol].attr
== curscr->wattr)
__cputchar(i);
#else
if ((curscr->lines[outline]->line[outcol].attr
if ((curscr->alines[outline]->line[outcol].attr
& WA_ATTRIBUTES)
== curscr->wattr) {
switch (WCOL(curscr->lines[outline]->line[outcol])) {
switch (WCOL(curscr->alines[outline]->line[outcol])) {
case 1:
__cputwchar(curscr->lines[outline]->line[outcol].ch);
__cursesi_putnsp(curscr->lines[outline]->line[outcol].nsp,
__cputwchar(curscr->alines[outline]->line[outcol].ch);
__cursesi_putnsp(curscr->alines[outline]->line[outcol].nsp,
outline,
outcol);
#ifdef DEBUG
@ -423,8 +423,8 @@ dontcr:while (outline < destline) {
"plod: (%d,%d)WCOL(%d), "
"putwchar(%x)\n",
outline, outcol,
WCOL(curscr->lines[outline]->line[outcol]),
curscr->lines[outline]->line[outcol].ch);
WCOL(curscr->alines[outline]->line[outcol]),
curscr->alines[outline]->line[outcol].ch);
#endif /* DEBUG */
/*FALLTHROUGH*/
case 0:

View File

@ -1,4 +1,4 @@
/* $NetBSD: curses.c,v 1.22 2007/05/28 15:01:55 blymn Exp $ */
/* $NetBSD: curses.c,v 1.23 2009/07/22 16:57:14 roy Exp $ */
/*
* Copyright (c) 1981, 1993, 1994
@ -35,7 +35,7 @@
#if 0
static char sccsid[] = "@(#)curses.c 8.3 (Berkeley) 5/4/94";
#else
__RCSID("$NetBSD: curses.c,v 1.22 2007/05/28 15:01:55 blymn Exp $");
__RCSID("$NetBSD: curses.c,v 1.23 2009/07/22 16:57:14 roy Exp $");
#endif
#endif /* not lint */
@ -180,7 +180,7 @@ __cursesi_win_free_nsp(WINDOW *win)
__LDATA *sp;
for (i = 0; i < win->maxy; i++) {
for (sp = win->lines[i]->line, j = 0; j < win->maxx;
for (sp = win->alines[i]->line, j = 0; j < win->maxx;
j++, sp++) {
__cursesi_free_nsp(sp->nsp);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: curses.h,v 1.97 2009/07/07 10:16:52 joerg Exp $ */
/* $NetBSD: curses.h,v 1.98 2009/07/22 16:57:14 roy Exp $ */
/*
* Copyright (c) 1981, 1993, 1994
@ -691,7 +691,7 @@ WINDOW *newpad(int, int);
SCREEN *newterm(char *, FILE *, FILE *);
WINDOW *newwin(int, int, int, int);
int nl(void);
attr_t no_color_video(void);
attr_t no_color_attributes(void);
int nocbreak(void);
int nodelay(WINDOW *, bool);
int noecho(void);

View File

@ -1,4 +1,4 @@
.\" $NetBSD: curses_color.3,v 1.11 2008/04/30 13:10:51 martin Exp $
.\" $NetBSD: curses_color.3,v 1.12 2009/07/22 16:57:14 roy Exp $
.\" Copyright (c) 2002 The NetBSD Foundation, Inc.
.\" All rights reserved.
.\"
@ -25,7 +25,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd March 9, 2004
.Dd July 20, 2009
.Dt CURSES_COLOR 3
.Os
.Sh NAME
@ -39,7 +39,7 @@
.Nm PAIR_NUMBER ,
.Nm init_color ,
.Nm color_content ,
.Nm no_color_video
.Nm no_color_attributes
.Nd curses color manipulation routines
.Sh LIBRARY
.Lb libcurses
@ -64,7 +64,7 @@
.Ft int
.Fn color_content "short color" "short *red" "short *green" "short *blue"
.Ft attr_t
.Fn no_color_video void
.Fn no_color_attributes void
.Pp
.Va extern int COLOR_PAIRS ;
.Pp
@ -202,7 +202,7 @@ and
respectively.
.Pp
The function
.Fn no_color_video
.Fn no_color_attributes
returns those attributes that a terminal is unable to combine with color.
.Sh RETURN VALUES
The functions
@ -224,7 +224,7 @@ Curses library complies with the X/Open Curses specification, part of the
Single Unix Specification.
.Pp
The function
.Fn no_color_video
.Fn no_color_attributes
and the use of negative color numbers
are extensions to the X/Open Curses specification.
.Sh HISTORY

View File

@ -1,4 +1,4 @@
/* $NetBSD: curses_private.h,v 1.42 2008/04/14 20:34:36 jdc Exp $ */
/* $NetBSD: curses_private.h,v 1.43 2009/07/22 16:57:14 roy Exp $ */
/*-
* Copyright (c) 1998-2000 Brett Lymn
@ -139,7 +139,7 @@ struct __window { /* Window structure. */
int maxy, maxx; /* Maximum values for curx, cury. */
int reqy, reqx; /* Size requested when created */
int ch_off; /* x offset for firstch/lastch. */
__LINE **lines; /* Array of pointers to the lines */
__LINE **alines; /* Array of pointers to the lines */
__LINE *lspace; /* line space (for cleanup) */
__LDATA *wspace; /* window space (for cleanup) */
@ -298,7 +298,7 @@ struct __screen {
char *stdbuf;
unsigned int len;
int meta_state;
char pad_char;
char padchar;
char ttytype[128];
int endwin;
int notty;

View File

@ -1,4 +1,4 @@
/* $NetBSD: delch.c,v 1.21 2007/10/06 18:31:33 martin Exp $ */
/* $NetBSD: delch.c,v 1.22 2009/07/22 16:57:14 roy Exp $ */
/*
* Copyright (c) 1981, 1993, 1994
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)delch.c 8.2 (Berkeley) 5/4/94";
#else
__RCSID("$NetBSD: delch.c,v 1.21 2007/10/06 18:31:33 martin Exp $");
__RCSID("$NetBSD: delch.c,v 1.22 2009/07/22 16:57:14 roy Exp $");
#endif
#endif /* not lint */
@ -90,8 +90,8 @@ wdelch(WINDOW *win)
__LDATA *end, *temp1, *temp2;
#ifndef HAVE_WCHAR
end = &win->lines[win->cury]->line[win->maxx - 1];
temp1 = &win->lines[win->cury]->line[win->curx];
end = &win->alines[win->cury]->line[win->maxx - 1];
temp1 = &win->alines[win->cury]->line[win->curx];
temp2 = temp1 + 1;
while (temp1 < end) {
(void) memcpy(temp1, temp2, sizeof(__LDATA));
@ -108,9 +108,9 @@ wdelch(WINDOW *win)
int cw, sx;
nschar_t *np, *tnp;
end = &win->lines[win->cury]->line[win->maxx - 1];
end = &win->alines[win->cury]->line[win->maxx - 1];
sx = win->curx;
temp1 = &win->lines[win->cury]->line[win->curx];
temp1 = &win->alines[win->cury]->line[win->curx];
cw = WCOL( *temp1 );
if ( cw < 0 ) {
temp1 += cw;

View File

@ -1,4 +1,4 @@
/* $NetBSD: delwin.c,v 1.16 2007/05/28 15:01:55 blymn Exp $ */
/* $NetBSD: delwin.c,v 1.17 2009/07/22 16:57:14 roy Exp $ */
/*
* Copyright (c) 1981, 1993, 1994
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)delwin.c 8.2 (Berkeley) 5/4/94";
#else
__RCSID("$NetBSD: delwin.c,v 1.16 2007/05/28 15:01:55 blymn Exp $");
__RCSID("$NetBSD: delwin.c,v 1.17 2009/07/22 16:57:14 roy Exp $");
#endif
#endif /* not lint */
@ -101,7 +101,7 @@ delwin(WINDOW *win)
wp->nextp = win->nextp;
}
free(win->lspace);
free(win->lines);
free(win->alines);
if (win == _cursesi_screen->curscr)
_cursesi_screen->curscr = NULL;
if (win == _cursesi_screen->stdscr)

View File

@ -1,4 +1,4 @@
/* $NetBSD: erase.c,v 1.23 2007/05/28 15:01:55 blymn Exp $ */
/* $NetBSD: erase.c,v 1.24 2009/07/22 16:57:14 roy Exp $ */
/*
* Copyright (c) 1981, 1993, 1994
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)erase.c 8.2 (Berkeley) 5/4/94";
#else
__RCSID("$NetBSD: erase.c,v 1.23 2007/05/28 15:01:55 blymn Exp $");
__RCSID("$NetBSD: erase.c,v 1.24 2009/07/22 16:57:14 roy Exp $");
#endif
#endif /* not lint */
@ -77,7 +77,7 @@ werase(WINDOW *win)
else
attr = 0;
for (y = 0; y < win->maxy; y++) {
start = win->lines[y]->line;
start = win->alines[y]->line;
end = &start[win->maxx];
for (sp = start; sp < end; sp++)
#ifndef HAVE_WCHAR

View File

@ -1,4 +1,4 @@
/* $NetBSD: fileio.c,v 1.3 2008/05/24 16:37:49 christos Exp $ */
/* $NetBSD: fileio.c,v 1.4 2009/07/22 16:57:14 roy Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: fileio.c,v 1.3 2008/05/24 16:37:49 christos Exp $");
__RCSID("$NetBSD: fileio.c,v 1.4 2009/07/22 16:57:14 roy Exp $");
#endif /* not lint */
#include "curses.h"
@ -111,7 +111,7 @@ putwin(WINDOW *win, FILE *fp)
/* Lines and line data */
for (y = 0; y < win->maxy; y++)
for (sp = win->lines[y]->line, x = 0; x < win->maxx;
for (sp = win->alines[y]->line, x = 0; x < win->maxx;
x++, sp++) {
if (fwrite(&sp->ch, sizeof(wchar_t), 1, fp) != 1)
return ERR;
@ -220,7 +220,7 @@ getwin(FILE *fp)
/* Lines and line data */
for (y = 0; y < win->maxy; y++) {
for (sp = win->lines[y]->line, x = 0; x < win->maxx;
for (sp = win->alines[y]->line, x = 0; x < win->maxx;
x++, sp++) {
if (fread(&sp->ch, sizeof(wchar_t), 1, fp) != 1)
goto error1;

View File

@ -1,4 +1,4 @@
/* $NetBSD: id_subwins.c,v 1.13 2003/08/07 16:44:22 agc Exp $ */
/* $NetBSD: id_subwins.c,v 1.14 2009/07/22 16:57:14 roy Exp $ */
/*
* Copyright (c) 1981, 1993, 1994
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)id_subwins.c 8.2 (Berkeley) 5/4/94";
#else
__RCSID("$NetBSD: id_subwins.c,v 1.13 2003/08/07 16:44:22 agc Exp $");
__RCSID("$NetBSD: id_subwins.c,v 1.14 2009/07/22 16:57:14 roy Exp $");
#endif
#endif /* not lint */
@ -54,7 +54,7 @@ __id_subwins(WINDOW *orig)
for (win = orig->nextp; win != orig; win = win->nextp) {
oy = win->begy - orig->begy;
for (y = 0; y < win->maxy; y++)
win->lines[y]->line =
&orig->lines[oy + y]->line[win->ch_off];
win->alines[y]->line =
&orig->alines[oy + y]->line[win->ch_off];
}
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: in_wch.c,v 1.2 2007/05/28 15:01:55 blymn Exp $ */
/* $NetBSD: in_wch.c,v 1.3 2009/07/22 16:57:14 roy Exp $ */
/*
* Copyright (c) 2005 The NetBSD Foundation Inc.
@ -36,7 +36,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: in_wch.c,v 1.2 2007/05/28 15:01:55 blymn Exp $");
__RCSID("$NetBSD: in_wch.c,v 1.3 2009/07/22 16:57:14 roy Exp $");
#endif /* not lint */
#include "curses.h"
@ -98,7 +98,7 @@ win_wch(WINDOW *win, cchar_t *wcval)
return ERR;
#else
nschar_t *np;
__LDATA *lp = &win->lines[ win->cury ]->line[ win->curx ];
__LDATA *lp = &win->alines[ win->cury ]->line[ win->curx ];
int cw = WCOL( *lp );
if ( cw < 0 )

View File

@ -1,4 +1,4 @@
/* $NetBSD: in_wchstr.c,v 1.2 2007/05/28 15:01:56 blymn Exp $ */
/* $NetBSD: in_wchstr.c,v 1.3 2009/07/22 16:57:14 roy Exp $ */
/*
* Copyright (c) 2005 The NetBSD Foundation Inc.
@ -36,7 +36,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: in_wchstr.c,v 1.2 2007/05/28 15:01:56 blymn Exp $");
__RCSID("$NetBSD: in_wchstr.c,v 1.3 2009/07/22 16:57:14 roy Exp $");
#endif /* not lint */
#include "curses.h"
@ -161,7 +161,7 @@ win_wchnstr(WINDOW *win, cchar_t *wchstr, int n)
if (wchstr == NULL)
return ERR;
start = &win->lines[win->cury]->line[win->curx];
start = &win->alines[win->cury]->line[win->curx];
x = win->curx;
cw = WCOL(*start);
if (cw < 0) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: inch.c,v 1.8 2008/04/28 20:23:01 martin Exp $ */
/* $NetBSD: inch.c,v 1.9 2009/07/22 16:57:14 roy Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: inch.c,v 1.8 2008/04/28 20:23:01 martin Exp $");
__RCSID("$NetBSD: inch.c,v 1.9 2009/07/22 16:57:14 roy Exp $");
#endif /* not lint */
#include "curses.h"
@ -84,10 +84,10 @@ winch(WINDOW *win)
#ifndef HAVE_WCHAR
chtype ch;
ch = (chtype) (((win)->lines[(win)->cury]->line[(win)->curx].ch & __CHARTEXT) |
(chtype) ((win)->lines[(win)->cury]->line[(win)->curx].attr & __ATTRIBUTES));
ch = (chtype) (((win)->alines[(win)->cury]->line[(win)->curx].ch & __CHARTEXT) |
(chtype) ((win)->alines[(win)->cury]->line[(win)->curx].attr & __ATTRIBUTES));
return (ch);
#else
return ( chtype )win->lines[ win->cury ]->line[ win->curx ].ch;
return ( chtype )win->alines[ win->cury ]->line[ win->curx ].ch;
#endif /* HAVE_WCHAR */
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: inchstr.c,v 1.2 2002/01/02 10:38:28 blymn Exp $ */
/* $NetBSD: inchstr.c,v 1.3 2009/07/22 16:57:14 roy Exp $ */
/*
* Copyright 2001 Wasabi Systems, Inc.
@ -37,7 +37,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: inchstr.c,v 1.2 2002/01/02 10:38:28 blymn Exp $");
__RCSID("$NetBSD: inchstr.c,v 1.3 2009/07/22 16:57:14 roy Exp $");
#endif /* not lint */
#include "curses.h"
@ -134,14 +134,14 @@ winchnstr(WINDOW *win, chtype *chstr, int n)
if (chstr == NULL)
return ERR;
start = &win->lines[win->cury]->line[win->curx];
start = &win->alines[win->cury]->line[win->curx];
/* (n - 1) to leave room for the trailing 0 element */
if (n < 0 || (n - 1) > win->maxx - win->curx - 1)
epos = win->maxx - 1;
else
/* extra -1 for trailing NUL */
epos = win->curx + n -1 - 1;
end = &win->lines[win->cury]->line[epos];
end = &win->alines[win->cury]->line[epos];
while (start <= end) {
*chstr = start->ch;

View File

@ -1,4 +1,4 @@
/* $NetBSD: ins_wch.c,v 1.3 2007/05/29 11:10:56 blymn Exp $ */
/* $NetBSD: ins_wch.c,v 1.4 2009/07/22 16:57:15 roy Exp $ */
/*
* Copyright (c) 2005 The NetBSD Foundation Inc.
@ -36,7 +36,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: ins_wch.c,v 1.3 2007/05/29 11:10:56 blymn Exp $");
__RCSID("$NetBSD: ins_wch.c,v 1.4 2009/07/22 16:57:15 roy Exp $");
#endif /* not lint */
#include <string.h>
@ -117,9 +117,9 @@ wins_wch(WINDOW *win, const cchar_t *wch)
__CTRACE(__CTRACE_INPUT, "--before--\n");
for ( x = 0; x < win->maxx; x++ )
__CTRACE(__CTRACE_INPUT, "wins_wch: (0,%d)=(%x,%x,%p)\n", x,
win->lines[0]->line[x].ch,
win->lines[0]->line[x].attr,
win->lines[0]->line[x].nsp);
win->alines[0]->line[x].ch,
win->alines[0]->line[x].attr,
win->alines[0]->line[x].nsp);
#endif /* DEBUG */
x = win->curx;
y = win->cury;
@ -153,8 +153,8 @@ wins_wch(WINDOW *win, const cchar_t *wch)
/* locate current cell */
x = win->curx;
y = win->cury;
lnp = win->lines[ y ];
start = &win->lines[ y ]->line[ x ];
lnp = win->alines[ y ];
start = &win->alines[ y ]->line[ x ];
sx = x;
pcw = WCOL( *start );
if (pcw < 0) {
@ -172,7 +172,7 @@ wins_wch(WINDOW *win, const cchar_t *wch)
#ifdef DEBUG
__CTRACE(__CTRACE_INPUT, "wins_wch: shift all characters\n");
#endif /* DEBUG */
temp1 = &win->lines[ y ]->line[ win->maxx - 1 ];
temp1 = &win->alines[ y ]->line[ win->maxx - 1 ];
temp2 = temp1 - cw;
pcw = WCOL(*(temp2 + 1));
if (pcw < 0) {
@ -236,9 +236,9 @@ wins_wch(WINDOW *win, const cchar_t *wch)
for ( x = 0; x < win->maxx; x++ )
__CTRACE(__CTRACE_INPUT,
"wins_wch: (0,%d)=(%x,%x,%p)\n", x,
win->lines[0]->line[x].ch,
win->lines[0]->line[x].attr,
win->lines[0]->line[x].nsp);
win->alines[0]->line[x].ch,
win->alines[0]->line[x].attr,
win->alines[0]->line[x].nsp);
}
#endif /* DEBUG */
newx = win->maxx - 1 + win->ch_off;

View File

@ -1,4 +1,4 @@
/* $NetBSD: ins_wstr.c,v 1.3 2007/05/29 11:10:56 blymn Exp $ */
/* $NetBSD: ins_wstr.c,v 1.4 2009/07/22 16:57:15 roy Exp $ */
/*
* Copyright (c) 2005 The NetBSD Foundation Inc.
@ -36,7 +36,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: ins_wstr.c,v 1.3 2007/05/29 11:10:56 blymn Exp $");
__RCSID("$NetBSD: ins_wstr.c,v 1.4 2009/07/22 16:57:15 roy Exp $");
#endif /* not lint */
#include <string.h>
@ -163,9 +163,9 @@ wins_nwstr(WINDOW *win, const wchar_t *wstr, int n)
if (cw > win->maxx - win->curx + 1)
return ERR;
start = &win->lines[win->cury]->line[win->curx];
start = &win->alines[win->cury]->line[win->curx];
sx = win->curx;
lnp = win->lines[win->cury];
lnp = win->alines[win->cury];
pcw = WCOL(*start);
if (pcw < 0) {
sx += pcw;
@ -186,9 +186,9 @@ wins_nwstr(WINDOW *win, const wchar_t *wstr, int n)
__CTRACE(__CTRACE_INPUT,
"wins_nwstr: (%d,%d)=(%x,%x,%p)\n",
(int) win->cury, x,
win->lines[win->cury]->line[x].ch,
win->lines[win->cury]->line[x].attr,
win->lines[win->cury]->line[x].nsp);
win->alines[win->cury]->line[x].ch,
win->alines[win->cury]->line[x].attr,
win->alines[win->cury]->line[x].nsp);
}
#endif /* DEBUG */
@ -197,7 +197,7 @@ wins_nwstr(WINDOW *win, const wchar_t *wstr, int n)
#ifdef DEBUG
__CTRACE(__CTRACE_INPUT, "wins_nwstr: shift all characters\n");
#endif /* DEBUG */
temp1 = &win->lines[win->cury]->line[win->maxx - 1];
temp1 = &win->alines[win->cury]->line[win->maxx - 1];
temp2 = temp1 - width;
pcw = WCOL(*(temp2 + 1));
if (pcw < 0) {
@ -231,9 +231,9 @@ wins_nwstr(WINDOW *win, const wchar_t *wstr, int n)
__CTRACE(__CTRACE_INPUT,
"wins_nwstr: (%d,%d)=(%x,%x,%p)\n",
(int) win->cury, x,
win->lines[win->cury]->line[x].ch,
win->lines[win->cury]->line[x].attr,
win->lines[win->cury]->line[x].nsp);
win->alines[win->cury]->line[x].ch,
win->alines[win->cury]->line[x].attr,
win->alines[win->cury]->line[x].nsp);
}
#endif /* DEBUG */
}
@ -311,9 +311,9 @@ wins_nwstr(WINDOW *win, const wchar_t *wstr, int n)
__CTRACE(__CTRACE_INPUT,
"wins_nwstr: (%d,%d)=(%x,%x,%p)\n",
(int) win->cury, x,
win->lines[win->cury]->line[x].ch,
win->lines[win->cury]->line[x].attr,
win->lines[win->cury]->line[x].nsp);
win->alines[win->cury]->line[x].ch,
win->alines[win->cury]->line[x].attr,
win->alines[win->cury]->line[x].nsp);
}
#endif /* DEBUG */
newx = win->maxx - 1 + win->ch_off;

View File

@ -1,4 +1,4 @@
/* $NetBSD: insch.c,v 1.21 2007/05/28 15:01:56 blymn Exp $ */
/* $NetBSD: insch.c,v 1.22 2009/07/22 16:57:15 roy Exp $ */
/*
* Copyright (c) 1981, 1993, 1994
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)insch.c 8.2 (Berkeley) 5/4/94";
#else
__RCSID("$NetBSD: insch.c,v 1.21 2007/05/28 15:01:56 blymn Exp $");
__RCSID("$NetBSD: insch.c,v 1.22 2009/07/22 16:57:15 roy Exp $");
#endif
#endif /* not lint */
@ -96,8 +96,8 @@ winsch(WINDOW *win, chtype ch)
attr = win->battr & __COLOR;
else
attr = 0;
end = &win->lines[win->cury]->line[win->curx];
temp1 = &win->lines[win->cury]->line[win->maxx - 1];
end = &win->alines[win->cury]->line[win->curx];
temp1 = &win->alines[win->cury]->line[win->maxx - 1];
temp2 = temp1 - 1;
while (temp1 > end) {
(void) memcpy(temp1, temp2, sizeof(__LDATA));
@ -118,8 +118,8 @@ winsch(WINDOW *win, chtype ch)
#endif /* HAVE_WCHAR */
__touchline(win, (int) win->cury, (int) win->curx, (int) win->maxx - 1);
if (win->cury == LINES - 1 &&
(win->lines[LINES - 1]->line[COLS - 1].ch != ' ' ||
win->lines[LINES - 1]->line[COLS - 1].attr != attr)) {
(win->alines[LINES - 1]->line[COLS - 1].ch != ' ' ||
win->alines[LINES - 1]->line[COLS - 1].attr != attr)) {
if (win->flags & __SCROLLOK) {
wrefresh(win);
scroll(win);

View File

@ -1,4 +1,4 @@
/* $NetBSD: insdelln.c,v 1.15 2008/04/28 20:23:01 martin Exp $ */
/* $NetBSD: insdelln.c,v 1.16 2009/07/22 16:57:15 roy Exp $ */
/*
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: insdelln.c,v 1.15 2008/04/28 20:23:01 martin Exp $");
__RCSID("$NetBSD: insdelln.c,v 1.16 2009/07/22 16:57:15 roy Exp $");
#endif /* not lint */
/*
@ -53,9 +53,9 @@ __RCSID("$NetBSD: insdelln.c,v 1.15 2008/04/28 20:23:01 martin Exp $");
* Insert or delete lines on stdscr, leaving (cury, curx) unchanged.
*/
int
insdelln(int lines)
insdelln(int nlines)
{
return winsdelln(stdscr, lines);
return winsdelln(stdscr, nlines);
}
#endif
@ -65,7 +65,7 @@ insdelln(int lines)
* Insert or delete lines on the window, leaving (cury, curx) unchanged.
*/
int
winsdelln(WINDOW *win, int lines)
winsdelln(WINDOW *win, int nlines)
{
int y, i, last;
__LINE *temp;
@ -76,10 +76,10 @@ winsdelln(WINDOW *win, int lines)
#ifdef DEBUG
__CTRACE(__CTRACE_LINE,
"winsdelln: (%p) cury=%d lines=%d\n", win, win->cury, lines);
"winsdelln: (%p) cury=%d lines=%d\n", win, win->cury, nlines);
#endif
if (!lines)
if (!nlines)
return(OK);
if (__using_color && win != curscr)
@ -87,42 +87,42 @@ winsdelln(WINDOW *win, int lines)
else
attr = 0;
if (lines > 0) {
if (nlines > 0) {
/* Insert lines */
if (win->cury < win->scr_t || win->cury > win->scr_b) {
/* Outside scrolling region */
if (lines > win->maxy - win->cury)
lines = win->maxy - win->cury;
if (nlines > win->maxy - win->cury)
nlines = win->maxy - win->cury;
last = win->maxy - 1;
} else {
/* Inside scrolling region */
if (lines > win->scr_b + 1 - win->cury)
lines = win->scr_b + 1 - win->cury;
if (nlines > win->scr_b + 1 - win->cury)
nlines = win->scr_b + 1 - win->cury;
last = win->scr_b;
}
for (y = last - lines; y >= win->cury; --y) {
win->lines[y]->flags &= ~__ISPASTEOL;
win->lines[y + lines]->flags &= ~__ISPASTEOL;
for (y = last - nlines; y >= win->cury; --y) {
win->alines[y]->flags &= ~__ISPASTEOL;
win->alines[y + nlines]->flags &= ~__ISPASTEOL;
if (win->orig == NULL) {
temp = win->lines[y + lines];
win->lines[y + lines] = win->lines[y];
win->lines[y] = temp;
temp = win->alines[y + nlines];
win->alines[y + nlines] = win->alines[y];
win->alines[y] = temp;
} else {
(void) memcpy(win->lines[y + lines]->line,
win->lines[y]->line,
(void) memcpy(win->alines[y + nlines]->line,
win->alines[y]->line,
(size_t) win->maxx * __LDATASIZE);
}
}
for (y = win->cury - 1 + lines; y >= win->cury; --y)
for (y = win->cury - 1 + nlines; y >= win->cury; --y)
for (i = 0; i < win->maxx; i++) {
win->lines[y]->line[i].ch = win->bch;
win->lines[y]->line[i].attr = attr;
win->alines[y]->line[i].ch = win->bch;
win->alines[y]->line[i].attr = attr;
#ifndef HAVE_WCHAR
win->lines[y]->line[i].ch = win->bch;
win->alines[y]->line[i].ch = win->bch;
#else
win->lines[y]->line[i].ch
win->alines[y]->line[i].ch
= ( wchar_t )btowc(( int ) win->bch );
lp = &win->lines[y]->line[i];
lp = &win->alines[y]->line[i];
if (_cursesi_copy_nsp(win->bnsp, lp) == ERR)
return ERR;
SET_WCOL( *lp, 1 );
@ -131,42 +131,42 @@ winsdelln(WINDOW *win, int lines)
for (y = last; y >= win->cury; --y)
__touchline(win, y, 0, (int) win->maxx - 1);
} else {
/* Delete lines */
lines = 0 - lines;
/* Delete nlines */
nlines = 0 - nlines;
if (win->cury < win->scr_t || win->cury > win->scr_b) {
/* Outside scrolling region */
if (lines > win->maxy - win->cury)
lines = win->maxy - win->cury;
if (nlines > win->maxy - win->cury)
nlines = win->maxy - win->cury;
last = win->maxy;
} else {
/* Inside scrolling region */
if (lines > win->scr_b + 1 - win->cury)
lines = win->scr_b + 1 - win->cury;
if (nlines > win->scr_b + 1 - win->cury)
nlines = win->scr_b + 1 - win->cury;
last = win->scr_b + 1;
}
for (y = win->cury; y < last - lines; y++) {
win->lines[y]->flags &= ~__ISPASTEOL;
win->lines[y + lines]->flags &= ~__ISPASTEOL;
for (y = win->cury; y < last - nlines; y++) {
win->alines[y]->flags &= ~__ISPASTEOL;
win->alines[y + nlines]->flags &= ~__ISPASTEOL;
if (win->orig == NULL) {
temp = win->lines[y];
win->lines[y] = win->lines[y + lines];
win->lines[y + lines] = temp;
temp = win->alines[y];
win->alines[y] = win->alines[y + nlines];
win->alines[y + nlines] = temp;
} else {
(void) memcpy(win->lines[y]->line,
win->lines[y + lines]->line,
(void) memcpy(win->alines[y]->line,
win->alines[y + nlines]->line,
(size_t) win->maxx * __LDATASIZE);
}
}
for (y = last - lines; y < last; y++)
for (y = last - nlines; y < last; y++)
for (i = 0; i < win->maxx; i++) {
win->lines[y]->line[i].ch = win->bch;
win->lines[y]->line[i].attr = attr;
win->alines[y]->line[i].ch = win->bch;
win->alines[y]->line[i].attr = attr;
#ifndef HAVE_WCHAR
win->lines[y]->line[i].ch = win->bch;
win->alines[y]->line[i].ch = win->bch;
#else
win->lines[y]->line[i].ch
win->alines[y]->line[i].ch
= (wchar_t)btowc((int) win->bch);
lp = &win->lines[y]->line[i];
lp = &win->alines[y]->line[i];
SET_WCOL( *lp, 1 );
if (_cursesi_copy_nsp(win->bnsp, lp) == ERR)
return ERR;

View File

@ -1,4 +1,4 @@
/* $NetBSD: insstr.c,v 1.2 2007/05/28 15:01:56 blymn Exp $ */
/* $NetBSD: insstr.c,v 1.3 2009/07/22 16:57:15 roy Exp $ */
/*
* Copyright (c) 2005 The NetBSD Foundation Inc.
@ -36,7 +36,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: insstr.c,v 1.2 2007/05/28 15:01:56 blymn Exp $");
__RCSID("$NetBSD: insstr.c,v 1.3 2009/07/22 16:57:15 roy Exp $");
#endif /* not lint */
#include <string.h>
@ -153,12 +153,12 @@ winsnstr(WINDOW *win, const char *str, int n)
#endif /* DEBUG */
/* move string */
end = &win->lines[win->cury]->line[win->curx];
end = &win->alines[win->cury]->line[win->curx];
if ( len < win->maxx - win->curx ) {
#ifdef DEBUG
__CTRACE(__CTRACE_INPUT, "winsnstr: shift %d cells\n", len);
#endif /* DEBUG */
temp1 = &win->lines[win->cury]->line[win->maxx - 1];
temp1 = &win->alines[win->cury]->line[win->maxx - 1];
temp2 = temp1 - len;
while (temp2 >= end) {
#ifdef HAVE_WCHAR
@ -193,12 +193,12 @@ winsnstr(WINDOW *win, const char *str, int n)
for ( i = win->curx; i < win->curx + len; i++ ) {
__CTRACE(__CTRACE_INPUT,
"winsnstr: (%d,%d)=('%c',%x)\n", win->cury, i,
win->lines[win->cury]->line[i].ch,
win->lines[win->cury]->line[i].attr);
win->alines[win->cury]->line[i].ch,
win->alines[win->cury]->line[i].attr);
}
}
#endif /* DEBUG */
lnp = win->lines[ win->cury ];
lnp = win->alines[ win->cury ];
lnp->flags |= __ISDIRTY;
if ( win->ch_off < *lnp->firstchp )
*lnp->firstchp = win->ch_off;

View File

@ -1,4 +1,4 @@
/* $NetBSD: instr.c,v 1.2 2002/01/02 10:38:28 blymn Exp $ */
/* $NetBSD: instr.c,v 1.3 2009/07/22 16:57:15 roy Exp $ */
/*
* Copyright 2001 Wasabi Systems, Inc.
@ -37,7 +37,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: instr.c,v 1.2 2002/01/02 10:38:28 blymn Exp $");
__RCSID("$NetBSD: instr.c,v 1.3 2009/07/22 16:57:15 roy Exp $");
#endif /* not lint */
#include "curses.h"
@ -142,7 +142,7 @@ winnstr(WINDOW *win, char *str, int n)
if (str == NULL)
return ERR;
start = &win->lines[win->cury]->line[win->curx];
start = &win->alines[win->cury]->line[win->curx];
/* (n - 1) to leave room for the trailing NUL */
if (n < 0 || (n - 1) > win->maxx - win->curx - 1) {
epos = win->maxx - 1;
@ -152,7 +152,7 @@ winnstr(WINDOW *win, char *str, int n)
epos = win->curx + n - 1 - 1;
n--;
}
end = &win->lines[win->cury]->line[epos];
end = &win->alines[win->cury]->line[epos];
while (start <= end) {
*str = start->ch & __CHARTEXT;

View File

@ -1,4 +1,4 @@
/* $NetBSD: inwstr.c,v 1.2 2007/05/28 15:01:56 blymn Exp $ */
/* $NetBSD: inwstr.c,v 1.3 2009/07/22 16:57:15 roy Exp $ */
/*
* Copyright (c) 2005 The NetBSD Foundation Inc.
@ -36,7 +36,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: inwstr.c,v 1.2 2007/05/28 15:01:56 blymn Exp $");
__RCSID("$NetBSD: inwstr.c,v 1.3 2009/07/22 16:57:15 roy Exp $");
#endif /* not lint */
#include "curses.h"
@ -165,7 +165,7 @@ winnwstr(WINDOW *win, wchar_t *wstr, int n)
if (wstr == NULL)
return ERR;
start = &win->lines[win->cury]->line[win->curx];
start = &win->alines[win->cury]->line[win->curx];
x = win->curx;
cw = WCOL( *start );
if (cw < 0) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: move.c,v 1.15 2007/01/21 13:25:36 jdc Exp $ */
/* $NetBSD: move.c,v 1.16 2009/07/22 16:57:15 roy Exp $ */
/*
* Copyright (c) 1981, 1993, 1994
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)move.c 8.2 (Berkeley) 5/4/94";
#else
__RCSID("$NetBSD: move.c,v 1.15 2007/01/21 13:25:36 jdc Exp $");
__RCSID("$NetBSD: move.c,v 1.16 2009/07/22 16:57:15 roy Exp $");
#endif
#endif /* not lint */
@ -70,8 +70,8 @@ wmove(WINDOW *win, int y, int x)
if (x >= win->maxx || y >= win->maxy)
return (ERR);
win->curx = x;
win->lines[win->cury]->flags &= ~__ISPASTEOL;
win->alines[win->cury]->flags &= ~__ISPASTEOL;
win->cury = y;
win->lines[y]->flags &= ~__ISPASTEOL;
win->alines[y]->flags &= ~__ISPASTEOL;
return (OK);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: newwin.c,v 1.46 2008/04/14 20:33:15 jdc Exp $ */
/* $NetBSD: newwin.c,v 1.47 2009/07/22 16:57:15 roy Exp $ */
/*
* Copyright (c) 1981, 1993, 1994
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)newwin.c 8.3 (Berkeley) 7/27/94";
#else
__RCSID("$NetBSD: newwin.c,v 1.46 2008/04/14 20:33:15 jdc Exp $");
__RCSID("$NetBSD: newwin.c,v 1.47 2009/07/22 16:57:15 roy Exp $");
#endif
#endif /* not lint */
@ -148,7 +148,7 @@ __newwin(SCREEN *screen, int nlines, int ncols, int by, int bx, int ispad)
#endif
for (i = 0; i < maxy; i++) {
lp = win->lines[i];
lp = win->alines[i];
if (ispad)
lp->flags = __ISDIRTY;
else
@ -232,8 +232,8 @@ __set_subwin(WINDOW *orig, WINDOW *win)
win->ch_off = win->begx - orig->begx;
/* Point line pointers to line space. */
for (lp = win->lspace, i = 0; i < win->maxy; i++, lp++) {
win->lines[i] = lp;
olp = orig->lines[i + win->begy - orig->begy];
win->alines[i] = lp;
olp = orig->alines[i + win->begy - orig->begy];
#ifdef DEBUG
lp->sentinel = SENTINEL_VALUE;
#endif
@ -294,12 +294,12 @@ __makenew(SCREEN *screen, int nlines, int ncols, int by, int bx, int sub,
#endif
/* Set up line pointer array and line space. */
if ((win->lines = malloc(nlines * sizeof(__LINE *))) == NULL) {
if ((win->alines = malloc(nlines * sizeof(__LINE *))) == NULL) {
free(win);
return NULL;
}
if ((win->lspace = malloc(nlines * sizeof(__LINE))) == NULL) {
free(win->lines);
free(win->alines);
free(win);
return NULL;
}
@ -313,7 +313,7 @@ __makenew(SCREEN *screen, int nlines, int ncols, int by, int bx, int sub,
if ((win->wspace =
malloc(ncols * nlines * sizeof(__LDATA))) == NULL) {
free(win->lspace);
free(win->lines);
free(win->alines);
free(win);
return NULL;
}
@ -323,7 +323,7 @@ __makenew(SCREEN *screen, int nlines, int ncols, int by, int bx, int sub,
if ((wlp = malloc(sizeof(struct __winlist))) == NULL) {
free(win->wspace);
free(win->lspace);
free(win->lines);
free(win->alines);
free(win);
return NULL;
}
@ -342,7 +342,7 @@ __makenew(SCREEN *screen, int nlines, int ncols, int by, int bx, int sub,
* window space.
*/
for (lp = win->lspace, i = 0; i < nlines; i++, lp++) {
win->lines[i] = lp;
win->alines[i] = lp;
lp->line = &win->wspace[i * ncols];
#ifdef DEBUG
lp->sentinel = SENTINEL_VALUE;

View File

@ -1,4 +1,4 @@
/* $NetBSD: pause.c,v 1.8 2008/04/28 20:23:01 martin Exp $ */
/* $NetBSD: pause.c,v 1.9 2009/07/22 16:57:15 roy Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: pause.c,v 1.8 2008/04/28 20:23:01 martin Exp $");
__RCSID("$NetBSD: pause.c,v 1.9 2009/07/22 16:57:15 roy Exp $");
#endif /* not lint */
#include <stdarg.h>
@ -71,7 +71,7 @@ delay_output(int ms)
#ifdef DEBUG
__CTRACE(__CTRACE_MISC, "delay_output: %d\n", ms);
#endif
if (!_cursesi_screen->pad_char)
if (!_cursesi_screen->padchar)
return(napms(ms));
if (asprintf(&delstr, "%d", ms) == -1)

View File

@ -1,4 +1,4 @@
/* $NetBSD: refresh.c,v 1.70 2008/06/13 03:18:04 yamt Exp $ */
/* $NetBSD: refresh.c,v 1.71 2009/07/22 16:57:15 roy Exp $ */
/*
* Copyright (c) 1981, 1993, 1994
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)refresh.c 8.7 (Berkeley) 8/13/94";
#else
__RCSID("$NetBSD: refresh.c,v 1.70 2008/06/13 03:18:04 yamt Exp $");
__RCSID("$NetBSD: refresh.c,v 1.71 2009/07/22 16:57:15 roy Exp $");
#endif
#endif /* not lint */
@ -174,10 +174,10 @@ _cursesi_wnoutrefresh(SCREEN *screen, WINDOW *win, int begy, int begx,
orig, sub_win);
#endif
for (sy = 0; sy < sub_win->maxy; sy++) {
if (sub_win->lines[sy]->flags == __ISDIRTY) {
orig->lines[sy + sub_win->begy - orig->begy]->flags
if (sub_win->alines[sy]->flags == __ISDIRTY) {
orig->alines[sy + sub_win->begy - orig->begy]->flags
|= __ISDIRTY;
sub_win->lines[sy]->flags
sub_win->alines[sy]->flags
&= ~__ISDIRTY;
}
}
@ -203,7 +203,7 @@ _cursesi_wnoutrefresh(SCREEN *screen, WINDOW *win, int begy, int begx,
for (wy = begy, y_off = wbegy; wy < maxy &&
y_off < screen->__virtscr->maxy; wy++, y_off++) {
wlp = win->lines[wy];
wlp = win->alines[wy];
#ifdef DEBUG
__CTRACE(__CTRACE_REFRESH,
"_wnoutrefresh: wy %d\tf %d\tl %d\tflags %x\n",
@ -211,7 +211,7 @@ _cursesi_wnoutrefresh(SCREEN *screen, WINDOW *win, int begy, int begx,
#endif
if ((wlp->flags & __ISDIRTY) == 0)
continue;
vlp = screen->__virtscr->lines[y_off];
vlp = screen->__virtscr->alines[y_off];
if (*wlp->firstchp < maxx + win->ch_off &&
*wlp->lastchp >= win->ch_off) {
@ -413,7 +413,7 @@ doupdate(void)
if (!_cursesi_screen->curwin) {
for (wy = 0; wy < win->maxy; wy++) {
wlp = win->lines[wy];
wlp = win->alines[wy];
if (wlp->flags & __ISDIRTY) {
#ifndef HAVE_WCHAR
wlp->hash = __hash(wlp->line,
@ -477,7 +477,7 @@ doupdate(void)
* in the window are dirty.
*/
for (wy = 0, dnum = 0; wy < win->maxy; wy++)
if (win->lines[wy]->flags & __ISDIRTY)
if (win->alines[wy]->flags & __ISDIRTY)
dnum++;
if (!__noqch && dnum > (int) win->maxy / 4)
quickch();
@ -495,35 +495,35 @@ doupdate(void)
for (i = 0; i < curscr->maxy; i++) {
__CTRACE(__CTRACE_REFRESH, "C: %d:", i);
__CTRACE(__CTRACE_REFRESH, " 0x%x \n",
curscr->lines[i]->hash);
curscr->alines[i]->hash);
for (j = 0; j < curscr->maxx; j++)
__CTRACE(__CTRACE_REFRESH, "%c",
curscr->lines[i]->line[j].ch);
curscr->alines[i]->line[j].ch);
__CTRACE(__CTRACE_REFRESH, "\n");
__CTRACE(__CTRACE_REFRESH, " attr:");
for (j = 0; j < curscr->maxx; j++)
__CTRACE(__CTRACE_REFRESH, " %x",
curscr->lines[i]->line[j].attr);
curscr->alines[i]->line[j].attr);
__CTRACE(__CTRACE_REFRESH, "\n");
__CTRACE(__CTRACE_REFRESH, "W: %d:", i);
__CTRACE(__CTRACE_REFRESH, " 0x%x \n",
win->lines[i]->hash);
win->alines[i]->hash);
__CTRACE(__CTRACE_REFRESH, " 0x%x ",
win->lines[i]->flags);
win->alines[i]->flags);
for (j = 0; j < win->maxx; j++)
__CTRACE(__CTRACE_REFRESH, "%c",
win->lines[i]->line[j].ch);
win->alines[i]->line[j].ch);
__CTRACE(__CTRACE_REFRESH, "\n");
__CTRACE(__CTRACE_REFRESH, " attr:");
for (j = 0; j < win->maxx; j++)
__CTRACE(__CTRACE_REFRESH, " %x",
win->lines[i]->line[j].attr);
win->alines[i]->line[j].attr);
__CTRACE(__CTRACE_REFRESH, "\n");
#ifdef HAVE_WCHAR
__CTRACE(__CTRACE_REFRESH, " nsp:");
for (j = 0; j < curscr->maxx; j++)
__CTRACE(__CTRACE_REFRESH, " %p",
win->lines[i]->line[j].nsp);
win->alines[i]->line[j].nsp);
__CTRACE(__CTRACE_REFRESH, "\n");
__CTRACE(__CTRACE_REFRESH, " bnsp:");
for (j = 0; j < curscr->maxx; j++)
@ -536,7 +536,7 @@ doupdate(void)
#endif /* DEBUG */
for (wy = 0; wy < win->maxy; wy++) {
wlp = win->lines[wy];
wlp = win->alines[wy];
/* XXX: remove this debug */
#ifdef DEBUG
__CTRACE(__CTRACE_REFRESH,
@ -544,7 +544,7 @@ doupdate(void)
wy, *wlp->firstchp, *wlp->lastchp, wlp->flags);
#endif /* DEBUG */
if (!_cursesi_screen->curwin)
curscr->lines[wy]->hash = wlp->hash;
curscr->alines[wy]->hash = wlp->hash;
if (wlp->flags & __ISDIRTY) {
#ifdef DEBUG
__CTRACE(__CTRACE_REFRESH,
@ -611,12 +611,12 @@ doupdate(void)
__CTRACE(__CTRACE_REFRESH,
"[%d,%d](%x,%x,%p)-(%x,%x,%p)\n",
i, j,
curscr->lines[i]->line[j].ch,
curscr->lines[i]->line[j].attr,
curscr->lines[i]->line[j].nsp,
_cursesi_screen->__virtscr->lines[i]->line[j].ch,
_cursesi_screen->__virtscr->lines[i]->line[j].attr,
_cursesi_screen->__virtscr->lines[i]->line[j].nsp);
curscr->alines[i]->line[j].ch,
curscr->alines[i]->line[j].attr,
curscr->alines[i]->line[j].nsp,
_cursesi_screen->__virtscr->alines[i]->line[j].ch,
_cursesi_screen->__virtscr->alines[i]->line[j].attr,
_cursesi_screen->__virtscr->alines[i]->line[j].nsp);
}
}
#endif /* HAVE_WCHAR */
@ -664,8 +664,8 @@ makech(int wy)
"[makech-before]wy=%d,curscr(%p)-__virtscr(%p)\n",
wy, curscr, __virtscr);
for (x = 0; x < curscr->maxx; x++) {
lp = &curscr->lines[wy]->line[x];
vlp = &__virtscr->lines[wy]->line[x];
lp = &curscr->alines[wy]->line[x];
vlp = &__virtscr->alines[wy]->line[x];
__CTRACE(__CTRACE_REFRESH,
"[%d,%d](%x,%x,%x,%x,%p)-"
"(%x,%x,%x,%x,%p)\n",
@ -678,19 +678,19 @@ makech(int wy)
#endif /* HAVE_WCHAR */
#endif /* DEBUG */
/* Is the cursor still on the end of the last line? */
if (wy > 0 && curscr->lines[wy - 1]->flags & __ISPASTEOL) {
if (wy > 0 && curscr->alines[wy - 1]->flags & __ISPASTEOL) {
domvcur(_cursesi_screen->ly, _cursesi_screen->lx,
_cursesi_screen->ly + 1, 0);
_cursesi_screen->ly++;
_cursesi_screen->lx = 0;
}
wx = *win->lines[wy]->firstchp;
wx = *win->alines[wy]->firstchp;
if (wx < 0)
wx = 0;
else
if (wx >= win->maxx)
return (OK);
lch = *win->lines[wy]->lastchp;
lch = *win->alines[wy]->lastchp;
if (lch < 0)
return (OK);
else
@ -703,14 +703,14 @@ makech(int wy)
__CTRACE(__CTRACE_REFRESH, "makech: csp is blank\n");
#endif /* DEBUG */
} else {
csp = &curscr->lines[wy]->line[wx];
csp = &curscr->alines[wy]->line[wx];
#ifdef DEBUG
__CTRACE(__CTRACE_REFRESH,
"makech: csp is on curscr:(%d,%d)\n", wy, wx);
#endif /* DEBUG */
}
nsp = &win->lines[wy]->line[wx];
nsp = &win->alines[wy]->line[wx];
#ifdef DEBUG
if ( _cursesi_screen->curwin )
__CTRACE(__CTRACE_REFRESH,
@ -720,22 +720,22 @@ makech(int wy)
"makech: nsp is at __virtscr:(%d,%d)\n", wy, wx);
#endif /* DEBUG */
if (__tc_ce && !_cursesi_screen->curwin) {
cp = &win->lines[wy]->line[win->maxx - 1];
cp = &win->alines[wy]->line[win->maxx - 1];
lspc = cp->attr & __COLOR;
#ifndef HAVE_WCHAR
while (cp->ch == ' ' && cp->attr == lspc) /* XXX */
if (cp-- <= win->lines[wy]->line)
if (cp-- <= win->alines[wy]->line)
break;
#else
while (cp->ch == ( wchar_t )btowc(( int )' ' )
&& ( cp->attr & WA_ATTRIBUTES ) == lspc)
if (cp-- <= win->lines[wy]->line)
if (cp-- <= win->alines[wy]->line)
break;
#endif /* HAVE_WCHAR */
if (win->lines[wy]->line > cp)
if (win->alines[wy]->line > cp)
nlsp = 0;
else
nlsp = cp - win->lines[wy]->line;
nlsp = cp - win->alines[wy]->line;
}
if (!_cursesi_screen->curwin)
ce = __tc_ce;
@ -802,7 +802,7 @@ makech(int wy)
#endif
/* Check for clear to end-of-line. */
cep = &curscr->lines[wy]->line[win->maxx - 1];
cep = &curscr->alines[wy]->line[win->maxx - 1];
#ifndef HAVE_WCHAR
while (cep->ch == ' ' && cep->attr == lspc) /* XXX */
#else
@ -811,7 +811,7 @@ makech(int wy)
#endif /* HAVE_WCHAR */
if (cep-- <= csp)
break;
clsp = cep - curscr->lines[wy]->line -
clsp = cep - curscr->alines[wy]->line -
win->begx * __LDATASIZE;
#ifdef DEBUG
__CTRACE(__CTRACE_REFRESH,
@ -1115,8 +1115,8 @@ makech(int wy)
"makech-after: curscr(%p)-__virtscr(%p)\n",
curscr, __virtscr );
for (x = 0; x < curscr->maxx; x++) {
lp = &curscr->lines[wy]->line[x];
vlp = &__virtscr->lines[wy]->line[x];
lp = &curscr->alines[wy]->line[x];
vlp = &__virtscr->alines[wy]->line[x];
__CTRACE(__CTRACE_REFRESH,
"[%d,%d](%x,%x,%x,%x,%p)-"
"(%x,%x,%x,%x,%p)\n",
@ -1180,45 +1180,45 @@ quickch(void)
*/
for (top = 0; top < __virtscr->maxy; top++)
#ifndef HAVE_WCHAR
if (__virtscr->lines[top]->flags & __ISDIRTY &&
(__virtscr->lines[top]->hash != curscr->lines[top]->hash ||
memcmp(__virtscr->lines[top]->line,
curscr->lines[top]->line,
if (__virtscr->alines[top]->flags & __ISDIRTY &&
(__virtscr->alines[top]->hash != curscr->alines[top]->hash ||
memcmp(__virtscr->alines[top]->line,
curscr->alines[top]->line,
(size_t) __virtscr->maxx * __LDATASIZE)
!= 0))
break;
#else
if (__virtscr->lines[top]->flags & __ISDIRTY &&
(__virtscr->lines[top]->hash != curscr->lines[top]->hash ||
!linecmp(__virtscr->lines[top]->line,
curscr->lines[top]->line,
if (__virtscr->alines[top]->flags & __ISDIRTY &&
(__virtscr->alines[top]->hash != curscr->alines[top]->hash ||
!linecmp(__virtscr->alines[top]->line,
curscr->alines[top]->line,
(size_t) __virtscr->maxx )))
break;
#endif /* HAVE_WCHAR */
else
__virtscr->lines[top]->flags &= ~__ISDIRTY;
__virtscr->alines[top]->flags &= ~__ISDIRTY;
/*
* Find how many lines from bottom of screen are unchanged.
*/
for (bot = __virtscr->maxy - 1; bot >= 0; bot--)
#ifndef HAVE_WCHAR
if (__virtscr->lines[bot]->flags & __ISDIRTY &&
(__virtscr->lines[bot]->hash != curscr->lines[bot]->hash ||
memcmp(__virtscr->lines[bot]->line,
curscr->lines[bot]->line,
if (__virtscr->alines[bot]->flags & __ISDIRTY &&
(__virtscr->alines[bot]->hash != curscr->alines[bot]->hash ||
memcmp(__virtscr->alines[bot]->line,
curscr->alines[bot]->line,
(size_t) __virtscr->maxx * __LDATASIZE)
!= 0))
break;
#else
if (__virtscr->lines[bot]->flags & __ISDIRTY &&
(__virtscr->lines[bot]->hash != curscr->lines[bot]->hash ||
!linecmp(__virtscr->lines[bot]->line,
curscr->lines[bot]->line,
if (__virtscr->alines[bot]->flags & __ISDIRTY &&
(__virtscr->alines[bot]->hash != curscr->alines[bot]->hash ||
!linecmp(__virtscr->alines[bot]->line,
curscr->alines[bot]->line,
(size_t) __virtscr->maxx )))
break;
#endif /* HAVE_WCHAR */
else
__virtscr->lines[bot]->flags &= ~__ISDIRTY;
__virtscr->alines[bot]->flags &= ~__ISDIRTY;
/*
* Work round an xterm bug where inserting lines causes all the
@ -1226,11 +1226,11 @@ quickch(void)
* set on the first line (even if we unset it for subsequent
* lines).
*/
bcolor = __virtscr->lines[min(top,
bcolor = __virtscr->alines[min(top,
__virtscr->maxy - 1)]->line[0].attr & __COLOR;
for (i = top + 1, j = 0; i < bot; i++) {
if ((__virtscr->lines[i]->line[0].attr & __COLOR) != bcolor) {
bcolor = __virtscr->lines[i]->line[__virtscr->maxx].
if ((__virtscr->alines[i]->line[0].attr & __COLOR) != bcolor) {
bcolor = __virtscr->alines[i]->line[__virtscr->maxx].
attr & __COLOR;
j = i - top;
} else
@ -1269,22 +1269,22 @@ quickch(void)
starts++) {
for (curw = startw, curs = starts;
curs < starts + bsize; curw++, curs++)
if (__virtscr->lines[curw]->hash !=
curscr->lines[curs]->hash)
if (__virtscr->alines[curw]->hash !=
curscr->alines[curs]->hash)
break;
if (curs != starts + bsize)
continue;
for (curw = startw, curs = starts;
curs < starts + bsize; curw++, curs++)
#ifndef HAVE_WCHAR
if (memcmp(__virtscr->lines[curw]->line,
curscr->lines[curs]->line,
if (memcmp(__virtscr->alines[curw]->line,
curscr->alines[curs]->line,
(size_t) __virtscr->maxx *
__LDATASIZE) != 0)
break;
#else
if (!linecmp(__virtscr->lines[curw]->line,
curscr->lines[curs]->line,
if (!linecmp(__virtscr->alines[curw]->line,
curscr->alines[curs]->line,
(size_t) __virtscr->maxx))
break;
#endif /* HAVE_WCHAR */
@ -1319,29 +1319,29 @@ done:
__CTRACE(__CTRACE_REFRESH, "#####################################\n");
for (i = 0; i < curscr->maxy; i++) {
__CTRACE(__CTRACE_REFRESH, "C: %d:", i);
__CTRACE(__CTRACE_REFRESH, " 0x%x \n", curscr->lines[i]->hash);
__CTRACE(__CTRACE_REFRESH, " 0x%x \n", curscr->alines[i]->hash);
for (j = 0; j < curscr->maxx; j++)
__CTRACE(__CTRACE_REFRESH, "%c",
curscr->lines[i]->line[j].ch);
curscr->alines[i]->line[j].ch);
__CTRACE(__CTRACE_REFRESH, "\n");
__CTRACE(__CTRACE_REFRESH, " attr:");
for (j = 0; j < curscr->maxx; j++)
__CTRACE(__CTRACE_REFRESH, " %x",
curscr->lines[i]->line[j].attr);
curscr->alines[i]->line[j].attr);
__CTRACE(__CTRACE_REFRESH, "\n");
__CTRACE(__CTRACE_REFRESH, "W: %d:", i);
__CTRACE(__CTRACE_REFRESH, " 0x%x \n",
__virtscr->lines[i]->hash);
__virtscr->alines[i]->hash);
__CTRACE(__CTRACE_REFRESH, " 0x%x ",
__virtscr->lines[i]->flags);
__virtscr->alines[i]->flags);
for (j = 0; j < __virtscr->maxx; j++)
__CTRACE(__CTRACE_REFRESH, "%c",
__virtscr->lines[i]->line[j].ch);
__virtscr->alines[i]->line[j].ch);
__CTRACE(__CTRACE_REFRESH, "\n");
__CTRACE(__CTRACE_REFRESH, " attr:");
for (j = 0; j < __virtscr->maxx; j++)
__CTRACE(__CTRACE_REFRESH, " %x",
__virtscr->lines[i]->line[j].attr);
__virtscr->alines[i]->line[j].attr);
__CTRACE(__CTRACE_REFRESH, "\n");
}
#endif
@ -1412,14 +1412,14 @@ done:
*/
sc_region = bot - top + 1;
i = top;
tmp1 = curscr->lines[top];
tmp1 = curscr->alines[top];
cur_period = top;
for (j = top; j <= bot; j++) {
target = (i - top + n + sc_region) % sc_region + top;
tmp2 = curscr->lines[target];
curscr->lines[target] = tmp1;
tmp2 = curscr->alines[target];
curscr->alines[target] = tmp1;
/* Mark block as clean and blank out scrolled lines. */
clp = curscr->lines[target];
clp = curscr->alines[target];
#ifdef DEBUG
__CTRACE(__CTRACE_REFRESH,
"quickch: n=%d startw=%d curw=%d i = %d target=%d ",
@ -1430,7 +1430,7 @@ done:
#ifdef DEBUG
__CTRACE(__CTRACE_REFRESH, " notdirty\n");
#endif
__virtscr->lines[target]->flags &= ~__ISDIRTY;
__virtscr->alines[target]->flags &= ~__ISDIRTY;
} else
if ((n > 0 && target >= top && target < top + n) ||
(n < 0 && target <= bot && target > bot + n)) {
@ -1475,7 +1475,7 @@ done:
}
if (target == cur_period) {
i = target + 1;
tmp1 = curscr->lines[i];
tmp1 = curscr->alines[i];
cur_period = i;
} else {
tmp1 = tmp2;
@ -1488,12 +1488,12 @@ done:
__CTRACE(__CTRACE_REFRESH, "C: %d:", i);
for (j = 0; j < curscr->maxx; j++)
__CTRACE(__CTRACE_REFRESH, "%c",
curscr->lines[i]->line[j].ch);
curscr->alines[i]->line[j].ch);
__CTRACE(__CTRACE_REFRESH, "\n");
__CTRACE(__CTRACE_REFRESH, "W: %d:", i);
for (j = 0; j < __virtscr->maxx; j++)
__CTRACE(__CTRACE_REFRESH, "%c",
__virtscr->lines[i]->line[j].ch);
__virtscr->alines[i]->line[j].ch);
__CTRACE(__CTRACE_REFRESH, "\n");
}
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: resize.c,v 1.19 2008/04/29 17:46:39 jdc Exp $ */
/* $NetBSD: resize.c,v 1.20 2009/07/22 16:57:15 roy Exp $ */
/*
* Copyright (c) 2001
@ -40,7 +40,7 @@
#if 0
static char sccsid[] = "@(#)resize.c blymn 2001/08/26";
#else
__RCSID("$NetBSD: resize.c,v 1.19 2008/04/29 17:46:39 jdc Exp $");
__RCSID("$NetBSD: resize.c,v 1.20 2009/07/22 16:57:15 roy Exp $");
#endif
#endif /* not lint */
@ -233,10 +233,10 @@ __resizewin(WINDOW *win, int nlines, int ncols)
nlines = ncols = 0;
else {
/* Reallocate line pointer array and line space. */
newlines = realloc(win->lines, nlines * sizeof(__LINE *));
newlines = realloc(win->alines, nlines * sizeof(__LINE *));
if (newlines == NULL)
return ERR;
win->lines = newlines;
win->alines = newlines;
newlspace = realloc(win->lspace, nlines * sizeof(__LINE));
if (newlspace == NULL)
@ -262,7 +262,7 @@ __resizewin(WINDOW *win, int nlines, int ncols)
* window space.
*/
for (lp = win->lspace, i = 0; i < nlines; i++, lp++) {
win->lines[i] = lp;
win->alines[i] = lp;
lp->line = &win->wspace[i * ncols];
#ifdef DEBUG
lp->sentinel = SENTINEL_VALUE;
@ -278,8 +278,8 @@ __resizewin(WINDOW *win, int nlines, int ncols)
win->ch_off = win->begx - win->orig->begx;
/* Point line pointers to line space. */
for (lp = win->lspace, i = 0; i < nlines; i++, lp++) {
win->lines[i] = lp;
olp = win->orig->lines[i + win->begy - win->orig->begy];
win->alines[i] = lp;
olp = win->orig->alines[i + win->begy - win->orig->begy];
lp->line = &olp->line[win->ch_off];
#ifdef DEBUG
lp->sentinel = SENTINEL_VALUE;
@ -304,7 +304,7 @@ __resizewin(WINDOW *win, int nlines, int ncols)
* so this is no big deal.
*/
for (i = 0; i < win->maxy; i++) {
lp = win->lines[i];
lp = win->alines[i];
for (sp = lp->line, j = 0; j < win->maxx; j++, sp++) {
sp->attr = 0;
#ifndef HAVE_WCHAR

View File

@ -1,4 +1,4 @@
/* $NetBSD: scroll.c,v 1.19 2007/01/21 13:25:36 jdc Exp $ */
/* $NetBSD: scroll.c,v 1.20 2009/07/22 16:57:15 roy Exp $ */
/*
* Copyright (c) 1981, 1993, 1994
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)scroll.c 8.3 (Berkeley) 5/4/94";
#else
__RCSID("$NetBSD: scroll.c,v 1.19 2007/01/21 13:25:36 jdc Exp $");
__RCSID("$NetBSD: scroll.c,v 1.20 2009/07/22 16:57:15 roy Exp $");
#endif
#endif /* not lint */
@ -58,9 +58,9 @@ scroll(WINDOW *win)
* Scroll stdscr n lines - up if n is positive, down if n is negative.
*/
int
scrl(int lines)
scrl(int nlines)
{
return wscrl(stdscr, lines);
return wscrl(stdscr, nlines);
}
/*
@ -80,7 +80,7 @@ setscrreg(int top, int bottom)
* Scroll a window n lines - up if n is positive, down if n is negative.
*/
int
wscrl(WINDOW *win, int lines)
wscrl(WINDOW *win, int nlines)
{
int oy, ox;
@ -90,7 +90,7 @@ wscrl(WINDOW *win, int lines)
if (!(win->flags & __SCROLLOK))
return (ERR);
if (!lines)
if (!nlines)
return (OK);
getyx(win, oy, ox);
@ -103,7 +103,7 @@ wscrl(WINDOW *win, int lines)
else
/* Inside scrolling region */
wmove(win, win->scr_t, 0);
winsdelln(win, 0 - lines);
winsdelln(win, 0 - nlines);
wmove(win, oy, ox);
if (win == curscr) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: setterm.c,v 1.44 2009/02/22 20:05:48 christos Exp $ */
/* $NetBSD: setterm.c,v 1.45 2009/07/22 16:57:15 roy Exp $ */
/*
* Copyright (c) 1981, 1993, 1994
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)setterm.c 8.8 (Berkeley) 10/25/94";
#else
__RCSID("$NetBSD: setterm.c,v 1.44 2009/02/22 20:05:48 christos Exp $");
__RCSID("$NetBSD: setterm.c,v 1.45 2009/07/22 16:57:15 roy Exp $");
#endif
#endif /* not lint */
@ -203,7 +203,7 @@ _cursesi_setterm(char *type, SCREEN *screen)
* set the pad char, only take the first char of the pc capability
* as this is all we can use.
*/
screen->pad_char = screen->tc_pc ? screen->tc_pc[0] : 0;
screen->padchar = screen->tc_pc ? screen->tc_pc[0] : 0;
/* Get full name of terminal */
if (unknown) {
@ -343,7 +343,7 @@ _cursesi_resetterm(SCREEN *screen)
__GT = screen->GT;
__CA = screen->CA;
PC = screen->pad_char;
PC = screen->padchar;
__noqch = screen->noqch;
__mask_op = screen->mask_op;

View File

@ -1,4 +1,4 @@
/* $NetBSD: touchwin.c,v 1.24 2007/05/28 15:01:58 blymn Exp $ */
/* $NetBSD: touchwin.c,v 1.25 2009/07/22 16:57:15 roy Exp $ */
/*
* Copyright (c) 1981, 1993, 1994
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)touchwin.c 8.2 (Berkeley) 5/4/94";
#else
__RCSID("$NetBSD: touchwin.c,v 1.24 2007/05/28 15:01:58 blymn Exp $");
__RCSID("$NetBSD: touchwin.c,v 1.25 2009/07/22 16:57:15 roy Exp $");
#endif
#endif /* not lint */
@ -51,7 +51,7 @@ is_linetouched(WINDOW *win, int line)
if (line > win->maxy)
return FALSE;
return ((win->lines[line]->flags & __ISDIRTY) != 0);
return ((win->alines[line]->flags & __ISDIRTY) != 0);
}
/*
@ -159,7 +159,7 @@ wtouchln(WINDOW *win, int line, int n, int changed)
if (changed == 1)
__touchline(win, y, 0, (int) win->maxx - 1);
else {
wlp = win->lines[y];
wlp = win->alines[y];
if (*wlp->firstchp >= win->ch_off &&
*wlp->firstchp < win->maxx + win->ch_off)
*wlp->firstchp = win->maxx + win->ch_off;
@ -194,20 +194,20 @@ __touchline(WINDOW *win, int y, int sx, int ex)
__CTRACE(__CTRACE_LINE, "__touchline: (%p, %d, %d, %d)\n",
win, y, sx, ex);
__CTRACE(__CTRACE_LINE, "__touchline: first = %d, last = %d\n",
*win->lines[y]->firstchp, *win->lines[y]->lastchp);
*win->alines[y]->firstchp, *win->alines[y]->lastchp);
#endif
sx += win->ch_off;
ex += win->ch_off;
if (!(win->lines[y]->flags & __ISDIRTY))
win->lines[y]->flags |= __ISDIRTY;
if (!(win->alines[y]->flags & __ISDIRTY))
win->alines[y]->flags |= __ISDIRTY;
/* firstchp/lastchp are shared between parent window and sub-window. */
if (*win->lines[y]->firstchp > sx)
*win->lines[y]->firstchp = sx;
if (*win->lines[y]->lastchp < ex)
*win->lines[y]->lastchp = ex;
if (*win->alines[y]->firstchp > sx)
*win->alines[y]->firstchp = sx;
if (*win->alines[y]->lastchp < ex)
*win->alines[y]->lastchp = ex;
#ifdef DEBUG
__CTRACE(__CTRACE_LINE, "__touchline: first = %d, last = %d\n",
*win->lines[y]->firstchp, *win->lines[y]->lastchp);
*win->alines[y]->firstchp, *win->alines[y]->lastchp);
#endif
return (OK);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: tstp.c,v 1.36 2007/08/27 19:54:29 jdc Exp $ */
/* $NetBSD: tstp.c,v 1.37 2009/07/22 16:57:15 roy Exp $ */
/*
* Copyright (c) 1981, 1993, 1994
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)tstp.c 8.3 (Berkeley) 5/4/94";
#else
__RCSID("$NetBSD: tstp.c,v 1.36 2007/08/27 19:54:29 jdc Exp $");
__RCSID("$NetBSD: tstp.c,v 1.37 2009/07/22 16:57:15 roy Exp $");
#endif
#endif /* not lint */
@ -253,7 +253,7 @@ void
__restartwin(void)
{
struct winsize win;
int lines, cols;
int nlines, ncols;
#ifdef DEBUG
__CTRACE(__CTRACE_MISC, "__restartwin\n");
@ -287,12 +287,12 @@ __restartwin(void)
* We need to make local copies of LINES and COLS, otherwise we
* could lose if they are changed between wresize() calls.
*/
lines = LINES;
cols = COLS;
if (curscr->maxy != lines || curscr->maxx != cols)
wresize(curscr, lines, cols);
if (stdscr->maxy != lines || stdscr->maxx != cols)
wresize(stdscr, lines, cols);
nlines = LINES;
ncols = COLS;
if (curscr->maxy != nlines || curscr->maxx != ncols)
wresize(curscr, nlines, ncols);
if (stdscr->maxy != nlines || stdscr->maxx != ncols)
wresize(stdscr, nlines, ncols);
/* save the new "default" terminal state */
(void) tcgetattr(fileno(_cursesi_screen->infd),