Upgrade to version 1.8.6

This commit is contained in:
Andrey A. Chernov 1994-12-02 06:40:24 +00:00
parent 766ee5695e
commit 795172f7a5
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=4898
69 changed files with 2290 additions and 1373 deletions

View File

@ -1,18 +1,19 @@
/***************************************************************************
* COPYRIGHT NOTICE *
* COPYRIGHT NOTICE *
****************************************************************************
* ncurses is copyright (C) 1992, 1993, 1994 *
* by Zeyd M. Ben-Halim *
* zmbenhal@netcom.com *
* ncurses is copyright (C) 1992, 1993, 1994 *
* by Zeyd M. Ben-Halim *
* zmbenhal@netcom.com *
* *
* Permission is hereby granted to reproduce and distribute ncurses *
* by any means and for any fee, whether alone or as part of a *
* larger distribution, in source or in binary form, PROVIDED *
* this notice remains in the sources and is reproduced in any *
* documentation accompanying it or the applications linked with it. *
* Any other use of ncurses, including incorporating it in another *
* product is subject to written permission. *
* this notice is included with any such distribution, not removed *
* from header files, and is reproduced in any documentation *
* accompanying it or the applications linked with it. *
* *
* ncurses comes AS IS with no warranty, implied or expressed. *
* *
***************************************************************************/

View File

@ -2,7 +2,7 @@
BEGIN {
print ""
print "#include <stdlib.h>"
print "#include <ncurses.h>"
print "#include \"curses.h\""
print ""
print "struct kn {"
print "\tchar *name;"

View File

@ -1,8 +1,8 @@
# Makefile for ncurses
# $Id: Makefile,v 1.6 1994/10/28 06:56:55 ache Exp $
# $Id: Makefile,v 1.7 1994/11/29 02:48:17 ache Exp $
LIB= ncurses
SRCS= lib_kernel.c lib_pad.c\
SRCS= lib_kernel.c lib_pad.c lib_bkgd.c \
lib_unctrl.c lib_raw.c lib_vidattr.c lib_trace.c lib_beep.c \
lib_doupdate.c lib_refresh.c lib_initscr.c lib_newwin.c lib_addch.c \
lib_addstr.c lib_scroll.c lib_clreol.c lib_touch.c lib_mvcur.c lib_keyname.c\
@ -13,7 +13,7 @@ SRCS= lib_kernel.c lib_pad.c\
lib_newterm.c lib_set_term.c lib_overlay.c lib_scrreg.c lib_color.c \
lib_insstr.c lib_insdel.c lib_twait.c copyright.c
CFLAGS+= -I. -I${.CURDIR} -Wall -DMYTINFO -DTERMIOS -DGOOD_SELECT -DBSDTABS
CFLAGS+= -I. -I${.CURDIR} -Wall -DMYTINFO -DGOOD_SELECT
LDADD+= -lmytinfo
CLEANFILES+= lib_keyname.c keys.tries
@ -21,10 +21,13 @@ CLEANFILES+= lib_keyname.c keys.tries
beforedepend: keys.tries
beforeinstall:
@cd ${.CURDIR}; for i in ncurses.h unctrl.h termcap.h; do \
@cd ${.CURDIR}; for i in unctrl.h termcap.h; do \
cmp -s $$i ${DESTDIR}/usr/include/$$i || \
$(INSTALL) $(COPY) -m 444 -o $(BINOWN) -g $(BINGRP) $$i \
${DESTDIR}/usr/include; done
@cd ${.CURDIR}; cmp -s curses.h ${DESTDIR}/usr/include/ncurses.h || \
$(INSTALL) $(COPY) -m 444 -o $(BINOWN) -g $(BINGRP) curses.h \
${DESTDIR}/usr/include/ncurses.h
keys.tries: ${.CURDIR}/keys.list ${.CURDIR}/MKkeys.awk
awk -f ${.CURDIR}/MKkeys.awk ${.CURDIR}/keys.list > keys.tries

View File

@ -1,10 +1,12 @@
NCURSES 1.8.6 - July 24, 1994
-----------------------------
This file is intended to help people interested in working
on fixing ncurses, enhancing it, or porting it to other
platforms.
PORTABILITY:
The file matrix is an attempt and centralizing all portability
information. The top line contains the different options, down
The file matrix is an attempt at centralizing all portability
information. The top line lists the different options, down
the leftside are the operating systems supported. If an option
is not needed then it should have an entry of NONE. Note the
use of ':' to terminate each field. If somebody knows awk better
@ -23,13 +25,14 @@ SRCDIR: the directory where the terminfo database lives
CC: ANSI C compiler
FLAGS: standard compiler flags
EXTRA: extra flags needed by individual systems
Linux: -DBROKEN_TCDRAIN tcdrain() is broken on Linux
Sun: -DSUNIOCTL <sys/ioctl.h> conflicts with <termios.h>
HP-UX: -D_HPUX_SOURCE so that we get POSIX and XOPEN features.
SVR4: -DBROKEN_TIOCGETWINSZ guess what?
AIX: -DSYS_SELECT if you need <sys/select.h>
BASE: The directory under which headers and libraries will
be installed.
INSTALL: The name of an intelligent install program. GNU install works.
INSTALL: The name of an install program similar to BSD's (ie. understands
-m, -g, -o, etc.) GNU install works.
The awk script in script.src reads matrix and generates all the Config.*
files.

View File

@ -19,4 +19,3 @@ worm.c - worms run all over your screen
firework.c - multi-colored fireworks
newdemo.c - a demo from the PDCurses people
testcurs.c - a test from the PDCurses people
This will fail to link on machines that don't have vsscanf().

File diff suppressed because it is too large Load Diff

View File

@ -15,6 +15,11 @@
#include <unistd.h>
#endif
#define YBASE 10
#define XBASE 10
#define XLENGTH 54
#define YDEPTH 5
/* it won't be */
long now; /* yeah! */
struct tm *tm;
@ -64,6 +69,7 @@ int n = 0;
start_color();
init_pair(1, COLOR_BLACK, COLOR_RED);
init_pair(2, COLOR_RED, COLOR_BLACK);
init_pair(3, COLOR_WHITE, COLOR_BLACK);
attrset(COLOR_PAIR(2));
}
@ -75,6 +81,26 @@ int n = 0;
else
n = atoi(*argv);
}
if(hascolor) {
attrset(COLOR_PAIR(3));
mvaddch(YBASE - 1, XBASE - 1, ACS_ULCORNER);
hline(ACS_HLINE, XLENGTH);
mvaddch(YBASE - 1, XBASE + XLENGTH, ACS_URCORNER);
mvaddch(YBASE + YDEPTH, XBASE - 1, ACS_LLCORNER);
hline(ACS_HLINE, XLENGTH);
mvaddch(YBASE + YDEPTH, XBASE + XLENGTH, ACS_LRCORNER);
move(YBASE, XBASE - 1);
vline(ACS_VLINE, YDEPTH);
move(YBASE, XBASE + XLENGTH);
vline(ACS_VLINE, YDEPTH);
attrset(COLOR_PAIR(2));
}
do {
mask = 0;
time(&now);
@ -102,7 +128,7 @@ int n = 0;
for(j=0,t=1<<26; t; t>>=1,j++) {
if(a&t) {
if(!(a&(t<<1))) {
movto(i, 2*j);
movto(YBASE + i, XBASE + 2*j);
}
addstr(" ");
}
@ -154,15 +180,17 @@ void
standt(int on)
{
if (on) {
if(hascolor)
if(hascolor) {
attron(COLOR_PAIR(1));
else
attron(A_STANDOUT);
} else {
attron(A_STANDOUT);
}
} else {
if(hascolor)
if(hascolor) {
attron(COLOR_PAIR(2));
else
} else {
attroff(A_STANDOUT);
}
}
}

View File

@ -28,7 +28,7 @@
#define MIDPEG 39
#define RIGHTPEG 59
#define LENTOIND(x) (((x)-1)/2-1)
#define LENTOIND(x) (((x)-1)/2)
#define OTHER(a,b) (3-((a)+(b)))
struct Peg {
@ -91,7 +91,6 @@ unsigned char AutoFlag = 0;
puts("terminal doesn't support color.");
exit(1);
}
traceon();
start_color();
{
int i;

View File

@ -88,9 +88,7 @@ init ()
initscr ();
cbreak (); /* immediate char return */
noecho (); /* no immediate echo */
traceon();
title (1,23);
traceoff();
mvaddstr (23, 25, "Would you like instructions? ");
refresh();
if ((toupper(getch())) == 'Y')

View File

@ -19,6 +19,7 @@ library source.
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <assert.h>
#include <ncurses.h>
@ -37,13 +38,27 @@ library source.
static void getch_test(void)
/* test the keypad feature */
{
unsigned int c;
int firsttime = 0;
refresh();
c = '?';
do {
char buf[BUFSIZ];
unsigned int c;
int incount = 0, firsttime = 0;
bool blocking = TRUE;
refresh();
(void) printw("Delay in 10ths of a second (<CR> for blocking input)? ");
echo();
getstr(buf);
noecho();
if (isdigit(buf[0]))
{
timeout(atoi(buf) * 100);
blocking = FALSE;
}
c = '?';
for (;;)
{
if (firsttime++)
{
printw("Key pressed: %04o ", c);
@ -72,15 +87,19 @@ static void getch_test(void)
break;
if (c == '?')
addstr("Type any key to see its keypad value, `q' to quit, `?' for help.\n");
} while
((c = getch()) != EOF);
while ((c = getch()) == ERR)
if (!blocking)
(void) printw("%05d: input timed out\n", incount++);
}
timeout(-1);
erase();
endwin();
}
static void attr_test(void)
/* test text attrivutes */
/* test text attributes */
{
refresh();
@ -455,14 +474,15 @@ static void slk_test(void)
static void acs_display()
/* display the ACS character set */
{
traceon();
int i, j;
erase();
attron(A_BOLD);
mvaddstr(0, 20, "Display of the ACS Character Set");
attroff(A_BOLD);
refresh();
#define ACSY 5
#define ACSY 2
mvaddstr(ACSY + 0, 0, "ACS_ULCORNER: "); addch(ACS_ULCORNER);
mvaddstr(ACSY + 1, 0, "ACS_LLCORNER: "); addch(ACS_LLCORNER);
mvaddstr(ACSY + 2, 0, "ACS_URCORNER: "); addch(ACS_URCORNER);
@ -490,6 +510,15 @@ traceon();
mvaddstr(ACSY + 10,40, "ACS_LANTERN: "); addch(ACS_LANTERN);
mvaddstr(ACSY + 11,40, "ACS_BLOCK: "); addch(ACS_BLOCK);
#define HYBASE (ACSY + 13)
mvprintw(HYBASE + 1, 0, "High-half characters via echochar:\n");
for (i = 0; i < 4; i++)
{
move(HYBASE + i + 3, 24);
for (j = 0; j < 32; j++)
echochar(128 + 32 * i + j);
}
move(LINES - 1, 0);
addstr("Press any key to continue... ");
(void) getch();
@ -542,6 +571,7 @@ int uli, ulj, lri, lrj; /* co-ordinates of corners */
case KEY_DOWN: i++; break;
case KEY_LEFT: j += sj - 1; break;
case KEY_RIGHT: j++; break;
case '\004': return((pair *)NULL);
default: res.y = uli + i; res.x = ulj + j; return(&res);
}
i %= si;
@ -553,17 +583,21 @@ static WINDOW *getwindow(void)
/* Ask user for a window definition */
{
WINDOW *rwindow, *bwindow;
pair ul, lr;
pair ul, lr, *tmp;
move(0, 0); clrtoeol();
addstr("Use arrows to move cursor, anything else to mark corner 1");
refresh();
memcpy(&ul, selectcell(1, 0, LINES-1, COLS-1), sizeof(pair));
if ((tmp = selectcell(1, 0, LINES-1, COLS-1)) == (pair *)NULL)
return((WINDOW *)NULL);
memcpy(&ul, tmp, sizeof(pair));
addch(ACS_ULCORNER);
move(0, 0); clrtoeol();
addstr("Use arrows to move cursor, anything else to mark corner 2");
refresh();
memcpy(&lr, selectcell(ul.y, ul.x, LINES-1, COLS-1), sizeof(pair));
if ((tmp = selectcell(ul.y, ul.x, LINES-1, COLS-1)) == (pair *)NULL)
return((WINDOW *)NULL);
memcpy(&lr, tmp, sizeof(pair));
rwindow = newwin(lr.y - ul.y + 1, lr.x - ul.x + 1, ul.y, ul.x);
@ -593,7 +627,7 @@ static void acs_and_scroll()
refresh();
mvaddstr(LINES - 2, 0,
"F1 = make new window, F2 = next window, F3 = previous window");
"F1 = make new window, F2 = next window, F3 = previous window, Ctrl-D = exit");
mvaddstr(LINES - 1, 0,
"All other characters are echoed, windows should scroll.");
@ -607,7 +641,8 @@ static void acs_and_scroll()
{
case KEY_F(1):
neww = (struct frame *) malloc(sizeof(struct frame));
neww->wind = getwindow();
if ((neww->wind = getwindow()) == (WINDOW *)NULL)
goto breakout;
if (oldw == NULL) /* First element, */
{
neww->next = neww; /* so point it at itself */
@ -650,41 +685,216 @@ static void acs_and_scroll()
} while
((c = wgetch(current->wind)) != '\004');
breakout:
erase();
endwin();
}
#define GRIDSIZE 5
static void panner(WINDOW *pad, int iy, int ix, int (*pgetc)(void))
{
static int porty, portx, basex = 0, basey = 0;
int pxmax, pymax, c;
WINDOW *vscroll = (WINDOW *)NULL, *hscroll = (WINDOW *)NULL;
porty = iy; portx = ix;
getmaxyx(pad, pymax, pxmax);
if (pymax > porty)
vscroll = newwin(porty - (pxmax > ix), 1, 0, portx - (pymax > iy));
if (pxmax > portx)
hscroll = newwin(1, portx - (pymax > iy), porty - (pxmax > ix), 0);
c = KEY_REFRESH;
do {
switch(c)
{
case KEY_REFRESH:
/* do nothing */
break;
case KEY_IC:
if (portx >= pxmax || portx >= ix)
beep();
else
{
mvwin(vscroll, 0, ++portx - 1);
delwin(hscroll);
hscroll = newwin(1, portx - (pymax > porty),
porty - (pxmax > portx), 0);
}
break;
case KEY_IL:
if (porty >= pymax || porty >= iy)
beep();
else
{
mvwin(hscroll, ++porty - 1, 0);
delwin(vscroll);
vscroll = newwin(porty - (pxmax > portx), 1,
0, portx - (pymax > porty));
}
break;
case KEY_DC:
if (portx <= 0)
beep();
else
{
mvwin(vscroll, 0, --portx - 1);
delwin(hscroll);
hscroll = newwin(1, portx - (pymax > porty),
porty - (pxmax > portx), 0);
}
break;
case KEY_DL:
if (porty <= 0)
beep();
else
{
mvwin(hscroll, --porty - 1, 0);
delwin(vscroll);
vscroll = newwin(porty - (pxmax > portx), 1,
0, portx - (pymax > porty));
}
break;
case KEY_LEFT:
if (basex > 0)
basex--;
else
beep();
break;
case KEY_RIGHT:
if (basex + portx < pxmax)
basex++;
else
beep();
break;
case KEY_UP:
if (basey > 0)
basey--;
else
beep();
break;
case KEY_DOWN:
if (basey + porty < pymax)
basey++;
else
beep();
break;
}
prefresh(pad,
basey, basex,
0, 0,
porty - (hscroll != (WINDOW *)NULL) - 1,
portx - (vscroll != (WINDOW *)NULL) - 1);
if (vscroll)
{
int lowend, i, highend;
lowend = basey * ((float)porty / (float)pymax);
highend = (basey + porty) * ((float)porty / (float)pymax);
touchwin(vscroll);
for (i = 0; i < lowend; i++)
mvwaddch(vscroll, i, 0, ACS_VLINE);
wattron(vscroll, A_REVERSE);
for (i = lowend; i <= highend; i++)
mvwaddch(vscroll, i, 0, ' ');
wattroff(vscroll, A_REVERSE);
for (i = highend + 1; i < porty; i++)
mvwaddch(vscroll, i, 0, ACS_VLINE);
wrefresh(vscroll);
}
if (hscroll)
{
int lowend, j, highend;
lowend = basex * ((float)portx / (float)pxmax);
highend = (basex + portx) * ((float)portx / (float)pxmax);
touchwin(hscroll);
for (j = 0; j < lowend; j++)
mvwaddch(hscroll, 0, j, ACS_HLINE);
wattron(hscroll, A_REVERSE);
for (j = lowend; j <= highend; j++)
mvwaddch(hscroll, 0, j, ' ');
wattroff(hscroll, A_REVERSE);
for (j = highend + 1; j < portx; j++)
mvwaddch(hscroll, 0, j, ACS_HLINE);
wrefresh(hscroll);
}
mvaddch(porty - 1, portx - 1, ACS_LRCORNER);
} while
((c = pgetc()) != KEY_EXIT);
}
int padgetch(void)
{
int c;
switch(c = getch())
{
case 'u': return(KEY_UP);
case 'd': return(KEY_DOWN);
case 'r': return(KEY_RIGHT);
case 'l': return(KEY_LEFT);
case '+': return(KEY_IL);
case '-': return(KEY_DL);
case '>': return(KEY_IC);
case '<': return(KEY_DC);
default: return(c);
}
}
static void demo_pad(void)
/* Demonstrate pads. */
{
int i, j, gridcount = 0;
WINDOW *panpad = newpad(200, 200);
for (i = 0; i < 200; i++)
{
for (j = 0; j < 200; j++)
if (i % GRIDSIZE == 0 && j % GRIDSIZE == 0)
{
if (i == 0 || j == 0)
waddch(panpad, '+');
else
waddch(panpad, 'A' + (gridcount++ % 26));
}
else if (i % GRIDSIZE == 0)
waddch(panpad, '-');
else if (j % GRIDSIZE == 0)
waddch(panpad, '|');
else
waddch(panpad, ' ');
}
mvprintw(LINES - 3, 0, "Use arrow keys to pan over the test pattern");
mvprintw(LINES - 2, 0, "Use +,- to grow/shrink the panner vertically.");
mvprintw(LINES - 1, 0, "Use <,> to grow/shrink the panner horizontally.");
panner(panpad, LINES - 4, COLS, padgetch);
endwin();
erase();
}
/****************************************************************************
*
* Tests from John Burnell's PDCurses tester
*
****************************************************************************/
static void demo_pad(void)
/* Demonstrate pads. */
{
WINDOW *pad;
pad = newpad(50,100);
mvwaddstr(pad, 5, 2, "This is a new pad");
mvwaddstr(pad, 8, 0, "The end of this line should be truncated here:abcd");
mvwaddstr(pad,11, 1, "This line should not appear.");
wmove(pad, 10, 1);
wclrtoeol(pad);
mvwaddstr(pad, 10, 1, " Press any key to continue");
prefresh(pad,0,0,0,0,10,45);
keypad(pad, TRUE);
wgetch(pad);
mvwaddstr(pad, 35, 2, "This is displayed at line 35 in the pad");
mvwaddstr(pad, 40, 1, " Press any key to continue");
prefresh(pad,30,0,0,0,10,45);
keypad(pad, TRUE);
wgetch(pad);
delwin(pad);
}
static void Continue (WINDOW *win)
{
wmove(win, 10, 1);
@ -696,10 +906,13 @@ static void Continue (WINDOW *win)
static void input_test(WINDOW *win)
/* Input test, adapted from John Burnell's PDCurses tester */
{
int w, h, bx, by, sw, sh, i, c,num;
char buffer [80];
int w, h, bx, by, sw, sh, i;
WINDOW *subWin;
wclear (win);
#ifdef FOO
char buffer [80];
int num;
#endif /* FOO */
w = win->_maxx;
h = win->_maxy;
@ -722,16 +935,19 @@ static void input_test(WINDOW *win)
wattrset(subWin, A_BOLD);
#endif
box(subWin, ACS_VLINE, ACS_HLINE);
#ifdef FOO
mvwaddstr(subWin, 2, 1, "This is a subwindow");
#endif /* FOO */
wrefresh(win);
nocbreak();
mvwaddstr(win, 2, 1, "Press some keys for 5 seconds");
mvwaddstr(win, 1, 1, "Pressing ^C should do nothing");
mvwaddstr(win, 1, 1, "Type random keys for 5 seconds.");
mvwaddstr(win, 2, 1,
"These should be discarded (not echoed) after the subwindow goes away.");
wrefresh(win);
for (i = 0; i < 5; i++) {
werase (subWin);
box(subWin, ACS_VLINE, ACS_HLINE);
for (i = 0; i < 5; i++)
{
mvwprintw (subWin, 1, 1, "Time = %d", i);
wrefresh(subWin);
sleep(1);
@ -750,27 +966,18 @@ static void input_test(WINDOW *win)
echo();
wgetch(win);
flushinp();
mvwaddstr(win, 12, 0,
"If you see any key other than what you typed, flushinp() is broken.");
Continue(win);
wmove(win, 9, 10);
wdelch(win);
mvwaddstr(win, 4, 1, "The character should now have been deleted");
Continue(win);
wclear (win);
mvwaddstr(win, 2, 1, "Press a function key or an arrow key");
wrefresh(win);
keypad(win, TRUE);
c = wgetch(win);
nodelay(win, TRUE);
wgetch(win);
nodelay(win, FALSE);
refresh();
wclear (win);
mvwaddstr(win, 3, 2, "The window should have moved");
mvwaddstr(win, 4, 2, "This text should have appeared without you pressing a key");
mvwprintw(win, 2, 2, "Keycode = %d", c);
wmove(win, 12, 0);
clrtoeol();
waddstr(win,
"What you typed should now have been deleted; if not, wdelch() failed.");
Continue(win);
#ifdef FOO
/*
@ -785,126 +992,6 @@ static void input_test(WINDOW *win)
Continue(win);
}
static void output_test (WINDOW *win)
{
WINDOW *win1;
char Buffer [80];
chtype ch;
wclear (win);
mvwaddstr(win, 1, 1, "You should now have a screen in the upper left corner, and this text should have wrapped");
mvwin(win, 2, 1);
Continue(win);
nl();
wclear(win);
mvwaddstr(win, 1, 1, "A new window will appear with this text in it");
mvwaddstr(win, 8, 1, "Press any key to continue");
wrefresh(win);
wgetch(win);
win1 = newwin(10, 50, 15, 25);
if(win1 == NULL)
{ endwin();
return;
}
#ifdef A_COLOR
if (has_colors())
{
init_pair(3,COLOR_BLUE,COLOR_WHITE);
wattrset(win1, COLOR_PAIR(3));
}
else
wattrset(win1, A_NORMAL);
#else
wattrset(win1, A_NORMAL);
#endif
wclear (win1);
mvwaddstr(win1, 5, 1, "This text should appear; using overlay option");
copywin(win, win1,0,0,0,0,10,50,TRUE);
box(win1,ACS_VLINE,ACS_HLINE);
wmove(win1, 8, 26);
wrefresh(win1);
wgetch(win1);
wclear(win1);
wattron(win1, A_BLINK);
mvwaddstr(win1, 4, 1, "This blinking text should appear in only the second window");
wattroff(win1, A_BLINK);
wrefresh(win1);
wgetch(win1);
delwin(win1);
wclear(win);
wrefresh(win);
mvwaddstr(win, 6, 2, "This line shouldn't appear");
mvwaddstr(win, 4, 2, "Only half of the next line is visible");
mvwaddstr(win, 5, 2, "Only half of the next line is visible");
wmove(win, 6, 1);
wclrtobot (win);
wmove(win, 5, 20);
wclrtoeol (win);
mvwaddstr(win, 8, 2, "This line also shouldn't appear");
wmove(win, 8, 1);
wdeleteln(win);
Continue(win);
traceoff();
wmove (win, 5, 9);
ch = winch (win);
wclear(win);
wmove (win, 6, 2);
waddstr (win, "The next char should be l: ");
winsch (win, ch);
Continue(win);
wmove(win, 5, 1);
winsertln (win);
mvwaddstr(win, 5, 2, "The lines below should have moved down");
Continue(win);
#ifdef FOO
/*
* This test won't be portable until vsscanf() is
*/
wclear(win);
wmove(win, 2, 2);
wprintw(win, "This is a formatted string in a window: %d %s\n", 42, "is it");
mvwaddstr(win, 10, 1, "Enter a string: ");
wrefresh(win);
echo();
wscanw (win, "%s", Buffer);
wclear(win);
mvwaddstr(win, 10, 1, "Enter a string");
wrefresh(win);
clear();
move(0,0);
printw("This is a formatted string in stdscr: %d %s\n", 42, "is it");
mvaddstr(10, 1, "Enter a string: ");
refresh();
echo();
scanw ("%s", Buffer);
#endif /* FOO */
wclear(win);
curs_set(2);
mvwaddstr(win, 1, 1, "The cursor should appear as a block");
Continue(win);
wclear(win);
curs_set(0);
mvwaddstr(win, 1, 1, "The cursor should have disappeared");
Continue(win);
wclear(win);
curs_set(1);
mvwaddstr(win, 1, 1, "The cursor should be an underline");
Continue(win);
}
/****************************************************************************
*
* Main sequence
@ -963,10 +1050,6 @@ bool do_single_test(const char c)
input_test(stdscr);
return(TRUE);
case 'o':
output_test(stdscr);
return(TRUE);
case '?':
(void) puts("This is the ncurses capability tester.");
(void) puts("You may select a test from the main menu by typing the");
@ -983,7 +1066,7 @@ int main(const int argc, const char *argv[])
char buf[BUFSIZ];
/* enable debugging */
traceon();
trace(TRACE_ORDINARY);
/* tell it we're going to play with soft keys */
slk_init(1);
@ -1017,10 +1100,10 @@ int main(const int argc, const char *argv[])
(void) puts("g = display windows and scrolling");
(void) puts("p = exercise pad features");
(void) puts("i = subwindow input test");
(void) puts("o = output test");
(void) puts("? = get help");
(void) fputs("> ", stdout);
(void) fflush(stdout); /* necessary under SVr4 curses */
(void) fgets(buf, BUFSIZ, stdin);
if (do_single_test(buf[0])) {

View File

@ -1,19 +1,19 @@
char _ncurses_copyright[] = "\n\
/***************************************************************************\n\
* COPYRIGHT NOTICE *\n\
****************************************************************************\n\
* ncurses is copyright (C) 1992, 1993, 1994 *\n\
* by Zeyd M. Ben-Halim *\n\
* zmbenhal@netcom.com *\n\
* *\n\
* Permission is hereby granted to reproduce and distribute ncurses *\n\
* by any means and for any fee, whether alone or as part of a *\n\
* larger distribution, in source or in binary form, PROVIDED *\n\
* this notice remains in the sources and is reproduced in any *\n\
* documentation accompanying it or the applications linked with it. *\n\
* Any other use of ncurses, including incorporating it in another *\n\
* product is subject to written permission. *\n\
* *\n\
* ncurses comes AS IS with no warranty, implied or expressed. *\n\
* *\n\
***************************************************************************/\n";
/***************************************************************************
* COPYRIGHT NOTICE *
****************************************************************************
* ncurses is copyright (C) 1992, 1993, 1994 *
* by Zeyd M. Ben-Halim *
* zmbenhal@netcom.com *
* *
* Permission is hereby granted to reproduce and distribute ncurses *
* by any means and for any fee, whether alone or as part of a *
* larger distribution, in source or in binary form, PROVIDED *
* this notice is included with any such distribution, not removed *
* from header files, and is reproduced in any documentation *
* accompanying it or the applications linked with it. *
* *
* ncurses comes AS IS with no warranty, implied or expressed. *
* *
***************************************************************************/
\n";

View File

@ -91,16 +91,16 @@ All routines return the integer \fBERR\fR upon failure and an integer value
other than \fBERR\fR upon successful completion, unless otherwise noted in the
preceding routine descriptions.
.SH BUGS
The ncurses implementation does not yet handle insertion of a character at the
bottom-rightmost position of the screen correctly. If the terminal has the
auto_right_margin property, the real screen will be scrolled up one regardless
of whether scrollok has been enabled for \fBstdscr\fR.
The entry points \fBechochar\fR and \fBwechochar\fR are not yet implemented in
ncurses 1.8.1.
.SH NOTES
Note that \fBaddch\fR, \fBmvaddch\fR, \fBmvwaddch\fR, and
\fBechochar\fR may be macros.
On 386 and 486 consoles, giving \fBwechochar\fR an argument with its high
bit set will produce the corresponding high-half ASCIIZ graphic (SVr4 curses
also has this feature but does not document it). A control-character argument,
however, will not typically produce the corresponding graphic;
characters such as CR, NL, FF and TAB are typically interpreted by the console
driver itself, and ESC will be interpreted as the leader of a control sequence.
.SH SEE ALSO
\fBncurses\fR(3X), \fBcurs_attr\fR(3X), \fBcurs_clear\fR(3X),
\fBcurs_inch\fR(3X), \fBcurs_outopts\fR(3X), \fBcurs_refresh\fR(3X),

View File

@ -40,7 +40,7 @@ The routine \fBattrset\fR sets the current attributes of the given window to
turning any other attributes on or off. The routine \fBattron\fR turns on the
named attributes without affecting any others. The routine \fBstandout\fR is
the same as \fBattron(A_STANDOUT)\fR. The routine \fBstandend\fR is the same
as \fBattrset(A_NORMAL)\fR or \fBattrest(0)\fR, that is, it turns off all
as \fBattrset(A_NORMAL)\fR or \fBattrset(0)\fR, that is, it turns off all
attributes.
.SS Attributes
The following video attributes, defined in \fB<ncurses.h>\fR, can be passed to
@ -70,9 +70,6 @@ The following macro is the reverse of \fBCOLOR_PAIR(\fR\fIn\fR\fB)\fR:
The return values of these routines are not neaningful (many are implemented
as macro-expanded assignments and simply return their argument). The SVr4
manual page claims (falsely) that these routines always return \fB1\fR.
.SH BUGS
As of 1.8.2, ncurses attributes still have a tendency to stick on in some
circumstances where SVr4 curses attributes would turn off.
.SH NOTES
Note that \fBattroff\fR, \fBwattroff\fR, \fBattron\fR, \fBwattron\fR,
\fBattrset\fR, \fBwattrset\fR, \fBstandend\fR and \fBstandout\fR may be macros.

View File

@ -39,7 +39,7 @@ non-negative integer, if \fBimmedok\fR is set.
.SH NOTES
Note that \fBbkgdset\fR and \fBbkgd\fR may be macros.
.SH BUGS
These features and \fBimmedok\fR are not yet implemented in ncurses 1.8.1.
\fBimmedok\fR is not yet implemented in ncurses 1.8.6.
.SH SEE ALSO
\fBncurses\fR(3X), \fBcurs_addch\fR(3X), \fBcurs_outopts\fR(3X)
.\"#

View File

@ -56,7 +56,7 @@ is also true of SVr4 curses, though the fact is not documented).
Note that \fBborder\fR and \fBbox\fR may be macros.
.SH BUGS
The \fBimmedok\fR function is not yet implemented in ncurses 1.8.1.
The \fBimmedok\fR function is not yet implemented in ncurses 1.8.6.
.SH SEE ALSO
\fBncurses\fR(3X), \fBcurs_outopts\fR(3X).
.\"#

View File

@ -114,7 +114,7 @@ background color for all terminals.
.SH RETURN VALUE
All routines that return an integer return \fBERR\fR upon failure and \fBOK\fR
upon successful completion.
.SH BUGS
.SH NOTES
Several caveats apply onn 386 and 486 machines with VGA-compatible graphics:
COLOR_YELLOW is actually brown. To get yellow, use COLOR_YELLOW combined with

View File

@ -34,9 +34,6 @@ current line and the bottom line is lost.
.SH RETURN VALUE
All routines return the integer \fBERR\fR upon failure and an integer
value other than \fBERR\fR upon successful completion.
.SH BUGS
All the above should be implemented through \fBwinsdelln\fR() but
currently only \fBinsdelln\fR() is implemented in terms of it.
.SH NOTES
Note that all but \fBwinsdelln\fR may be a macros.

View File

@ -158,7 +158,7 @@ Note that \fBecho\fR, \fBnoecho\fR, \fBhalfdelay\fR, \fBintrflush\fR,
\fBqiflush\fR, \fBtimeout\fR, and \fBwtimeout\fR may be macros.
.SH BUGS
The entry points \fBintrflush\fR, \fBqiflush\fR, \fBnoqiflush\fR, and
\fBtypeahead\fR are not yet implemented in ncurses 1.8.1. The ncurses
\fBtypeahead\fR are not yet implemented in ncurses 1.8.6. The ncurses
code does not do typeahead checking during input as SVr4 curses does.
.SH SEE ALSO
\fBncurses\fR(3X), \fBcurs_getch\fR(3X), \fBcurs_initscr\fR(3X), \fBtermio\fR(7)

View File

@ -43,8 +43,8 @@ returns a character in the the ^-representation of the control character.
All routines return the integer \fBERR\fR upon failure and an integer value
other than \fBERR\fR upon successful completion.
.SH BUGS
Entry points for these functions are n ncurses.h but they are not
implemented as of ncurses 1.8.5.
Entry points for these functions are in ncurses.h but they are not
implemented as of ncurses 1.8.6.
.SH NOTES
Note that all but \fBwinsnstr\fR may be macros.
.SH SEE ALSO

View File

@ -100,8 +100,10 @@ requested \fIvisibility\fR is not supported.
.SH NOTES
Note that \fBgetsyx\fR is a macro, so \fB&\fR is not necessary before
the variables \fIy\fR and \fIx\fR.
.SH BUGS
The return value of curs_set is currently incorrect.
The SVr4 man pages warn that the return value of \fBcurs_set\fR "is currently
incorrect". This implementation gets it right, but it may be unwise to count
on the correctness of the return value anywhere else.
.SH SEE ALSO
\fBncurses\fR(3X), \fBcurs_initscr\fR(3X), \fBcurs_outopts\fR(3X), \fBcurs_refresh\fR(3X),
\fBcurs_scr_dump\fR(3X), \fBcurs_slk\fR(3X)

View File

@ -96,7 +96,8 @@ linefeed capability, resulting in faster cursor motion.
All other routines that return an integer always return \fBOK\fR.
.SH BUGS
The entry points \fBidcok\fR, \fBimmedok\fR are not yet implemented in
ncurses 1.8.1.
ncurses 1.8.6. Setting \fIidlok\fR has unfortunate effects on scrolling
windows.
.SH NOTES
Note that \fBclearok\fR, \fBleaveok\fR, \fBscrollok\fR, \fBidcok\fR, \fBnl\fR,
\fBnonl\fR and \fBsetscrreg\fR may be macros.

View File

@ -18,13 +18,13 @@ from (to) a file
The \fBscr_dump\fR routine dumps the current contents of the virtual screen
to the file \fIfilename\fR.
With the \fBscr_restore\fR routine, the virtual screen is set to the contents
The \fBscr_restore\fR routine sets the virtual screen to the contents
of \fIfilename\fR, which must have been written using \fBscr_dump\fR. The next
call to \fBdoupdate\fR restores the screen to the way it looked in the dump
file.
With the \fBscr_init\fR routine, the contents of \fIfilename\fR are read in and
used to initialize the \fBncurses\fR data structures about what the terminal
The \fBscr_init\fR routine reads in the contents of \fIfilename\fR and uses
them to initialize the \fBncurses\fR data structures about what the terminal
currently has on its screen. If the data is determined to be valid,
\fBncurses\fR bases its next update of the screen on this information rather
than clearing the screen and starting from scratch. \fBscr_init\fR is used
@ -45,6 +45,8 @@ All routines return the integer \fBERR\fR upon failure and \fBOK\fR
upon success.
.SH NOTES
Note that \fBscr_init\fR, \fBscr_set\fR, and \fBscr_restore\fR may be macros.
.BUGS
The time-stamp and rmcup/nrrmc checks are not implemented in \fBncurses\fR(3X).
.SH SEE ALSO
\fBncurses\fR(3X), \fBcurs_initscr\fR(3X), \fBcurs_refresh\fR(3X),
\fBcurs_util\fR(3X), \fBsystem\fR(3S)

View File

@ -62,8 +62,6 @@ variable \fBTERM\fR (truncated to 14 characters).
Routines that return an integer return \fBERR\fR upon failure and an integer
value other than \fBERR\fR upon successful completion.
.SH BUGS
The \fBtermattr\fR entry point is not implemented in ncurses 1.8.1.
.SH NOTES
Note that \fBtermattrs\fR may be a macro.
.SH SEE ALSO

View File

@ -68,8 +68,7 @@ successful completion.
Routines that return pointers return \fBNULL\fR on error.
.SH BUGS
The \fBfilter\fR and \fBdelay_output\fR entry points are not yet
supported in ncurses 1.8.1.
The \fBfilter\fR entry point is not yet supported.
.SH NOTES
Note that \fBunctrl\fR is a macro, which is defined in <\fBunctrl.h\fR>.
.SH SEE ALSO

View File

@ -109,6 +109,10 @@ If many small changes are made to the window, the \fBwsyncup\fR option could
degrade performance.
Note that \fBsyncok\fR may be a macro.
.SH BUGS
The subwindow functions (\fIsubwin\fR, \fIderwin\fR, etc.) are flaky,
incompletely implemented, and not well tested, especially in their
interaction with scrolling.
.SH SEE ALSO
\fBncurses\fR(3X), \fBcurs_refresh\fR(3X), \fBcurs_touch\fR(3X)
.\"#

530
lib/libncurses/curses.h Normal file
View File

@ -0,0 +1,530 @@
/***************************************************************************
* COPYRIGHT NOTICE *
****************************************************************************
* ncurses is copyright (C) 1992, 1993, 1994 *
* by Zeyd M. Ben-Halim *
* zmbenhal@netcom.com *
* *
* Permission is hereby granted to reproduce and distribute ncurses *
* by any means and for any fee, whether alone or as part of a *
* larger distribution, in source or in binary form, PROVIDED *
* this notice is included with any such distribution, not removed *
* from header files, and is reproduced in any documentation *
* accompanying it or the applications linked with it. *
* *
* ncurses comes AS IS with no warranty, implied or expressed. *
* *
***************************************************************************/
#ifndef __NCURSES_H
#define __NCURSES_H
#define CURSES 1
#define CURSES_H 1
#include <stdio.h>
#include <stdarg.h>
#ifndef NOTERMIOS
#include <termios.h>
#ifndef TERMIOS
#define TERMIOS 1
#endif
#else
#include <sgtty.h>
#include <sys/ioctl.h>
#endif
#include <unctrl.h>
#define bool char
typedef unsigned long chtype;
/* attributes */
#define A_ATTRIBUTES 0xffffff00
#define A_NORMAL 0x00000000
#define A_STANDOUT 0x00010000
#define A_UNDERLINE 0x00020000
#define A_REVERSE 0x00040000
#define A_BLINK 0x00080000
#define A_DIM 0x00100000
#define A_BOLD 0x00200000
#define A_ALTCHARSET 0x00400000
#define A_INVIS 0x00800000
#define A_PROTECT 0x01000000
#define A_CHARTEXT 0x000000ff
#define A_COLOR 0x0000ff00
#define COLOR_PAIR(n) (n << 8)
#define PAIR_NUMBER(a) ((a & A_COLOR) >> 8)
/* colors */
extern int COLORS;
extern int COLOR_PAIRS;
extern unsigned char *color_pairs;
#define COLOR_BLACK 0
#define COLOR_RED 1
#define COLOR_GREEN 2
#define COLOR_YELLOW 3
#define COLOR_BLUE 4
#define COLOR_MAGENTA 5
#define COLOR_CYAN 6
#define COLOR_WHITE 7
/* line graphics */
extern chtype acs_map[];
#define ACS_ULCORNER (acs_map['l'])
#define ACS_LLCORNER (acs_map['m'])
#define ACS_URCORNER (acs_map['k'])
#define ACS_LRCORNER (acs_map['j'])
#define ACS_RTEE (acs_map['u'])
#define ACS_LTEE (acs_map['t'])
#define ACS_BTEE (acs_map['v'])
#define ACS_TTEE (acs_map['w'])
#define ACS_HLINE (acs_map['q'])
#define ACS_VLINE (acs_map['x'])
#define ACS_PLUS (acs_map['n'])
#define ACS_S1 (acs_map['o']) /* scan line 1 */
#define ACS_S9 (acs_map['s']) /* scan line 9 */
#define ACS_DIAMOND (acs_map['`']) /* diamond */
#define ACS_CKBOARD (acs_map['a']) /* checker board (stipple) */
#define ACS_DEGREE (acs_map['f']) /* degree symbol */
#define ACS_PLMINUS (acs_map['g']) /* plus/minus */
#define ACS_BULLET (acs_map['~']) /* bullet */
#define ACS_LARROW (acs_map[',']) /* arrow pointing left */
#define ACS_RARROW (acs_map['+']) /* arrow pointing right */
#define ACS_DARROW (acs_map['.']) /* arrow pointing down */
#define ACS_UARROW (acs_map['-']) /* arrow pointing up */
#define ACS_BOARD (acs_map['h']) /* board of squares */
#define ACS_LANTERN (acs_map['I']) /* lantern symbol */
#define ACS_BLOCK (acs_map['0']) /* solid square block */
#ifndef TRUE
# define TRUE (1)
# define FALSE (0)
#endif
#define ERR (-1)
#define OK (0)
#define _SUBWIN 0x01
#define _ENDLINE 0x02
#define _FULLWIN 0x04
#define _SCROLLWIN 0x08
#define _ISPAD 0x10
#define _HASMOVED 0x20
#define _NOCHANGE -1
typedef struct screen SCREEN;
typedef struct _win_st WINDOW;
struct _win_st {
short _cury, _curx; /* current cursor position */
short _maxy, _maxx; /* maximum values of x and y NOT the screen dimensions */
short _begy, _begx;
short _flags;
chtype _attrs;
chtype _bkgd;
/* The following should be consolidated into one bitset */
bool _notimeout;
bool _use_idc;
bool _clear;
bool _leave;
bool _scroll;
bool _idlok;
bool _immed;
bool _sync;
bool _use_keypad; /* 0=no, 1=yes */
bool _use_meta; /* T=use the meta key */
int _delay; /* 0 = nodelay
<0 = blocking
>0 = delay */
chtype **_line;
short *_firstchar; /* First changed character in the line */
short *_lastchar; /* Last changed character in the line */
short _regtop; /* Top and bottom of scrolling region */
short _regbottom;
int _parx;
int _pary;
WINDOW *_parent; /* parent if a sub-window */
};
extern WINDOW *stdscr, *curscr, *newscr;
extern int LINES, COLS;
#ifdef __cplusplus
extern "C" {
#endif
extern char ttytype[]; /* needed for backward compatibility */
extern int tigetflag(char *);
extern int tigetnum(char *);
extern char *tigetstr(char *);
/* Debugging : use with libdcurses.a */
extern void _init_trace(void);
extern void _tracef(char *, ...);
extern char *_traceattr(int mode);
extern char *_tracechar(const unsigned char mode);
extern void trace(const unsigned int tracelevel);
/* trace masks */
#define TRACE_DISABLE 0x00 /* turn off tracing */
#define TRACE_ORDINARY 0x01 /* ordinary trace mode */
#define TRACE_CHARPUT 0x02 /* also trace all character outputs */
#define TRACE_MAXIMUM 0x0f /* maximum trace level */
/* function prototypes */
extern int baudrate(void);
extern int beep(void);
extern int cbreak(void);
extern int clearok(WINDOW *,int);
extern int copywin(WINDOW *,WINDOW *,int,int,int,int,int,int,int);
extern int curs_set(int);
extern int def_prog_mode(void);
extern int def_shell_mode(void);
extern int delwin(WINDOW *);
extern WINDOW *derwin(WINDOW *,int,int,int,int);
extern int doupdate(void);
extern WINDOW *dupwin(WINDOW *);
extern int echo(void);
extern int endwin(void);
extern char erasechar(void);
extern int flash(void);
extern int flushinp(void);
extern int halfdelay(int);
extern int idlok(WINDOW *,int);
extern int intrflush(WINDOW *,bool);
extern int is_linetouched(WINDOW *,int);
extern int is_wintouched(WINDOW *);
extern WINDOW *initscr(void);
extern int isendwin(void);
extern char *keyname(int);
extern int keypad(WINDOW *,int);
extern char killchar(void);
extern int leaveok(WINDOW *,int);
extern char *longname(void);
extern int meta(WINDOW *,int);
extern int mvcur(int,int,int,int);
extern int mvprintw(int,int,char *,...);
extern int mvscanw(int,int,char *,...);
extern int mvwin(WINDOW *,int,int);
extern int mvwprintw(WINDOW *,int,int,char *,...);
extern int mvwscanw(WINDOW *,int,int,char *,...);
extern WINDOW *newpad(int,int);
extern SCREEN *newterm(char *,FILE *,FILE *);
extern WINDOW *newwin(int,int,int,int);
extern int nl(void);
extern int nocbreak(void);
extern int nodelay(WINDOW *,int);
extern int noecho(void);
extern int nonl(void);
extern int noraw(void);
extern int notimeout(WINDOW *,bool);
extern int overlay(WINDOW *,WINDOW *);
extern int overwrite(WINDOW *,WINDOW *);
extern int pnoutrefresh(WINDOW *,int,int,int,int,int,int);
extern int prefresh(WINDOW *,int,int,int,int,int,int);
extern int printw(char *,...);
extern int putp(char *);
extern int raw(void);
extern int reset_prog_mode(void);
extern int reset_shell_mode(void);
extern int resetty(void);
extern int ripoffline(int line, int (*init)(WINDOW *, int));
extern int savetty(void);
extern int scanw(char *,...);
extern int scrollok(WINDOW *,int);
extern SCREEN *set_term(SCREEN *);
extern int setupterm(char *,int,int *);
extern WINDOW *subwin(WINDOW *,int,int,int,int);
extern int timeout(int);
extern char *tparm(char *, ...);
extern int tputs(char *,int,int (*)(char));
extern int typeahead(int);
extern int ungetch(int);
extern int vidattr(chtype);
extern int vidputs(chtype,int (*)(char));
extern int vwscanw(WINDOW *,char *,va_list);
extern int vwprintw(WINDOW *,char *,va_list);
extern int waddch(WINDOW *,chtype);
extern int waddchnstr(WINDOW *,chtype *,int);
extern int waddnstr(WINDOW *,char *,int);
extern int wattron(WINDOW *,chtype);
extern int wattroff(WINDOW *,chtype);
extern int wbkgd(WINDOW *,chtype);
extern int wborder(WINDOW *,chtype,chtype,chtype,chtype,chtype,chtype,chtype,chtype);
extern int wclear(WINDOW *);
extern int wclrtobot(WINDOW *);
extern int wclrtoeol(WINDOW *);
extern int wdelch(WINDOW *);
extern int wechochar(WINDOW *, chtype);
extern int werase(WINDOW *);
extern int wgetch(WINDOW *);
extern int wgetnstr(WINDOW *,char *,int maxlen);
extern int whline(WINDOW *,chtype,int);
extern int winsch(WINDOW *,chtype);
extern int winsdelln(WINDOW *,int);
extern int winsnstr(WINDOW *,char *,int);
extern int wmove(WINDOW *,int,int);
extern int wnoutrefresh(WINDOW *);
extern int wprintw(WINDOW *,char *,...);
extern int wredrawln(WINDOW *,int,int);
extern int wrefresh(WINDOW *);
extern int wscanw(WINDOW *,char *,...);
extern int wscrl(WINDOW *,int);
extern int wsetscrreg(WINDOW *,int,int);
extern int wtimeout(WINDOW *,int);
extern int wtouchln(WINDOW *,int,int,int);
extern int wvline(WINDOW *,chtype,int);
extern bool can_change_color(void);
extern int color_content(short,short *,short *, short *);
extern int has_colors(void);
extern int init_color(short,short,short,short);
extern int init_pair(short,short,short);
extern int pair_content(short,short*,short*);
extern int start_color(void);
extern int slk_init(int);
extern int slk_set(int,char *,int);
extern int slk_refresh(void);
extern int slk_noutrefresh(void);
extern char *slk_label(int);
extern int slk_clear(void);
extern int slk_restore(void);
extern int slk_touch(void);
#ifdef __cplusplus
}
#endif
/*
* pseudo functions
*/
#define wgetstr(w, s) wgetnstr(w, s, -1)
#define napms(x) usleep(1000*x)
#define setterm(term) setupterm(term, 1, (int *)0)
#define fixterm() reset_prog_mode()
#define resetterm() reset_shell_mode()
#define saveterm() def_prog_mode()
#define crmode() cbreak()
#define nocrmode() nocbreak()
#define gettmode()
#define getyx(win,y,x) (y = (win)->_cury, x = (win)->_curx)
#define getbegyx(win,y,x) (y = (win)->_begy, x = (win)->_begx)
#define getmaxyx(win,y,x) (y = (win)->_maxy + 1, x = (win)->_maxx + 1)
#define getsyx(y,x) getyx(stdscr, y, x)
#define setsyx(y,x) (stdscr->_cury = y, stdscr->_curx = x)
#define wbkgdset(w,ch) (win->_bkgd = ch)
/* It seems older SYSV curses define these */
#define getattrs(win) (win->_attrs)
#define getmaxx(win) ((win)->_maxx + 1)
#define getmaxy(win) ((win)->_maxy + 1)
#define winch(win) ((win)->_line[(win)->_cury][(win)->_curx])
#define wstandout(win) (wattrset(win,A_STANDOUT))
#define wstandend(win) (wattrset(win,A_NORMAL))
#define wattrset(win,at) ((win)->_attrs = (at))
#define subpad(p,l,c,y,x) derwin(p,l,c,y,x)
#define scroll(win) wscrl(win,1)
#define touchwin(win) wtouchln((win), 0, (win)->_maxy + 1, 1)
#define touchline(win, s, c) wtouchln((win), s, c, 1)
#define untouchwin(win) wtouchln((win), 0, (win)->_maxy + 1, 0)
#define box(win, v, h) wborder(win, v, v, h, h, 0, 0, 0, 0)
#define border(ls, rs, ts, bs, tl, tr, bl, br) wborder(stdscr, ls, rs, ts, bs, tl, tr, bl, br)
#define hline(ch, n) whline(stdscr, ch, n)
#define vline(ch, n) wvline(stdscr, ch, n)
#define winsstr(w, s) winsnstr(w, s, 0)
#define redrawwin(w) wredrawln(w, 0, w->_maxy+1)
#define waddstr(win,str) waddnstr(win,str,-1)
#define waddchstr(win,str) waddchnstr(win,str,-1)
/*
* pseudo functions for standard screen
*/
#define bkgdset(ch) wbkgdset(stdscr,ch)
#define bkgd(ch) wbkgd(stdscr,ch)
#define inch() winch(stdscr)
#define standout() wstandout(stdscr)
#define standend() wstandend(stdscr)
#define attron(at) wattron(stdscr,at)
#define attroff(at) wattroff(stdscr,at)
#define attrset(at) wattrset(stdscr,at)
#define addch(ch) waddch(stdscr,ch)
#define echochar(c) wechochar(stdscr, c)
#define getch() wgetch(stdscr)
#define addstr(str) waddnstr(stdscr,str,-1)
#define getstr(str) wgetstr(stdscr,str)
#define move(y, x) wmove(stdscr,y,x)
#define clear() wclear(stdscr)
#define erase() werase(stdscr)
#define clrtobot() wclrtobot(stdscr)
#define clrtoeol() wclrtoeol(stdscr)
#define insertln() winsdelln(stdscr, 1)
#define winsertln(w) winsdelln(w, 1)
#define deleteln() winsdelln(stdscr, -1)
#define wdeleteln(w) winsdelln(w, -1)
#define refresh() wrefresh(stdscr)
#define insch(c) winsch(stdscr,c)
#define delch() wdelch(stdscr)
#define setscrreg(t,b) wsetscrreg(stdscr,t,b)
#define scrl(n) wscrl(stdscr,n)
#define timeout(delay) wtimeout(stdscr, delay)
#define addnstr(str,n) waddnstr(stdscr,str,n)
#define addchstr(str) waddchstr(stdscr,str)
#define addchnstr(str,n) waddchnstr(stdscr,str, n)
#define insdelln(n) winsdelln(stdscr, n)
#define insstr(s) winsstr(stdscr, s)
#define insnstr(s,n) winsnstr(stdscr, s, n)
/*
* mv functions
*/
#define mvwaddch(win,y,x,ch) (wmove(win,y,x) == ERR ? ERR : waddch(win,ch))
#define mvwgetch(win,y,x) (wmove(win,y,x) == ERR ? ERR : wgetch(win))
#define mvwaddchnstr(win,y,x,str,n) (wmove(win,y,x) == ERR ? ERR : waddchnstr(win,str,n))
#define mvwaddchstr(win,y,x,str) (wmove(win,y,x) == ERR ? ERR : waddchnstr(win,str,-1))
#define mvwaddnstr(win,y,x,str,n) (wmove(win,y,x) == ERR ? ERR : waddnstr(win,str,n))
#define mvwaddstr(win,y,x,str) (wmove(win,y,x) == ERR ? ERR : waddnstr(win,str,-1))
#define mvwgetstr(win,y,x,str) (wmove(win,y,x) == ERR ? ERR : wgetstr(win,str))
#define mvwinch(win,y,x) (wmove(win,y,x) == ERR ? ERR : winch(win))
#define mvwdelch(win,y,x) (wmove(win,y,x) == ERR ? ERR : wdelch(win))
#define mvwinsch(win,y,x,c) (wmove(win,y,x) == ERR ? ERR : winsch(win,c))
#define mvaddch(y,x,ch) mvwaddch(stdscr,y,x,ch)
#define mvgetch(y,x) mvwgetch(stdscr,y,x)
#define mvaddnstr(y,x,str,n) mvwaddnstr(stdscr,y,x,str,n)
#define mvaddstr(y,x,str) mvwaddstr(stdscr,y,x,str)
#define mvgetstr(y,x,str) mvwgetstr(stdscr,y,x,str)
#define mvinch(y,x) mvwinch(stdscr,y,x)
#define mvdelch(y,x) mvwdelch(stdscr,y,x)
#define mvinsch(y,x,c) mvwinsch(stdscr,y,x,c)
#define mvwinsstr(w, y, x, s) (wmove(w,y,x) == ERR ? ERR : winsstr(w,s))
#define mvwinsnstr(w, y, x, s, n) (wmove(w,y,x) == ERR ? ERR : winsnstr(w,s,n))
#define mvinsstr(y,x,s) mvwinsstr(stdscr,y,x,s)
#define mvinsnstr(y,x,s,n) mvwinsnstr(stdscr,y,x,s,n)
/* Funny "characters" enabled for various special function keys for input */
/* Whether such a key exists depend if its definition is in the terminfo entry */
#define KEY_MIN 0401 /* Minimum curses key */
#define KEY_BREAK 0401 /* break key (unreliable) */
#define KEY_DOWN 0402 /* The four arrow keys ... */
#define KEY_UP 0403
#define KEY_LEFT 0404
#define KEY_RIGHT 0405 /* ... */
#define KEY_HOME 0406 /* Home key (upward+left arrow) */
#define KEY_BACKSPACE 0407 /* backspace (unreliable) */
#define KEY_F0 0410 /* Function keys. Space for 64 */
#define KEY_F(n) (KEY_F0+(n)) /* keys is reserved. */
#define KEY_DL 0510 /* Delete line */
#define KEY_IL 0511 /* Insert line */
#define KEY_DC 0512 /* Delete character */
#define KEY_IC 0513 /* Insert char or enter insert mode */
#define KEY_EIC 0514 /* Exit insert char mode */
#define KEY_CLEAR 0515 /* Clear screen */
#define KEY_EOS 0516 /* Clear to end of screen */
#define KEY_EOL 0517 /* Clear to end of line */
#define KEY_SF 0520 /* Scroll 1 line forward */
#define KEY_SR 0521 /* Scroll 1 line backwards (reverse) */
#define KEY_NPAGE 0522 /* Next page */
#define KEY_PPAGE 0523 /* Previous page */
#define KEY_STAB 0524 /* Set tab */
#define KEY_CTAB 0525 /* Clear tab */
#define KEY_CATAB 0526 /* Clear all tabs */
#define KEY_ENTER 0527 /* Enter or send (unreliable) */
#define KEY_SRESET 0530 /* soft (partial) reset (unreliable) */
#define KEY_RESET 0531 /* reset or hard reset (unreliable) */
#define KEY_PRINT 0532 /* print or copy */
#define KEY_LL 0533 /* home down or bottom (lower left) */
/* The keypad is arranged like this: */
/* a1 up a3 */
/* left b2 right */
/* c1 down c3 */
#define KEY_A1 0534 /* Upper left of keypad */
#define KEY_A3 0535 /* Upper right of keypad */
#define KEY_B2 0536 /* Center of keypad */
#define KEY_C1 0537 /* Lower left of keypad */
#define KEY_C3 0540 /* Lower right of keypad */
#define KEY_BTAB 0541 /* Back tab key */
#define KEY_BEG 0542 /* beg(inning) key */
#define KEY_CANCEL 0543 /* cancel key */
#define KEY_CLOSE 0544 /* close key */
#define KEY_COMMAND 0545 /* cmd (command) key */
#define KEY_COPY 0546 /* copy key */
#define KEY_CREATE 0547 /* create key */
#define KEY_END 0550 /* end key */
#define KEY_EXIT 0551 /* exit key */
#define KEY_FIND 0552 /* find key */
#define KEY_HELP 0553 /* help key */
#define KEY_MARK 0554 /* mark key */
#define KEY_MESSAGE 0555 /* message key */
#define KEY_MOVE 0556 /* move key */
#define KEY_NEXT 0557 /* next object key */
#define KEY_OPEN 0560 /* open key */
#define KEY_OPTIONS 0561 /* options key */
#define KEY_PREVIOUS 0562 /* previous object key */
#define KEY_REDO 0563 /* redo key */
#define KEY_REFERENCE 0564 /* ref(erence) key */
#define KEY_REFRESH 0565 /* refresh key */
#define KEY_REPLACE 0566 /* replace key */
#define KEY_RESTART 0567 /* restart key */
#define KEY_RESUME 0570 /* resume key */
#define KEY_SAVE 0571 /* save key */
#define KEY_SBEG 0572 /* shifted beginning key */
#define KEY_SCANCEL 0573 /* shifted cancel key */
#define KEY_SCOMMAND 0574 /* shifted command key */
#define KEY_SCOPY 0575 /* shifted copy key */
#define KEY_SCREATE 0576 /* shifted create key */
#define KEY_SDC 0577 /* shifted delete char key */
#define KEY_SDL 0600 /* shifted delete line key */
#define KEY_SELECT 0601 /* select key */
#define KEY_SEND 0602 /* shifted end key */
#define KEY_SEOL 0603 /* shifted clear line key */
#define KEY_SEXIT 0604 /* shifted exit key */
#define KEY_SFIND 0605 /* shifted find key */
#define KEY_SHELP 0606 /* shifted help key */
#define KEY_SHOME 0607 /* shifted home key */
#define KEY_SIC 0610 /* shifted input key */
#define KEY_SLEFT 0611 /* shifted left arrow key */
#define KEY_SMESSAGE 0612 /* shifted message key */
#define KEY_SMOVE 0613 /* shifted move key */
#define KEY_SNEXT 0614 /* shifted next key */
#define KEY_SOPTIONS 0615 /* shifted options key */
#define KEY_SPREVIOUS 0616 /* shifted prev key */
#define KEY_SPRINT 0617 /* shifted print key */
#define KEY_SREDO 0620 /* shifted redo key */
#define KEY_SREPLACE 0621 /* shifted replace key */
#define KEY_SRIGHT 0622 /* shifted right arrow */
#define KEY_SRSUME 0623 /* shifted resume key */
#define KEY_SSAVE 0624 /* shifted save key */
#define KEY_SSUSPEND 0625 /* shifted suspend key */
#define KEY_SUNDO 0626 /* shifted undo key */
#define KEY_SUSPEND 0627 /* suspend key */
#define KEY_UNDO 0630 /* undo key */
#define KEY_MAX 0777 /* Maximum curses key */
#endif

View File

@ -24,7 +24,7 @@ typedef struct sigaction sigaction_t;
#include "SigAction.h"
#endif
#include <ncurses.h>
#include "curses.h"
#define min(a,b) ((a) > (b) ? (b) : (a))
#define max(a,b) ((a) < (b) ? (b) : (a))
@ -34,17 +34,19 @@ typedef struct sigaction sigaction_t;
#define CHANGED -1
extern int _coloron;
extern int _isendwin;
extern WINDOW *newscr;
#ifdef TRACE
#define T(a) if (_tracing) _tracef a
#define T(a) if (_tracing & TRACE_ORDINARY) _tracef a
#define TR(n, a) if (_tracing & (n)) _tracef a
extern int _tracing;
extern char *visbuf(const char *);
#else
#define T(a)
#define T(a)
#define TR(n, a)
#endif
extern int _outc(char);
extern int _outch(char);
extern void init_acs(void);
extern void tstp(int);
extern WINDOW *makenew(int, int, int, int);
@ -79,6 +81,7 @@ typedef struct {
struct screen {
FILE *_ifp; /* input file ptr for this terminal */
FILE *_ofp; /* output file ptr for this terminal */
int _checkfd;
#ifdef MYTINFO
struct _terminal *_term;
#else
@ -86,11 +89,16 @@ struct screen {
#endif
WINDOW *_curscr; /* windows specific to a given terminal */
WINDOW *_newscr;
WINDOW *_stdscr;
struct try *_keytry; /* "Try" for use with keypad mode */
unsigned int _fifo[FIFO_SIZE]; /* Buffer for pushed back characters */
signed char _fifohead,
signed char _fifohead,
_fifotail,
_fifopeek;
bool _endwin;
chtype _current_attr;
bool _coloron;
int _cursor; /* visibility of the cursor */
int _cursrow; /* Row and column of physical cursor */
int _curscol;
bool _nl; /* True if NL -> CR/NL is on */

View File

@ -5,7 +5,7 @@
#include "curses.priv.h"
#include <nterm.h>
#include "terminfo.h"
#include <string.h>
/* line graphics */
@ -67,7 +67,7 @@ void init_acs()
acs_map['0'] = (chtype)'#' & A_CHARTEXT;
if (ena_acs != NULL)
tputs(ena_acs, 1, _outc);
putp(ena_acs);
if (acs_chars != NULL) {
int i = 0;
@ -91,8 +91,7 @@ void init_acs()
}
#ifdef TRACE
else {
if (_tracing)
_tracef("acsc not defined, using default mapping");
T(("acsc not defined, using default mapping"));
}
#endif
}

View File

@ -13,25 +13,23 @@
#include "curses.priv.h"
#include "unctrl.h"
int
waddch(WINDOW *win, chtype c)
static int
wladdch(WINDOW *win, chtype c, bool literal)
{
int x, y;
int newx;
chtype ch = c;
#if 0
/* enabling this causes tons of tracing output
and slow ncurses down to a crawl */
T(("waddch(%x,%c (%x)) called", win, ch&A_CHARTEXT, ch));
#endif
x = win->_curx;
y = win->_cury;
if (y > win->_maxy || x > win->_maxx || y < 0 || x < 0)
return(ERR);
/* ugly, but necessary --- and, bizarrely enough, even portable! */
if (literal)
goto noctrl;
switch (ch&A_CHARTEXT) {
case '\t':
for (newx = x + (8 - (x & 07)); x < newx; x++)
@ -40,7 +38,7 @@ chtype ch = c;
return(OK);
case '\n':
wclrtoeol(win);
x = 0;
x = 0;
goto newline;
case '\r':
x = 0;
@ -53,8 +51,17 @@ chtype ch = c;
if (ch < ' ')
return(waddstr(win, unctrl(ch)));
/* FALL THROUGH */
noctrl:
T(("win attr = %x", win->_attrs));
ch |= win->_attrs;
if (win->_line[y][x]&A_CHARTEXT == ' ')
ch |= win->_bkgd;
else
ch |= (win->_bkgd&A_ATTRIBUTES);
T(("bkg = %x -> ch = %x", win->_bkgd, ch));
if (win->_line[y][x] != ch) {
if (win->_firstchar[y] == _NOCHANGE)
win->_firstchar[y] = win->_lastchar[y] = x;
@ -65,6 +72,7 @@ chtype ch = c;
}
T(("char %d of line %d is %x", x, y, ch));
win->_line[y][x++] = ch;
if (x > win->_maxx) {
x = 0;
@ -84,3 +92,16 @@ chtype ch = c;
return(OK);
}
int waddch(WINDOW *win, chtype ch)
{
TR(TRACE_CHARPUT, ("waddch(%x,%c (%x)) called", win, ch&A_CHARTEXT, ch));
return wladdch(win, ch, FALSE);
}
int wechochar(WINDOW *win, chtype ch)
{
T(("wechochar(%x,%c (%x)) called", win, ch&A_CHARTEXT, ch));
return wladdch(win, ch, TRUE);
}

View File

@ -15,21 +15,21 @@
int
waddnstr(WINDOW *win, char *str, int n)
{
T(("waddnstr(%x,%s,%d) called", win, str, n));
T(("waddnstr(%x,\"%s\",%d) called", win, visbuf(str), n));
if (str == NULL)
return ERR;
if (n < 0) {
while (*str != '\0') {
if (waddch(win, (unsigned char)*str++) == ERR)
if (waddch(win, (chtype)(unsigned char)*str++) == ERR)
return(ERR);
}
return OK;
}
while((n-- > 0) && (*str != '\0')) {
if (waddch(win, (unsigned char)*str++) == ERR)
if (waddch(win, (chtype)(unsigned char)*str++) == ERR)
return ERR;
}
return OK;
@ -42,14 +42,14 @@ waddchnstr(WINDOW *win, chtype *str, int n)
if (n < 0) {
while (*str) {
if (waddch(win, *str++) == ERR)
if (waddch(win, (chtype)(unsigned char)*str++) == ERR)
return(ERR);
}
return OK;
}
while(n-- > 0) {
if (waddch(win, *str++) == ERR)
if (waddch(win, (chtype)(unsigned char)*str++) == ERR)
return ERR;
}
return OK;

View File

@ -11,7 +11,7 @@
*/
#include "curses.priv.h"
#include <nterm.h>
#include "terminfo.h"
/*
* beep()
@ -27,9 +27,9 @@ int beep()
/* should make sure that we are not in altchar mode */
if (bell)
return(tputs(bell, 1, _outc));
return(putp(bell));
else if (flash_screen)
return(tputs(flash_screen, 1, _outc));
return(putp(flash_screen));
else
return(ERR);
}
@ -48,9 +48,9 @@ int flash()
/* should make sure that we are not in altchar mode */
if (flash_screen)
return(tputs(flash_screen, 1, _outc));
return(putp(flash_screen));
else if (bell)
return(tputs(bell, 1, _outc));
return(putp(bell));
else
return(ERR);
}

37
lib/libncurses/lib_bkgd.c Normal file
View File

@ -0,0 +1,37 @@
/***************************************************************************
* COPYRIGHT NOTICE *
****************************************************************************
* ncurses is copyright (C) 1992, 1993, 1994 *
* by Zeyd M. Ben-Halim *
* zmbenhal@netcom.com *
* *
* Permission is hereby granted to reproduce and distribute ncurses *
* by any means and for any fee, whether alone or as part of a *
* larger distribution, in source or in binary form, PROVIDED *
* this notice is included with any such distribution, not removed *
* from header files, and is reproduced in any documentation *
* accompanying it or the applications linked with it. *
* *
* ncurses comes AS IS with no warranty, implied or expressed. *
* *
***************************************************************************/
#include "curses.h"
#include "curses.priv.h"
int wbkgd(WINDOW *win, chtype ch)
{
int x, y;
T(("wbkgd(%x, %x) called", win, ch));
for (y = 0; y < win->_maxy; y++)
for (x = 0; x < win->_maxx; x++)
if (win->_line[y][x]&A_CHARTEXT == ' ')
win->_line[y][x] |= ch;
else
win->_line[y][x] |= (ch&A_ATTRIBUTES);
touchwin(win);
return OK;
}

View File

@ -8,29 +8,29 @@
*
*/
#include <stdlib.h>
#include "curses.priv.h"
#include <nterm.h>
#include "terminfo.h"
int COLOR_PAIRS;
int COLORS;
unsigned char color_pairs[64];
int _coloron = 0;
unsigned char *color_pairs;
int start_color()
{
T(("start_color() called."));
if (orig_pair != NULL)
tputs(orig_pair, 1, _outc);
putp(orig_pair);
else return ERR;
if (max_pairs != -1)
COLOR_PAIRS = max_pairs;
else return ERR;
color_pairs = malloc(max_pairs);
if (max_colors != -1)
COLORS = max_colors;
else return ERR;
_coloron = 1;
SP->_coloron = 1;
T(("started color: COLORS = %d, COLOR_PAIRS = %d", COLORS, COLOR_PAIRS));
@ -41,7 +41,7 @@ int init_pair(short pair, short f, short b)
{
T(("init_pair( %d, %d, %d )", pair, f, b));
if ((pair < 1) || (pair > COLOR_PAIRS))
if ((pair < 1) || (pair >= COLOR_PAIRS))
return ERR;
if ((f < 0) || (f >= COLORS) || (b < 0) || (b >= COLORS))
return ERR;
@ -53,7 +53,7 @@ int init_pair(short pair, short f, short b)
color_pairs[pair] = ( (f & 0x0f) | (b & 0x0f) << 4 );
return color_pairs[pair];
return OK;
}
int init_color(short color, short r, short g, short b)
@ -68,7 +68,7 @@ int init_color(short color, short r, short g, short b)
if (r < 0 || r > 1000 || g < 0 || g > 1000 || b < 0 || b > 1000)
return ERR;
tputs(tparm(initialize_color, color, r, g, b), 1, _outc);
putp(tparm(initialize_color, color, r, g, b));
return OK;
}

View File

@ -11,7 +11,7 @@
*/
#include "curses.priv.h"
#include <nterm.h>
#include "terminfo.h"
int wdelch(WINDOW *win)
{

View File

@ -12,9 +12,13 @@
*-----------------------------------------------------------------*/
#include <stdlib.h>
#include <sys/time.h>
#ifdef SYS_SELECT
#include <sys/select.h>
#endif
#include <string.h>
#include "curses.priv.h"
#include <nterm.h>
#include "terminfo.h"
#ifdef SVR4_ACTION
#define _POSIX_SOURCE
#endif
@ -30,9 +34,12 @@ static void DelChar( int count );
static inline void PutAttrChar(chtype ch)
{
TR(TRACE_CHARPUT, ("PutAttrChar(%s, %s)",
_tracechar(ch & A_CHARTEXT),
_traceattr((ch & (chtype)A_ATTRIBUTES))));
if (curscr->_attrs != (ch & (chtype)A_ATTRIBUTES)) {
curscr->_attrs = ch & (chtype)A_ATTRIBUTES;
vidputs(curscr->_attrs, _outc);
vidputs(curscr->_attrs, _outch);
}
putc(ch & A_CHARTEXT, SP->_ofp);
}
@ -41,9 +48,8 @@ static int LRCORNER = FALSE;
static inline void PutChar(chtype ch)
{
T(("puttin %x", ch));
if (LRCORNER == TRUE && SP->_curscol == columns-1) {
int i = lines;
int i = lines -1;
int j = columns -1;
LRCORNER = FALSE;
@ -52,21 +58,21 @@ static inline void PutChar(chtype ch)
)
return;
if (cursor_left)
tputs(cursor_left, 1, _outc);
putp(cursor_left);
else
mvcur(-1, -1, i-1, j);
mvcur(-1, -1, i, j);
PutAttrChar(ch);
if (cursor_left)
tputs(cursor_left, 1, _outc);
putp(cursor_left);
else
mvcur(-1, -1, i-1, j);
mvcur(-1, -1, i, j);
if (enter_insert_mode && exit_insert_mode) {
tputs(enter_insert_mode, 1, _outc);
PutAttrChar(newscr->_line[i-1][columns-2]);
tputs(exit_insert_mode, 1, _outc);
putp(enter_insert_mode);
PutAttrChar(newscr->_line[i][j-1]);
putp(exit_insert_mode);
} else if (insert_character) {
tputs(insert_character, 1, _outc);
PutAttrChar(newscr->_line[i-1][columns-2]);
putp(insert_character);
PutAttrChar(newscr->_line[i][j-1]);
}
return;
}
@ -89,9 +95,12 @@ static inline void GoTo(int row, int col)
SP->_curscol = col;
}
int _outc(char ch)
int _outch(char ch)
{
putc(ch, SP->_ofp);
if (SP != NULL)
putc(ch, SP->_ofp);
else
putc(ch, stdout);
return OK;
}
@ -107,16 +116,29 @@ sigaction_t act, oact;
act.sa_flags = 0;
sigaction(SIGTSTP, &act, &oact);
if (_isendwin == 1) {
if (SP->_endwin == TRUE) {
T(("coming back from shell mode"));
reset_prog_mode();
/* is this necessary? */
if (enter_alt_charset_mode)
init_acs();
newscr->_clear = TRUE;
_isendwin = 0;
SP->_endwin = FALSE;
}
/* check for pending input */
{
fd_set fdset;
struct timeval timeout = {0,0};
FD_ZERO(&fdset);
FD_SET(SP->_checkfd, &fdset);
if (select(SP->_checkfd+1, &fdset, NULL, NULL, &timeout) != 0) {
fflush(SP->_ofp);
return OK;
}
}
if (curscr->_clear) { /* force refresh ? */
T(("clearing and updating curscr"));
ClrUpdate(curscr); /* yes, clear all & update */
@ -194,11 +216,9 @@ int lastNonBlank;
for (i = 0; i < lines; i++) {
lastNonBlank = columns - 1;
while (scr->_line[i][lastNonBlank] == BLANK )
while (lastNonBlank >= 0 && scr->_line[i][lastNonBlank] == BLANK)
lastNonBlank--;
T(("updating line %d upto %d", i, lastNonBlank));
/* check if we are at the lr corner */
if (i == lines-1)
if ((auto_right_margin) && !(eat_newline_glitch) &&
@ -221,7 +241,8 @@ int lastNonBlank;
for (; inspace > 0; inspace--)
PutChar(scr->_line[i][j-1]);
} else {
tputs(tparm(parm_right_cursor, inspace), 1, _outc);
putp(tparm(parm_right_cursor, inspace));
SP->_curscol += inspace;
}
inspace = 0;
}
@ -312,7 +333,7 @@ int attrchanged = 0;
T(("back_color_erase, turning attributes off"));
vidattr(curscr->_attrs = A_NORMAL);
}
tputs(clr_eol, 1, _outc);
putp(clr_eol);
}
} else {
lastChar = columns - 1;
@ -382,7 +403,7 @@ int attrchanged = 0;
T(("back_color_erase, turning attributes off"));
vidattr(curscr->_attrs = A_NORMAL);
}
tputs(clr_eol, 1, _outc);
putp(clr_eol);
/* check if we are at the lr corner */
if (lineno == lines-1)
@ -403,11 +424,11 @@ int attrchanged = 0;
return;
oLastChar = columns - 1;
while (oLastChar > firstChar && oldLine[oLastChar] == ' ')
while (oLastChar > firstChar && oldLine[oLastChar] == BLANK)
oLastChar--;
nLastChar = columns - 1;
while (nLastChar > firstChar && newLine[nLastChar] == ' ')
while (nLastChar > firstChar && newLine[nLastChar] == BLANK)
nLastChar--;
if((nLastChar == firstChar) && clr_eol) {
@ -416,9 +437,9 @@ int attrchanged = 0;
T(("back_color_erase, turning attributes off"));
vidattr(curscr->_attrs = A_NORMAL);
}
tputs(clr_eol,1,_outc);
putp(clr_eol);
if(newLine[firstChar] != ' ' ) {
if(newLine[firstChar] != BLANK ) {
/* check if we are at the lr corner */
if (lineno == lines-1)
if ((auto_right_margin) && !(eat_newline_glitch) &&
@ -491,19 +512,19 @@ static void ClearScreen()
T(("ClearScreen() called"));
if (clear_screen) {
tputs(clear_screen, 1, _outc);
putp(clear_screen);
SP->_cursrow = SP->_curscol = 0;
} else if (clr_eos) {
SP->_cursrow = SP->_curscol = -1;
GoTo(0,0);
tputs(clr_eos, 1, _outc);
putp(clr_eos);
} else if (clr_eol) {
SP->_cursrow = SP->_curscol = -1;
while (SP->_cursrow < lines) {
GoTo(SP->_cursrow, 0);
tputs(clr_eol, 1, _outc);
putp(clr_eol);
}
GoTo(0,0);
}
@ -523,15 +544,15 @@ static void InsStr(chtype *line, int count)
T(("InsStr(%x,%d) called", line, count));
if (enter_insert_mode && exit_insert_mode) {
tputs(enter_insert_mode, 1, _outc);
putp(enter_insert_mode);
while (count) {
PutChar(*line);
line++;
count--;
}
tputs(exit_insert_mode, 1, _outc);
putp(exit_insert_mode);
} else if (parm_ich) {
tputs(tparm(parm_ich, count), 1, _outc);
putp(tparm(parm_ich, count));
while (count) {
PutChar(*line);
line++;
@ -539,7 +560,7 @@ static void InsStr(chtype *line, int count)
}
} else {
while (count) {
tputs(insert_character, 1, _outc);
putp(insert_character);
PutChar(*line);
line++;
count--;
@ -563,10 +584,10 @@ static void DelChar(int count)
vidattr(curscr->_attrs = A_NORMAL);
}
if (parm_dch) {
tputs(tparm(parm_dch, count), 1, _outc);
putp(tparm(parm_dch, count));
} else {
while (count--)
tputs(delete_character, 1, _outc);
putp(delete_character);
}
}

View File

@ -10,14 +10,14 @@
**
*/
#include <nterm.h>
#include "terminfo.h"
#include "curses.priv.h"
int _isendwin;
int isendwin()
{
return _isendwin;
if (SP == NULL)
return FALSE;
return SP->_endwin;
}
int
@ -25,19 +25,22 @@ endwin()
{
T(("endwin() called"));
_isendwin = 1;
SP->_endwin = TRUE;
mvcur(-1, -1, lines - 1, 0);
if (exit_ca_mode)
tputs(exit_ca_mode, 1, _outc);
putp(exit_ca_mode);
if (_coloron == 1)
tputs(orig_pair, 1, _outc);
if (SP->_coloron == TRUE)
putp(orig_pair);
if (curscr && (curscr->_attrs != A_NORMAL))
vidattr(curscr->_attrs = A_NORMAL);
if (SP->_cursor != 1)
putp(cursor_normal);
fflush(SP->_ofp);
return(reset_shell_mode());

View File

@ -11,7 +11,7 @@
*/
#include "curses.priv.h"
#include <nterm.h>
#include "terminfo.h"
#define BLANK ' '

View File

@ -14,7 +14,7 @@
#include <string.h>
#include <signal.h>
#include <errno.h>
#ifdef BRAINDEAD
#if defined(BRAINDEAD)
extern int errno;
#endif
#include "curses.priv.h"
@ -79,6 +79,7 @@ unsigned char ch;
n = read(fileno(SP->_ifp), &ch, 1);
if (n == -1 && errno == EINTR)
goto again;
T(("read %d characters", n));
SP->_fifo[tail] = ch;
if (head == -1) head = tail;
t_inc();
@ -139,7 +140,8 @@ int ch;
if (win->_use_keypad)
ch = kgetch(win);
else {
fifo_push();
if (head == -1)
fifo_push();
ch = fifo_pull();
}
@ -182,7 +184,7 @@ kgetch(WINDOW *win)
{
struct try *ptr;
int ch = 0;
int timeleft = 2000;
int timeleft = 1000;
T(("kgetch(%x) called", win));
@ -204,8 +206,7 @@ int timeleft = 2000;
} else { /* go back for another character */
ptr = ptr->child;
T(("going back for more"));
}
else
} else
break;
T(("waiting for rest of sequence"));

View File

@ -42,7 +42,7 @@ int ch;
noecho();
noraw();
cbreak();
keypad(win, FALSE);
keypad(win, TRUE);
erasec = erasechar();
killc = killchar();
@ -81,25 +81,25 @@ int ch;
}
}
win->_curx = 0;
if (win->_cury < win->_maxy)
win->_cury++;
win->_curx = 0;
if (win->_cury < win->_maxy)
win->_cury++;
wrefresh(win);
if (! oldnl)
if (oldnl == FALSE)
nonl();
if (oldecho)
if (oldecho == TRUE)
echo();
if (oldraw)
if (oldraw == TRUE)
raw();
if (! oldcbreak)
if (oldcbreak == FALSE)
nocbreak();
if (oldkeypad)
keypad(win, TRUE);
if (oldkeypad == FALSE)
keypad(win, FALSE);
if (ch == ERR) {
*str = '\0';
@ -107,7 +107,7 @@ int ch;
}
*str = '\0';
T(("wgetnstr returns %s", oldstr));
T(("wgetnstr returns \"%s\"", visbuf(oldstr)));
return(OK);
}

View File

@ -18,11 +18,11 @@ WINDOW *initscr()
#ifdef TRACE
_init_trace();
if (_tracing)
_tracef("initscr() called");
T(("initscr() called"));
#endif
if (newterm(getenv("TERM"), stdout, stdin) == NULL)
return NULL;
return NULL;
else {
def_shell_mode();
def_prog_mode();

View File

@ -14,10 +14,10 @@
#include <stdlib.h>
#include "curses.priv.h"
#include <nterm.h>
#include "terminfo.h"
int
winsdel(WINDOW *win, int n)
winsdelln(WINDOW *win, int n)
{
int ret, sscroll, stop, sbot;

View File

@ -7,7 +7,6 @@
* lib_kernel.c
*
* Misc. low-level routines:
* wattron()
* reset_prog_mode()
* reset_shell_mode()
* baudrate()
@ -21,15 +20,41 @@
*/
#include "curses.priv.h"
#include <nterm.h>
#include "terminfo.h"
int wattron(WINDOW *win, chtype at)
{
win->_attrs &= (unsigned long)0xffff00ff;
win->_attrs |= at;
T(("wattron(%x,%s) current = %s", win, _traceattr(at), _traceattr(win->_attrs)));
if (PAIR_NUMBER(at) > 0x00) {
win->_attrs = (win->_attrs & ~A_COLOR) | at ;
T(("new attribute is %s", _traceattr(win->_attrs)));
} else {
win->_attrs |= at;
T(("new attribute is %s", _traceattr(win->_attrs)));
}
return OK;
}
int wattroff(WINDOW *win, chtype at)
{
#define IGNORE_COLOR_OFF FALSE
T(("wattroff(%x,%s) current = %s", win, _traceattr(at), _traceattr(win->_attrs)));
if (IGNORE_COLOR_OFF == TRUE) {
if (PAIR_NUMBER(at) == 0xff) /* turn off color */
win->_attrs &= ~at;
else /* leave color alone */
win->_attrs &= ~(at|~A_COLOR);
} else {
if (PAIR_NUMBER(at) > 0x00) /* turn off color */
win->_attrs &= ~at;
else /* leave color alone */
win->_attrs &= ~(at|~A_COLOR);
}
T(("new attribute is %s", _traceattr(win->_attrs)));
return OK;
}
#ifndef MYTINFO
int reset_prog_mode()
{
@ -61,6 +86,8 @@ int reset_shell_mode()
int curs_set(int vis)
{
int cursor = SP->_cursor;
T(("curs_set(%d)", vis));
if (vis < 0 || vis > 2)
@ -69,20 +96,43 @@ int curs_set(int vis)
switch(vis) {
case 2:
if (cursor_visible)
tputs(cursor_visible, 1, _outc);
putp(cursor_visible);
break;
case 1:
if (cursor_normal)
tputs(cursor_normal, 1, _outc);
putp(cursor_normal);
break;
case 0:
if (cursor_invisible)
tputs(cursor_invisible, 1, _outc);
putp(cursor_invisible);
break;
}
return OK;
SP->_cursor = vis;
return cursor;
}
int delay_output(int ms)
{
int speed;
T(("delay_output(%d) called", ms));
if (!no_pad_char && (speed = baudrate()) == ERR)
return(ERR);
else {
register int nullcount;
if (!no_pad_char)
for (nullcount = ms * 1000 / speed; nullcount > 0; nullcount--)
putc(*pad_char, SP->_ofp);
(void) fflush(SP->_ofp);
if (no_pad_char)
napms(ms);
}
return OK;
}
/*
* erasechar()
*
@ -208,10 +258,9 @@ int
baudrate()
{
int i, ret;
#ifdef UNTRACE
if (_tracing)
_tracef("baudrate() called");
#endif
T(("baudrate() called"));
#ifdef TERMIOS
ret = cfgetospeed(&cur_term->Nttyb);
#else

View File

@ -12,7 +12,7 @@
#include <string.h>
#include "curses.priv.h"
#include <nterm.h>
#include "terminfo.h"
char *
longname()

View File

@ -15,10 +15,7 @@
int
wmove(WINDOW *win, int y, int x)
{
#ifdef TRACE
if (_tracing)
_tracef("wmove(%x,%d,%d) called", win, y, x);
#endif
T(("wmove(%x,%d,%d) called", win, y, x));
if (x >= 0 && x <= win->_maxx &&
y >= 0 && y <= win->_maxy)

View File

@ -20,7 +20,7 @@
#include <string.h>
#include <stdlib.h>
#include <nterm.h>
#include "terminfo.h"
#include "curses.priv.h"
#ifndef OPT_MVCUR
@ -175,17 +175,14 @@ struct Sequence seqA, seqB, /* allocate work structures */
*try; /* next try */
bool nlstat = SP->_nl; /* nl-output-mapping in effect ?*/
#ifdef TRACE
if (_tracing)
_tracef("=============================\nmvcur(%d,%d,%d,%d) called",
oldrow, oldcol, newrow, newcol);
#endif
T(("=============================\nmvcur(%d,%d,%d,%d) called",
oldrow, oldcol, newrow, newcol));
if ((oldrow == newrow) && (oldcol == newcol))
return OK;
if (oldcol == columns-1 && eat_newline_glitch && auto_right_margin) {
tputs(tparm(cursor_address, newrow, newcol), 1, _outc);
putp(tparm(cursor_address, newrow, newcol));
return OK;
}
@ -255,10 +252,7 @@ bool nlstat = SP->_nl; /* nl-output-mapping in effect ?*/
nl();
#endif
#ifdef TRACE
if (_tracing)
_tracef("===================================");
#endif
T(("==================================="));
return OK;
}
@ -488,10 +482,7 @@ add_seq(struct Sequence *seq1, struct Sequence *seq2)
{
int *vptr;
#ifdef TRACE
if (_tracing)
_tracef("add_seq(%x, %x)", seq1, seq2);
#endif
T(("add_seq(%x, %x)", seq1, seq2));
if(seq1->cost >= INFINITY || seq2->cost >= INFINITY)
seq1->cost = INFINITY;
@ -511,10 +502,7 @@ int *opptr, prm[9], ps, p, op;
int count;
char *sequence();
#ifdef TRACE
if (_tracing)
_tracef("out_seq(%x)", seq);
#endif
T(("out_seq(%x)", seq));
if (seq->cost >= INFINITY)
return;
@ -526,14 +514,14 @@ char *sequence();
for (p = 0; p < ps; p++) /* fill in needed parms */
prm[p] = *(++opptr);
tputs(tparm(sequence(op),
putp(tparm(sequence(op),
prm[0], prm[1], prm[2], prm[3], prm[4],
prm[5], prm[6], prm[7], prm[8]), 1, _outc);
prm[5], prm[6], prm[7], prm[8]));
} else {
count = *(++opptr);
/*rev should save tputs output instead of mult calls */
while (count--) /* do count times */
tputs(sequence(op), 1, _outc);
putp(sequence(op));
}
}
}
@ -550,10 +538,7 @@ char *sequence();
static void
update_ops()
{
#ifdef TRACE
if (_tracing)
_tracef("update_ops()");
#endif
T(("update_ops()"));
if (SP) { /* SP structure exists */
int op;
@ -631,10 +616,8 @@ static void add_op(struct Sequence *seq, int op, ...)
va_list argp;
int num_ps, p;
#ifdef TRACE
if (_tracing)
_tracef("adding op %d to sequence", op);
#endif
T(("adding op %d to sequence", op));
va_start(argp, op);
num_ps = - op_info[op]; /* get parms or -cost */
@ -673,10 +656,8 @@ int num_ps, p;
static char *sequence(int op)
{
#ifdef TRACE
if (_tracing)
_tracef("sequence(%d)", op);
#endif
T(("sequence(%d)", op));
switch(op) {
case CARRIAGE_RETURN:
return (carriage_return);

View File

@ -11,7 +11,7 @@
*/
#include "curses.priv.h"
#include <nterm.h>
#include "terminfo.h"
int mvwin(WINDOW *win, int by, int bx)
{

View File

@ -12,7 +12,7 @@
#include <stdlib.h>
#include "curses.priv.h"
#include <nterm.h>
#include "terminfo.h"
#ifdef SVR4_ACTION
#define _POSIX_SOURCE
#endif
@ -52,7 +52,7 @@ char *use_it = _ncurses_copyright;
use_it = use_it; /* shut up compiler */
#ifdef TRACE
_init_trace();
T(("newterm(%s,%x,%x) called", term, ofp, ifp));
T(("newterm(\"%s\",%x,%x) called", term, ofp, ifp));
#endif
#ifdef MYTINFO
@ -87,6 +87,9 @@ char *use_it = _ncurses_copyright;
SP->_fifohead = -1;
SP->_fifotail = 0;
SP->_fifopeek = 0;
SP->_endwin = FALSE;
SP->_checkfd = fileno(ifp);
typeahead(fileno(ifp));
if (enter_ca_mode)
putp(enter_ca_mode);
@ -108,8 +111,7 @@ char *use_it = _ncurses_copyright;
curscr->_clear = FALSE;
stolen = topstolen = 0;
for (rsp = rippedoff; rsp->line; rsp++)
{
for (rsp = rippedoff; rsp->line; rsp++) {
if (rsp->hook)
if (rsp->line < 0)
rsp->hook(newwin(1,COLS, LINES-1,0), COLS);
@ -131,10 +133,14 @@ char *use_it = _ncurses_copyright;
#if 0
sigaction(SIGSEGV, &act, NULL);
#endif
if (stdscr == NULL)
if ((stdscr = newwin(lines - stolen, columns, topstolen, 0)) == NULL)
return(NULL);
if ((stdscr = newwin(lines - stolen, columns, topstolen, 0)) == NULL)
return(NULL);
SP->_stdscr = stdscr;
def_shell_mode();
def_prog_mode();
T(("newterm returns %x", SP));
return(SP);

View File

@ -11,7 +11,7 @@
*/
#include <stdlib.h>
#include <nterm.h>
#include "terminfo.h"
#include "curses.priv.h"
WINDOW * newwin(int num_lines, int num_columns, int begy, int begx)
@ -83,6 +83,8 @@ int i;
win->_pary = begy;
win->_parx = begx;
win->_attrs = orig->_attrs;
win->_bkgd = orig->_bkgd;
for (i = 0; i < num_lines; i++)
win->_line[i] = &orig->_line[begy++][begx];
@ -142,6 +144,7 @@ WINDOW *win;
win->_flags = 0;
win->_attrs = A_NORMAL;
win->_bkgd = ' ';
win->_clear = (num_lines == lines && num_columns == columns);
win->_idlok = FALSE;

View File

@ -11,15 +11,20 @@
*/
#include <stdlib.h>
#include <nterm.h>
#include "terminfo.h"
#include "curses.priv.h"
int idlok(WINDOW *win, int flag)
{
T(("idlok(%x,%d) called", win, flag));
if (insert_line || delete_line || parm_insert_line || parm_delete_line) {
win->_idlok = flag;
if (flag == FALSE) {
win->_idlok = FALSE;
return OK;
}
if ((insert_line || parm_insert_line) && (delete_line || parm_delete_line)) {
win->_idlok = TRUE;
}
return OK;
}
@ -42,6 +47,10 @@ int leaveok(WINDOW *win, int flag)
T(("leaveok(%x,%d) called", win, flag));
win->_leave = flag;
if (flag == TRUE)
curs_set(0);
else
curs_set(1);
return OK;
}
@ -102,9 +111,9 @@ int keypad(WINDOW *win, int flag)
win->_use_keypad = flag;
if (flag && keypad_xmit)
tputs(keypad_xmit, 1, _outc);
putp(keypad_xmit);
else if (! flag && keypad_local)
tputs(keypad_local, 1, _outc);
putp(keypad_local);
if (SP->_keytry == UNINITIALISED)
init_keytry();
@ -120,9 +129,9 @@ int meta(WINDOW *win, int flag)
win->_use_meta = flag;
if (flag && meta_on)
tputs(meta_on, 1, _outc);
putp(meta_on);
else if (! flag && meta_off)
tputs(meta_off, 1, _outc);
putp(meta_off);
return OK;
}
@ -227,3 +236,17 @@ struct try *ptr, *savedptr;
ptr->value = code;
return;
}
int typeahead(int fd)
{
T(("typeahead(%d) called", fd));
SP->_checkfd = fd;
return OK;
}
int intrflush(WINDOW *win, bool flag)
{
T(("intrflush(%x, %d) called", win, flag));
return OK;
}

View File

@ -84,15 +84,16 @@ int m, n;
return ERR;
T(("three"));
if ((pminrow + smaxrow > win->_maxy) || (pmincol + smaxcol > win->_maxx))
if ((pminrow + smaxrow - sminrow > win->_maxy) ||
(pmincol + smaxcol - smincol > win->_maxx))
return ERR;
T(("pad being refreshed"));
for (i = pminrow, m = sminrow; i <= smaxrow + pminrow; i++, m++) {
j = pmincol;
n = j + smincol;
for (; j <= pmincol + smaxcol; j++, n++) {
for (i = pminrow, m = sminrow; i <= pminrow + smaxrow-sminrow;
i++, m++) {
for (j = pmincol, n = smincol; j <= pmincol + smaxcol-smincol;
j++, n++) {
if (win->_line[i][j] != newscr->_line[m][n]) {
newscr->_line[m][n] = win->_line[i][j];

View File

@ -17,10 +17,7 @@ int printw(char *fmt, ...)
va_list argp;
char buf[BUFSIZ];
#ifdef TRACE
if (_tracing)
_tracef("printw(%s,...) called", fmt);
#endif
T(("printw(\"%s\",...) called", fmt));
va_start(argp, fmt);
vsprintf(buf, fmt, argp);
@ -35,10 +32,7 @@ int wprintw(WINDOW *win, char *fmt, ...)
va_list argp;
char buf[BUFSIZ];
#ifdef TRACE
if (_tracing)
_tracef("wprintw(%x,%s,...) called", win, fmt);
#endif
T(("wprintw(%x,\"%s\",...) called", win, fmt));
va_start(argp, fmt);
vsprintf(buf, fmt, argp);

View File

@ -19,7 +19,7 @@
*/
#include "curses.priv.h"
#include <nterm.h>
#include "terminfo.h"
int raw()
{

View File

@ -10,6 +10,7 @@
**
*/
#include <stdio.h>
#include "curses.priv.h"
int vwscanw(WINDOW *win, char *fmt, va_list argp)
@ -26,10 +27,7 @@ int scanw(char *fmt, ...)
{
va_list ap;
#ifdef TRACE
if (_tracing)
_tracef("scanw(%s,...) called", fmt);
#endif
T(("scanw(\"%s\",...) called", fmt));
va_start(ap, fmt);
return(vwscanw(stdscr, fmt, ap));
@ -39,10 +37,7 @@ int wscanw(WINDOW *win, char *fmt, ...)
{
va_list ap;
#ifdef TRACE
if (_tracing)
_tracef("wscanw(%x,%s,...) called", win, fmt);
#endif
T(("wscanw(%x,\"%s\",...) called", win, fmt));
va_start(ap, fmt);
return(vwscanw(win, fmt, ap));
@ -69,4 +64,3 @@ va_list ap;
}

View File

@ -14,43 +14,100 @@
#include <stdlib.h>
#include "curses.priv.h"
#include <nterm.h>
#include "terminfo.h"
void scroll_window(WINDOW *win, int n, int regtop, int regbottom)
{
int line, i;
chtype *ptr, *temp;
chtype **saved;
chtype blank = ' ';
saved = (chtype **)malloc(sizeof(chtype *) * abs(n));
if (n < 0) {
/* save overwritten lines */
for (i = 0; i < -n; i++)
saved[i] = win->_line[regbottom-i];
/* shift n lines */
for (line = regbottom; line >= regtop-n; line--)
win->_line[line] = win->_line[line+n];
/* restore saved lines and blank them */
for (i = 0, line = regtop; line < regtop-n; line++, i++) {
win->_line[line] = saved[i];
temp = win->_line[line];
for (ptr = temp; ptr - temp <= win->_maxx; ptr++)
*ptr = blank;
}
} else {
/* save overwritten lines */
for (i = 0; i < n; i++)
saved[i] = win->_line[regtop+i];
/* shift n lines */
for (line = regtop; line <= regbottom-n; line++)
win->_line[line] = win->_line[line+n];
/* restore saved lines and blank them */
for (i = 0, line = regbottom; line > regbottom - n; line--, i++) {
win->_line[line] = saved[i];
temp = win->_line[line];
for (ptr = temp; ptr - temp <= win->_maxx; ptr++)
*ptr = blank;
}
}
free(saved);
}
int
wscrl(WINDOW *win, int n)
{
int line, i, touched = 0;
chtype *ptr, *temp;
chtype **saved, **newsaved = NULL, **cursaved = NULL;
chtype blank = ' ';
int physical = FALSE;
int i;
T(("wscrl(%x,%d) called", win, n));
if (! win->_scroll)
if (! win->_scroll)
return ERR;
if (n == 0)
return OK;
/* test for scrolling region == entire screen */
/* as an optimization, if the scrolling region is the entire screen
scroll the physical screen */
/* should we extend this to include smaller scrolling ranges by using
change_scroll_region? */
if ( win->_begx == 0 && win->_maxx == columns - 1
&& !memory_above && !memory_below
&& ((win->_regtop == 0 && win->_regbottom == lines - 1
&& ( (n < 0 && (parm_rindex || scroll_reverse))
|| (n > 0 && (parm_index || scroll_forward))
)
) || (win->_idlok && (parm_insert_line || insert_line)
&& (parm_delete_line || delete_line)
)
if ( win->_begx == 0 && win->_maxx == columns - 1
&& !memory_above && !memory_below
&& ((win->_regtop == 0 && win->_regbottom == lines - 1
&& ( (n < 0 && (parm_rindex || scroll_reverse))
|| (n > 0 && (parm_index || scroll_forward))
)
) || (win->_idlok && (parm_insert_line || insert_line)
&& (parm_delete_line || delete_line)
)
)
)
) {
physical = TRUE;
if (physical == TRUE) {
wrefresh(win);
scroll_window(curscr, n, win->_begy+win->_regtop, win->_begy+win->_regbottom);
scroll_window(newscr, n, win->_begy+win->_regtop, win->_begy+win->_regbottom);
}
scroll_window(win, n, win->_regtop, win->_regbottom);
if (physical == TRUE) {
if (n < 0) {
if ( win->_regtop == 0 && win->_regbottom == lines - 1
&& (parm_rindex || scroll_reverse)
@ -118,107 +175,8 @@ chtype blank = ' ';
}
mvcur(-1, -1, win->_cury, win->_curx);
touched = 1;
}
} else
touchline(win, win->_regtop, win->_regbottom - win->_regtop + 1);
saved = (chtype **)malloc(sizeof(chtype *) * abs(n));
if (touched) {
newsaved = (chtype **)malloc(sizeof(chtype *) * abs(n));
cursaved = (chtype **)malloc(sizeof(chtype *) * abs(n));
}
if (n < 0) {
/* save overwritten lines */
for (i = 0; i < -n; i++) {
saved[i] = win->_line[win->_regbottom-i];
if (touched) {
newsaved[i] = newscr->_line[win->_begy+win->_regbottom-i];
cursaved[i] = curscr->_line[win->_begy+win->_regbottom-i];
}
}
/* shift n lines */
for (line = win->_regbottom; line >= win->_regtop - n; line--) {
win->_line[line] = win->_line[line+n];
if (touched) {
newscr->_line[win->_begy+line] = newscr->_line[win->_begy+line+n];
curscr->_line[win->_begy+line] = curscr->_line[win->_begy+line+n];
}
}
/* restore saved lines and blank them */
for (i = 0, line = win->_regtop; line < win->_regtop-n; line++, i++) {
win->_line[line] = saved[i];
if (touched) {
newscr->_line[win->_begy+line] = newsaved[i];
curscr->_line[win->_begy+line] = cursaved[i];
}
temp = win->_line[line];
for (ptr = temp; ptr - temp <= win->_maxx; ptr++)
*ptr = blank;
if (touched) {
temp = newscr->_line[win->_begy+line];
for (ptr = temp; ptr - temp <= newscr->_maxx; ptr++)
*ptr = blank;
temp = curscr->_line[win->_begy+line];
for (ptr = temp; ptr - temp <= curscr->_maxx; ptr++)
*ptr = blank;
}
}
} else {
/* save overwritten lines */
for (i = 0; i < n; i++) {
saved[i] = win->_line[win->_regtop+i];
if (touched) {
newsaved[i] = newscr->_line[win->_begy+win->_regtop+i];
cursaved[i] = curscr->_line[win->_begy+win->_regtop+i];
}
}
/* shift n lines */
for (line = win->_regtop; line <= win->_regbottom - n; line++) {
win->_line[line] = win->_line[line+n];
if (touched) {
newscr->_line[win->_begy+line] = newscr->_line[win->_begy+line+n];
curscr->_line[win->_begy+line] = curscr->_line[win->_begy+line+n];
}
}
/* restore saved lines and blank them */
for (i = 0, line = win->_regbottom; line > win->_regbottom - n; line--, i++) {
win->_line[line] = saved[i];
if (touched) {
newscr->_line[win->_begy+line] = newsaved[i];
curscr->_line[win->_begy+line] = cursaved[i];
}
temp = win->_line[line];
for (ptr = temp; ptr - temp <= win->_maxx; ptr++)
*ptr = blank;
if (touched) {
temp = newscr->_line[win->_begy+line];
for (ptr = temp; ptr - temp <= newscr->_maxx; ptr++)
*ptr = blank;
temp = curscr->_line[win->_begy+line];
for (ptr = temp; ptr - temp <= curscr->_maxx; ptr++)
*ptr = blank;
}
}
}
free(saved);
if (touched) {
free(newsaved);
free(cursaved);
}
if (!touched)
touchline(win, win->_regtop, win->_regbottom - win->_regtop + 1);
return OK;
return OK;
}

View File

@ -11,22 +11,26 @@
*/
#include "curses.priv.h"
#include "terminfo.h"
int wsetscrreg(WINDOW *win, int top, int bottom)
{
T(("wsetscrreg(%x,%d,%d) called", win, top, bottom));
T(("wsetscrreg(%x,%d,%d) called", win, top, bottom));
if (top >= 0 && top <= win->_maxy &&
bottom >= 0 && bottom <= win->_maxy &&
bottom > top)
{
win->_regtop = top;
win->_regbottom = bottom;
win->_regtop = top;
win->_regbottom = bottom;
T(("correctly set scrolling region between %d and %d", top, bottom));
if (change_scroll_region != NULL) {
T(("changing scroll region"));
putp(tparm(change_scroll_region, top, bottom));
}
return(OK);
}
else
return(ERR);
return(OK);
} else
return(ERR);
}

View File

@ -11,7 +11,7 @@
*/
#include "curses.priv.h"
#include <nterm.h>
#include "terminfo.h"
struct screen *
set_term(screen)
@ -19,10 +19,7 @@ struct screen *screen;
{
struct screen *oldSP;
#ifdef TRACE
if (_tracing)
_tracef("set_term(%o) called", screen);
#endif
T(("set_term(%o) called", screen));
oldSP = SP;
SP = screen;
@ -30,6 +27,7 @@ struct screen *oldSP;
cur_term = SP->_term;
curscr = SP->_curscr;
newscr = SP->_newscr;
stdscr = SP->_stdscr;
return(oldSP);
}

View File

@ -8,7 +8,7 @@
* code under the terms of the GNU Copyleft.
*/
#include <nterm.h>
#include "terminfo.h"
#include "curses.priv.h"
#include <string.h>
#include <stdlib.h>
@ -26,10 +26,8 @@ char *
slk_label(int n)
{
SLK *slk = SP->_slk;
#ifdef TRACE
if (_tracing)
_tracef("slk_label(%d)", n);
#endif
T(("slk_label(%d)", n));
if (slk == NULL || n < 1 || n > 8)
return NULL;
@ -44,10 +42,7 @@ static void
slk_intern_refresh(SLK *slk)
{
int i;
#ifdef TRACE
if (_tracing)
_tracef("slk_intern_refresh(%x)", slk);
#endif
T(("slk_intern_refresh(%x)", slk));
for (i = 0; i < 8; i++) {
if (slk->dirty || slk->ent[i].dirty) {
@ -71,10 +66,8 @@ int
slk_noutrefresh(void)
{
SLK *slk = SP->_slk;
#ifdef TRACE
if (_tracing)
_tracef("slk_noutrefresh()");
#endif
T(("slk_noutrefresh()"));
if (slk == NULL)
return ERR;
@ -92,10 +85,8 @@ int
slk_refresh(void)
{
SLK *slk = SP->_slk;
#ifdef TRACE
if (_tracing)
_tracef("slk_refresh()");
#endif
T(("slk_refresh()"));
if (slk == NULL)
return ERR;
@ -113,10 +104,8 @@ int
slk_restore(void)
{
SLK *slk = SP->_slk;
#ifdef TRACE
if (_tracing)
_tracef("slk_restore()");
#endif
T(("slk_restore()"));
if (slk == NULL)
return ERR;
@ -134,10 +123,7 @@ slk_set(int i, char *str, int format)
{
SLK *slk = SP->_slk;
int len;
#ifdef TRACE
if (_tracing)
_tracef("slk_set(%d, %s, %d)", i, str, format);
#endif
T(("slk_set(%d, \"%s\", %d)", i, str, format));
if (slk == NULL || i < 1 || i > 8 || format < 0 || format > 2)
return ERR;
@ -172,10 +158,7 @@ int
slk_touch(void)
{
SLK *slk = SP->_slk;
#ifdef TRACE
if (_tracing)
_tracef("slk_touch()");
#endif
T(("slk_touch()"));
if (slk == NULL)
return ERR;
@ -191,10 +174,8 @@ int
slk_clear(void)
{
SLK *slk = SP->_slk;
#ifdef TRACE
if (_tracing)
_tracef("slk_clear()");
#endif
T(("slk_clear()"));
if (slk == NULL)
return ERR;
@ -213,10 +194,8 @@ slk_initialize(WINDOW *stwin, int cols)
{
SLK *slk;
int i, maxlab, x;
#ifdef TRACE
if (_tracing)
_tracef("slk_initialize()");
#endif
T(("slk_initialize()"));
if ((SP->_slk = slk = (SLK*) calloc(1,sizeof(SLK))) == NULL)
return OK;

View File

@ -13,7 +13,7 @@
#include <fcntl.h>
#include <errno.h>
#include "curses.priv.h"
#include <nterm.h>
#include "terminfo.h"
#if defined(BRAINDEAD)
extern int errno;
@ -43,19 +43,12 @@ static int been_here = 0;
}
void traceon()
void trace(const unsigned int tracelevel)
{
_tracing = 1;
_tracing = tracelevel;
}
void traceoff()
{
_tracing = 0;
}
char *_traceattr(int newmode)
{
static char buf[BUFSIZ];
@ -98,8 +91,8 @@ colors[] =
(void) sprintf(buf + strlen(buf),
"COLOR_PAIR(%d) = (%s, %s), ",
pairnum,
colors[BG(color_pairs[pairnum])].name,
colors[FG(color_pairs[pairnum])].name
colors[FG(color_pairs[pairnum])].name,
colors[BG(color_pairs[pairnum])].name
);
}
if ((newmode & A_ATTRIBUTES) == 0)
@ -109,7 +102,7 @@ colors[] =
return(strcat(buf,"}"));
}
static char *visbuf(const char *buf)
char *visbuf(const char *buf)
/* visibilize a given string */
{
static char vbuf[BUFSIZ];
@ -154,17 +147,33 @@ static char *visbuf(const char *buf)
return(vbuf);
}
char *_tracechar(const unsigned char ch)
{
static char crep[20];
/*
* We can show the actual character if it's either an ordinary printable
* or one of the high-half characters.
*/
if (isprint(ch) || (ch & 0x80))
{
crep[0] = '\'';
crep[1] = ch; /* necessary; printf tries too hard on metachars */
(void) sprintf(crep + 2, "' = 0x%02x", ch);
}
else
(void) sprintf(crep, "0x%02x", ch);
return(crep);
}
void
_tracef(char *fmt, ...)
{
va_list ap;
char buffer[256];
char *vp;
va_start(ap, fmt);
vsprintf(buffer, fmt, ap);
vp = visbuf(buffer);
write(tracefd, vp, strlen(vp));
write(tracefd, buffer, strlen(buffer));
write(tracefd, "\n", 1);
}

View File

@ -11,7 +11,7 @@
*/
#include "curses.priv.h"
#include <nterm.h>
#include "terminfo.h"
#ifdef SVR4_ACTION
#define _POSIX_SOURCE
#endif
@ -41,7 +41,7 @@ sigset_t mask;
reset_prog_mode();
flushinp();
if (enter_ca_mode)
tputs(enter_ca_mode, 1, _outc);
putp(enter_ca_mode);
doupdate();
}

View File

@ -1,6 +1,6 @@
/* This work is copyrighted. See COPYRIGHT.OLD & COPYRIGHT.NEW for *
* details. If they are missing then this copy is in violation of *
* the copyright conditions. */
/* This work is copyrighted. See COPYRIGHT.OLD & COPYRIGHT.NEW for *
* details. If they are missing then this copy is in violation of *
* the copyright conditions. */
/*
** lib_twait.c
@ -10,10 +10,26 @@
*/
#include <string.h>
#include <sys/types.h> /* some systems can't live without this */
#include <sys/time.h>
#include <unistd.h>
#if defined(SYS_SELECT)
#include <sys/select.h>
#endif
#include "curses.priv.h"
#if defined(NOUSLEEP)
void usleep(unsigned int usec)
{
struct timeval tval;
tval.tv_sec = usec / 1000000;
tval.tv_usec = usec % 1000000;
select(0, NULL, NULL, NULL, &tval);
}
#endif
int timed_wait(int fd, int wait, int *timeleft)
{
int result;
@ -22,38 +38,38 @@ static fd_set set;
#ifndef GOOD_SELECT
struct timeval starttime, returntime;
gettimeofday(&starttime, NULL);
gettimeofday(&starttime, NULL);
#endif
FD_ZERO(&set);
FD_SET(fd, &set);
FD_ZERO(&set);
FD_SET(fd, &set);
/* the units of wait are milliseconds */
timeout.tv_sec = wait / 1000;
timeout.tv_usec = (wait % 1000) * 1000;
/* the units of wait are milliseconds */
timeout.tv_sec = wait / 1000;
timeout.tv_usec = (wait % 1000) * 1000;
T(("start twait: sec = %d, usec = %d", timeout.tv_sec, timeout.tv_usec));
T(("start twait: sec = %d, usec = %d", timeout.tv_sec, timeout.tv_usec));
result = select(fd+1, &set, NULL, NULL, &timeout);
result = select(fd+1, &set, NULL, NULL, &timeout);
#ifndef GOOD_SELECT
gettimeofday(&returntime, NULL);
timeout.tv_sec -= (returntime.tv_sec - starttime.tv_sec);
timeout.tv_usec -= (returntime.tv_usec - starttime.tv_usec);
if (timeout.tv_usec < 0 && timeout.tv_sec > 0) {
gettimeofday(&returntime, NULL);
timeout.tv_sec -= (returntime.tv_sec - starttime.tv_sec);
timeout.tv_usec -= (returntime.tv_usec - starttime.tv_usec);
if (timeout.tv_usec < 0 && timeout.tv_sec > 0) {
timeout.tv_sec--;
timeout.tv_usec += 1000000;
}
if (timeout.tv_sec < 0)
}
if (timeout.tv_sec < 0)
timeout.tv_sec = timeout.tv_usec = 0;
#endif
/* return approximate time left on the timeout, in milliseconds */
if (timeleft)
/* return approximate time left on the timeout, in milliseconds */
if (timeleft)
*timeleft = (timeout.tv_sec * 1000) + (timeout.tv_usec / 1000);
T(("end twait: returned %d, sec = %d, usec = %d (%d msec)",
result, timeout.tv_sec, timeout.tv_usec, *timeleft));
T(("end twait: returned %d, sec = %d, usec = %d (%d msec)",
result, timeout.tv_sec, timeout.tv_usec, *timeleft));
return(result);
return(result);
}

View File

@ -1,4 +1,6 @@
#ifdef __FreeBSD__
#include <ctype.h>
#endif
#include <unctrl.h>
char *
@ -6,7 +8,11 @@ char *
{
static char buffer[3] = "^x";
if (isgraph(uch)) {
#ifdef __FreeBSD__
if (isprint(uch)) {
#else
if ((uch & 0x60) != 0 && uch != 0x7F) {
#endif
/*
* Printable character. Simply return the character as a one-character
* string.

View File

@ -1,7 +1,21 @@
/* This work is copyrighted. See COPYRIGHT.OLD & COPYRIGHT.NEW for *
* details. If they are missing then this copy is in violation of *
* the copyright conditions. */
/***************************************************************************
* COPYRIGHT NOTICE *
****************************************************************************
* ncurses is copyright (C) 1992, 1993, 1994 *
* by Zeyd M. Ben-Halim *
* zmbenhal@netcom.com *
* *
* Permission is hereby granted to reproduce and distribute ncurses *
* by any means and for any fee, whether alone or as part of a *
* larger distribution, in source or in binary form, PROVIDED *
* this notice is included with any such distribution, not removed *
* from header files, and is reproduced in any documentation *
* accompanying it or the applications linked with it. *
* *
* ncurses comes AS IS with no warranty, implied or expressed. *
* *
***************************************************************************/
/*
* vidputs(newmode, outc)
@ -28,11 +42,11 @@
#include <string.h>
#include "curses.priv.h"
#include <nterm.h>
#include "terminfo.h"
static void do_color(int pair, int (*outc)(char))
{
short fg, bg;
int fg, bg;
if ( pair == 0 ) {
tputs(orig_pair, 1, outc);
@ -53,84 +67,71 @@ short fg, bg;
}
}
static int current_pair = 0;
static chtype previous_attr = 0;
#define previous_attr SP->_current_attr
int vidputs(chtype newmode, int (*outc)(char))
{
chtype turn_off, turn_on;
chtype turn_off = (~newmode & previous_attr) & ~A_COLOR;
chtype turn_on = (newmode & ~previous_attr) & ~A_COLOR;
T(("vidputs(%x) called %s", newmode, _traceattr(newmode)));
T(("previous attribute was %s", _traceattr(previous_attr)));
if (newmode == previous_attr)
return OK;
if (newmode == A_NORMAL && exit_attribute_mode) {
if((previous_attr & A_ALTCHARSET) && exit_alt_charset_mode)
tputs(exit_alt_charset_mode, 1, outc);
tputs(exit_attribute_mode, 1, outc);
current_pair = -1;
goto set_color;
}
else if (set_attributes) {
tputs(tparm(set_attributes,
(newmode & A_STANDOUT) != 0,
(newmode & A_UNDERLINE) != 0,
(newmode & A_REVERSE) != 0,
(newmode & A_BLINK) != 0,
(newmode & A_DIM) != 0,
(newmode & A_BOLD) != 0,
(newmode & A_INVIS) != 0,
(newmode & A_PROTECT) != 0,
(newmode & A_ALTCHARSET) != 0), 1, outc);
goto set_color;
} else {
if (exit_attribute_mode) {
if((previous_attr & A_ALTCHARSET) && exit_alt_charset_mode) {
tputs(exit_alt_charset_mode, 1, outc);
previous_attr &= ~A_ALTCHARSET;
}
if (previous_attr) {
T(("exiting attribute mode"));
tputs(exit_attribute_mode, 1, outc);
previous_attr = 0;
current_pair = -1;
}
} else {
turn_off = ~newmode & previous_attr;
T(("turning %x off", turn_off));
if ((turn_off & A_ALTCHARSET) && exit_alt_charset_mode)
tputs(exit_alt_charset_mode, 1, outc);
if ((turn_off & A_BOLD) && exit_standout_mode)
tputs(exit_standout_mode, 1, outc);
if ((turn_off & A_DIM) && exit_standout_mode)
tputs(exit_standout_mode, 1, outc);
if ((turn_off & A_BLINK) && exit_standout_mode)
tputs(exit_standout_mode, 1, outc);
if ((turn_off & A_INVIS) && exit_standout_mode)
tputs(exit_standout_mode, 1, outc);
if ((turn_off & A_PROTECT) && exit_standout_mode)
tputs(exit_standout_mode, 1, outc);
if ((turn_off & A_UNDERLINE) && exit_underline_mode)
tputs(exit_underline_mode, 1, outc);
if ((turn_off & A_REVERSE) && exit_standout_mode)
tputs(exit_standout_mode, 1, outc);
if ((turn_off & A_STANDOUT) && exit_standout_mode)
tputs(exit_standout_mode, 1, outc);
if((previous_attr & A_ALTCHARSET) && exit_alt_charset_mode) {
tputs(exit_alt_charset_mode, 1, outc);
previous_attr &= ~A_ALTCHARSET;
}
if (previous_attr)
tputs(exit_attribute_mode, 1, outc);
} else if (set_attributes) {
if (turn_on || turn_off) {
tputs(tparm(set_attributes,
(newmode & A_STANDOUT) != 0,
(newmode & A_UNDERLINE) != 0,
(newmode & A_REVERSE) != 0,
(newmode & A_BLINK) != 0,
(newmode & A_DIM) != 0,
(newmode & A_BOLD) != 0,
(newmode & A_INVIS) != 0,
(newmode & A_PROTECT) != 0,
(newmode & A_ALTCHARSET) != 0), 1, outc);
}
} else {
turn_on = newmode & ~previous_attr;
T(("turning %x off", _traceattr(turn_off)));
if ((turn_off & A_ALTCHARSET) && exit_alt_charset_mode)
tputs(exit_alt_charset_mode, 1, outc);
T(("turning %x on", turn_on));
if ((turn_off & A_BOLD) && exit_standout_mode)
tputs(exit_standout_mode, 1, outc);
if ((turn_off & A_DIM) && exit_standout_mode)
tputs(exit_standout_mode, 1, outc);
if ((turn_off & A_BLINK) && exit_standout_mode)
tputs(exit_standout_mode, 1, outc);
if ((turn_off & A_INVIS) && exit_standout_mode)
tputs(exit_standout_mode, 1, outc);
if ((turn_off & A_PROTECT) && exit_standout_mode)
tputs(exit_standout_mode, 1, outc);
if ((turn_off & A_UNDERLINE) && exit_underline_mode)
tputs(exit_underline_mode, 1, outc);
if ((turn_off & A_REVERSE) && exit_standout_mode)
tputs(exit_standout_mode, 1, outc);
if ((turn_off & A_STANDOUT) && exit_standout_mode)
tputs(exit_standout_mode, 1, outc);
T(("turning %x on", _traceattr(turn_on)));
if ((turn_on & A_ALTCHARSET) && enter_alt_charset_mode)
tputs(enter_alt_charset_mode, 1, outc);
@ -158,18 +159,18 @@ chtype turn_off, turn_on;
if ((turn_on & A_UNDERLINE) && enter_underline_mode)
tputs(enter_underline_mode, 1, outc);
set_color:
if (_coloron) {
int pair = PAIR_NUMBER(newmode);
T(("old pair = %d -- new pair = %d", current_pair, pair));
if (pair != current_pair) {
current_pair = pair;
do_color(pair, outc);
}
}
}
if (SP->_coloron) {
int pair = PAIR_NUMBER(newmode);
int current_pair = PAIR_NUMBER(previous_attr);
T(("old pair = %d -- new pair = %d", current_pair, pair));
if (pair != current_pair || turn_off) {
do_color(pair, outc);
}
}
previous_attr = newmode;
@ -182,6 +183,6 @@ int vidattr(chtype newmode)
T(("vidattr(%x) called", newmode));
return(vidputs(newmode, _outc));
return(vidputs(newmode, _outch));
}

View File

@ -14,7 +14,7 @@
int mvder(WINDOW *win, int y, int x)
{
return(ERR);
}
void wsyncup(WINDOW *win)
@ -24,7 +24,7 @@ void wsyncup(WINDOW *win)
int syncok(WINDOW *win, bool bf)
{
return(ERR);
}
void wcursyncup(WINDOW *win)
@ -40,12 +40,11 @@ void wsyncdown(WINDOW *win)
WINDOW *dupwin(WINDOW *win)
{
WINDOW *nwin;
#ifdef TRACE
if (_tracing)
_tracef("dupwin(%x) called", win);
#endif
int linesize, i;
if ((nwin = newwin(win->_maxy, win->_maxx, win->_bey, win->_begx)) == NULL)
T(("dupwin(%x) called", win));
if ((nwin = newwin(win->_maxy + 1, win->_maxx + 1, win->_begy, win->_begx)) == NULL)
return NULL;
nwin->_curx = win->_curx;
@ -57,6 +56,7 @@ WINDOW *nwin;
nwin->_flags = win->_flags;
nwin->_attrs = win->_attrs;
nwin->_bkgd = win->_bkgd;
nwin->_clear = win->_clear;
nwin->_scroll = win->_scroll;
@ -73,8 +73,9 @@ WINDOW *nwin;
nwin->_regtop = win->_regtop;
nwin->_regbottom = win->_regbottom;
for (i = 0; i < nwin->_cury; i++) {
memcpy(nwin->_line[i], win->_line[i], win->_maxx * sizeof(chtype));
linesize = (win->_maxx + 1) * sizeof(chtype);
for (i = 0; i <= nwin->_maxy; i++) {
memcpy(nwin->_line[i], win->_line[i], linesize);
nwin->_firstchar[i] = win->_firstchar[i];
nwin->_lastchar[i] = win->_lastchar[i];
}

View File

@ -1,6 +1,6 @@
.TH ncurses 3X ""
.ds n 5
.ds d /usr/lib/terminfo
.ds d @TERMINFO@
.SH NAME
\fBncurses\fR - CRT screen handling and optimization package
.SH SYNOPSIS

View File

@ -1,14 +1,41 @@
#ifndef _TERMCAP_H
#define _TERMCAP_H 1
#ifdef __FreeBSD__
#include <sys/cdefs.h>
#else
#ifndef __P
#if defined(__STDC__) || defined(__cplusplus)
#define __P(protos) protos
#else
#define __P(protos) () /* traditional C preprocessor */
#endif
#endif
#ifndef __BEGIN_DECLS
#ifdef __cplusplus
#define __BEGIN_DECLS extern "C" {
#define __END_DECLS };
#else
#define __BEGIN_DECLS
#define __END_DECLS
#endif
#endif
#endif
__BEGIN_DECLS
#ifndef __FreeBSD__
#include <sys/types.h>
#endif
extern char PC;
extern char *UP;
extern char *BC;
#ifdef __FreeBSD__
extern short ospeed;
#else
extern speed_t ospeed;
#endif
extern int tgetent __P((char *, const char *));
extern int tgetflag __P((const char *));

View File

@ -0,0 +1,2 @@
/* fake header for sources compatibility */
#include <nterm.h>

View File

@ -14,8 +14,6 @@
#ifndef _UNCTRL_H
#define _UNCTRL_H 1
#include <sys/cdefs.h>
extern char *unctrl __P((unsigned char));
extern char *unctrl(unsigned char);
#endif /* _UNCTRL_H */

View File

@ -1,3 +1,3 @@
#define NCURSES_VERSION "1.8.5"
#define NCURSES_VERSION "1.8.6"

View File

@ -1,8 +1,8 @@
# Makefile for ncurses
# $Id: Makefile,v 1.6 1994/10/28 06:56:55 ache Exp $
# $Id: Makefile,v 1.7 1994/11/29 02:48:17 ache Exp $
LIB= ncurses
SRCS= lib_kernel.c lib_pad.c\
SRCS= lib_kernel.c lib_pad.c lib_bkgd.c \
lib_unctrl.c lib_raw.c lib_vidattr.c lib_trace.c lib_beep.c \
lib_doupdate.c lib_refresh.c lib_initscr.c lib_newwin.c lib_addch.c \
lib_addstr.c lib_scroll.c lib_clreol.c lib_touch.c lib_mvcur.c lib_keyname.c\
@ -13,7 +13,7 @@ SRCS= lib_kernel.c lib_pad.c\
lib_newterm.c lib_set_term.c lib_overlay.c lib_scrreg.c lib_color.c \
lib_insstr.c lib_insdel.c lib_twait.c copyright.c
CFLAGS+= -I. -I${.CURDIR} -Wall -DMYTINFO -DTERMIOS -DGOOD_SELECT -DBSDTABS
CFLAGS+= -I. -I${.CURDIR} -Wall -DMYTINFO -DGOOD_SELECT
LDADD+= -lmytinfo
CLEANFILES+= lib_keyname.c keys.tries
@ -21,10 +21,13 @@ CLEANFILES+= lib_keyname.c keys.tries
beforedepend: keys.tries
beforeinstall:
@cd ${.CURDIR}; for i in ncurses.h unctrl.h termcap.h; do \
@cd ${.CURDIR}; for i in unctrl.h termcap.h; do \
cmp -s $$i ${DESTDIR}/usr/include/$$i || \
$(INSTALL) $(COPY) -m 444 -o $(BINOWN) -g $(BINGRP) $$i \
${DESTDIR}/usr/include; done
@cd ${.CURDIR}; cmp -s curses.h ${DESTDIR}/usr/include/ncurses.h || \
$(INSTALL) $(COPY) -m 444 -o $(BINOWN) -g $(BINGRP) curses.h \
${DESTDIR}/usr/include/ncurses.h
keys.tries: ${.CURDIR}/keys.list ${.CURDIR}/MKkeys.awk
awk -f ${.CURDIR}/MKkeys.awk ${.CURDIR}/keys.list > keys.tries