1*2be3a5a4Sblymn /* $NetBSD: curses_private.h,v 1.82 2024/07/11 07:13:41 blymn Exp $ */ 223464ee5Sblymn 323464ee5Sblymn /*- 423464ee5Sblymn * Copyright (c) 1998-2000 Brett Lymn 523464ee5Sblymn * (blymn@baea.com.au, brett_lymn@yahoo.com.au) 623464ee5Sblymn * All rights reserved. 723464ee5Sblymn * 823464ee5Sblymn * This code has been donated to The NetBSD Foundation by the Author. 923464ee5Sblymn * 1023464ee5Sblymn * Redistribution and use in source and binary forms, with or without 1123464ee5Sblymn * modification, are permitted provided that the following conditions 1223464ee5Sblymn * are met: 1323464ee5Sblymn * 1. Redistributions of source code must retain the above copyright 1423464ee5Sblymn * notice, this list of conditions and the following disclaimer. 1523464ee5Sblymn * 2. The name of the author may not be used to endorse or promote products 16c03a48d6Swiz * derived from this software without specific prior written permission 1723464ee5Sblymn * 1823464ee5Sblymn * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 1923464ee5Sblymn * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 2023464ee5Sblymn * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 2123464ee5Sblymn * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 2223464ee5Sblymn * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 2323464ee5Sblymn * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 2423464ee5Sblymn * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 2523464ee5Sblymn * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 2623464ee5Sblymn * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 2723464ee5Sblymn * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 2823464ee5Sblymn * 2923464ee5Sblymn * 3023464ee5Sblymn */ 3123464ee5Sblymn 32e124de36Sblymn /* Modified by Ruibiao Qiu <ruibiao@arl.wustl.edu,ruibiao@gmail.com> 33e124de36Sblymn * to add support for wide characters 34e124de36Sblymn * Changes: 35e124de36Sblymn * - Add a compiler variable HAVE_WCHAR for wide character only code 36e124de36Sblymn * - Add a pointer to liked list of non-spacing characters in __ldata 37e124de36Sblymn * and the macro to access the width field in the attribute field 383d3c5d42Swiz * - Add a circular input character buffer in __screen to handle 393d3c5d42Swiz * wide-character input (used in get_wch()) 40e124de36Sblymn */ 41e124de36Sblymn 4298eb8895Sroy #include <term.h> 43c84d91aaSblymn #include <termios.h> 44c84d91aaSblymn 4523464ee5Sblymn /* Private structure definitions for curses. */ 4651344953Sblymn 4751344953Sblymn /* Termcap capabilities. */ 48e124de36Sblymn #ifdef HAVE_WCHAR 49e124de36Sblymn /* 50e124de36Sblymn * Add a list of non-spacing characters to each spacing 51e124de36Sblymn * character in a singly linked list 52e124de36Sblymn */ 53e124de36Sblymn typedef struct nschar_t { 54e124de36Sblymn wchar_t ch; /* Non-spacing character */ 55e124de36Sblymn struct nschar_t *next; /* Next non-spacing character */ 56e124de36Sblymn } nschar_t; 57e124de36Sblymn #endif /* HAVE_WCHAR */ 58e124de36Sblymn 5923464ee5Sblymn /* 604dd5a997Sjdc * A window is an array of __LINE structures pointed to by the 'lines' pointer. 6123464ee5Sblymn * A line is an array of __LDATA structures pointed to by the 'line' pointer. 6223464ee5Sblymn * 6323464ee5Sblymn * IMPORTANT: the __LDATA structure must NOT induce any padding, so if new 6423464ee5Sblymn * fields are added -- padding fields with *constant values* should ensure 6523464ee5Sblymn * that the compiler will not generate any padding when storing an array of 6623464ee5Sblymn * __LDATA structures. This is to enable consistent use of memcmp, and memcpy 6723464ee5Sblymn * for comparing and copying arrays. 6823464ee5Sblymn */ 6923464ee5Sblymn 7023464ee5Sblymn struct __ldata { 7123464ee5Sblymn wchar_t ch; /* Character */ 7223464ee5Sblymn attr_t attr; /* Attributes */ 73a7d2c216Sblymn #define CA_CONTINUATION 0x0001 /* a continuation cell */ 74a7d2c216Sblymn #define CA_BACKGROUND 0x0002 /* background char */ 75a7d2c216Sblymn int16_t cflags; /* internal attributes for wide char */ 76e124de36Sblymn #ifdef HAVE_WCHAR 77e124de36Sblymn nschar_t *nsp; /* Foreground non-spacing character pointer */ 78f1942931Sblymn int16_t wcols; /* display width of a wide char */ 79e124de36Sblymn #endif /* HAVE_WCHAR */ 8023464ee5Sblymn }; 8123464ee5Sblymn 8223464ee5Sblymn #define __LDATASIZE (sizeof(__LDATA)) 8323464ee5Sblymn 8423464ee5Sblymn struct __line { 858d259104Sblymn #ifdef DEBUG 868d259104Sblymn #define SENTINEL_VALUE 0xaac0ffee 878d259104Sblymn 888d259104Sblymn unsigned int sentinel; /* try to catch line overflows */ 898d259104Sblymn #endif 9023464ee5Sblymn #define __ISDIRTY 0x01 /* Line is dirty. */ 9123464ee5Sblymn #define __ISPASTEOL 0x02 /* Cursor is past end of line */ 9269b405aaSblymn #define __ISFORCED 0x04 /* Force update, no optimisation */ 9323464ee5Sblymn unsigned int flags; 9423464ee5Sblymn unsigned int hash; /* Hash value for the line. */ 9523464ee5Sblymn int *firstchp, *lastchp; /* First and last chngd columns ptrs */ 9623464ee5Sblymn int firstch, lastch; /* First and last changed columns. */ 9723464ee5Sblymn __LDATA *line; /* Pointer to the line text. */ 9823464ee5Sblymn }; 9923464ee5Sblymn 10023464ee5Sblymn struct __window { /* Window structure. */ 10123464ee5Sblymn struct __window *nextp, *orig; /* Subwindows list and parent. */ 10223464ee5Sblymn int begy, begx; /* Window home. */ 10323464ee5Sblymn int cury, curx; /* Current x, y coordinates. */ 10423464ee5Sblymn int maxy, maxx; /* Maximum values for curx, cury. */ 105d75ec818Sdsl int reqy, reqx; /* Size requested when created */ 106d75ec818Sdsl int ch_off; /* x offset for firstch/lastch. */ 10743d5eb45Sroy __LINE **alines; /* Array of pointers to the lines */ 10823464ee5Sblymn __LINE *lspace; /* line space (for cleanup) */ 10923464ee5Sblymn __LDATA *wspace; /* window space (for cleanup) */ 11023464ee5Sblymn 11123464ee5Sblymn #define __ENDLINE 0x00000001 /* End of screen. */ 11223464ee5Sblymn #define __FLUSH 0x00000002 /* Fflush(stdout) after refresh. */ 11323464ee5Sblymn #define __FULLWIN 0x00000004 /* Window is a screen. */ 11423464ee5Sblymn #define __IDLINE 0x00000008 /* Insert/delete sequences. */ 11523464ee5Sblymn #define __SCROLLWIN 0x00000010 /* Last char will scroll window. */ 11623464ee5Sblymn #define __SCROLLOK 0x00000020 /* Scrolling ok. */ 11723464ee5Sblymn #define __CLEAROK 0x00000040 /* Clear on next refresh. */ 11823464ee5Sblymn #define __LEAVEOK 0x00000100 /* If cursor left */ 11923464ee5Sblymn #define __KEYPAD 0x00010000 /* If interpreting keypad codes */ 12023464ee5Sblymn #define __NOTIMEOUT 0x00020000 /* Wait indefinitely for func keys */ 1218d259104Sblymn #define __IDCHAR 0x00040000 /* insert/delete char sequences */ 122c18be873Sjdc #define __ISPAD 0x00080000 /* "window" is a pad */ 12374ff043fSblymn #define __ISDERWIN 0x00100000 /* "window" is derived from parent */ 1241369811dSroy #define __IMMEDOK 0x00200000 /* refreshed when changed */ 1251369811dSroy #define __SYNCOK 0x00400000 /* sync when changed */ 126a887f4afSblymn #define __HALFDELAY 0x00800000 /* In half delay mode */ 12723464ee5Sblymn unsigned int flags; 12823464ee5Sblymn int delay; /* delay for getch() */ 12923464ee5Sblymn attr_t wattr; /* Character attributes */ 130836ef17fSjdc wchar_t bch; /* Background character */ 1312d808175Sjdc attr_t battr; /* Background attributes */ 132f1942931Sblymn uint32_t wcols; /* Background column width */ 1333f9388e3Sjdc int scr_t, scr_b; /* Scrolling region top, bottom */ 13487e998f3Sdsl SCREEN *screen; /* Screen for this window */ 135a6a9a97dSjdc int pbegy, pbegx, 136a6a9a97dSjdc sbegy, sbegx, 137a6a9a97dSjdc smaxy, smaxx; /* Saved prefresh() values */ 13874ff043fSblymn int dery, derx; /* derived window coordinates 13974ff043fSblymn - top left corner of source 14074ff043fSblymn relative to parent win */ 141e124de36Sblymn #ifdef HAVE_WCHAR 142e124de36Sblymn nschar_t *bnsp; /* Background non-spacing char list */ 143e124de36Sblymn #endif /* HAVE_WCHAR */ 14459538e7eSchristos FILE *fp; /* for window formatted printf */ 14569f3641eSroy char *buf; /* buffer for window formatted printf */ 14669f3641eSroy size_t buflen; /* length of above buffer */ 14723464ee5Sblymn }; 1482d808175Sjdc 149836ef17fSjdc /* Set of attributes unset by 'me' - 'mb', 'md', 'mh', 'mk', 'mp' and 'mr'. */ 150e124de36Sblymn #ifndef HAVE_WCHAR 151836ef17fSjdc #define __TERMATTR \ 152836ef17fSjdc (__REVERSE | __BLINK | __DIM | __BOLD | __BLANK | __PROTECT) 153e124de36Sblymn #else 154e124de36Sblymn #define __TERMATTR \ 155e124de36Sblymn (__REVERSE | __BLINK | __DIM | __BOLD | __BLANK | __PROTECT \ 156e124de36Sblymn | WA_TOP | WA_LOW | WA_LEFT | WA_RIGHT | WA_HORIZONTAL | WA_VERTICAL) 157e124de36Sblymn #endif /* HAVE_WCHAR */ 158836ef17fSjdc 159d4b4d9edSjdc struct __winlist { 160d4b4d9edSjdc struct __window *winp; /* The window. */ 161d4b4d9edSjdc struct __winlist *nextp; /* Next window. */ 162d4b4d9edSjdc }; 163d4b4d9edSjdc 164c84d91aaSblymn struct __color { 165c84d91aaSblymn short num; 166c84d91aaSblymn short red; 167c84d91aaSblymn short green; 168c84d91aaSblymn short blue; 169c84d91aaSblymn int flags; 170c84d91aaSblymn }; 171c84d91aaSblymn 172c84d91aaSblymn /* List of colour pairs */ 173c84d91aaSblymn struct __pair { 174c84d91aaSblymn short fore; 175c84d91aaSblymn short back; 176c84d91aaSblymn int flags; 177c84d91aaSblymn }; 178c84d91aaSblymn 179c84d91aaSblymn /* Maximum colours */ 1808cf8e1d6Sroy #define MAX_COLORS 256 181c84d91aaSblymn /* Maximum colour pairs - determined by number of colour bits in attr_t */ 1824eb3ef3dSjdc #define MAX_PAIRS PAIR_NUMBER(__COLOR) 183c84d91aaSblymn 184c84d91aaSblymn typedef struct keymap keymap_t; 185c84d91aaSblymn 186a2ac1ce4Sroy /* POSIX allows up to 8 columns in a label. */ 187a2ac1ce4Sroy #define MAX_SLK_COLS 8 188a2ac1ce4Sroy #ifdef HAVE_WCHAR 189a2ac1ce4Sroy #define MAX_SLK_LABEL sizeof(wchar_t) * MAX_SLK_COLS 190a2ac1ce4Sroy #else 191a2ac1ce4Sroy #define MAX_SLK_LABEL MAX_SLK_COLS 192a2ac1ce4Sroy #endif 193a2ac1ce4Sroy struct __slk_label { 194a2ac1ce4Sroy char *text; 195a2ac1ce4Sroy int justify; 196a2ac1ce4Sroy #define SLK_JUSTIFY_LEFT 0 197a2ac1ce4Sroy #define SLK_JUSTIFY_CENTER 1 198a2ac1ce4Sroy #define SLK_JUSTIFY_RIGHT 2 199a2ac1ce4Sroy char label[MAX_SLK_LABEL + 1]; 200a2ac1ce4Sroy int x; 201a2ac1ce4Sroy }; 202c77e1d01Sroy 203c77e1d01Sroy #define MAX_RIPS 5 204c77e1d01Sroy struct __ripoff { 205c77e1d01Sroy int nlines; 206c77e1d01Sroy WINDOW *win; 207c77e1d01Sroy }; 208c77e1d01Sroy 209c84d91aaSblymn /* this is the encapsulation of the terminal definition, one for 210c84d91aaSblymn * each terminal that curses talks to. 211c84d91aaSblymn */ 212c84d91aaSblymn struct __screen { 213c84d91aaSblymn FILE *infd, *outfd; /* input and output file descriptors */ 214c84d91aaSblymn WINDOW *curscr; /* Current screen. */ 215c84d91aaSblymn WINDOW *stdscr; /* Standard screen. */ 216c84d91aaSblymn WINDOW *__virtscr; /* Virtual screen (for doupdate()). */ 217c84d91aaSblymn int curwin; /* current window for refresh */ 218d75ec818Sdsl int lx, ly; /* loop parameters for refresh */ 219c84d91aaSblymn int COLS; /* Columns on the screen. */ 220c84d91aaSblymn int LINES; /* Lines on the screen. */ 221c77e1d01Sroy int nripped; /* Number of ripofflines. */ 222c77e1d01Sroy struct __ripoff ripped[MAX_RIPS]; /* ripofflines. */ 22347cc2fc3Sroy int ESCDELAY; /* Delay between keys in esc seq's. */ 22447cc2fc3Sroy #define ESCDELAY_DEFAULT 300 /* milliseconds. */ 2252e2213efSroy int TABSIZE; /* Size of a tab. */ 22647cc2fc3Sroy #define TABSIZE_DEFAULT 8 /* spaces. */ 227c84d91aaSblymn int COLORS; /* Maximum colors on the screen */ 228c84d91aaSblymn int COLOR_PAIRS; /* Maximum color pairs on the screen */ 229*2be3a5a4Sblymn short curpair; /* current colour pair set on the terminal */ 230c84d91aaSblymn int My_term; /* Use Def_term regardless. */ 231c84d91aaSblymn char GT; /* Gtty indicates tabs. */ 232c84d91aaSblymn char NONL; /* Term can't hack LF doing a CR. */ 233c84d91aaSblymn char UPPERCASE; /* Terminal is uppercase only. */ 234c84d91aaSblymn 235c84d91aaSblymn chtype acs_char[NUM_ACS]; 236e124de36Sblymn #ifdef HAVE_WCHAR 237e124de36Sblymn cchar_t wacs_char[ NUM_ACS ]; 238e124de36Sblymn #endif /* HAVE_WCHAR */ 239c84d91aaSblymn struct __color colours[MAX_COLORS]; 240c84d91aaSblymn struct __pair colour_pairs[MAX_PAIRS]; 241c84d91aaSblymn attr_t nca; 242c84d91aaSblymn 243c84d91aaSblymn /* Style of colour manipulation */ 244c84d91aaSblymn #define COLOR_NONE 0 245c84d91aaSblymn #define COLOR_ANSI 1 /* ANSI/DEC-style colour manipulation */ 246c84d91aaSblymn #define COLOR_HP 2 /* HP-style colour manipulation */ 247c84d91aaSblymn #define COLOR_TEK 3 /* Tektronix-style colour manipulation */ 248c84d91aaSblymn #define COLOR_OTHER 4 /* None of the others but can set fore/back */ 249c84d91aaSblymn int color_type; 250c84d91aaSblymn 251c84d91aaSblymn attr_t mask_op; 252c84d91aaSblymn attr_t mask_me; 253c84d91aaSblymn attr_t mask_ue; 254c84d91aaSblymn attr_t mask_se; 25598eb8895Sroy TERMINAL *term; 256c84d91aaSblymn int old_mode; /* old cursor visibility state for terminal */ 257c84d91aaSblymn keymap_t *base_keymap; 258c84d91aaSblymn int echoit; 259c84d91aaSblymn int pfast; 260c84d91aaSblymn int rawmode; 261e6800497Sjdc int nl; 262c84d91aaSblymn int noqch; 263c84d91aaSblymn int clearok; 264c84d91aaSblymn int useraw; 265c84d91aaSblymn struct __winlist *winlistp; 266c84d91aaSblymn struct termios cbreakt, rawt, *curt, save_termios; 267c84d91aaSblymn struct termios orig_termios, baset, savedtty; 268c84d91aaSblymn int ovmin; 269c84d91aaSblymn int ovtime; 270c84d91aaSblymn char *stdbuf; 271c84d91aaSblymn unsigned int len; 272c84d91aaSblymn int meta_state; 27343d5eb45Sroy char padchar; 274c84d91aaSblymn int endwin; 2752f69e2e1Sitojun int notty; 276140349e8Sjdc int resized; 2777cc6075bSjdc wchar_t *unget_list; 2787cc6075bSjdc int unget_len, unget_pos; 2791c3d3283Sroy int filtered; 280a663bc11Sroy int checkfd; 281a2ac1ce4Sroy 282a2ac1ce4Sroy /* soft label key */ 283a2ac1ce4Sroy bool is_term_slk; 284a2ac1ce4Sroy WINDOW *slk_window; 285a2ac1ce4Sroy int slk_format; 2860a1d3be0Sroy #define SLK_FMT_INVAL -1 287a2ac1ce4Sroy #define SLK_FMT_3_2_3 0 288a2ac1ce4Sroy #define SLK_FMT_4_4 1 289a2ac1ce4Sroy int slk_nlabels; 290a2ac1ce4Sroy int slk_label_len; 291a2ac1ce4Sroy bool slk_hidden; 292a2ac1ce4Sroy struct __slk_label *slk_labels; 293a2ac1ce4Sroy 294f1942931Sblymn #define MAX_CBUF_SIZE 8 295596ba706Schristos #ifdef HAVE_WCHAR 296e124de36Sblymn int cbuf_head; /* header to cbuf */ 297e124de36Sblymn int cbuf_tail; /* tail to cbuf */ 298e124de36Sblymn int cbuf_cur; /* the current char in cbuf */ 299e124de36Sblymn mbstate_t sp; /* wide char processing state */ 300e124de36Sblymn char cbuf[ MAX_CBUF_SIZE ]; /* input character buffer */ 301e124de36Sblymn #endif /* HAVE_WCHAR */ 302c84d91aaSblymn }; 303c84d91aaSblymn 304c84d91aaSblymn 305606508daSjdc extern char __GT; /* Gtty indicates tabs. */ 306606508daSjdc extern char __NONL; /* Term can't hack LF doing a CR. */ 307606508daSjdc extern char __UPPERCASE; /* Terminal is uppercase only. */ 308606508daSjdc extern int My_term; /* Use Def_term regardless. */ 309606508daSjdc extern const char *Def_term; /* Default terminal type. */ 310c84d91aaSblymn extern SCREEN *_cursesi_screen; /* The current screen in use */ 311606508daSjdc 3121f221324Sjdc /* Debugging options/functions. */ 3132d808175Sjdc #ifdef DEBUG 3141f221324Sjdc #define __CTRACE_TSTAMP 0x00000001 3151f221324Sjdc #define __CTRACE_MISC 0x00000002 3161f221324Sjdc #define __CTRACE_INIT 0x00000004 3171f221324Sjdc #define __CTRACE_SCREEN 0x00000008 3181f221324Sjdc #define __CTRACE_WINDOW 0x00000010 3191f221324Sjdc #define __CTRACE_REFRESH 0x00000020 3201f221324Sjdc #define __CTRACE_COLOR 0x00000040 3211f221324Sjdc #define __CTRACE_INPUT 0x00000080 3221f221324Sjdc #define __CTRACE_OUTPUT 0x00000100 3231f221324Sjdc #define __CTRACE_LINE 0x00000200 3241f221324Sjdc #define __CTRACE_ATTR 0x00000400 3251f221324Sjdc #define __CTRACE_ERASE 0x00000800 3264dd5a997Sjdc #define __CTRACE_FILEIO 0x00001000 3271f221324Sjdc #define __CTRACE_ALL 0x7fffffff 3281f221324Sjdc void __CTRACE(int, const char *, ...) __attribute__((__format__(__printf__, 2, 3))); 3290bd3a620Srin #else 3300bd3a620Srin #define __CTRACE(area, fmt, ...) __nothing 3312d808175Sjdc #endif 3321f221324Sjdc 33366ae8b28Sroy /* Common erase logic */ 33466ae8b28Sroy #ifdef HAVE_WCHAR 335878e2e09Suwe #define __NEED_ERASE(_sp, _bch, _battr) \ 336878e2e09Suwe ((_sp)->ch != (_bch) || \ 337a7d2c216Sblymn (((_sp)->cflags & CA_BACKGROUND) != CA_BACKGROUND) || \ 338878e2e09Suwe ((_sp)->attr & WA_ATTRIBUTES) != (_battr) || \ 339878e2e09Suwe (_sp)->nsp != NULL || \ 340f1942931Sblymn (_sp)->wcols < 0) 34166ae8b28Sroy #else 342878e2e09Suwe #define __NEED_ERASE(_sp, _bch, _battr) \ 343878e2e09Suwe ((_sp)->ch != (_bch) || (_sp)->attr != (_battr)) 34466ae8b28Sroy #endif 34566ae8b28Sroy 3461f221324Sjdc /* Private functions. */ 34798eb8895Sroy int __cputchar_args(int, void *); 348240c598fSitojun void _cursesi_free_keymap(keymap_t *); 349240c598fSitojun int _cursesi_gettmode(SCREEN *); 350240c598fSitojun void _cursesi_reset_acs(SCREEN *); 35169b405aaSblymn int _cursesi_addbyte(WINDOW *, __LINE **, int *, int *, int , attr_t, int); 35269b405aaSblymn int _cursesi_addwchar(WINDOW *, __LINE **, int *, int *, const cchar_t *, 35369b405aaSblymn int); 35469b405aaSblymn int _cursesi_waddbytes(WINDOW *, const char *, int, attr_t, int); 355e124de36Sblymn #ifdef HAVE_WCHAR 356e124de36Sblymn void _cursesi_reset_wacs(SCREEN *); 357e124de36Sblymn #endif /* HAVE_WCHAR */ 358240c598fSitojun void _cursesi_resetterm(SCREEN *); 359a9c500b2Suwe int _cursesi_setterm(const char *, SCREEN *); 360aaf74682Sblymn int __delay(void); 361846cb8f3Sroy unsigned int __hash_more(const void *, size_t, unsigned int); 36243ea4784Srin unsigned int __hash_line(const __LDATA *, int); 363240c598fSitojun #define __hash(s, len) __hash_more((s), (len), 0u) 364240c598fSitojun void __id_subwins(WINDOW *); 365240c598fSitojun void __init_getch(SCREEN *); 366240c598fSitojun void __init_acs(SCREEN *); 36788123910Sblymn int _cursesi_celleq(__LDATA *, __LDATA *); 368e124de36Sblymn #ifdef HAVE_WCHAR 369e124de36Sblymn void __init_get_wch(SCREEN *); 370e124de36Sblymn void __init_wacs(SCREEN *); 37198eb8895Sroy int __cputwchar_args( wchar_t, void * ); 37288123910Sblymn void _cursesi_copy_wchar(__LDATA *, __LDATA *); 373e124de36Sblymn int _cursesi_copy_nsp(nschar_t *, struct __ldata *); 374e124de36Sblymn void __cursesi_free_nsp(nschar_t *); 375e124de36Sblymn void __cursesi_win_free_nsp(WINDOW *); 376e124de36Sblymn void __cursesi_putnsp(nschar_t *, const int, const int); 377452834f2Sdrochner void __cursesi_chtype_to_cchar(chtype, cchar_t *); 378e124de36Sblymn #endif /* HAVE_WCHAR */ 37921a2638fSroy int __fgetc_resize(FILE *); 3807cc6075bSjdc int __unget(wint_t); 381240c598fSitojun int __mvcur(int, int, int, int, int); 382d34c5681Sroy WINDOW *__newwin(SCREEN *, int, int, int, int, int, int); 383aaf74682Sblymn int __nodelay(void); 384aaf74682Sblymn int __notimeout(void); 385aaf74682Sblymn void __restartwin(void); 386aaf74682Sblymn void __restore_colors(void); 38766cab71cSblymn void __restore_cursor_vis(void); 38866cab71cSblymn void __restore_meta_state(void); 389aaf74682Sblymn void __restore_termios(void); 390aaf74682Sblymn void __restore_stophandler(void); 391140349e8Sjdc void __restore_winchhandler(void); 392d34c5681Sroy int __ripoffscreen(SCREEN *); 393dd838550Sroy int __ripoffresize(SCREEN *); 394d34c5681Sroy void __ripofftouch(SCREEN *); 395d34c5681Sroy int __rippedlines(const SCREEN *, int); 396aaf74682Sblymn void __save_termios(void); 3974eb3ef3dSjdc void __set_color(WINDOW *win, attr_t attr); 398aaf74682Sblymn void __set_stophandler(void); 399140349e8Sjdc void __set_winchhandler(void); 400240c598fSitojun void __set_subwin(WINDOW *, WINDOW *); 401a2ac1ce4Sroy int __slk_init(SCREEN *); 402a2ac1ce4Sroy void __slk_free(SCREEN *); 403a2ac1ce4Sroy int __slk_resize(SCREEN *, int cols); 404a2ac1ce4Sroy int __slk_noutrefresh(SCREEN *); 405240c598fSitojun void __startwin(SCREEN *); 406240c598fSitojun void __stop_signal_handler(int); 407aaf74682Sblymn int __stopwin(void); 408240c598fSitojun void __swflags(WINDOW *); 4091369811dSroy void __sync(WINDOW *); 410240c598fSitojun int __timeout(int); 411240c598fSitojun int __touchline(WINDOW *, int, int, int); 412301bf8ccSblymn int __touchwin(WINDOW *, int); 413a2ac1ce4Sroy int __unripoffline(int (*)(WINDOW *, int)); 4143f832f52Sjdc void __unsetattr(int); 4154eb3ef3dSjdc void __unset_color(WINDOW *win); 416240c598fSitojun int __waddch(WINDOW *, __LDATA *); 417e0083771Sjdc int __wgetnstr(WINDOW *, char *, int); 418140349e8Sjdc void __winch_signal_handler(int); 4192d808175Sjdc 4202d808175Sjdc /* Private #defines. */ 421240c598fSitojun #define min(a,b) ((a) < (b) ? (a) : (b)) 422240c598fSitojun #define max(a,b) ((a) > (b) ? (a ): (b)) 4232d808175Sjdc 4242d808175Sjdc /* Private externs. */ 4252d808175Sjdc extern int __echoit; 4262d808175Sjdc extern int __endwin; 4272d808175Sjdc extern int __pfast; 4282d808175Sjdc extern int __rawmode; 4292d808175Sjdc extern int __noqch; 430606508daSjdc extern attr_t __mask_op, __mask_me, __mask_ue, __mask_se; 4313f832f52Sjdc extern WINDOW *__virtscr; 4324eb3ef3dSjdc extern int __using_color; 433f1942931Sblymn extern int __do_color_init; 4344eb3ef3dSjdc extern attr_t __default_color; 435