Index: /trunk/nv/lib/curses.hh
===================================================================
--- /trunk/nv/lib/curses.hh	(revision 218)
+++ /trunk/nv/lib/curses.hh	(revision 218)
@@ -0,0 +1,57 @@
+// Copyright (C) 2013 ChaosForge / Kornel Kisielewicz
+// http://chaosforge.org/
+//
+// This file is part of NV Libraries.
+// For conditions of distribution and use, see copyright notice in nv.hh
+
+#ifndef NV_LIB_CURSES_HH
+#define NV_LIB_CURSES_HH
+
+#include <nv/common.hh>
+
+#define NV_CURSES_DYNAMIC
+//#define NV_CURSES_SHARED
+
+#if NV_PLATFORM == NV_WINDOWS
+#	define NV_CURSES_PATH "pdcurses.dll"
+#elif NV_PLATFORM == NV_APPLE
+#	define NV_CURSES_PATH ""
+#else
+#	define NV_CURSES_PATH ""
+#endif
+
+extern "C" {
+
+#if defined(NV_CURSES_SHARED) && (NV_PLATFORM == NV_WINDOWS)
+#	define NV_CURSES_API __declspec(dllimport)
+#else
+#	define NV_CURSES_API extern
+#endif
+
+#include <stdarg.h>
+#include <stddef.h>
+#include <wchar.h>
+
+#include <nv/lib/detail/curses_types.inc>
+
+#if defined(NV_CURSES_DYNAMIC)
+#	define NV_CURSES_FUN( rtype, fname, fparams ) NV_CURSES_API rtype ( *fname) fparams
+#else
+#	define NV_CURSES_FUN( rtype, fname, fparams ) NV_CURSES_API rtype fname fparams
+#endif
+
+#include <nv/lib/detail/curses_functions.inc>
+
+#undef NV_CURSES_FUN
+}
+
+namespace nv {
+	/* Dynamic load support */
+#	if defined( NV_CURSES_DYNAMIC )
+	bool load_curses_library( const char* path = NV_CURSES_PATH );
+#	else
+	inline bool load_curses_library( const char* path = "" ) { return true; }
+#	endif
+}
+
+#endif // NV_LIB_CURSES_HH
Index: /trunk/nv/lib/detail/curses_functions.inc
===================================================================
--- /trunk/nv/lib/detail/curses_functions.inc	(revision 218)
+++ /trunk/nv/lib/detail/curses_functions.inc	(revision 218)
@@ -0,0 +1,456 @@
+NV_CURSES_FUN( int     , addch, (const chtype) );
+NV_CURSES_FUN( int     , addchnstr, (const chtype *, int) );
+NV_CURSES_FUN( int     , addchstr, (const chtype *) );
+NV_CURSES_FUN( int     , addnstr, (const char *, int) );
+NV_CURSES_FUN( int     , addstr, (const char *) );
+NV_CURSES_FUN( int     , attroff, (chtype) );
+NV_CURSES_FUN( int     , attron, (chtype) );
+NV_CURSES_FUN( int     , attrset, (chtype) );
+NV_CURSES_FUN( int     , attr_get, (attr_t *, short *, void *) );
+NV_CURSES_FUN( int     , attr_off, (attr_t, void *) );
+NV_CURSES_FUN( int     , attr_on, (attr_t, void *) );
+NV_CURSES_FUN( int     , attr_set, (attr_t, short, void *) );
+NV_CURSES_FUN( int     , baudrate, (void) );
+NV_CURSES_FUN( int     , beep, (void) );
+NV_CURSES_FUN( int     , bkgd, (chtype) );
+NV_CURSES_FUN( void    , bkgdset, (chtype) );
+NV_CURSES_FUN( int     , border, (chtype, chtype, chtype, chtype, chtype, chtype, chtype, chtype) );
+NV_CURSES_FUN( int     , box, (WINDOW *, chtype, chtype) );
+NV_CURSES_FUN( BOOL    , can_change_color, (void) );
+NV_CURSES_FUN( int     , cbreak, (void) ); 
+NV_CURSES_FUN( int     , chgat, (int, attr_t, short, const void *) );
+NV_CURSES_FUN( int     , clearok, (WINDOW *, BOOL) );
+NV_CURSES_FUN( int     , clear, (void) );
+NV_CURSES_FUN( int     , clrtobot, (void) );
+NV_CURSES_FUN( int     , clrtoeol, (void) );
+NV_CURSES_FUN( int     , color_content, (short, short *, short *, short *) );
+NV_CURSES_FUN( int     , color_set, (short, void *) );
+NV_CURSES_FUN( int     , copywin, (const WINDOW *, WINDOW *, int, int, int, int, int, int, int) );
+NV_CURSES_FUN( int     , curs_set, (int) );
+NV_CURSES_FUN( int     , def_prog_mode, (void) );
+NV_CURSES_FUN( int     , def_shell_mode, (void) );
+NV_CURSES_FUN( int     , delay_output, (int) );
+NV_CURSES_FUN( int     , delch, (void) );
+NV_CURSES_FUN( int     , deleteln, (void) );
+NV_CURSES_FUN( void    , delscreen, (SCREEN *) ); 
+NV_CURSES_FUN( int     , delwin, (WINDOW *) );
+NV_CURSES_FUN( WINDOW *, derwin, (WINDOW *, int, int, int, int) );
+NV_CURSES_FUN( int     , doupdate, (void) );
+NV_CURSES_FUN( WINDOW *, dupwin, (WINDOW *) );
+NV_CURSES_FUN( int     , echochar, (const chtype) );
+NV_CURSES_FUN( int     , echo, (void) );
+NV_CURSES_FUN( int     , endwin, (void) );
+NV_CURSES_FUN( char    , erasechar, (void) );
+NV_CURSES_FUN( int     , erase, (void) );
+NV_CURSES_FUN( void    , filter, (void) );
+NV_CURSES_FUN( int     , flash, (void) );
+NV_CURSES_FUN( int     , flushinp, (void) );
+NV_CURSES_FUN( chtype  , getbkgd, (WINDOW *) );
+NV_CURSES_FUN( int     , getnstr, (char *, int) );
+NV_CURSES_FUN( int     , getstr, (char *) );
+NV_CURSES_FUN( WINDOW *, getwin, (FILE *) );
+NV_CURSES_FUN( int     , halfdelay, (int) );
+NV_CURSES_FUN( BOOL    , has_colors, (void) );
+NV_CURSES_FUN( BOOL    , has_ic, (void) );
+NV_CURSES_FUN( BOOL    , has_il, (void) );
+NV_CURSES_FUN( int     , hline, (chtype, int) );
+NV_CURSES_FUN( void    , idcok, (WINDOW *, BOOL) );
+NV_CURSES_FUN( int     , idlok, (WINDOW *, BOOL) );
+NV_CURSES_FUN( void    , immedok, (WINDOW *, BOOL) );
+NV_CURSES_FUN( int     , inchnstr, (chtype *, int) );
+NV_CURSES_FUN( int     , inchstr, (chtype *) );
+NV_CURSES_FUN( chtype  , inch, (void) );
+NV_CURSES_FUN( int     , init_color, (short, short, short, short) );
+NV_CURSES_FUN( int     , init_pair, (short, short, short) );
+NV_CURSES_FUN( WINDOW *, initscr, (void) );
+NV_CURSES_FUN( int     , innstr, (char *, int) );
+NV_CURSES_FUN( int     , insch, (chtype) );
+NV_CURSES_FUN( int     , insdelln, (int) );
+NV_CURSES_FUN( int     , insertln, (void) );
+NV_CURSES_FUN( int     , insnstr, (const char *, int) );
+NV_CURSES_FUN( int     , insstr, (const char *) );
+NV_CURSES_FUN( int     , instr, (char *) );
+NV_CURSES_FUN( int     , intrflush, (WINDOW *, BOOL) );
+NV_CURSES_FUN( BOOL    , isendwin, (void) );
+NV_CURSES_FUN( BOOL    , is_linetouched, (WINDOW *, int) );
+NV_CURSES_FUN( BOOL    , is_wintouched, (WINDOW *) );
+NV_CURSES_FUN( char   *, keyname, (int) );
+NV_CURSES_FUN( int     , keypad, (WINDOW *, BOOL) );
+NV_CURSES_FUN( char    , killchar, (void) );
+NV_CURSES_FUN( int     , leaveok, (WINDOW *, BOOL) );
+NV_CURSES_FUN( char   *, longname, (void) );
+NV_CURSES_FUN( int     , meta, (WINDOW *, BOOL) );
+NV_CURSES_FUN( int     , move, (int, int) );
+NV_CURSES_FUN( int     , mvaddch, (int, int, const chtype) );
+NV_CURSES_FUN( int     , mvaddchnstr, (int, int, const chtype *, int) );
+NV_CURSES_FUN( int     , mvaddchstr, (int, int, const chtype *) );
+NV_CURSES_FUN( int     , mvaddnstr, (int, int, const char *, int) );
+NV_CURSES_FUN( int     , mvaddstr, (int, int, const char *) );
+NV_CURSES_FUN( int     , mvchgat, (int, int, int, attr_t, short, const void *) );
+NV_CURSES_FUN( int     , mvcur, (int, int, int, int) );
+NV_CURSES_FUN( int     , mvdelch, (int, int) );
+NV_CURSES_FUN( int     , mvderwin, (WINDOW *, int, int) );
+NV_CURSES_FUN( int     , mvgetch, (int, int) );
+NV_CURSES_FUN( int     , mvgetnstr, (int, int, char *, int) );
+NV_CURSES_FUN( int     , mvgetstr, (int, int, char *) );
+NV_CURSES_FUN( int     , mvhline, (int, int, chtype, int) );
+NV_CURSES_FUN( chtype  , mvinch, (int, int) );
+NV_CURSES_FUN( int     , mvinchnstr, (int, int, chtype *, int) );
+NV_CURSES_FUN( int     , mvinchstr, (int, int, chtype *) );
+NV_CURSES_FUN( int     , mvinnstr, (int, int, char *, int) );
+NV_CURSES_FUN( int     , mvinsch, (int, int, chtype) );
+NV_CURSES_FUN( int     , mvinsnstr, (int, int, const char *, int) );
+NV_CURSES_FUN( int     , mvinsstr, (int, int, const char *) );
+NV_CURSES_FUN( int     , mvinstr, (int, int, char *) );
+NV_CURSES_FUN( int     , mvprintw, (int, int, const char *, ...) );
+NV_CURSES_FUN( int     , mvscanw, (int, int, const char *, ...) );
+NV_CURSES_FUN( int     , mvvline, (int, int, chtype, int) );
+NV_CURSES_FUN( int     , mvwaddchnstr, (WINDOW *, int, int, const chtype *, int) );
+NV_CURSES_FUN( int     , mvwaddchstr, (WINDOW *, int, int, const chtype *) );
+NV_CURSES_FUN( int     , mvwaddch, (WINDOW *, int, int, const chtype) );
+NV_CURSES_FUN( int     , mvwaddnstr, (WINDOW *, int, int, const char *, int) );
+NV_CURSES_FUN( int     , mvwaddstr, (WINDOW *, int, int, const char *) );
+NV_CURSES_FUN( int     , mvwchgat, (WINDOW *, int, int, int, attr_t, short, const void *) );
+NV_CURSES_FUN( int     , mvwdelch, (WINDOW *, int, int) );
+NV_CURSES_FUN( int     , mvwgetch, (WINDOW *, int, int) );
+NV_CURSES_FUN( int     , mvwgetnstr, (WINDOW *, int, int, char *, int) );
+NV_CURSES_FUN( int     , mvwgetstr, (WINDOW *, int, int, char *) );
+NV_CURSES_FUN( int     , mvwhline, (WINDOW *, int, int, chtype, int) );
+NV_CURSES_FUN( int     , mvwinchnstr, (WINDOW *, int, int, chtype *, int) );
+NV_CURSES_FUN( int     , mvwinchstr, (WINDOW *, int, int, chtype *) );
+NV_CURSES_FUN( chtype  , mvwinch, (WINDOW *, int, int) );
+NV_CURSES_FUN( int     , mvwinnstr, (WINDOW *, int, int, char *, int) );
+NV_CURSES_FUN( int     , mvwinsch, (WINDOW *, int, int, chtype) );
+NV_CURSES_FUN( int     , mvwinsnstr, (WINDOW *, int, int, const char *, int) );
+NV_CURSES_FUN( int     , mvwinsstr, (WINDOW *, int, int, const char *) );
+NV_CURSES_FUN( int     , mvwinstr, (WINDOW *, int, int, char *) );
+NV_CURSES_FUN( int     , mvwin, (WINDOW *, int, int) );
+NV_CURSES_FUN( int     , mvwprintw, (WINDOW *, int, int, const char *, ...) );
+NV_CURSES_FUN( int     , mvwscanw, (WINDOW *, int, int, const char *, ...) );
+NV_CURSES_FUN( int     , mvwvline, (WINDOW *, int, int, chtype, int) );
+NV_CURSES_FUN( int     , napms, (int) );
+NV_CURSES_FUN( WINDOW *, newpad, (int, int) );
+NV_CURSES_FUN( SCREEN *, newterm, (const char *, FILE *, FILE *) );
+NV_CURSES_FUN( WINDOW *, newwin, (int, int, int, int) );
+NV_CURSES_FUN( int     , nl, (void) );
+NV_CURSES_FUN( int     , nocbreak, (void) );
+NV_CURSES_FUN( int     , nodelay, (WINDOW *, BOOL) );
+NV_CURSES_FUN( int     , noecho, (void) );
+NV_CURSES_FUN( int     , nonl, (void) );
+NV_CURSES_FUN( void    , noqiflush, (void) );
+NV_CURSES_FUN( int     , noraw, (void) );
+NV_CURSES_FUN( int     , notimeout, (WINDOW *, BOOL) );
+NV_CURSES_FUN( int     , overlay, (const WINDOW *, WINDOW *) );
+NV_CURSES_FUN( int     , overwrite, (const WINDOW *, WINDOW *) );
+NV_CURSES_FUN( int     , pair_content, (short, short *, short *) );
+NV_CURSES_FUN( int     , pechochar, (WINDOW *, chtype) );
+NV_CURSES_FUN( int     , pnoutrefresh, (WINDOW *, int, int, int, int, int, int) );
+NV_CURSES_FUN( int     , prefresh, (WINDOW *, int, int, int, int, int, int) );
+NV_CURSES_FUN( int     , printw, (const char *, ...) );
+NV_CURSES_FUN( int     , putwin, (WINDOW *, FILE *) );
+NV_CURSES_FUN( void    , qiflush, (void) );
+NV_CURSES_FUN( int     , raw, (void) );
+NV_CURSES_FUN( int     , redrawwin, (WINDOW *) );
+NV_CURSES_FUN( int     , refresh, (void) );
+NV_CURSES_FUN( int     , reset_prog_mode, (void) );
+NV_CURSES_FUN( int     , reset_shell_mode, (void) );
+NV_CURSES_FUN( int     , resetty, (void) );
+//NV_CURSES_FUN( int     , ripoffline, (int, int , (*)(WINDOW *, int)) );
+NV_CURSES_FUN( int     , savetty, (void) );
+NV_CURSES_FUN( int     , scanw, (const char *, ...) );
+NV_CURSES_FUN( int     , scr_dump, (const char *) );
+NV_CURSES_FUN( int     , scr_init, (const char *) );
+NV_CURSES_FUN( int     , scr_restore, (const char *) );
+NV_CURSES_FUN( int     , scr_set, (const char *) );
+NV_CURSES_FUN( int     , scrl, (int) );
+NV_CURSES_FUN( int     , scroll, (WINDOW *) );
+NV_CURSES_FUN( int     , scrollok, (WINDOW *, BOOL) );
+NV_CURSES_FUN( SCREEN *, set_term, (SCREEN *) );
+NV_CURSES_FUN( int     , setscrreg, (int, int) );
+NV_CURSES_FUN( int     , slk_attroff, (const chtype) );
+NV_CURSES_FUN( int     , slk_attr_off, (const attr_t, void *) );
+NV_CURSES_FUN( int     , slk_attron, (const chtype) );
+NV_CURSES_FUN( int     , slk_attr_on, (const attr_t, void *) );
+NV_CURSES_FUN( int     , slk_attrset, (const chtype) );
+NV_CURSES_FUN( int     , slk_attr_set, (const attr_t, short, void *) );
+NV_CURSES_FUN( int     , slk_clear, (void) );
+NV_CURSES_FUN( int     , slk_color, (short) );
+NV_CURSES_FUN( int     , slk_init, (int) );
+NV_CURSES_FUN( char   *, slk_label, (int) );
+NV_CURSES_FUN( int     , slk_noutrefresh, (void) );
+NV_CURSES_FUN( int     , slk_refresh, (void) );
+NV_CURSES_FUN( int     , slk_restore, (void) );
+NV_CURSES_FUN( int     , slk_set, (int, const char *, int) );
+NV_CURSES_FUN( int     , slk_touch, (void) );
+NV_CURSES_FUN( int     , standend, (void) );
+NV_CURSES_FUN( int     , standout, (void) );
+NV_CURSES_FUN( int     , start_color, (void) );
+NV_CURSES_FUN( WINDOW *, subpad, (WINDOW *, int, int, int, int) );
+NV_CURSES_FUN( WINDOW *, subwin, (WINDOW *, int, int, int, int) );
+NV_CURSES_FUN( int     , syncok, (WINDOW *, BOOL) );
+NV_CURSES_FUN( chtype  , termattrs, (void) );
+NV_CURSES_FUN( attr_t  , term_attrs, (void) );
+NV_CURSES_FUN( char   *, termname, (void) );
+NV_CURSES_FUN( void    , timeout, (int) );
+NV_CURSES_FUN( int     , touchline, (WINDOW *, int, int) );
+NV_CURSES_FUN( int     , touchwin, (WINDOW *) );
+NV_CURSES_FUN( int     , typeahead, (int) );
+NV_CURSES_FUN( int     , untouchwin, (WINDOW *) );
+NV_CURSES_FUN( void    , use_env, (BOOL) );
+NV_CURSES_FUN( int     , vidattr, (chtype) );
+NV_CURSES_FUN( int     , vid_attr, (attr_t, short, void *) );
+//NV_CURSES_FUN( int     , vidputs, (chtype, int , (*)(int)) );
+//NV_CURSES_FUN( int     , vid_puts, (attr_t, short, void *, int , (*)(int)) );
+NV_CURSES_FUN( int     , vline, (chtype, int) );
+NV_CURSES_FUN( int     , vw_printw, (WINDOW *, const char *, va_list) );
+NV_CURSES_FUN( int     , vwprintw, (WINDOW *, const char *, va_list) );
+NV_CURSES_FUN( int     , vw_scanw, (WINDOW *, const char *, va_list) );
+NV_CURSES_FUN( int     , vwscanw, (WINDOW *, const char *, va_list) );
+NV_CURSES_FUN( int     , waddchnstr, (WINDOW *, const chtype *, int) );
+NV_CURSES_FUN( int     , waddchstr, (WINDOW *, const chtype *) );
+NV_CURSES_FUN( int     , waddch, (WINDOW *, const chtype) );
+NV_CURSES_FUN( int     , waddnstr, (WINDOW *, const char *, int) );
+NV_CURSES_FUN( int     , waddstr, (WINDOW *, const char *) );
+NV_CURSES_FUN( int     , wattroff, (WINDOW *, chtype) );
+NV_CURSES_FUN( int     , wattron, (WINDOW *, chtype) );
+NV_CURSES_FUN( int     , wattrset, (WINDOW *, chtype) );
+NV_CURSES_FUN( int     , wattr_get, (WINDOW *, attr_t *, short *, void *) );
+NV_CURSES_FUN( int     , wattr_off, (WINDOW *, attr_t, void *) );
+NV_CURSES_FUN( int     , wattr_on, (WINDOW *, attr_t, void *) );
+NV_CURSES_FUN( int     , wattr_set, (WINDOW *, attr_t, short, void *) );
+NV_CURSES_FUN( void    , wbkgdset, (WINDOW *, chtype) );
+NV_CURSES_FUN( int     , wbkgd, (WINDOW *, chtype) );
+NV_CURSES_FUN( int     , wborder, (WINDOW *, chtype, chtype, chtype, chtype, chtype, chtype, chtype, chtype) );
+NV_CURSES_FUN( int     , wchgat, (WINDOW *, int, attr_t, short, const void *) );
+NV_CURSES_FUN( int     , wclear, (WINDOW *) );
+NV_CURSES_FUN( int     , wclrtobot, (WINDOW *) );
+NV_CURSES_FUN( int     , wclrtoeol, (WINDOW *) );
+NV_CURSES_FUN( int     , wcolor_set, (WINDOW *, short, void *) );
+NV_CURSES_FUN( void    , wcursyncup, (WINDOW *) );
+NV_CURSES_FUN( int     , wdelch, (WINDOW *) );
+NV_CURSES_FUN( int     , wdeleteln, (WINDOW *) );
+NV_CURSES_FUN( int     , wechochar, (WINDOW *, const chtype) );
+NV_CURSES_FUN( int     , werase, (WINDOW *) );
+NV_CURSES_FUN( int     , wgetch, (WINDOW *) );
+NV_CURSES_FUN( int     , wgetnstr, (WINDOW *, char *, int) );
+NV_CURSES_FUN( int     , wgetstr, (WINDOW *, char *) );
+NV_CURSES_FUN( int     , whline, (WINDOW *, chtype, int) );
+NV_CURSES_FUN( int     , winchnstr, (WINDOW *, chtype *, int) );
+NV_CURSES_FUN( int     , winchstr, (WINDOW *, chtype *) );
+NV_CURSES_FUN( chtype  , winch, (WINDOW *) );
+NV_CURSES_FUN( int     , winnstr, (WINDOW *, char *, int) );
+NV_CURSES_FUN( int     , winsch, (WINDOW *, chtype) );
+NV_CURSES_FUN( int     , winsdelln, (WINDOW *, int) );
+NV_CURSES_FUN( int     , winsertln, (WINDOW *) );
+NV_CURSES_FUN( int     , winsnstr, (WINDOW *, const char *, int) );
+NV_CURSES_FUN( int     , winsstr, (WINDOW *, const char *) );
+NV_CURSES_FUN( int     , winstr, (WINDOW *, char *) );
+NV_CURSES_FUN( int     , wmove, (WINDOW *, int, int) );
+NV_CURSES_FUN( int     , wnoutrefresh, (WINDOW *) );
+NV_CURSES_FUN( int     , wprintw, (WINDOW *, const char *, ...) );
+NV_CURSES_FUN( int     , wredrawln, (WINDOW *, int, int) );
+NV_CURSES_FUN( int     , wrefresh, (WINDOW *) );
+NV_CURSES_FUN( int     , wscanw, (WINDOW *, const char *, ...) );
+NV_CURSES_FUN( int     , wscrl, (WINDOW *, int) );
+NV_CURSES_FUN( int     , wsetscrreg, (WINDOW *, int, int) );
+NV_CURSES_FUN( int     , wstandend, (WINDOW *) );
+NV_CURSES_FUN( int     , wstandout, (WINDOW *) );
+NV_CURSES_FUN( void    , wsyncdown, (WINDOW *) );
+NV_CURSES_FUN( void    , wsyncup, (WINDOW *) );
+NV_CURSES_FUN( void    , wtimeout, (WINDOW *, int) );
+NV_CURSES_FUN( int     , wtouchln, (WINDOW *, int, int, int) );
+NV_CURSES_FUN( int     , wvline, (WINDOW *, chtype, int) );
+
+/* Wide-character functions */
+
+#ifdef CURSES_PDC_WIDE
+NV_CURSES_FUN( int     , addnwstr, (const wchar_t *, int) );
+NV_CURSES_FUN( int     , addwstr, (const wchar_t *) );
+NV_CURSES_FUN( int     , add_wch, (const cchar_t *) );
+NV_CURSES_FUN( int     , add_wchnstr, (const cchar_t *, int) );
+NV_CURSES_FUN( int     , add_wchstr, (const cchar_t *) );
+NV_CURSES_FUN( 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 *) );
+NV_CURSES_FUN( int     , box_set, (WINDOW *, const cchar_t *, const cchar_t *) );
+NV_CURSES_FUN( int     , echo_wchar, (const cchar_t *) );
+NV_CURSES_FUN( int     , erasewchar, (wchar_t *) );
+NV_CURSES_FUN( int     , getbkgrnd, (cchar_t *) );
+NV_CURSES_FUN( int     , getcchar, (const cchar_t *, wchar_t *, attr_t *, short *, void *) );
+NV_CURSES_FUN( int     , getn_wstr, (wint_t *, int) );
+NV_CURSES_FUN( int     , get_wch, (wint_t *) );
+NV_CURSES_FUN( int     , get_wstr, (wint_t *) );
+NV_CURSES_FUN( int     , hline_set, (const cchar_t *, int) );
+NV_CURSES_FUN( int     , innwstr, (wchar_t *, int) );
+NV_CURSES_FUN( int     , ins_nwstr, (const wchar_t *, int) );
+NV_CURSES_FUN( int     , ins_wch, (const cchar_t *) );
+NV_CURSES_FUN( int     , ins_wstr, (const wchar_t *) );
+NV_CURSES_FUN( int     , inwstr, (wchar_t *) );
+NV_CURSES_FUN( int     , in_wch, (cchar_t *) );
+NV_CURSES_FUN( int     , in_wchnstr, (cchar_t *, int) );
+NV_CURSES_FUN( int     , in_wchstr, (cchar_t *) );
+NV_CURSES_FUN( char   *, key_name, (wchar_t) );
+NV_CURSES_FUN( int     , killwchar, (wchar_t *) );
+NV_CURSES_FUN( int     , mvaddnwstr, (int, int, const wchar_t *, int) );
+NV_CURSES_FUN( int     , mvaddwstr, (int, int, const wchar_t *) );
+NV_CURSES_FUN( int     , mvadd_wch, (int, int, const cchar_t *) );
+NV_CURSES_FUN( int     , mvadd_wchnstr, (int, int, const cchar_t *, int) );
+NV_CURSES_FUN( int     , mvadd_wchstr, (int, int, const cchar_t *) );
+NV_CURSES_FUN( int     , mvgetn_wstr, (int, int, wint_t *, int) );
+NV_CURSES_FUN( int     , mvget_wch, (int, int, wint_t *) );
+NV_CURSES_FUN( int     , mvget_wstr, (int, int, wint_t *) );
+NV_CURSES_FUN( int     , mvhline_set, (int, int, const cchar_t *, int) );
+NV_CURSES_FUN( int     , mvinnwstr, (int, int, wchar_t *, int) );
+NV_CURSES_FUN( int     , mvins_nwstr, (int, int, const wchar_t *, int) );
+NV_CURSES_FUN( int     , mvins_wch, (int, int, const cchar_t *) );
+NV_CURSES_FUN( int     , mvins_wstr, (int, int, const wchar_t *) );
+NV_CURSES_FUN( int     , mvinwstr, (int, int, wchar_t *) );
+NV_CURSES_FUN( int     , mvin_wch, (int, int, cchar_t *) );
+NV_CURSES_FUN( int     , mvin_wchnstr, (int, int, cchar_t *, int) );
+NV_CURSES_FUN( int     , mvin_wchstr, (int, int, cchar_t *) );
+NV_CURSES_FUN( int     , mvvline_set, (int, int, const cchar_t *, int) );
+NV_CURSES_FUN( int     , mvwaddnwstr, (WINDOW *, int, int, const wchar_t *, int) );
+NV_CURSES_FUN( int     , mvwaddwstr, (WINDOW *, int, int, const wchar_t *) );
+NV_CURSES_FUN( int     , mvwadd_wch, (WINDOW *, int, int, const cchar_t *) );
+NV_CURSES_FUN( int     , mvwadd_wchnstr, (WINDOW *, int, int, const cchar_t *, int) );
+NV_CURSES_FUN( int     , mvwadd_wchstr, (WINDOW *, int, int, const cchar_t *) );
+NV_CURSES_FUN( int     , mvwgetn_wstr, (WINDOW *, int, int, wint_t *, int) );
+NV_CURSES_FUN( int     , mvwget_wch, (WINDOW *, int, int, wint_t *) );
+NV_CURSES_FUN( int     , mvwget_wstr, (WINDOW *, int, int, wint_t *) );
+NV_CURSES_FUN( int     , mvwhline_set, (WINDOW *, int, int, const cchar_t *, int) );
+NV_CURSES_FUN( int     , mvwinnwstr, (WINDOW *, int, int, wchar_t *, int) );
+NV_CURSES_FUN( int     , mvwins_nwstr, (WINDOW *, int, int, const wchar_t *, int) );
+NV_CURSES_FUN( int     , mvwins_wch, (WINDOW *, int, int, const cchar_t *) );
+NV_CURSES_FUN( int     , mvwins_wstr, (WINDOW *, int, int, const wchar_t *) );
+NV_CURSES_FUN( int     , mvwin_wch, (WINDOW *, int, int, cchar_t *) );
+NV_CURSES_FUN( int     , mvwin_wchnstr, (WINDOW *, int, int, cchar_t *, int) );
+NV_CURSES_FUN( int     , mvwin_wchstr, (WINDOW *, int, int, cchar_t *) );
+NV_CURSES_FUN( int     , mvwinwstr, (WINDOW *, int, int, wchar_t *) );
+NV_CURSES_FUN( int     , mvwvline_set, (WINDOW *, int, int, const cchar_t *, int) );
+NV_CURSES_FUN( int     , pecho_wchar, (WINDOW *, const cchar_t*) );
+NV_CURSES_FUN( int     , setcchar, (cchar_t*, const wchar_t*, const attr_t, short, const void*) );
+NV_CURSES_FUN( int     , slk_wset, (int, const wchar_t *, int) );
+NV_CURSES_FUN( int     , unget_wch, (const wchar_t) );
+NV_CURSES_FUN( int     , vline_set, (const cchar_t *, int) );
+NV_CURSES_FUN( int     , waddnwstr, (WINDOW *, const wchar_t *, int) );
+NV_CURSES_FUN( int     , waddwstr, (WINDOW *, const wchar_t *) );
+NV_CURSES_FUN( int     , wadd_wch, (WINDOW *, const cchar_t *) );
+NV_CURSES_FUN( int     , wadd_wchnstr, (WINDOW *, const cchar_t *, int) );
+NV_CURSES_FUN( int     , wadd_wchstr, (WINDOW *, const cchar_t *) );
+NV_CURSES_FUN( int     , wbkgrnd, (WINDOW *, const cchar_t *) );
+NV_CURSES_FUN( void    , wbkgrndset, (WINDOW *, const cchar_t *) );
+NV_CURSES_FUN( 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 *) );
+NV_CURSES_FUN( int     , wecho_wchar, (WINDOW *, const cchar_t *) );
+NV_CURSES_FUN( int     , wgetbkgrnd, (WINDOW *, cchar_t *) );
+NV_CURSES_FUN( int     , wgetn_wstr, (WINDOW *, wint_t *, int) );
+NV_CURSES_FUN( int     , wget_wch, (WINDOW *, wint_t *) );
+NV_CURSES_FUN( int     , wget_wstr, (WINDOW *, wint_t *) );
+NV_CURSES_FUN( int     , whline_set, (WINDOW *, const cchar_t *, int) );
+NV_CURSES_FUN( int     , winnwstr, (WINDOW *, wchar_t *, int) );
+NV_CURSES_FUN( int     , wins_nwstr, (WINDOW *, const wchar_t *, int) );
+NV_CURSES_FUN( int     , wins_wch, (WINDOW *, const cchar_t *) );
+NV_CURSES_FUN( int     , wins_wstr, (WINDOW *, const wchar_t *) );
+NV_CURSES_FUN( int     , winwstr, (WINDOW *, wchar_t *) );
+NV_CURSES_FUN( int     , win_wch, (WINDOW *, cchar_t *) );
+NV_CURSES_FUN( int     , win_wchnstr, (WINDOW *, cchar_t *, int) );
+NV_CURSES_FUN( int     , win_wchstr, (WINDOW *, cchar_t *) );
+NV_CURSES_FUN( wchar_t *, wunctrl, (cchar_t *) );
+NV_CURSES_FUN( int     , wvline_set, (WINDOW *, const cchar_t *, int) );
+#endif
+
+/* Quasi-standard */
+
+NV_CURSES_FUN( chtype  , getattrs, (WINDOW *) );
+NV_CURSES_FUN( int     , getbegx, (WINDOW *) );
+NV_CURSES_FUN( int     , getbegy, (WINDOW *) );
+NV_CURSES_FUN( int     , getmaxx, (WINDOW *) );
+NV_CURSES_FUN( int     , getmaxy, (WINDOW *) );
+NV_CURSES_FUN( int     , getparx, (WINDOW *) );
+NV_CURSES_FUN( int     , getpary, (WINDOW *) );
+NV_CURSES_FUN( int     , getcurx, (WINDOW *) );
+NV_CURSES_FUN( int     , getcury, (WINDOW *) );
+NV_CURSES_FUN( void    , traceoff, (void) );
+NV_CURSES_FUN( void    , traceon, (void) );
+NV_CURSES_FUN( char   *, unctrl, (chtype) );
+
+NV_CURSES_FUN( int     , crmode, (void) );
+NV_CURSES_FUN( int     , nocrmode, (void) );
+NV_CURSES_FUN( int     , draino, (int) );
+NV_CURSES_FUN( int     , resetterm, (void) );
+NV_CURSES_FUN( int     , fixterm, (void) );
+NV_CURSES_FUN( int     , saveterm, (void) );
+NV_CURSES_FUN( int     , setsyx, (int, int) );
+
+NV_CURSES_FUN( int     , mouse_set, (unsigned long) );
+NV_CURSES_FUN( int     , mouse_on, (unsigned long) );
+NV_CURSES_FUN( int     , mouse_off, (unsigned long) );
+NV_CURSES_FUN( int     , request_mouse_pos, (void) );
+NV_CURSES_FUN( int     , map_button, (unsigned long) );
+NV_CURSES_FUN( void    , wmouse_position, (WINDOW *, int *, int *) );
+NV_CURSES_FUN( unsigned long , getmouse, (void) );
+NV_CURSES_FUN( unsigned long , getbmap, (void) );
+
+/* ncurses */
+
+NV_CURSES_FUN( int     , assume_default_colors, (int, int) );
+NV_CURSES_FUN( const char *, curses_version, (void) );
+NV_CURSES_FUN( BOOL    , has_key, (int) );
+NV_CURSES_FUN( int     , use_default_colors, (void) );
+NV_CURSES_FUN( int     , wresize, (WINDOW *, int, int) );
+
+NV_CURSES_FUN( int     , mouseinterval, (int) );
+NV_CURSES_FUN( mmask_t , mousemask, (mmask_t, mmask_t *) );
+NV_CURSES_FUN( BOOL    , mouse_trafo, (int *, int *, BOOL) );
+NV_CURSES_FUN( int     , nc_getmouse, (MEVENT *) );
+NV_CURSES_FUN( int     , ungetmouse, (MEVENT *) );
+NV_CURSES_FUN( BOOL    , wenclose, (const WINDOW *, int, int) );
+NV_CURSES_FUN( BOOL    , wmouse_trafo, (const WINDOW *, int *, int *, BOOL) );
+
+/* PDCurses */
+
+NV_CURSES_FUN( int     , addrawch, (chtype) );
+NV_CURSES_FUN( int     , insrawch, (chtype) );
+NV_CURSES_FUN( BOOL    , is_termresized, (void) );
+NV_CURSES_FUN( int     , mvaddrawch, (int, int, chtype) );
+NV_CURSES_FUN( int     , mvdeleteln, (int, int) );
+NV_CURSES_FUN( int     , mvinsertln, (int, int) );
+NV_CURSES_FUN( int     , mvinsrawch, (int, int, chtype) );
+NV_CURSES_FUN( int     , mvwaddrawch, (WINDOW *, int, int, chtype) );
+NV_CURSES_FUN( int     , mvwdeleteln, (WINDOW *, int, int) );
+NV_CURSES_FUN( int     , mvwinsertln, (WINDOW *, int, int) );
+NV_CURSES_FUN( int     , mvwinsrawch, (WINDOW *, int, int, chtype) );
+NV_CURSES_FUN( int     , raw_output, (BOOL) );
+NV_CURSES_FUN( int     , resize_term, (int, int) );
+NV_CURSES_FUN( WINDOW *, resize_window, (WINDOW *, int, int) );
+NV_CURSES_FUN( int     , waddrawch, (WINDOW *, chtype) );
+NV_CURSES_FUN( int     , winsrawch, (WINDOW *, chtype) );
+NV_CURSES_FUN( char    , wordchar, (void) );
+
+#ifdef CURSES_PDC_WIDE
+NV_CURSES_FUN( wchar_t *, slk_wlabel, (int) );
+#endif
+
+NV_CURSES_FUN( void    , PDC_debug, (const char *, ...) );
+NV_CURSES_FUN( int     , PDC_ungetch, (int) );
+NV_CURSES_FUN( int     , PDC_set_blink, (BOOL) );
+NV_CURSES_FUN( int     , PDC_set_line_color, (short) );
+NV_CURSES_FUN( void    , PDC_set_title, (const char *) );
+
+NV_CURSES_FUN( int     , PDC_clearclipboard, (void) );
+NV_CURSES_FUN( int     , PDC_freeclipboard, (char *) );
+NV_CURSES_FUN( int     , PDC_getclipboard, (char **, long *) );
+NV_CURSES_FUN( int     , PDC_setclipboard, (const char *, long) );
+
+NV_CURSES_FUN( unsigned long , PDC_get_input_fd, (void) );
+NV_CURSES_FUN( unsigned long , PDC_get_key_modifiers, (void) );
+NV_CURSES_FUN( int     , PDC_return_key_modifiers, (BOOL) );
+NV_CURSES_FUN( int     , PDC_save_key_modifiers, (BOOL) );
+
+#ifdef CURSES_XCURSES
+NV_CURSES_FUN( WINDOW *, Xinitscr, (int, char **) );
+NV_CURSES_FUN( void    , XCursesExit, (void) );
+NV_CURSES_FUN( int     , sb_init, (void) );
+NV_CURSES_FUN( int     , sb_set_horz, (int, int, int) );
+NV_CURSES_FUN( int     , sb_set_vert, (int, int, int) );
+NV_CURSES_FUN( int     , sb_get_horz, (int *, int *, int *) );
+NV_CURSES_FUN( int     , sb_get_vert, (int *, int *, int *) );
+NV_CURSES_FUN( int     , sb_refresh, (void) );
+#endif 
Index: /trunk/nv/lib/detail/curses_types.inc
===================================================================
--- /trunk/nv/lib/detail/curses_types.inc	(revision 218)
+++ /trunk/nv/lib/detail/curses_types.inc	(revision 218)
@@ -0,0 +1,716 @@
+#define CURSES_PDC_BUILD 3401
+#define CURSES_PDCURSES        1
+#define CURSES_XOPEN           1
+#define CURSES_SYSVcurses      1
+#define CURSES_BSDcurses       1
+#define CURSES_CHTYPE_LONG     1
+
+#ifndef CURSES_FALSE
+# define CURSES_FALSE 0
+#endif
+#ifndef CURSES_TRUE
+# define CURSES_TRUE 1
+#endif
+#ifndef CURSES_NULL
+# define CURSES_NULL (void *)0
+#endif
+#ifndef CURSES_ERR
+# define CURSES_ERR (-1)
+#endif
+#ifndef CURSES_OK
+# define CURSES_OK 0
+#endif
+
+typedef unsigned char BOOL;
+
+#ifdef CURSES_CHTYPE_LONG
+# if _LP64
+typedef unsigned int chtype;
+# else
+typedef unsigned long chtype;  /* 16-bit attr + 16-bit char */
+# endif
+#else
+typedef unsigned short chtype; /* 8-bit attr + 8-bit char */
+#endif
+
+#ifdef CURSES_PDC_WIDE
+typedef chtype cchar_t;
+#endif
+
+typedef chtype attr_t;
+
+typedef struct
+{
+    int x;           /* absolute column, 0 based, measured in characters */
+    int y;           /* absolute row, 0 based, measured in characters */
+    short button[3]; /* state of each button */
+    int changes;     /* flags indicating what has changed with the mouse */
+} MOUSE_STATUS;
+
+#define CURSES_BUTTON_RELEASED         0x0000
+#define CURSES_BUTTON_PRESSED          0x0001
+#define CURSES_BUTTON_CLICKED          0x0002
+#define CURSES_BUTTON_DOUBLE_CLICKED   0x0003
+#define CURSES_BUTTON_TRIPLE_CLICKED   0x0004
+#define CURSES_BUTTON_MOVED            0x0005  /* PDCurses */
+#define CURSES_WHEEL_SCROLLED          0x0006  /* PDCurses */
+#define CURSES_BUTTON_ACTION_MASK      0x0007  /* PDCurses */
+
+#define CURSES_PDC_BUTTON_SHIFT        0x0008  /* PDCurses */
+#define CURSES_PDC_BUTTON_CONTROL      0x0010  /* PDCurses */
+#define CURSES_PDC_BUTTON_ALT          0x0020  /* PDCurses */
+#define CURSES_BUTTON_MODIFIER_MASK    0x0038  /* PDCurses */
+
+#define CURSES_MOUSE_X_POS             (Mouse_status.x)
+#define CURSES_MOUSE_Y_POS             (Mouse_status.y)
+
+/*
+ * Bits associated with the .changes field:
+ *   3         2         1         0
+ * 210987654321098765432109876543210
+ *                                 1 <- button 1 has changed
+ *                                10 <- button 2 has changed
+ *                               100 <- button 3 has changed
+ *                              1000 <- mouse has moved
+ *                             10000 <- mouse position report
+ *                            100000 <- mouse wheel up
+ *                           1000000 <- mouse wheel down
+ */
+
+#define CURSES_PDC_MOUSE_MOVED         0x0008
+#define CURSES_PDC_MOUSE_POSITION      0x0010
+#define CURSES_PDC_MOUSE_WHEEL_UP      0x0020
+#define CURSES_PDC_MOUSE_WHEEL_DOWN    0x0040
+
+#define CURSES_A_BUTTON_CHANGED        (Mouse_status.changes & 7)
+#define CURSES_MOUSE_MOVED             (Mouse_status.changes & PDC_MOUSE_MOVED)
+#define CURSES_MOUSE_POS_REPORT        (Mouse_status.changes & PDC_MOUSE_POSITION)
+#define CURSES_BUTTON_CHANGED(x)       (Mouse_status.changes & (1 << ((x) - 1)))
+#define CURSES_BUTTON_STATUS(x)        (Mouse_status.button[(x) - 1])
+#define CURSES_MOUSE_WHEEL_UP          (Mouse_status.changes & PDC_MOUSE_WHEEL_UP)
+#define CURSES_MOUSE_WHEEL_DOWN        (Mouse_status.changes & PDC_MOUSE_WHEEL_DOWN)
+
+/* mouse bit-masks */
+
+#define CURSES_BUTTON1_RELEASED        0x00000001L
+#define CURSES_BUTTON1_PRESSED         0x00000002L
+#define CURSES_BUTTON1_CLICKED         0x00000004L
+#define CURSES_BUTTON1_DOUBLE_CLICKED  0x00000008L
+#define CURSES_BUTTON1_TRIPLE_CLICKED  0x00000010L
+#define CURSES_BUTTON1_MOVED           0x00000010L /* PDCurses */
+
+#define CURSES_BUTTON2_RELEASED        0x00000020L
+#define CURSES_BUTTON2_PRESSED         0x00000040L
+#define CURSES_BUTTON2_CLICKED         0x00000080L
+#define CURSES_BUTTON2_DOUBLE_CLICKED  0x00000100L
+#define CURSES_BUTTON2_TRIPLE_CLICKED  0x00000200L
+#define CURSES_BUTTON2_MOVED           0x00000200L /* PDCurses */
+
+#define CURSES_BUTTON3_RELEASED        0x00000400L
+#define CURSES_BUTTON3_PRESSED         0x00000800L
+#define CURSES_BUTTON3_CLICKED         0x00001000L
+#define CURSES_BUTTON3_DOUBLE_CLICKED  0x00002000L
+#define CURSES_BUTTON3_TRIPLE_CLICKED  0x00004000L
+#define CURSES_BUTTON3_MOVED           0x00004000L /* PDCurses */
+
+#define CURSES_BUTTON4_RELEASED        0x00008000L
+#define CURSES_BUTTON4_PRESSED         0x00010000L
+#define CURSES_BUTTON4_CLICKED         0x00020000L
+#define CURSES_BUTTON4_DOUBLE_CLICKED  0x00040000L
+#define CURSES_BUTTON4_TRIPLE_CLICKED  0x00080000L
+
+#define CURSES_BUTTON5_RELEASED        0x00100000L
+#define CURSES_BUTTON5_PRESSED         0x00200000L
+#define CURSES_BUTTON5_CLICKED         0x00400000L
+#define CURSES_BUTTON5_DOUBLE_CLICKED  0x00800000L
+#define CURSES_BUTTON5_TRIPLE_CLICKED  0x01000000L
+
+#define CURSES_MOUSE_WHEEL_SCROLL      0x02000000L /* PDCurses */
+#define CURSES_BUTTON_MODIFIER_SHIFT   0x04000000L /* PDCurses */
+#define CURSES_BUTTON_MODIFIER_CONTROL 0x08000000L /* PDCurses */
+#define CURSES_BUTTON_MODIFIER_ALT     0x10000000L /* PDCurses */
+
+#define CURSES_ALL_MOUSE_EVENTS        0x1fffffffL
+#define CURSES_REPORT_MOUSE_POSITION   0x20000000L
+
+/* ncurses mouse interface */
+
+typedef unsigned long mmask_t;
+
+typedef struct
+{
+        short id;       /* unused, always 0 */
+        int x, y, z;    /* x, y same as MOUSE_STATUS; z unused */
+        mmask_t bstate; /* equivalent to changes + button[], but
+                           in the same format as used for mousemask() */
+} MEVENT;
+
+#ifdef CURSES_NCURSES_MOUSE_VERSION
+# define CURSES_BUTTON_SHIFT   CURSES_BUTTON_MODIFIER_SHIFT
+# define CURSES_BUTTON_CONTROL CURSES_BUTTON_MODIFIER_CONTROL
+# define CURSES_BUTTON_CTRL    CURSES_BUTTON_MODIFIER_CONTROL
+# define CURSES_BUTTON_ALT     CURSES_BUTTON_MODIFIER_ALT
+#else
+# define CURSES_BUTTON_SHIFT   CURSES_PDC_BUTTON_SHIFT
+# define CURSES_BUTTON_CONTROL CURSES_PDC_BUTTON_CONTROL
+# define CURSES_BUTTON_ALT     CURSES_PDC_BUTTON_ALT
+#endif
+
+typedef struct _win       /* definition of a window */
+{
+    int   _cury;          /* current pseudo-cursor */
+    int   _curx;
+    int   _maxy;          /* max window coordinates */
+    int   _maxx;
+    int   _begy;          /* origin on screen */
+    int   _begx;
+    int   _flags;         /* window properties */
+    chtype _attrs;        /* standard attributes and colors */
+    chtype _bkgd;         /* background, normally blank */
+    BOOL  _clear;         /* causes clear at next refresh */
+    BOOL  _leaveit;       /* leaves cursor where it is */
+    BOOL  _scroll;        /* allows window scrolling */
+    BOOL  _nodelay;       /* input character wait flag */
+    BOOL  _immed;         /* immediate update flag */
+    BOOL  _sync;          /* synchronise window ancestors */
+    BOOL  _use_keypad;    /* flags keypad key mode active */
+    chtype **_y;          /* pointer to line pointer array */
+    int   *_firstch;      /* first changed character in line */
+    int   *_lastch;       /* last changed character in line */
+    int   _tmarg;         /* top of scrolling region */
+    int   _bmarg;         /* bottom of scrolling region */
+    int   _delayms;       /* milliseconds of delay for getch() */
+    int   _parx, _pary;   /* coords relative to parent (0,0) */
+    struct _win *_parent; /* subwin's pointer to parent win */
+} WINDOW;
+
+typedef struct
+{
+    BOOL  alive;          /* if initscr() called, and not endwin() */
+    BOOL  autocr;         /* if cr -> lf */
+    BOOL  cbreak;         /* if terminal unbuffered */
+    BOOL  echo;           /* if terminal echo */
+    BOOL  raw_inp;        /* raw input mode (v. cooked input) */
+    BOOL  raw_out;        /* raw output mode (7 v. 8 bits) */
+    BOOL  audible;        /* FALSE if the bell is visual */
+    BOOL  mono;           /* TRUE if current screen is mono */
+    BOOL  resized;        /* TRUE if TERM has been resized */
+    BOOL  orig_attr;      /* TRUE if we have the original colors */
+    short orig_fore;      /* original screen foreground color */
+    short orig_back;      /* original screen foreground color */
+    int   cursrow;        /* position of physical cursor */
+    int   curscol;        /* position of physical cursor */
+    int   visibility;     /* visibility of cursor */
+    int   orig_cursor;    /* original cursor size */
+    int   lines;          /* new value for LINES */
+    int   cols;           /* new value for COLS */
+    unsigned long _trap_mbe;       /* trap these mouse button events */
+    unsigned long _map_mbe_to_key; /* map mouse buttons to slk */
+    int   mouse_wait;              /* time to wait (in ms) for a
+                                      button release after a press, in 
+                                      order to count it as a click */
+    int   slklines;                /* lines in use by slk_init() */
+    WINDOW *slk_winptr;            /* window for slk */
+    int   linesrippedoff;          /* lines ripped off via ripoffline() */
+    int   linesrippedoffontop;     /* lines ripped off on 
+                                      top via ripoffline() */
+    int   delaytenths;             /* 1/10ths second to wait block
+                                      getch() for */
+    BOOL  _preserve;               /* TRUE if screen background
+                                      to be preserved */
+    int   _restore;                /* specifies if screen background
+                                      to be restored, and how */
+    BOOL  save_key_modifiers;      /* TRUE if each key modifiers saved
+                                      with each key press */
+    BOOL  return_key_modifiers;    /* TRUE if modifier keys are
+                                      returned as "real" keys */
+    BOOL  key_code;                /* TRUE if last key is a special key;
+                                      used internally by get_wch() */
+#ifdef CURSES_XCURSES
+    int   XcurscrSize;    /* size of Xcurscr shared memory block */
+    BOOL  sb_on;
+    int   sb_viewport_y;
+    int   sb_viewport_x;
+    int   sb_total_y;
+    int   sb_total_x;
+    int   sb_cur_y;
+    int   sb_cur_x;
+#endif
+    short line_color;     /* color of line attributes - default -1 */
+} SCREEN;
+
+NV_CURSES_API int          LINES;        /* terminal height */
+NV_CURSES_API int          COLS;         /* terminal width */
+NV_CURSES_API WINDOW       *stdscr;      /* the default screen window */
+NV_CURSES_API WINDOW       *curscr;      /* the current screen image */
+NV_CURSES_API SCREEN       *SP;          /* curses variables */
+NV_CURSES_API MOUSE_STATUS Mouse_status;
+NV_CURSES_API int          COLORS;
+NV_CURSES_API int          COLOR_PAIRS;
+NV_CURSES_API int          TABSIZE;
+NV_CURSES_API chtype       acs_map[];    /* alternate character set map */
+NV_CURSES_API char         ttytype[];    /* terminal name/description */
+
+#define CURSES_A_NORMAL      (chtype)0
+
+#ifdef CURSES_CHTYPE_LONG
+# define CURSES_A_ALTCHARSET (chtype)0x00010000
+# define CURSES_A_RIGHTLINE  (chtype)0x00020000
+# define CURSES_A_LEFTLINE   (chtype)0x00040000
+# define CURSES_A_INVIS      (chtype)0x00080000
+# define CURSES_A_UNDERLINE  (chtype)0x00100000
+# define CURSES_A_REVERSE    (chtype)0x00200000
+# define CURSES_A_BLINK      (chtype)0x00400000
+# define CURSES_A_BOLD       (chtype)0x00800000
+
+# define CURSES_A_ATTRIBUTES (chtype)0xffff0000
+# define CURSES_A_CHARTEXT   (chtype)0x0000ffff
+# define CURSES_A_COLOR      (chtype)0xff000000
+
+# define CURSES_A_ITALIC     CURSES_A_INVIS
+# define CURSES_A_PROTECT    (CURSES_A_UNDERLINE | CURSES_A_LEFTLINE | CURSES_A_RIGHTLINE)
+
+# define CURSES_PDC_ATTR_SHIFT  19
+# define CURSES_PDC_COLOR_SHIFT 24
+#else
+# define CURSES_A_BOLD       (chtype)0x0100  /* X/Open */
+# define CURSES_A_REVERSE    (chtype)0x0200  /* X/Open */
+# define CURSES_A_BLINK      (chtype)0x0400  /* X/Open */
+
+# define CURSES_A_ATTRIBUTES (chtype)0xff00  /* X/Open */
+# define CURSES_A_CHARTEXT   (chtype)0x00ff  /* X/Open */
+# define CURSES_A_COLOR      (chtype)0xf800  /* System V */
+
+# define CURSES_A_ALTCHARSET CURSES_A_NORMAL        /* X/Open */
+# define CURSES_A_PROTECT    CURSES_A_NORMAL        /* X/Open */
+# define CURSES_A_UNDERLINE  CURSES_A_NORMAL        /* X/Open */
+
+# define CURSES_A_LEFTLINE   CURSES_A_NORMAL
+# define CURSES_A_RIGHTLINE  CURSES_A_NORMAL
+# define CURSES_A_ITALIC     CURSES_A_NORMAL
+# define CURSES_A_INVIS      CURSES_A_NORMAL
+
+# define CURSES_PDC_ATTR_SHIFT   8
+# define CURSES_PDC_COLOR_SHIFT 11
+#endif
+
+#define CURSES_A_STANDOUT    (CURSES_A_REVERSE | CURSES_A_BOLD) /* X/Open */
+#define CURSES_A_DIM         CURSES_A_NORMAL
+
+#define CURSES_CHR_MSK       CURSES_A_CHARTEXT           /* Obsolete */
+#define CURSES_ATR_MSK       CURSES_A_ATTRIBUTES         /* Obsolete */
+#define CURSES_ATR_NRM       CURSES_A_NORMAL             /* Obsolete */
+
+#define CURSES_WA_ALTCHARSET CURSES_A_ALTCHARSET
+#define CURSES_WA_BLINK      CURSES_A_BLINK
+#define CURSES_WA_BOLD       CURSES_A_BOLD
+#define CURSES_WA_DIM        CURSES_A_DIM
+#define CURSES_WA_INVIS      CURSES_A_INVIS
+#define CURSES_WA_LEFT       CURSES_A_LEFTLINE
+#define CURSES_WA_PROTECT    CURSES_A_PROTECT
+#define CURSES_WA_REVERSE    CURSES_A_REVERSE
+#define CURSES_WA_RIGHT      CURSES_A_RIGHTLINE
+#define CURSES_WA_STANDOUT   CURSES_A_STANDOUT
+#define CURSES_WA_UNDERLINE  CURSES_A_UNDERLINE
+
+#define CURSES_WA_HORIZONTAL CURSES_A_NORMAL
+#define CURSES_WA_LOW        CURSES_A_NORMAL
+#define CURSES_WA_TOP        CURSES_A_NORMAL
+#define CURSES_WA_VERTICAL   CURSES_A_NORMAL
+
+#ifdef CURSES_CHTYPE_LONG
+# define CURSES_ACS_PICK(w, n) ((chtype)w | CURSES_A_ALTCHARSET)
+#else
+# define CURSES_ACS_PICK(w, n) ((chtype)n)
+#endif
+
+#define CURSES_ACS_ULCORNER  CURSES_ACS_PICK('l', '+')
+#define CURSES_ACS_LLCORNER  CURSES_ACS_PICK('m', '+')
+#define CURSES_ACS_URCORNER  CURSES_ACS_PICK('k', '+')
+#define CURSES_ACS_LRCORNER  CURSES_ACS_PICK('j', '+')
+#define CURSES_ACS_RTEE      CURSES_ACS_PICK('u', '+')
+#define CURSES_ACS_LTEE      CURSES_ACS_PICK('t', '+')
+#define CURSES_ACS_BTEE      CURSES_ACS_PICK('v', '+')
+#define CURSES_ACS_TTEE      CURSES_ACS_PICK('w', '+')
+#define CURSES_ACS_HLINE     CURSES_ACS_PICK('q', '-')
+#define CURSES_ACS_VLINE     CURSES_ACS_PICK('x', '|')
+#define CURSES_ACS_PLUS      CURSES_ACS_PICK('n', '+')
+
+#define CURSES_ACS_S1        CURSES_ACS_PICK('o', '-')
+#define CURSES_ACS_S9        CURSES_ACS_PICK('s', '_')
+#define CURSES_ACS_DIAMOND   CURSES_ACS_PICK('`', '+')
+#define CURSES_ACS_CKBOARD   CURSES_ACS_PICK('a', ':')
+#define CURSES_ACS_DEGREE    CURSES_ACS_PICK('f', '\'')
+#define CURSES_ACS_PLMINUS   CURSES_ACS_PICK('g', '#')
+#define CURSES_ACS_BULLET    CURSES_ACS_PICK('~', 'o')
+
+#define CURSES_ACS_LARROW    CURSES_ACS_PICK(',', '<')
+#define CURSES_ACS_RARROW    CURSES_ACS_PICK('+', '>')
+#define CURSES_ACS_DARROW    CURSES_ACS_PICK('.', 'v')
+#define CURSES_ACS_UARROW    CURSES_ACS_PICK('-', '^')
+#define CURSES_ACS_BOARD     CURSES_ACS_PICK('h', '#')
+#define CURSES_ACS_LANTERN   CURSES_ACS_PICK('i', '*')
+#define CURSES_ACS_BLOCK     CURSES_ACS_PICK('0', '#')
+
+#define CURSES_ACS_S3        CURSES_ACS_PICK('p', '-')
+#define CURSES_ACS_S7        CURSES_ACS_PICK('r', '-')
+#define CURSES_ACS_LEQUAL    CURSES_ACS_PICK('y', '<')
+#define CURSES_ACS_GEQUAL    CURSES_ACS_PICK('z', '>')
+#define CURSES_ACS_PI        CURSES_ACS_PICK('{', 'n')
+#define CURSES_ACS_NEQUAL    CURSES_ACS_PICK('|', '+')
+#define CURSES_ACS_STERLING  CURSES_ACS_PICK('}', 'L')
+
+#define CURSES_ACS_BSSB      CURSES_ACS_ULCORNER
+#define CURSES_ACS_SSBB      CURSES_ACS_LLCORNER
+#define CURSES_ACS_BBSS      CURSES_ACS_URCORNER
+#define CURSES_ACS_SBBS      CURSES_ACS_LRCORNER
+#define CURSES_ACS_SBSS      CURSES_ACS_RTEE
+#define CURSES_ACS_SSSB      CURSES_ACS_LTEE
+#define CURSES_ACS_SSBS      CURSES_ACS_BTEE
+#define CURSES_ACS_BSSS      CURSES_ACS_TTEE
+#define CURSES_ACS_BSBS      CURSES_ACS_HLINE
+#define CURSES_ACS_SBSB      CURSES_ACS_VLINE
+#define CURSES_ACS_SSSS      CURSES_ACS_PLUS
+
+#ifdef CURSES_PDC_WIDE
+# define CURSES_WACS_ULCORNER (&(acs_map['l']))
+# define CURSES_WACS_LLCORNER (&(acs_map['m']))
+# define CURSES_WACS_URCORNER (&(acs_map['k']))
+# define CURSES_WACS_LRCORNER (&(acs_map['j']))
+# define CURSES_WACS_RTEE     (&(acs_map['u']))
+# define CURSES_WACS_LTEE     (&(acs_map['t']))
+# define CURSES_WACS_BTEE     (&(acs_map['v']))
+# define CURSES_WACS_TTEE     (&(acs_map['w']))
+# define CURSES_WACS_HLINE    (&(acs_map['q']))
+# define CURSES_WACS_VLINE    (&(acs_map['x']))
+# define CURSES_WACS_PLUS     (&(acs_map['n']))
+
+# define CURSES_WACS_S1       (&(acs_map['o']))
+# define CURSES_WACS_S9       (&(acs_map['s']))
+# define CURSES_WACS_DIAMOND  (&(acs_map['`']))
+# define CURSES_WACS_CKBOARD  (&(acs_map['a']))
+# define CURSES_WACS_DEGREE   (&(acs_map['f']))
+# define CURSES_WACS_PLMINUS  (&(acs_map['g']))
+# define CURSES_WACS_BULLET   (&(acs_map['~']))
+
+# define CURSES_WACS_LARROW   (&(acs_map[',']))
+# define CURSES_WACS_RARROW   (&(acs_map['+']))
+# define CURSES_WACS_DARROW   (&(acs_map['.']))
+# define CURSES_WACS_UARROW   (&(acs_map['-']))
+# define CURSES_WACS_BOARD    (&(acs_map['h']))
+# define CURSES_WACS_LANTERN  (&(acs_map['i']))
+# define CURSES_WACS_BLOCK    (&(acs_map['0']))
+
+# define CURSES_WACS_S3       (&(acs_map['p']))
+# define CURSES_WACS_S7       (&(acs_map['r']))
+# define CURSES_WACS_LEQUAL   (&(acs_map['y']))
+# define CURSES_WACS_GEQUAL   (&(acs_map['z']))
+# define CURSES_WACS_PI       (&(acs_map['{']))
+# define CURSES_WACS_NEQUAL   (&(acs_map['|']))
+# define CURSES_WACS_STERLING (&(acs_map['}']))
+
+# define CURSES_WACS_BSSB     CURSES_WACS_ULCORNER
+# define CURSES_WACS_SSBB     CURSES_WACS_LLCORNER
+# define CURSES_WACS_BBSS     CURSES_WACS_URCORNER
+# define CURSES_WACS_SBBS     CURSES_WACS_LRCORNER
+# define CURSES_WACS_SBSS     CURSES_WACS_RTEE
+# define CURSES_WACS_SSSB     CURSES_WACS_LTEE
+# define CURSES_WACS_SSBS     CURSES_WACS_BTEE
+# define CURSES_WACS_BSSS     CURSES_WACS_TTEE
+# define CURSES_WACS_BSBS     CURSES_WACS_HLINE
+# define CURSES_WACS_SBSB     CURSES_WACS_VLINE
+# define CURSES_WACS_SSSS     CURSES_WACS_PLUS
+#endif
+
+#define CURSES_COLOR_BLACK   0
+
+#ifdef CURSES_PDC_RGB        /* RGB */
+# define CURSES_COLOR_RED    1
+# define CURSES_COLOR_GREEN  2
+# define CURSES_COLOR_BLUE   4
+#else                 /* BGR */
+# define CURSES_COLOR_BLUE   1
+# define CURSES_COLOR_GREEN  2
+# define CURSES_COLOR_RED    4
+#endif
+
+#define CURSES_COLOR_CYAN    (CURSES_COLOR_BLUE | CURSES_COLOR_GREEN)
+#define CURSES_COLOR_MAGENTA (CURSES_COLOR_RED | CURSES_COLOR_BLUE)
+#define CURSES_COLOR_YELLOW  (CURSES_COLOR_RED | CURSES_COLOR_GREEN)
+
+#define CURSES_COLOR_WHITE   7
+
+#define CURSES_KEY_CODE_YES  0x100  /* If get_wch() gives a key code */
+
+#define CURSES_KEY_BREAK     0x101  /* Not on PC KBD */
+#define CURSES_KEY_DOWN      0x102  /* Down arrow key */
+#define CURSES_KEY_UP        0x103  /* Up arrow key */
+#define CURSES_KEY_LEFT      0x104  /* Left arrow key */
+#define CURSES_KEY_RIGHT     0x105  /* Right arrow key */
+#define CURSES_KEY_HOME      0x106  /* home key */
+#define CURSES_KEY_BACKSPACE 0x107  /* not on pc */
+#define CURSES_KEY_F0        0x108  /* function keys; 64 reserved */
+
+#define CURSES_KEY_DL        0x148  /* delete line */
+#define CURSES_KEY_IL        0x149  /* insert line */
+#define CURSES_KEY_DC        0x14a  /* delete character */
+#define CURSES_KEY_IC        0x14b  /* insert char or enter ins mode */
+#define CURSES_KEY_EIC       0x14c  /* exit insert char mode */
+#define CURSES_KEY_CLEAR     0x14d  /* clear screen */
+#define CURSES_KEY_EOS       0x14e  /* clear to end of screen */
+#define CURSES_KEY_EOL       0x14f  /* clear to end of line */
+#define CURSES_KEY_SF        0x150  /* scroll 1 line forward */
+#define CURSES_KEY_SR        0x151  /* scroll 1 line back (reverse) */
+#define CURSES_KEY_NPAGE     0x152  /* next page */
+#define CURSES_KEY_PPAGE     0x153  /* previous page */
+#define CURSES_KEY_STAB      0x154  /* set tab */
+#define CURSES_KEY_CTAB      0x155  /* clear tab */
+#define CURSES_KEY_CATAB     0x156  /* clear all tabs */
+#define CURSES_KEY_ENTER     0x157  /* enter or send (unreliable) */
+#define CURSES_KEY_SRESET    0x158  /* soft/reset (partial/unreliable) */
+#define CURSES_KEY_RESET     0x159  /* reset/hard reset (unreliable) */
+#define CURSES_KEY_PRINT     0x15a  /* print/copy */
+#define CURSES_KEY_LL        0x15b  /* home down/bottom (lower left) */
+#define CURSES_KEY_ABORT     0x15c  /* abort/terminate key (any) */
+#define CURSES_KEY_SHELP     0x15d  /* short help */
+#define CURSES_KEY_LHELP     0x15e  /* long help */
+#define CURSES_KEY_BTAB      0x15f  /* Back tab key */
+#define CURSES_KEY_BEG       0x160  /* beg(inning) key */
+#define CURSES_KEY_CANCEL    0x161  /* cancel key */
+#define CURSES_KEY_CLOSE     0x162  /* close key */
+#define CURSES_KEY_COMMAND   0x163  /* cmd (command) key */
+#define CURSES_KEY_COPY      0x164  /* copy key */
+#define CURSES_KEY_CREATE    0x165  /* create key */
+#define CURSES_KEY_END       0x166  /* end key */
+#define CURSES_KEY_EXIT      0x167  /* exit key */
+#define CURSES_KEY_FIND      0x168  /* find key */
+#define CURSES_KEY_HELP      0x169  /* help key */
+#define CURSES_KEY_MARK      0x16a  /* mark key */
+#define CURSES_KEY_MESSAGE   0x16b  /* message key */
+#define CURSES_KEY_MOVE      0x16c  /* move key */
+#define CURSES_KEY_NEXT      0x16d  /* next object key */
+#define CURSES_KEY_OPEN      0x16e  /* open key */
+#define CURSES_KEY_OPTIONS   0x16f  /* options key */
+#define CURSES_KEY_PREVIOUS  0x170  /* previous object key */
+#define CURSES_KEY_REDO      0x171  /* redo key */
+#define CURSES_KEY_REFERENCE 0x172  /* ref(erence) key */
+#define CURSES_KEY_REFRESH   0x173  /* refresh key */
+#define CURSES_KEY_REPLACE   0x174  /* replace key */
+#define CURSES_KEY_RESTART   0x175  /* restart key */
+#define CURSES_KEY_RESUME    0x176  /* resume key */
+#define CURSES_KEY_SAVE      0x177  /* save key */
+#define CURSES_KEY_SBEG      0x178  /* shifted beginning key */
+#define CURSES_KEY_SCANCEL   0x179  /* shifted cancel key */
+#define CURSES_KEY_SCOMMAND  0x17a  /* shifted command key */
+#define CURSES_KEY_SCOPY     0x17b  /* shifted copy key */
+#define CURSES_KEY_SCREATE   0x17c  /* shifted create key */
+#define CURSES_KEY_SDC       0x17d  /* shifted delete char key */
+#define CURSES_KEY_SDL       0x17e  /* shifted delete line key */
+#define CURSES_KEY_SELECT    0x17f  /* select key */
+#define CURSES_KEY_SEND      0x180  /* shifted end key */
+#define CURSES_KEY_SEOL      0x181  /* shifted clear line key */
+#define CURSES_KEY_SEXIT     0x182  /* shifted exit key */
+#define CURSES_KEY_SFIND     0x183  /* shifted find key */
+#define CURSES_KEY_SHOME     0x184  /* shifted home key */
+#define CURSES_KEY_SIC       0x185  /* shifted input key */
+
+#define CURSES_KEY_SLEFT     0x187  /* shifted left arrow key */
+#define CURSES_KEY_SMESSAGE  0x188  /* shifted message key */
+#define CURSES_KEY_SMOVE     0x189  /* shifted move key */
+#define CURSES_KEY_SNEXT     0x18a  /* shifted next key */
+#define CURSES_KEY_SOPTIONS  0x18b  /* shifted options key */
+#define CURSES_KEY_SPREVIOUS 0x18c  /* shifted prev key */
+#define CURSES_KEY_SPRINT    0x18d  /* shifted print key */
+#define CURSES_KEY_SREDO     0x18e  /* shifted redo key */
+#define CURSES_KEY_SREPLACE  0x18f  /* shifted replace key */
+#define CURSES_KEY_SRIGHT    0x190  /* shifted right arrow */
+#define CURSES_KEY_SRSUME    0x191  /* shifted resume key */
+#define CURSES_KEY_SSAVE     0x192  /* shifted save key */
+#define CURSES_KEY_SSUSPEND  0x193  /* shifted suspend key */
+#define CURSES_KEY_SUNDO     0x194  /* shifted undo key */
+#define CURSES_KEY_SUSPEND   0x195  /* suspend key */
+#define CURSES_KEY_UNDO      0x196  /* undo key */
+
+#define CURSES_ALT_0         0x197
+#define CURSES_ALT_1         0x198
+#define CURSES_ALT_2         0x199
+#define CURSES_ALT_3         0x19a
+#define CURSES_ALT_4         0x19b
+#define CURSES_ALT_5         0x19c
+#define CURSES_ALT_6         0x19d
+#define CURSES_ALT_7         0x19e
+#define CURSES_ALT_8         0x19f
+#define CURSES_ALT_9         0x1a0
+#define CURSES_ALT_A         0x1a1
+#define CURSES_ALT_B         0x1a2
+#define CURSES_ALT_C         0x1a3
+#define CURSES_ALT_D         0x1a4
+#define CURSES_ALT_E         0x1a5
+#define CURSES_ALT_F         0x1a6
+#define CURSES_ALT_G         0x1a7
+#define CURSES_ALT_H         0x1a8
+#define CURSES_ALT_I         0x1a9
+#define CURSES_ALT_J         0x1aa
+#define CURSES_ALT_K         0x1ab
+#define CURSES_ALT_L         0x1ac
+#define CURSES_ALT_M         0x1ad
+#define CURSES_ALT_N         0x1ae
+#define CURSES_ALT_O         0x1af
+#define CURSES_ALT_P         0x1b0
+#define CURSES_ALT_Q         0x1b1
+#define CURSES_ALT_R         0x1b2
+#define CURSES_ALT_S         0x1b3
+#define CURSES_ALT_T         0x1b4
+#define CURSES_ALT_U         0x1b5
+#define CURSES_ALT_V         0x1b6
+#define CURSES_ALT_W         0x1b7
+#define CURSES_ALT_X         0x1b8
+#define CURSES_ALT_Y         0x1b9
+#define CURSES_ALT_Z         0x1ba
+
+#define CURSES_CTL_LEFT      0x1bb  /* Control-Left-Arrow */
+#define CURSES_CTL_RIGHT     0x1bc
+#define CURSES_CTL_PGUP      0x1bd
+#define CURSES_CTL_PGDN      0x1be
+#define CURSES_CTL_HOME      0x1bf
+#define CURSES_CTL_END       0x1c0
+
+#define CURSES_KEY_A1        0x1c1  /* upper left on Virtual keypad */
+#define CURSES_KEY_A2        0x1c2  /* upper middle on Virt. keypad */
+#define CURSES_KEY_A3        0x1c3  /* upper right on Vir. keypad */
+#define CURSES_KEY_B1        0x1c4  /* middle left on Virt. keypad */
+#define CURSES_KEY_B2        0x1c5  /* center on Virt. keypad */
+#define CURSES_KEY_B3        0x1c6  /* middle right on Vir. keypad */
+#define CURSES_KEY_C1        0x1c7  /* lower left on Virt. keypad */
+#define CURSES_KEY_C2        0x1c8  /* lower middle on Virt. keypad */
+#define CURSES_KEY_C3        0x1c9  /* lower right on Vir. keypad */
+
+#define CURSES_PADSLASH      0x1ca  /* slash on keypad */
+#define CURSES_PADENTER      0x1cb  /* enter on keypad */
+#define CURSES_CTL_PADENTER  0x1cc  /* ctl-enter on keypad */
+#define CURSES_ALT_PADENTER  0x1cd  /* alt-enter on keypad */
+#define CURSES_PADSTOP       0x1ce  /* stop on keypad */
+#define CURSES_PADSTAR       0x1cf  /* star on keypad */
+#define CURSES_PADMINUS      0x1d0  /* minus on keypad */
+#define CURSES_PADPLUS       0x1d1  /* plus on keypad */
+#define CURSES_CTL_PADSTOP   0x1d2  /* ctl-stop on keypad */
+#define CURSES_CTL_PADCENTER 0x1d3  /* ctl-enter on keypad */
+#define CURSES_CTL_PADPLUS   0x1d4  /* ctl-plus on keypad */
+#define CURSES_CTL_PADMINUS  0x1d5  /* ctl-minus on keypad */
+#define CURSES_CTL_PADSLASH  0x1d6  /* ctl-slash on keypad */
+#define CURSES_CTL_PADSTAR   0x1d7  /* ctl-star on keypad */
+#define CURSES_ALT_PADPLUS   0x1d8  /* alt-plus on keypad */
+#define CURSES_ALT_PADMINUS  0x1d9  /* alt-minus on keypad */
+#define CURSES_ALT_PADSLASH  0x1da  /* alt-slash on keypad */
+#define CURSES_ALT_PADSTAR   0x1db  /* alt-star on keypad */
+#define CURSES_ALT_PADSTOP   0x1dc  /* alt-stop on keypad */
+#define CURSES_CTL_INS       0x1dd  /* ctl-insert */
+#define CURSES_ALT_DEL       0x1de  /* alt-delete */
+#define CURSES_ALT_INS       0x1df  /* alt-insert */
+#define CURSES_CTL_UP        0x1e0  /* ctl-up arrow */
+#define CURSES_CTL_DOWN      0x1e1  /* ctl-down arrow */
+#define CURSES_CTL_TAB       0x1e2  /* ctl-tab */
+#define CURSES_ALT_TAB       0x1e3
+#define CURSES_ALT_MINUS     0x1e4
+#define CURSES_ALT_EQUAL     0x1e5
+#define CURSES_ALT_HOME      0x1e6
+#define CURSES_ALT_PGUP      0x1e7
+#define CURSES_ALT_PGDN      0x1e8
+#define CURSES_ALT_END       0x1e9
+#define CURSES_ALT_UP        0x1ea  /* alt-up arrow */
+#define CURSES_ALT_DOWN      0x1eb  /* alt-down arrow */
+#define CURSES_ALT_RIGHT     0x1ec  /* alt-right arrow */
+#define CURSES_ALT_LEFT      0x1ed  /* alt-left arrow */
+#define CURSES_ALT_ENTER     0x1ee  /* alt-enter */
+#define CURSES_ALT_ESC       0x1ef  /* alt-escape */
+#define CURSES_ALT_BQUOTE    0x1f0  /* alt-back quote */
+#define CURSES_ALT_LBRACKET  0x1f1  /* alt-left bracket */
+#define CURSES_ALT_RBRACKET  0x1f2  /* alt-right bracket */
+#define CURSES_ALT_SEMICOLON 0x1f3  /* alt-semi-colon */
+#define CURSES_ALT_FQUOTE    0x1f4  /* alt-forward quote */
+#define CURSES_ALT_COMMA     0x1f5  /* alt-comma */
+#define CURSES_ALT_STOP      0x1f6  /* alt-stop */
+#define CURSES_ALT_FSLASH    0x1f7  /* alt-forward slash */
+#define CURSES_ALT_BKSP      0x1f8  /* alt-backspace */
+#define CURSES_CTL_BKSP      0x1f9  /* ctl-backspace */
+#define CURSES_PAD0          0x1fa  /* keypad 0 */
+
+#define CURSES_CTL_PAD0      0x1fb  /* ctl-keypad 0 */
+#define CURSES_CTL_PAD1      0x1fc
+#define CURSES_CTL_PAD2      0x1fd
+#define CURSES_CTL_PAD3      0x1fe
+#define CURSES_CTL_PAD4      0x1ff
+#define CURSES_CTL_PAD5      0x200
+#define CURSES_CTL_PAD6      0x201
+#define CURSES_CTL_PAD7      0x202
+#define CURSES_CTL_PAD8      0x203
+#define CURSES_CTL_PAD9      0x204
+
+#define CURSES_ALT_PAD0      0x205  /* alt-keypad 0 */
+#define CURSES_ALT_PAD1      0x206
+#define CURSES_ALT_PAD2      0x207
+#define CURSES_ALT_PAD3      0x208
+#define CURSES_ALT_PAD4      0x209
+#define CURSES_ALT_PAD5      0x20a
+#define CURSES_ALT_PAD6      0x20b
+#define CURSES_ALT_PAD7      0x20c
+#define CURSES_ALT_PAD8      0x20d
+#define CURSES_ALT_PAD9      0x20e
+
+#define CURSES_CTL_DEL       0x20f  /* clt-delete */
+#define CURSES_ALT_BSLASH    0x210  /* alt-back slash */
+#define CURSES_CTL_ENTER     0x211  /* ctl-enter */
+
+#define CURSES_SHF_PADENTER  0x212  /* shift-enter on keypad */
+#define CURSES_SHF_PADSLASH  0x213  /* shift-slash on keypad */
+#define CURSES_SHF_PADSTAR   0x214  /* shift-star  on keypad */
+#define CURSES_SHF_PADPLUS   0x215  /* shift-plus  on keypad */
+#define CURSES_SHF_PADMINUS  0x216  /* shift-minus on keypad */
+#define CURSES_SHF_UP        0x217  /* shift-up on keypad */
+#define CURSES_SHF_DOWN      0x218  /* shift-down on keypad */
+#define CURSES_SHF_IC        0x219  /* shift-insert on keypad */
+#define CURSES_SHF_DC        0x21a  /* shift-delete on keypad */
+
+#define CURSES_KEY_MOUSE     0x21b  /* "mouse" key */
+#define CURSES_KEY_SHIFT_L   0x21c  /* Left-shift */
+#define CURSES_KEY_SHIFT_R   0x21d  /* Right-shift */
+#define CURSES_KEY_CONTROL_L 0x21e  /* Left-control */
+#define CURSES_KEY_CONTROL_R 0x21f  /* Right-control */
+#define CURSES_KEY_ALT_L     0x220  /* Left-alt */
+#define CURSES_KEY_ALT_R     0x221  /* Right-alt */
+#define CURSES_KEY_RESIZE    0x222  /* Window resize */
+#define CURSES_KEY_SUP       0x223  /* Shifted up arrow */
+#define CURSES_KEY_SDOWN     0x224  /* Shifted down arrow */
+
+#define CURSES_KEY_MIN       CURSES_KEY_BREAK      /* Minimum curses key value */
+#define CURSES_KEY_MAX       CURSES_KEY_SDOWN      /* Maximum curses key */
+
+#define CURSES_KEY_F(n)      (CURSES_KEY_F0 + (n)) 
+
+#define getch()            wgetch(stdscr)
+#define ungetch(ch)        PDC_ungetch(ch)
+
+#define CURSES_COLOR_PAIR(n)      (((chtype)(n) << CURSES_PDC_COLOR_SHIFT) & CURSES_A_COLOR)
+#define CURSES_PAIR_NUMBER(n)     (((n) & CURSES_A_COLOR) >> CURSES_PDC_COLOR_SHIFT)
+
+#define getbegyx(w, y, x)  (y = getbegy(w), x = getbegx(w))
+#define getmaxyx(w, y, x)  (y = getmaxy(w), x = getmaxx(w))
+#define getparyx(w, y, x)  (y = getpary(w), x = getparx(w))
+#define getyx(w, y, x)     (y = getcury(w), x = getcurx(w))
+
+#define getsyx(y, x)       { if (curscr->_leaveit) (y)=(x)=-1; \
+                             else getyx(curscr,(y),(x)); }
+
+#ifdef CURSES_NCURSES_MOUSE_VERSION
+# define getmouse(x) nc_getmouse(x)
+#endif
+
+#define CURSES_PDC_CLIP_SUCCESS         0
+#define CURSES_PDC_CLIP_ACCESS_ERROR    1
+#define CURSES_PDC_CLIP_EMPTY           2
+#define CURSES_PDC_CLIP_MEMORY_ERROR    3
+
+#define CURSES_PDC_KEY_MODIFIER_SHIFT   1
+#define CURSES_PDC_KEY_MODIFIER_CONTROL 2
+#define CURSES_PDC_KEY_MODIFIER_ALT     4
+#define CURSES_PDC_KEY_MODIFIER_NUMLOCK 8
Index: /trunk/src/lib/curses.cc
===================================================================
--- /trunk/src/lib/curses.cc	(revision 218)
+++ /trunk/src/lib/curses.cc	(revision 218)
@@ -0,0 +1,28 @@
+// Copyright (C) 2013 ChaosForge / Kornel Kisielewicz
+// http://chaosforge.org/
+//
+// This file is part of NV Libraries.
+// For conditions of distribution and use, see copyright notice in nv.hh
+
+#include "nv/lib/curses.hh"
+
+#if defined( NV_CURSES_DYNAMIC )
+
+#include "nv/library.hh"
+
+#define NV_CURSES_FUN( rtype, fname, fparams ) rtype (*fname) fparams = nullptr;
+#include <nv/lib/detail/curses_functions.inc>
+#undef NV_CURSES_FUN
+
+bool nv::load_curses_library( const char* path )
+{
+	static nv::library curses_library;
+	if ( curses_library.is_open() ) return true;
+	curses_library.open( path );
+
+#	define NV_CURSES_FUN( rtype, fname, fparams ) *(void **) (&fname) = curses_library.get(#fname);
+#	include <nv/lib/detail/curses_functions.inc>
+#	undef NV_CURSES_FUN
+	return true;
+}
+#endif
