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