Path: icaen!news.uiowa.edu!uunet!MathWorks.Com!news2.near.net!news.delphi.com!usenet From: Leslie M. Barstow III Newsgroups: comp.binaries.apple2 Subject: Curses.h header - not included in curses package - sorry Date: Tue, 27 Sep 94 02:59:44 -0500 Organization: Delphi (info@delphi.com email, 800-695-4005 voice) Lines: 217 Message-ID: NNTP-Posting-Host: bos1a.delphi.com /* * Copyright 1980 Kenneth C. R. C. Arnold and The Regents of the * University of California. Permission is granted to freely * distribute curses and its documentation provided that this * notice is left intact. * * @(#)curses.h 5.1 (Berkeley) 6/7/85 */ # ifndef WINDOW # include # include # define bool char # define reg register #ifndef TRUE # define TRUE (1) # define FALSE (0) #endif #ifndef ERR # define ERR (0) # define OK (1) #endif # define _ENDLINE 001 # define _FULLWIN 002 # define _SCROLLWIN 004 # define _FLUSH 010 # define _FULLLINE 020 # define _IDLINE 040 # define _STANDOUT 0200 # define _NOCHANGE -1 # define _puts(s) tputs(s, 0, _putchar) typedef struct sgttyb SGTTY; /* * Capabilities from termcap */ extern bool AM, BS, CA, DA, DB, EO, HC, HZ, IN, MI, MS, NC, NS, OS, UL, XB, XN, XT, XS, XX; extern char *AL, *BC, *BT, *CD, *CE, *CL, *CM, *CR, *CS, *DC, *DL, *DM, *DO, *ED, *EI, *K0, *K1, *K2, *K3, *K4, *K5, *K6, *K7, *K8, *K9, *HO, *IC, *IM, *IP, *KD, *KE, *KH, *KL, *KR, *KS, *KU, *LL, *MA, *ND, *NL, *RC, *SC, *SE, *SF, *SO, *SR, *TA, *TE, *TI, *UC, *UE, *UP, *US, *VB, *VS, *VE, *VI, *AL_PARM, *DL_PARM, *UP_PARM, *DOWN_PARM, *LEFT_PARM, *RIGHT_PARM; extern char PC; /* * From the tty modes... */ extern bool GT, NONL, UPPERCASE, normtty, _pfast; struct _win_st { short _cury, _curx; /* window current cursor location */ short _maxy, _maxx; /* window size - bottom-right corner */ short _begy, _begx; /* offset on stdscr for (0, 0) for this window */ short _flags; /* various flags, as above */ short _ch_off; /* offset for subwindow */ bool _clear; /* clear window when next refreshed? */ bool _leave; /* leave cursor at old location */ bool _scroll; /* scroll y/n */ char **_y; /* actual screen data */ short *_firstch; /* array - first changed char pos for line */ short *_lastch; /* array - last changed char pos for line */ struct _win_st *_nextp, *_orig; /* subwindow stuff */ }; # define WINDOW struct _win_st extern bool My_term, _echoit, _rawmode, _endwin; extern char *Def_term, ttytype[]; extern int LINES, COLS, _tty_ch, _res_flg; extern unsigned int curs_vis; extern SGTTY _tty; 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 int waddch(WINDOW *, char); int wgetch(WINDOW *); int waddstr(WINDOW *, char *); int wgetstr(WINDOW *, char *); int wmove(WINDOW *, int, int); int wclear(WINDOW *); int werase(WINDOW *); int wclrtobot(WINDOW *); int wclrtoeol(WINDOW *); int winsertln(WINDOW *); int wdeleteln(WINDOW *); int wrefresh(WINDOW *); int winsch(WINDOW *, char); int wdelch(WINDOW *); int wstandout(WINDOW *); int wstandend(WINDOW *); int delwin(WINDOW *); int box(WINDOW *, char, char); int curs_set(int); int endwin(); WINDOW *initscr(); int mvcur(int, int, int, int); int mvwin(WINDOW *, int, int); WINDOW *newwin(int, int, int, int); WINDOW *subwin(WINDOW *, int, int, int, int); int overlay(WINDOW *, WINDOW *); int overwrite(WINDOW *, WINDOW *); int scroll(WINDOW *); int touchline(WINDOW *, int, int, int); int touchoverlap(WINDOW *, WINDOW *); int touchwin(WINDOW *); char *longname(), *getcap(); /* * psuedo functions for standard screen */ # define addch(ch) waddch(stdscr, ch) # define getch() wgetch(stdscr) # define addstr(str) waddstr(stdscr, str) # 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() winsertln(stdscr) # define deleteln() wdeleteln(stdscr) # define refresh() wrefresh(stdscr) # define inch() winch(stdscr) # define insch(c) winsch(stdscr,c) # define delch() wdelch(stdscr) # define standout() wstandout(stdscr) # define standend() wstandend(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,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 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) /* * psuedo functions */ #define clearok(win,bf) (win->_clear = bf) #define leaveok(win,bf) (win->_leave = bf) #define scrollok(win,bf) (win->_scroll = bf) #define flushok(win,bf) (bf ? (win->_flags |= _FLUSH):(win->_flags &= ~_FLUSH)) #define getyx(win,y,x) y = win->_cury, x = win->_curx #define winch(win) (win->_y[win->_cury][win->_curx] & 0177) #define inch() (stdscr->_y[stdscr->_cury][stdscr->_curx] & 0177) #define raw() (_tty.sg_flags|=RAW, _pfast=_rawmode=TRUE, stty(_tty_ch,&_tty)) #define noraw() (_tty.sg_flags&=~RAW,_rawmode=FALSE,_pfast=!(_tty.sg_flags&CRMOD),stty(_tty_ch,&_tty)) #define cbreak() (_tty.sg_flags |= CBREAK, _rawmode = TRUE, stty(_tty_ch,&_tty)) #define nocbreak() (_tty.sg_flags &= ~CBREAK,_rawmode=FALSE,stty(_tty_ch,&_tty)) #define crmode() cbreak() /* backwards compatability */ #define nocrmode() nocbreak() /* backwards compatability */ #define echo() (_tty.sg_flags |= ECHO, _echoit = TRUE, stty(_tty_ch, &_tty)) #define noecho() (_tty.sg_flags &= ~ECHO, _echoit = FALSE, stty(_tty_ch, &_tty)) #define nl() (_tty.sg_flags |= CRMOD,_pfast = _rawmode,stty(_tty_ch, &_tty)) #define nonl() (_tty.sg_flags &= ~CRMOD, _pfast = TRUE, stty(_tty_ch, &_tty)) #define savetty() ((void) gtty(_tty_ch, &_tty), _res_flg = _tty.sg_flags) #define resetty() (_tty.sg_flags = _res_flg, (void) stty(_tty_ch, &_tty)) #define erasechar() (_tty.sg_erase) #define killchar() (_tty.sg_kill) #define baudrate() (_tty.sg_ospeed) /* * Used to be in unctrl.h. */ #ifndef unctrl #define unctrl(c) _unctrl[(c) & 0177] extern char *_unctrl[]; # endif # endif /* WINDOW */