xref: /titanic_50/usr/src/lib/libcurses/screen/curses.ed (revision 16e76cdd6e3cfaac7d91c3b0644ee1bc6cf52347)
1e keycaps
2H
3g/.*KEY_/s//KEY_/
4g/KEY_F([1-9]/d
5g'\(KEY_[^,]*\),[ 	]*\([0-9][0-9]*\),[ 	]*\(.*\)'s''#define	\1	\2		/* \3 */'
6w ./tmp/keycaps
7e !sort +2n ./tmp/keycaps
8g'\(KEY_[^	]	\)'s''\1	'
9g'\(KEY_[^	][^	]	\)'s''\1	'
10g'\(KEY_[^	][^	][^	]	\)'s''\1	'
111i
12/* Funny "characters" enabled for various special function keys for input */
13/* This list is created from caps and curses.ed. Do not edit it! */
14#define	KEY_MIN		0401		/* Minimum curses key */
15#define	KEY_BREAK	0401		/* break key (unreliable) */
16.
17/KEY_F(0)/s//KEY_F0	/
18a
19#define	KEY_F(n)	(KEY_F0+(n))	/* Space for 64 function keys */
20					/* is reserved. */
21.
22/KEY_ENTER/a
23#define	KEY_SRESET	0530		/* soft (partial) reset (unreliable) */
24#define	KEY_RESET	0531		/* reset or hard reset (unreliable) */
25.
26/KEY_A1/i
27					/* The keypad is arranged like this: */
28					/*    a1    up    a3   */
29					/*   left   b2  right  */
30					/*    c1   down   c3   */
31.
32$a
33#define	KEY_MAX		0777		/* Maximum curses key */
34.
351i
36#ifndef _CURSES_H
37#define	_CURSES_H
38
39/*
40 * curses.h - this file is automatically made from caps and
41 *	curses.ed. Don't make changes directly to curses.h!
42 */
43
44#include <widec.h>
45
46#include <stdio.h>
47
48#ifdef	__cplusplus
49extern "C" {
50#endif
51
52#define	CSMAX   4
53
54/*
55 * This trick is used to distinguish between SYSV and V7 systems.
56 * We assume that L_ctermid is only defined in stdio.h in SYSV
57 * systems, but not in V7 or Berkeley UNIX.
58 */
59#ifdef L_ctermid
60#ifdef SYSV
61#undef SYSV
62#endif
63#define	SYSV
64#endif
65/* Some V7 systems define	L_ctermid - we list those here */
66#ifdef BSD
67#undef SYSV
68#endif
69
70#ifdef SYSV
71
72#include <termio.h>
73typedef struct termio SGTTY;
74typedef struct termios SGTTYS;
75
76#else /* !SYSV */
77
78#ifndef _SGTTYB_
79#include <sgtty.h>
80#endif /* _SGTTYB_ */
81typedef struct sgttyb SGTTY;
82
83#endif /* SYSV */
84
85/*
86 * bool is a built-in type in standard C++ and as such is not
87 * defined here when using standard C++. However, the GNU compiler
88 * fixincludes utility nonetheless creates it's own version of this
89 * header for use by gcc and g++. In that version it adds a redundant
90 * guard for __cplusplus. To avoid the creation of a gcc/g++ specific
91 * header we need to include the following magic comment:
92 *
93 * we must use the C++ compiler's type
94 *
95 * The above comment should not be removed or changed until GNU
96 * gcc/fixinc/inclhack.def is updated to bypass this header.
97 */
98#if !defined(__cplusplus) && !defined(_BOOL)
99typedef	char bool;
100#endif /* !defined(__cplusplus) && !defined(_BOOL) */
101
102#define	_VR3_COMPAT_CODE
103/*
104 * chtype is the type used to store a character together with attributes.
105 * It can be set to "char" to save space, or "long" to get more attributes.
106 */
107#ifdef	CHTYPE
108typedef	CHTYPE chtype;
109#else
110#ifdef _LP64
111typedef unsigned int chtype;
112#else
113typedef unsigned long chtype;
114#endif /* _LP64 */
115#endif /* CHTYPE */
116
117/*
118 *	Define for the 'old' definition of chtype is required
119 *	when we are running in compatibility mode
120 */
121#ifdef _VR3_COMPAT_CODE
122typedef unsigned short _ochtype;
123#endif
124
125/* TRUE and FALSE get defined so many times, */
126/* let's not get in the way of other definitions. */
127#if	!defined(TRUE) || ((TRUE) != 1)
128#define	TRUE	(1)
129#endif
130#if	!defined(FALSE) || ((FALSE) != 0)
131#define	FALSE	(0)
132#endif
133#if	!defined(ERR) || ((ERR) != -1)
134#define	ERR	(-1)
135#endif
136#if	!defined(OK) || ((OK) != 0)
137#define	OK	(0)
138#endif
139
140/* short-hand notations */
141typedef struct _win_st	WINDOW;
142typedef struct screen	SCREEN;
143typedef struct _Mouse	MOUSE_STATUS;
144
145struct _win_st
146{
147	short		_cury, _curx;	/* current coordinates */
148	short		_maxy, _maxx;	/* max coordinates */
149	short		_begy, _begx;	/* (0,0) screen coordinates */
150	char		_flags;
151	short		_yoffset;	/* actual begy is _begy+_yoffset */
152	bool		_clear,		/* clearok() info */
153			_leave,		/* leaveok() info */
154			_immed,		/* window in immediate mode */
155			_sync;		/* auto syncup of parent */
156	WINDOW		*_padwin;	/* "pad" area for current window */
157#ifdef	_VR3_COMPAT_CODE
158	_ochtype	**_y16;		/* MUST stay at this offset in WINDOW */
159#endif
160	short		*_firstch;	/* first change in line */
161	short		*_lastch;	/* last change in line */
162	short		_tmarg, _bmarg;	/* scrolling region bounds */
163					/* MUST stay at this offset in WINDOW */
164	unsigned	_scroll		: 1;	/* scrollok() info */
165	unsigned	_use_idl	: 1;
166	unsigned	_use_keypad	: 1;
167	unsigned	_notimeout	: 1;
168	unsigned	_use_idc	: 1;
169	chtype		_attrs;		/* current window attributes */
170	chtype		_bkgd;		/* background, normally blank */
171	int		_delay;		/* delay period on wgetch */
172					/* 0:  for nodelay */
173					/* <0: for infinite delay */
174					/* >0: delay time in millisec */
175	short		_ndescs;	/* number of descendants */
176	short		_parx, _pary;	/* coords relative to parent (0,0) */
177	WINDOW		*_parent;	/* the parent if this is a subwin */
178	chtype		**_y;		/* lines of data */
179	short		_nbyte;		/* number of bytes to come */
180	short		_index;		/* index to hold coming char */
181	char		_waitc[CSMAX];	/* array to hold partial m-width char */
182	bool		_insmode;	/* TRUE for inserting, */
183					/* FALSE for adding */
184};
185
186/* _lastch is initially set to this, _firstch is set to win->_maxx */
187#define	_NOCHANGE	-1
188#define	_INFINITY	16000	/* no line can be longer than this */
189
190/* values for win->_flags */
191#define	_ISPAD		001
192#define	_WINCHANGED	002
193#define	_WINMOVED	004
194#define	_WINSDEL	010
195#define	_CANT_BE_IMMED	020
196#define	_WIN_ADD_ONE	040
197#define	_WIN_INS_ONE	100
198
199struct _Mouse {
200	int x, y;
201	short button[3];
202	int   changes;
203};
204
205#define	CURS_STUPID	0
206#define	CURS_UNKNOWN	1
207#define	CURS_BAD_MALLOC	2
208
209/*
210 * Various tricks to shut up lint about things that are perfectly fine.
211 */
212#if defined(__lint) && !defined(CURSES) /* if not internal to curses source */
213struct screen {
214	int _nobody_;
215};
216#endif /* __lint */
217
218/* common external variables */
219
220extern	int	LINES, COLS, TABSIZE, COLORS, COLOR_PAIRS;
221
222extern	short	curs_errno;
223
224extern WINDOW *stdscr, *curscr;
225
226extern  MOUSE_STATUS	Mouse_status;
227
228extern char ttytype[];
229
230extern char	curs_parm_err[],
231		*curs_err_strings[];
232
233/* Function declarations */
234
235#ifdef	_VR3_COMPAT_CODE
236
237extern	_ochtype	*acs_map;
238extern chtype 	*acs32map;
239
240/* definitions for Vr3 source compatibility */
241
242#define	initscr		initscr32
243#define	newterm		newterm32
244#define	waddch		w32addch
245#define	wechochar	w32echochar
246#define	pechochar	p32echochar
247#define	winsch		w32insch
248#define	vidputs		vid32puts
249#define	vidattr		vid32attr
250#define	wattroff	w32attroff
251#define	wattron		w32attron
252#define	wattrset	w32attrset
253#define	acs_map		acs32map
254#define	box		box32
255
256#ifdef	__STDC__
257extern WINDOW *initscr(void);
258extern	SCREEN	*newterm(char *, FILE *, FILE *);
259#else
260extern WINDOW *initscr();
261extern	SCREEN	*newterm();
262#endif
263
264/* declarations for mini-curses */
265
266#ifdef	__STDC__
267extern	WINDOW 	*m_initscr(void);
268
269extern	SCREEN	*m_newterm(char *, FILE *, FILE *);
270
271extern	int	m_addch(int), m_addstr(char *), m_clear(void), m_erase(void),
272		m_move(int, int), m_refresh(void);
273
274#else  /* __STDC__ */
275extern	WINDOW	*m_initscr();
276
277extern	SCREEN	*m_newterm();
278
279extern	int	m_addch(), m_addstr(), m_clear(), m_erase(),
280		m_move(), m_refresh();
281
282#endif /* __STDC__ */
283
284#else	/* _VR3_COMPAT_CODE */
285
286extern chtype *acs_map;
287
288#endif	/* _VR3_COMPAT_CODE */
289
290#ifdef __STDC__
291
292extern SCREEN *newscreen(char *, int, int, int, FILE *, FILE *);
293extern SCREEN *setcurscreen(SCREEN *);
294
295extern WINDOW *initscr(void);
296extern WINDOW *newwin(int, int, int, int);
297extern WINDOW *newpad(int, int);
298extern WINDOW *derwin(WINDOW *, int, int, int, int);
299extern WINDOW *dupwin(WINDOW *);
300extern WINDOW *getwin(FILE *);
301
302extern int wgetch(WINDOW *); /* it can return KEY_*, for instance. */
303
304extern char *longname(void);	/* long name of terminal */
305extern char *termname(void);	/* effective terminal name */
306extern char *keyname(int); 	/* name of token returned by wgetch() */
307extern char *slk_label(int);
308extern char erasechar(void);
309extern char killchar(void);
310extern char *unctrl(int);
311
312extern chtype termattrs(void);
313
314extern void vidupdate(chtype, chtype, int (*)(char));
315extern void wsyncup(WINDOW *);
316extern void wsyncdown(WINDOW *);
317extern void delscreen(SCREEN *);
318extern void curserr(void);
319extern void _setqiflush(int);
320extern void wcursyncup(WINDOW *);
321
322extern int cbreak(void);
323extern int nocbreak(void);
324extern int reset_prog_mode(void);
325extern int reset_shell_mode(void);
326extern int def_prog_mode(void);
327extern int _setecho(int);
328extern int _setnonl(int);
329extern int def_shell_mode(void);
330extern int raw(void);
331extern int savetty(void);
332extern int traceon(void);
333extern int _meta(int);
334extern int traceoff(void);
335extern int noraw(void);
336extern int flushinp(void);
337extern int _getsyx(int *, int *);
338extern int _ring(bool);
339extern int resetty(void);
340extern int ripoffline(int, int (*)(WINDOW *, int));
341extern int setsyx(int, int);
342extern int slk_refresh(void);
343extern int slk_restore(void);
344extern int wstandend(WINDOW *);
345extern int wstandout(WINDOW *);
346extern int wattroff(WINDOW *, chtype);
347extern int wattron(WINDOW *, chtype);
348extern int wattrset(WINDOW *, chtype);
349extern int wrefresh(WINDOW *);
350
351extern int copywin(WINDOW *, WINDOW *, int, int, int, int, int, int, int);
352extern int curs_set(int);
353extern int delay_output(int);
354extern int delwin(WINDOW *);
355extern int doupdate(void);
356extern int drainio(int);
357extern int endwin(void);
358extern int isendwin(void);
359extern int baudrate(void);
360extern int has_ic(void);
361extern int has_il(void);
362extern int keypad(WINDOW *, bool);
363extern int mvcur(int, int, int, int);
364
365extern int mvprintw(int, int, ...);
366extern int mvscanw(int, int, ...);
367extern int mvwprintw(WINDOW *, int, int, ...);
368extern int mvwscanw(WINDOW *, int, int, ...);
369extern int printw(char *, ...);
370extern int scanw(char *, ...);
371extern int wprintw(WINDOW *, ...);
372extern int wscanw(WINDOW *, ...);
373
374		/* __va_list is the ANSI-C safe definition of the	*/
375		/* va_list type as allowed to be defined in stdlib.h.	*/
376		/* <stdio.h> provides the nested include of <va_list.h>	*/
377		/* which provides this namespace safe definition.	*/
378		/* Either <stdarg.h> or <varargs.h> must be included to	*/
379		/* use these interfaces.				*/
380
381extern int vwprintw(WINDOW *, char *, __va_list);
382extern int vwscanw(WINDOW *, char *, __va_list);
383
384extern int mvwin(WINDOW *, int, int);
385extern int mvderwin(WINDOW *, int, int);
386extern int napms(int);
387extern int newkey(char *, short, bool);
388extern int filter(void);
389extern int pechochar(WINDOW *, chtype);
390extern int pnoutrefresh(WINDOW *, int, int, int, int, int, int);
391extern int prefresh(WINDOW *, int, int, int, int, int, int);
392
393extern int putwin(WINDOW *, FILE *);
394extern int wredrawln(WINDOW *, int, int);
395extern int scr_dump(char *);
396extern int setupterm(char *, int, int *);
397
398extern int slk_attron(chtype);
399extern int slk_attroff(chtype);
400extern int slk_attrset(chtype);
401extern int slk_clear(void);
402extern int slk_noutrefresh(void);
403extern int slk_set(int, char *, int);
404extern int slk_start(int, int *);
405extern int slk_touch(void);
406extern int start_color(void);
407extern int typeahead(int);
408
409extern bool can_change_color(void);
410extern bool has_colors(void);
411
412extern int waddch(WINDOW *, chtype);
413extern int waddchnstr(WINDOW *, chtype *, int);
414extern int waddnstr(WINDOW *, char *, int);
415extern int wbkgd(WINDOW *, chtype);
416extern int wborder(WINDOW *, chtype, chtype, chtype, chtype,
417		chtype, chtype, chtype, chtype);
418extern int wclrtobot(WINDOW *);
419extern int wclrtoeol(WINDOW *);
420extern int wdelch(WINDOW *);
421extern int wechochar(WINDOW *, chtype);
422extern int wgetstr(WINDOW *, char *);
423extern int wgetnstr(WINDOW *, char *, int);
424extern int whline(WINDOW *, chtype, int);
425extern int wvline(WINDOW *, chtype, int);
426extern int winchnstr(WINDOW *, chtype *, int);
427extern int winchstr(WINDOW *, chtype *);
428extern int winnstr(WINDOW *, char *, int);
429extern int winsch(WINDOW *, chtype);
430extern int winsdelln(WINDOW *, int);		/* internal */
431extern int winsnstr(WINDOW *, char *, int);
432extern int winstr(WINDOW *, char *);
433extern int wmove(WINDOW *, int, int);
434extern int wnoutrefresh(WINDOW *);
435extern int wredrawln(WINDOW *, int, int);
436extern int wscrl(WINDOW *, int);
437extern int wsetscrreg(WINDOW *, int, int);
438extern int wtouchln(WINDOW *, int, int, int);
439
440extern int crmode(void);
441extern int nocrmode(void);
442extern int ungetch(int);
443
444extern int mouse_set(long int);
445extern int mouse_on(long int);
446extern int mouse_off(long int);
447extern int request_mouse_pos(void);
448extern int map_button(unsigned long);
449
450extern void wmouse_position(WINDOW *, int *, int *);
451
452extern unsigned long getmouse(void), getbmap(void);
453
454		/* the following declarations take integers as arguments  */
455		/* to keep the CI5 compiler happy.  what we really want   */
456		/* to pass is given in comments.  (by the way, we don't   */
457		/* save anything by passing short or bool, since compiler */
458		/* expands them to integers any way			  */
459
460extern int pair_content(short, short *, short *);
461extern int color_content(short, short *, short *, short *); /* as above */
462extern int init_color(short, short, short, short);
463extern int init_pair(short, short, short);
464extern int idlok(WINDOW *, bool);
465
466extern void immedok(WINDOW *, bool);
467
468extern chtype winwch(WINDOW *);
469
470extern int pechowchar(WINDOW *, chtype);
471extern int ungetwch(const wchar_t);
472extern int waddnwstr(WINDOW *, wchar_t *, int);
473extern int waddwch(WINDOW *, chtype);
474extern int waddwchnstr(WINDOW *, chtype *, int);
475extern int wechowchar(WINDOW *, chtype);
476extern int wgetnwstr(WINDOW *, wchar_t *, int);
477extern int wgetwch(WINDOW *);
478extern int wgetwstr(WINDOW *, wchar_t *);
479extern int winnwstr(WINDOW *, wchar_t *, int);
480extern int winsnwstr(WINDOW *, wchar_t *, int);
481extern int winswch(WINDOW *, chtype);
482extern int winwchnstr(WINDOW *, chtype *, int);
483extern int winwstr(WINDOW *, wchar_t *);
484
485#else /* __STDC__ */
486
487extern	SCREEN	*newscreen(),	/* termname, lines, cols, tabsiz, fout, fin */
488		*setcurscreen(); /* screenptr */
489
490extern	WINDOW 	*initscr(),
491		*newwin(),		/* nlines, ncols, begy, begx */
492		*newpad(),		/* nlines, ncols */
493		*derwin(),		/* orig, nlines, ncols, begy, begx */
494		*dupwin(),		/* orig */
495		*getwin();		/* file */
496
497extern	int	wgetch(); /* because it can return KEY_*, for instance. */
498
499extern	char	*longname(),	/* long name of terminal */
500		*termname(),	/* effective terminal name */
501		*keyname(),	/* (int)  name of token returned by wgetch() */
502		*slk_label(),	/* index */
503		erasechar(),
504		killchar(),
505		*unctrl();
506
507extern	chtype	termattrs();
508
509extern	void	vidupdate(), wsyncup(), wsyncdown(),
510		delkeymap(),
511		delscreen(), curserr(),
512		_setqiflush(),
513		immedok(),
514		wcursyncup();
515
516extern	int	cbreak(), nocbreak(),
517		reset_prog_mode(), reset_shell_mode(), def_prog_mode(),
518		_setecho(), _setnonl(),
519		def_shell_mode(), raw(),
520		savetty(), traceon(), _meta(),
521		traceoff(), noraw(), flushinp(), _getsyx(),
522		_ring(), resetty(), ripoffline(), setsyx(), slk_refresh(),
523		slk_restore(), wstandend(), wstandout(),
524		wattroff(), wattron(), wattrset(), wrefresh();
525
526extern	int	color_cont(), copywin(), curs_set(), delay_output(), delwin(),
527		doupdate(), drainio(), endwin(), isendwin(),
528		baudrate(), has_ic(), has_il(), idlok(),
529		init_color(), init_pair(), keypad(), mvcur();
530
531extern	int	mvprintw(), mvscanw(), mvwprintw(), mvwscanw(),
532		printw(), scanw(), wprintw(), wscanw(), vwprintw(), vwscanw();
533
534extern	int	mvwin(), mvderwin(), napms(), newkey(), filter(),
535		pair_content(), pechochar(), pnoutrefresh(), prefresh();
536
537extern 	int	putwin(), wredrawln(), scr_dump(), setupterm();
538
539extern	int	slk_attrof(), slk_attrof(), slk_attrset(),
540		slk_clear(), slk_noutrefresh(), slk_set(),
541		slk_start(), slk_touch(), start_color(),
542		typeahead();
543
544extern	bool	can_change_color(), has_colors();
545
546extern	int	waddch(), waddchnstr(), waddnstr(), wbkgd(),
547		wborder(), wclrtobot(), wclrtoeol(), wdelch(), wechochar(),
548		wgetstr(), wgetnstr(), whline(), wvline(), winchnstr(),
549		winchstr(), winnstr(), winsch(),
550		winsdelln(),		/* internal */
551		winsnstr(), winstr(), wmove(), wnoutrefresh(), wredrawln(),
552		wscrl(), wsetscrreg(), wtouchln();
553
554extern	int	crmode(), nocrmode(), ungetch();
555
556extern	int	mouse_set(), mouse_on(), mouse_off(),
557		request_mouse_pos(), map_button();
558
559extern void	wmouse_position();
560
561extern unsigned long getmouse(), getbmap();
562
563extern chtype	winwch();
564
565extern int	pechowchar(), ungetwch(), waddnwstr(), waddwch(),
566		waddwchnstr(), wechowchar(), wgetnwstr(), wgetwch(),
567		wgetwstr(), winnwstr(), winsnwstr(), winswch(),
568		winwchnstr(), winwstr();
569
570#endif /* __STDC__ */
571
572#define	getsyx(y, x)		_getsyx(&(y), &(x))
573
574/*
575 * Functions to get at the window structure.
576 */
577
578#define	getyx(win, y, x)	((y) = getcury(win), (x) = getcurx(win))
579#define	getbegyx(win, y, x)	((y) = getbegy(win), (x) = getbegx(win))
580#define	getmaxyx(win, y, x)	((y) = getmaxy(win), (x) = getmaxx(win))
581#define	getparyx(win, y, x)	((y) = getpary(win), (x) = getparx(win))
582
583#if	defined(CURS_PERFORMANCE) && !defined(__lint)
584#define	getcury(win)		((win)->_cury)
585#define	getcurx(win)		((win)->_curx)
586#define	getbegy(win)		((win)->_begy)
587#define	getbegx(win)		((win)->_begx)
588#define	getmaxy(win)		((win)->_maxy)
589#define	getmaxx(win)		((win)->_maxx)
590#define	getpary(win)		((win)->_pary)
591#define	getparx(win)		((win)->_parx)
592#define	getbkgd(win)		((win)->_bkgd)
593#define	getattrs(win)		((win)->_attrs)
594#else 	/* defined(CURS_PERFORMANCE) && !defined(__lint) */
595
596#ifdef __STDC__
597extern int getcury(WINDOW *);
598extern int getcurx(WINDOW *);
599extern int getbegy(WINDOW *);
600extern int getbegx(WINDOW *);
601extern int getmaxy(WINDOW *);
602extern int getmaxx(WINDOW *);
603extern int getpary(WINDOW *);
604extern int getparx(WINDOW *);
605
606extern chtype getbkgd(WINDOW *);
607extern chtype getattrs(WINDOW *);
608
609#else  /* __STDC__ */
610extern	int	getcury(), getcurx(), getbegy(), getbegx(),
611		getmaxy(), getmaxx(), getpary(), getparx();
612
613extern chtype	getbkgd(), getattrs();
614
615#endif  /* __STDC__ */
616#endif	/* defined(CURS_PERFORMANCE) && !defined(__lint) */
617
618#if	defined(NOMACROS) || defined(__lint)
619
620#ifdef __STDC__
621
622extern	SCREEN	*newterm(char *, FILE *, FILE *);
623extern	SCREEN  *set_term(SCREEN *);
624
625extern WINDOW *subpad(WINDOW *, int, int, int, int);
626extern WINDOW *subwin(WINDOW *, int, int, int, int);
627
628extern char *unctrl(int);
629
630extern chtype inch(void);
631extern chtype winch(WINDOW *);
632extern chtype mvinch(int, int);
633extern chtype mvwinch(WINDOW *, int, int);
634
635extern int addch(chtype);
636extern int addchnstr(chtype *, int);
637extern int addchstr(chtype *);
638extern int addnstr(char *, int);
639extern int addstr(char *);
640extern int attroff(chtype);
641extern int attron(chtype);
642extern int attrset(chtype);
643extern int beep(void);
644extern int bkgd(chtype);
645extern int border(chtype, chtype, chtype, chtype,
646		chtype, chtype, chtype, chtype);
647extern int box(WINDOW *, chtype, chtype);
648extern int clear(void);
649extern int clearok(WINDOW *, bool);
650extern int clrtobot(void);
651extern int clrtoeol(void);
652extern int crmode(void);
653extern int delch(void);
654extern int deleteln(void);
655extern int echo(void);
656extern int echochar(chtype);
657extern int erase(void);
658extern int fixterm(void);
659extern int flash(void);
660extern int garbagedlines(WINDOW *, int, int);
661extern int garbagedwin(WINDOW *);
662extern int getch(void);
663extern int getstr(char *);
664extern int gettmode(void);
665extern int halfdelay(int);
666extern int hline(chtype, int);
667extern int inchnstr(chtype *, int);
668extern int inchstr(chtype *);
669extern int innstr(char *, int);
670extern int insch(chtype);
671extern int insdelln(int);
672extern int insertln(void);
673extern int insnstr(char *, int);
674extern int insstr(char *);
675extern int instr(char *);
676extern int intrflush(WINDOW *, int);
677extern int is_linetouched(WINDOW *, int);
678extern int is_wintouched(WINDOW *);
679extern int leaveok(WINDOW *, bool);
680extern int meta(WINDOW *, int);
681extern int move(int, int);
682extern int mvaddch(int, int, chtype);
683extern int mvaddchnstr(int, int, chtype *, int);
684extern int mvaddchstr(int, int, chtype *);
685extern int mvaddnstr(int, int, char *, int);
686extern int mvaddstr(int, int, char *);
687extern int mvdelch(int, int);
688extern int mvgetch(int, int);
689extern int mvgetstr(int, int, char *);
690extern int mvhline(int, int, chtype, int);
691extern int mvinchnstr(int, int, chtype *, int);
692extern int mvinchstr(int, int, chtype *);
693extern int mvinnstr(int, int, char *, int);
694extern int mvinsch(int, int, chtype);
695extern int mvinsnstr(int, int, char *, int);
696extern int mvinsstr(int, int, char *);
697extern int mvinstr(int, int, char *);
698extern int mvvline(int, int, chtype, int);
699extern int mvwaddch(WINDOW *, int, int, chtype);
700extern int mvwaddchnstr(WINDOW *, int, int, chtype *, int);
701extern int mvwaddchstr(WINDOW *, int, int, chtype *);
702extern int mvwaddnstr(WINDOW *, int, int, char *, int);
703extern int mvwaddstr(WINDOW *, int, int, char *);
704extern int mvwdelch(WINDOW *, int, int);
705extern int mvwgetch(WINDOW *, int, int);
706extern int mvwgetstr(WINDOW *, int, int, char *);
707extern int mvwhline(WINDOW *, int, int, chtype, int);
708extern int mvwinchnstr(WINDOW *, int, int, chtype *, int);
709extern int mvwinchstr(WINDOW *, int, int, chtype *);
710extern int mvwinnstr(WINDOW *, int, int, char *, int);
711extern int mvwinsch(WINDOW *, int, int, chtype);
712extern int mvwinsnstr(WINDOW *, int, int, char *, int);
713extern int mvwinsstr(WINDOW *, int, int, char *);
714extern int mvwinstr(WINDOW *, int, int, char *);
715extern int mvwvline(WINDOW *, int, int, chtype, int);
716extern int nl(void);
717extern int nocrmode(void);
718extern int nodelay(WINDOW *, bool);
719extern int noecho(void);
720extern int nonl(void);
721extern int notimeout(WINDOW *, bool);
722extern int overlay(WINDOW *, WINDOW *);
723extern int overwrite(WINDOW *, WINDOW *);
724extern int redrawwin(WINDOW *);
725extern int refresh(void);
726extern int resetterm(void);
727extern int saveterm(void);
728extern int scr_init(char *);
729extern int scr_restore(char *);
730extern int scr_set(char *);
731extern int scrl(int);
732extern int scroll(WINDOW *);
733extern int scrollok(WINDOW *, bool);
734extern int setscrreg(int, int);
735extern int setterm(char *);
736extern int slk_init(int);
737extern int standend(void);
738extern int standout(void);
739extern int syncok(WINDOW *, bool);
740extern int touchline(WINDOW *, int, int);
741extern int touchwin(WINDOW *);
742extern int untouchwin(WINDOW *);
743extern int vline(chtype, int);
744extern int waddchstr(WINDOW *, chtype *);
745extern int waddstr(WINDOW *, char *);
746extern int wclear(WINDOW *);
747extern int wdeleteln(WINDOW *);
748extern int werase(WINDOW *);
749extern int winchstr(WINDOW *, chtype *);
750extern int winsertln(WINDOW *);
751extern int winsstr(WINDOW *, char *);
752extern int winstr(WINDOW *, char *);
753extern int wstandend(WINDOW *);
754extern int wstandout(WINDOW *);
755
756extern void bkgdset(chtype);
757extern void idcok(WINDOW *, bool);
758extern void noqiflush(void);
759extern void wbkgdset(WINDOW *, chtype);
760extern void qiflush(void);
761extern void timeout(int);
762extern void wtimeout(WINDOW *, int);
763extern void use_env(int);			/* int sb. char */
764
765extern chtype inwch(void);
766extern chtype mvinwch(int, int);
767extern chtype mvwinwch(WINDOW *, int, int);
768
769extern int addnwstr(wchar_t *, int);
770extern int addwch(chtype);
771extern int addwchnstr(chtype *, int);
772extern int addwchstr(chtype *);
773extern int addwstr(wchar_t *);
774extern int echowchar(chtype);
775extern int getnwstr(wchar_t *, int);
776extern int getwch(void);
777extern int getwstr(wchar_t *);
778extern int innwstr(wchar_t *, int);
779extern int insnwstr(wchar_t *, int);
780extern int inswch(chtype);
781extern int inswstr(wchar_t *);
782extern int inwchnstr(chtype *, int);
783extern int inwchstr(chtype *);
784extern int inwstr(wchar_t *);
785extern int mvaddnwstr(int, int, wchar_t *, int);
786extern int mvaddwch(int, int, chtype);
787extern int mvaddwchnstr(int, int, chtype *, int);
788extern int mvaddwchstr(int, int, chtype *);
789extern int mvaddwstr(int, int, wchar_t *);
790extern int mvgetnwstr(int, int, wchar_t *, int);
791extern int mvgetwch(int, int);
792extern int mvgetwstr(int, int, wchar_t *);
793extern int mvinnwstr(int, int, wchar_t *, int);
794extern int mvinsnwstr(int, int, wchar_t *, int);
795extern int mvinswch(int, int, chtype);
796extern int mvinswstr(int, int, wchar_t *);
797extern int mvinwchnstr(int, int, chtype *, int);
798extern int mvinwchstr(int, int, chtype *);
799extern int mvinwstr(int, int, wchar_t *);
800extern int mvwaddnwstr(WINDOW *, int, int, wchar_t *, int);
801extern int mvwaddwch(WINDOW *, int, int, chtype);
802extern int mvwaddwchnstr(WINDOW *, int, int, chtype *, int);
803extern int mvwaddwchstr(WINDOW *, int, int, chtype *);
804extern int mvwaddwstr(WINDOW *, int, int, wchar_t *);
805extern int mvwgetnwstr(WINDOW *, int, int, wchar_t *, int);
806extern int mvwgetwch(WINDOW *, int, int);
807extern int mvwgetwstr(WINDOW *, int, int, wchar_t *);
808extern int mvwinnwstr(WINDOW *, int, int, wchar_t *, int);
809extern int mvwinsnwstr(WINDOW *, int, int, wchar_t *, int);
810extern int mvwinswch(WINDOW *, int, int, chtype);
811extern int mvwinswstr(WINDOW *, int, int, wchar_t *);
812extern int mvwinwchnstr(WINDOW *, int, int, chtype *, int);
813extern int mvwinwchstr(WINDOW *, int, int, chtype *);
814extern int mvwinwstr(WINDOW *, int, int, wchar_t *);
815extern int waddwchstr(WINDOW *, chtype *);
816extern int waddwstr(WINDOW *, wchar_t *);
817extern int winswstr(WINDOW *, wchar_t *);
818extern int winwchstr(WINDOW *, chtype *);
819
820#else /* __STDC__ */
821
822extern	SCREEN	*newterm(),		/* termname, fout, fin */
823extern	SCREEN	*set_term();		/* screenptr */
824
825extern	WINDOW	*subpad(),
826extern	WINDOW	*subwin();
827
828extern	chtype	inch(), winch(), mvinch(), mvwinch();
829
830extern	char	*unctrl();
831
832extern	int	addch(), addchnstr(), addchstr(), addnstr(), addstr(),
833		attroff(), attron(), attrset(), beep(), bkgd(),
834		border(), box(), clear(), clearok(), clrtobot(), clrtoeol(),
835		crmode(), delch(), deleteln(), echo(), echochar(),
836		erase(),
837/* MORE */	fixterm(),
838		flash(), garbagedlines(), garbagedwin(),
839		getch(), getstr(), gettmode(), halfdelay(), hline(),
840		inchnstr(), inchstr(), innstr(), insch(),
841		insdelln(), insertln(), insnstr(), insstr(), instr(),
842		intrflush(),
843		is_linetouched(), is_wintouched(), leaveok(), meta(),
844		move(), mvaddch(), mvaddchnstr(), mvaddchstr(), mvaddnstr(),
845		mvaddstr(), mvdelch(), mvgetch(), mvgetstr(), mvhline(),
846		mvinchnstr(), mvinchstr(), mvinnstr(), mvinsch(), mvinsnstr(),
847		mvinsstr(), mvinstr(), mvvline(), mvwaddch(), mvwaddchnstr(),
848		mvwaddchstr(), mvwaddnstr(), mvwaddstr(), mvwdelch(),
849		mvwgetch(), mvwgetstr(), mvwhline(), mvwinchnstr(),
850		mvwinchstr(), mvwinnstr(), mvwinsch(), mvwinsnstr(),
851		mvwinsstr(), mvwinstr(), mvwvline(),
852		nl(), nocrmode(), nodelay(),
853		noecho(), nonl(), notimeout(),
854		overlay(), overwrite(), redrawwin(), refresh(),
855		resetterm(), saveterm(), scr_init(),
856		scr_restore(), scr_set(), scrl(),
857		scroll(), scrollok(), setscrreg(), setterm(),
858		slk_init(), standend(), standout(),
859		syncok(), touchline(), touchwin(), untouchwin(), vline(),
860		waddchstr(), waddstr(), wclear(),
861		wdeleteln(), werase(), winchstr(), winsertln(),
862		winsstr(), winstr(), wstandend(), wstandout();
863
864extern	void	bkgdset(), wbkgdset(), idcok(), noqiflush(),
865		qiflush(), timeout(), wtimeout(), use_env();
866
867extern unsigned long getmouse(), getbmap();
868
869extern chtype   inwch(), mvinwch(), mvwinwch();
870
871extern int	addnwstr(), addwch(), addwchnstr(), addwchstr(),
872		addwstr(), echowchar(), getnwstr(), getwch(),
873		getwstr(), innwstr(), insnwstr(), inswch(),
874		inswstr(), inwchnstr(), inwchstr(), inwstr(),
875		mvaddnwstr(), mvaddwch(), mvaddwchnstr(), mvaddwchstr(),
876		mvaddwstr(), mvgetnwstr(), mvgetwch(), mvgetwstr(),
877		mvinnwstr(), mvinsnwstr(), mvinswch(), mvinswstr(),
878		mvinwchnstr(), mvinwchstr(), mvinwstr(), mvwaddnwstr(),
879		mvwaddwch(), mvwaddwchnstr(), mvwaddwchstr(), mvwaddwstr(),
880		mvwgetnwstr(), mvwgetwch(), mvwgetwstr(), mvwinnwstr(),
881		mvwinsnwstr(), mvwinswch(), mvwinswstr(), mvwinwchnstr(),
882		mvwinwchstr(), mvwinwstr(), waddwchstr(), waddwstr(),
883		winswstr(), winwchstr();
884
885#endif /* __STDC__ */
886
887#else	/* NOMACROS || __lint */
888
889/*
890 * The defines from here down to the #endif for NOMACROS
891 * define	macros, which may be more efficient than their
892 * function versions. The functions may be accessed by defining
893 * NOMACROS in C code. This is useful for debugging purposes.
894 */
895
896#include  <unctrl.h>
897
898/* pseudo functions for stdscr */
899#define	addch(ch)	waddch(stdscr, ch)
900#define	addnstr(s, n)	waddnstr(stdscr, s, n)
901#define	addstr(str)	waddstr(stdscr, str)
902#define	attroff(at)	wattroff(stdscr, at)
903#define	attron(at)	wattron(stdscr, at)
904#define	attrset(at)	wattrset(stdscr, at)
905#define	bkgd(c)		wbkgd(stdscr, c)
906#define	border(ls, rs, ts, bs, tl, tr, bl, br) \
907	wborder(stdscr, ls, rs, ts, bs, tl, tr, bl, br)
908#define	clear()		wclear(stdscr)
909#define	clrtobot()	wclrtobot(stdscr)
910#define	clrtoeol()	wclrtoeol(stdscr)
911#define	delch()		wdelch(stdscr)
912#define	deleteln()	wdeleteln(stdscr)
913#define	echochar(ch)	wechochar(stdscr, ch)
914#define	erase()		werase(stdscr)
915#define	getch()		wgetch(stdscr)
916#define	getstr(str)	wgetstr(stdscr, str)
917#define	inch()		winch(stdscr)
918#define	insch(c)	winsch(stdscr, c)
919#define	insdelln(id)	winsdelln(stdscr, id)
920#define	insertln()	winsertln(stdscr)
921#define	insnstr(s, n)	winsnstr(stdscr, s, n)
922#define	insstr(s)	winsstr(stdscr, s)
923#define	move(y, x)	wmove(stdscr, y, x)
924#define	refresh()	wrefresh(stdscr)
925#define	scrl(n)		wscrl(stdscr, n)
926#define	setscrreg(t, b)	wsetscrreg(stdscr, t, b)
927#define	standend()	wstandend(stdscr)
928#define	standout()	wstandout(stdscr)
929#define	timeout(tm)	wtimeout(stdscr, tm)
930#define	hline(c, num)	whline(stdscr, c, num)
931#define	vline(c, num)	wvline(stdscr, c, num)
932#define	addchstr(str)	waddchstr(stdscr, str)
933#define	addchnstr(str, n)	waddchnstr(stdscr, str, n)
934#define	instr(str)	winstr(stdscr, (str))
935#define	innstr(str, n)	winnstr(stdscr, (str), (n))
936#define	inchstr(str)	winchstr(stdscr, str)
937#define	inchnstr(str, n)	winchnstr(stdscr, str, n)
938#define	bkgdset(c)	wbkgdset(stdscr, c)
939
940#define	addnwstr(ws, n)	waddnwstr(stdscr, ws, n)
941#define	addwch(ch)	waddwch(stdscr, ch)
942#define	addwchnstr(str, n)	waddwchnstr(stdscr, str, n)
943#define	addwchstr(str)	waddwchstr(stdscr, str)
944#define	addwstr(ws)	waddwstr(stdscr, ws)
945#define	echowchar(ch)	wechowchar(stdscr, ch)
946#define	getnwstr(ws, n)	wgetnwstr(stdscr, ws, n)
947#define	getwch()	wgetwch(stdscr)
948#define	getwstr(ws)	wgetwstr(stdscr, ws)
949#define	innwstr(ws, n)	winnwstr(stdscr, ws, n)
950#define	insnwstr(ws, n)	winsnwstr(stdscr, ws, n)
951#define	inswch(c)	winswch(stdscr, c)
952#define	inswstr(ws)	winswstr(stdscr, ws)
953#define	inwch()	winwch(stdscr)
954#define	inwchnstr(str, n)	winwchnstr(stdscr, str, n)
955#define	inwchstr(str)	winwchstr(stdscr, str)
956#define	inwstr(ws)	winwstr(stdscr, ws)
957
958#define	adjcurspos()	wadjcurspos(stdscr)
959#define	movenextch()	wmovenextch(stdscr)
960#define	moveprevch()	wmoveprevch(stdscr)
961
962/* functions to define	environment flags of a window */
963#ifdef	CURS_PERFORMANCE
964#define	wbkgdset(win, c) \
965	(((win)->_attrs = (((win)->_attrs & ~((win)->_bkgd & A_ATTRIBUTES)) | \
966	    (c & A_ATTRIBUTES))), ((win)->_bkgd = (c)))
967#define	syncok(win, bf)		((win)->_parent ? (win)->_sync = (bf) : ERR)
968#define	notimeout(win, bf) \
969	(((win)->_notimeout = ((bf) ? TRUE : FALSE)), OK)
970#define	clearok(win, bf)	(((win)->_clear = (bf)), OK)
971#define	leaveok(win, bf)	(((win)->_leave = (bf)), OK)
972#define	scrollok(win, bf)	(((win)->_scroll = ((bf) ? TRUE : FALSE)), OK)
973#define	idcok(win, bf)		((win)->_use_idc = ((bf) ? TRUE : FALSE))
974#define	nodelay(win, bf)	(((win)->_delay = (bf) ? 0 : -1), OK)
975#define	is_wintouched(win)	((win)->_flags & _WINCHANGED)
976#define	is_linetouched(win, line) \
977	((((line) >= (win)->_maxy) || ((line) < 0)) ? ERR : \
978	    (((win)->_firstch[(line)] == _INFINITY) ? FALSE : TRUE))
979
980#define	subwin(win, nl, nc, by, bx) \
981	derwin((win), (nl), (nc), (by-win->_begy), (bx-win->_begx))
982#define	touchwin(win)		wtouchln((win), 0, (win)->_maxy, TRUE)
983#define	redrawwin(win)		wredrawln((win), 0, (win)->_maxy)
984#define	winchstr(win, str) \
985	winchnstr((win), str, ((win)->_maxx - (win)->_curx))
986#define	winstr(win, str) \
987	winnstr((win), str, ((win)->_maxx - (win)->_curx))
988#define	untouchwin(win)		wtouchln((win), 0, ((win)->_maxy), FALSE)
989#define	winch(win)		((win)->_y[(win)->_cury][(win)->_curx])
990
991#define	wtimeout(win, tm)	((win)->_delay = (tm))
992#define	use_env(bf)		(_use_env = (bf))
993
994#else	/* CURS_PERFORMANCE */
995
996#ifdef __STDC__
997
998extern void wbkgdset(WINDOW *, chtype);
999extern void idcok(WINDOW *, bool);
1000extern void wtimeout(WINDOW *, int);
1001extern void use_env(int);			 /* int sb. char */
1002
1003extern int syncok(WINDOW *, bool);
1004extern int notimeout(WINDOW *, bool);
1005extern int clearok(WINDOW *, bool);
1006extern int leaveok(WINDOW *, bool);
1007extern int scrollok(WINDOW *, bool);
1008extern int nodelay(WINDOW *, bool);
1009extern int is_linetouched(WINDOW *, int);
1010extern int is_wintouched(WINDOW *);
1011extern int touchwin(WINDOW *);
1012extern int redrawwin(WINDOW *);
1013extern int winchstr(WINDOW *, chtype *);
1014extern int winstr(WINDOW *, char *);
1015extern int untouchwin(WINDOW *);
1016
1017extern chtype winch(WINDOW *);
1018
1019extern WINDOW *subwin(WINDOW *, int, int, int, int);
1020
1021#else  /* __STDC__ */
1022
1023extern	void	wbkgdset(), idcok(), wtimeout(), use_env();
1024
1025extern	int	syncok(), notimeout(), clearok(), leaveok(),
1026		scrollok(), nodelay(), is_linetouched(), is_wintouched(),
1027		touchwin(), redrawwin(), winchstr(), winstr(),
1028		untouchwin();
1029
1030extern  chtype  winch();
1031
1032extern WINDOW *subwin();
1033
1034#endif /* __STDC__ */
1035
1036#endif	/* CURS_PERFORMANCE */
1037
1038/* functions for move and update */
1039#define	mvaddch(y, x, ch) \
1040	mvwaddch(stdscr, y, x, ch)
1041#define	mvaddnstr(y, x, s, n) \
1042	mvwaddnstr(stdscr, y, x, s, n)
1043#define	mvaddstr(y, x, str) \
1044	mvwaddstr(stdscr, y, x, str)
1045#define	mvdelch(y, x) \
1046	mvwdelch(stdscr, y, x)
1047#define	mvgetch(y, x) \
1048	mvwgetch(stdscr, y, x)
1049#define	mvgetstr(y, x, str) \
1050	mvwgetstr(stdscr, y, x, str)
1051#define	mvinch(y, x) \
1052	mvwinch(stdscr, y, x)
1053#define	mvinsch(y, x, c) \
1054	mvwinsch(stdscr, y, x, c)
1055#define	mvinsnstr(y, x, s, n) \
1056	mvwinsnstr(stdscr, y, x, s, n)
1057#define	mvinsstr(y, x, s) \
1058	mvwinsstr(stdscr, y, x, s)
1059#define	mvaddchstr(y, x, str) \
1060	mvwaddchstr(stdscr, y, x, str)
1061#define	mvaddchnstr(y, x, str, n) \
1062	mvwaddchnstr(stdscr, y, x, str, n)
1063#define	mvinstr(y, x, str) \
1064	mvwinstr(stdscr, y, x, (str))
1065#define	mvinnstr(y, x, str, n) \
1066	mvwinnstr(stdscr, y, x, (str), (n))
1067#define	mvinchstr(y, x, str) \
1068	mvwinchstr(stdscr, y, x, str)
1069#define	mvinchnstr(y, x, str, n) \
1070	mvwinchnstr(stdscr, y, x, str, n)
1071#define	mvhline(y, x, c, num) \
1072	mvwhline(stdscr, y, x, c, num)
1073#define	mvvline(y, x, c, num) \
1074	mvwvline(stdscr, y, x, c, num)
1075
1076#define	mvaddnwstr(y, x, ws, n) \
1077	mvwaddnwstr(stdscr, y, x, ws, n)
1078#define	mvaddwch(y, x, ch) \
1079	mvwaddwch(stdscr, y, x, ch)
1080#define	mvaddwchnstr(y, x, str, n) \
1081	mvwaddwchnstr(stdscr, y, x, str, n)
1082#define	mvaddwchstr(y, x, str) \
1083	mvwaddwchstr(stdscr, y, x, str)
1084#define	mvaddwstr(y, x, ws) \
1085	mvwaddwstr(stdscr, y, x, ws)
1086#define	mvgetnwstr(y, x, ws, n) \
1087	mvwgetnwstr(stdscr, y, x, ws, n)
1088#define	mvgetwch(y, x) \
1089	mvwgetwch(stdscr, y, x)
1090#define	mvgetwstr(y, x, ws) \
1091	mvwgetwstr(stdscr, y, x, ws)
1092#define	mvinnwstr(y, x, ws, n) \
1093	mvwinnwstr(stdscr, y, x, ws, n)
1094#define	mvinsnwstr(y, x, ws, n) \
1095	mvwinsnwstr(stdscr, y, x, ws, n)
1096#define	mvinswch(y, x, c) \
1097	mvwinswch(stdscr, y, x, c)
1098#define	mvinswstr(y, x, ws) \
1099	mvwinswstr(stdscr, y, x, ws)
1100#define	mvinwch(y, x) \
1101	mvwinwch(stdscr, y, x)
1102#define	mvinwchnstr(y, x, str, n) \
1103	mvwinwchnstr(stdscr, y, x, str, n)
1104#define	mvinwchstr(y, x, str) \
1105	mvwinwchstr(stdscr, y, x, str)
1106#define	mvinwstr(y, x, ws) \
1107	mvwinwstr(stdscr, y, x, ws)
1108
1109#define	mvwaddch(win, y, x, ch) \
1110	(wmove(win, y, x) == ERR ? ERR : waddch(win, ch))
1111#define	mvwaddnstr(win, y, x, s, n) \
1112	(wmove(win, y, x) == ERR ? ERR : waddnstr(win, s, n))
1113#define	mvwaddstr(win, y, x, str) \
1114	(wmove(win, y, x) == ERR ? ERR : waddstr(win, str))
1115#define	mvwdelch(win, y, x) \
1116	(wmove(win, y, x) == ERR ? ERR : wdelch(win))
1117#define	mvwgetch(win, y, x) \
1118	(wmove(win, y, x) == ERR ? ERR : wgetch(win))
1119#define	mvwgetstr(win, y, x, str) \
1120	(wmove(win, y, x) == ERR ? ERR : wgetstr(win, str))
1121#define	mvwinch(win, y, x) \
1122	(wmove(win, y, x) == ERR ? (chtype)ERR : winch(win))
1123#define	mvwinsch(win, y, x, c) \
1124	(wmove(win, y, x) == ERR ? ERR : winsch(win, c))
1125#define	mvwinsnstr(win, y, x, s, n) \
1126	(wmove(win, y, x) == ERR ? ERR : winsnstr(win, s, n))
1127#define	mvwinsstr(win, y, x, s) \
1128	(wmove(win, y, x) == ERR ? ERR : winsstr(win, s))
1129#define	mvwhline(win, y, x, c, num) \
1130	(wmove(win, y, x) == ERR ? ERR : whline(win, c, num))
1131#define	mvwvline(win, y, x, c, num) \
1132	(wmove(win, y, x) == ERR ? ERR : wvline(win, c, num))
1133#define	mvwaddchstr(win, y, x, str) \
1134	(wmove(win, y, x) == ERR ? ERR : waddchstr(win, str))
1135#define	mvwaddchnstr(win, y, x, str, n) \
1136	(wmove(win, y, x) == ERR ? ERR : waddchnstr(win, str, n))
1137#define	mvwinstr(win, y, x, str) \
1138	(wmove(win, y, x) == ERR ? ERR : winstr(win, str))
1139#define	mvwinnstr(win, y, x, str, n) \
1140	(wmove(win, y, x) == ERR ? ERR : winnstr(win, str, n))
1141#define	mvwinchstr(win, y, x, str) \
1142	(wmove(win, y, x) == ERR ? ERR : winchstr(win, str))
1143#define	mvwinchnstr(win, y, x, str, n) \
1144	(wmove(win, y, x) == ERR ? ERR : winchnstr(win, str, n))
1145#define	mvwaddnwstr(win, y, x, ws, n) \
1146	(wmove(win, y, x) == ERR ? ERR : waddnwstr(win, ws, n))
1147#define	mvwaddwch(win, y, x, ch) \
1148	(wmove(win, y, x) == ERR ? ERR : waddwch(win, ch))
1149#define	mvwaddwchnstr(win, y, x, str, n) \
1150	(wmove(win, y, x) == ERR ? ERR : waddwchnstr(win, str, n))
1151#define	mvwaddwchstr(win, y, x, str) \
1152	(wmove(win, y, x) == ERR ? ERR : waddwchstr(win, str))
1153#define	mvwaddwstr(win, y, x, ws) \
1154	(wmove(win, y, x) == ERR ? ERR : waddwstr(win, ws))
1155#define	mvwgetnwstr(win, y, x, ws, n) \
1156	(wmove(win, y, x) == ERR ? ERR : wgetnwstr(win, ws, n))
1157#define	mvwgetwch(win, y, x) \
1158	(wmove(win, y, x) == ERR ? ERR : wgetwch(win))
1159#define	mvwgetwstr(win, y, x, ws) \
1160	(wmove(win, y, x) == ERR ? ERR : wgetwstr(win, ws))
1161#define	mvwinnwstr(win, y, x, ws, n) \
1162	(wmove(win, y, x) == ERR ? ERR : winnwstr(win, ws, n))
1163#define	mvwinsnwstr(win, y, x, ws, n) \
1164	(wmove(win, y, x) == ERR ? ERR : winsnwstr(win, ws, n))
1165#define	mvwinswch(win, y, x, c) \
1166	(wmove(win, y, x) == ERR ? ERR : winswch(win, c))
1167#define	mvwinswstr(win, y, x, ws) \
1168	(wmove(win, y, x) == ERR ? ERR : winswstr(win, ws))
1169#define	mvwinwch(win, y, x) \
1170	(wmove(win, y, x) == ERR ?(chtype) ERR : winwch(win))
1171#define	mvwinwchnstr(win, y, x, str, n) \
1172	(wmove(win, y, x) == ERR ? ERR : winwchnstr(win, str, n))
1173#define	mvwinwchstr(win, y, x, str) \
1174	(wmove(win, y, x) == ERR ? ERR : winwchstr(win, str))
1175#define	mvwinwstr(win, y, x, ws) \
1176	(wmove(win, y, x) == ERR ? ERR : winwstr(win, ws))
1177
1178#define	waddwchstr(win, str)	waddwchnstr(win, str, -1)
1179#define	winwchstr(win, str)	winwchnstr(win, str, -1)
1180#define	waddwstr(win, ws)	waddnwstr(win, ws, -1)
1181#define	winswstr(win, ws)	winsnwstr(win, ws, -1)
1182
1183#ifdef CURS_MACROS
1184#define	overlay(src, dst)	_overlap((src), (dst), TRUE)
1185#define	overwrite(src, dst)	_overlap((src), (dst), FALSE)
1186#define	wdeleteln(win)		winsdelln((win), -1)
1187#define	winsertln(win)		winsdelln((win), 1)
1188#define	wstandend(win)		wattrset((win), A_NORMAL)
1189#define	wstandout(win)		wattron((win), A_STANDOUT)
1190#define	beep()			_ring(TRUE)
1191#define	flash()			_ring(FALSE)
1192#define	scroll(win)		wscrl((win), 1)
1193#define	slk_init(f)		slk_start(((f == 0) ? 3 : 2), NULL)
1194#define	scr_init(file)		_scr_all(file, 0)
1195#define	scr_restore(file)	_scr_all(file, 1)
1196#define	scr_set(file)		_scr_all(file, 2)
1197#define	subpad(win, nl, nc, by, bx) derwin((win), (nl), (nc), (by), (bx))
1198#define	box(win, v, h)		wborder((win), (v), (v), (h), (h), 0, 0, 0, 0)
1199#define	newterm(type, fout, fin) newscreen((type), 0, 0, 0, (fout), (fin))
1200#define	touchline(win, y, n)	wtouchln((win), (y), (n), TRUE)
1201
1202#define	waddstr(win, str)	waddnstr((win), (str), -1)
1203#define	werase(win)		(wmove((win), 0, 0), wclrtobot(win))
1204#define	wclear(win)		(clearok((win), TRUE), werase(win))
1205#define	intrflush(win, flag)	_setqiflush(flag)
1206#define	meta(win, flag)		_meta(flag)
1207
1208#define	setterm(name)		setupterm((name), 1, (char *)NULL)
1209#define	gettmode()		(OK)
1210#define	halfdelay(tens)		ttimeout((tens)*100)
1211
1212#define	echo()			_setecho(TRUE)
1213#define	noecho()		_setecho(FALSE)
1214#define	nl()			_setnonl(FALSE)
1215#define	nonl()			_setnonl(TRUE)
1216
1217#else /* CURS_MACROS */
1218
1219#ifdef __STDC__
1220
1221extern int overlay(WINDOW *, WINDOW *);
1222extern int overwrite(WINDOW *, WINDOW *);
1223extern int wdeleteln(WINDOW *);
1224extern int winsertln(WINDOW *);
1225extern int wstandend(WINDOW *);
1226extern int wstandout(WINDOW *);
1227extern int beep(void);
1228extern int flash(void);
1229extern int scroll(WINDOW *);
1230extern int slk_init(int);
1231extern int scr_init(char *);
1232extern int scr_restore(char *);
1233extern int box(WINDOW *, chtype, chtype);
1234extern int touchline(WINDOW *, int, int);
1235extern int waddstr(WINDOW *, char *);
1236extern int werase(WINDOW *);
1237extern int wclear(WINDOW *);
1238extern int intrflush(WINDOW *, int);
1239extern int meta(WINDOW *, int);
1240extern int setterm(char *);
1241extern int gettmode(void);
1242extern int halfdelay(int);
1243extern int echo(void);
1244extern int noecho(void);
1245extern int nl(void);
1246extern int nonl(void);
1247
1248extern WINDOW *subpad(WINDOW *, int, int, int, int);
1249
1250extern  SCREEN *newterm(char *, FILE *, FILE *);
1251
1252#else  /* __STDC__ */
1253
1254extern	int	overlay(), overwrite(), wdeleteln(), winsertln(),
1255		wstandend(), wstandout(), beep(), flash(),
1256		scroll(), slk_init(), scr_init(), scr_restore(),
1257		box(), touchline(), waddstr(), werase(),
1258		wclear(), intrflush(), meta(), setterm(), gettmode(),
1259		halfdelay(), echo(), noecho(), nl(), nonl();
1260
1261extern	WINDOW *subpad();
1262
1263extern  SCREEN  *newterm();
1264
1265#endif /* __STDC__ */
1266#endif /* CURS_MACROS */
1267
1268#define	garbagedlines		wredrawln
1269#define	garbagedwin		redrawwin
1270
1271#define	crmode			cbreak
1272#define	nocrmode		nocbreak
1273#define	saveterm		def_prog_mode
1274#define	fixterm			reset_prog_mode
1275#define	resetterm		reset_shell_mode
1276
1277#define	waddchstr(win, str)	waddchnstr((win), (str), -1)
1278#define	winsstr(win, str)	winsnstr((win), (str), -1)
1279
1280/* iocontrol functions */
1281#define	qiflush()		_setqiflush(TRUE)
1282#define	noqiflush()		_setqiflush(FALSE)
1283
1284#define	set_term		setcurscreen
1285
1286#endif	/* NOMACROS || __lint */
1287
1288/*
1289 * Standard alternate character set.  The current ACS world is evolving,
1290 * so we support only a widely available subset: the line drawing characters
1291 * from the VT100, plus a few from the Teletype 5410v1.  Eventually there
1292 * may be support of more sophisticated ACS line drawing, such as that
1293 * in the Teletype 5410, the HP line drawing set, and the like.  There may
1294 * be support for some non line oriented characters as well.
1295 *
1296 * Line drawing ACS names are of the form ACS_trbl, where t is the top, r
1297 * is the right, b is the bottom, and l is the left.  t, r, b, and l might
1298 * be B (blank), S (single), D (double), or T (thick).  The subset defined
1299 * here only uses B and S.
1300 */
1301
1302#define	ACS_BSSB	(acs_map['l'])
1303#define	ACS_SSBB	(acs_map['m'])
1304#define	ACS_BBSS	(acs_map['k'])
1305#define	ACS_SBBS	(acs_map['j'])
1306#define	ACS_SBSS	(acs_map['u'])
1307#define	ACS_SSSB	(acs_map['t'])
1308#define	ACS_SSBS	(acs_map['v'])
1309#define	ACS_BSSS	(acs_map['w'])
1310#define	ACS_BSBS	(acs_map['q'])
1311#define	ACS_SBSB	(acs_map['x'])
1312#define	ACS_SSSS	(acs_map['n'])
1313
1314/*
1315 * Human readable names for the most commonly used characters.
1316 * "Upper", "right", etc. are chosen to be consistent with the vt100 manual.
1317 */
1318
1319#define	ACS_ULCORNER	ACS_BSSB
1320#define	ACS_LLCORNER	ACS_SSBB
1321#define	ACS_URCORNER	ACS_BBSS
1322#define	ACS_LRCORNER	ACS_SBBS
1323#define	ACS_RTEE	ACS_SBSS
1324#define	ACS_LTEE	ACS_SSSB
1325#define	ACS_BTEE	ACS_SSBS
1326#define	ACS_TTEE	ACS_BSSS
1327#define	ACS_HLINE	ACS_BSBS
1328#define	ACS_VLINE	ACS_SBSB
1329#define	ACS_PLUS	ACS_SSSS
1330#define	ACS_S1		(acs_map['o'])	/* scan line 1 */
1331#define	ACS_S9		(acs_map['s'])	/* scan line 9 */
1332#define	ACS_DIAMOND	(acs_map['`'])	/* diamond */
1333#define	ACS_CKBOARD	(acs_map['a'])	/* checker board (stipple) */
1334#define	ACS_DEGREE	(acs_map['f'])	/* degree symbol */
1335#define	ACS_PLMINUS	(acs_map['g'])	/* plus/minus */
1336#define	ACS_BULLET	(acs_map['~'])	/* bullet */
1337	/* Teletype 5410v1 symbols */
1338#define	ACS_LARROW	(acs_map[','])	/* arrow pointing left */
1339#define	ACS_RARROW	(acs_map['+'])	/* arrow pointing right */
1340#define	ACS_DARROW	(acs_map['.'])	/* arrow pointing down */
1341#define	ACS_UARROW	(acs_map['-'])	/* arrow pointing up */
1342#define	ACS_BOARD	(acs_map['h'])	/* board of squares */
1343#define	ACS_LANTERN	(acs_map['i'])	/* lantern symbol */
1344#define	ACS_BLOCK	(acs_map['0'])	/* solid square block */
1345
1346.
1347$a
1348
1349/*
1350 *	The definition for 'reg' is not standard, and is provided for
1351 *	compatibility reasons. User's are discouraged from using this.
1352 */
1353#define	reg	register
1354
1355/* Various video attributes */
1356#define	A_STANDOUT	000010000000
1357#define	_STANDOUT	A_STANDOUT    /* for compatability with old curses */
1358#define	A_UNDERLINE	000020000000
1359#define	A_REVERSE	000040000000
1360#define	A_BLINK		000100000000
1361#define	A_DIM		000200000000
1362#define	A_BOLD		000400000000
1363#define	A_ALTCHARSET	001000000000
1364
1365/* The next two are subject to change so don't depend on them */
1366#define	A_INVIS		010000000000
1367#define	A_PROTECT	020000000000U
1368
1369#define	A_NORMAL	000000000000
1370#define	A_ATTRIBUTES	031777700000U	/* 0xCFFF8000 */
1371#define	A_CHARTEXT	006000077777	/* 0x30007FFF */
1372#define	A_COLOR		000007700000
1373
1374#define	A_WATTRIBUTES	031770000000U	/* 0xCFE00000 */
1375#define	A_WCHARTEXT	006007777777	/* 0x301FFFFF */
1376
1377#define	COLOR_PAIR(n)	((n) << 15)
1378#define	PAIR_NUMBER(n)	(((n) & A_COLOR) >> 15)
1379
1380/* definition of 8 basic color	*/
1381#define	COLOR_BLACK	0
1382#define	COLOR_RED	1
1383#define	COLOR_GREEN	2
1384#define	COLOR_YELLOW	3
1385#define	COLOR_BLUE	4
1386#define	COLOR_MAGENTA	5
1387#define	COLOR_CYAN	6
1388#define	COLOR_WHITE	7
1389
1390/* mouse related macros: don't change these definitions or bit-masks.	*/
1391/* they are interdependent (used by _map_button() in tgetch()		*/
1392#define	BUTTON_RELEASED		0
1393#define	BUTTON_PRESSED		1
1394#define	BUTTON_CLICKED		2
1395#define	BUTTON_DOUBLE_CLICKED	3
1396#define	BUTTON_TRIPLE_CLICKED	4
1397
1398#define	MOUSE_X_POS		(Mouse_status.x)
1399#define	MOUSE_Y_POS		(Mouse_status.y)
1400#define	A_BUTTON_CHANGED	(Mouse_status.changes & 7)
1401#define	MOUSE_MOVED		(Mouse_status.changes & 8)
1402#define	MOUSE_POS_REPORT	(Mouse_status.changes & 16)
1403#define	BUTTON_CHANGED(x)	(Mouse_status.changes & (1 << ((x) - 1)))
1404#define	BUTTON_STATUS(x)	(Mouse_status.button[(x)-1])
1405
1406/* definition of mouse bit-masks	*/
1407#define	BUTTON1_RELEASED	000000000001
1408#define	BUTTON1_PRESSED		000000000002
1409#define	BUTTON1_CLICKED		000000000004
1410#define	BUTTON1_DOUBLE_CLICKED	000000000010
1411#define	BUTTON1_TRIPLE_CLICKED	000000000020
1412#define	BUTTON2_RELEASED	000000000040
1413#define	BUTTON2_PRESSED		000000000100
1414#define	BUTTON2_CLICKED		000000000200
1415#define	BUTTON2_DOUBLE_CLICKED	000000000400
1416#define	BUTTON2_TRIPLE_CLICKED	000000001000
1417#define	BUTTON3_RELEASED	000000002000
1418#define	BUTTON3_PRESSED		000000004000
1419#define	BUTTON3_CLICKED		000000010000
1420#define	BUTTON3_DOUBLE_CLICKED	000000020000
1421#define	BUTTON3_TRIPLE_CLICKED	000000040000
1422#define	ALL_MOUSE_EVENTS	000000077777
1423#define	REPORT_MOUSE_POSITION	000000100000
1424
1425#ifdef	__cplusplus
1426}
1427#endif
1428
1429#endif	/* _CURSES_H */
1430.
14310r copyright.h
1432g/\@(\#)curses\.ed/s//\@(\#)curses\.h/
1433w curses.h
1434