home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 15 / 15.iso / s / s053 / 25.ddi / root.2 / usr / ucbinclude / curses.h < prev    next >
Encoding:
C/C++ Source or Header  |  1990-12-08  |  6.2 KB  |  208 lines

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