home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
rtsi.com
/
2014.01.www.rtsi.com.tar
/
www.rtsi.com
/
OS9
/
OSK
/
EFFO
/
pd7.lzh
/
DEFS
/
curses.h
next >
Wrap
Text File
|
1990-04-01
|
8KB
|
230 lines
/* header defs for curses.l */
#ifndef stdin
# include <stdio.h>
#endif
#ifndef sg_class
# include <sgstat.h>
#endif
#define ECHOON 1
#define ECHOOFF 0
#define TRUE (1)
#define FALSE (0)
#define ERR (0)
#define OK (1)
#define SCFDEV 0
#define OTHERDEV 1
#define TCAPSLEN 300
#define TTYNAMESIZE 50
#define bool char
#define reg register
/* Termcap defs */
char *tgetstr(), *tgoto();
char *getenv();
extern bool AM, BS, CA, DA, DB, EO, GT, HZ, IN, MI, MS, NC, OS, UL, XN;
extern char *AL, *BC, *BT, *CD, *CE, *CL, *CM, *CR, *DC, *DL, *DM, *DO,
*ED, *EI, *HO, *IC, *IM, *IP, *LL, *MA, *ND, *NL, *SE, *SF,
*SO, *SR_, *TA, *TE, *TI, *UC, *UE, *UP, *US, *VB, *VE, *VS;
extern char PC_;
extern int SG;
extern int LINES, COLS; /* lines and columns on physical terminal screen */
extern short ospeed;
extern char termbuf[1024], tcapbuf[TCAPSLEN];
/* physical terminal defs */
extern NONL, UPPERCASE;
extern _devtype;
extern int ttcol, ttrow; /* cursor location */
extern int tt_tabsiz;
int tt_mv(), tt_clrln(), tt_clrscr(), tt_clrpag(), tt_so(), tt_se();
int tt_init(), tt_putc(), tt_puts(), tt_flush();
#define tt_mvputc(r,c,ch) (tt_mv(r,c)==ERR ? ERR : tt_putc(ch))
#define tt_mvputs(r,c,str) (tt_mv(r,c) == ERR ? ERR : tt_puts(str))
#define tt_mvclrln(r,c) (tt_mv(r,c) == ERR : ERR : tt_clrln())
#define tt_mvclrpag(r,c) (tt_mv(r,c) == ERR ? ERR : tt_clrpag())
#define tt_mvso(r,c) (tt_mv(r,c) == ERR ? ERR : tt_so())
#define tt_mvse(r,c) (tt_mv(r,c) == ERR ? ERR : tt_se())
extern struct sgbuf _pdbuf, _savepdbuf; /* the path descriptor buffers */
/* curses defs */
typedef struct WINDOW {
struct WINDOW *w_next, /* next window in list */
*w_prev; /* previous window */
struct WINBUF *w_buf; /* text buffer for this window */
int w_hrow, /* home row on screen */
w_hcol, /* home column on screen */
w_orow, /* offset row in buffer */
w_ocol, /* offset column in buffer */
w_rows, /* number of lines of window on screen */
w_cols, /* number of columns of window on screen */
w_wrow, /* cursor row location in the window */
w_wcol, /* cursor column */
w_sflag, /* flags used by the windowing system */
w_aflag; /* flags for use by the application */
bool w_clear, /* clear screen flag */
w_scroll, /* scroll flag */
w_leave; /* leave cursor flag */
struct WINLIN *w_bline; /* a pointer to the buffer line the cursor is on*/
} WINDOW;
#define W_HIDE 0x01 /* flag that says window should not be displayed */
#define W_SCREEN 0x02 /* window is a screen */
#define W_TOUCH 0x04 /* ignore output optimization */
#define W_NODELAY 0x08 /* if set, getch will return if no data */
#define W_SCROLL 0x10 /* window has very recently been scrolled */
/* i.e., no writes have occurred since scroll */
#define W_STANDOUT 0x0100 /* output to window should be in standout mode */
typedef struct WINBUF {
struct WINBUF *b_next, /* next buffer in list */
*b_prev; /* previous buffer */
struct WINLIN *b_text; /* the first line of text in this buffer */
int b_wcnt, /* number of windows looking at this buffer */
b_lines, /* number of lines in this buffer */
b_lsize, /* default size to allocate for new lines */
b_sflag, /* flags used by the windowing system */
b_aflag; /* flags for use by the application */
} WINBUF;
typedef struct WINLIN {
struct WINLIN *l_next, /* next line of buffer */
*l_prev; /* previous line */
int l_size, /* space allocated for line */
l_sflag, /* flags used by windowing system */
l_aflag; /* flags for use by the application */
char l_text[1]; /* the characters in the line */
} WINLIN;
#define L_CLEAR 0x01 /* line contains all blanks */
extern WINDOW *winhead; /* the root of the window list */
extern WINBUF *bufhead; /* the root of the buffer list */
extern WINDOW *curscr, *virscr, *stdscr; /* standard windows */
extern FILE *bufin;
extern bool _echo, _crmode, _rawmode, _typeahead, _nlmode, My_term;
extern char *Def_term, ttytype[TTYNAMESIZE];
WINDOW *newwin(), *subwin(), *w_open(), *w_linkbuf();
WINBUF *w_bufopen(), *newbuf();
char *w_addline();
# define VOID(x) (x)
/* macro functions */
#define clearok(win,b) (win->w_clear = b)
#define leaveok(win,b) (win->w_leave = b)
#define scrollok(win,b) (win->w_scroll = b)
#define getyx(win,r,c) (r = win->w_wrow, c = win->w_wcol)
#define winch(win) (win->w_bline->l_text[win->w_ocol + win->w_wcol] & 0x7f)
#define wnoutrefresh(win) paint(win)
#define doupdate() _update(virscr)
#define hide(win) (win->w_sflag |= W_HIDE)
#define unhide(win) (win->w_sflag &= ~W_HIDE)
/* stdscr functions */
#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 clrtobot() VOID(wclrtobot(stdscr))
#define clrtoeol() VOID(wclrtoeol(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 standout() VOID(wattron(stdscr, W_STANDOUT))
#define standend() VOID(wattrset(stdscr,0))
#define wstandout(win) VOID(wattron(win, W_STANDOUT))
#define wstandend(win) VOID(wattrset(win, 0))
/* mv function defines */
#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,str) VOID(wmove(win,y,x)==ERR?ERR:wgetstr(win,str))
#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 mvwclrtobot(win,r,c) VOID(wmove(win,r,c) == ERR? ERR: wclrtobot(win))
#define mvwclrtoeol(win,r,c) VOID(wmove(win,r,c)== ERR? ERR: wclrtoeol(win))
#define mvwinsertln(win,r,c) VOID(wmove(win,r,c) == ERR? ERR: winsertln(win))
#define mvwdeleteln(win,r,c) VOID(wmove(win,r,c) == ERR? ERR: wdeleteln(win))
#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,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 mvclrtobot(r,c) mvwclrtobot(stdscr,r,c)
#define mvclrtoeol(r,c) mvwclrtoeol(stdscr,r,c)
#define mvinsertln(r,c) mvwinsertln(stdscr,r,c)
#define mvdeleteln(r,c) mvwdeleteln(stdscr,r,c)
#define crmode() _crmode = TRUE
#define nocrmode() _crmode = FALSE
#define raw() _rawmode = TRUE
#define noraw() _rawmode = FALSE
/* some system five functions */
#define REFRESH 256
#define OUT 257
#define prefresh(pad, pminrow, pmincol, sminrow, smincol, smaxrow, smaxcol) \
_pfresh(pad, pminrow, pmincol, sminrow, smincol, smaxrow, smaxcol, REFRESH)
#define pnoutrefresh(pad, pminrow, pmincol, sminrow, smincol, smaxrow, smaxcol) \
_pfresh(pad, pminrow, pmincol, sminrow, smincol, smaxrow, smaxcol, OUT)
#define tbreak() (_typeahead && chkin())
#define cbreak() crmode()
#define nocbreak() nocrmode()
#define A_STANDOUT W_STANDOUT
#define A_REVERSE 0
#define A_BOLD 0
#define A_DIM 0
#define A_BLINK 0
#define A_UNDERLINE 0
#define A_MASK (A_STANDOUT|A_REVERSE|A_BOLD|A_DIM|A_BLINK|A_UNDERLINE)
#define attron(attr) wattron(stdscr, attr)
#define attoff(attr) wattroff(stdscr, attr)
#define attrset(attr) wattrset(stdscr, attr)