Home | History | Annotate | Line # | Download | only in libcurses
curses_private.h revision 1.78
      1  1.78     blymn /*	$NetBSD: curses_private.h,v 1.78 2022/04/12 07:03:04 blymn Exp $	*/
      2   1.1     blymn 
      3   1.1     blymn /*-
      4   1.1     blymn  * Copyright (c) 1998-2000 Brett Lymn
      5   1.1     blymn  *                         (blymn (at) baea.com.au, brett_lymn (at) yahoo.com.au)
      6   1.1     blymn  * All rights reserved.
      7   1.1     blymn  *
      8   1.1     blymn  * This code has been donated to The NetBSD Foundation by the Author.
      9   1.1     blymn  *
     10   1.1     blymn  * Redistribution and use in source and binary forms, with or without
     11   1.1     blymn  * modification, are permitted provided that the following conditions
     12   1.1     blymn  * are met:
     13   1.1     blymn  * 1. Redistributions of source code must retain the above copyright
     14   1.1     blymn  *    notice, this list of conditions and the following disclaimer.
     15   1.1     blymn  * 2. The name of the author may not be used to endorse or promote products
     16  1.16       wiz  *    derived from this software without specific prior written permission
     17   1.1     blymn  *
     18   1.1     blymn  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     19   1.1     blymn  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     20   1.1     blymn  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     21   1.1     blymn  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     22   1.1     blymn  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     23   1.1     blymn  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     24   1.1     blymn  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     25   1.1     blymn  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     26   1.1     blymn  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     27   1.1     blymn  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     28   1.1     blymn  *
     29   1.1     blymn  *
     30   1.1     blymn  */
     31   1.1     blymn 
     32  1.40     blymn /* Modified by Ruibiao Qiu <ruibiao (at) arl.wustl.edu,ruibiao (at) gmail.com>
     33  1.40     blymn  * to add support for wide characters
     34  1.40     blymn  * Changes:
     35  1.40     blymn  * - Add a compiler variable HAVE_WCHAR for wide character only code
     36  1.40     blymn  * - Add a pointer to liked list of non-spacing characters in __ldata
     37  1.40     blymn  *   and the macro to access the width field in the attribute field
     38  1.46       wiz  * - Add a circular input character buffer in __screen to handle
     39  1.46       wiz  *   wide-character input (used in get_wch())
     40  1.40     blymn  */
     41  1.40     blymn 
     42  1.44       roy #include <term.h>
     43  1.17     blymn #include <termios.h>
     44  1.17     blymn 
     45   1.1     blymn /* Private structure definitions for curses. */
     46  1.18     blymn 
     47  1.18     blymn /* Termcap capabilities. */
     48  1.40     blymn #ifdef HAVE_WCHAR
     49  1.40     blymn /*
     50  1.40     blymn  * Add a list of non-spacing characters to each spacing
     51  1.40     blymn  * character in a singly linked list
     52  1.40     blymn  */
     53  1.40     blymn typedef struct nschar_t {
     54  1.40     blymn 	wchar_t			ch;		/* Non-spacing character */
     55  1.40     blymn 	struct nschar_t	*next;	/* Next non-spacing character */
     56  1.40     blymn } nschar_t;
     57  1.40     blymn #endif /* HAVE_WCHAR */
     58  1.40     blymn 
     59   1.1     blymn /*
     60  1.42       jdc  * A window is an array of __LINE structures pointed to by the 'lines' pointer.
     61   1.1     blymn  * A line is an array of __LDATA structures pointed to by the 'line' pointer.
     62   1.1     blymn  *
     63   1.1     blymn  * IMPORTANT: the __LDATA structure must NOT induce any padding, so if new
     64   1.1     blymn  * fields are added -- padding fields with *constant values* should ensure
     65   1.1     blymn  * that the compiler will not generate any padding when storing an array of
     66   1.1     blymn  *  __LDATA structures.  This is to enable consistent use of memcmp, and memcpy
     67   1.1     blymn  * for comparing and copying arrays.
     68   1.1     blymn  */
     69   1.1     blymn 
     70   1.1     blymn struct __ldata {
     71   1.1     blymn 	wchar_t	ch;			/* Character */
     72   1.1     blymn 	attr_t	attr;			/* Attributes */
     73  1.40     blymn #ifdef HAVE_WCHAR
     74  1.40     blymn 	nschar_t	*nsp;	/* Foreground non-spacing character pointer */
     75  1.77     blymn #define WCA_CONTINUATION	0x0001	/* a continuation cell */
     76  1.77     blymn 	int16_t		wflags;		/* internal attributes for wide char */
     77  1.77     blymn 	int16_t		wcols;		/* display width of a wide char */
     78  1.40     blymn #endif /* HAVE_WCHAR */
     79   1.1     blymn };
     80   1.1     blymn 
     81   1.1     blymn #define __LDATASIZE	(sizeof(__LDATA))
     82   1.1     blymn 
     83   1.1     blymn struct __line {
     84  1.24     blymn #ifdef DEBUG
     85  1.24     blymn #define SENTINEL_VALUE 0xaac0ffee
     86  1.40     blymn 
     87  1.24     blymn 	unsigned int sentinel;          /* try to catch line overflows */
     88  1.24     blymn #endif
     89   1.1     blymn #define	__ISDIRTY	0x01		/* Line is dirty. */
     90   1.1     blymn #define __ISPASTEOL	0x02		/* Cursor is past end of line */
     91  1.49     blymn #define __ISFORCED	0x04		/* Force update, no optimisation */
     92   1.1     blymn 	unsigned int flags;
     93   1.1     blymn 	unsigned int hash;		/* Hash value for the line. */
     94   1.1     blymn 	int *firstchp, *lastchp;	/* First and last chngd columns ptrs */
     95   1.1     blymn 	int firstch, lastch;		/* First and last changed columns. */
     96   1.1     blymn 	__LDATA *line;			/* Pointer to the line text. */
     97   1.1     blymn };
     98   1.1     blymn 
     99   1.1     blymn struct __window {		/* Window structure. */
    100   1.1     blymn 	struct __window	*nextp, *orig;	/* Subwindows list and parent. */
    101   1.1     blymn 	int begy, begx;			/* Window home. */
    102   1.1     blymn 	int cury, curx;			/* Current x, y coordinates. */
    103   1.1     blymn 	int maxy, maxx;			/* Maximum values for curx, cury. */
    104  1.29       dsl 	int reqy, reqx;			/* Size requested when created */
    105  1.29       dsl 	int ch_off;			/* x offset for firstch/lastch. */
    106  1.43       roy 	__LINE **alines;		/* Array of pointers to the lines */
    107   1.1     blymn 	__LINE  *lspace;		/* line space (for cleanup) */
    108   1.1     blymn 	__LDATA *wspace;		/* window space (for cleanup) */
    109   1.1     blymn 
    110   1.1     blymn #define	__ENDLINE	0x00000001	/* End of screen. */
    111   1.1     blymn #define	__FLUSH		0x00000002	/* Fflush(stdout) after refresh. */
    112   1.1     blymn #define	__FULLWIN	0x00000004	/* Window is a screen. */
    113   1.1     blymn #define	__IDLINE	0x00000008	/* Insert/delete sequences. */
    114   1.1     blymn #define	__SCROLLWIN	0x00000010	/* Last char will scroll window. */
    115   1.1     blymn #define	__SCROLLOK	0x00000020	/* Scrolling ok. */
    116   1.1     blymn #define	__CLEAROK	0x00000040	/* Clear on next refresh. */
    117   1.1     blymn #define	__LEAVEOK	0x00000100	/* If cursor left */
    118   1.1     blymn #define	__KEYPAD	0x00010000	/* If interpreting keypad codes */
    119   1.1     blymn #define	__NOTIMEOUT	0x00020000	/* Wait indefinitely for func keys */
    120  1.26       jdc #define __IDCHAR	0x00040000	/* insert/delete char sequences */
    121  1.26       jdc #define __ISPAD		0x00080000	/* "window" is a pad */
    122  1.50     blymn #define __ISDERWIN	0x00100000	/* "window" is derived from parent */
    123  1.54       roy #define __IMMEDOK	0x00200000	/* refreshed when changed */
    124  1.54       roy #define __SYNCOK	0x00400000	/* sync when changed */
    125  1.68     blymn #define __HALFDELAY	0x00800000	/* In half delay mode */
    126   1.1     blymn 	unsigned int flags;
    127   1.1     blymn 	int	delay;			/* delay for getch() */
    128   1.1     blymn 	attr_t	wattr;			/* Character attributes */
    129   1.5       jdc 	wchar_t	bch;			/* Background character */
    130   1.2       jdc 	attr_t	battr;			/* Background attributes */
    131  1.77     blymn 	uint32_t wcols;			/* Background column width */
    132  1.14       jdc 	int	scr_t, scr_b;		/* Scrolling region top, bottom */
    133  1.32       dsl 	SCREEN	*screen;		/* Screen for this window */
    134  1.36       jdc 	int	pbegy, pbegx,
    135  1.36       jdc 		sbegy, sbegx,
    136  1.36       jdc 		smaxy, smaxx;		/* Saved prefresh() values */
    137  1.50     blymn 	int	dery, derx;		/* derived window coordinates
    138  1.50     blymn 					   - top left corner of source
    139  1.50     blymn 					   relative to parent win */
    140  1.40     blymn #ifdef HAVE_WCHAR
    141  1.40     blymn 	nschar_t *bnsp;			/* Background non-spacing char list */
    142  1.40     blymn #endif /* HAVE_WCHAR */
    143  1.51  christos 	FILE	*fp;			/* for window formatted printf */
    144  1.69       roy 	char	*buf;			/* buffer for window formatted printf */
    145  1.69       roy 	size_t	 buflen;		/* length of above buffer */
    146   1.1     blymn };
    147   1.5       jdc 
    148   1.5       jdc /* Set of attributes unset by 'me' - 'mb', 'md', 'mh', 'mk', 'mp' and 'mr'. */
    149  1.40     blymn #ifndef HAVE_WCHAR
    150   1.5       jdc #define	__TERMATTR \
    151   1.5       jdc 	(__REVERSE | __BLINK | __DIM | __BOLD | __BLANK | __PROTECT)
    152  1.40     blymn #else
    153  1.40     blymn #define	__TERMATTR \
    154  1.40     blymn 	(__REVERSE | __BLINK | __DIM | __BOLD | __BLANK | __PROTECT \
    155  1.40     blymn 	| WA_TOP | WA_LOW | WA_LEFT | WA_RIGHT | WA_HORIZONTAL | WA_VERTICAL)
    156  1.40     blymn #endif /* HAVE_WCHAR */
    157   1.2       jdc 
    158   1.3       jdc struct __winlist {
    159   1.3       jdc 	struct __window		*winp;	/* The window. */
    160   1.3       jdc 	struct __winlist	*nextp;	/* Next window. */
    161   1.3       jdc };
    162   1.3       jdc 
    163  1.17     blymn struct __color {
    164  1.17     blymn 	short	num;
    165  1.17     blymn 	short	red;
    166  1.17     blymn 	short	green;
    167  1.17     blymn 	short	blue;
    168  1.17     blymn 	int	flags;
    169  1.17     blymn };
    170  1.17     blymn 
    171  1.17     blymn /* List of colour pairs */
    172  1.17     blymn struct __pair {
    173  1.17     blymn 	short	fore;
    174  1.17     blymn 	short	back;
    175  1.17     blymn 	int	flags;
    176  1.17     blymn };
    177  1.17     blymn 
    178  1.17     blymn /* Maximum colours */
    179  1.55       roy #define	MAX_COLORS	256
    180  1.17     blymn /* Maximum colour pairs - determined by number of colour bits in attr_t */
    181  1.25       jdc #define	MAX_PAIRS	PAIR_NUMBER(__COLOR)
    182  1.17     blymn 
    183  1.17     blymn typedef struct keymap keymap_t;
    184  1.17     blymn 
    185  1.60       roy /* POSIX allows up to 8 columns in a label. */
    186  1.60       roy #define	MAX_SLK_COLS	8
    187  1.60       roy #ifdef HAVE_WCHAR
    188  1.60       roy #define	MAX_SLK_LABEL	sizeof(wchar_t) * MAX_SLK_COLS
    189  1.60       roy #else
    190  1.60       roy #define	MAX_SLK_LABEL	MAX_SLK_COLS
    191  1.60       roy #endif
    192  1.60       roy struct __slk_label {
    193  1.60       roy 	char	*text;
    194  1.60       roy 	int	 justify;
    195  1.60       roy #define	SLK_JUSTIFY_LEFT	0
    196  1.60       roy #define	SLK_JUSTIFY_CENTER	1
    197  1.60       roy #define	SLK_JUSTIFY_RIGHT	2
    198  1.60       roy 	char	 label[MAX_SLK_LABEL + 1];
    199  1.60       roy 	int	 x;
    200  1.60       roy };
    201  1.59       roy 
    202  1.59       roy #define	MAX_RIPS	5
    203  1.59       roy struct __ripoff {
    204  1.59       roy 	int	nlines;
    205  1.59       roy 	WINDOW	*win;
    206  1.59       roy };
    207  1.59       roy 
    208  1.17     blymn /* this is the encapsulation of the terminal definition, one for
    209  1.17     blymn  * each terminal that curses talks to.
    210  1.17     blymn  */
    211  1.17     blymn struct __screen {
    212  1.17     blymn 	FILE    *infd, *outfd;  /* input and output file descriptors */
    213  1.17     blymn 	WINDOW	*curscr;	/* Current screen. */
    214  1.17     blymn 	WINDOW	*stdscr;	/* Standard screen. */
    215  1.17     blymn 	WINDOW	*__virtscr;	/* Virtual screen (for doupdate()). */
    216  1.17     blymn 	int      curwin;        /* current window for refresh */
    217  1.29       dsl 	int      lx, ly;        /* loop parameters for refresh */
    218  1.17     blymn 	int	 COLS;		/* Columns on the screen. */
    219  1.17     blymn 	int	 LINES;		/* Lines on the screen. */
    220  1.59       roy 	int	 nripped;	/* Number of ripofflines. */
    221  1.59       roy 	struct __ripoff ripped[MAX_RIPS];	/* ripofflines. */
    222  1.56       roy 	int	 ESCDELAY;	/* Delay between keys in esc seq's. */
    223  1.56       roy #define	ESCDELAY_DEFAULT	300 /* milliseconds. */
    224  1.48       roy 	int	 TABSIZE;	/* Size of a tab. */
    225  1.56       roy #define	TABSIZE_DEFAULT		8   /* spaces. */
    226  1.17     blymn 	int	 COLORS;	/* Maximum colors on the screen */
    227  1.17     blymn 	int	 COLOR_PAIRS;	/* Maximum color pairs on the screen */
    228  1.17     blymn 	int	 My_term;	/* Use Def_term regardless. */
    229  1.17     blymn 	char	 GT;		/* Gtty indicates tabs. */
    230  1.17     blymn 	char	 NONL;		/* Term can't hack LF doing a CR. */
    231  1.17     blymn 	char	 UPPERCASE;	/* Terminal is uppercase only. */
    232  1.17     blymn 
    233  1.17     blymn 	chtype acs_char[NUM_ACS];
    234  1.40     blymn #ifdef HAVE_WCHAR
    235  1.40     blymn 	cchar_t wacs_char[ NUM_ACS ];
    236  1.40     blymn #endif /* HAVE_WCHAR */
    237  1.17     blymn 	struct __color colours[MAX_COLORS];
    238  1.17     blymn 	struct __pair  colour_pairs[MAX_PAIRS];
    239  1.17     blymn 	attr_t	nca;
    240  1.20     blymn 
    241  1.17     blymn /* Style of colour manipulation */
    242  1.17     blymn #define COLOR_NONE	0
    243  1.17     blymn #define COLOR_ANSI	1	/* ANSI/DEC-style colour manipulation */
    244  1.17     blymn #define COLOR_HP	2	/* HP-style colour manipulation */
    245  1.17     blymn #define COLOR_TEK	3	/* Tektronix-style colour manipulation */
    246  1.17     blymn #define COLOR_OTHER	4	/* None of the others but can set fore/back */
    247  1.17     blymn 	int color_type;
    248  1.20     blymn 
    249  1.17     blymn 	attr_t mask_op;
    250  1.17     blymn 	attr_t mask_me;
    251  1.17     blymn 	attr_t mask_ue;
    252  1.17     blymn 	attr_t mask_se;
    253  1.44       roy 	TERMINAL *term;
    254  1.17     blymn 	int old_mode; /* old cursor visibility state for terminal */
    255  1.17     blymn 	keymap_t *base_keymap;
    256  1.17     blymn 	int echoit;
    257  1.17     blymn 	int pfast;
    258  1.17     blymn 	int rawmode;
    259  1.30       jdc 	int nl;
    260  1.17     blymn 	int noqch;
    261  1.17     blymn 	int clearok;
    262  1.17     blymn 	int useraw;
    263  1.17     blymn 	struct __winlist *winlistp;
    264  1.17     blymn 	struct   termios cbreakt, rawt, *curt, save_termios;
    265  1.17     blymn 	struct termios orig_termios, baset, savedtty;
    266  1.17     blymn 	int ovmin;
    267  1.17     blymn 	int ovtime;
    268  1.17     blymn 	char *stdbuf;
    269  1.17     blymn 	unsigned int len;
    270  1.17     blymn 	int meta_state;
    271  1.43       roy 	char padchar;
    272  1.17     blymn 	int endwin;
    273  1.22    itojun 	int notty;
    274  1.35       jdc 	int resized;
    275  1.41       jdc 	wchar_t *unget_list;
    276  1.41       jdc 	int unget_len, unget_pos;
    277  1.52       roy 	int filtered;
    278  1.53       roy 	int checkfd;
    279  1.60       roy 
    280  1.60       roy 	/* soft label key */
    281  1.60       roy 	bool		 is_term_slk;
    282  1.60       roy 	WINDOW		*slk_window;
    283  1.60       roy 	int		 slk_format;
    284  1.66       roy #define	SLK_FMT_INVAL	-1
    285  1.60       roy #define	SLK_FMT_3_2_3	0
    286  1.60       roy #define	SLK_FMT_4_4	1
    287  1.60       roy 	int		 slk_nlabels;
    288  1.60       roy 	int		 slk_label_len;
    289  1.60       roy 	bool		 slk_hidden;
    290  1.60       roy 	struct __slk_label *slk_labels;
    291  1.60       roy 
    292  1.77     blymn #define MAX_CBUF_SIZE 8
    293  1.40     blymn #ifdef HAVE_WCHAR
    294  1.40     blymn 	int		cbuf_head;		/* header to cbuf */
    295  1.40     blymn 	int		cbuf_tail;		/* tail to cbuf */
    296  1.40     blymn 	int		cbuf_cur;		/* the current char in cbuf */
    297  1.40     blymn 	mbstate_t	sp;			/* wide char processing state */
    298  1.40     blymn 	char		cbuf[ MAX_CBUF_SIZE ];	/* input character buffer */
    299  1.40     blymn #endif /* HAVE_WCHAR */
    300  1.17     blymn };
    301  1.17     blymn 
    302  1.17     blymn 
    303  1.11       jdc extern char	 __GT;			/* Gtty indicates tabs. */
    304  1.11       jdc extern char	 __NONL;		/* Term can't hack LF doing a CR. */
    305  1.11       jdc extern char	 __UPPERCASE;		/* Terminal is uppercase only. */
    306  1.11       jdc extern int	 My_term;		/* Use Def_term regardless. */
    307  1.11       jdc extern const char	*Def_term;	/* Default terminal type. */
    308  1.17     blymn extern SCREEN   *_cursesi_screen;       /* The current screen in use */
    309  1.11       jdc 
    310  1.39       jdc /* Debugging options/functions. */
    311   1.2       jdc #ifdef DEBUG
    312  1.39       jdc #define __CTRACE_TSTAMP		0x00000001
    313  1.39       jdc #define __CTRACE_MISC		0x00000002
    314  1.39       jdc #define __CTRACE_INIT		0x00000004
    315  1.39       jdc #define __CTRACE_SCREEN		0x00000008
    316  1.39       jdc #define __CTRACE_WINDOW		0x00000010
    317  1.39       jdc #define __CTRACE_REFRESH	0x00000020
    318  1.39       jdc #define __CTRACE_COLOR		0x00000040
    319  1.39       jdc #define __CTRACE_INPUT		0x00000080
    320  1.39       jdc #define __CTRACE_OUTPUT		0x00000100
    321  1.39       jdc #define __CTRACE_LINE		0x00000200
    322  1.39       jdc #define __CTRACE_ATTR		0x00000400
    323  1.39       jdc #define __CTRACE_ERASE		0x00000800
    324  1.42       jdc #define __CTRACE_FILEIO		0x00001000
    325  1.39       jdc #define __CTRACE_ALL		0x7fffffff
    326  1.39       jdc void	 __CTRACE(int, const char *, ...) __attribute__((__format__(__printf__, 2, 3)));
    327  1.75       rin #else
    328  1.75       rin #define	__CTRACE(area, fmt, ...)	__nothing
    329   1.2       jdc #endif
    330  1.39       jdc 
    331  1.72       roy /* Common erase logic */
    332  1.72       roy #ifdef HAVE_WCHAR
    333  1.73       uwe #define __NEED_ERASE(_sp, _bch, _battr)				\
    334  1.73       uwe 	((_sp)->ch != (_bch) ||					\
    335  1.73       uwe 	    ((_sp)->attr & WA_ATTRIBUTES) != (_battr) ||	\
    336  1.73       uwe 	    (_sp)->nsp != NULL ||				\
    337  1.77     blymn 	    (_sp)->wcols < 0)
    338  1.72       roy #else
    339  1.73       uwe #define __NEED_ERASE(_sp, _bch, _battr)				\
    340  1.73       uwe 	((_sp)->ch != (_bch) || (_sp)->attr != (_battr))
    341  1.72       roy #endif
    342  1.72       roy 
    343  1.39       jdc /* Private functions. */
    344  1.44       roy int     __cputchar_args(int, void *);
    345  1.23    itojun void     _cursesi_free_keymap(keymap_t *);
    346  1.23    itojun int      _cursesi_gettmode(SCREEN *);
    347  1.23    itojun void     _cursesi_reset_acs(SCREEN *);
    348  1.49     blymn int	_cursesi_addbyte(WINDOW *, __LINE **, int *, int *, int , attr_t, int);
    349  1.49     blymn int	_cursesi_addwchar(WINDOW *, __LINE **, int *, int *, const cchar_t *,
    350  1.49     blymn 			  int);
    351  1.49     blymn int	_cursesi_waddbytes(WINDOW *, const char *, int, attr_t, int);
    352  1.40     blymn #ifdef HAVE_WCHAR
    353  1.40     blymn void     _cursesi_reset_wacs(SCREEN *);
    354  1.40     blymn #endif /* HAVE_WCHAR */
    355  1.23    itojun void     _cursesi_resetterm(SCREEN *);
    356  1.23    itojun int      _cursesi_setterm(char *, SCREEN *);
    357   1.4     blymn int	 __delay(void);
    358  1.57       roy unsigned int	 __hash_more(const void *, size_t, unsigned int);
    359  1.76       rin unsigned int	 __hash_line(const __LDATA *, int);
    360  1.23    itojun #define	__hash(s, len)	__hash_more((s), (len), 0u)
    361  1.23    itojun void	 __id_subwins(WINDOW *);
    362  1.23    itojun void	 __init_getch(SCREEN *);
    363  1.23    itojun void	 __init_acs(SCREEN *);
    364  1.40     blymn #ifdef HAVE_WCHAR
    365  1.40     blymn void	 __init_get_wch(SCREEN *);
    366  1.40     blymn void	 __init_wacs(SCREEN *);
    367  1.44       roy int	__cputwchar_args( wchar_t, void * );
    368  1.40     blymn int     _cursesi_copy_nsp(nschar_t *, struct __ldata *);
    369  1.40     blymn void	__cursesi_free_nsp(nschar_t *);
    370  1.40     blymn void	__cursesi_win_free_nsp(WINDOW *);
    371  1.40     blymn void	__cursesi_putnsp(nschar_t *, const int, const int);
    372  1.45  drochner void	__cursesi_chtype_to_cchar(chtype, cchar_t *);
    373  1.40     blymn #endif /* HAVE_WCHAR */
    374  1.63       roy int	 __fgetc_resize(FILE *);
    375  1.41       jdc int	 __unget(wint_t);
    376  1.23    itojun int	 __mvcur(int, int, int, int, int);
    377  1.64       roy WINDOW  *__newwin(SCREEN *, int, int, int, int, int, int);
    378   1.4     blymn int	 __nodelay(void);
    379   1.4     blymn int	 __notimeout(void);
    380   1.4     blymn void	 __restartwin(void);
    381   1.4     blymn void	 __restore_colors(void);
    382   1.6     blymn void     __restore_cursor_vis(void);
    383   1.6     blymn void     __restore_meta_state(void);
    384   1.4     blymn void	 __restore_termios(void);
    385   1.4     blymn void	 __restore_stophandler(void);
    386  1.35       jdc void	 __restore_winchhandler(void);
    387  1.64       roy int	 __ripoffscreen(SCREEN *);
    388  1.65       roy int	 __ripoffresize(SCREEN *);
    389  1.64       roy void	 __ripofftouch(SCREEN *);
    390  1.64       roy int	 __rippedlines(const SCREEN *, int);
    391   1.4     blymn void	 __save_termios(void);
    392  1.25       jdc void	 __set_color(WINDOW *win, attr_t attr);
    393   1.4     blymn void	 __set_stophandler(void);
    394  1.35       jdc void	 __set_winchhandler(void);
    395  1.23    itojun void	 __set_subwin(WINDOW *, WINDOW *);
    396  1.60       roy int	 __slk_init(SCREEN *);
    397  1.60       roy void	 __slk_free(SCREEN *);
    398  1.60       roy int	 __slk_resize(SCREEN *, int cols);
    399  1.60       roy int	 __slk_noutrefresh(SCREEN *);
    400  1.23    itojun void	 __startwin(SCREEN *);
    401  1.23    itojun void	 __stop_signal_handler(int);
    402   1.4     blymn int	 __stopwin(void);
    403  1.23    itojun void	 __swflags(WINDOW *);
    404  1.54       roy void	 __sync(WINDOW *);
    405  1.23    itojun int	 __timeout(int);
    406  1.23    itojun int	 __touchline(WINDOW *, int, int, int);
    407  1.78     blymn int	 __touchwin(WINDOW *, int);
    408  1.60       roy int	 __unripoffline(int (*)(WINDOW *, int));
    409   1.7       jdc void	 __unsetattr(int);
    410  1.25       jdc void	 __unset_color(WINDOW *win);
    411  1.23    itojun int	 __waddch(WINDOW *, __LDATA *);
    412  1.15       jdc int	 __wgetnstr(WINDOW *, char *, int);
    413  1.35       jdc void	 __winch_signal_handler(int);
    414   1.2       jdc 
    415   1.2       jdc /* Private #defines. */
    416  1.23    itojun #define	min(a,b)	((a) < (b) ? (a) : (b))
    417  1.23    itojun #define	max(a,b)	((a) > (b) ? (a ): (b))
    418   1.2       jdc 
    419   1.2       jdc /* Private externs. */
    420   1.3       jdc extern int		 __echoit;
    421   1.3       jdc extern int		 __endwin;
    422   1.3       jdc extern int		 __pfast;
    423   1.3       jdc extern int		 __rawmode;
    424   1.3       jdc extern int		 __noqch;
    425  1.11       jdc extern attr_t		 __mask_op, __mask_me, __mask_ue, __mask_se;
    426   1.7       jdc extern WINDOW		*__virtscr;
    427  1.25       jdc extern int		 __using_color;
    428  1.77     blymn extern int		 __do_color_init;
    429  1.25       jdc extern attr_t		 __default_color;
    430