]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - include/curses.h.in
ncurses 5.0
[ncurses.git] / include / curses.h.in
index 43e474ba449b8af36170d1dfec37f838d4444791..4f300b0b9aeddfe18487c59d1d39adea887eaf9d 100644 (file)
@@ -1,30 +1,50 @@
-/***************************************************************************
-*                            COPYRIGHT NOTICE                              *
-****************************************************************************
-*                ncurses is copyright (C) 1992-1995                        *
-*                          Zeyd M. Ben-Halim                               *
-*                          zmbenhal@netcom.com                             *
-*                          Eric S. Raymond                                 *
-*                          esr@snark.thyrsus.com                           *
-*                                                                          *
-*        Permission is hereby granted to reproduce and distribute ncurses  *
-*        by any means and for any fee, whether alone or as part of a       *
-*        larger distribution, in source or in binary form, PROVIDED        *
-*        this notice is included with any such distribution, and is not    *
-*        removed from any of its header files. Mention of ncurses in any   *
-*        applications linked with it is highly appreciated.                *
-*                                                                          *
-*        ncurses comes AS IS with no warranty, implied or expressed.       *
-*                                                                          *
-***************************************************************************/
-
-/* $Id: curses.h.in,v 1.44 1997/04/20 01:32:08 tom Exp $ */
+/****************************************************************************
+ * Copyright (c) 1998 Free Software Foundation, Inc.                        *
+ *                                                                          *
+ * Permission is hereby granted, free of charge, to any person obtaining a  *
+ * copy of this software and associated documentation files (the            *
+ * "Software"), to deal in the Software without restriction, including      *
+ * without limitation the rights to use, copy, modify, merge, publish,      *
+ * distribute, distribute with modifications, sublicense, and/or sell       *
+ * copies of the Software, and to permit persons to whom the Software is    *
+ * furnished to do so, subject to the following conditions:                 *
+ *                                                                          *
+ * The above copyright notice and this permission notice shall be included  *
+ * in all copies or substantial portions of the Software.                   *
+ *                                                                          *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
+ * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
+ *                                                                          *
+ * Except as contained in this notice, the name(s) of the above copyright   *
+ * holders shall not be used in advertising or otherwise to promote the     *
+ * sale, use or other dealings in this Software without prior written       *
+ * authorization.                                                           *
+ ****************************************************************************/
+
+/****************************************************************************
+ *  Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995               *
+ *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
+ ****************************************************************************/
+
+/* $Id: curses.h.in,v 1.85 1999/10/23 12:33:54 tom Exp $ */
 
 #ifndef __NCURSES_H
 #define __NCURSES_H
+
 #define CURSES 1
 #define CURSES_H 1
 
+/* This should be defined for the enhanced functionality to be visible.
+ * However, none of the wide-character (enhanced) functionality is implemented.
+ * So we do not define it (yet).
+#define _XOPEN_CURSES 1
+ */
+
 /* These are defined only in curses.h, and are used for conditional compiles */
 #define NCURSES_VERSION_MAJOR @NCURSES_MAJOR@
 #define NCURSES_VERSION_MINOR @NCURSES_MINOR@
 #define NCURSES_ATTR_T int
 #endif
 
-#ifndef NCURSES_CONST
-#define NCURSES_CONST /* nothing */
-#endif
+#undef  NCURSES_CONST
+#define NCURSES_CONST @NCURSES_CONST@
 
-#ifndef _UNCTRL_H
-typedef unsigned long  chtype;
-#endif
+typedef unsigned @cf_cv_typeof_chtype@ chtype;
 
 #include <stdio.h>
 #include <unctrl.h>
@@ -60,24 +77,17 @@ typedef unsigned long  chtype;
 /* XSI and SVr4 specify that curses implements 'bool'.  However, C++ may also
  * implement it.  If so, we must use the C++ compiler's type to avoid conflict
  * with other interfaces.
- *
- * To simplify use with/without the configuration script, we define the symbols
- * CXX_BUILTIN_BOOL and CXX_TYPE_OF_BOOL; they're edited by the configure
- * script.
  */
 
 #undef TRUE
+#define TRUE    1
+
 #undef FALSE
-#define CXX_BUILTIN_BOOL @nc_cv_builtin_bool@
-#define CXX_TYPE_OF_BOOL @nc_cv_type_of_bool@
+#define FALSE   0
 
-#if defined(__cplusplus) && CXX_BUILTIN_BOOL
-#define TRUE    ((CXX_TYPE_OF_BOOL)true)
-#define FALSE   ((CXX_TYPE_OF_BOOL)false)
-#else
-typedef CXX_TYPE_OF_BOOL bool;
-#define TRUE    ((bool)1)
-#define FALSE   ((bool)0)
+#if (!defined(__cplusplus) || !@cf_cv_builtin_bool@) && (!@cf_cv_cc_bool_type@)
+#undef bool
+typedef @cf_cv_type_of_bool@ bool;
 #endif
 
 #ifdef __cplusplus
@@ -86,26 +96,25 @@ extern "C" {
 
 /*
  * XSI attributes.  In the ncurses implementation, they are identical to the
- * A_ attributes because attr_t is just an int.  The XSI Curses attr_* and
- * wattr_* entry points are all mapped to attr* and wattr* entry points.
+ * A_ attributes.
  */
-#define WA_ATTRIBUTES  0xffffff00
-#define WA_NORMAL      0x00000000
-#define WA_STANDOUT    0x00010000
-#define WA_UNDERLINE   0x00020000
-#define WA_REVERSE     0x00040000
-#define WA_BLINK       0x00080000
-#define WA_DIM         0x00100000
-#define WA_BOLD                0x00200000
-#define WA_ALTCHARSET  0x00400000
-#define WA_INVIS       0x00800000
-#define WA_PROTECT     0x01000000
-#define WA_HORIZONTAL  0x02000000      /* XSI Curses attr -- not yet used */
-#define WA_LEFT                0x04000000      /* XSI Curses attr -- not yet used */
-#define WA_LOW         0x08000000      /* XSI Curses attr -- not yet used */
-#define WA_RIGHT       0x10000000      /* XSI Curses attr -- not yet used */
-#define WA_TOP         0x20000000      /* XSI Curses attr -- not yet used */
-#define WA_VERTICAL    0x40000000      /* XSI Curses attr -- not yet used */
+#define WA_ATTRIBUTES  A_ATTRIBUTES
+#define WA_NORMAL      A_NORMAL
+#define WA_STANDOUT    A_STANDOUT
+#define WA_UNDERLINE   A_UNDERLINE
+#define WA_REVERSE     A_REVERSE
+#define WA_BLINK       A_BLINK
+#define WA_DIM         A_DIM
+#define WA_BOLD                A_BOLD
+#define WA_ALTCHARSET  A_ALTCHARSET
+#define WA_INVIS       A_INVIS
+#define WA_PROTECT     A_PROTECT
+#define WA_HORIZONTAL  A_HORIZONTAL
+#define WA_LEFT                A_LEFT
+#define WA_LOW         A_LOW
+#define WA_RIGHT       A_RIGHT
+#define WA_TOP         A_TOP
+#define WA_VERTICAL    A_VERTICAL
 
 /* colors */
 extern int COLORS;
@@ -149,7 +158,7 @@ extern      chtype acs_map[];
 #define ACS_DARROW     (acs_map['.'])  /* arrow pointing down */
 #define ACS_UARROW     (acs_map['-'])  /* arrow pointing up */
 #define ACS_BOARD      (acs_map['h'])  /* board of squares */
-#define ACS_LANTERN    (acs_map['I'])  /* lantern symbol */
+#define ACS_LANTERN    (acs_map['i'])  /* lantern symbol */
 #define ACS_BLOCK      (acs_map['0'])  /* solid square block */
 /*
  * These aren't documented, but a lot of System Vs have them anyway
@@ -233,7 +242,16 @@ typedef struct
 cchar_t;
 #endif /* _XOPEN_SOURCE_EXTENDED */
 
-struct _win_st {
+struct ldat
+{
+       chtype  *text;          /* text of the line */
+       short   firstchar;      /* first changed character in the line */
+       short   lastchar;       /* last changed character in the line */
+       short   oldindex;       /* index of the line at last update */
+};
+
+struct _win_st
+{
        short   _cury, _curx;   /* current cursor position */
 
        /* window location and size */
@@ -258,15 +276,7 @@ struct _win_st {
        bool    _use_keypad;    /* process function keys into KEY_ symbols? */
        int     _delay;         /* 0 = nodelay, <0 = blocking, >0 = delay */
 
-       /* the actual line data */
-       struct ldat
-       {
-           chtype  *text;      /* text of the line */
-           short   firstchar;  /* first changed character in the line */
-           short   lastchar;   /* last changed character in the line */
-           short   oldindex;   /* index of the line at last update */
-       }
-       *_line;
+       struct ldat *_line;     /* the actual line data */
 
        /* global screen state */
        short   _regtop;        /* top line of scrolling region */
@@ -288,19 +298,27 @@ struct _win_st {
        short   _yoffset;       /* real begy is _begy + _yoffset */
 };
 
-extern WINDOW   *stdscr, *curscr, *newscr;
+extern WINDOW   *stdscr;
+extern WINDOW   *curscr;
+extern WINDOW   *newscr;
 
-extern int     LINES, COLS, TABSIZE;
+extern int     LINES;
+extern int     COLS;
+extern int     TABSIZE;
 
 /*
  * This global was an undocumented feature under AIX curses.
  */
 extern int ESCDELAY;   /* ESC expire time in milliseconds */
 
-/* non-XSI extensions (dickey@clark.net) */
+extern char *keybound (int, int);
+extern const char *curses_version (void);
+extern int define_key (char *, int);
+extern int keyok (int, bool);
 extern int resizeterm (int, int);
-extern int wresize (WINDOW *, int, int);
 extern int use_default_colors (void);
+extern int use_extended_names (bool);
+extern int wresize (WINDOW *, int, int);
 
 extern char ttytype[];         /* needed for backward compatibility */
 
@@ -308,11 +326,23 @@ extern char ttytype[];            /* needed for backward compatibility */
  * GCC (and some other compilers) define '__attribute__'; we're using this
  * macro to alert the compiler to flag inconsistencies in printf/scanf-like
  * function calls.  Just in case '__attribute__' isn't defined, make a dummy.
+ * G++ doesn't accept it anyway.
  */
 #if !defined(__GNUC__) && !defined(__attribute__)
 #define __attribute__(p) /* nothing */
 #endif
 
+/*
+ * For g++, turn off our macros that use __attribute__ (g++ recognizes some
+ * of them, but not at the same version levels as gcc).
+ */
+#ifdef __cplusplus
+#undef GCC_NORETURN
+#undef GCC_PRINTF
+#undef GCC_SCANF
+#undef GCC_UNUSED
+#endif
+
 /*
  * We cannot define these in ncurses_cfg.h, since they require parameters to be
  * passed (that's non-portable).
@@ -359,25 +389,25 @@ extern int add_wchstr(const cchar_t *);                   /* missing */
 extern int attroff(NCURSES_ATTR_T);                    /* generated */
 extern int attron(NCURSES_ATTR_T);                     /* generated */
 extern int attrset(NCURSES_ATTR_T);                    /* generated */
-extern int attr_get(void);                             /* generated */
-extern int attr_off(NCURSES_ATTR_T);                   /* generated */
-extern int attr_on(NCURSES_ATTR_T);                    /* generated */
-extern int attr_set(NCURSES_ATTR_T);                   /* generated */
+extern int attr_get(attr_t *, short *, void *);                /* generated */
+extern int attr_off(attr_t, void *);                   /* generated */
+extern int attr_on(attr_t, void *);                    /* generated */
+extern int attr_set(attr_t, short, void *);            /* generated */
 extern int baudrate(void);                             /* implemented */
 extern int beep(void);                                 /* implemented */
 extern int bkgd(chtype);                               /* generated */
 extern void bkgdset(chtype);                           /* generated */
 #ifdef _XOPEN_SOURCE_EXTENDED
-extern int bkgrndset(const cchar_t *);                 /* missing */
+extern void bkgrndset(const cchar_t *);                        /* missing */
 extern int bkgrnd(const cchar_t *);                    /* missing */
 #endif /* _XOPEN_SOURCE_EXTENDED */
 extern int border(chtype,chtype,chtype,chtype,chtype,chtype,chtype,chtype);    /* generated */
 #ifdef _XOPEN_SOURCE_EXTENDED
-extern int border_set(cchar_t,cchar_t,cchar_t,cchar_t,cchar_t,cchar_t,cchar_t,cchar_t);        /* missing */
+extern int border_set(const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*);        /* missing */
 #endif /* _XOPEN_SOURCE_EXTENDED */
 extern int box(WINDOW *, chtype, chtype);              /* generated */
 #ifdef _XOPEN_SOURCE_EXTENDED
-extern int box_set(WINDOW *, cchar_t, cchar_t);                /* missing */
+extern int box_set(WINDOW *, const cchar_t *, const cchar_t *);        /* missing */
 #endif /* _XOPEN_SOURCE_EXTENDED */
 extern bool can_change_color(void);                    /* implemented */
 extern int cbreak(void);                               /* implemented */
@@ -387,6 +417,7 @@ extern int clearok(WINDOW *,bool);                  /* implemented */
 extern int clrtobot(void);                             /* generated */
 extern int clrtoeol(void);                             /* generated */
 extern int color_content(short,short*,short*,short*);  /* implemented */
+extern int color_set(short,void*);                     /* generated */
 extern int COLOR_PAIR(int);                            /* generated */
 extern int copywin(const WINDOW*,WINDOW*,int,int,int,int,int,int,int); /* implemented */
 extern int curs_set(int);                              /* implemented */
@@ -404,12 +435,10 @@ extern int echo(void);                                    /* implemented */
 extern int echochar(const chtype);                     /* generated */
 #ifdef _XOPEN_SOURCE_EXTENDED
 extern int echo_wchar(const cchar_t *);                        /* missing */
+extern int erasewchar(wchar_t*);                       /* missing */
 #endif /* _XOPEN_SOURCE_EXTENDED */
 extern int endwin(void);                               /* implemented */
 extern char erasechar(void);                           /* implemented */
-#ifdef _XOPEN_SOURCE_EXTENDED
-extern int erase_wchar(wchar_t *);                     /* missing */
-#endif /* _XOPEN_SOURCE_EXTENDED */
 extern void filter(void);                              /* implemented */
 extern int flash(void);                                        /* implemented */
 extern int flushinp(void);                             /* implemented */
@@ -427,14 +456,14 @@ extern int getstr(char *);                                /* generated */
 #ifdef _XOPEN_SOURCE_EXTENDED
 extern int get_wch(wint_t *);                          /* missing */
 #endif /* _XOPEN_SOURCE_EXTENDED */
-extern WINDOW *getwin(FILE *);                         /* not in XPG4 */
+extern WINDOW *getwin(FILE *);                         /* implemented */
 #ifdef _XOPEN_SOURCE_EXTENDED
 extern int get_wstr(wint_t *);                         /* missing */
 #endif /* _XOPEN_SOURCE_EXTENDED */
 extern int halfdelay(int);                             /* implemented */
 extern bool has_colors(void);                          /* implemented */
-extern int has_ic(void);                               /* implemented */
-extern int has_il(void);                               /* implemented */
+extern bool has_ic(void);                              /* implemented */
+extern bool has_il(void);                              /* implemented */
 extern int hline(chtype, int);                         /* generated */
 #ifdef _XOPEN_SOURCE_EXTENDED
 extern int hline_set(const cchar_t *, int);            /* missing */
@@ -466,16 +495,16 @@ extern int ins_wstr(const wchar_t *);                     /* missing */
 extern int intrflush(WINDOW *,bool);                   /* implemented */
 #ifdef _XOPEN_SOURCE_EXTENDED
 extern int inwstr(wchar_t *);                          /* missing */
-extern int in_wch(const cchar_t *);                    /* missing */
-extern int in_wchstr(const cchar_t *);                 /* missing */
-extern int in_wchntr(const cchar_t *, int);            /* missing */
+extern int in_wch(NCURSES_CONST cchar_t *);            /* missing */
+extern int in_wchstr(NCURSES_CONST cchar_t *);         /* missing */
+extern int in_wchnstr(NCURSES_CONST cchar_t *, int);   /* missing */
 #endif /* _XOPEN_SOURCE_EXTENDED */
-extern int isendwin(void);                             /* implemented */
-extern int is_linetouched(WINDOW *,int);               /* implemented */
-extern int is_wintouched(WINDOW *);                    /* implemented */
-extern const char *keyname(int);                       /* implemented */
+extern bool isendwin(void);                            /* implemented */
+extern bool is_linetouched(WINDOW *,int);              /* implemented */
+extern bool is_wintouched(WINDOW *);                   /* implemented */
+extern NCURSES_CONST char *keyname(int);               /* implemented */
 #ifdef _XOPEN_SOURCE_EXTENDED
-extern int key_name(wchar_t *);                                /* missing */
+extern char *key_name(wchar_t);                                /* missing */
 #endif /* _XOPEN_SOURCE_EXTENDED */
 extern int keypad(WINDOW *,bool);                      /* implemented */
 extern char killchar(void);                            /* implemented */
@@ -534,13 +563,13 @@ extern int mvins_nwstr(int, int, const wchar_t *, int);   /* missing */
 extern int mvins_wch(int, int, const cchar_t *);       /* missing */
 extern int mvins_wstr(int, int, const wchar_t *);      /* missing */
 extern int mvinwstr(int, int, wchar_t *);              /* missing */
-extern int mvin_wch(int, int, const cchar_t *);                /* missing */
-extern int mvin_wchstr(int, int, const cchar_t *);     /* missing */
-extern int mvin_wchntr(int, int, const cchar_t *, int);        /* missing */
+extern int mvin_wch(int, int, NCURSES_CONST cchar_t *);        /* missing */
+extern int mvin_wchstr(int, int, NCURSES_CONST cchar_t *);     /* missing */
+extern int mvin_wchnstr(int, int, NCURSES_CONST cchar_t *, int);       /* missing */
 #endif /* _XOPEN_SOURCE_EXTENDED */
-extern int mvprintw(int,int,const char *,...)          /* implemented */
+extern int mvprintw(int,int, NCURSES_CONST char *,...) /* implemented */
                GCC_PRINTFLIKE(3,4);
-extern int mvscanw(int,int,const char *,...)           /* implemented */
+extern int mvscanw(int,int, NCURSES_CONST char *,...)  /* implemented */
                GCC_SCANFLIKE(3,4);
 extern int mvvline(int, int, chtype, int);             /* generated */
 #ifdef _XOPEN_SOURCE_EXTENDED
@@ -593,13 +622,13 @@ extern int mvwins_nwstr(WINDOW *, int,int, const wchar_t *,int); /* missing */
 extern int mvwins_wch(WINDOW *, int, int, const cchar_t *);    /* missing */
 extern int mvwins_wstr(WINDOW *, int, int, const wchar_t *);   /* missing */
 extern int mvwinwstr(WINDOW *, int, int, wchar_t *);           /* missing */
-extern int mvwin_wch(WINDOW *, int, int, const cchar_t *);     /* missing */
-extern int mvwin_wchnstr(WINDOW *, int,int,const cchar_t *,int); /* missing */
-extern int mvwin_wchstr(WINDOW *, int, int, const cchar_t *);  /* missing */
+extern int mvwin_wch(WINDOW *, int, int, NCURSES_CONST cchar_t *);     /* missing */
+extern int mvwin_wchnstr(WINDOW *, int,int, NCURSES_CONST cchar_t *,int); /* missing */
+extern int mvwin_wchstr(WINDOW *, int, int, NCURSES_CONST cchar_t *);  /* missing */
 #endif /* _XOPEN_SOURCE_EXTENDED */
-extern int mvwprintw(WINDOW*,int,int,const char *,...) /* implemented */
+extern int mvwprintw(WINDOW*,int,int, NCURSES_CONST char *,...)        /* implemented */
                GCC_PRINTFLIKE(4,5);
-extern int mvwscanw(WINDOW *,int,int,const char *,...) /* implemented */
+extern int mvwscanw(WINDOW *,int,int, NCURSES_CONST char *,...)        /* implemented */
                GCC_SCANFLIKE(4,5);
 extern int mvwvline(WINDOW *,int, int, chtype, int);   /* generated */
 #ifdef _XOPEN_SOURCE_EXTENDED
@@ -607,31 +636,31 @@ extern int mvwvline_set(WINDOW *, int,int, const cchar_t *,int); /* missing */
 #endif /* _XOPEN_SOURCE_EXTENDED */
 extern int napms(int);                                 /* implemented */
 extern WINDOW *newpad(int,int);                                /* implemented */
-extern SCREEN *newterm(const char *,FILE *,FILE *);    /* implemented */
+extern SCREEN *newterm(NCURSES_CONST char *,FILE *,FILE *);    /* implemented */
 extern WINDOW *newwin(int,int,int,int);                        /* implemented */
 extern int nl(void);                                   /* implemented */
 extern int nocbreak(void);                             /* implemented */
 extern int nodelay(WINDOW *,bool);                     /* implemented */
 extern int noecho(void);                               /* implemented */
 extern int nonl(void);                                 /* implemented */
-extern int noqiflush(void);                            /* implemented */
+extern void noqiflush(void);                           /* implemented */
 extern int noraw(void);                                        /* implemented */
 extern int notimeout(WINDOW *,bool);                   /* implemented */
 extern int overlay(const WINDOW*,WINDOW *);            /* implemented */
 extern int overwrite(const WINDOW*,WINDOW *);          /* implemented */
 extern int pair_content(short,short*,short*);          /* implemented */
 extern int PAIR_NUMBER(int);                           /* generated */
-extern int pechochar(WINDOW *, chtype);                        /* implemented */
+extern int pechochar(WINDOW *, const chtype);          /* implemented */
 #ifdef _XOPEN_SOURCE_EXTENDED
 extern int pecho_wchar(WINDOW *, const cchar_t *);     /* missing */
 #endif /* _XOPEN_SOURCE_EXTENDED */
 extern int pnoutrefresh(WINDOW*,int,int,int,int,int,int);/* implemented */
 extern int prefresh(WINDOW *,int,int,int,int,int,int); /* implemented */
-extern int printw(const char *,...)                    /* implemented */
+extern int printw(NCURSES_CONST char *,...)            /* implemented */
                GCC_PRINTFLIKE(1,2);
 extern int putp(const char *);                         /* implemented */
 extern int putwin(WINDOW *, FILE *);                   /* implemented */
-extern int qiflush(void);                              /* implemented */
+extern void qiflush(void);                             /* implemented */
 extern int raw(void);                                  /* implemented */
 extern int redrawwin(WINDOW *);                                /* generated */
 extern int refresh(void);                              /* generated */
@@ -640,7 +669,7 @@ extern int reset_prog_mode(void);                   /* implemented */
 extern int reset_shell_mode(void);                     /* implemented */
 extern int ripoffline(int, int (*init)(WINDOW *, int));        /* implemented */
 extern int savetty(void);                              /* implemented */
-extern int scanw(const char *,...)                     /* implemented */
+extern int scanw(NCURSES_CONST char *,...)             /* implemented */
                GCC_SCANFLIKE(1,2);
 extern int scr_dump(const char *);                     /* implemented */
 extern int scr_init(const char *);                     /* implemented */
@@ -650,24 +679,19 @@ extern int scrollok(WINDOW *,bool);                       /* implemented */
 extern int scr_restore(const char *);                  /* implemented */
 extern int scr_set(const char *);                      /* implemented */
 #ifdef _XOPEN_SOURCE_EXTENDED
-extern int setcchar(cchar_t *, wchar_t *, attr_t, short, const void *);        /* missing */
+extern int setcchar(cchar_t *, const wchar_t *, const attr_t, short, const void *);    /* missing */
 #endif /* _XOPEN_SOURCE_EXTENDED */
 extern int setscrreg(int,int);                         /* generated */
 extern SCREEN *set_term(SCREEN *);                     /* implemented */
-extern int slk_attroff(const attr_t);                  /* implemented */
-#ifdef _XOPEN_SOURCE_EXTENDED
-extern int slk_attr_off(attr_t);                       /* missing */
-#endif /* _XOPEN_SOURCE_EXTENDED */
-extern int slk_attron(const attr_t);                   /* implemented */
-#ifdef _XOPEN_SOURCE_EXTENDED
-extern int slk_attr_on(attr_t);                                /* missing */
-#endif /* _XOPEN_SOURCE_EXTENDED */
-extern int slk_attrset(const attr_t);                  /* implemented */
-extern attr_t slk_attr(void);                           /* implemented */
-#ifdef _XOPEN_SOURCE_EXTENDED
-extern int slk_attr_set(attr_t);                       /* missing */
-#endif /* _XOPEN_SOURCE_EXTENDED */
+extern int slk_attroff(const chtype);                  /* implemented */
+extern int slk_attr_off(const attr_t, void *);         /* generated:WIDEC */
+extern int slk_attron(const chtype);                   /* implemented */
+extern int slk_attr_on(attr_t,void*);                  /* generated:WIDEC */
+extern int slk_attrset(const chtype);                  /* implemented */
+extern attr_t slk_attr(void);                          /* implemented */
+extern int slk_attr_set(const attr_t,short,void*);     /* implemented */
 extern int slk_clear(void);                            /* implemented */
+extern int slk_color(short);                           /* implemented */
 extern int slk_init(int);                              /* implemented */
 extern char *slk_label(int);                           /* implemented */
 extern int slk_noutrefresh(void);                      /* implemented */
@@ -676,7 +700,7 @@ extern int slk_restore(void);                               /* implemented */
 extern int slk_set(int,const char *,int);              /* implemented */
 extern int slk_touch(void);                            /* implemented */
 #ifdef _XOPEN_SOURCE_EXTENDED
-extern int slk_wset(int, wchar_t *, int);              /* missing */
+extern int slk_wset(int, const wchar_t *, int);                /* missing */
 #endif /* _XOPEN_SOURCE_EXTENDED */
 extern int standout(void);                             /* generated */
 extern int standend(void);                             /* generated */
@@ -684,35 +708,35 @@ extern int start_color(void);                             /* implemented */
 extern WINDOW *subpad(WINDOW *, int, int, int, int);   /* implemented */
 extern WINDOW *subwin(WINDOW *,int,int,int,int);       /* implemented */
 extern int syncok(WINDOW *, bool);                     /* implemented */
-extern attr_t termattrs(void);                         /* implemented */
+extern chtype termattrs(void);                         /* implemented */
+extern attr_t term_attrs(void);                                /* missing */
 extern char *termname(void);                           /* implemented */
-extern int tigetflag(const char *);                    /* implemented */
-extern int tigetnum(const char *);                     /* implemented */
-extern char *tigetstr(const char *);                   /* implemented */
-extern int timeout(int);                               /* generated */
+extern int tigetflag(NCURSES_CONST char *);            /* implemented */
+extern int tigetnum(NCURSES_CONST char *);             /* implemented */
+extern char *tigetstr(NCURSES_CONST char *);           /* implemented */
+extern void timeout(int);                              /* generated */
+extern char *tparm(NCURSES_CONST char *, ...);         /* implemented */
 extern int typeahead(int);                             /* implemented */
 extern int ungetch(int);                               /* implemented */
 #ifdef _XOPEN_SOURCE_EXTENDED
-extern int unget_wch(const wchar_t *);                 /* missing */
+extern int unget_wch(const wchar_t);                   /* missing */
 #endif /* _XOPEN_SOURCE_EXTENDED */
 extern int untouchwin(WINDOW *);                       /* generated */
 extern void use_env(bool);                             /* implemented */
 extern int vidattr(chtype);                            /* implemented */
-#ifdef _XOPEN_SOURCE_EXTENDED
-extern int vid_attr(attr_t);                           /* missing */
-#endif /* _XOPEN_SOURCE_EXTENDED */
+extern int vid_attr(attr_t, short, void *);            /* generated:WIDEC */
 extern int vidputs(chtype, int (*)(int));              /* implemented */
 #ifdef _XOPEN_SOURCE_EXTENDED
-extern int vid_puts(attr_t, int (*)(int));             /* missing */
+extern int vid_puts(attr_t, short, void *, int (*)(int)); /* missing */
 #endif /* _XOPEN_SOURCE_EXTENDED */
 extern int vline(chtype, int);                         /* generated */
 #ifdef _XOPEN_SOURCE_EXTENDED
 extern int vline_set(const cchar_t *, int);            /* missing */
 #endif /* _XOPEN_SOURCE_EXTENDED */
-extern int vwprintw(WINDOW *,const char *,va_list);    /* implemented */
-extern int vw_printw(WINDOW *,const char *,va_list);   /* generated */
-extern int vwscanw(WINDOW *,const char *,va_list);     /* implemented */
-extern int vw_scanw(WINDOW *,const char *,va_list);    /* generated */
+extern int vwprintw(WINDOW *, NCURSES_CONST char *,va_list);   /* implemented */
+extern int vw_printw(WINDOW *, NCURSES_CONST char *,va_list);  /* generated */
+extern int vwscanw(WINDOW *, NCURSES_CONST char *,va_list);    /* implemented */
+extern int vw_scanw(WINDOW *, NCURSES_CONST char *,va_list);   /* generated */
 extern int waddch(WINDOW *, const chtype);             /* implemented */
 extern int waddchnstr(WINDOW *,const chtype *const,int); /* implemented */
 extern int waddchstr(WINDOW *,const chtype *);         /* generated */
@@ -720,6 +744,7 @@ extern int waddnstr(WINDOW *,const char *const,int);        /* implemented */
 extern int waddstr(WINDOW *,const char *);             /* generated */
 #ifdef _XOPEN_SOURCE_EXTENDED
 extern int waddwstr(WINDOW *,const wchar_t *);         /* missing */
+extern int waddnwstr(WINDOW *,const wchar_t *,int);    /* missing */
 extern int wadd_wch(WINDOW *,const cchar_t *);         /* missing */
 extern int wadd_wchnstr(WINDOW *,const cchar_t *,int); /* missing */
 extern int wadd_wchstr(WINDOW *,const cchar_t *);      /* missing */
@@ -727,24 +752,25 @@ extern int wadd_wchstr(WINDOW *,const cchar_t *); /* missing */
 extern int wattron(WINDOW *, int);                     /* generated */
 extern int wattroff(WINDOW *, int);                    /* generated */
 extern int wattrset(WINDOW *, int);                    /* generated */
-extern attr_t wattr_get(WINDOW *);                     /* generated */
-extern int wattr_on(WINDOW *, const attr_t);           /* implemented */
-extern int wattr_off(WINDOW *, const attr_t);          /* implemented */
-extern int wattr_set(WINDOW *, attr_t);                        /* generated */
+extern int wattr_get(WINDOW *, attr_t *, short *, void *);     /* generated */
+extern int wattr_on(WINDOW *, NCURSES_CONST attr_t, void *);   /* implemented */
+extern int wattr_off(WINDOW *, NCURSES_CONST attr_t, void *);  /* implemented */
+extern int wattr_set(WINDOW *, attr_t, short, void *);         /* generated */
 extern int wbkgd(WINDOW *,const chtype);               /* implemented */
-extern void wbkgdset(WINDOW *,chtype);                 /* generated */
+extern void wbkgdset(WINDOW *,chtype);                 /* implemented */
 #ifdef _XOPEN_SOURCE_EXTENDED
-extern int wbkgrndset(WINDOW *,const cchar_t *);       /* missing */
+extern void wbkgrndset(WINDOW *,const cchar_t *);      /* missing */
 extern int wbkgrnd(WINDOW *,const cchar_t *);          /* missing */
 #endif /* _XOPEN_SOURCE_EXTENDED */
 extern int wborder(WINDOW *,chtype,chtype,chtype,chtype,chtype,chtype,chtype,chtype);  /* implemented */
 #ifdef _XOPEN_SOURCE_EXTENDED
-extern int wborder_set(WINDOW *,cchar_t,cchar_t,cchar_t,cchar_t,cchar_t,cchar_t,cchar_t,cchar_t);      /* missing */
+extern int wborder_set(WINDOW *,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*);      /* missing */
 #endif /* _XOPEN_SOURCE_EXTENDED */
 extern int wchgat(WINDOW *, int, attr_t, short, const void *);/* implemented */
 extern int wclear(WINDOW *);                           /* implemented */
 extern int wclrtobot(WINDOW *);                                /* implemented */
 extern int wclrtoeol(WINDOW *);                                /* implemented */
+extern int wcolor_set(WINDOW*,short,void*);            /* implemented */
 extern void wcursyncup(WINDOW *);                      /* implemented */
 extern int wdelch(WINDOW *);                           /* implemented */
 extern int wdeleteln(WINDOW *);                                /* generated */
@@ -770,7 +796,7 @@ extern int whline(WINDOW *, chtype, int);           /* implemented */
 #ifdef _XOPEN_SOURCE_EXTENDED
 extern int whline_set(WINDOW *, const cchar_t *, int); /* missing */
 #endif /* _XOPEN_SOURCE_EXTENDED */
-extern chtype winch(WINDOW *);                         /* generated */
+extern chtype winch(WINDOW *);                         /* implemented */
 extern int winchnstr(WINDOW *, chtype *, int);         /* implemented */
 extern int winchstr(WINDOW *, chtype *);               /* generated */
 extern int winnstr(WINDOW *, char *, int);             /* implemented */
@@ -788,17 +814,17 @@ extern int wins_nwstr(WINDOW *, const wchar_t *, int);    /* missing */
 extern int wins_wch(WINDOW *, const cchar_t *);                /* missing */
 extern int wins_wstr(WINDOW *, const wchar_t *);       /* missing */
 extern int winwstr(WINDOW *, wchar_t *);               /* missing */
-extern int win_wch(WINDOW *, const cchar_t *);         /* missing */
-extern int win_wchnstr(WINDOW *, const cchar_t *, int);        /* missing */
-extern int win_wchstr(WINDOW *, const cchar_t *);      /* missing */
+extern int win_wch(WINDOW *, NCURSES_CONST cchar_t *); /* missing */
+extern int win_wchnstr(WINDOW *, NCURSES_CONST cchar_t *, int);        /* missing */
+extern int win_wchstr(WINDOW *, NCURSES_CONST cchar_t *);      /* missing */
 #endif /* _XOPEN_SOURCE_EXTENDED */
 extern int wmove(WINDOW *,int,int);                    /* implemented */
 extern int wnoutrefresh(WINDOW *);                     /* implemented */
-extern int wprintw(WINDOW *,const char *,...)          /* implemented */
+extern int wprintw(WINDOW *, NCURSES_CONST char *,...) /* implemented */
                GCC_PRINTFLIKE(2,3);
 extern int wredrawln(WINDOW *,int,int);                        /* implemented */
 extern int wrefresh(WINDOW *);                         /* implemented */
-extern int wscanw(WINDOW *,const char *,...)           /* implemented */
+extern int wscanw(WINDOW *, NCURSES_CONST char *,...)  /* implemented */
                GCC_SCANFLIKE(2,3);
 extern int wscrl(WINDOW *,int);                                /* implemented */
 extern int wsetscrreg(WINDOW *,int,int);               /* implemented */
@@ -806,38 +832,58 @@ extern int wstandout(WINDOW *);                           /* generated */
 extern int wstandend(WINDOW *);                                /* generated */
 extern void wsyncdown(WINDOW *);                       /* implemented */
 extern void wsyncup(WINDOW *);                         /* implemented */
-extern int wtimeout(WINDOW *,int);                     /* implemented */
+extern void wtimeout(WINDOW *,int);                    /* implemented */
 extern int wtouchln(WINDOW *,int,int,int);             /* implemented */
 #ifdef _XOPEN_SOURCE_EXTENDED
-extern wchar_t wunctrl(cchar_t *);                     /* missing */
+extern wchar_t *wunctrl(cchar_t *);                    /* missing */
 #endif /* _XOPEN_SOURCE_EXTENDED */
 extern int wvline(WINDOW *,chtype,int);                        /* implemented */
 #ifdef _XOPEN_SOURCE_EXTENDED
 extern int wvline_set(WINDOW *, const cchar_t *, int); /* missing */
 #endif /* _XOPEN_SOURCE_EXTENDED */
 
+extern bool mouse_trafo(int*, int*, bool);              /* generated */
+
 /* attributes */
-#define A_ATTRIBUTES   0xffffff00
-#define A_NORMAL       0x00000000
-#define A_STANDOUT     0x00010000
-#define A_UNDERLINE    0x00020000
-#define A_REVERSE      0x00040000
-#define A_BLINK                0x00080000
-#define A_DIM          0x00100000
-#define A_BOLD         0x00200000
-#define A_ALTCHARSET   0x00400000
-#define A_INVIS                0x00800000
-#define A_PROTECT      0x01000000
-#define A_HORIZONTAL   0x02000000      /* XSI Curses attr -- not yet used */
-#define A_LEFT         0x04000000      /* XSI Curses attr -- not yet used */
-#define A_LOW          0x08000000      /* XSI Curses attr -- not yet used */
-#define A_RIGHT                0x10000000      /* XSI Curses attr -- not yet used */
-#define A_TOP          0x20000000      /* XSI Curses attr -- not yet used */
-#define A_VERTICAL     0x40000000      /* XSI Curses attr -- not yet used */
-#define A_CHARTEXT     0x000000ff
-#define A_COLOR                0x0000ff00
-#define COLOR_PAIR(n)  ((n) << 8)
-#define PAIR_NUMBER(a) (((a) & A_COLOR) >> 8)
+
+#define NCURSES_BITS(mask,shift) ((mask) << ((shift) + @cf_cv_widec_shift@))
+
+#define A_NORMAL       0L
+#define A_ATTRIBUTES   NCURSES_BITS(~(@cf_cv_1UL@ - @cf_cv_1UL@),0)
+#define A_CHARTEXT     (NCURSES_BITS(@cf_cv_1UL@,0) - @cf_cv_1UL@)
+#define A_COLOR                NCURSES_BITS(((@cf_cv_1UL@) << 8) - @cf_cv_1UL@,0)
+#define A_STANDOUT     NCURSES_BITS(@cf_cv_1UL@,8)
+#define A_UNDERLINE    NCURSES_BITS(@cf_cv_1UL@,9)
+#define A_REVERSE      NCURSES_BITS(@cf_cv_1UL@,10)
+#define A_BLINK                NCURSES_BITS(@cf_cv_1UL@,11)
+#define A_DIM          NCURSES_BITS(@cf_cv_1UL@,12)
+#define A_BOLD         NCURSES_BITS(@cf_cv_1UL@,13)
+#define A_ALTCHARSET   NCURSES_BITS(@cf_cv_1UL@,14)
+#define A_INVIS                NCURSES_BITS(@cf_cv_1UL@,15)
+
+/* Tradeoff on 32-bit machines ('protect' vs widec).  The others (e.g., left
+ * highlight are not implemented in any terminal descriptions, anyway.
+ */
+#if ((16 + @cf_cv_widec_shift@) < @cf_cv_shift_limit@)
+#define A_PROTECT      NCURSES_BITS(@cf_cv_1UL@,16)
+#define A_HORIZONTAL   NCURSES_BITS(@cf_cv_1UL@,17)
+#define A_LEFT         NCURSES_BITS(@cf_cv_1UL@,18)
+#define A_LOW          NCURSES_BITS(@cf_cv_1UL@,19)
+#define A_RIGHT                NCURSES_BITS(@cf_cv_1UL@,20)
+#define A_TOP          NCURSES_BITS(@cf_cv_1UL@,21)
+#define A_VERTICAL     NCURSES_BITS(@cf_cv_1UL@,22)
+#else
+#define A_PROTECT      0L
+#define A_HORIZONTAL   0L
+#define A_LEFT         0L
+#define A_LOW          0L
+#define A_RIGHT                0L
+#define A_TOP          0L
+#define A_VERTICAL     0L
+#endif
+
+#define COLOR_PAIR(n)  NCURSES_BITS(n, 0)
+#define PAIR_NUMBER(a) (((a) & A_COLOR) >> @cf_cv_widec_shift@)
 
 /*
  * pseudo functions
@@ -854,37 +900,41 @@ extern int wvline_set(WINDOW *, const cchar_t *, int);    /* missing */
 #define nocrmode()             nocbreak()
 #define gettmode()
 
-#define getyx(win,y,x)         (y = (win)->_cury, x = (win)->_curx)
-#define getbegyx(win,y,x)      (y = (win)->_begy, x = (win)->_begx)
-#define getmaxyx(win,y,x)      (y = (win)->_maxy + 1, x = (win)->_maxx + 1)
-#define getparyx(win,y,x)      (y = (win)->_pary, x = (win)->_parx)
-#define getsyx(y,x)            getyx(stdscr, y, x)
-#define setsyx(y,x)            (stdscr->_cury = y, stdscr->_curx = x)
-
-#define        wbkgdset(win, ch) \
-       (((win)->_attrs = (((win)->_attrs & ~((win)->_bkgd & A_ATTRIBUTES)) | \
-           ((ch) & A_ATTRIBUTES))), \
-           ((win)->_bkgd = (ch)))
+#define getyx(win,y,x)         (y = (win)?(win)->_cury:ERR, x = (win)?(win)->_curx:ERR)
+#define getbegyx(win,y,x)      (y = (win)?(win)->_begy:ERR, x = (win)?(win)->_begx:ERR)
+#define getmaxyx(win,y,x)      (y = (win)?((win)->_maxy + 1):ERR, x = (win)?((win)->_maxx + 1):ERR)
+#define getparyx(win,y,x)      (y = (win)?(win)->_pary:ERR, x = (win)?(win)->_parx:ERR)
+#define getsyx(y,x) do { if(newscr->_leaveok) (y)=(x)=-1; \
+                        else getyx(newscr,(y),(x)); \
+                   } while(0)
+#define setsyx(y,x) do { if((y)==-1 && (x)==-1) newscr->_leaveok=TRUE; \
+                        else {newscr->_leaveok=FALSE;wmove(newscr,(y),(x));} \
+                   } while(0)
 
 /* It seems older SYSV curses versions define these */
-#define getattrs(win)          ((win)->_attrs)
-#define getmaxx(win)           ((win)->_maxx + 1)
-#define getmaxy(win)           ((win)->_maxy + 1)
-
-#define winch(win)             ((win)->_line[(win)->_cury].text[(win)->_curx])
-#define wstandout(win)         (wattr_set(win,A_STANDOUT))
-#define wstandend(win)         (wattr_set(win,A_NORMAL))
-#define wattr_set(win,at)      ((win)->_attrs = (at))
-
-#define wattron(win,at)                wattr_on(win, at)
-#define wattroff(win,at)       wattr_off(win, at)
-#define wattrset(win,at)       wattr_set(win, at)
+#define getattrs(win)          ((win)?(win)->_attrs:A_NORMAL)
+#define getcurx(win)           ((win)?(win)->_curx:ERR)
+#define getcury(win)           ((win)?(win)->_cury:ERR)
+#define getbegx(win)           ((win)?(win)->_begx:ERR)
+#define getbegy(win)           ((win)?(win)->_begy:ERR)
+#define getmaxx(win)           ((win)?((win)->_maxx + 1):ERR)
+#define getmaxy(win)           ((win)?((win)->_maxy + 1):ERR)
+#define getparx(win)           ((win)?(win)->_parx:ERR)
+#define getpary(win)           ((win)?(win)->_pary:ERR)
+
+#define wstandout(win)         (wattrset(win,A_STANDOUT))
+#define wstandend(win)         (wattrset(win,A_NORMAL))
+#define wattr_set(win,a,p,opts) ((win)->_attrs = (((a) & ~A_COLOR) | COLOR_PAIR(p)), OK)
+
+#define wattron(win,at)                wattr_on(win, at, (void *)0)
+#define wattroff(win,at)       wattr_off(win, at, (void *)0)
+#define wattrset(win,at)       ((win)->_attrs = (at))
 
 #define scroll(win)            wscrl(win,1)
 
-#define touchwin(win)          wtouchln((win), 0, (win)->_maxy + 1, 1)
+#define touchwin(win)          wtouchln((win), 0, getmaxy(win), 1)
 #define touchline(win, s, c)   wtouchln((win), s, c, 1)
-#define untouchwin(win)                wtouchln((win), 0, (win)->_maxy + 1, 0)
+#define untouchwin(win)                wtouchln((win), 0, getmaxy(win), 0)
 
 #define box(win, v, h)         wborder(win, v, v, h, h, 0, 0, 0, 0)
 #define border(ls, rs, ts, bs, tl, tr, bl, br) wborder(stdscr, ls, rs, ts, bs, tl, tr, bl, br)
@@ -916,6 +966,7 @@ extern int wvline_set(WINDOW *, const cchar_t *, int);      /* missing */
 #define clear()                        wclear(stdscr)
 #define clrtobot()                     wclrtobot(stdscr)
 #define clrtoeol()                     wclrtoeol(stdscr)
+#define color_set(c,o)         wcolor_set(stdscr,c,o)
 #define delch()                        wdelch(stdscr)
 #define deleteln()                     winsdelln(stdscr,-1)
 #define echochar(c)            wechochar(stdscr,c)
@@ -994,14 +1045,14 @@ extern int wvline_set(WINDOW *, const cchar_t *, int);   /* missing */
  * winnwstr(), wins_nwstr(), wins_wch(), win_wch(), win_wchnstr().
  * Except for wchgat(), these are not yet implemented.  They will be someday.
  */
-#define add_wch(c)                     wadd_wch(stsdscr,c)
+#define add_wch(c)                     wadd_wch(stdscr,c)
 #define addnwstr(wstr,n)               waddnwstr(stdscr,wstr,n)
 #define addwstr(wstr,n)                        waddnwstr(stdscr,wstr,-1)
-#define attr_get()                     wattr_get(stdscr)
-#define attr_off(a)                    wattr_off(stdscr,a)
-#define attr_on(a)                     wattr_on(stdscr,a)
-#define attr_set(a)                    wattr_set(stdscr,a)
-#define box_set(w,v,h)                 wborder_set(w,v,v,h,h,0,0,0,9)
+#define attr_get(a,pair,opts)          wattr_get(stdscr,a,pair,opts)
+#define attr_off(a,opts)               wattr_off(stdscr,a,opts)
+#define attr_on(a,opts)                        wattr_on(stdscr,a,opts)
+#define attr_set(a,pair,opts)          wattr_set(stdscr,a,pair,opts)
+#define box_set(w,v,h)                 wborder_set(w,v,v,h,h,0,0,0,0)
 #define chgat(n,a,c,o)                 wchgat(stdscr,n,a,c,o)
 #define echo_wchar(c)                  wecho_wchar(stdscr,c)
 #define getbkgd(win)                   ((win)->_bkgd)
@@ -1036,11 +1087,11 @@ extern int wvline_set(WINDOW *, const cchar_t *, int);  /* missing */
 #define mvinwstr(y,x,c)                        mvwinnwstr(stdscr,y,x,c,-1)
 #define mvvline_set(y,x,c,n)           mvwvline_set(stdscr,y,x,c,n)
 
-#define mvwadd_wch(y,x,win,c)          (wmove(win,y,x) == ERR ? ERR : wadd_wch(stsdscr,c))
-#define mvwaddnwstr(y,x,win,wstr,n)    (wmove(win,y,x) == ERR ? ERR : waddnwstr(stdscr,wstr,n))
-#define mvwaddwstr(y,x,win,wstr,n)     (wmove(win,y,x) == ERR ? ERR : waddnwstr(stdscr,wstr,-1))
+#define mvwadd_wch(win,y,x,c)          (wmove(win,y,x) == ERR ? ERR : wadd_wch(stdscr,c))
+#define mvwaddnwstr(win,y,x,wstr,n)    (wmove(win,y,x) == ERR ? ERR : waddnwstr(stdscr,wstr,n))
+#define mvwaddwstr(win,y,x,wstr,n)     (wmove(win,y,x) == ERR ? ERR : waddnwstr(stdscr,wstr,-1))
 #define mvwchgat(win,y,x,n,a,c,o)      (wmove(win,y,x) == ERR ? ERR : wchgat(win,n,a,c,o))
-#define mvwget_wch(win,y,x,c)          (wmove(win,y,x) == ERR ? ERR : wget_wch(win,n))
+#define mvwget_wch(win,y,x,c)          (wmove(win,y,x) == ERR ? ERR : wget_wch(win,c))
 #define mvwget_wstr(win,y,x,t)         (wmove(win,y,x) == ERR ? ERR : wgetn_wstr(win,t,-1))
 #define mvwgetn_wstr(win,y,x,t,n)      (wmove(win,y,x) == ERR ? ERR : wgetn_wstr(win,t,n))
 #define mvwhline_set(win,y,x,c,n)      (wmove(win,y,x) == ERR ? ERR : whline_set(win,c,n))
@@ -1049,14 +1100,20 @@ extern int wvline_set(WINDOW *, const cchar_t *, int);  /* missing */
 #define mvwin_wchstr(win,y,x,c)                (wmove(win,y,x) == ERR ? ERR : win_wchnstr(stdscr,c,-1))
 #define mvwinnwstr(win,y,x,c,n)                (wmove(win,y,x) == ERR ? ERR : winnwstr(stdscr,c,n))
 #define mvwins_nwstr(win,y,x,t,n)      (wmove(win,y,x) == ERR ? ERR : wins_nwstr(stdscr,t,n))
-#define mvwins_wch(win,y,x,c)          (wmove(win,y,x) == ERR ? ERR : wins_wch(c))
+#define mvwins_wch(win,y,x,c)          (wmove(win,y,x) == ERR ? ERR : wins_wch(stdscr,c))
 #define mvwins_wstr(win,y,x,t)         (wmove(win,y,x) == ERR ? ERR : wins_nwstr(stdscr,t,-1))
 #define mvwinwstr(win,y,x,c)           (wmove(win,y,x) == ERR ? ERR : winnwstr(stdscr,c,-1))
 #define mvwvline_set(win,y,x,c,n)      (wmove(win,y,x) == ERR ? ERR : wvline_set(win,c,n))
 
-#define vline_set(c,n)                 vhline_set(stdscr,c,n)
+#define slk_attr_off(a,v)              ((v) ? ERR : slk_attroff(a))
+#define slk_attr_on(a,v)               ((v) ? ERR : slk_attron(a))
+
+#define vid_attr(a,pair,opts)          vidattr(a)
+#define vline_set(c,n)                 wvline_set(stdscr,c,n)
 #define waddwstr(win,wstr,n)           waddnwstr(win,wstr,-1)
-#define wattr_get(win)                 ((win)->_attrs)
+#define wattr_get(win,a,p,opts)                ((void)((a) != 0 && (*(a) = (win)->_attrs)), \
+                                        (void)((p) != 0 && (*(p) = PAIR_NUMBER((win)->_attrs))), \
+                                        OK)
 #define wget_wstr(w,t)                 wgetn_wstr(w,t,-1)
 #define win_wchstr(w,c)                        win_wchnstr(w,c,-1)
 #define wins_wstr(w,t)                 wins_nwstr(w,t,-1)
@@ -1176,6 +1233,7 @@ extern int wvline_set(WINDOW *, const cchar_t *, int);    /* missing */
 #define KEY_SUSPEND    0627            /* Suspend */
 #define KEY_UNDO       0630            /* Undo */
 #define KEY_MOUSE      0631            /* Mouse event has occurred */
+#define KEY_RESIZE     0632            /* Terminal resize event */
 #define KEY_MAX                0777            /* Maximum key value */
 
 /* mouse interface */
@@ -1233,8 +1291,11 @@ MEVENT;
 extern int getmouse(MEVENT *);
 extern int ungetmouse(MEVENT *);
 extern mmask_t mousemask(mmask_t, mmask_t *);
-extern bool wenclose(WINDOW *, int, int);
+extern bool wenclose(const WINDOW *, int, int);
 extern int mouseinterval(int);
+extern bool wmouse_trafo(const WINDOW* win,int* y, int* x, bool to_screen);
+
+#define mouse_trafo(y,x,to_screen) wmouse_trafo(stdscr,y,x,to_screen)
 
 /* other non-XSI functions */
 
@@ -1247,7 +1308,7 @@ extern void _tracef(const char *, ...) GCC_PRINTFLIKE(1,2);
 extern void _tracedump(const char *, WINDOW *);
 extern char *_traceattr(attr_t);
 extern char *_traceattr2(int, chtype);
-extern char *_tracebits(void);
+extern char *_nc_tracebits(void);
 extern char *_tracechar(const unsigned char);
 extern char *_tracechtype(chtype);
 extern char *_tracechtype2(int, chtype);
@@ -1272,6 +1333,7 @@ extern void trace(const unsigned int);
 
 #if defined(TRACE) || defined(NCURSES_TEST)
 extern int _nc_optimize_enable;                /* enable optimizations */
+extern const char *_nc_visbuf(const char *);
 #define OPTIMIZE_MVCUR         0x01    /* cursor movement optimization */
 #define OPTIMIZE_HASHMAP       0x02    /* diff hashing to detect scrolls */
 #define OPTIMIZE_SCROLL                0x04    /* scroll optimization */