1: /*
   2:  * Copyright (c) 1980 Regents of the University of California.
   3:  * All rights reserved.  The Berkeley software License Agreement
   4:  * specifies the terms and conditions for redistribution.
   5:  *
   6:  *	@(#)curses.h	5.1 (Berkeley) 6/7/85
   7:  */
   8: 
   9: # ifndef WINDOW
  10: 
  11: # include   <stdio.h>
  12: 
  13: # include   <sgtty.h>
  14: 
  15: # define    bool    char
  16: # define    reg register
  17: 
  18: # define    TRUE    (1)
  19: # define    FALSE   (0)
  20: # define    ERR (0)
  21: # define    OK  (1)
  22: 
  23: # define    _ENDLINE    001
  24: # define    _FULLWIN    002
  25: # define    _SCROLLWIN  004
  26: # define    _FLUSH      010
  27: # define    _FULLLINE   020
  28: # define    _IDLINE     040
  29: # define    _STANDOUT   0200
  30: # define    _NOCHANGE   -1
  31: 
  32: # define    _puts(s)    tputs(s, 0, _putchar)
  33: 
  34: typedef struct sgttyb   SGTTY;
  35: 
  36: /*
  37:  * Capabilities from termcap
  38:  */
  39: 
  40: extern bool     AM, BS, CA, DA, DB, EO, HC, HZ, IN, MI, MS, NC, NS, OS, UL,
  41:         XB, XN, XT, XS, XX;
  42: extern char *AL, *BC, *BT, *CD, *CE, *CL, *CM, *CR, *CS, *DC, *DL,
  43:         *DM, *DO, *ED, *EI, *K0, *K1, *K2, *K3, *K4, *K5, *K6,
  44:         *K7, *K8, *K9, *HO, *IC, *IM, *IP, *KD, *KE, *KH, *KL,
  45:         *KR, *KS, *KU, *LL, *MA, *ND, *NL, *RC, *SC, *SE, *SF,
  46:         *SO, *SR, *TA, *TE, *TI, *UC, *UE, *UP, *US, *VB, *VS,
  47:         *VE, *AL_PARM, *DL_PARM, *UP_PARM, *DOWN_PARM,
  48:         *LEFT_PARM, *RIGHT_PARM;
  49: extern char PC;
  50: 
  51: /*
  52:  * From the tty modes...
  53:  */
  54: 
  55: extern bool GT, NONL, UPPERCASE, normtty, _pfast;
  56: 
  57: struct _win_st {
  58:     short       _cury, _curx;
  59:     short       _maxy, _maxx;
  60:     short       _begy, _begx;
  61:     short       _flags;
  62:     short       _ch_off;
  63:     bool        _clear;
  64:     bool        _leave;
  65:     bool        _scroll;
  66:     char        **_y;
  67:     short       *_firstch;
  68:     short       *_lastch;
  69:     struct _win_st  *_nextp, *_orig;
  70: };
  71: 
  72: # define    WINDOW  struct _win_st
  73: 
  74: extern bool My_term, _echoit, _rawmode, _endwin;
  75: 
  76: extern char *Def_term, ttytype[];
  77: 
  78: extern int  LINES, COLS, _tty_ch, _res_flg;
  79: 
  80: extern SGTTY    _tty;
  81: 
  82: extern WINDOW   *stdscr, *curscr;
  83: 
  84: /*
  85:  *	Define VOID to stop lint from generating "null effect"
  86:  * comments.
  87:  */
  88: # ifdef lint
  89: int __void__;
  90: # define    VOID(x) (__void__ = (int) (x))
  91: # else
  92: # define    VOID(x) (x)
  93: # endif
  94: 
  95: /*
  96:  * psuedo functions for standard screen
  97:  */
  98: # define    addch(ch)   VOID(waddch(stdscr, ch))
  99: # define    getch()     VOID(wgetch(stdscr))
 100: # define    addstr(str) VOID(waddstr(stdscr, str))
 101: # define    getstr(str) VOID(wgetstr(stdscr, str))
 102: # define    move(y, x)  VOID(wmove(stdscr, y, x))
 103: # define    clear()     VOID(wclear(stdscr))
 104: # define    erase()     VOID(werase(stdscr))
 105: # define    clrtobot()  VOID(wclrtobot(stdscr))
 106: # define    clrtoeol()  VOID(wclrtoeol(stdscr))
 107: # define    insertln()  VOID(winsertln(stdscr))
 108: # define    deleteln()  VOID(wdeleteln(stdscr))
 109: # define    refresh()   VOID(wrefresh(stdscr))
 110: # define    inch()      VOID(winch(stdscr))
 111: # define    insch(c)    VOID(winsch(stdscr,c))
 112: # define    delch()     VOID(wdelch(stdscr))
 113: # define    standout()  VOID(wstandout(stdscr))
 114: # define    standend()  VOID(wstandend(stdscr))
 115: 
 116: /*
 117:  * mv functions
 118:  */
 119: #define mvwaddch(win,y,x,ch)    VOID(wmove(win,y,x)==ERR?ERR:waddch(win,ch))
 120: #define mvwgetch(win,y,x)   VOID(wmove(win,y,x)==ERR?ERR:wgetch(win))
 121: #define mvwaddstr(win,y,x,str)  VOID(wmove(win,y,x)==ERR?ERR:waddstr(win,str))
 122: #define mvwgetstr(win,y,x,str)  VOID(wmove(win,y,x)==ERR?ERR:wgetstr(win,str))
 123: #define mvwinch(win,y,x)    VOID(wmove(win,y,x) == ERR ? ERR : winch(win))
 124: #define mvwdelch(win,y,x)   VOID(wmove(win,y,x) == ERR ? ERR : wdelch(win))
 125: #define mvwinsch(win,y,x,c) VOID(wmove(win,y,x) == ERR ? ERR:winsch(win,c))
 126: #define mvaddch(y,x,ch)     mvwaddch(stdscr,y,x,ch)
 127: #define mvgetch(y,x)        mvwgetch(stdscr,y,x)
 128: #define mvaddstr(y,x,str)   mvwaddstr(stdscr,y,x,str)
 129: #define mvgetstr(y,x,str)       mvwgetstr(stdscr,y,x,str)
 130: #define mvinch(y,x)     mvwinch(stdscr,y,x)
 131: #define mvdelch(y,x)        mvwdelch(stdscr,y,x)
 132: #define mvinsch(y,x,c)      mvwinsch(stdscr,y,x,c)
 133: 
 134: /*
 135:  * psuedo functions
 136:  */
 137: 
 138: #define clearok(win,bf)  (win->_clear = bf)
 139: #define leaveok(win,bf)  (win->_leave = bf)
 140: #define scrollok(win,bf) (win->_scroll = bf)
 141: #define flushok(win,bf)  (bf ? (win->_flags |= _FLUSH):(win->_flags &= ~_FLUSH))
 142: #define getyx(win,y,x)   y = win->_cury, x = win->_curx
 143: #define winch(win)   (win->_y[win->_cury][win->_curx] & 0177)
 144: 
 145: #define raw()    (_tty.sg_flags|=RAW, _pfast=_rawmode=TRUE, stty(_tty_ch,&_tty))
 146: #define noraw()  (_tty.sg_flags&=~RAW,_rawmode=FALSE,_pfast=!(_tty.sg_flags&CRMOD),stty(_tty_ch,&_tty))
 147: #define cbreak() (_tty.sg_flags |= CBREAK, _rawmode = TRUE, stty(_tty_ch,&_tty))
 148: #define nocbreak() (_tty.sg_flags &= ~CBREAK,_rawmode=FALSE,stty(_tty_ch,&_tty))
 149: #define crmode() cbreak()   /* backwards compatability */
 150: #define nocrmode() nocbreak()   /* backwards compatability */
 151: #define echo()   (_tty.sg_flags |= ECHO, _echoit = TRUE, stty(_tty_ch, &_tty))
 152: #define noecho() (_tty.sg_flags &= ~ECHO, _echoit = FALSE, stty(_tty_ch, &_tty))
 153: #define nl()     (_tty.sg_flags |= CRMOD,_pfast = _rawmode,stty(_tty_ch, &_tty))
 154: #define nonl()   (_tty.sg_flags &= ~CRMOD, _pfast = TRUE, stty(_tty_ch, &_tty))
 155: #define savetty() ((void) gtty(_tty_ch, &_tty), _res_flg = _tty.sg_flags)
 156: #define resetty() (_tty.sg_flags = _res_flg, (void) stty(_tty_ch, &_tty))
 157: 
 158: #define erasechar() (_tty.sg_erase)
 159: #define killchar()  (_tty.sg_kill)
 160: #define baudrate()  (_tty.sg_ospeed)
 161: 
 162: WINDOW  *initscr(), *newwin(), *subwin();
 163: char    *longname(), *getcap();
 164: 
 165: /*
 166:  * Used to be in unctrl.h.
 167:  */
 168: #define unctrl(c)   _unctrl[(c) & 0177]
 169: extern char *_unctrl[];
 170: # endif

Defined variables

__void__ defined in line 89; used 1 times
  • in line 90

Defined struct's

_win_st defined in line 57; used 2 times
  • in line 69(2)

Defined typedef's

SGTTY defined in line 34; used 2 times

Defined macros

ERR defined in line 20; used 14 times
FALSE defined in line 19; used 6 times
OK defined in line 21; never used
TRUE defined in line 18; used 5 times
VOID defined in line 92; used 24 times
WINDOW defined in line 72; used 4 times
_ENDLINE defined in line 23; never used
_FLUSH defined in line 26; used 2 times
  • in line 141(2)
_FULLLINE defined in line 27; never used
_FULLWIN defined in line 24; never used
_IDLINE defined in line 28; never used
_NOCHANGE defined in line 30; never used
_SCROLLWIN defined in line 25; never used
_STANDOUT defined in line 29; never used
_puts defined in line 32; never used
addch defined in line 98; never used
addstr defined in line 100; never used
baudrate defined in line 160; never used
bool defined in line 15; used 9 times
cbreak defined in line 147; used 1 times
clear defined in line 103; never used
clearok defined in line 138; never used
clrtobot defined in line 105; never used
clrtoeol defined in line 106; never used
crmode defined in line 149; never used
delch defined in line 112; never used
deleteln defined in line 108; never used
echo defined in line 151; never used
erase defined in line 104; never used
erasechar defined in line 158; never used
flushok defined in line 141; never used
getch defined in line 99; never used
getstr defined in line 101; never used
getyx defined in line 142; never used
inch defined in line 110; never used
insch defined in line 111; never used
insertln defined in line 107; never used
killchar defined in line 159; never used
leaveok defined in line 139; never used
move defined in line 102; never used
mvaddch defined in line 126; never used
mvaddstr defined in line 128; never used
mvdelch defined in line 131; never used
mvgetch defined in line 127; never used
mvgetstr defined in line 129; never used
mvinch defined in line 130; never used
mvinsch defined in line 132; never used
mvwaddch defined in line 119; used 1 times
mvwaddstr defined in line 121; used 1 times
mvwdelch defined in line 124; used 1 times
mvwgetch defined in line 120; used 1 times
mvwgetstr defined in line 122; used 1 times
mvwinch defined in line 123; used 1 times
mvwinsch defined in line 125; used 1 times
nl defined in line 153; never used
nocbreak defined in line 148; used 1 times
nocrmode defined in line 150; never used
noecho defined in line 152; never used
nonl defined in line 154; never used
noraw defined in line 146; never used
raw defined in line 145; never used
refresh defined in line 109; never used
reg defined in line 16; never used
resetty defined in line 156; never used
savetty defined in line 155; never used
scrollok defined in line 140; never used
standend defined in line 114; never used
standout defined in line 113; never used
unctrl defined in line 168; never used
winch defined in line 143; used 2 times

Usage of this include

Last modified: 1985-06-07
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 1989
Valid CSS Valid XHTML 1.0 Strict