Annotation of coherent/g/usr/bin/tic/curses.h, revision 1.1.1.1

1.1       root        1: /*********************************************************************
                      2: *                         COPYRIGHT NOTICE                           *
                      3: **********************************************************************
                      4: *        This software is copyright (C) 1982 by Pavel Curtis         *
                      5: *                                                                    *
                      6: *        Permission is granted to reproduce and distribute           *
                      7: *        this file by any means so long as no fee is charged         *
                      8: *        above a nominal handling fee and so long as this            *
                      9: *        notice is always included in the copies.                    *
                     10: *                                                                    *
                     11: *        Other rights are reserved except as explicitly granted      *
                     12: *        by written permission of the author.                        *
                     13: *                Pavel Curtis                                        *
                     14: *                Computer Science Dept.                              *
                     15: *                405 Upson Hall                                      *
                     16: *                Cornell University                                  *
                     17: *                Ithaca, NY 14853                                    *
                     18: *                                                                    *
                     19: *                Ph- (607) 256-4934                                  *
                     20: *                                                                    *
                     21: *                Pavel.Cornell@Udel-Relay   (ARPAnet)                *
                     22: *                decvax!cornell!pavel       (UUCPnet)                *
                     23: *********************************************************************/
                     24: 
                     25: /*
                     26:  *      curses.h - Main header file for the curses package
                     27:  *
                     28:  *  $Header: /src386/usr/bin/tic/RCS/curses.h,v 1.1 92/03/13 10:46:31 bin Exp $
                     29:  *
                     30:  *  $Log:      curses.h,v $
                     31:  * Revision 1.1  92/03/13  10:46:31  bin
                     32:  * Initial revision
                     33:  * 
                     34: Revision 2.1  82/10/25  14:46:08  pavel
                     35: Added Copyright Notice
                     36: 
                     37: Revision 2.0  82/10/24  15:17:22  pavel
                     38: Beta-one Test Release
                     39: 
                     40: Revision 1.4  82/08/23  22:30:13  pavel
                     41: The REAL Alpha-one Release Version
                     42: 
                     43: Revision 1.3  82/08/20  16:52:46  pavel
                     44: Fixed <terminfo.h> bug
                     45: 
                     46: Revision 1.2  82/08/19  19:10:13  pavel
                     47: Alpha Test Release One
                     48: 
                     49: Revision 1.1  82/08/12  18:38:57  pavel
                     50: Initial revision
                     51: 
                     52:  *
                     53:  */
                     54: 
                     55: #ifndef WINDOW
                     56: 
                     57: #include "terminfo.h"
                     58: 
                     59: 
                     60: #define bool    char
                     61: 
                     62: 
                     63: #ifndef MINICURSES
                     64:     typedef unsigned short  chtype;
                     65: #else
                     66:     typedef unsigned char   chtype;
                     67: #endif  MINICURSES
                     68: 
                     69: 
                     70: #ifndef TRUE
                     71: #  define TRUE    (1)
                     72: #  define FALSE   (0)
                     73: #endif
                     74: 
                     75: #define ERR     (0)
                     76: #define OK      (1)
                     77: 
                     78: #define _SUBWIN         01
                     79: #define _ENDLINE        02
                     80: #define _FULLWIN        04
                     81: #define _SCROLLWIN      010
                     82: 
                     83: #define _NOCHANGE       -1
                     84: 
                     85: struct _win_st {
                     86:        short   _cury, _curx;
                     87:        short   _maxy, _maxx;
                     88:        short   _begy, _begx;
                     89:        short   _flags;
                     90:        chtype  _attrs;
                     91:        bool    _clear;
                     92:        bool    _leave;
                     93:        bool    _scroll;
                     94:        bool    _idlok;
                     95:        bool    _use_keypad;    /* 0=no, 1=yes, 2=yes/timeout */
                     96:        bool    _use_meta;      /* T=use the meta key */
                     97:        bool    _nodelay;       /* T=don't wait for tty input */
                     98:        chtype  **_line;
                     99:        short   *_firstchar;    /* First changed character in the line */
                    100:        short   *_lastchar;     /* Last changed character in the line */
                    101:        short   *_numchngd;     /* Number of changes made in the line */
                    102:        short   _regtop;        /* Top and bottom of scrolling region */
                    103:        short   _regbottom;
                    104: };
                    105: 
                    106: #define WINDOW  struct _win_st
                    107: 
                    108: WINDOW *stdscr, *curscr;
                    109: 
                    110: int    LINES, COLS;
                    111: 
                    112: WINDOW  *initscr(), *newwin(), *subwin();
                    113: char    *longname();
                    114: struct  screen  *newterm(), *set_term();
                    115: 
                    116: 
                    117: /*
                    118:  * psuedo functions
                    119:  */
                    120: 
                    121: #define getyx(win,y,x)   (y = (win)->_cury, x = (win)->_curx)
                    122: 
                    123: #define inch()                 winch(stdscr)
                    124: #define standout()             wstandout(stdscr)
                    125: #define standend()             wstandend(stdscr)
                    126: #define attron(at)             wattron(stdscr,at)
                    127: #define attroff(at)            wattroff(stdscr,at)
                    128: #define attrset(at)            wattrset(stdscr,at)
                    129: 
                    130: #define winch(win)             ((win)->_line[(win)->_cury][(win)->_curx])
                    131: #define wstandout(win)          (wattrset(win,A_STANDOUT))
                    132: #define wstandend(win)          (wattrset(win,A_NORMAL))
                    133: #define wattron(win,at)         ((win)->_attrs |= (at))
                    134: #define wattroff(win,at)        ((win)->_attrs &= ~(at))
                    135: #define wattrset(win,at)        ((win)->_attrs = (at))
                    136: 
                    137: 
                    138: #ifndef MINICURSES
                    139:        /*
                    140:         * psuedo functions for standard screen
                    141:         */
                    142: #  define addch(ch)       waddch(stdscr, ch)
                    143: #  define getch()         wgetch(stdscr)
                    144: #  define addstr(str)     waddstr(stdscr, str)
                    145: #  define getstr(str)     wgetstr(stdscr, str)
                    146: #  define move(y, x)      wmove(stdscr, y, x)
                    147: #  define clear()         wclear(stdscr)
                    148: #  define erase()         werase(stdscr)
                    149: #  define clrtobot()      wclrtobot(stdscr)
                    150: #  define clrtoeol()      wclrtoeol(stdscr)
                    151: #  define insertln()      winsertln(stdscr)
                    152: #  define deleteln()      wdeleteln(stdscr)
                    153: #  define refresh()       wrefresh(stdscr)
                    154: #  define insch(c)        winsch(stdscr,c)
                    155: #  define delch()         wdelch(stdscr)
                    156: #  define setscrreg(t,b)  wsetscrreg(stdscr,t,b)
                    157: 
                    158:            /*
                    159:             * mv functions
                    160:             */
                    161: #  define mvwaddch(win,y,x,ch)    (wmove(win,y,x) == ERR ? ERR : waddch(win,ch))
                    162: #  define mvwgetch(win,y,x)       (wmove(win,y,x) == ERR ? ERR : wgetch(win))
                    163: #  define mvwaddstr(win,y,x,str)  (wmove(win,y,x) == ERR ? ERR \
                    164:                                                         : waddstr(win,str))
                    165: #  define mvwgetstr(win,y,x)      (wmove(win,y,x) == ERR ? ERR : wgetstr(win))
                    166: #  define mvwinch(win,y,x)        (wmove(win,y,x) == ERR ? ERR : winch(win))
                    167: #  define mvwdelch(win,y,x)       (wmove(win,y,x) == ERR ? ERR : wdelch(win))
                    168: #  define mvwinsch(win,y,x,c)     (wmove(win,y,x) == ERR ? ERR : winsch(win,c))
                    169: #  define mvaddch(y,x,ch)         mvwaddch(stdscr,y,x,ch)
                    170: #  define mvgetch(y,x)            mvwgetch(stdscr,y,x)
                    171: #  define mvaddstr(y,x,str)       mvwaddstr(stdscr,y,x,str)
                    172: #  define mvgetstr(y,x)           mvwgetstr(stdscr,y,x)
                    173: #  define mvinch(y,x)             mvwinch(stdscr,y,x)
                    174: #  define mvdelch(y,x)            mvwdelch(stdscr,y,x)
                    175: #  define mvinsch(y,x,c)          mvwinsch(stdscr,y,x,c)
                    176:   
                    177: #else MINICURSES
                    178: 
                    179: #  define addch                          m_addch
                    180: #  define addstr                  m_addstr
                    181: #  define erase                   m_erase
                    182: #  define clear                   m_clear
                    183: #  define refresh                 m_refresh
                    184: #  define initscr                 m_initscr
                    185: #  define newterm                 m_newterm
                    186: #  define mvaddch(y,x,ch)         (move(y,x) == ERR ? ERR : addch(ch))
                    187: #  define mvaddstr(y,x,str)       (move(y,x) == ERR ? ERR : addstr(str))
                    188: 
                    189: /*
                    190:  * These functions don't exist in minicurses, so we define them
                    191:  * to nonexistent functions to help the user catch the error.
                    192:  */
                    193: #  define box             no_box
                    194: #  define clrtobot        no_clrtobot
                    195: #  define clrtoeol        no_clrtoeol
                    196: #  define delch           no_delch
                    197: #  define deleteln        no_deleteln
                    198: #  define delwin          no_delwin
                    199: #  define getch           no_getch
                    200: #  define getstr          no_getstr
                    201: #  define insch           no_insch
                    202: #  define insertln        no_insertln
                    203: #  define longname        no_longname
                    204: #  define mvprintw        no_mvprintw
                    205: #  define mvscanw         no_mvscanw
                    206: #  define mvwin           no_mvwin
                    207: #  define mvwprintw       no_mvwprintw
                    208: #  define mvwscanw        no_mvwscanw
                    209: #  define newwin          no_newwin
                    210: #  define overlay         no_overlay
                    211: #  define overwrite       no_overwrite
                    212: #  define printw          no_printw
                    213: #  define putp            no_putp
                    214: #  define scanw           no_scanw
                    215: #  define scroll          no_scroll
                    216: #  define setscrreg       no_setscrreg
                    217: #  define subwin          no_subwin
                    218: #  define touchwin        no_touchwin
                    219: #  define tstp            no_tstp
                    220: #  define vidattr         no_vidattr
                    221: #  define waddch          no_waddch
                    222: #  define waddstr         no_waddstr
                    223: #  define wclear          no_wclear
                    224: #  define wclrtobot       no_wclrtobot
                    225: #  define wclrtoeol       no_wclrtoeol
                    226: #  define wdelch          no_wdelch
                    227: #  define wdeleteln       no_wdeleteln
                    228: #  define werase          no_werase
                    229: #  define wgetch          no_wgetch
                    230: #  define wgetstr         no_wgetstr
                    231: #  define winsch          no_winsch
                    232: #  define winsertln       no_winsertln
                    233: #  define wmove           no_wmove
                    234: #  define wprintw         no_wprintw
                    235: #  define wrefresh        no_wrefresh
                    236: #  define wscanw          no_wscanw
                    237: #  define wsetscrreg      no_wsetscrreg
                    238: 
                    239: /* mv functions that aren't valid */
                    240: #  define mvdelch         no_mvwdelch
                    241: #  define mvgetch         no_mvwgetch
                    242: #  define mvgetstr        no_mvwgetstr
                    243: #  define mvinch          no_mvwinch
                    244: #  define mvinsch         no_mvwinsch
                    245: #  define mvwaddch        no_mvwaddch
                    246: #  define mvwaddstr       no_mvaddstr
                    247: #  define mvwdelch        no_mvwdelch
                    248: #  define mvwgetch        no_mvwgetch
                    249: #  define mvwgetstr       no_mvwgetstr
                    250: #  define mvwinch         no_mvwinch
                    251: #  define mvwinsch        no_mvwinsch
                    252: 
                    253: #endif MINICURSES
                    254: 
                    255: 
                    256: #ifndef MINICURSES
                    257: /* Funny "characters" enabled for various special function keys for input */
                    258: #define KEY_BREAK       0401            /* break key (unreliable) */
                    259: #define KEY_DOWN        0402            /* The four arrow keys ... */
                    260: #define KEY_UP          0403
                    261: #define KEY_LEFT        0404
                    262: #define KEY_RIGHT       0405            /* ... */
                    263: #define KEY_HOME        0406            /* Home key (upward+left arrow) */
                    264: #define KEY_BACKSPACE   0407            /* backspace (unreliable) */
                    265: #define KEY_F0          0410            /* Function keys.  Space for 64 */
                    266: #define KEY_F(n)        (KEY_F0+(n))    /* keys is reserved. */
                    267: #define KEY_DL          0510            /* Delete line */
                    268: #define KEY_IL          0511            /* Insert line */
                    269: #define KEY_DC          0512            /* Delete character */
                    270: #define KEY_IC          0513            /* Insert char or enter insert mode */
                    271: #define KEY_EIC         0514            /* Exit insert char mode */
                    272: #define KEY_CLEAR       0515            /* Clear screen */
                    273: #define KEY_EOS         0516            /* Clear to end of screen */
                    274: #define KEY_EOL         0517            /* Clear to end of line */
                    275: #define KEY_SF          0520            /* Scroll 1 line forward */
                    276: #define KEY_SR          0521            /* Scroll 1 line backwards (reverse) */
                    277: #define KEY_NPAGE       0522            /* Next page */
                    278: #define KEY_PPAGE       0523            /* Previous page */
                    279: #define KEY_STAB        0524            /* Set tab */
                    280: #define KEY_CTAB        0525            /* Clear tab */
                    281: #define KEY_CATAB       0526            /* Clear all tabs */
                    282: #define KEY_ENTER       0527            /* Enter or send (unreliable) */
                    283: #define KEY_SRESET      0530            /* soft (partial) reset (unreliable) */
                    284: #define KEY_RESET       0531            /* reset or hard reset (unreliable) */
                    285: #define KEY_PRINT       0532            /* print or copy */
                    286: #define KEY_LL          0533            /* home down or bottom (lower left) */
                    287: 
                    288: #endif MINICURSES
                    289: 
                    290: #endif WINDOW

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.