Annotation of researchv10no/ncurses/screen/curses.h, revision 1.1.1.1

1.1       root        1: /* 5/15/81 (Berkeley) @(#)curses.h     1.8 */
                      2: /*     @(#)curses.h    1.20    (MRH)   3/16/83 */
                      3: #ifndef WINDOW
                      4: 
                      5: # ifndef       NONSTANDARD
                      6: #  include  <stdio.h>
                      7:   /*
                      8:    * This trick is used to distinguish between USG and V7 systems.
                      9:    * We assume that L_ctermid is only defined in stdio.h in USG
                     10:    * systems, but not in V7 or Berkeley UNIX.
                     11:    */
                     12: #  ifdef L_ctermid
                     13: #  define USG
                     14: #  endif
                     15: #  include  <unctrl.h>
                     16: #  ifdef USG
                     17: #   include <termio.h>
                     18:    typedef struct termio SGTTY;
                     19: #  else
                     20: #   include <sgtty.h>
                     21:    typedef struct sgttyb SGTTY;
                     22: #  endif
                     23: # else         NONSTANDARD
                     24: /*
                     25:  * NONSTANDARD is intended for a standalone program (no UNIX)
                     26:  * that manages screens.  The specific program is Alan Hewett's
                     27:  * ITC, which runs standalone on an 11/23 (at least for now).
                     28:  * It is unclear whether this code needs to be supported anymore.
                     29:  */
                     30: # define NULL 0
                     31: # endif                NONSTANDARD
                     32: 
                     33: # define       bool    char
                     34: # define       reg     register
                     35: 
                     36: /*
                     37:  * chtype is the type used to store a character together with attributes.
                     38:  * It can be set to "char" to save space, or "long" to get more attributes.
                     39:  */
                     40: # ifdef        CHTYPE
                     41:        typedef CHTYPE chtype;
                     42: # else
                     43:        typedef unsigned short chtype;
                     44: # endif CHTYPE
                     45: 
                     46: # define       TRUE    (1)
                     47: # define       FALSE   (0)
                     48: # define       ERR     (-1)
                     49: # define       OK      (0)
                     50: 
                     51: # define       _SUBWIN         01
                     52: # define       _ENDLINE        02
                     53: # define       _FULLWIN        04
                     54: # define       _SCROLLWIN      010
                     55: # define       _FLUSH          020
                     56: # define       _ISPAD          040
                     57: # define       _STANDOUT       0200
                     58: # define       _NOCHANGE       -1
                     59: 
                     60: struct _win_st {
                     61:        short   _cury, _curx;
                     62:        short   _maxy, _maxx;
                     63:        short   _begy, _begx;
                     64:        short   _flags;
                     65:        chtype  _attrs;
                     66:        bool    _clear;
                     67:        bool    _leave;
                     68:        bool    _scroll;
                     69:        bool    _use_idl;
                     70:        bool    _use_keypad;    /* 0=no, 1=yes, 2=yes/timeout */
                     71:        bool    _use_meta;      /* T=use the meta key */
                     72:        bool    _nodelay;       /* T=don't wait for tty input */
                     73:        chtype  **_y;
                     74:        short   *_firstch;
                     75:        short   *_lastch;
                     76:        short   _tmarg,_bmarg;
                     77: };
                     78: 
                     79: extern int     LINES, COLS;
                     80: 
                     81: typedef struct _win_st WINDOW;
                     82: extern WINDOW  *stdscr, *curscr;
                     83: 
                     84: extern char    *Def_term, ttytype[];
                     85: 
                     86: typedef struct screen  SCREEN;
                     87: 
                     88: # ifndef NOMACROS
                     89: #  ifndef MINICURSES
                     90: /*
                     91:  * psuedo functions for standard screen
                     92:  */
                     93: # define       addch(ch)       waddch(stdscr, ch)
                     94: # define       getch()         wgetch(stdscr)
                     95: # define       addstr(str)     waddstr(stdscr, str)
                     96: # define       getstr(str)     wgetstr(stdscr, str)
                     97: # define       move(y, x)      wmove(stdscr, y, x)
                     98: # define       clear()         wclear(stdscr)
                     99: # define       erase()         werase(stdscr)
                    100: # define       clrtobot()      wclrtobot(stdscr)
                    101: # define       clrtoeol()      wclrtoeol(stdscr)
                    102: # define       insertln()      winsertln(stdscr)
                    103: # define       deleteln()      wdeleteln(stdscr)
                    104: # define       refresh()       wrefresh(stdscr)
                    105: # define       inch()          winch(stdscr)
                    106: # define       insch(c)        winsch(stdscr,c)
                    107: # define       delch()         wdelch(stdscr)
                    108: # define       standout()      wstandout(stdscr)
                    109: # define       standend()      wstandend(stdscr)
                    110: # define       attron(at)      wattron(stdscr,at)
                    111: # define       attroff(at)     wattroff(stdscr,at)
                    112: # define       attrset(at)     wattrset(stdscr,at)
                    113: 
                    114: # define       setscrreg(t,b)  wsetscrreg(stdscr, t, b)
                    115: # define       wsetscrreg(win,t,b)     (win->_tmarg=(t),win->_bmarg=(b))
                    116: 
                    117: /*
                    118:  * mv functions
                    119:  */
                    120: #define        mvwaddch(win,y,x,ch)    (wmove(win,y,x)==ERR?ERR:waddch(win,ch))
                    121: #define        mvwgetch(win,y,x)       (wmove(win,y,x)==ERR?ERR:wgetch(win))
                    122: #define        mvwaddstr(win,y,x,str)  (wmove(win,y,x)==ERR?ERR:waddstr(win,str))
                    123: #define        mvwgetstr(win,y,x,str)  (wmove(win,y,x)==ERR?ERR:wgetstr(win,str))
                    124: #define        mvwinch(win,y,x)        (wmove(win,y,x)==ERR?ERR:winch(win))
                    125: #define        mvwdelch(win,y,x)       (wmove(win,y,x)==ERR?ERR:wdelch(win))
                    126: #define        mvwinsch(win,y,x,c)     (wmove(win,y,x)==ERR?ERR:winsch(win,c))
                    127: #define        mvaddch(y,x,ch)         mvwaddch(stdscr,y,x,ch)
                    128: #define        mvgetch(y,x)            mvwgetch(stdscr,y,x)
                    129: #define        mvaddstr(y,x,str)       mvwaddstr(stdscr,y,x,str)
                    130: #define        mvgetstr(y,x,str)       mvwgetstr(stdscr,y,x,str)
                    131: #define        mvinch(y,x)             mvwinch(stdscr,y,x)
                    132: #define        mvdelch(y,x)            mvwdelch(stdscr,y,x)
                    133: #define        mvinsch(y,x,c)          mvwinsch(stdscr,y,x,c)
                    134: 
                    135: #  else MINICURSES
                    136: 
                    137: # define       addch(ch)               m_addch(ch)
                    138: # define       addstr(str)             m_addstr(str)
                    139: # define       move(y, x)              m_move(y, x)
                    140: # define       clear()                 m_clear()
                    141: # define       erase()                 m_erase()
                    142: # define       refresh()               m_refresh()
                    143: # define       standout()              wstandout(stdscr)
                    144: # define       standend()              wstandend(stdscr)
                    145: # define       attron(at)              wattron(stdscr,at)
                    146: # define       attroff(at)             wattroff(stdscr,at)
                    147: # define       attrset(at)             wattrset(stdscr,at)
                    148: # define       mvaddch(y,x,ch)         move(y, x), addch(ch)
                    149: # define       mvaddstr(y,x,str)       move(y, x), addstr(str)
                    150: # define       initscr                 m_initscr
                    151: # define       newterm                 m_newterm
                    152: 
                    153: /*
                    154:  * These functions don't exist in minicurses, so we define them
                    155:  * to nonexistent functions to help the user catch the error.
                    156:  */
                    157: #define        getch           m_getch
                    158: #define        getstr          m_getstr
                    159: #define        clrtobot        m_clrtobot
                    160: #define        clrtoeol        m_clrtoeol
                    161: #define        insertln        m_insertln
                    162: #define        deleteln        m_deleteln
                    163: #define        inch            m_inch
                    164: #define        insch           m_insch
                    165: #define        delch           m_delch
                    166: /* mv functions that aren't valid */
                    167: #define        mvwaddch        m_mvwaddch
                    168: #define        mvwgetch        m_mvwgetch
                    169: #define        mvwaddstr       m_mvaddstr
                    170: #define        mvwgetstr       m_mvwgetstr
                    171: #define        mvwinch         m_mvwinch
                    172: #define        mvwdelch        m_mvwdelch
                    173: #define        mvwinsch        m_mvwinsch
                    174: #define        mvgetch         m_mvwgetch
                    175: #define        mvgetstr        m_mvwgetstr
                    176: #define        mvinch          m_mvwinch
                    177: #define        mvdelch         m_mvwdelch
                    178: #define        mvinsch         m_mvwinsch
                    179: /* Real functions that aren't valid */
                    180: #define box            m_box
                    181: #define delwin         m_delwin
                    182: #define longname       m_longname
                    183: #define makenew                m_makenew
                    184: #define mvprintw       m_mvprintw
                    185: #define mvscanw                m_mvscanw
                    186: #define mvwin          m_mvwin
                    187: #define mvwprintw      m_mvwprintw
                    188: #define mvwscanw       m_mvwscanw
                    189: #define newwin         m_newwin
                    190: #define _outchar               m_outchar
                    191: #define overlay                m_overlay
                    192: #define overwrite      m_overwrite
                    193: #define printw         m_printw
                    194: #define putp           m_putp
                    195: #define scanw          m_scanw
                    196: #define scroll         m_scroll
                    197: #define subwin         m_subwin
                    198: #define touchwin       m_touchwin
                    199: #define _tscroll               m_tscroll
                    200: #define _tstp          m_tstp
                    201: #define vidattr                m_vidattr
                    202: #define waddch         m_waddch
                    203: #define waddstr                m_waddstr
                    204: #define wclear         m_wclear
                    205: #define wclrtobot      m_wclrtobot
                    206: #define wclrtoeol      m_wclrtoeol
                    207: #define wdelch         m_wdelch
                    208: #define wdeleteln      m_wdeleteln
                    209: #define werase         m_werase
                    210: #define wgetch         m_wgetch
                    211: #define wgetstr                m_wgetstr
                    212: #define winsch         m_winsch
                    213: #define winsertln      m_winsertln
                    214: #define wmove          m_wmove
                    215: #define wprintw                m_wprintw
                    216: #define wrefresh       m_wrefresh
                    217: #define wscanw         m_wscanw
                    218: #define setscrreg      m_setscrreg
                    219: #define wsetscrreg     m_wsetscrreg
                    220: 
                    221: #  endif MINICURSES
                    222: 
                    223: /*
                    224:  * psuedo functions
                    225:  */
                    226: 
                    227: #define        getyx(win,y,x)   y = win->_cury, x = win->_curx
                    228: #define        winch(win)       (win->_y[win->_cury][win->_curx])
                    229: 
                    230: WINDOW *initscr(), *newwin(), *subwin(), *newpad();
                    231: char   *longname();
                    232: char   erasechar(), killchar();
                    233: int    wgetch();       /* because it can return KEY_*, for instance. */
                    234: SCREEN *newterm();
                    235: 
                    236: /* Various video attributes */
                    237: #define A_STANDOUT     0000200
                    238: #define A_UNDERLINE    0000400
                    239: #define A_REVERSE      0001000
                    240: #define A_BLINK                0002000
                    241: #define A_DIM          0004000
                    242: #define A_BOLD         0010000
                    243: 
                    244: /* The next three are subject to change (perhaps to colors) so don't depend on them */
                    245: #define A_INVIS                0020000
                    246: #define A_PROTECT      0040000
                    247: #define A_ALTCHARSET   0100000
                    248: 
                    249: #define A_NORMAL       0000000
                    250: #define A_ATTRIBUTES   0377600
                    251: #define A_CHARTEXT     0000177
                    252: 
                    253: /* Funny "characters" enabled for various special function keys for input */
                    254: #define KEY_BREAK      0401            /* break key (unreliable) */
                    255: #define KEY_DOWN       0402            /* The four arrow keys ... */
                    256: #define KEY_UP         0403
                    257: #define KEY_LEFT       0404
                    258: #define KEY_RIGHT      0405            /* ... */
                    259: #define KEY_HOME       0406            /* Home key (upward+left arrow) */
                    260: #define KEY_BACKSPACE  0407            /* backspace (unreliable) */
                    261: #define KEY_F0         0410            /* Function keys.  Space for 64 */
                    262: #define KEY_F(n)       (KEY_F0+(n))    /* keys is reserved. */
                    263: #define KEY_DL         0510            /* Delete line */
                    264: #define KEY_IL         0511            /* Insert line */
                    265: #define KEY_DC         0512            /* Delete character */
                    266: #define KEY_IC         0513            /* Insert char or enter insert mode */
                    267: #define KEY_EIC                0514            /* Exit insert char mode */
                    268: #define KEY_CLEAR      0515            /* Clear screen */
                    269: #define KEY_EOS                0516            /* Clear to end of screen */
                    270: #define KEY_EOL                0517            /* Clear to end of line */
                    271: #define KEY_SF         0520            /* Scroll 1 line forward */
                    272: #define KEY_SR         0521            /* Scroll 1 line backwards (reverse) */
                    273: #define KEY_NPAGE      0522            /* Next page */
                    274: #define KEY_PPAGE      0523            /* Previous page */
                    275: #define KEY_STAB       0524            /* Set tab */
                    276: #define KEY_CTAB       0525            /* Clear tab */
                    277: #define KEY_CATAB      0526            /* Clear all tabs */
                    278: #define KEY_ENTER      0527            /* Enter or send (unreliable) */
                    279: #define KEY_SRESET     0530            /* soft (partial) reset (unreliable) */
                    280: #define KEY_RESET      0531            /* reset or hard reset (unreliable) */
                    281: #define KEY_PRINT      0532            /* print or copy */
                    282: #define KEY_LL         0533            /* home down or bottom (lower left) */
                    283:                                        /* The keypad is arranged like this: */
                    284:                                        /*    a1    up    a3   */
                    285:                                        /*   left   b2  right  */
                    286:                                        /*    c1   down   c3   */
                    287: #define KEY_A1         0534            /* upper left of keypad */
                    288: #define KEY_A3         0535            /* upper right of keypad */
                    289: #define KEY_B2         0536            /* center of keypad */
                    290: #define KEY_C1         0537            /* lower left of keypad */
                    291: #define KEY_C3         0540            /* lower right of keypad */
                    292: 
                    293: # endif NOMACROS
                    294: #endif WINDOW

unix.superglobalmegacorp.com

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