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