#ifndef CURSES_PRIV_H
#define CURSES_PRIV_H 1
#include <ncurses_dll.h>
#ifdef __cplusplus
extern "C" {
#endif
#include <ncurses_cfg.h>
#if USE_RCS_IDS
#define MODULE_ID(id) static const char Ident[] = id;
#else
#define MODULE_ID(id)
#endif
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
#if HAVE_SYS_BSDTYPES_H
#include <sys/bsdtypes.h>
#endif
#if HAVE_LIMITS_H
# include <limits.h>
#elif HAVE_SYS_PARAM_H
# include <sys/param.h>
#endif
#ifndef PATH_MAX
# if defined(_POSIX_PATH_MAX)
# define PATH_MAX _POSIX_PATH_MAX
# elif defined(MAXPATHLEN)
# define PATH_MAX MAXPATHLEN
# else
# define PATH_MAX 255
# endif
#endif
#include <assert.h>
#include <stdio.h>
#include <errno.h>
#if DECL_ERRNO
extern int errno;
#endif
#include <nc_panel.h>
#if HAVE_WORKING_POLL
#define USE_FUNC_POLL 1
#if HAVE_POLL_H
#include <poll.h>
#else
#include <sys/poll.h>
#endif
#else
#define USE_FUNC_POLL 0
#endif
#if HAVE_LIBGPM && HAVE_GPM_H
#define USE_GPM_SUPPORT 1
#else
#define USE_GPM_SUPPORT 0
#endif
#if defined(__QNX__) && !defined(__QNXNTO__)
#define USE_QNX_MOUSE 1
#else
#define USE_QNX_MOUSE 0
#endif
#ifdef __EMX__
#define USE_EMX_MOUSE
#endif
#define DEFAULT_MAXCLICK 166
#define EV_MAX 8
#if !NCURSES_EXT_FUNCS
#undef HAVE_SIZECHANGE
#endif
#if HAVE_SIZECHANGE
#define USE_SIZECHANGE 1
#else
#undef USE_SIGWINCH
#endif
#ifdef USE_ROOT_ENVIRON
#define use_terminfo_vars() 1
#else
#define use_terminfo_vars() _nc_env_access()
extern NCURSES_EXPORT(int) _nc_env_access (void);
#endif
#if USE_OK_BCOPY
#define memmove(d,s,n) bcopy(s,d,n)
#elif USE_MY_MEMMOVE
#define memmove(d,s,n) _nc_memmove(d,s,n)
extern NCURSES_EXPORT(void *) _nc_memmove (void *, const void *, size_t);
#endif
#if !USE_SCROLL_HINTS
#if !USE_HASHMAP
#define USE_SCROLL_HINTS 1
#else
#define USE_SCROLL_HINTS 0
#endif
#endif
#if USE_SCROLL_HINTS
#define if_USE_SCROLL_HINTS(stmt) stmt
#else
#define if_USE_SCROLL_HINTS(stmt)
#endif
struct tries {
struct tries *child;
struct tries *sibling;
unsigned char ch;
unsigned short value;
};
#define C_SHIFT 8
#define C_MASK ((1 << C_SHIFT) - 1)
#define PAIR_OF(fg, bg) ((((fg) & C_MASK) << C_SHIFT) | ((bg) & C_MASK))
#define L_BRACE '{'
#define R_BRACE '}'
#define S_QUOTE '\''
#define D_QUOTE '"'
typedef struct
{
short red, green, blue;
}
color_t;
#define MAXCOLUMNS 135
#define MAXLINES 66
#define FIFO_SIZE MAXCOLUMNS+2
#define ACS_LEN 128
#define WINDOWLIST struct _win_list
#if USE_WIDEC_SUPPORT
#define _nc_bkgd _bkgrnd
#else
#undef _XOPEN_SOURCE_EXTENDED
#define _nc_bkgd _bkgd
#define wgetbkgrnd(win, wch) *wch = win->_bkgd
#define wbkgrnd wbkgd
#endif
#include <curses.h>
struct ldat
{
NCURSES_CH_T *text;
NCURSES_SIZE_T firstchar;
NCURSES_SIZE_T lastchar;
NCURSES_SIZE_T oldindex;
};
typedef struct
{
char *text;
char *form_text;
int x;
char dirty;
char visible;
} slk_ent;
typedef struct {
char dirty;
char hidden;
struct _win_st *win;
slk_ent *ent;
char* buffer;
short maxlab;
short labcnt;
short maxlen;
chtype attr;
} SLK;
typedef struct {
unsigned long hashval;
int oldcount, newcount;
int oldindex, newindex;
} HASHMAP;
struct screen {
int _ifd;
FILE *_ofp;
char *_setbuf;
int _buffered;
int _checkfd;
struct term *_term;
short _lines;
short _columns;
short _lines_avail;
short _topstolen;
WINDOW *_curscr;
WINDOW *_newscr;
WINDOW *_stdscr;
struct tries *_keytry;
struct tries *_key_ok;
bool _tried;
bool _keypad_on;
unsigned int _fifo[FIFO_SIZE];
short _fifohead,
_fifotail,
_fifopeek,
_fifohold;
int _endwin;
attr_t _current_attr;
int _coloron;
int _cursor;
int _cursrow;
int _curscol;
int _nl;
int _raw;
int _cbreak;
int _echo;
int _use_meta;
SLK *_slk;
int slk_format;
#if NCURSES_NO_PADDING
int _no_padding;
#endif
int _char_padding;
int _cr_cost;
int _cup_cost;
int _home_cost;
int _ll_cost;
#if USE_HARD_TABS
int _ht_cost;
int _cbt_cost;
#endif
int _cub1_cost;
int _cuf1_cost;
int _cud1_cost;
int _cuu1_cost;
int _cub_cost;
int _cuf_cost;
int _cud_cost;
int _cuu_cost;
int _hpa_cost;
int _vpa_cost;
int _ed_cost;
int _el_cost;
int _el1_cost;
int _dch1_cost;
int _ich1_cost;
int _dch_cost;
int _ich_cost;
int _ech_cost;
int _rep_cost;
int _hpa_ch_cost;
int _cup_ch_cost;
int _cuf_ch_cost;
int _inline_cost;
int _smir_cost;
int _rmir_cost;
int _ip_cost;
char * _address_cursor;
int _scrolling;
color_t *_color_table;
int _color_count;
unsigned short *_color_pairs;
int _pair_count;
#if NCURSES_EXT_FUNCS
bool _default_color;
bool _has_sgr_39_49;
int _default_fg;
int _default_bg;
#endif
chtype _xmc_suppress;
chtype _xmc_triggers;
chtype _acs_map[ACS_LEN];
bool _use_rmso;
bool _use_rmul;
bool _nc_sp_idlok;
bool _nc_sp_idcok;
#define _nc_idlok SP->_nc_sp_idlok
#define _nc_idcok SP->_nc_sp_idcok
int _maxclick;
bool (*_mouse_event) (SCREEN *);
bool (*_mouse_inline)(SCREEN *);
bool (*_mouse_parse) (int);
void (*_mouse_resume)(SCREEN *);
void (*_mouse_wrap) (SCREEN *);
int _mouse_fd;
#if USE_SIZECHANGE
int (*_resize)(int,int);
#endif
struct panelhook _panelHook;
WINDOWLIST *_nc_sp_windows;
#define _nc_windows SP->_nc_sp_windows
bool _sig_winch;
SCREEN *_next_screen;
unsigned long *oldhash, *newhash;
HASHMAP *hashtab;
int hashtab_len;
bool _cleanup;
int (*_outch)(int);
};
extern NCURSES_EXPORT_VAR(SCREEN *) _nc_screen_chain;
#if NCURSES_NOMACROS
#include <nomacros.h>
#endif
WINDOWLIST {
WINDOWLIST *next;
#if HAVE_RESIZETERM
int l_margin;
int r_margin;
int t_margin;
int b_margin;
#endif
WINDOW win;
};
typedef struct {
int line;
int (*hook)(struct _win_st *, int);
struct _win_st *w;
} ripoff_t;
#define is7bits(c) ((unsigned)(c) < 128)
#ifndef min
#define min(a,b) ((a) > (b) ? (b) : (a))
#endif
#ifndef max
#define max(a,b) ((a) < (b) ? (b) : (a))
#endif
#ifndef STDIN_FILENO
#define STDIN_FILENO 0
#endif
#ifndef STDOUT_FILENO
#define STDOUT_FILENO 1
#endif
#ifndef STDERR_FILENO
#define STDERR_FILENO 2
#endif
#ifndef EXIT_SUCCESS
#define EXIT_SUCCESS 0
#endif
#ifndef EXIT_FAILURE
#define EXIT_FAILURE 1
#endif
#ifndef R_OK
#define R_OK 4
#endif
#ifndef W_OK
#define W_OK 2
#endif
#ifndef X_OK
#define X_OK 1
#endif
#ifndef F_OK
#define F_OK 0
#endif
#if HAVE_FCNTL_H
#include <fcntl.h>
#endif
#ifndef O_BINARY
#define O_BINARY 0
#endif
#define UChar(c) ((unsigned char)(c))
#define ChCharOf(c) ((c) & (chtype)A_CHARTEXT)
#define ChAttrOf(c) ((c) & (chtype)A_ATTRIBUTES)
#if USE_WIDEC_SUPPORT
#define CharOf(c) ((c).chars[0])
#define AttrOf(c) ((c).attr)
#define AddAttr(c,a) (c).attr |= a
#define RemAttr(c,a) (c).attr &= ~(a)
#define SetAttr(c,a) (c).attr = a
#define NewChar(ch) { ChAttrOf(ch), { ChCharOf(ch) } }
#define NewChar2(c,a) { a, { c } }
#define CharEq(a,b) (!memcmp(&a, &b, sizeof(a)))
#define SetChar(ch,c,a) do { \
NCURSES_CH_T *_cp = &ch; \
memset(_cp,0,sizeof(ch)); _cp->chars[0] = c; _cp->attr = a; \
} while (0)
#define CHREF(wch) (&wch)
#define CHDEREF(wch) (*wch)
#define ARG_CH_T NCURSES_CH_T *
#define CARG_CH_T const NCURSES_CH_T *
#define PUTC_DATA char PUTC_buf[MB_LEN_MAX]; int PUTC_i, PUTC_n; \
mbstate_t PUT_st; wchar_t PUTC_ch
#define PUTC(ch,b) do { if(!isnac(ch)) { \
memset (&PUT_st, '\0', sizeof (PUT_st)); \
PUTC_i = 0; \
do { \
PUTC_ch = PUTC_i < CCHARW_MAX ? \
(ch).chars[PUTC_i] : L'\0'; \
PUTC_n = wcrtomb(PUTC_buf, \
(ch).chars[PUTC_i], &PUT_st); \
if (PUTC_ch == L'\0') \
--PUTC_n; \
if (PUTC_n <= 0) \
break; \
fwrite(PUTC_buf, PUTC_n, 1, b); \
++PUTC_i; \
} while (PUTC_ch != L'\0'); \
} } while (0)
#define BLANK { WA_NORMAL, ' ' }
#define ISBLANK(ch) ((ch).chars[0] == L' ' && (ch).chars[1] == L'\0')
#define WA_NAC 1
#define isnac(ch) (AttrOf(ch) & WA_NAC)
#define if_WIDEC(code) code
#define Charable(ch) (!isnac(ch) && \
(ch).chars[1] == L'\0' && \
(wctob(CharOf(ch)) == (char)CharOf(ch)))
#define L(ch) L ## ch
#else
#define CharOf(c) ChCharOf(c)
#define AttrOf(c) ChAttrOf(c)
#define AddAttr(c,a) c |= a
#define RemAttr(c,a) c &= ~(a & A_ATTRIBUTES)
#define SetAttr(c,a) c = (c & ~A_ATTRIBUTES) | a
#define NewChar(ch) (ch)
#define NewChar2(c,a) (c | a)
#define CharEq(a,b) (a == b)
#define SetChar(ch,c,a) ch = c | a
#define CHREF(wch) wch
#define CHDEREF(wch) wch
#define ARG_CH_T NCURSES_CH_T
#define CARG_CH_T NCURSES_CH_T
#define PUTC_DATA int data = 0
#define PUTC(a,b) do { data = CharOf(ch); putc(data,b); } while (0)
#define BLANK (' '|A_NORMAL)
#define ISBLANK(ch) (CharOf(ch) == ' ')
#define isnac(ch) (0)
#define if_WIDEC(code)
#define L(ch) ch
#endif
#define AttrOfD(ch) AttrOf(CHDEREF(ch))
#define CharOfD(ch) CharOf(CHDEREF(ch))
#define SetChar2(wch,ch) SetChar(wch,ChCharOf(ch),ChAttrOf(ch))
#define BLANK_ATTR A_NORMAL
#define BLANK_TEXT L(' ')
#define CHANGED -1
#define CHANGED_CELL(line,col) \
if (line->firstchar == _NOCHANGE) \
line->firstchar = line->lastchar = col; \
else if ((col) < line->firstchar) \
line->firstchar = col; \
else if ((col) > line->lastchar) \
line->lastchar = col
#define CHANGED_RANGE(line,start,end) \
if (line->firstchar == _NOCHANGE \
|| line->firstchar > (start)) \
line->firstchar = start; \
if (line->lastchar == _NOCHANGE \
|| line->lastchar < (end)) \
line->lastchar = end
#define CHANGED_TO_EOL(line,start,end) \
if (line->firstchar == _NOCHANGE \
|| line->firstchar > (start)) \
line->firstchar = start; \
line->lastchar = end
#define SIZEOF(v) (sizeof(v)/sizeof(v[0]))
#define FreeIfNeeded(p) if ((p) != 0) free(p)
#define FreeAndNull(p) free(p); p = 0
#include <nc_alloc.h>
#define T_CALLED(fmt) "called {" fmt
#define T_CREATE(fmt) "create :" fmt
#define T_RETURN(fmt) "return }" fmt
#ifdef TRACE
#define TR(n, a) if (_nc_tracing & (n)) _tracef a
#define T(a) TR(TRACE_CALLS, a)
#define TPUTS_TRACE(s) _nc_tputs_trace = s;
#define TRACE_RETURN(value,type) return _nc_retrace_##type(value)
#define returnAttr(code) TRACE_RETURN(code,attr_t)
#define returnChar(code) TRACE_RETURN(code,chtype)
#define returnCode(code) TRACE_RETURN(code,int)
#define returnPtr(code) TRACE_RETURN(code,ptr)
#define returnSP(code) TRACE_RETURN(code,sp)
#define returnVoid T((T_RETURN(""))); return
#define returnWin(code) TRACE_RETURN(code,win)
extern NCURSES_EXPORT(SCREEN *) _nc_retrace_sp (SCREEN *);
extern NCURSES_EXPORT(WINDOW *) _nc_retrace_win (WINDOW *);
extern NCURSES_EXPORT(attr_t) _nc_retrace_attr_t (attr_t);
extern NCURSES_EXPORT(attr_t) _nc_retrace_chtype (chtype);
extern NCURSES_EXPORT(char *) _nc_retrace_ptr (char *);
extern NCURSES_EXPORT(char *) _nc_varargs (const char *, va_list);
extern NCURSES_EXPORT(const char *) _nc_altcharset_name(attr_t, chtype);
extern NCURSES_EXPORT(int) _nc_retrace_int (int);
extern NCURSES_EXPORT(void) _nc_fifo_dump (void);
extern NCURSES_EXPORT_VAR(const char *) _nc_tputs_trace;
extern NCURSES_EXPORT_VAR(long) _nc_outchars;
extern NCURSES_EXPORT_VAR(unsigned) _nc_tracing;
#if USE_WIDEC_SUPPORT
extern NCURSES_EXPORT(const char *) _nc_viswbuf2 (int, const wchar_t *);
extern NCURSES_EXPORT(const char *) _nc_viscbuf2 (int, const cchar_t *, int);
extern NCURSES_EXPORT(const char *) _nc_viscbuf (const cchar_t *, int);
#endif
#else
#define T(a)
#define TR(n, a)
#define TPUTS_TRACE(s)
#define returnAttr(code) return code
#define returnChar(code) return code
#define returnCode(code) return code
#define returnPtr(code) return code
#define returnSP(code) return code
#define returnVoid return
#define returnWin(code) return code
#endif
#define empty_module(name) \
extern NCURSES_EXPORT(void) name (void); \
NCURSES_EXPORT(void) name (void) { }
extern NCURSES_EXPORT(const char *) _nc_visbuf2 (int, const char *);
#define ALL_BUT_COLOR ((chtype)~(A_COLOR))
#define IGNORE_COLOR_OFF FALSE
#define NONBLANK_ATTR (A_BOLD|A_DIM|A_BLINK)
#define XMC_CHANGES(c) ((c) & SP->_xmc_suppress)
#define toggle_attr_on(S,at) {\
if (PAIR_NUMBER(at) > 0)\
(S) = ((S) & ALL_BUT_COLOR) | (at);\
else\
(S) |= (at);\
TR(TRACE_ATTRS, ("new attribute is %s", _traceattr((S))));}
#define toggle_attr_off(S,at) {\
if (IGNORE_COLOR_OFF == TRUE) {\
if (PAIR_NUMBER(at) == 0xff) \
(S) &= ~(at);\
else \
(S) &= ~((at)&ALL_BUT_COLOR);\
} else {\
if (PAIR_NUMBER(at) > 0x00) \
(S) &= ~(at|A_COLOR);\
else \
(S) &= ~(at);\
}\
TR(TRACE_ATTRS, ("new attribute is %s", _traceattr((S))));}
#define DelCharCost(count) \
((parm_dch != 0) \
? SP->_dch_cost \
: ((delete_character != 0) \
? (SP->_dch1_cost * count) \
: INFINITY))
#define InsCharCost(count) \
((parm_ich != 0) \
? SP->_ich_cost \
: ((enter_insert_mode && exit_insert_mode) \
? SP->_smir_cost + SP->_rmir_cost + (SP->_ip_cost * count) \
: ((insert_character != 0) \
? (SP->_ich1_cost * count) \
: INFINITY)))
#if USE_XMC_SUPPORT
#define UpdateAttrs(a) if (SP->_current_attr != (a)) { \
attr_t chg = SP->_current_attr; \
vidattr((a)); \
if (magic_cookie_glitch > 0 \
&& XMC_CHANGES((chg ^ SP->_current_attr))) { \
T(("%s @%d before glitch %d,%d", \
__FILE__, __LINE__, \
SP->_cursrow, \
SP->_curscol)); \
_nc_do_xmc_glitch(chg); \
} \
}
#else
#define UpdateAttrs(a) if (SP->_current_attr != (a)) \
vidattr((a));
#endif
#if NCURSES_EXPANDED && NCURSES_EXT_FUNCS
#undef toggle_attr_on
#define toggle_attr_on(S,at) _nc_toggle_attr_on(&(S), at)
extern NCURSES_EXPORT(void) _nc_toggle_attr_on (attr_t *, attr_t);
#undef toggle_attr_off
#define toggle_attr_off(S,at) _nc_toggle_attr_off(&(S), at)
extern NCURSES_EXPORT(void) _nc_toggle_attr_off (attr_t *, attr_t);
#undef DelCharCost
#define DelCharCost(count) _nc_DelCharCost(count)
extern NCURSES_EXPORT(int) _nc_DelCharCost (int);
#undef InsCharCost
#define InsCharCost(count) _nc_InsCharCost(count)
extern NCURSES_EXPORT(int) _nc_InsCharCost (int);
#undef UpdateAttrs
#define UpdateAttrs(c) _nc_UpdateAttrs(c)
extern NCURSES_EXPORT(void) _nc_UpdateAttrs (chtype);
#else
extern NCURSES_EXPORT(void) _nc_expanded (void);
#endif
#if !HAVE_GETCWD
#define getcwd(buf,len) getwd(buf)
#endif
#if USE_XMC_SUPPORT
extern NCURSES_EXPORT(void) _nc_do_xmc_glitch (attr_t);
#endif
#if defined(TRACE) || defined(SCROLLDEBUG) || defined(HASHDEBUG)
extern NCURSES_EXPORT(void) _nc_linedump (void);
#endif
extern NCURSES_EXPORT(void) _nc_init_acs (void);
extern NCURSES_EXPORT(int) _nc_msec_cost (const char *const, int);
#if USE_WIDEC_SUPPORT
extern NCURSES_EXPORT(int) _nc_wchstrlen(const cchar_t *);
#endif
#define INFINITY 1000000
extern NCURSES_EXPORT(void) _nc_mvcur_init (void);
extern NCURSES_EXPORT(void) _nc_mvcur_resume (void);
extern NCURSES_EXPORT(void) _nc_mvcur_wrap (void);
extern NCURSES_EXPORT(int) _nc_scrolln (int, int, int, int);
extern NCURSES_EXPORT(void) _nc_screen_init (void);
extern NCURSES_EXPORT(void) _nc_screen_resume (void);
extern NCURSES_EXPORT(void) _nc_screen_wrap (void);
extern NCURSES_EXPORT(int) _nc_has_mouse (void);
#define INFINITY 1000000
#if USE_WIDEC_SUPPORT
extern NCURSES_EXPORT(void) _nc_init_wacs(void);
#endif
typedef struct {
char *s_head;
char *s_tail;
size_t s_size;
} string_desc;
extern NCURSES_EXPORT(string_desc *) _nc_str_init (string_desc *, char *, size_t);
extern NCURSES_EXPORT(string_desc *) _nc_str_null (string_desc *, size_t);
extern NCURSES_EXPORT(string_desc *) _nc_str_copy (string_desc *, string_desc *);
extern NCURSES_EXPORT(bool) _nc_safe_strcat (string_desc *, const char *);
extern NCURSES_EXPORT(bool) _nc_safe_strcpy (string_desc *, const char *);
extern NCURSES_EXPORT(void) _nc_mvcur_init (void);
extern NCURSES_EXPORT(void) _nc_mvcur_resume (void);
extern NCURSES_EXPORT(void) _nc_mvcur_wrap (void);
extern NCURSES_EXPORT(int) _nc_scrolln (int, int, int, int);
extern NCURSES_EXPORT(void) _nc_screen_init (void);
extern NCURSES_EXPORT(void) _nc_screen_resume (void);
extern NCURSES_EXPORT(void) _nc_screen_wrap (void);
#if !HAVE_STRSTR
#define strstr _nc_strstr
extern NCURSES_EXPORT(char *) _nc_strstr (const char *, const char *);
#endif
extern NCURSES_EXPORT(char *) _nc_printf_string (const char *, va_list);
extern NCURSES_EXPORT(void) _nc_add_to_try (struct tries **, const char *, unsigned short);
extern NCURSES_EXPORT(char *) _nc_expand_try (struct tries *, unsigned short, int *, size_t);
extern NCURSES_EXPORT(int) _nc_remove_key (struct tries **, unsigned short);
extern NCURSES_EXPORT(int) _nc_remove_string (struct tries **, char *);
extern NCURSES_EXPORT(WINDOW *) _nc_makenew (int, int, int, int, int);
extern NCURSES_EXPORT(char *) _nc_home_terminfo (void);
extern NCURSES_EXPORT(char *) _nc_trace_buf (int, size_t);
extern NCURSES_EXPORT(NCURSES_CH_T) _nc_render (WINDOW *, NCURSES_CH_T);
extern NCURSES_EXPORT(int) _nc_access (const char *, int);
extern NCURSES_EXPORT(int) _nc_baudrate (int);
extern NCURSES_EXPORT(int) _nc_freewin (WINDOW *);
extern NCURSES_EXPORT(int) _nc_getenv_num (const char *);
extern NCURSES_EXPORT(int) _nc_keypad (bool);
extern NCURSES_EXPORT(int) _nc_ospeed (int);
extern NCURSES_EXPORT(int) _nc_outch (int);
extern NCURSES_EXPORT(int) _nc_setupscreen (short, short const, FILE *);
extern NCURSES_EXPORT(int) _nc_timed_wait (int, int, int *);
extern NCURSES_EXPORT(int) _nc_waddch_nosync (WINDOW *, const NCURSES_CH_T);
extern NCURSES_EXPORT(void) _nc_do_color (int, int, bool, int (*)(int));
extern NCURSES_EXPORT(void) _nc_flush (void);
extern NCURSES_EXPORT(void) _nc_freeall (void);
extern NCURSES_EXPORT(void) _nc_hash_map (void);
extern NCURSES_EXPORT(void) _nc_init_keytry (void);
extern NCURSES_EXPORT(void) _nc_keep_tic_dir (const char *);
extern NCURSES_EXPORT(void) _nc_make_oldhash (int i);
extern NCURSES_EXPORT(void) _nc_outstr (const char *str);
extern NCURSES_EXPORT(void) _nc_scroll_oldhash (int n, int top, int bot);
extern NCURSES_EXPORT(void) _nc_scroll_optimize (void);
extern NCURSES_EXPORT(void) _nc_scroll_window (WINDOW *, int const, short const, short const, NCURSES_CH_T);
extern NCURSES_EXPORT(void) _nc_set_buffer (FILE *, bool);
extern NCURSES_EXPORT(void) _nc_signal_handler (bool);
extern NCURSES_EXPORT(void) _nc_synchook (WINDOW *);
extern NCURSES_EXPORT(void) _nc_trace_tries (struct tries *);
#if USE_SIZECHANGE
extern NCURSES_EXPORT(void) _nc_update_screensize (void);
#endif
#if HAVE_RESIZETERM
extern NCURSES_EXPORT(void) _nc_resize_margins (WINDOW *);
#else
#define _nc_resize_margins(wp)
#endif
#if !HAVE_VSSCANF
extern int vsscanf(const char *str, const char *format, va_list __arg);
#endif
extern NCURSES_EXPORT_VAR(int *) _nc_oldnums;
#define USE_SETBUF_0 0
#define NC_BUFFERED(flag) \
if ((SP->_buffered != 0) != flag) \
_nc_set_buffer(SP->_ofp, flag)
#define NC_OUTPUT ((SP != 0) ? SP->_ofp : stdout)
#if BROKEN_LINKER
#define SP _nc_screen()
extern NCURSES_EXPORT(SCREEN *) _nc_screen (void);
extern NCURSES_EXPORT(int) _nc_alloc_screen (void);
extern NCURSES_EXPORT(void) _nc_set_screen (SCREEN *);
#else
extern NCURSES_EXPORT_VAR(SCREEN *) SP;
#define _nc_alloc_screen() ((SP = typeCalloc(SCREEN, 1)) != 0)
#define _nc_set_screen(sp) SP = sp
#endif
#define screen_lines SP->_lines
#define screen_columns SP->_columns
extern NCURSES_EXPORT_VAR(int) _nc_slk_format;
extern NCURSES_EXPORT(int) _nc_slk_initialize (WINDOW *, int);
#define MAX_SKEY_OLD 8
#define MAX_SKEY_LEN_OLD 8
#define MAX_SKEY_PC 12
#define MAX_SKEY_LEN_PC 5
#define SLK_STDFMT(fmt) (fmt < 3)
#define SLK_LINES(fmt) (SLK_STDFMT(fmt) ? 1 : ((fmt) - 2))
#define MAX_SKEY(fmt) (SLK_STDFMT(fmt)? MAX_SKEY_OLD : MAX_SKEY_PC)
#define MAX_SKEY_LEN(fmt) (SLK_STDFMT(fmt)? MAX_SKEY_LEN_OLD : MAX_SKEY_LEN_PC)
extern NCURSES_EXPORT(int) _nc_ripoffline (int line, int (*init)(WINDOW *,int));
#ifdef __cplusplus
}
#endif
#endif