/* 5/15/81 (Berkeley) @(#)curses.h 1.8 */ # ifndef WINDOW # include # define bool char # define reg register # define ERR (0) # define OK (1) # define _SUBWIN 01 # define _ENDLINE 02 # define _FULLWIN 04 # define _SCROLLWIN 010 # define _STANDOUT 0200 # define _NOCHANGE -1 /* * Capabilities from termcap */ extern bool AM, AN, BS, CA, GT, HL, MS, NC, SD; extern bool NONL; extern char *BC, *BT, *CE, *CL, *CM, *HO, *LL, *ND, *SE, *SO, *TA, *TE, *TI, *UC, *UE, *UP, *US, *VE, *VS; struct _win_st { short _cury, _curx; short _maxy, _maxx; short _begy, _begx; short _flags; bool _clear; bool _leave; bool _scroll; char **_y; short *_firstch; short *_lastch; }; # define WINDOW struct _win_st extern bool _echoit, _endwin; extern int LINES, COLS; extern WINDOW *stdscr, *curscr; /* * Define VOID to stop lint from generating "null effect" * comments. */ # ifdef lint int __void__; # define VOID(x) (__void__ = (int) (x)) # else # define VOID(x) (x) # endif /* * psuedo functions for standard screen */ # define addch(ch) VOID(waddch(stdscr, ch)) # define getch() VOID(wgetch(stdscr)) # define addstr(str) VOID(waddstr(stdscr, str)) # define getstr(str) VOID(wgetstr(stdscr, str)) # define move(y, x) VOID(wmove(stdscr, y, x)) # define clear() VOID(wclear(stdscr)) # define erase() VOID(werase(stdscr)) # define ctobot() VOID(wctobot(stdscr)) # define ctoeol() VOID(wctoeol(stdscr)) # define insertln() VOID(winsertln(stdscr)) # define deleteln() VOID(wdeleteln(stdscr)) # define refresh() VOID(wrefresh(stdscr)) # define inch() VOID(winch(stdscr)) # define insch(c) VOID(winsch(stdscr,c)) # define delch() VOID(wdelch(stdscr)) # define stout() VOID(wstout(stdscr)) # define stend() VOID(wstend(stdscr)) /* * mv functions */ #define mvwaddch(win,y,x,ch) VOID(wmove(win,y,x)==ERR?ERR:waddch(win,ch)) #define mvwgetch(win,y,x) VOID(wmove(win,y,x)==ERR?ERR:wgetch(win)) #define mvwaddstr(win,y,x,str) VOID(wmove(win,y,x)==ERR?ERR:waddstr(win,str)) #define mvwgetstr(win,y,x) VOID(wmove(win,y,x)==ERR?ERR:wgetstr(win)) #define mvwinch(win,y,x) VOID(wmove(win,y,x) == ERR ? ERR : winch(win)) #define mvwdelch(win,y,x) VOID(wmove(win,y,x) == ERR ? ERR : wdelch(win)) #define mvwinsch(win,y,x,c) VOID(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 mvaddstr(y,x,str) mvwaddstr(stdscr,y,x,str) #define mvgetstr(y,x) mvwgetstr(stdscr,y,x) #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) /* * psuedo functions */ #define clearok(win,bf) (win->_clear = bf) #define leaveok(win,bf) (win->_leave = bf) #define scrollok(win,bf) (win->_scroll = bf) #define getyx(win,y,x) y = win->_cury, x = win->_curx #define winch(win) (win->_y[win->_cury][win->_curx]) #define echo _echoit=1 #define noecho _echoit=0 WINDOW *initscr(), *newwin(), *subwin(); # endif