]> ncurses.scripts.mit.edu Git - ncurses.git/blob - ncurses/curses.priv.h
ncurses 5.4
[ncurses.git] / ncurses / curses.priv.h
1 /****************************************************************************
2  * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc.              *
3  *                                                                          *
4  * Permission is hereby granted, free of charge, to any person obtaining a  *
5  * copy of this software and associated documentation files (the            *
6  * "Software"), to deal in the Software without restriction, including      *
7  * without limitation the rights to use, copy, modify, merge, publish,      *
8  * distribute, distribute with modifications, sublicense, and/or sell       *
9  * copies of the Software, and to permit persons to whom the Software is    *
10  * furnished to do so, subject to the following conditions:                 *
11  *                                                                          *
12  * The above copyright notice and this permission notice shall be included  *
13  * in all copies or substantial portions of the Software.                   *
14  *                                                                          *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
16  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
17  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
18  * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
19  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
20  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
21  * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
22  *                                                                          *
23  * Except as contained in this notice, the name(s) of the above copyright   *
24  * holders shall not be used in advertising or otherwise to promote the     *
25  * sale, use or other dealings in this Software without prior written       *
26  * authorization.                                                           *
27  ****************************************************************************/
28
29 /****************************************************************************
30  *  Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995               *
31  *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
32  *     and: Thomas E. Dickey 1996-2002                                      *
33  ****************************************************************************/
34
35
36 /*
37  * $Id: curses.priv.h,v 1.255 2004/02/01 01:05:58 Stanislav.Ievlev Exp $
38  *
39  *      curses.priv.h
40  *
41  *      Header file for curses library objects which are private to
42  *      the library.
43  *
44  */
45
46 #ifndef CURSES_PRIV_H
47 #define CURSES_PRIV_H 1
48
49 #include <ncurses_dll.h>
50
51 #ifdef __cplusplus
52 extern "C" {
53 #endif
54
55 #include <ncurses_cfg.h>
56
57 #if USE_RCS_IDS
58 #define MODULE_ID(id) static const char Ident[] = id;
59 #else
60 #define MODULE_ID(id) /*nothing*/
61 #endif
62
63 #include <stdlib.h>
64 #include <string.h>
65 #include <sys/types.h>
66
67 #if HAVE_UNISTD_H
68 #include <unistd.h>
69 #endif
70
71 #if HAVE_SYS_BSDTYPES_H
72 #include <sys/bsdtypes.h>       /* needed for ISC */
73 #endif
74
75 #if HAVE_LIMITS_H
76 # include <limits.h>
77 #elif HAVE_SYS_PARAM_H
78 # include <sys/param.h>
79 #endif
80
81 #ifndef PATH_MAX
82 # if defined(_POSIX_PATH_MAX)
83 #  define PATH_MAX _POSIX_PATH_MAX
84 # elif defined(MAXPATHLEN)
85 #  define PATH_MAX MAXPATHLEN
86 # else
87 #  define PATH_MAX 255  /* the Posix minimum path-size */
88 # endif
89 #endif
90
91 #include <assert.h>
92 #include <stdio.h>
93
94 #include <errno.h>
95
96 #if DECL_ERRNO
97 extern int errno;
98 #endif
99
100 #include <nc_panel.h>
101
102 /* Some systems have a broken 'select()', but workable 'poll()'.  Use that */
103 #if HAVE_WORKING_POLL
104 #define USE_FUNC_POLL 1
105 #if HAVE_POLL_H
106 #include <poll.h>
107 #else
108 #include <sys/poll.h>
109 #endif
110 #else
111 #define USE_FUNC_POLL 0
112 #endif
113
114 /* include signal.h before curses.h to work-around defect in glibc 2.1.3 */
115 #include <signal.h>
116
117 /* Alessandro Rubini's GPM (general-purpose mouse) */
118 #if HAVE_LIBGPM && HAVE_GPM_H
119 #define USE_GPM_SUPPORT 1
120 #else
121 #define USE_GPM_SUPPORT 0
122 #endif
123
124 /* QNX mouse support */
125 #if defined(__QNX__) && !defined(__QNXNTO__)
126 #define USE_QNX_MOUSE 1
127 #else
128 #define USE_QNX_MOUSE 0
129 #endif
130
131 /* EMX mouse support */
132 #ifdef __EMX__
133 #define USE_EMX_MOUSE 1
134 #else
135 #define USE_EMX_MOUSE 0
136 #endif
137
138 #define DEFAULT_MAXCLICK 166
139 #define EV_MAX          8       /* size of mouse circular event queue */
140
141 /*
142  * If we don't have signals to support it, don't add a sigwinch handler.
143  * In any case, resizing is an extended feature.  Use it if we've got it.
144  */
145 #if !NCURSES_EXT_FUNCS
146 #undef HAVE_SIZECHANGE
147 #define HAVE_SIZECHANGE 0
148 #endif
149
150 #if HAVE_SIZECHANGE && defined(SIGWINCH)
151 #define USE_SIZECHANGE 1
152 #else
153 #define USE_SIZECHANGE 0
154 #undef USE_SIGWINCH
155 #define USE_SIGWINCH 0
156 #endif
157
158 /*
159  * If desired, one can configure this, disabling environment variables that
160  * point to custom terminfo/termcap locations.
161  */
162 #ifdef USE_ROOT_ENVIRON
163 #define use_terminfo_vars() 1
164 #else
165 #define use_terminfo_vars() _nc_env_access()
166 extern NCURSES_EXPORT(int) _nc_env_access (void);
167 #endif
168
169 /*
170  * Not all platforms have memmove; some have an equivalent bcopy.  (Some may
171  * have neither).
172  */
173 #if USE_OK_BCOPY
174 #define memmove(d,s,n) bcopy(s,d,n)
175 #elif USE_MY_MEMMOVE
176 #define memmove(d,s,n) _nc_memmove(d,s,n)
177 extern NCURSES_EXPORT(void *) _nc_memmove (void *, const void *, size_t);
178 #endif
179
180 /*
181  * Scroll hints are useless when hashmap is used
182  */
183 #if !USE_SCROLL_HINTS
184 #if !USE_HASHMAP
185 #define USE_SCROLL_HINTS 1
186 #else
187 #define USE_SCROLL_HINTS 0
188 #endif
189 #endif
190
191 #if USE_SCROLL_HINTS
192 #define if_USE_SCROLL_HINTS(stmt) stmt
193 #else
194 #define if_USE_SCROLL_HINTS(stmt) /*nothing*/
195 #endif
196
197 /*
198  * Note:  ht/cbt expansion flakes out randomly under Linux 1.1.47, but only
199  * when we're throwing control codes at the screen at high volume.  To see
200  * this, re-enable USE_HARD_TABS and run worm for a while.  Other systems
201  * probably don't want to define this either due to uncertainties about tab
202  * delays and expansion in raw mode.
203  */
204
205 struct tries {
206         struct tries    *child;     /* ptr to child.  NULL if none          */
207         struct tries    *sibling;   /* ptr to sibling.  NULL if none        */
208         unsigned char    ch;        /* character at this node               */
209         unsigned short   value;     /* code of string so far.  0 if none.   */
210 };
211
212 /*
213  * Definitions for color pairs
214  */
215 #define C_SHIFT 8               /* we need more bits than there are colors */
216 #define C_MASK  ((1 << C_SHIFT) - 1)
217
218 #define PAIR_OF(fg, bg) ((((fg) & C_MASK) << C_SHIFT) | ((bg) & C_MASK))
219
220 /*
221  * Common/troublesome character definitions
222  */
223 #define L_BRACE '{'
224 #define R_BRACE '}'
225 #define S_QUOTE '\''
226 #define D_QUOTE '"'
227
228 #define VT_ACSC "``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~"
229
230 /*
231  * Structure for palette tables
232  */
233
234 typedef struct
235 {
236     short red, green, blue;     /* what color_content() returns */
237     short r, g, b;              /* params to init_color() */
238     int init;                   /* true if we called init_color() */
239 }
240 color_t;
241
242 #define MAXCOLUMNS    135
243 #define MAXLINES      66
244 #define FIFO_SIZE     MAXCOLUMNS+2  /* for nocbreak mode input */
245
246 #define ACS_LEN       128
247
248 #define WINDOWLIST struct _win_list
249
250 #if USE_WIDEC_SUPPORT
251 #define _nc_bkgd    _bkgrnd
252 #else
253 #undef _XOPEN_SOURCE_EXTENDED
254 #define _nc_bkgd    _bkgd
255 #define wgetbkgrnd(win, wch)    *wch = win->_bkgd
256 #define wbkgrnd     wbkgd
257 #endif
258
259 #include <curses.h>     /* we'll use -Ipath directive to get the right one! */
260 #include <term.h>
261
262 struct ldat
263 {
264         NCURSES_CH_T    *text;          /* text of the line */
265         NCURSES_SIZE_T  firstchar;      /* first changed character in the line */
266         NCURSES_SIZE_T  lastchar;       /* last changed character in the line */
267         NCURSES_SIZE_T  oldindex;       /* index of the line at last update */
268 };
269
270 typedef enum {
271         M_XTERM = -1            /* use xterm's mouse tracking? */
272         ,M_NONE = 0             /* no mouse device */
273 #if USE_GPM_SUPPORT
274         ,M_GPM                  /* use GPM */
275 #endif
276 #if USE_SYSMOUSE
277         ,M_SYSMOUSE             /* FreeBSD sysmouse on console */
278 #endif
279 } MouseType;
280
281 /*
282  * Structure for soft labels.
283  */
284
285 typedef struct
286 {
287         char *ent_text;         /* text for the label */
288         char *form_text;        /* formatted text (left/center/...) */
289         int ent_x;              /* x coordinate of this field */
290         char dirty;             /* this label has changed */
291         char visible;           /* field is visible */
292 } slk_ent;
293
294 typedef struct {
295         char dirty;             /* all labels have changed */
296         char hidden;            /* soft labels are hidden */
297         WINDOW *win;
298         slk_ent *ent;
299         short  maxlab;          /* number of available labels */
300         short  labcnt;          /* number of allocated labels */
301         short  maxlen;          /* length of labels */
302         chtype attr;            /* soft label attribute */
303 } SLK;
304
305 typedef struct {
306         unsigned long hashval;
307         int oldcount, newcount;
308         int oldindex, newindex;
309 } HASHMAP;
310
311 typedef struct {
312         int     line;           /* lines to take, < 0 => from bottom*/
313         int     (*hook)(WINDOW *, int); /* callback for user        */
314         WINDOW *w;              /* maybe we need this for cleanup   */
315 } ripoff_t;
316
317 struct screen {
318         int             _ifd;           /* input file ptr for screen        */
319         FILE            *_ofp;          /* output file ptr for screen       */
320         char            *_setbuf;       /* buffered I/O for output          */
321         int             _buffered;      /* setvbuf uses _setbuf data        */
322         int             _checkfd;       /* filedesc for typeahead check     */
323         TERMINAL        *_term;         /* terminal type information        */
324         short           _lines;         /* screen lines                     */
325         short           _columns;       /* screen columns                   */
326
327         short           _lines_avail;   /* lines available for stdscr       */
328         short           _topstolen;     /* lines stolen from top            */
329         ripoff_t        _rippedoff[5];  /* list of lines stolen             */
330         int             _rip_count;     /* ...and total lines stolen        */
331
332         WINDOW          *_curscr;       /* current screen                   */
333         WINDOW          *_newscr;       /* virtual screen to be updated to  */
334         WINDOW          *_stdscr;       /* screen's full-window context     */
335
336         struct tries    *_keytry;       /* "Try" for use with keypad mode   */
337         struct tries    *_key_ok;       /* Disabled keys via keyok(,FALSE)  */
338         bool            _tried;         /* keypad mode was initialized      */
339         bool            _keypad_on;     /* keypad mode is currently on      */
340
341         bool            _called_wgetch; /* check for recursion in wgetch()  */
342         int             _fifo[FIFO_SIZE];       /* input push-back buffer   */
343         short           _fifohead,      /* head of fifo queue               */
344                         _fifotail,      /* tail of fifo queue               */
345                         _fifopeek,      /* where to peek for next char      */
346                         _fifohold;      /* set if breakout marked           */
347
348         int             _endwin;        /* are we out of window mode?       */
349         attr_t          _current_attr;  /* terminal attribute current set   */
350         int             _coloron;       /* is color enabled?                */
351         int             _color_defs;    /* are colors modified              */
352         int             _cursor;        /* visibility of the cursor         */
353         int             _cursrow;       /* physical cursor row              */
354         int             _curscol;       /* physical cursor column           */
355         bool            _notty;         /* true if we cannot switch non-tty */
356         int             _nl;            /* True if NL -> CR/NL is on        */
357         int             _raw;           /* True if in raw mode              */
358         int             _cbreak;        /* 1 if in cbreak mode              */
359                                         /* > 1 if in halfdelay mode         */
360         int             _echo;          /* True if echo on                  */
361         int             _use_meta;      /* use the meta key?                */
362         SLK             *_slk;          /* ptr to soft key struct / NULL    */
363         int             slk_format;     /* selected format for this screen  */
364         /* cursor movement costs; units are 10ths of milliseconds */
365 #if NCURSES_NO_PADDING
366         int             _no_padding;    /* flag to set if padding disabled  */
367 #endif
368         int             _char_padding;  /* cost of character put            */
369         int             _cr_cost;       /* cost of (carriage_return)        */
370         int             _cup_cost;      /* cost of (cursor_address)         */
371         int             _home_cost;     /* cost of (cursor_home)            */
372         int             _ll_cost;       /* cost of (cursor_to_ll)           */
373 #if USE_HARD_TABS
374         int             _ht_cost;       /* cost of (tab)                    */
375         int             _cbt_cost;      /* cost of (backtab)                */
376 #endif /* USE_HARD_TABS */
377         int             _cub1_cost;     /* cost of (cursor_left)            */
378         int             _cuf1_cost;     /* cost of (cursor_right)           */
379         int             _cud1_cost;     /* cost of (cursor_down)            */
380         int             _cuu1_cost;     /* cost of (cursor_up)              */
381         int             _cub_cost;      /* cost of (parm_cursor_left)       */
382         int             _cuf_cost;      /* cost of (parm_cursor_right)      */
383         int             _cud_cost;      /* cost of (parm_cursor_down)       */
384         int             _cuu_cost;      /* cost of (parm_cursor_up)         */
385         int             _hpa_cost;      /* cost of (column_address)         */
386         int             _vpa_cost;      /* cost of (row_address)            */
387         /* used in tty_update.c, must be chars */
388         int             _ed_cost;       /* cost of (clr_eos)                */
389         int             _el_cost;       /* cost of (clr_eol)                */
390         int             _el1_cost;      /* cost of (clr_bol)                */
391         int             _dch1_cost;     /* cost of (delete_character)       */
392         int             _ich1_cost;     /* cost of (insert_character)       */
393         int             _dch_cost;      /* cost of (parm_dch)               */
394         int             _ich_cost;      /* cost of (parm_ich)               */
395         int             _ech_cost;      /* cost of (erase_chars)            */
396         int             _rep_cost;      /* cost of (repeat_char)            */
397         int             _hpa_ch_cost;   /* cost of (column_address)         */
398         int             _cup_ch_cost;   /* cost of (cursor_address)         */
399         int             _cuf_ch_cost;   /* cost of (parm_cursor_right)      */
400         int             _inline_cost;   /* cost of inline-move              */
401         int             _smir_cost;     /* cost of (enter_insert_mode)      */
402         int             _rmir_cost;     /* cost of (exit_insert_mode)       */
403         int             _ip_cost;       /* cost of (insert_padding)         */
404         /* used in lib_mvcur.c */
405         char *          _address_cursor;
406         /* used in tty_update.c */
407         int             _scrolling;     /* 1 if terminal's smart enough to  */
408
409         /* used in lib_color.c */
410         color_t         *_color_table;  /* screen's color palette            */
411         int             _color_count;   /* count of colors in palette        */
412         unsigned short  *_color_pairs;  /* screen's color pair list          */
413         int             _pair_count;    /* count of color pairs              */
414 #if NCURSES_EXT_FUNCS
415         bool            _default_color; /* use default colors                */
416         bool            _has_sgr_39_49; /* has ECMA default color support    */
417         int             _default_fg;    /* assumed default foreground        */
418         int             _default_bg;    /* assumed default background        */
419 #endif
420         chtype          _xmc_suppress;  /* attributes to suppress if xmc     */
421         chtype          _xmc_triggers;  /* attributes to process if xmc      */
422         chtype          _acs_map[ACS_LEN]; /* the real alternate-charset map */
423
424         /* used in lib_vidattr.c */
425         bool            _use_rmso;      /* true if we may use 'rmso'         */
426         bool            _use_rmul;      /* true if we may use 'rmul'         */
427
428         /*
429          * These data correspond to the state of the idcok() and idlok()
430          * functions.  A caveat is in order here:  the XSI and SVr4
431          * documentation specify that these functions apply to the window which
432          * is given as an argument.  However, ncurses implements this logic
433          * only for the newscr/curscr update process, _not_ per-window.
434          */
435         bool            _nc_sp_idlok;
436         bool            _nc_sp_idcok;
437 #define _nc_idlok SP->_nc_sp_idlok
438 #define _nc_idcok SP->_nc_sp_idcok
439
440         /*
441          * These are the data that support the mouse interface.
442          */
443         MouseType       _mouse_type;
444         int             _maxclick;
445         bool            (*_mouse_event) (SCREEN *);
446         bool            (*_mouse_inline)(SCREEN *);
447         bool            (*_mouse_parse) (int);
448         void            (*_mouse_resume)(SCREEN *);
449         void            (*_mouse_wrap)  (SCREEN *);
450         int             _mouse_fd;      /* file-descriptor, if any */
451         NCURSES_CONST char *_mouse_xtermcap; /* string to enable/disable mouse */
452 #if USE_SYSMOUSE
453         MEVENT          _sysmouse_fifo[FIFO_SIZE];
454         int             _sysmouse_head;
455         int             _sysmouse_tail;
456         int             _sysmouse_char_width;   /* character width */
457         int             _sysmouse_char_height;  /* character height */
458         int             _sysmouse_old_buttons;
459         int             _sysmouse_new_buttons;
460 #endif
461
462         /*
463          * This supports automatic resizing
464          */
465 #if USE_SIZECHANGE
466         int             (*_resize)(int,int);
467 #endif
468
469         /*
470          * These are data that support the proper handling of the panel stack on an
471          * per screen basis.
472          */
473         struct panelhook _panelHook;
474         /*
475          * Linked-list of all windows, to support '_nc_resizeall()' and
476          * '_nc_freeall()'
477          */
478         WINDOWLIST      *_nc_sp_windows;
479 #define _nc_windows SP->_nc_sp_windows
480
481         bool            _sig_winch;
482         SCREEN          *_next_screen;
483
484         /* hashes for old and new lines */
485         unsigned long   *oldhash, *newhash;
486         HASHMAP         *hashtab;
487         int             hashtab_len;
488
489         bool            _cleanup;       /* cleanup after int/quit signal */
490         int             (*_outch)(int); /* output handler if not putc */
491
492         /* recent versions of 'screen' have partially-working support for
493          * UTF-8, but do not permit ACS at the same time (see tty_update.c).
494          */
495 #if USE_WIDEC_SUPPORT
496         bool            _posix_locale;
497         bool            _screen_acs_fix;
498 #endif
499 };
500
501 extern NCURSES_EXPORT_VAR(SCREEN *) _nc_screen_chain;
502
503 #if NCURSES_NOMACROS
504 #include <nomacros.h>
505 #endif
506
507         WINDOWLIST {
508         WINDOW  win;    /* first, so WINDOW_EXT() works */
509         WINDOWLIST *next;
510 #ifdef _XOPEN_SOURCE_EXTENDED
511         char addch_work[(MB_LEN_MAX * 9) + 1];
512         int addch_used;
513         int addch_x;
514         int addch_y;
515 #endif
516 };
517
518 #define WINDOW_EXT(win,field) (((WINDOWLIST *)(win))->field)
519
520 /* The terminfo source is assumed to be 7-bit ASCII */
521 #define is7bits(c)      ((unsigned)(c) < 128)
522
523 #ifndef min
524 #define min(a,b)        ((a) > (b)  ?  (b)  :  (a))
525 #endif
526
527 #ifndef max
528 #define max(a,b)        ((a) < (b)  ?  (b)  :  (a))
529 #endif
530
531 /* usually in <unistd.h> */
532 #ifndef STDIN_FILENO
533 #define STDIN_FILENO 0
534 #endif
535
536 #ifndef STDOUT_FILENO
537 #define STDOUT_FILENO 1
538 #endif
539
540 #ifndef STDERR_FILENO
541 #define STDERR_FILENO 2
542 #endif
543
544 #ifndef EXIT_SUCCESS
545 #define EXIT_SUCCESS 0
546 #endif
547
548 #ifndef EXIT_FAILURE
549 #define EXIT_FAILURE 1
550 #endif
551
552 #ifndef R_OK
553 #define R_OK    4               /* Test for read permission.  */
554 #endif
555 #ifndef W_OK
556 #define W_OK    2               /* Test for write permission.  */
557 #endif
558 #ifndef X_OK
559 #define X_OK    1               /* Test for execute permission.  */
560 #endif
561 #ifndef F_OK
562 #define F_OK    0               /* Test for existence.  */
563 #endif
564
565 #if HAVE_FCNTL_H
566 #include <fcntl.h>              /* may define O_BINARY  */
567 #endif
568
569 #ifndef O_BINARY
570 #define O_BINARY 0
571 #endif
572
573 #ifdef TRACE
574 #define TRACE_OUTCHARS(n) _nc_outchars += (n);
575 #else
576 #define TRACE_OUTCHARS(n) /* nothing */
577 #endif
578
579 #define UChar(c)        ((unsigned char)(c))
580 #define ChCharOf(c)     ((c) & (chtype)A_CHARTEXT)
581 #define ChAttrOf(c)     ((c) & (chtype)A_ATTRIBUTES)
582
583 #ifndef MB_LEN_MAX
584 #define MB_LEN_MAX 8 /* should be >= MB_CUR_MAX, but that may be a function */
585 #endif
586
587 #if USE_WIDEC_SUPPORT /* { */
588 #define NulChar         0,0,0,0 /* FIXME: see CCHARW_MAX */
589 #define CharOf(c)       ((c).chars[0])
590 #define AttrOf(c)       ((c).attr)
591 #define AddAttr(c,a)    (c).attr |= a
592 #define RemAttr(c,a)    (c).attr &= ~(a)
593 #define SetAttr(c,a)    (c).attr = a
594 #define NewChar(ch)     { ChAttrOf(ch), { ChCharOf(ch), NulChar } }
595 #define NewChar2(c,a)   { a, { c, NulChar } }
596 #define CharEq(a,b)     (!memcmp(&a, &b, sizeof(a)))
597 #define SetChar(ch,c,a) do {                                                        \
598                             NCURSES_CH_T *_cp = &ch;                                \
599                             memset(_cp,0,sizeof(ch)); _cp->chars[0] = c; _cp->attr = a; \
600                         } while (0)
601 #define CHREF(wch)      (&wch)
602 #define CHDEREF(wch)    (*wch)
603 #define ARG_CH_T        NCURSES_CH_T *
604 #define CARG_CH_T       const NCURSES_CH_T *
605 #define PUTC_DATA       char PUTC_buf[MB_LEN_MAX]; int PUTC_i, PUTC_n; \
606                         mbstate_t PUT_st; wchar_t PUTC_ch
607 #define PUTC_INIT       memset (&PUT_st, '\0', sizeof (PUT_st));                    \
608                         PUTC_i = 0
609 #define PUTC(ch,b)      do { if(!isnac(ch)) {                                       \
610                         if (Charable(ch)) {                                         \
611                             fputc(CharOf(ch), b);                                   \
612                             TRACE_OUTCHARS(1);                                      \
613                         } else {                                                    \
614                             PUTC_INIT;                                              \
615                             do {                                                    \
616                                 PUTC_ch = PUTC_i < CCHARW_MAX ?                     \
617                                             (ch).chars[PUTC_i] : L'\0';             \
618                                 PUTC_n = wcrtomb(PUTC_buf,                          \
619                                                  (ch).chars[PUTC_i], &PUT_st);      \
620                                 if (PUTC_ch == L'\0')                               \
621                                     --PUTC_n;                                       \
622                                 if (PUTC_n <= 0)                                    \
623                                     break;                                          \
624                                 fwrite(PUTC_buf, (unsigned) PUTC_n, 1, b);          \
625                                 ++PUTC_i;                                           \
626                             } while (PUTC_ch != L'\0');                             \
627                             TRACE_OUTCHARS(PUTC_i);                                 \
628                         } } } while (0)
629
630 #define BLANK           { WA_NORMAL, ' ' }
631 #define ISBLANK(ch)     ((ch).chars[0] == L' ' && (ch).chars[1] == L'\0')
632
633 #define WA_NAC          1
634 #define isnac(ch)       (AttrOf(ch) & WA_NAC)
635 #define if_WIDEC(code)  code
636 #define Charable(ch)    ((SP != 0 && SP->_posix_locale)                 \
637                          || (!isnac(ch) &&                              \
638                              (ch).chars[1] == L'\0' &&                  \
639                              _nc_is_charable(CharOf(ch))))
640
641 #define L(ch)           L ## ch
642 #else /* }{ */
643 #define CharOf(c)       ChCharOf(c)
644 #define AttrOf(c)       ChAttrOf(c)
645 #define AddAttr(c,a)    c |= a
646 #define RemAttr(c,a)    c &= ~(a & A_ATTRIBUTES)
647 #define SetAttr(c,a)    c = (c & ~A_ATTRIBUTES) | a
648 #define NewChar(ch)     (ch)
649 #define NewChar2(c,a)   (c | a)
650 #define CharEq(a,b)     (a == b)
651 #define SetChar(ch,c,a) ch = c | a
652 #define CHREF(wch)      wch
653 #define CHDEREF(wch)    wch
654 #define ARG_CH_T        NCURSES_CH_T
655 #define CARG_CH_T       NCURSES_CH_T
656 #define PUTC_DATA       int data = 0
657 #define PUTC(a,b)       do { data = CharOf(ch); putc(data,b); } while (0)
658
659 #define BLANK           (' '|A_NORMAL)
660 #define ISBLANK(ch)     (CharOf(ch) == ' ')
661
662 #define isnac(ch)       (0)
663 #define if_WIDEC(code) /* nothing */
664
665 #define L(ch)           ch
666 #endif /* } */
667
668 #define AttrOfD(ch)     AttrOf(CHDEREF(ch))
669 #define CharOfD(ch)     CharOf(CHDEREF(ch))
670 #define SetChar2(wch,ch)    SetChar(wch,ChCharOf(ch),ChAttrOf(ch))
671
672 #define BLANK_ATTR      A_NORMAL
673 #define BLANK_TEXT      L(' ')
674
675 #define CHANGED     -1
676
677 #define CHANGED_CELL(line,col) \
678         if (line->firstchar == _NOCHANGE) \
679                 line->firstchar = line->lastchar = col; \
680         else if ((col) < line->firstchar) \
681                 line->firstchar = col; \
682         else if ((col) > line->lastchar) \
683                 line->lastchar = col
684
685 #define CHANGED_RANGE(line,start,end) \
686         if (line->firstchar == _NOCHANGE \
687          || line->firstchar > (start)) \
688                 line->firstchar = start; \
689         if (line->lastchar == _NOCHANGE \
690          || line->lastchar < (end)) \
691                 line->lastchar = end
692
693 #define CHANGED_TO_EOL(line,start,end) \
694         if (line->firstchar == _NOCHANGE \
695          || line->firstchar > (start)) \
696                 line->firstchar = start; \
697         line->lastchar = end
698
699 #define SIZEOF(v) (sizeof(v)/sizeof(v[0]))
700
701 #define FreeIfNeeded(p)  if ((p) != 0) free(p)
702
703 /* FreeAndNull() is not a comma-separated expression because some compilers
704  * do not accept a mixture of void with values.
705  */
706 #define FreeAndNull(p)   free(p); p = 0
707
708 #include <nc_alloc.h>
709
710 /*
711  * Prefixes for call/return points of library function traces.  We use these to
712  * instrument the public functions so that the traces can be easily transformed
713  * into regression scripts.
714  */
715 #define T_CALLED(fmt) "called {" fmt
716 #define T_CREATE(fmt) "create :" fmt
717 #define T_RETURN(fmt) "return }" fmt
718
719 #ifdef TRACE
720
721 #define START_TRACE() \
722         if ((_nc_tracing & TRACE_MAXIMUM) == 0) { \
723             int t = _nc_getenv_num("NCURSES_TRACE"); \
724             if (t >= 0) \
725                 trace((unsigned) t); \
726         }
727
728 #define TR(n, a)        if (_nc_tracing & (n)) _tracef a
729 #define T(a)            TR(TRACE_CALLS, a)
730 #define TPUTS_TRACE(s)  _nc_tputs_trace = s;
731 #define TRACE_RETURN(value,type) return _nc_retrace_##type(value)
732
733 #define returnAttr(code) TRACE_RETURN(code,attr_t)
734 #define returnChar(code) TRACE_RETURN(code,chtype)
735 #define returnBool(code) TRACE_RETURN(code,bool)
736 #define returnBits(code) TRACE_RETURN(code,unsigned)
737 #define returnCode(code) TRACE_RETURN(code,int)
738 #define returnPtr(code)  TRACE_RETURN(code,ptr)
739 #define returnSP(code)   TRACE_RETURN(code,sp)
740 #define returnVoid       T((T_RETURN(""))); return
741 #define returnWin(code)  TRACE_RETURN(code,win)
742
743 extern NCURSES_EXPORT(NCURSES_BOOL)     _nc_retrace_bool (NCURSES_BOOL);
744 extern NCURSES_EXPORT(SCREEN *)         _nc_retrace_sp (SCREEN *);
745 extern NCURSES_EXPORT(WINDOW *)         _nc_retrace_win (WINDOW *);
746 extern NCURSES_EXPORT(attr_t)           _nc_retrace_attr_t (attr_t);
747 extern NCURSES_EXPORT(char *)           _nc_retrace_ptr (char *);
748 extern NCURSES_EXPORT(char *)           _nc_trace_ttymode(TTY *tty);
749 extern NCURSES_EXPORT(char *)           _nc_varargs (const char *, va_list);
750 extern NCURSES_EXPORT(chtype)           _nc_retrace_chtype (chtype);
751 extern NCURSES_EXPORT(const char *)     _nc_altcharset_name(attr_t, chtype);
752 extern NCURSES_EXPORT(int)              _nc_retrace_int (int);
753 extern NCURSES_EXPORT(unsigned)         _nc_retrace_unsigned (unsigned);
754 extern NCURSES_EXPORT(void)             _nc_fifo_dump (void);
755 extern NCURSES_EXPORT_VAR(const char *) _nc_tputs_trace;
756 extern NCURSES_EXPORT_VAR(long)         _nc_outchars;
757 extern NCURSES_EXPORT_VAR(unsigned)     _nc_tracing;
758
759 #if USE_WIDEC_SUPPORT
760 extern NCURSES_EXPORT(const char *) _nc_viswbuf2 (int, const wchar_t *);
761 extern NCURSES_EXPORT(const char *) _nc_viswbufn (const wchar_t *, int);
762 extern NCURSES_EXPORT(const char *) _nc_viscbuf2 (int, const cchar_t *, int);
763 extern NCURSES_EXPORT(const char *) _nc_viscbuf (const cchar_t *, int);
764 #endif
765
766 #else /* !TRACE */
767
768 #define START_TRACE() /* nothing */
769
770 #define T(a)
771 #define TR(n, a)
772 #define TPUTS_TRACE(s)
773
774 #define returnAttr(code) return code
775 #define returnBits(code) return code
776 #define returnBool(code) return code
777 #define returnChar(code) return code
778 #define returnCode(code) return code
779 #define returnPtr(code)  return code
780 #define returnSP(code)   return code
781 #define returnVoid       return
782 #define returnWin(code)  return code
783
784 #endif /* TRACE/!TRACE */
785
786 extern NCURSES_EXPORT(const char *) _nc_visbuf2 (int, const char *);
787 extern NCURSES_EXPORT(const char *) _nc_visbufn (const char *, int);
788
789 #define empty_module(name) \
790 extern  NCURSES_EXPORT(void) name (void); \
791         NCURSES_EXPORT(void) name (void) { }
792
793 #define ALL_BUT_COLOR ((chtype)~(A_COLOR))
794 #define IGNORE_COLOR_OFF FALSE
795 #define NONBLANK_ATTR (A_NORMAL|A_BOLD|A_DIM|A_BLINK)
796 #define XMC_CHANGES(c) ((c) & SP->_xmc_suppress)
797
798 #define toggle_attr_on(S,at) {\
799    if (PAIR_NUMBER(at) > 0)\
800       (S) = ((S) & ALL_BUT_COLOR) | (at);\
801    else\
802       (S) |= (at);\
803    TR(TRACE_ATTRS, ("new attribute is %s", _traceattr((S))));}
804
805
806 #define toggle_attr_off(S,at) {\
807    if (IGNORE_COLOR_OFF == TRUE) {\
808       if (PAIR_NUMBER(at) == 0xff) /* turn off color */\
809          (S) &= ~(at);\
810       else /* leave color alone */\
811          (S) &= ~((at)&ALL_BUT_COLOR);\
812    } else {\
813       if (PAIR_NUMBER(at) > 0x00) /* turn off color */\
814          (S) &= ~(at|A_COLOR);\
815       else /* leave color alone */\
816          (S) &= ~(at);\
817    }\
818    TR(TRACE_ATTRS, ("new attribute is %s", _traceattr((S))));}
819
820 #define DelCharCost(count) \
821                 ((parm_dch != 0) \
822                 ? SP->_dch_cost \
823                 : ((delete_character != 0) \
824                         ? (SP->_dch1_cost * count) \
825                         : INFINITY))
826
827 #define InsCharCost(count) \
828                 ((parm_ich != 0) \
829                 ? SP->_ich_cost \
830                 : ((enter_insert_mode && exit_insert_mode) \
831                   ? SP->_smir_cost + SP->_rmir_cost + (SP->_ip_cost * count) \
832                   : ((insert_character != 0) \
833                     ? ((SP->_ich1_cost + SP->_ip_cost) * count) \
834                     : INFINITY)))
835
836 #if USE_XMC_SUPPORT
837 #define UpdateAttrs(a)  if (SP->_current_attr != (a)) { \
838                                 attr_t chg = SP->_current_attr; \
839                                 vidattr((a)); \
840                                 if (magic_cookie_glitch > 0 \
841                                  && XMC_CHANGES((chg ^ SP->_current_attr))) { \
842                                         T(("%s @%d before glitch %d,%d", \
843                                                 __FILE__, __LINE__, \
844                                                 SP->_cursrow, \
845                                                 SP->_curscol)); \
846                                         _nc_do_xmc_glitch(chg); \
847                                 } \
848                         }
849 #else
850 #define UpdateAttrs(a)  if (SP->_current_attr != (a)) \
851                                 vidattr((a));
852 #endif
853
854 /*
855  * Macros to make additional parameter to implement wgetch_events()
856  */
857 #ifdef NCURSES_WGETCH_EVENTS
858 #define EVENTLIST_0th(param) param
859 #define EVENTLIST_1st(param) param
860 #define EVENTLIST_2nd(param) , param
861 #else
862 #define EVENTLIST_0th(param) void
863 #define EVENTLIST_1st(param) /* nothing */
864 #define EVENTLIST_2nd(param) /* nothing */
865 #endif
866
867 #if NCURSES_EXPANDED && NCURSES_EXT_FUNCS
868
869 #undef  toggle_attr_on
870 #define toggle_attr_on(S,at) _nc_toggle_attr_on(&(S), at)
871 extern NCURSES_EXPORT(void) _nc_toggle_attr_on (attr_t *, attr_t);
872
873 #undef  toggle_attr_off
874 #define toggle_attr_off(S,at) _nc_toggle_attr_off(&(S), at)
875 extern NCURSES_EXPORT(void) _nc_toggle_attr_off (attr_t *, attr_t);
876
877 #undef  DelCharCost
878 #define DelCharCost(count) _nc_DelCharCost(count)
879 extern NCURSES_EXPORT(int) _nc_DelCharCost (int);
880
881 #undef  InsCharCost
882 #define InsCharCost(count) _nc_InsCharCost(count)
883 extern NCURSES_EXPORT(int) _nc_InsCharCost (int);
884
885 #undef  UpdateAttrs
886 #define UpdateAttrs(c) _nc_UpdateAttrs(c)
887 extern NCURSES_EXPORT(void) _nc_UpdateAttrs (chtype);
888
889 #else
890
891 extern NCURSES_EXPORT(void) _nc_expanded (void);
892
893 #endif
894
895 #if !HAVE_GETCWD
896 #define getcwd(buf,len) getwd(buf)
897 #endif
898
899 /* charable.c */
900 #if USE_WIDEC_SUPPORT
901 extern NCURSES_EXPORT(bool) _nc_is_charable(wchar_t);
902 extern NCURSES_EXPORT(int) _nc_to_char(wint_t);
903 extern NCURSES_EXPORT(wint_t) _nc_to_widechar(int);
904 #endif
905
906 /* doupdate.c */
907 #if USE_XMC_SUPPORT
908 extern NCURSES_EXPORT(void) _nc_do_xmc_glitch (attr_t);
909 #endif
910
911 /* hardscroll.c */
912 #if defined(TRACE) || defined(SCROLLDEBUG) || defined(HASHDEBUG)
913 extern NCURSES_EXPORT(void) _nc_linedump (void);
914 #endif
915
916 /* lib_acs.c */
917 extern NCURSES_EXPORT(void) _nc_init_acs (void);        /* corresponds to traditional 'init_acs()' */
918 extern NCURSES_EXPORT(int) _nc_msec_cost (const char *const, int);  /* used by 'tack' program */
919
920 /* lib_addstr.c */
921 #if USE_WIDEC_SUPPORT
922 extern NCURSES_EXPORT(int) _nc_wchstrlen(const cchar_t *);
923 #endif
924
925 /* lib_color.c */
926 extern NCURSES_EXPORT(bool) _nc_reset_colors(void);
927
928 /* lib_getch.c */
929 extern NCURSES_EXPORT(int) _nc_wgetch(WINDOW *, unsigned long *, int EVENTLIST_2nd(_nc_eventlist *));
930
931 /* lib_insch.c */
932 extern NCURSES_EXPORT(void) _nc_insert_ch(WINDOW *, chtype);
933
934 /* lib_mvcur.c */
935 #define INFINITY        1000000 /* cost: too high to use */
936
937 extern NCURSES_EXPORT(void) _nc_mvcur_init (void);
938 extern NCURSES_EXPORT(void) _nc_mvcur_resume (void);
939 extern NCURSES_EXPORT(void) _nc_mvcur_wrap (void);
940
941 extern NCURSES_EXPORT(int) _nc_scrolln (int, int, int, int);
942
943 extern NCURSES_EXPORT(void) _nc_screen_init (void);
944 extern NCURSES_EXPORT(void) _nc_screen_resume (void);
945 extern NCURSES_EXPORT(void) _nc_screen_wrap (void);
946
947 /* lib_mouse.c */
948 extern NCURSES_EXPORT(int) _nc_has_mouse (void);
949
950 /* lib_mvcur.c */
951 #define INFINITY        1000000 /* cost: too high to use */
952 #define BAUDBYTE        9       /* 9 = 7 bits + 1 parity + 1 stop */
953
954 /* lib_setup.c */
955 extern NCURSES_EXPORT(char *) _nc_get_locale(void);
956 extern NCURSES_EXPORT(int) _nc_unicode_locale(void);
957 extern NCURSES_EXPORT(int) _nc_locale_breaks_acs(void);
958
959 /* lib_wacs.c */
960 #if USE_WIDEC_SUPPORT
961 extern NCURSES_EXPORT(void) _nc_init_wacs(void);
962 #endif
963
964 typedef struct {
965     char *s_head;       /* beginning of the string (may be null) */
966     char *s_tail;       /* end of the string (may be null) */
967     size_t s_size;      /* current remaining size available */
968     size_t s_init;      /* total size available */
969 } string_desc;
970
971 /* strings.c */
972 extern NCURSES_EXPORT(string_desc *) _nc_str_init (string_desc *, char *, size_t);
973 extern NCURSES_EXPORT(string_desc *) _nc_str_null (string_desc *, size_t);
974 extern NCURSES_EXPORT(string_desc *) _nc_str_copy (string_desc *, string_desc *);
975 extern NCURSES_EXPORT(bool) _nc_safe_strcat (string_desc *, const char *);
976 extern NCURSES_EXPORT(bool) _nc_safe_strcpy (string_desc *, const char *);
977
978 extern NCURSES_EXPORT(void) _nc_mvcur_init (void);
979 extern NCURSES_EXPORT(void) _nc_mvcur_resume (void);
980 extern NCURSES_EXPORT(void) _nc_mvcur_wrap (void);
981
982 extern NCURSES_EXPORT(int) _nc_scrolln (int, int, int, int);
983
984 extern NCURSES_EXPORT(void) _nc_screen_init (void);
985 extern NCURSES_EXPORT(void) _nc_screen_resume (void);
986 extern NCURSES_EXPORT(void) _nc_screen_wrap (void);
987
988 #if !HAVE_STRSTR
989 #define strstr _nc_strstr
990 extern NCURSES_EXPORT(char *) _nc_strstr (const char *, const char *);
991 #endif
992
993 /* safe_sprintf.c */
994 extern NCURSES_EXPORT(char *) _nc_printf_string (const char *, va_list);
995
996 /* tries.c */
997 extern NCURSES_EXPORT(void) _nc_add_to_try (struct tries **, const char *, unsigned short);
998 extern NCURSES_EXPORT(char *) _nc_expand_try (struct tries *, unsigned short, int *, size_t);
999 extern NCURSES_EXPORT(int) _nc_remove_key (struct tries **, unsigned short);
1000 extern NCURSES_EXPORT(int) _nc_remove_string (struct tries **, const char *);
1001
1002 /* elsewhere ... */
1003 extern NCURSES_EXPORT(NCURSES_CH_T) _nc_render (WINDOW *, NCURSES_CH_T);
1004 extern NCURSES_EXPORT(WINDOW *) _nc_makenew (int, int, int, int, int);
1005 extern NCURSES_EXPORT(char *) _nc_home_terminfo (void);
1006 extern NCURSES_EXPORT(char *) _nc_trace_buf (int, size_t);
1007 extern NCURSES_EXPORT(char *) _nc_trace_bufcat (int, const char *);
1008 extern NCURSES_EXPORT(int) _nc_access (const char *, int);
1009 extern NCURSES_EXPORT(int) _nc_baudrate (int);
1010 extern NCURSES_EXPORT(int) _nc_freewin (WINDOW *);
1011 extern NCURSES_EXPORT(int) _nc_getenv_num (const char *);
1012 extern NCURSES_EXPORT(int) _nc_keypad (bool);
1013 extern NCURSES_EXPORT(int) _nc_ospeed (int);
1014 extern NCURSES_EXPORT(int) _nc_outch (int);
1015 extern NCURSES_EXPORT(int) _nc_setupscreen (short, short const, FILE *);
1016 extern NCURSES_EXPORT(int) _nc_timed_wait(int, int, int * EVENTLIST_2nd(_nc_eventlist *));
1017 extern NCURSES_EXPORT(int) _nc_waddch_nosync (WINDOW *, const NCURSES_CH_T);
1018 extern NCURSES_EXPORT(void) _nc_do_color (int, int, bool, int (*)(int));
1019 extern NCURSES_EXPORT(void) _nc_flush (void);
1020 extern NCURSES_EXPORT(void) _nc_freeall (void);
1021 extern NCURSES_EXPORT(void) _nc_hash_map (void);
1022 extern NCURSES_EXPORT(void) _nc_init_keytry (void);
1023 extern NCURSES_EXPORT(void) _nc_keep_tic_dir (const char *);
1024 extern NCURSES_EXPORT(void) _nc_make_oldhash (int i);
1025 extern NCURSES_EXPORT(void) _nc_scroll_oldhash (int n, int top, int bot);
1026 extern NCURSES_EXPORT(void) _nc_scroll_optimize (void);
1027 extern NCURSES_EXPORT(void) _nc_scroll_window (WINDOW *, int const, short const, short const, NCURSES_CH_T);
1028 extern NCURSES_EXPORT(void) _nc_set_buffer (FILE *, bool);
1029 extern NCURSES_EXPORT(void) _nc_signal_handler (bool);
1030 extern NCURSES_EXPORT(void) _nc_synchook (WINDOW *);
1031 extern NCURSES_EXPORT(void) _nc_trace_tries (struct tries *);
1032
1033 #if USE_SIZECHANGE
1034 extern NCURSES_EXPORT(void) _nc_update_screensize (void);
1035 #endif
1036
1037 #if HAVE_RESIZETERM
1038 extern NCURSES_EXPORT(void) _nc_resize_margins (WINDOW *);
1039 #else
1040 #define _nc_resize_margins(wp) /* nothing */
1041 #endif
1042
1043 #ifdef NCURSES_WGETCH_EVENTS
1044 extern NCURSES_EXPORT(int) _nc_eventlist_timeout(_nc_eventlist *);
1045 #else
1046 #define wgetch_events(win, evl) wgetch(win)
1047 #define wgetnstr_events(win, str, maxlen, evl) wgetnstr(win, str, maxlen)
1048 #endif
1049
1050 /*
1051  * Not everyone has vsscanf(), but we'd like to use it for scanw().
1052  */
1053 #if !HAVE_VSSCANF
1054 extern int vsscanf(const char *str, const char *format, va_list __arg);
1055 #endif
1056
1057 /* scroll indices */
1058 extern NCURSES_EXPORT_VAR(int *) _nc_oldnums;
1059
1060 #define USE_SETBUF_0 0
1061
1062 #define NC_BUFFERED(flag) _nc_set_buffer(SP->_ofp, flag)
1063
1064 #define NC_OUTPUT ((SP != 0) ? SP->_ofp : stdout)
1065
1066 /*
1067  * On systems with a broken linker, define 'SP' as a function to force the
1068  * linker to pull in the data-only module with 'SP'.
1069  */
1070 #if BROKEN_LINKER
1071 #define SP _nc_screen()
1072 extern NCURSES_EXPORT(SCREEN *) _nc_screen (void);
1073 extern NCURSES_EXPORT(int) _nc_alloc_screen (void);
1074 extern NCURSES_EXPORT(void) _nc_set_screen (SCREEN *);
1075 #else
1076 /* current screen is private data; avoid possible linking conflicts too */
1077 extern NCURSES_EXPORT_VAR(SCREEN *) SP;
1078 #define _nc_alloc_screen() ((SP = typeCalloc(SCREEN, 1)) != 0)
1079 #define _nc_set_screen(sp) SP = sp
1080 #endif
1081
1082 /*
1083  * We don't want to use the lines or columns capabilities internally, because
1084  * if the application is running multiple screens under X, it's quite possible
1085  * they could all have type xterm but have different sizes!  So...
1086  */
1087 #define screen_lines    SP->_lines
1088 #define screen_columns  SP->_columns
1089
1090 extern NCURSES_EXPORT_VAR(int) _nc_slk_format;  /* != 0 if slk_init() called */
1091 extern NCURSES_EXPORT(int) _nc_slk_initialize (WINDOW *, int);
1092
1093 /*
1094  * Some constants related to SLK's
1095  */
1096 #define MAX_SKEY_OLD       8    /* count of soft keys */
1097 #define MAX_SKEY_LEN_OLD   8    /* max length of soft key text */
1098 #define MAX_SKEY_PC       12    /* This is what most PC's have */
1099 #define MAX_SKEY_LEN_PC    5
1100
1101 /* Macro to check whether or not we use a standard format */
1102 #define SLK_STDFMT(fmt) (fmt < 3)
1103 /* Macro to determine height of label window */
1104 #define SLK_LINES(fmt)  (SLK_STDFMT(fmt) ? 1 : ((fmt) - 2))
1105
1106 #define MAX_SKEY(fmt)     (SLK_STDFMT(fmt)? MAX_SKEY_OLD : MAX_SKEY_PC)
1107 #define MAX_SKEY_LEN(fmt) (SLK_STDFMT(fmt)? MAX_SKEY_LEN_OLD : MAX_SKEY_LEN_PC)
1108
1109 extern NCURSES_EXPORT(int) _nc_ripoffline (int line, int (*init)(WINDOW *,int));
1110
1111 /*
1112  * Common error messages
1113  */
1114 #define MSG_NO_MEMORY "Out of memory"
1115 #define MSG_NO_INPUTS "Premature EOF"
1116
1117 #ifdef __cplusplus
1118 }
1119 #endif
1120
1121 #endif /* CURSES_PRIV_H */