Home | History | Annotate | Line # | Download | only in libcurses
curses_private.h revision 1.42
      1  1.42       jdc /*	$NetBSD: curses_private.h,v 1.42 2008/04/14 20:34:36 jdc 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.40     blymn  * - Add a circular input character buffer in __screen to handle wide
     39  1.40     blymn  *   character input (used in get_wch())
     40  1.40     blymn  */
     41  1.40     blymn 
     42  1.17     blymn #include <termios.h>
     43  1.17     blymn 
     44   1.1     blymn /* Private structure definitions for curses. */
     45  1.18     blymn 
     46  1.18     blymn /* Termcap capabilities. */
     47  1.18     blymn extern char	__tc_am, __tc_bs, __tc_cc, __tc_da, __tc_eo,
     48  1.18     blymn 		__tc_hc, __tc_hl, __tc_in, __tc_mi, __tc_ms,
     49  1.18     blymn 		__tc_nc, __tc_ns, __tc_os, __tc_ul, __tc_ut,
     50  1.18     blymn 		__tc_xb, __tc_xn, __tc_xt, __tc_xs, __tc_xx;
     51  1.18     blymn extern char	__CA;
     52  1.18     blymn extern int	__tc_pa, __tc_Co, __tc_NC;
     53  1.18     blymn extern char	*__tc_ac, *__tc_AB, *__tc_ae, *__tc_AF, *__tc_AL,
     54  1.18     blymn 		*__tc_al, *__tc_as, *__tc_bc, *__tc_bl, *__tc_bt,
     55  1.18     blymn 		*__tc_cd, *__tc_ce, *__tc_cl, *__tc_cm, *__tc_cr,
     56  1.18     blymn 		*__tc_cs, *__tc_dc, *__tc_DL, *__tc_dl, *__tc_dm,
     57  1.18     blymn 		*__tc_DO, *__tc_do, *__tc_eA, *__tc_ed, *__tc_ei,
     58  1.18     blymn 		*__tc_ho, *__tc_Ic, *__tc_ic, *__tc_im, *__tc_Ip,
     59  1.18     blymn 		*__tc_ip, *__tc_k0, *__tc_k1, *__tc_k2, *__tc_k3,
     60  1.18     blymn 		*__tc_k4, *__tc_k5, *__tc_k6, *__tc_k7, *__tc_k8,
     61  1.18     blymn 		*__tc_k9, *__tc_kd, *__tc_ke, *__tc_kh, *__tc_kl,
     62  1.18     blymn 		*__tc_kr, *__tc_ks, *__tc_ku, *__tc_LE, *__tc_ll,
     63  1.18     blymn 		*__tc_ma, *__tc_mb, *__tc_md, *__tc_me, *__tc_mh,
     64  1.18     blymn 		*__tc_mk, *__tc_mm, *__tc_mo, *__tc_mp, *__tc_mr,
     65  1.18     blymn 		*__tc_nd, *__tc_nl, *__tc_oc, *__tc_op,
     66  1.18     blymn 		*__tc_rc, *__tc_RI, *__tc_Sb, *__tc_sc, *__tc_se,
     67  1.18     blymn 		*__tc_SF, *__tc_Sf, *__tc_sf, *__tc_so, *__tc_sp,
     68  1.18     blymn 		*__tc_SR, *__tc_sr, *__tc_ta, *__tc_te, *__tc_ti,
     69  1.18     blymn 		*__tc_uc, *__tc_ue, *__tc_UP, *__tc_up, *__tc_us,
     70  1.18     blymn 		*__tc_vb, *__tc_ve, *__tc_vi, *__tc_vs;
     71  1.18     blymn 
     72  1.40     blymn #ifdef HAVE_WCHAR
     73  1.40     blymn extern char *__tc_Xh, *__tc_Xl, *__tc_Xo, *__tc_Xr, *__tc_Xt,
     74  1.40     blymn 		*__tc_Xv;
     75  1.40     blymn /*
     76  1.40     blymn  * Add a list of non-spacing characters to each spacing
     77  1.40     blymn  * character in a singly linked list
     78  1.40     blymn  */
     79  1.40     blymn typedef struct nschar_t {
     80  1.40     blymn 	wchar_t			ch;		/* Non-spacing character */
     81  1.40     blymn 	struct nschar_t	*next;	/* Next non-spacing character */
     82  1.40     blymn } nschar_t;
     83  1.40     blymn #endif /* HAVE_WCHAR */
     84  1.40     blymn 
     85   1.1     blymn /*
     86  1.42       jdc  * A window is an array of __LINE structures pointed to by the 'lines' pointer.
     87   1.1     blymn  * A line is an array of __LDATA structures pointed to by the 'line' pointer.
     88   1.1     blymn  *
     89   1.1     blymn  * IMPORTANT: the __LDATA structure must NOT induce any padding, so if new
     90   1.1     blymn  * fields are added -- padding fields with *constant values* should ensure
     91   1.1     blymn  * that the compiler will not generate any padding when storing an array of
     92   1.1     blymn  *  __LDATA structures.  This is to enable consistent use of memcmp, and memcpy
     93   1.1     blymn  * for comparing and copying arrays.
     94   1.1     blymn  */
     95   1.1     blymn 
     96   1.1     blymn struct __ldata {
     97   1.1     blymn 	wchar_t	ch;			/* Character */
     98   1.1     blymn 	attr_t	attr;			/* Attributes */
     99  1.40     blymn #ifdef HAVE_WCHAR
    100  1.40     blymn 	nschar_t	*nsp;	/* Foreground non-spacing character pointer */
    101  1.40     blymn #endif /* HAVE_WCHAR */
    102   1.1     blymn };
    103   1.1     blymn 
    104  1.40     blymn #ifdef HAVE_WCHAR
    105  1.40     blymn /* macros to extract the width of a wide character */
    106  1.40     blymn #define __WCWIDTH 0xfc000000
    107  1.40     blymn #define WCW_SHIFT 26
    108  1.40     blymn #define WCOL(wc) ((((unsigned) (wc).attr) >> WCW_SHIFT ) > MB_LEN_MAX ? ((int)(((unsigned) (wc).attr ) >> WCW_SHIFT )) - 64 : ((int)(((unsigned) (wc).attr ) >> WCW_SHIFT)))
    109  1.40     blymn #define SET_WCOL(c, w) do { 						\
    110  1.40     blymn 	((c).attr) = ((((c).attr) & WA_ATTRIBUTES ) | ((w) << WCW_SHIFT )); \
    111  1.40     blymn } while(/*CONSTCOND*/0)
    112  1.40     blymn #define BGWCOL(wc) ((((wc).battr) >> WCW_SHIFT ) > MB_LEN_MAX ? (((wc).battr ) >> WCW_SHIFT ) - 64 : (((wc).battr ) >> WCW_SHIFT ))
    113  1.40     blymn #define SET_BGWCOL(c, w) do { 						\
    114  1.40     blymn 	((c).battr) = ((((c).battr) & WA_ATTRIBUTES ) | ((w) << WCW_SHIFT )); \
    115  1.40     blymn } while(/*CONSTCOND*/0)
    116  1.40     blymn #endif /* HAVE_WCHAR */
    117  1.40     blymn 
    118   1.1     blymn #define __LDATASIZE	(sizeof(__LDATA))
    119   1.1     blymn 
    120   1.1     blymn struct __line {
    121  1.24     blymn #ifdef DEBUG
    122  1.24     blymn #define SENTINEL_VALUE 0xaac0ffee
    123  1.40     blymn 
    124  1.24     blymn 	unsigned int sentinel;          /* try to catch line overflows */
    125  1.24     blymn #endif
    126   1.1     blymn #define	__ISDIRTY	0x01		/* Line is dirty. */
    127   1.1     blymn #define __ISPASTEOL	0x02		/* Cursor is past end of line */
    128   1.1     blymn 	unsigned int flags;
    129   1.1     blymn 	unsigned int hash;		/* Hash value for the line. */
    130   1.1     blymn 	int *firstchp, *lastchp;	/* First and last chngd columns ptrs */
    131   1.1     blymn 	int firstch, lastch;		/* First and last changed columns. */
    132   1.1     blymn 	__LDATA *line;			/* Pointer to the line text. */
    133   1.1     blymn };
    134   1.1     blymn 
    135   1.1     blymn struct __window {		/* Window structure. */
    136   1.1     blymn 	struct __window	*nextp, *orig;	/* Subwindows list and parent. */
    137   1.1     blymn 	int begy, begx;			/* Window home. */
    138   1.1     blymn 	int cury, curx;			/* Current x, y coordinates. */
    139   1.1     blymn 	int maxy, maxx;			/* Maximum values for curx, cury. */
    140  1.29       dsl 	int reqy, reqx;			/* Size requested when created */
    141  1.29       dsl 	int ch_off;			/* x offset for firstch/lastch. */
    142   1.1     blymn 	__LINE **lines;			/* Array of pointers to the lines */
    143   1.1     blymn 	__LINE  *lspace;		/* line space (for cleanup) */
    144   1.1     blymn 	__LDATA *wspace;		/* window space (for cleanup) */
    145   1.1     blymn 
    146   1.1     blymn #define	__ENDLINE	0x00000001	/* End of screen. */
    147   1.1     blymn #define	__FLUSH		0x00000002	/* Fflush(stdout) after refresh. */
    148   1.1     blymn #define	__FULLWIN	0x00000004	/* Window is a screen. */
    149   1.1     blymn #define	__IDLINE	0x00000008	/* Insert/delete sequences. */
    150   1.1     blymn #define	__SCROLLWIN	0x00000010	/* Last char will scroll window. */
    151   1.1     blymn #define	__SCROLLOK	0x00000020	/* Scrolling ok. */
    152   1.1     blymn #define	__CLEAROK	0x00000040	/* Clear on next refresh. */
    153   1.1     blymn #define	__LEAVEOK	0x00000100	/* If cursor left */
    154   1.1     blymn #define	__KEYPAD	0x00010000	/* If interpreting keypad codes */
    155   1.1     blymn #define	__NOTIMEOUT	0x00020000	/* Wait indefinitely for func keys */
    156  1.26       jdc #define __IDCHAR	0x00040000	/* insert/delete char sequences */
    157  1.26       jdc #define __ISPAD		0x00080000	/* "window" is a pad */
    158   1.1     blymn 	unsigned int flags;
    159   1.1     blymn 	int	delay;			/* delay for getch() */
    160   1.1     blymn 	attr_t	wattr;			/* Character attributes */
    161   1.5       jdc 	wchar_t	bch;			/* Background character */
    162   1.2       jdc 	attr_t	battr;			/* Background attributes */
    163  1.14       jdc 	int	scr_t, scr_b;		/* Scrolling region top, bottom */
    164  1.32       dsl 	SCREEN	*screen;		/* Screen for this window */
    165  1.36       jdc 	int	pbegy, pbegx,
    166  1.36       jdc 		sbegy, sbegx,
    167  1.36       jdc 		smaxy, smaxx;		/* Saved prefresh() values */
    168  1.40     blymn #ifdef HAVE_WCHAR
    169  1.40     blymn 	nschar_t *bnsp;			/* Background non-spacing char list */
    170  1.40     blymn #endif /* HAVE_WCHAR */
    171   1.1     blymn };
    172   1.5       jdc 
    173   1.5       jdc /* Set of attributes unset by 'me' - 'mb', 'md', 'mh', 'mk', 'mp' and 'mr'. */
    174  1.40     blymn #ifndef HAVE_WCHAR
    175   1.5       jdc #define	__TERMATTR \
    176   1.5       jdc 	(__REVERSE | __BLINK | __DIM | __BOLD | __BLANK | __PROTECT)
    177  1.40     blymn #else
    178  1.40     blymn #define	__TERMATTR \
    179  1.40     blymn 	(__REVERSE | __BLINK | __DIM | __BOLD | __BLANK | __PROTECT \
    180  1.40     blymn 	| WA_TOP | WA_LOW | WA_LEFT | WA_RIGHT | WA_HORIZONTAL | WA_VERTICAL)
    181  1.40     blymn #endif /* HAVE_WCHAR */
    182   1.2       jdc 
    183   1.3       jdc struct __winlist {
    184   1.3       jdc 	struct __window		*winp;	/* The window. */
    185   1.3       jdc 	struct __winlist	*nextp;	/* Next window. */
    186   1.3       jdc };
    187   1.3       jdc 
    188  1.17     blymn struct __color {
    189  1.17     blymn 	short	num;
    190  1.17     blymn 	short	red;
    191  1.17     blymn 	short	green;
    192  1.17     blymn 	short	blue;
    193  1.17     blymn 	int	flags;
    194  1.17     blymn };
    195  1.17     blymn 
    196  1.17     blymn /* List of colour pairs */
    197  1.17     blymn struct __pair {
    198  1.17     blymn 	short	fore;
    199  1.17     blymn 	short	back;
    200  1.17     blymn 	int	flags;
    201  1.17     blymn };
    202  1.17     blymn 
    203  1.17     blymn /* Maximum colours */
    204  1.17     blymn #define	MAX_COLORS	64
    205  1.17     blymn /* Maximum colour pairs - determined by number of colour bits in attr_t */
    206  1.25       jdc #define	MAX_PAIRS	PAIR_NUMBER(__COLOR)
    207  1.17     blymn 
    208  1.17     blymn typedef struct keymap keymap_t;
    209  1.17     blymn 
    210  1.17     blymn /* this is the encapsulation of the terminal definition, one for
    211  1.17     blymn  * each terminal that curses talks to.
    212  1.17     blymn  */
    213  1.17     blymn struct __screen {
    214  1.17     blymn 	FILE    *infd, *outfd;  /* input and output file descriptors */
    215  1.17     blymn 	WINDOW	*curscr;	/* Current screen. */
    216  1.17     blymn 	WINDOW	*stdscr;	/* Standard screen. */
    217  1.17     blymn 	WINDOW	*__virtscr;	/* Virtual screen (for doupdate()). */
    218  1.17     blymn 	int      curwin;        /* current window for refresh */
    219  1.29       dsl 	int      lx, ly;        /* loop parameters for refresh */
    220  1.17     blymn 	int	 COLS;		/* Columns on the screen. */
    221  1.17     blymn 	int	 LINES;		/* Lines on the screen. */
    222  1.17     blymn 	int	 COLORS;	/* Maximum colors on the screen */
    223  1.17     blymn 	int	 COLOR_PAIRS;	/* Maximum color pairs on the screen */
    224  1.17     blymn 	int	 My_term;	/* Use Def_term regardless. */
    225  1.17     blymn 	char	 GT;		/* Gtty indicates tabs. */
    226  1.17     blymn 	char	 NONL;		/* Term can't hack LF doing a CR. */
    227  1.17     blymn 	char	 UPPERCASE;	/* Terminal is uppercase only. */
    228  1.17     blymn 
    229  1.17     blymn         /* BEWARE!!! The order of the following terminal capabilities */
    230  1.17     blymn         /* (tc_foo) is important - do not update without fixing the zap */
    231  1.17     blymn         /* function in setterm.c */
    232  1.17     blymn 	char	tc_am, tc_bs, tc_cc, tc_da, tc_eo, tc_hc, tc_hl, tc_in, tc_mi,
    233  1.17     blymn 		tc_ms, tc_nc, tc_ns, tc_os, tc_ul, tc_ut, tc_xb, tc_xn, tc_xt,
    234  1.17     blymn 		tc_xs, tc_xx;
    235  1.17     blymn 	int     flag_count;
    236  1.17     blymn 	int	tc_pa, tc_Co, tc_NC;
    237  1.17     blymn 	int     int_count;
    238  1.17     blymn 	char	*tc_AB, *tc_ac, *tc_ae, *tc_AF, *tc_AL,
    239  1.17     blymn 		*tc_al, *tc_as, *tc_bc, *tc_bl, *tc_bt,
    240  1.17     blymn 		*tc_cd, *tc_ce, *tc_cl, *tc_cm, *tc_cr,
    241  1.17     blymn 		*tc_cs, *tc_dc, *tc_DL, *tc_dl, *tc_dm,
    242  1.17     blymn 		*tc_DO, *tc_do, *tc_eA, *tc_ed, *tc_ei,
    243  1.17     blymn 		*tc_ho, *tc_Ic, *tc_ic, *tc_im, *tc_Ip,
    244  1.17     blymn 		*tc_ip, *tc_k0, *tc_k1, *tc_k2, *tc_k3,
    245  1.17     blymn 		*tc_k4, *tc_k5, *tc_k6, *tc_k7, *tc_k8,
    246  1.17     blymn 		*tc_k9, *tc_kd, *tc_ke, *tc_kh, *tc_kl,
    247  1.17     blymn 		*tc_kr, *tc_ks, *tc_ku, *tc_LE, *tc_ll,
    248  1.17     blymn 		*tc_ma, *tc_mb, *tc_md, *tc_me, *tc_mh,
    249  1.17     blymn 		*tc_mk, *tc_mm, *tc_mo, *tc_mp, *tc_mr,
    250  1.17     blymn 		*tc_nd, *tc_nl, *tc_oc, *tc_op, *tc_pc,
    251  1.17     blymn 		*tc_rc, *tc_RI, *tc_Sb, *tc_sc, *tc_se,
    252  1.17     blymn 		*tc_SF, *tc_Sf, *tc_sf, *tc_so, *tc_sp,
    253  1.17     blymn 		*tc_SR, *tc_sr, *tc_ta, *tc_te, *tc_ti,
    254  1.17     blymn 		*tc_uc, *tc_ue, *tc_UP, *tc_up, *tc_us,
    255  1.40     blymn #ifndef HAVE_WCHAR
    256  1.17     blymn 		*tc_vb, *tc_ve, *tc_vi, *tc_vs;
    257  1.40     blymn #else
    258  1.40     blymn 		*tc_vb, *tc_ve, *tc_vi, *tc_vs, *tc_Xh,
    259  1.40     blymn 		*tc_Xl, *tc_Xo, *tc_Xr, *tc_Xt, *tc_Xv;
    260  1.40     blymn #endif /* HAVE_WCHAR */
    261  1.17     blymn 	char CA;
    262  1.17     blymn 	int str_count;
    263  1.17     blymn 	chtype acs_char[NUM_ACS];
    264  1.40     blymn #ifdef HAVE_WCHAR
    265  1.40     blymn 	cchar_t wacs_char[ NUM_ACS ];
    266  1.40     blymn #endif /* HAVE_WCHAR */
    267  1.17     blymn 	struct __color colours[MAX_COLORS];
    268  1.17     blymn 	struct __pair  colour_pairs[MAX_PAIRS];
    269  1.17     blymn 	attr_t	nca;
    270  1.20     blymn 
    271  1.17     blymn /* Style of colour manipulation */
    272  1.17     blymn #define COLOR_NONE	0
    273  1.17     blymn #define COLOR_ANSI	1	/* ANSI/DEC-style colour manipulation */
    274  1.17     blymn #define COLOR_HP	2	/* HP-style colour manipulation */
    275  1.17     blymn #define COLOR_TEK	3	/* Tektronix-style colour manipulation */
    276  1.17     blymn #define COLOR_OTHER	4	/* None of the others but can set fore/back */
    277  1.17     blymn 	int color_type;
    278  1.20     blymn 
    279  1.17     blymn 	attr_t mask_op;
    280  1.17     blymn 	attr_t mask_me;
    281  1.17     blymn 	attr_t mask_ue;
    282  1.17     blymn 	attr_t mask_se;
    283  1.17     blymn 	struct tinfo *cursesi_genbuf;
    284  1.17     blymn 	int old_mode; /* old cursor visibility state for terminal */
    285  1.17     blymn 	keymap_t *base_keymap;
    286  1.17     blymn 	int echoit;
    287  1.17     blymn 	int pfast;
    288  1.17     blymn 	int rawmode;
    289  1.30       jdc 	int nl;
    290  1.17     blymn 	int noqch;
    291  1.17     blymn 	int clearok;
    292  1.17     blymn 	int useraw;
    293  1.17     blymn 	struct __winlist *winlistp;
    294  1.17     blymn 	struct   termios cbreakt, rawt, *curt, save_termios;
    295  1.17     blymn 	struct termios orig_termios, baset, savedtty;
    296  1.17     blymn 	int ovmin;
    297  1.17     blymn 	int ovtime;
    298  1.17     blymn 	char *stdbuf;
    299  1.17     blymn 	unsigned int len;
    300  1.17     blymn 	int meta_state;
    301  1.17     blymn 	char pad_char;
    302  1.21  christos 	char ttytype[128];
    303  1.17     blymn 	int endwin;
    304  1.22    itojun 	int notty;
    305  1.27     blymn 	int half_delay;
    306  1.35       jdc 	int resized;
    307  1.41       jdc 	wchar_t *unget_list;
    308  1.41       jdc 	int unget_len, unget_pos;
    309  1.40     blymn #ifdef HAVE_WCHAR
    310  1.40     blymn #define MB_LEN_MAX 8
    311  1.40     blymn #define MAX_CBUF_SIZE MB_LEN_MAX
    312  1.40     blymn 	int		cbuf_head;		/* header to cbuf */
    313  1.40     blymn 	int		cbuf_tail;		/* tail to cbuf */
    314  1.40     blymn 	int		cbuf_cur;		/* the current char in cbuf */
    315  1.40     blymn 	mbstate_t	sp;			/* wide char processing state */
    316  1.40     blymn 	char		cbuf[ MAX_CBUF_SIZE ];	/* input character buffer */
    317  1.40     blymn #endif /* HAVE_WCHAR */
    318  1.17     blymn };
    319  1.17     blymn 
    320  1.17     blymn 
    321  1.11       jdc extern char	 __GT;			/* Gtty indicates tabs. */
    322  1.11       jdc extern char	 __NONL;		/* Term can't hack LF doing a CR. */
    323  1.11       jdc extern char	 __UPPERCASE;		/* Terminal is uppercase only. */
    324  1.11       jdc extern int	 My_term;		/* Use Def_term regardless. */
    325  1.11       jdc extern const char	*Def_term;	/* Default terminal type. */
    326  1.17     blymn extern SCREEN   *_cursesi_screen;       /* The current screen in use */
    327  1.11       jdc 
    328  1.39       jdc /* Debugging options/functions. */
    329   1.2       jdc #ifdef DEBUG
    330  1.39       jdc #define __CTRACE_TSTAMP		0x00000001
    331  1.39       jdc #define __CTRACE_MISC		0x00000002
    332  1.39       jdc #define __CTRACE_INIT		0x00000004
    333  1.39       jdc #define __CTRACE_SCREEN		0x00000008
    334  1.39       jdc #define __CTRACE_WINDOW		0x00000010
    335  1.39       jdc #define __CTRACE_REFRESH	0x00000020
    336  1.39       jdc #define __CTRACE_COLOR		0x00000040
    337  1.39       jdc #define __CTRACE_INPUT		0x00000080
    338  1.39       jdc #define __CTRACE_OUTPUT		0x00000100
    339  1.39       jdc #define __CTRACE_LINE		0x00000200
    340  1.39       jdc #define __CTRACE_ATTR		0x00000400
    341  1.39       jdc #define __CTRACE_ERASE		0x00000800
    342  1.42       jdc #define __CTRACE_FILEIO		0x00001000
    343  1.39       jdc #define __CTRACE_ALL		0x7fffffff
    344  1.39       jdc void	 __CTRACE_init(void);
    345  1.39       jdc void	 __CTRACE(int, const char *, ...) __attribute__((__format__(__printf__, 2, 3)));
    346   1.2       jdc #endif
    347  1.39       jdc 
    348  1.39       jdc /* Private functions. */
    349  1.23    itojun void     __cputchar_args(char, void *);
    350  1.23    itojun void     _cursesi_free_keymap(keymap_t *);
    351  1.23    itojun int      _cursesi_gettmode(SCREEN *);
    352  1.23    itojun void     _cursesi_reset_acs(SCREEN *);
    353  1.40     blymn int	_cursesi_addbyte(WINDOW *, __LINE **, int *, int *, int , attr_t);
    354  1.40     blymn int	_cursesi_addwchar(WINDOW *, __LINE **, int *, int *, const cchar_t *);
    355  1.40     blymn #ifdef HAVE_WCHAR
    356  1.40     blymn void     _cursesi_reset_wacs(SCREEN *);
    357  1.40     blymn #endif /* HAVE_WCHAR */
    358  1.23    itojun void     _cursesi_resetterm(SCREEN *);
    359  1.23    itojun int      _cursesi_setterm(char *, SCREEN *);
    360   1.4     blymn int	 __delay(void);
    361  1.37       dsl u_int	 __hash_more(const void *, size_t, u_int);
    362  1.23    itojun #define	__hash(s, len)	__hash_more((s), (len), 0u)
    363  1.23    itojun void	 __id_subwins(WINDOW *);
    364  1.23    itojun void	 __init_getch(SCREEN *);
    365  1.23    itojun void	 __init_acs(SCREEN *);
    366  1.40     blymn #ifdef HAVE_WCHAR
    367  1.40     blymn void	 __init_get_wch(SCREEN *);
    368  1.40     blymn void	 __init_wacs(SCREEN *);
    369  1.40     blymn void	__cputwchar_args( wchar_t, void * );
    370  1.40     blymn int     _cursesi_copy_nsp(nschar_t *, struct __ldata *);
    371  1.40     blymn void	__cursesi_free_nsp(nschar_t *);
    372  1.40     blymn void	__cursesi_win_free_nsp(WINDOW *);
    373  1.40     blymn void	__cursesi_putnsp(nschar_t *, const int, const int);
    374  1.40     blymn #endif /* HAVE_WCHAR */
    375  1.41       jdc int	 __unget(wint_t);
    376  1.23    itojun char	*__longname(char *, char *);	/* Original BSD version */
    377  1.23    itojun int	 __mvcur(int, int, int, int, int);
    378  1.26       jdc WINDOW  *__newwin(SCREEN *, int, int, int, int, int);
    379   1.4     blymn int	 __nodelay(void);
    380   1.4     blymn int	 __notimeout(void);
    381   1.4     blymn char	*__parse_cap(const char *, ...);
    382   1.4     blymn void	 __restartwin(void);
    383   1.4     blymn void	 __restore_colors(void);
    384   1.6     blymn void     __restore_cursor_vis(void);
    385   1.6     blymn void     __restore_meta_state(void);
    386   1.4     blymn void	 __restore_termios(void);
    387   1.4     blymn void	 __restore_stophandler(void);
    388  1.35       jdc void	 __restore_winchhandler(void);
    389   1.4     blymn void	 __save_termios(void);
    390  1.25       jdc void	 __set_color(WINDOW *win, attr_t attr);
    391   1.4     blymn void	 __set_stophandler(void);
    392  1.35       jdc void	 __set_winchhandler(void);
    393  1.23    itojun void	 __set_subwin(WINDOW *, WINDOW *);
    394  1.23    itojun void	 __startwin(SCREEN *);
    395  1.23    itojun void	 __stop_signal_handler(int);
    396   1.4     blymn int	 __stopwin(void);
    397  1.23    itojun void	 __swflags(WINDOW *);
    398  1.23    itojun int	 __timeout(int);
    399  1.23    itojun int	 __touchline(WINDOW *, int, int, int);
    400  1.23    itojun int	 __touchwin(WINDOW *);
    401  1.23    itojun char	*__tscroll(const char *, int, int);
    402   1.7       jdc void	 __unsetattr(int);
    403  1.25       jdc void	 __unset_color(WINDOW *win);
    404  1.23    itojun int	 __waddch(WINDOW *, __LDATA *);
    405  1.15       jdc int	 __wgetnstr(WINDOW *, char *, int);
    406  1.35       jdc void	 __winch_signal_handler(int);
    407   1.2       jdc 
    408   1.2       jdc /* Private #defines. */
    409  1.23    itojun #define	min(a,b)	((a) < (b) ? (a) : (b))
    410  1.23    itojun #define	max(a,b)	((a) > (b) ? (a ): (b))
    411   1.2       jdc 
    412   1.2       jdc /* Private externs. */
    413   1.3       jdc extern int		 __echoit;
    414   1.3       jdc extern int		 __endwin;
    415   1.3       jdc extern int		 __pfast;
    416   1.3       jdc extern int		 __rawmode;
    417   1.3       jdc extern int		 __noqch;
    418  1.11       jdc extern attr_t		 __mask_op, __mask_me, __mask_ue, __mask_se;
    419   1.7       jdc extern WINDOW		*__virtscr;
    420  1.25       jdc extern int		 __using_color;
    421  1.25       jdc extern attr_t		 __default_color;
    422