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