1*0a6a1f1dSLionel Sambuc /* $NetBSD: curses_private.h,v 1.50 2014/02/20 09:42:42 blymn Exp $ */ 251ffecc1SBen Gras 351ffecc1SBen Gras /*- 451ffecc1SBen Gras * Copyright (c) 1998-2000 Brett Lymn 551ffecc1SBen Gras * (blymn@baea.com.au, brett_lymn@yahoo.com.au) 651ffecc1SBen Gras * All rights reserved. 751ffecc1SBen Gras * 851ffecc1SBen Gras * This code has been donated to The NetBSD Foundation by the Author. 951ffecc1SBen Gras * 1051ffecc1SBen Gras * Redistribution and use in source and binary forms, with or without 1151ffecc1SBen Gras * modification, are permitted provided that the following conditions 1251ffecc1SBen Gras * are met: 1351ffecc1SBen Gras * 1. Redistributions of source code must retain the above copyright 1451ffecc1SBen Gras * notice, this list of conditions and the following disclaimer. 1551ffecc1SBen Gras * 2. The name of the author may not be used to endorse or promote products 1651ffecc1SBen Gras * derived from this software without specific prior written permission 1751ffecc1SBen Gras * 1851ffecc1SBen Gras * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 1951ffecc1SBen Gras * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 2051ffecc1SBen Gras * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 2151ffecc1SBen Gras * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 2251ffecc1SBen Gras * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 2351ffecc1SBen Gras * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 2451ffecc1SBen Gras * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 2551ffecc1SBen Gras * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 2651ffecc1SBen Gras * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 2751ffecc1SBen Gras * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 2851ffecc1SBen Gras * 2951ffecc1SBen Gras * 3051ffecc1SBen Gras */ 3151ffecc1SBen Gras 3251ffecc1SBen Gras /* Modified by Ruibiao Qiu <ruibiao@arl.wustl.edu,ruibiao@gmail.com> 3351ffecc1SBen Gras * to add support for wide characters 3451ffecc1SBen Gras * Changes: 3551ffecc1SBen Gras * - Add a compiler variable HAVE_WCHAR for wide character only code 3651ffecc1SBen Gras * - Add a pointer to liked list of non-spacing characters in __ldata 3751ffecc1SBen Gras * and the macro to access the width field in the attribute field 3851ffecc1SBen Gras * - Add a circular input character buffer in __screen to handle 3951ffecc1SBen Gras * wide-character input (used in get_wch()) 4051ffecc1SBen Gras */ 4151ffecc1SBen Gras 4251ffecc1SBen Gras #include <term.h> 4351ffecc1SBen Gras #include <termios.h> 4451ffecc1SBen Gras 4551ffecc1SBen Gras /* Private structure definitions for curses. */ 4651ffecc1SBen Gras 4751ffecc1SBen Gras /* Termcap capabilities. */ 4851ffecc1SBen Gras #ifdef HAVE_WCHAR 4951ffecc1SBen Gras /* 5051ffecc1SBen Gras * Add a list of non-spacing characters to each spacing 5151ffecc1SBen Gras * character in a singly linked list 5251ffecc1SBen Gras */ 5351ffecc1SBen Gras typedef struct nschar_t { 5451ffecc1SBen Gras wchar_t ch; /* Non-spacing character */ 5551ffecc1SBen Gras struct nschar_t *next; /* Next non-spacing character */ 5651ffecc1SBen Gras } nschar_t; 5751ffecc1SBen Gras #endif /* HAVE_WCHAR */ 5851ffecc1SBen Gras 5951ffecc1SBen Gras /* 6051ffecc1SBen Gras * A window is an array of __LINE structures pointed to by the 'lines' pointer. 6151ffecc1SBen Gras * A line is an array of __LDATA structures pointed to by the 'line' pointer. 6251ffecc1SBen Gras * 6351ffecc1SBen Gras * IMPORTANT: the __LDATA structure must NOT induce any padding, so if new 6451ffecc1SBen Gras * fields are added -- padding fields with *constant values* should ensure 6551ffecc1SBen Gras * that the compiler will not generate any padding when storing an array of 6651ffecc1SBen Gras * __LDATA structures. This is to enable consistent use of memcmp, and memcpy 6751ffecc1SBen Gras * for comparing and copying arrays. 6851ffecc1SBen Gras */ 6951ffecc1SBen Gras 7051ffecc1SBen Gras struct __ldata { 7151ffecc1SBen Gras wchar_t ch; /* Character */ 7251ffecc1SBen Gras attr_t attr; /* Attributes */ 7351ffecc1SBen Gras #ifdef HAVE_WCHAR 7451ffecc1SBen Gras nschar_t *nsp; /* Foreground non-spacing character pointer */ 7551ffecc1SBen Gras #endif /* HAVE_WCHAR */ 7651ffecc1SBen Gras }; 7751ffecc1SBen Gras 7851ffecc1SBen Gras #ifdef HAVE_WCHAR 7951ffecc1SBen Gras /* macros to extract the width of a wide character */ 8051ffecc1SBen Gras #define __WCWIDTH 0xfc000000 8151ffecc1SBen Gras #define WCW_SHIFT 26 8251ffecc1SBen Gras #define WCOL(wc) ((((unsigned) (wc).attr) >> WCW_SHIFT ) > MB_LEN_MAX ? ((int)(((unsigned) (wc).attr ) >> WCW_SHIFT )) - 64 : ((int)(((unsigned) (wc).attr ) >> WCW_SHIFT))) 8351ffecc1SBen Gras #define SET_WCOL(c, w) do { \ 8451ffecc1SBen Gras ((c).attr) = ((((c).attr) & WA_ATTRIBUTES ) | ((w) << WCW_SHIFT )); \ 8551ffecc1SBen Gras } while(/*CONSTCOND*/0) 8651ffecc1SBen Gras #define BGWCOL(wc) ((((wc).battr) >> WCW_SHIFT ) > MB_LEN_MAX ? (((wc).battr ) >> WCW_SHIFT ) - 64 : (((wc).battr ) >> WCW_SHIFT )) 8751ffecc1SBen Gras #define SET_BGWCOL(c, w) do { \ 8851ffecc1SBen Gras ((c).battr) = ((((c).battr) & WA_ATTRIBUTES ) | ((w) << WCW_SHIFT )); \ 8951ffecc1SBen Gras } while(/*CONSTCOND*/0) 9051ffecc1SBen Gras #endif /* HAVE_WCHAR */ 9151ffecc1SBen Gras 9251ffecc1SBen Gras #define __LDATASIZE (sizeof(__LDATA)) 9351ffecc1SBen Gras 9451ffecc1SBen Gras struct __line { 9551ffecc1SBen Gras #ifdef DEBUG 9651ffecc1SBen Gras #define SENTINEL_VALUE 0xaac0ffee 9751ffecc1SBen Gras 9851ffecc1SBen Gras unsigned int sentinel; /* try to catch line overflows */ 9951ffecc1SBen Gras #endif 10051ffecc1SBen Gras #define __ISDIRTY 0x01 /* Line is dirty. */ 10151ffecc1SBen Gras #define __ISPASTEOL 0x02 /* Cursor is past end of line */ 10284d9c625SLionel Sambuc #define __ISFORCED 0x04 /* Force update, no optimisation */ 10351ffecc1SBen Gras unsigned int flags; 10451ffecc1SBen Gras unsigned int hash; /* Hash value for the line. */ 10551ffecc1SBen Gras int *firstchp, *lastchp; /* First and last chngd columns ptrs */ 10651ffecc1SBen Gras int firstch, lastch; /* First and last changed columns. */ 10751ffecc1SBen Gras __LDATA *line; /* Pointer to the line text. */ 10851ffecc1SBen Gras }; 10951ffecc1SBen Gras 11051ffecc1SBen Gras struct __window { /* Window structure. */ 11151ffecc1SBen Gras struct __window *nextp, *orig; /* Subwindows list and parent. */ 11251ffecc1SBen Gras int begy, begx; /* Window home. */ 11351ffecc1SBen Gras int cury, curx; /* Current x, y coordinates. */ 11451ffecc1SBen Gras int maxy, maxx; /* Maximum values for curx, cury. */ 11551ffecc1SBen Gras int reqy, reqx; /* Size requested when created */ 11651ffecc1SBen Gras int ch_off; /* x offset for firstch/lastch. */ 11751ffecc1SBen Gras __LINE **alines; /* Array of pointers to the lines */ 11851ffecc1SBen Gras __LINE *lspace; /* line space (for cleanup) */ 11951ffecc1SBen Gras __LDATA *wspace; /* window space (for cleanup) */ 12051ffecc1SBen Gras 12151ffecc1SBen Gras #define __ENDLINE 0x00000001 /* End of screen. */ 12251ffecc1SBen Gras #define __FLUSH 0x00000002 /* Fflush(stdout) after refresh. */ 12351ffecc1SBen Gras #define __FULLWIN 0x00000004 /* Window is a screen. */ 12451ffecc1SBen Gras #define __IDLINE 0x00000008 /* Insert/delete sequences. */ 12551ffecc1SBen Gras #define __SCROLLWIN 0x00000010 /* Last char will scroll window. */ 12651ffecc1SBen Gras #define __SCROLLOK 0x00000020 /* Scrolling ok. */ 12751ffecc1SBen Gras #define __CLEAROK 0x00000040 /* Clear on next refresh. */ 12851ffecc1SBen Gras #define __LEAVEOK 0x00000100 /* If cursor left */ 12951ffecc1SBen Gras #define __KEYPAD 0x00010000 /* If interpreting keypad codes */ 13051ffecc1SBen Gras #define __NOTIMEOUT 0x00020000 /* Wait indefinitely for func keys */ 13151ffecc1SBen Gras #define __IDCHAR 0x00040000 /* insert/delete char sequences */ 13251ffecc1SBen Gras #define __ISPAD 0x00080000 /* "window" is a pad */ 133*0a6a1f1dSLionel Sambuc #define __ISDERWIN 0x00100000 /* "window" is derived from parent */ 13451ffecc1SBen Gras unsigned int flags; 13551ffecc1SBen Gras int delay; /* delay for getch() */ 13651ffecc1SBen Gras attr_t wattr; /* Character attributes */ 13751ffecc1SBen Gras wchar_t bch; /* Background character */ 13851ffecc1SBen Gras attr_t battr; /* Background attributes */ 13951ffecc1SBen Gras int scr_t, scr_b; /* Scrolling region top, bottom */ 14051ffecc1SBen Gras SCREEN *screen; /* Screen for this window */ 14151ffecc1SBen Gras int pbegy, pbegx, 14251ffecc1SBen Gras sbegy, sbegx, 14351ffecc1SBen Gras smaxy, smaxx; /* Saved prefresh() values */ 144*0a6a1f1dSLionel Sambuc int dery, derx; /* derived window coordinates 145*0a6a1f1dSLionel Sambuc - top left corner of source 146*0a6a1f1dSLionel Sambuc relative to parent win */ 14751ffecc1SBen Gras #ifdef HAVE_WCHAR 14851ffecc1SBen Gras nschar_t *bnsp; /* Background non-spacing char list */ 14951ffecc1SBen Gras #endif /* HAVE_WCHAR */ 15051ffecc1SBen Gras }; 15151ffecc1SBen Gras 15251ffecc1SBen Gras /* Set of attributes unset by 'me' - 'mb', 'md', 'mh', 'mk', 'mp' and 'mr'. */ 15351ffecc1SBen Gras #ifndef HAVE_WCHAR 15451ffecc1SBen Gras #define __TERMATTR \ 15551ffecc1SBen Gras (__REVERSE | __BLINK | __DIM | __BOLD | __BLANK | __PROTECT) 15651ffecc1SBen Gras #else 15751ffecc1SBen Gras #define __TERMATTR \ 15851ffecc1SBen Gras (__REVERSE | __BLINK | __DIM | __BOLD | __BLANK | __PROTECT \ 15951ffecc1SBen Gras | WA_TOP | WA_LOW | WA_LEFT | WA_RIGHT | WA_HORIZONTAL | WA_VERTICAL) 16051ffecc1SBen Gras #endif /* HAVE_WCHAR */ 16151ffecc1SBen Gras 16251ffecc1SBen Gras struct __winlist { 16351ffecc1SBen Gras struct __window *winp; /* The window. */ 16451ffecc1SBen Gras struct __winlist *nextp; /* Next window. */ 16551ffecc1SBen Gras }; 16651ffecc1SBen Gras 16751ffecc1SBen Gras struct __color { 16851ffecc1SBen Gras short num; 16951ffecc1SBen Gras short red; 17051ffecc1SBen Gras short green; 17151ffecc1SBen Gras short blue; 17251ffecc1SBen Gras int flags; 17351ffecc1SBen Gras }; 17451ffecc1SBen Gras 17551ffecc1SBen Gras /* List of colour pairs */ 17651ffecc1SBen Gras struct __pair { 17751ffecc1SBen Gras short fore; 17851ffecc1SBen Gras short back; 17951ffecc1SBen Gras int flags; 18051ffecc1SBen Gras }; 18151ffecc1SBen Gras 18251ffecc1SBen Gras /* Maximum colours */ 18351ffecc1SBen Gras #define MAX_COLORS 64 18451ffecc1SBen Gras /* Maximum colour pairs - determined by number of colour bits in attr_t */ 18551ffecc1SBen Gras #define MAX_PAIRS PAIR_NUMBER(__COLOR) 18651ffecc1SBen Gras 18751ffecc1SBen Gras typedef struct keymap keymap_t; 18851ffecc1SBen Gras 18951ffecc1SBen Gras /* this is the encapsulation of the terminal definition, one for 19051ffecc1SBen Gras * each terminal that curses talks to. 19151ffecc1SBen Gras */ 19251ffecc1SBen Gras struct __screen { 19351ffecc1SBen Gras FILE *infd, *outfd; /* input and output file descriptors */ 19451ffecc1SBen Gras WINDOW *curscr; /* Current screen. */ 19551ffecc1SBen Gras WINDOW *stdscr; /* Standard screen. */ 19651ffecc1SBen Gras WINDOW *__virtscr; /* Virtual screen (for doupdate()). */ 19751ffecc1SBen Gras int curwin; /* current window for refresh */ 19851ffecc1SBen Gras int lx, ly; /* loop parameters for refresh */ 19951ffecc1SBen Gras int COLS; /* Columns on the screen. */ 20051ffecc1SBen Gras int LINES; /* Lines on the screen. */ 20184d9c625SLionel Sambuc int TABSIZE; /* Size of a tab. */ 20251ffecc1SBen Gras int COLORS; /* Maximum colors on the screen */ 20351ffecc1SBen Gras int COLOR_PAIRS; /* Maximum color pairs on the screen */ 20451ffecc1SBen Gras int My_term; /* Use Def_term regardless. */ 20551ffecc1SBen Gras char GT; /* Gtty indicates tabs. */ 20651ffecc1SBen Gras char NONL; /* Term can't hack LF doing a CR. */ 20751ffecc1SBen Gras char UPPERCASE; /* Terminal is uppercase only. */ 20851ffecc1SBen Gras 20951ffecc1SBen Gras chtype acs_char[NUM_ACS]; 21051ffecc1SBen Gras #ifdef HAVE_WCHAR 21151ffecc1SBen Gras cchar_t wacs_char[ NUM_ACS ]; 21251ffecc1SBen Gras #endif /* HAVE_WCHAR */ 21351ffecc1SBen Gras struct __color colours[MAX_COLORS]; 21451ffecc1SBen Gras struct __pair colour_pairs[MAX_PAIRS]; 21551ffecc1SBen Gras attr_t nca; 21651ffecc1SBen Gras 21751ffecc1SBen Gras /* Style of colour manipulation */ 21851ffecc1SBen Gras #define COLOR_NONE 0 21951ffecc1SBen Gras #define COLOR_ANSI 1 /* ANSI/DEC-style colour manipulation */ 22051ffecc1SBen Gras #define COLOR_HP 2 /* HP-style colour manipulation */ 22151ffecc1SBen Gras #define COLOR_TEK 3 /* Tektronix-style colour manipulation */ 22251ffecc1SBen Gras #define COLOR_OTHER 4 /* None of the others but can set fore/back */ 22351ffecc1SBen Gras int color_type; 22451ffecc1SBen Gras 22551ffecc1SBen Gras attr_t mask_op; 22651ffecc1SBen Gras attr_t mask_me; 22751ffecc1SBen Gras attr_t mask_ue; 22851ffecc1SBen Gras attr_t mask_se; 22951ffecc1SBen Gras TERMINAL *term; 23051ffecc1SBen Gras int old_mode; /* old cursor visibility state for terminal */ 23151ffecc1SBen Gras keymap_t *base_keymap; 23251ffecc1SBen Gras int echoit; 23351ffecc1SBen Gras int pfast; 23451ffecc1SBen Gras int rawmode; 23551ffecc1SBen Gras int nl; 23651ffecc1SBen Gras int noqch; 23751ffecc1SBen Gras int clearok; 23851ffecc1SBen Gras int useraw; 23951ffecc1SBen Gras struct __winlist *winlistp; 24051ffecc1SBen Gras struct termios cbreakt, rawt, *curt, save_termios; 24151ffecc1SBen Gras struct termios orig_termios, baset, savedtty; 24251ffecc1SBen Gras int ovmin; 24351ffecc1SBen Gras int ovtime; 24451ffecc1SBen Gras char *stdbuf; 24551ffecc1SBen Gras unsigned int len; 24651ffecc1SBen Gras int meta_state; 24751ffecc1SBen Gras char padchar; 24851ffecc1SBen Gras int endwin; 24951ffecc1SBen Gras int notty; 25051ffecc1SBen Gras int half_delay; 25151ffecc1SBen Gras int resized; 25251ffecc1SBen Gras wchar_t *unget_list; 25351ffecc1SBen Gras int unget_len, unget_pos; 25451ffecc1SBen Gras #ifdef HAVE_WCHAR 25551ffecc1SBen Gras #define MB_LEN_MAX 8 25651ffecc1SBen Gras #define MAX_CBUF_SIZE MB_LEN_MAX 25751ffecc1SBen Gras int cbuf_head; /* header to cbuf */ 25851ffecc1SBen Gras int cbuf_tail; /* tail to cbuf */ 25951ffecc1SBen Gras int cbuf_cur; /* the current char in cbuf */ 26051ffecc1SBen Gras mbstate_t sp; /* wide char processing state */ 26151ffecc1SBen Gras char cbuf[ MAX_CBUF_SIZE ]; /* input character buffer */ 26251ffecc1SBen Gras #endif /* HAVE_WCHAR */ 26351ffecc1SBen Gras }; 26451ffecc1SBen Gras 26551ffecc1SBen Gras 26651ffecc1SBen Gras extern char __GT; /* Gtty indicates tabs. */ 26751ffecc1SBen Gras extern char __NONL; /* Term can't hack LF doing a CR. */ 26851ffecc1SBen Gras extern char __UPPERCASE; /* Terminal is uppercase only. */ 26951ffecc1SBen Gras extern int My_term; /* Use Def_term regardless. */ 27051ffecc1SBen Gras extern const char *Def_term; /* Default terminal type. */ 27151ffecc1SBen Gras extern SCREEN *_cursesi_screen; /* The current screen in use */ 27251ffecc1SBen Gras 27351ffecc1SBen Gras /* Debugging options/functions. */ 27451ffecc1SBen Gras #ifdef DEBUG 27551ffecc1SBen Gras #define __CTRACE_TSTAMP 0x00000001 27651ffecc1SBen Gras #define __CTRACE_MISC 0x00000002 27751ffecc1SBen Gras #define __CTRACE_INIT 0x00000004 27851ffecc1SBen Gras #define __CTRACE_SCREEN 0x00000008 27951ffecc1SBen Gras #define __CTRACE_WINDOW 0x00000010 28051ffecc1SBen Gras #define __CTRACE_REFRESH 0x00000020 28151ffecc1SBen Gras #define __CTRACE_COLOR 0x00000040 28251ffecc1SBen Gras #define __CTRACE_INPUT 0x00000080 28351ffecc1SBen Gras #define __CTRACE_OUTPUT 0x00000100 28451ffecc1SBen Gras #define __CTRACE_LINE 0x00000200 28551ffecc1SBen Gras #define __CTRACE_ATTR 0x00000400 28651ffecc1SBen Gras #define __CTRACE_ERASE 0x00000800 28751ffecc1SBen Gras #define __CTRACE_FILEIO 0x00001000 28851ffecc1SBen Gras #define __CTRACE_ALL 0x7fffffff 28951ffecc1SBen Gras void __CTRACE_init(void); 29051ffecc1SBen Gras void __CTRACE(int, const char *, ...) __attribute__((__format__(__printf__, 2, 3))); 29151ffecc1SBen Gras #endif 29251ffecc1SBen Gras 29351ffecc1SBen Gras /* Private functions. */ 29451ffecc1SBen Gras int __cputchar_args(int, void *); 29551ffecc1SBen Gras void _cursesi_free_keymap(keymap_t *); 29651ffecc1SBen Gras int _cursesi_gettmode(SCREEN *); 29751ffecc1SBen Gras void _cursesi_reset_acs(SCREEN *); 29884d9c625SLionel Sambuc int _cursesi_addbyte(WINDOW *, __LINE **, int *, int *, int , attr_t, int); 29984d9c625SLionel Sambuc int _cursesi_addwchar(WINDOW *, __LINE **, int *, int *, const cchar_t *, 30084d9c625SLionel Sambuc int); 30184d9c625SLionel Sambuc int _cursesi_waddbytes(WINDOW *, const char *, int, attr_t, int); 30251ffecc1SBen Gras #ifdef HAVE_WCHAR 30351ffecc1SBen Gras void _cursesi_reset_wacs(SCREEN *); 30451ffecc1SBen Gras #endif /* HAVE_WCHAR */ 30551ffecc1SBen Gras void _cursesi_resetterm(SCREEN *); 30651ffecc1SBen Gras int _cursesi_setterm(char *, SCREEN *); 30751ffecc1SBen Gras int __delay(void); 30851ffecc1SBen Gras u_int __hash_more(const void *, size_t, u_int); 30951ffecc1SBen Gras #define __hash(s, len) __hash_more((s), (len), 0u) 31051ffecc1SBen Gras void __id_subwins(WINDOW *); 31151ffecc1SBen Gras void __init_getch(SCREEN *); 31251ffecc1SBen Gras void __init_acs(SCREEN *); 31351ffecc1SBen Gras #ifdef HAVE_WCHAR 31451ffecc1SBen Gras void __init_get_wch(SCREEN *); 31551ffecc1SBen Gras void __init_wacs(SCREEN *); 31651ffecc1SBen Gras int __cputwchar_args( wchar_t, void * ); 31751ffecc1SBen Gras int _cursesi_copy_nsp(nschar_t *, struct __ldata *); 31851ffecc1SBen Gras void __cursesi_free_nsp(nschar_t *); 31951ffecc1SBen Gras void __cursesi_win_free_nsp(WINDOW *); 32051ffecc1SBen Gras void __cursesi_putnsp(nschar_t *, const int, const int); 32151ffecc1SBen Gras void __cursesi_chtype_to_cchar(chtype, cchar_t *); 32251ffecc1SBen Gras #endif /* HAVE_WCHAR */ 32351ffecc1SBen Gras int __unget(wint_t); 32451ffecc1SBen Gras int __mvcur(int, int, int, int, int); 32551ffecc1SBen Gras WINDOW *__newwin(SCREEN *, int, int, int, int, int); 32651ffecc1SBen Gras int __nodelay(void); 32751ffecc1SBen Gras int __notimeout(void); 32851ffecc1SBen Gras void __restartwin(void); 32951ffecc1SBen Gras void __restore_colors(void); 33051ffecc1SBen Gras void __restore_cursor_vis(void); 33151ffecc1SBen Gras void __restore_meta_state(void); 33251ffecc1SBen Gras void __restore_termios(void); 33351ffecc1SBen Gras void __restore_stophandler(void); 33451ffecc1SBen Gras void __restore_winchhandler(void); 33551ffecc1SBen Gras void __save_termios(void); 33651ffecc1SBen Gras void __set_color(WINDOW *win, attr_t attr); 33751ffecc1SBen Gras void __set_stophandler(void); 33851ffecc1SBen Gras void __set_winchhandler(void); 33951ffecc1SBen Gras void __set_subwin(WINDOW *, WINDOW *); 34051ffecc1SBen Gras void __startwin(SCREEN *); 34151ffecc1SBen Gras void __stop_signal_handler(int); 34251ffecc1SBen Gras int __stopwin(void); 34351ffecc1SBen Gras void __swflags(WINDOW *); 34451ffecc1SBen Gras int __timeout(int); 34551ffecc1SBen Gras int __touchline(WINDOW *, int, int, int); 34651ffecc1SBen Gras int __touchwin(WINDOW *); 34751ffecc1SBen Gras void __unsetattr(int); 34851ffecc1SBen Gras void __unset_color(WINDOW *win); 34951ffecc1SBen Gras int __waddch(WINDOW *, __LDATA *); 35051ffecc1SBen Gras int __wgetnstr(WINDOW *, char *, int); 35151ffecc1SBen Gras void __winch_signal_handler(int); 35251ffecc1SBen Gras 35351ffecc1SBen Gras /* Private #defines. */ 35451ffecc1SBen Gras #define min(a,b) ((a) < (b) ? (a) : (b)) 35551ffecc1SBen Gras #define max(a,b) ((a) > (b) ? (a ): (b)) 35651ffecc1SBen Gras 35751ffecc1SBen Gras /* Private externs. */ 35851ffecc1SBen Gras extern int __echoit; 35951ffecc1SBen Gras extern int __endwin; 36051ffecc1SBen Gras extern int __pfast; 36151ffecc1SBen Gras extern int __rawmode; 36251ffecc1SBen Gras extern int __noqch; 36351ffecc1SBen Gras extern attr_t __mask_op, __mask_me, __mask_ue, __mask_se; 36451ffecc1SBen Gras extern WINDOW *__virtscr; 36551ffecc1SBen Gras extern int __using_color; 36651ffecc1SBen Gras extern attr_t __default_color; 367