Annotation of 41BSD/lib/libcurses/curses.h, revision 1.1

1.1     ! root        1: # include      <stdio.h>
        !             2:  
        !             3: # include      <sgtty.h>
        !             4: 
        !             5: # define       bool    char            /* boolean variable             */
        !             6: # define       reg     register        /* register varaible abbr.      */
        !             7: 
        !             8: # define       TRUE    (1)
        !             9: # define       FALSE   (0)
        !            10: # define       ERR     (0)             /* default return on error      */
        !            11: # define       OK      (1)             /* default return on good run   */
        !            12: 
        !            13: # define       _SUBWIN         01      /* window is a subindow         */
        !            14: # define       _ENDLINE        02      /* lines go to end of screen    */
        !            15: # define       _FULLWIN        04      /* window is entire screen      */
        !            16: # define       _SCROLLWIN      010     /* window could cause scroll    */
        !            17: # define       _STANDOUT       0200    /* standout mode in effect      */
        !            18: # define       _NOCHANGE       -1      /* no change on this line       */
        !            19: 
        !            20: # define       _puts(s)        tputs(s, 0, _putchar);
        !            21: 
        !            22: typedef        struct sgttyb   SGTTY;
        !            23: 
        !            24: # ifndef WINDOW
        !            25: 
        !            26: /* Copyright (c) 1979 Regents of the University of California */
        !            27: /*
        !            28:  * Capabilities from termcap
        !            29:  */
        !            30: 
        !            31: char   *AL;                    /* P* Add new blank line                */
        !            32: bool   AM;                     /*    Automatic margins                 */
        !            33: char   *BC;                    /*    Back cursor                       */
        !            34: bool   BS;                     /*    Backspace works                   */
        !            35: char   *BT;                    /* P  Back tab                          */
        !            36: bool   CA;                     /*    Cursor addressible                */
        !            37: char   *CD;                    /* P* Clear to end of display           */
        !            38: char   *CE;                    /* P  Clear to end of line              */
        !            39: char   *CL;                    /* P* Clear screen                      */
        !            40: char   *CM;                    /* P  Cursor motion                     */
        !            41: bool   DA;                     /*    Display may be retained above     */
        !            42: bool   DB;                     /*    Display may be retained below     */
        !            43: char   *DC;                    /* P* Delete character                  */
        !            44: char   *DL;                    /* P* Delete line sequence              */
        !            45: char   *DM;                    /*    Delete mode (enter)               */
        !            46: char   *DO;                    /*    Down line sequence                */
        !            47: char   *ED;                    /*    End delete mode                   */
        !            48: bool   EO;                     /*    Can erase overstrikes with ' '    */
        !            49: char   *EI;                    /*    End insert mode                   */
        !            50: bool   GT;                     /*    Gtty indicates tabs               */
        !            51: char   *HO;                    /*    Home cursor                       */
        !            52: bool   HZ;                     /*    Hazeltine ~ braindamage           */
        !            53: char   *IC;                    /* P  Insert character                  */
        !            54: bool   IN;                     /*    Insert-null blessing              */
        !            55: char   *IM;                    /*    Insrt mode (as ':im=:' if 'ic')   */
        !            56: char   *IP;                    /* P* pad after char ins'd using IM+IE  */
        !            57: char   *LL;                    /*    Quick to last line, column 0      */
        !            58: char   *MA;                    /*    Ctrl character map for cmd mode   */
        !            59: bool   MI;                     /*    can move in insert mode           */
        !            60: bool   NC;                     /*    No Cr: \r sends \r\n then eats \n */
        !            61: char   *ND;                    /*    Non-destructive space             */
        !            62: bool   OS;                     /*    Overstrike works                  */
        !            63: char   PC;                     /*    Pad character                     */
        !            64: char   *SE;                    /*    Standout end (may leave space)    */
        !            65: char   *SF;                    /* P  Scroll forwards                   */
        !            66: char   *SO;                    /*    Stand out begin (may leave space) */
        !            67: char   *SR;                    /* P  Scroll backwards                  */
        !            68: char   *TA;                    /* P  Tab (not ^I or with padding)      */
        !            69: char   *TE;                    /*    End sequence after TI             */
        !            70: char   *TI;                    /*    Terminal Initialize               */
        !            71: bool   UL;                     /*    Underlining works even though !os */
        !            72: char   *UE;                    /*    Underline End sequence            */
        !            73: char   *UP;                    /*    Upline                            */
        !            74: char   *US;                    /*    Underline Start sequence          */
        !            75: char   *VB;                    /*    Visible bell                      */
        !            76: char   *VE;                    /*    Visual end sequence               */
        !            77: char   *VS;                    /*    Visual start sequence             */
        !            78: bool   XN;                     /*    A newline gets eaten after wrap   */
        !            79:        /* X? is reserved for severely nauseous glitches                */
        !            80:        /* If there are enough of these we may need bit masks!          */
        !            81: 
        !            82: /*
        !            83:  * From the tty modes...
        !            84:  */
        !            85: bool   NONL;                   /* Term can't hack linefeeds doing a CR */
        !            86: bool   UPPERCASE;              /* Ick!                                 */
        !            87: 
        !            88: bool   normtty;                /* set if must normal mode from normf   */
        !            89: bool   pfast;                  /* Have stty -nl'ed to go faster        */
        !            90: 
        !            91: # define       WINDOW  struct _win_st
        !            92: 
        !            93: struct _win_st {               /* window description structure         */
        !            94:        short   _cury, _curx;           /* current y,x positions        */
        !            95:        short   _maxy, _maxx;           /* maximum y,x positions        */
        !            96:        short   _begy, _begx;           /* start y,x positions          */
        !            97:        short   _flags;                 /* various window flags         */
        !            98:        bool    _clear;                 /* need to clear                */
        !            99:        bool    _leave;                 /* leave curx,y at last update  */
        !           100:        bool    _scroll;                /* scrolls allowed              */
        !           101:        char    **_y;                   /* actual window                */
        !           102:        short   *_firstch;              /* first change on line         */
        !           103:        short   *_lastch;               /* last change on line          */
        !           104: };
        !           105: 
        !           106: extern bool    My_term,        /* set if user species terminal         */
        !           107:                _echoit,        /* set if echoing characters            */
        !           108:                _rawmode;       /* set if terminal in raw mode          */
        !           109: 
        !           110: extern char    *Def_term,      /* default terminal type                */
        !           111:                ttytype[];      /* long name of current terminal        */
        !           112: 
        !           113: extern int     LINES, COLS,    /* number of lines and columns          */
        !           114:                _tty_ch,        /* channel with tty on it               */
        !           115:                _res_flg;       /* sgtty flags stored for reset         */
        !           116: 
        !           117: # ifdef DEBUG
        !           118: FILE           *outf;          /* error outfile                        */
        !           119: # endif
        !           120: 
        !           121: SGTTY          _tty;           /* tty structure                        */
        !           122: 
        !           123: WINDOW         *stdscr,        /* standard screen                      */
        !           124:                *curscr;        /* current screen                       */
        !           125: 
        !           126: /*
        !           127:  *     Define VOID to stop lint from generating "null effect"
        !           128:  * comments.
        !           129:  */
        !           130: # ifdef lint
        !           131: int    __void__;               /* place to assign to                   */
        !           132: # define       VOID(x) (__void__ = (int) (x))
        !           133: # else
        !           134: # define       VOID(x) (x)
        !           135: # endif
        !           136: 
        !           137: # endif
        !           138: 
        !           139: /*
        !           140:  * psuedo functions for standard screen
        !           141:  */
        !           142: # define       addch(ch)       VOID(waddch(stdscr, ch))
        !           143: # define       getch()         VOID(wgetch(stdscr))
        !           144: # define       addstr(str)     VOID(waddstr(stdscr, str))
        !           145: # define       getstr(str)     VOID(wgetstr(stdscr, str))
        !           146: # define       move(y, x)      VOID(wmove(stdscr, y, x))
        !           147: # define       clear()         VOID(wclear(stdscr))
        !           148: # define       erase()         VOID(werase(stdscr))
        !           149: # define       clrtobot()      VOID(wclrtobot(stdscr))
        !           150: # define       clrtoeol()      VOID(wclrtoeol(stdscr))
        !           151: # define       insertln()      VOID(winsertln(stdscr))
        !           152: # define       deleteln()      VOID(wdeleteln(stdscr))
        !           153: # define       refresh()       VOID(wrefresh(stdscr))
        !           154: # define       inch()          VOID(winch(stdscr))
        !           155: # ifdef STANDOUT
        !           156: # define       standout()      VOID(wstandout(stdscr))
        !           157: # define       standend()      VOID(wstandend(stdscr))
        !           158: # endif
        !           159: 
        !           160: /*
        !           161:  * mv functions
        !           162:  */
        !           163: #define        mvwaddch(win,y,x,ch)    VOID(wmove(win,y,x)==ERR?ERR:waddch(win,ch))
        !           164: #define        mvwgetch(win,y,x,ch)    VOID(wmove(win,y,x)==ERR?ERR:wgetch(win,ch))
        !           165: #define        mvwaddstr(win,y,x,str)  VOID(wmove(win,y,x)==ERR?ERR:waddstr(win,str))
        !           166: #define        mvwgetstr(win,y,x,str)  VOID(wmove(win,y,x)==ERR?ERR:wgetstr(win,str))
        !           167: #define        mvwinch(win,y,x)        VOID(wmove(win,y,x) == ERR ? ERR : winch(win))
        !           168: #define        mvaddch(y,x,ch)         mvwaddch(stdscr,y,x,ch)
        !           169: #define        mvgetch(y,x,ch)         mvwgetch(stdscr,y,x,ch)
        !           170: #define        mvaddstr(y,x,str)       mvwaddstr(stdscr,y,x,str)
        !           171: #define        mvgetstr(y,x,str)       mvwgetstr(stdscr,y,x,str)
        !           172: #define        mvinch(y,x)             mvwinch(win,y,x)
        !           173: 
        !           174: /*
        !           175:  * psuedo functions
        !           176:  */
        !           177: 
        !           178: #define        clearok(win,bf)  (win->_clear = bf)
        !           179: #define        leaveok(win,bf)  (win->_leave = bf)
        !           180: #define        scrollok(win,bf) (win->_scroll = bf)
        !           181: #define        getyx(win,y,x)   y = win->_cury, x = win->_curx
        !           182: #define        winch(win)       (win->_y[win->_cury][win->_curx])
        !           183: 
        !           184: #define raw()   (_tty.sg_flags |= RAW, _rawmode = TRUE, stty(_tty_ch, &_tty))
        !           185: #define noraw()         (_tty.sg_flags &= ~RAW, _rawmode = FALSE, stty(_tty_ch, &_tty))
        !           186: #define crmode() (_tty.sg_flags |= CBREAK, _rawmode = TRUE, stty(_tty_ch,&_tty))
        !           187: #define nocrmode() (_tty.sg_flags &= ~CBREAK,_rawmode=FALSE,stty(_tty_ch,&_tty))
        !           188: #define echo()  (_tty.sg_flags |= ECHO, _echoit = TRUE, stty(_tty_ch, &_tty))
        !           189: #define noecho() (_tty.sg_flags &= ~ECHO, _echoit = FALSE, stty(_tty_ch, &_tty))
        !           190: #define nl()    (_tty.sg_flags |= CRMOD, NONL = TRUE, stty(_tty_ch, &_tty))
        !           191: #define nonl()  (_tty.sg_flags &= ~CRMOD, NONL = FALSE, stty(_tty_ch, &_tty))
        !           192: #define        savetty()       (gtty(_tty_ch, &_tty), _res_flg = _tty.sg_flags)
        !           193: #define        resetty()       (_tty.sg_flags = _res_flg, stty(_tty_ch, &_tty))
        !           194: 
        !           195: WINDOW *initscr(), *newwin();

unix.superglobalmegacorp.com

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