Update to ncurses-6.0

Change-Id: I98ab2ea8a5e13cca9f8b7cf6277b9b14a4da4299
diff --git a/include/Caps b/include/Caps
index 7c63c7f..120ae35 100644
--- a/include/Caps
+++ b/include/Caps
@@ -1,5 +1,5 @@
 ##############################################################################
-# Copyright (c) 1998-2002,2006 Free Software Foundation, Inc.                #
+# Copyright (c) 1998-2011,2015 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"), #
@@ -29,7 +29,7 @@
 # Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995
 #    and: Eric S. Raymond <esr@snark.thyrsus.com>
 #
-# $Id: Caps,v 1.36 2006/05/27 15:33:04 tom Exp $
+# $Id: Caps,v 1.39 2015/04/26 15:25:55 tom Exp $
 #
 # This is the master termcap/terminfo capability table.
 #
@@ -97,7 +97,7 @@
 # 3. List it in the standard table.  You almost certainly do *not* want
 # to do this -- the capabilities in that one, and their order, have been
 # carefully chosen to be SVr4-binary-compatible when they're written out
-# as a terminfo object, and breaking this would be bad.  It's up the ncurses
+# as a terminfo object, and breaking this would be bad.  It's up to the ncurses
 # library what to do with the terminfo data after it's read in.
 #
 # 4. List it in the aliases table with an IGNORE target field.  If you
@@ -227,7 +227,7 @@
 over_strike			os	bool	os	-	-	YBCG-	terminal can overstrike
 status_line_esc_ok		eslok	bool	es	-	-	YB-G-	escape can be used on the status line
 dest_tabs_magic_smso		xt	bool	xt	-	-	YBCGE	tabs destructive, magic so char (t1061)
-tilde_glitch			hz	bool	hz	-	-	YB-GE	cannot print ~'s (hazeltine)
+tilde_glitch			hz	bool	hz	-	-	YB-GE	cannot print ~'s (Hazeltine)
 transparent_underline		ul	bool	ul	-	-	YBCGE	underline character overstrikes
 xon_xoff			xon	bool	xo	-	-	YB---	terminal uses xon/xoff handshaking
 needs_xon_xoff			nxon	bool	nx	-	-	-----	padding will not work, xon/xoff required
@@ -271,7 +271,7 @@
 label_height			lh	num	lh	-	-	-----	rows in each label
 label_width			lw	num	lw	-	-	-----	columns in each label
 max_attributes			ma	num	ma	-	-	YBC--	maximum combined attributes terminal can handle
-maximum_windows			wnum	num	MW	-	-	-----	maximum number of defineable windows
+maximum_windows			wnum	num	MW	-	-	-----	maximum number of definable windows
 # These came in with SVr4's color support
 max_colors			colors	num	Co	-	-	-----	maximum number of colors on screen
 max_pairs			pairs	num	pa	-	-	-----	maximum number of color-pairs on the screen
@@ -719,7 +719,7 @@
 bit_image_newline		binel	str	Zz	-		-	-----	Move to next row of the bit image
 bit_image_carriage_return	bicr	str	Yv	-		-	-----	Move to beginning of same row
 color_names			colornm	str	Yw	-		-	-----	Give name for color #1
-define_bit_image_region		defbi	str	Yx	-		-	-----	Define rectangualar bit image region
+define_bit_image_region		defbi	str	Yx	-		-	-----	Define rectangular bit image region
 end_bit_image_region		endbi	str	Yy	-		-	-----	End a bit-image region
 set_color_band		setcolor	str	Yz	-		-	-----	Change to ribbon color #1
 set_page_length			slines	str	YZ	-		-	-----	Set page length to #1 lines
@@ -738,11 +738,13 @@
 #%.ad
 #%
 #%.in .8i
-#%The XSI Curses standard added these.  They are some post-4.1 
-#%versions of System V curses, e.g., Solaris 2.5 and IRIX 6.x.
-#%The \fBncurses\fR termcap names for them are invented; according to the
-#%XSI Curses standard, they have no termcap names.  If your compiled terminfo
-#%entries use these, they may not be binary-compatible with System V terminfo
+#%The XSI Curses standard added these hardcopy capabilities.
+#%They were used in some post-4.1 versions of System V curses,
+#%e.g., Solaris 2.5 and IRIX 6.x.
+#%Except for \fBYI\fP, the \fBncurses\fR termcap names for them are invented.
+#%According to the XSI Curses standard, they have no termcap names.
+#%If your compiled terminfo entries use these,
+#%they may not be binary-compatible with System V terminfo
 #%entries after SVr4.1; beware!
 #%
 #%.na
@@ -760,7 +762,7 @@
 enter_top_hl_mode		ethlm	str	Xt	-		-	-----	Enter top highlight mode
 enter_vertical_hl_mode		evhlm	str	Xv	-		-	-----	Enter vertical highlight mode
 set_a_attributes		sgr1	str	sA	-		-	-----	Define second set of video attributes #1-#6
-set_pglen_inch			slength	str	sL	-		-	-----	YI Set page length to #1 hundredth of an inch
+set_pglen_inch			slength	str	YI	-		-	-----	Set page length to #1 hundredth of an inch (some implementations use sL for termcap).
 #%.TE
 #%.ad
 #
@@ -1256,9 +1258,3 @@
 # kcmd, kend, khlp, and kf11...kf63.
 #
 #############################################################################
-#
-# The following sets edit modes for GNU EMACS
-# Local Variables:
-# case-fold-search:nil
-# truncate-lines:t
-# End:
diff --git a/include/Caps.aix4 b/include/Caps.aix4
index 75913dc..8fb53c2 100644
--- a/include/Caps.aix4
+++ b/include/Caps.aix4
@@ -1,5 +1,5 @@
 ##############################################################################
-# Copyright (c) 2001-2002,2006 Free Software Foundation, Inc.                #
+# Copyright (c) 2001-2011,2015 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"), #
@@ -28,7 +28,7 @@
 #
 # Author: Thomas Dickey
 #
-# $Id: Caps.aix4,v 1.7 2006/05/27 15:33:04 tom Exp $
+# $Id: Caps.aix4,v 1.10 2015/04/26 15:25:55 tom Exp $
 #
 # This is an adaptation of ncurses' termcap/terminfo capability table, which
 # is designed to align with AIX 4.x's terminfo.
@@ -97,7 +97,7 @@
 # 3. List it in the standard table.  You almost certainly do *not* want
 # to do this -- the capabilities in that one, and their order, have been
 # carefully chosen to be SVr4-binary-compatible when they're written out
-# as a terminfo object, and breaking this would be bad.  It's up the ncurses
+# as a terminfo object, and breaking this would be bad.  It's up to the ncurses
 # library what to do with the terminfo data after it's read in.
 #
 # 4. List it in the aliases table with an IGNORE target field.  If you
@@ -227,7 +227,7 @@
 over_strike			os	bool	os	-	-	YBCG-	terminal can overstrike
 status_line_esc_ok		eslok	bool	es	-	-	YB-G-	escape can be used on the status line
 dest_tabs_magic_smso		xt	bool	xt	-	-	YBCGE	tabs destructive, magic so char (t1061)
-tilde_glitch			hz	bool	hz	-	-	YB-GE	cannot print ~'s (hazeltine)
+tilde_glitch			hz	bool	hz	-	-	YB-GE	cannot print ~'s (Hazeltine)
 transparent_underline		ul	bool	ul	-	-	YBCGE	underline character overstrikes
 xon_xoff			xon	bool	xo	-	-	YB---	terminal uses xon/xoff handshaking
 needs_xon_xoff			nxon	bool	nx	-	-	-----	padding will not work, xon/xoff required
@@ -271,7 +271,7 @@
 label_height			lh	num	lh	-	-	-----	rows in each label
 label_width			lw	num	lw	-	-	-----	columns in each label
 max_attributes			ma	num	ma	-	-	YBC--	maximum combined attributes terminal can handle
-maximum_windows			wnum	num	MW	-	-	-----	maximum number of defineable windows
+maximum_windows			wnum	num	MW	-	-	-----	maximum number of definable windows
 # These came in with SVr4's color support
 max_colors			colors	num	Co	-	-	-----	maximum number of colors on screen
 max_pairs			pairs	num	pa	-	-	-----	maximum number of color-pairs on the screen
@@ -821,7 +821,7 @@
 bit_image_newline		binel	str	Zz	-		-	-----	Move to next row of the bit image
 bit_image_carriage_return	bicr	str	Yv	-		-	-----	Move to beginning of same row
 color_names			colornm	str	Yw	-		-	-----	Give name for color #1
-define_bit_image_region		defbi	str	Yx	-		-	-----	Define rectangualar bit image region
+define_bit_image_region		defbi	str	Yx	-		-	-----	Define rectangular bit image region
 end_bit_image_region		endbi	str	Yy	-		-	-----	End a bit-image region
 set_color_band		setcolor	str	Yz	-		-	-----	Change to ribbon color #1
 set_page_length			slines	str	YZ	-		-	-----	Set page length to #1 lines
@@ -840,11 +840,13 @@
 #%.ad
 #%
 #%.in .8i
-#%The XSI Curses standard added these.  They are some post-4.1 
-#%versions of System V curses, e.g., Solaris 2.5 and IRIX 6.x.
-#%The \fBncurses\fR termcap names for them are invented; according to the
-#%XSI Curses standard, they have no termcap names.  If your compiled terminfo
-#%entries use these, they may not be binary-compatible with System V terminfo
+#%The XSI Curses standard added these hardcopy capabilities.
+#%They were used in some post-4.1 versions of System V curses,
+#%e.g., Solaris 2.5 and IRIX 6.x.
+#%Except for \fBYI\fP, the \fBncurses\fR termcap names for them are invented.
+#%According to the XSI Curses standard, they have no termcap names.
+#%If your compiled terminfo entries use these,
+#%they may not be binary-compatible with System V terminfo
 #%entries after SVr4.1; beware!
 #%
 #%.na
@@ -862,7 +864,7 @@
 enter_top_hl_mode		ethlm	str	Xt	-		-	-----	Enter top highlight mode
 enter_vertical_hl_mode		evhlm	str	Xv	-		-	-----	Enter vertical highlight mode
 set_a_attributes		sgr1	str	sA	-		-	-----	Define second set of video attributes #1-#6
-set_pglen_inch			slength	str	sL	-		-	-----	YI Set page length to #1 hundredth of an inch
+set_pglen_inch			slength	str	YI	-		-	-----	Set page length to #1 hundredth of an inch (some implementations use sL for termcap).
 #%.TE
 #%.ad
 #
@@ -1247,9 +1249,3 @@
 # kcmd, kend, khlp, and kf11...kf63.
 #
 #############################################################################
-#
-# The following sets edit modes for GNU EMACS
-# Local Variables:
-# case-fold-search:nil
-# truncate-lines:t
-# End:
diff --git a/include/Caps.hpux11 b/include/Caps.hpux11
index b74acdb..512aa82 100644
--- a/include/Caps.hpux11
+++ b/include/Caps.hpux11
@@ -1,5 +1,5 @@
 ##############################################################################
-# Copyright (c) 2002-2003,2006 Free Software Foundation, Inc.                #
+# Copyright (c) 2002-2011,2015 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"), #
@@ -28,7 +28,7 @@
 #
 # Author: Thomas Dickey
 #
-# $Id: Caps.hpux11,v 1.4 2006/05/27 15:33:04 tom Exp $
+# $Id: Caps.hpux11,v 1.7 2015/04/26 15:25:55 tom Exp $
 #
 # This is an adaptation of ncurses' termcap/terminfo capability table, which
 # is designed to align with HPUX 11.x's terminfo.
@@ -97,7 +97,7 @@
 # 3. List it in the standard table.  You almost certainly do *not* want
 # to do this -- the capabilities in that one, and their order, have been
 # carefully chosen to be SVr4-binary-compatible when they're written out
-# as a terminfo object, and breaking this would be bad.  It's up the ncurses
+# as a terminfo object, and breaking this would be bad.  It's up to the ncurses
 # library what to do with the terminfo data after it's read in.
 #
 # 4. List it in the aliases table with an IGNORE target field.  If you
@@ -227,7 +227,7 @@
 over_strike			os	bool	os	-	-	YBCG-	terminal can overstrike
 status_line_esc_ok		eslok	bool	es	-	-	YB-G-	escape can be used on the status line
 dest_tabs_magic_smso		xt	bool	xt	-	-	YBCGE	tabs destructive, magic so char (t1061)
-tilde_glitch			hz	bool	hz	-	-	YB-GE	cannot print ~'s (hazeltine)
+tilde_glitch			hz	bool	hz	-	-	YB-GE	cannot print ~'s (Hazeltine)
 transparent_underline		ul	bool	ul	-	-	YBCGE	underline character overstrikes
 xon_xoff			xon	bool	xo	-	-	YB---	terminal uses xon/xoff handshaking
 # end booleans for HPUX 9, 10 (non-color curses)
@@ -273,7 +273,7 @@
 label_height			lh	num	lh	-	-	-----	rows in each label
 label_width			lw	num	lw	-	-	-----	columns in each label
 max_attributes			ma	num	ma	-	-	YBC--	maximum combined attributes terminal can handle
-maximum_windows			wnum	num	MW	-	-	-----	maximum number of defineable windows
+maximum_windows			wnum	num	MW	-	-	-----	maximum number of definable windows
 # These came in with SVr4's color support
 max_colors			colors	num	Co	-	-	-----	maximum number of colors on screen
 max_pairs			pairs	num	pa	-	-	-----	maximum number of color-pairs on the screen
@@ -727,7 +727,7 @@
 bit_image_newline		binel	str	Zz	-		-	-----	Move to next row of the bit image
 bit_image_carriage_return	bicr	str	Yv	-		-	-----	Move to beginning of same row
 color_names			colornm	str	Yw	-		-	-----	Give name for color #1
-define_bit_image_region		defbi	str	Yx	-		-	-----	Define rectangualar bit image region
+define_bit_image_region		defbi	str	Yx	-		-	-----	Define rectangular bit image region
 end_bit_image_region		endbi	str	Yy	-		-	-----	End a bit-image region
 set_color_band		setcolor	str	Yz	-		-	-----	Change to ribbon color #1
 set_page_length			slines	str	YZ	-		-	-----	Set page length to #1 lines
@@ -746,11 +746,13 @@
 #%.ad
 #%
 #%.in .8i
-#%The XSI Curses standard added these.  They are some post-4.1 
-#%versions of System V curses, e.g., Solaris 2.5 and IRIX 6.x.
-#%The \fBncurses\fR termcap names for them are invented; according to the
-#%XSI Curses standard, they have no termcap names.  If your compiled terminfo
-#%entries use these, they may not be binary-compatible with System V terminfo
+#%The XSI Curses standard added these hardcopy capabilities.
+#%They were used in some post-4.1 versions of System V curses,
+#%e.g., Solaris 2.5 and IRIX 6.x.
+#%Except for \fBYI\fP, the \fBncurses\fR termcap names for them are invented.
+#%According to the XSI Curses standard, they have no termcap names.
+#%If your compiled terminfo entries use these,
+#%they may not be binary-compatible with System V terminfo
 #%entries after SVr4.1; beware!
 #%
 #%.na
@@ -761,7 +763,7 @@
 #%lw25 lw6 lw2 lw20.
 #%\fBVariable	Cap-	TCap	Description\fR
 #%\fBString	name	Code\fR
-set_pglen_inch			slength	str	sL	-		-	-----	YI Set page length to #1 hundredth of an inch
+set_pglen_inch			slength	str	YI	-		-	-----	Set page length to #1 hundredth of an inch (some implementations use sL for termcap).
 enter_horizontal_hl_mode	ehhlm	str	Xh	-		-	-----	Enter horizontal highlight mode
 enter_left_hl_mode		elhlm	str	Xl	-		-	-----	Enter left highlight mode
 enter_low_hl_mode		elohlm	str	Xo	-		-	-----	Enter low highlight mode
@@ -1270,9 +1272,3 @@
 # kcmd, kend, khlp, and kf11...kf63.
 #
 #############################################################################
-#
-# The following sets edit modes for GNU EMACS
-# Local Variables:
-# case-fold-search:nil
-# truncate-lines:t
-# End:
diff --git a/include/Caps.keys b/include/Caps.keys
index 6841ae5..ebf392b 100644
--- a/include/Caps.keys
+++ b/include/Caps.keys
@@ -1,5 +1,5 @@
 ##############################################################################
-# Copyright (c) 2001-2002,2006 Free Software Foundation, Inc.                #
+# Copyright (c) 2001-2013,2015 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"), #
@@ -29,7 +29,7 @@
 # Author: Thomas Dickey
 #    and: Ilya Zakharevich
 #
-# $Id: Caps.keys,v 1.3 2006/05/27 15:33:04 tom Exp $
+# $Id: Caps.keys,v 1.8 2015/04/26 15:25:55 tom Exp $
 #
 # This is an adaptation of ncurses' termcap/terminfo capability table, which
 # is illustrates an experimental extension to describe alt-, shift- and
@@ -99,7 +99,7 @@
 # 3. List it in the standard table.  You almost certainly do *not* want
 # to do this -- the capabilities in that one, and their order, have been
 # carefully chosen to be SVr4-binary-compatible when they're written out
-# as a terminfo object, and breaking this would be bad.  It's up the ncurses
+# as a terminfo object, and breaking this would be bad.  It's up to the ncurses
 # library what to do with the terminfo data after it's read in.
 #
 # 4. List it in the aliases table with an IGNORE target field.  If you
@@ -229,11 +229,11 @@
 over_strike			os	bool	os	-	-	YBCG-	terminal can overstrike
 status_line_esc_ok		eslok	bool	es	-	-	YB-G-	escape can be used on the status line
 dest_tabs_magic_smso		xt	bool	xt	-	-	YBCGE	tabs destructive, magic so char (t1061)
-tilde_glitch			hz	bool	hz	-	-	YB-GE	can't print ~'s (hazeltine)
+tilde_glitch			hz	bool	hz	-	-	YB-GE	cannot print ~'s (Hazeltine)
 transparent_underline		ul	bool	ul	-	-	YBCGE	underline character overstrikes
 xon_xoff			xon	bool	xo	-	-	YB---	terminal uses xon/xoff handshaking
-needs_xon_xoff			nxon	bool	nx	-	-	-----	padding won't work, xon/xoff required
-prtr_silent			mc5i	bool	5i	-	-	-----	printer won't echo on screen
+needs_xon_xoff			nxon	bool	nx	-	-	-----	padding will not work, xon/xoff required
+prtr_silent			mc5i	bool	5i	-	-	-----	printer will not echo on screen
 hard_cursor			chts	bool	HC	-	-	-----	cursor is hard to see
 non_rev_rmcup			nrrmc	bool	NR	-	-	-----	smcup does not reverse rmcup
 no_pad_char			npc	bool	NP	-	-	-----	pad character does not exist
@@ -273,11 +273,11 @@
 label_height			lh	num	lh	-	-	-----	rows in each label
 label_width			lw	num	lw	-	-	-----	columns in each label
 max_attributes			ma	num	ma	-	-	YBC--	maximum combined attributes terminal can handle
-maximum_windows			wnum	num	MW	-	-	-----	maximum number of defineable windows
+maximum_windows			wnum	num	MW	-	-	-----	maximum number of definable windows
 # These came in with SVr4's color support
 max_colors			colors	num	Co	-	-	-----	maximum number of colors on screen
 max_pairs			pairs	num	pa	-	-	-----	maximum number of color-pairs on the screen
-no_color_video			ncv	num	NC	-	-	-----	video attributes that can't be used with colors
+no_color_video			ncv	num	NC	-	-	-----	video attributes that cannot be used with colors
 #%.TE
 #%.ad
 #%
@@ -809,7 +809,7 @@
 bit_image_newline		binel	str	Zz	-		-	-----	Move to next row of the bit image
 bit_image_carriage_return	bicr	str	Yv	-		-	-----	Move to beginning of same row
 color_names			colornm	str	Yw	-		-	-----	Give name for color #1
-define_bit_image_region		defbi	str	Yx	-		-	-----	Define rectangualar bit image region
+define_bit_image_region		defbi	str	Yx	-		-	-----	Define rectangular bit image region
 end_bit_image_region		endbi	str	Yy	-		-	-----	End a bit-image region
 set_color_band		setcolor	str	Yz	-		-	-----	Change to ribbon color #1
 set_page_length			slines	str	YZ	-		-	-----	Set page length to #1 lines
@@ -828,11 +828,13 @@
 #%.ad
 #%
 #%.in .8i
-#%The XSI Curses standard added these.  They are some post-4.1 
-#%versions of System V curses, e.g., Solaris 2.5 and IRIX 6.x.
-#%The \fBncurses\fR termcap names for them are invented; according to the
-#%XSI Curses standard, they have no termcap names.  If your compiled terminfo
-#%entries use these, they may not be binary-compatible with System V terminfo
+#%The XSI Curses standard added these hardcopy capabilities.
+#%They were used in some post-4.1 versions of System V curses,
+#%e.g., Solaris 2.5 and IRIX 6.x.
+#%Except for \fBYI\fP, the \fBncurses\fR termcap names for them are invented.
+#%According to the XSI Curses standard, they have no termcap names.
+#%If your compiled terminfo entries use these,
+#%they may not be binary-compatible with System V terminfo
 #%entries after SVr4.1; beware!
 #%
 #%.na
@@ -850,7 +852,7 @@
 enter_top_hl_mode		ethlm	str	Xt	-		-	-----	Enter top highlight mode
 enter_vertical_hl_mode		evhlm	str	Xv	-		-	-----	Enter vertical highlight mode
 set_a_attributes		sgr1	str	sA	-		-	-----	Define second set of video attributes #1-#6
-set_pglen_inch			slength	str	sL	-		-	-----	YI Set page length to #1 hundredth of an inch
+set_pglen_inch			slength	str	YI	-		-	-----	Set page length to #1 hundredth of an inch (some implementations use sL for termcap).
 #%.TE
 #%.ad
 #
@@ -1346,9 +1348,3 @@
 # kcmd, kend, khlp, and kf11...kf63.
 #
 #############################################################################
-#
-# The following sets edit modes for GNU EMACS
-# Local Variables:
-# case-fold-search:nil
-# truncate-lines:t
-# End:
diff --git a/include/Caps.osf1r5 b/include/Caps.osf1r5
index d9ea564..e1bfe0b 100644
--- a/include/Caps.osf1r5
+++ b/include/Caps.osf1r5
@@ -1,5 +1,5 @@
 ##############################################################################
-# Copyright (c) 2002,2006 Free Software Foundation, Inc.                     #
+# Copyright (c) 2002-2011,2015 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"), #
@@ -28,7 +28,7 @@
 #
 # Author: Thomas Dickey
 #
-# $Id: Caps.osf1r5,v 1.4 2006/05/27 15:33:04 tom Exp $
+# $Id: Caps.osf1r5,v 1.7 2015/04/26 15:25:55 tom Exp $
 #
 # This is an adaptation of ncurses' termcap/terminfo capability table, which
 # is designed to align with OSF/1 version 5 (Tru64) terminfo.
@@ -97,7 +97,7 @@
 # 3. List it in the standard table.  You almost certainly do *not* want
 # to do this -- the capabilities in that one, and their order, have been
 # carefully chosen to be SVr4-binary-compatible when they're written out
-# as a terminfo object, and breaking this would be bad.  It's up the ncurses
+# as a terminfo object, and breaking this would be bad.  It's up to the ncurses
 # library what to do with the terminfo data after it's read in.
 #
 # 4. List it in the aliases table with an IGNORE target field.  If you
@@ -227,7 +227,7 @@
 over_strike			os	bool	os	-	-	YBCG-	terminal can overstrike
 status_line_esc_ok		eslok	bool	es	-	-	YB-G-	escape can be used on the status line
 dest_tabs_magic_smso		xt	bool	xt	-	-	YBCGE	tabs destructive, magic so char (t1061)
-tilde_glitch			hz	bool	hz	-	-	YB-GE	cannot print ~'s (hazeltine)
+tilde_glitch			hz	bool	hz	-	-	YB-GE	cannot print ~'s (Hazeltine)
 transparent_underline		ul	bool	ul	-	-	YBCGE	underline character overstrikes
 xon_xoff			xon	bool	xo	-	-	YB---	terminal uses xon/xoff handshaking
 back_color_erase		bce	bool	ut	-	-	-----	screen erased with background color
@@ -280,7 +280,7 @@
 max_micro_address		maddr	num	Yd	-	-	-----	maximum value in micro_..._address
 max_micro_jump			mjump	num	Ye	-	-	-----	maximum value in parm_..._micro
 max_pairs			pairs	num	pa	-	-	-----	maximum number of color-pairs on the screen
-maximum_windows			wnum	num	MW	-	-	-----	maximum number of defineable windows
+maximum_windows			wnum	num	MW	-	-	-----	maximum number of definable windows
 micro_col_size			mcs	num	Yf	-	-	-----	character step size when in micro mode
 micro_line_size			mls	num	Yg	-	-	-----	line step size when in micro mode
 no_color_video			ncv	num	NC	-	-	-----	video attributes that can not be used with colors
@@ -574,7 +574,7 @@
 code_set_init			csin	str	ci	-		-	-----	Init sequence for multiple codesets
 color_names			colornm	str	Yw	-		-	-----	Give name for color #1
 create_window			cwin	str	CW	-		-	-----	define a window #1 from #2,#3 to #4,#5
-define_bit_image_region		defbi	str	Yx	-		-	-----	Define rectangualar bit image region
+define_bit_image_region		defbi	str	Yx	-		-	-----	Define rectangular bit image region
 define_char			defc	str	ZE	-		-	-----	Define a character #1, #2 dots wide, descender #3
 device_type			devt	str	dv	-		-	-----	Indicate language/codeset support
 dial_phone			dial	str	DI	-		-	-----	dial number #1
@@ -769,7 +769,7 @@
 xoff_character			xoffc	str	XF	-		-	-----	XOFF character
 xon_character			xonc	str	XN	-		-	-----	XON character
 zero_motion			zerom	str	Zx	-		-	-----	No motion for subsequent character
-set_pglen_inch			slength	str	sL	-		-	-----	YI Set page length to #1 hundredth of an inch
+set_pglen_inch			slength	str	YI	-		-	-----	Set page length to #1 hundredth of an inch (some implementations use sL for termcap).
 enter_horizontal_hl_mode	ehhlm	str	Xh	-		-	-----	Enter horizontal highlight mode
 enter_left_hl_mode		elhlm	str	Xl	-		-	-----	Enter left highlight mode
 enter_low_hl_mode		elohlm	str	Xo	-		-	-----	Enter low highlight mode
@@ -1266,9 +1266,3 @@
 # kcmd, kend, khlp, and kf11...kf63.
 #
 #############################################################################
-#
-# The following sets edit modes for GNU EMACS
-# Local Variables:
-# case-fold-search:nil
-# truncate-lines:t
-# End:
diff --git a/include/Caps.uwin b/include/Caps.uwin
index 450eaeb..b09f612 100644
--- a/include/Caps.uwin
+++ b/include/Caps.uwin
@@ -1,5 +1,5 @@
 ##############################################################################
-# Copyright (c) 2001-2002,2006 Free Software Foundation, Inc.                #
+# Copyright (c) 2001-2010,2015 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"), #
@@ -28,7 +28,7 @@
 #
 # Author: Thomas Dickey
 #
-# $Id: Caps.uwin,v 1.4 2006/05/27 15:33:04 tom Exp $
+# $Id: Caps.uwin,v 1.6 2015/04/26 15:24:21 tom Exp $
 #
 # This is an adaptation of ncurses' termcap/terminfo capability table, which
 # is designed to align with U/Win's terminfo.
@@ -97,7 +97,7 @@
 # 3. List it in the standard table.  You almost certainly do *not* want
 # to do this -- the capabilities in that one, and their order, have been
 # carefully chosen to be SVr4-binary-compatible when they're written out
-# as a terminfo object, and breaking this would be bad.  It's up the ncurses
+# as a terminfo object, and breaking this would be bad.  It's up to the ncurses
 # library what to do with the terminfo data after it's read in.
 #
 # 4. List it in the aliases table with an IGNORE target field.  If you
@@ -227,7 +227,7 @@
 over_strike			os	bool	os	-	-	YBCG-	terminal can overstrike
 status_line_esc_ok		eslok	bool	es	-	-	YB-G-	escape can be used on the status line
 dest_tabs_magic_smso		xt	bool	xt	-	-	YBCGE	tabs destructive, magic so char (t1061)
-tilde_glitch			hz	bool	hz	-	-	YB-GE	cannot print ~'s (hazeltine)
+tilde_glitch			hz	bool	hz	-	-	YB-GE	cannot print ~'s (Hazeltine)
 transparent_underline		ul	bool	ul	-	-	YBCGE	underline character overstrikes
 xon_xoff			xon	bool	xo	-	-	YB---	terminal uses xon/xoff handshaking
 needs_xon_xoff			nxon	bool	nx	-	-	-----	padding will not work, xon/xoff required
@@ -1082,9 +1082,3 @@
 # kcmd, kend, khlp, and kf11...kf63.
 #
 #############################################################################
-#
-# The following sets edit modes for GNU EMACS
-# Local Variables:
-# case-fold-search:nil
-# truncate-lines:t
-# End:
diff --git a/include/MKkey_defs.sh b/include/MKkey_defs.sh
index b3cb4f7..45a06d0 100755
--- a/include/MKkey_defs.sh
+++ b/include/MKkey_defs.sh
@@ -1,7 +1,7 @@
 #! /bin/sh
-# $Id: MKkey_defs.sh,v 1.14 2003/12/06 17:10:09 tom Exp $
+# $Id: MKkey_defs.sh,v 1.15 2013/03/09 16:32:01 tom Exp $
 ##############################################################################
-# Copyright (c) 2001-2002,2003 Free Software Foundation, Inc.                #
+# Copyright (c) 2001-2003,2013 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"), #
@@ -65,9 +65,12 @@
 key_event	kv1	str	V1	KEY_EVENT	+	-----	We were interrupted by an event
 EOF
 
+THIS=./`basename $0`
+PARM=./`basename $DATA`
+
 cat <<EOF
 /*
- * These definitions were generated by $0 $DATA
+ * These definitions were generated by $THIS $PARM
  */
 EOF
 
diff --git a/include/MKparametrized.sh b/include/MKparametrized.sh
index 2825c82..3ce5d9c 100755
--- a/include/MKparametrized.sh
+++ b/include/MKparametrized.sh
@@ -1,6 +1,6 @@
 #!/bin/sh
 ##############################################################################
-# Copyright (c) 1998-2000,2006 Free Software Foundation, Inc.                #
+# Copyright (c) 1998-2006,2014 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"), #
@@ -26,7 +26,7 @@
 # use or other dealings in this Software without prior written               #
 # authorization.                                                             #
 ##############################################################################
-# $Id: MKparametrized.sh,v 1.6 2006/04/22 21:36:16 tom Exp $
+# $Id: MKparametrized.sh,v 1.7 2014/05/24 15:07:19 tom Exp $
 #
 # MKparametrized.sh -- generate indirection vectors for various sort methods
 #
@@ -53,10 +53,11 @@
 # this, that would be cleaner....
 
 ${AWK-awk} <$CAPS '
-$3 != "str"	{next;}
-$1 ~ /^acs_/	{print "-1,\t/* ", $2, " */"; count++; next;}
-$0 ~ /#[0-9]/	{print "1,\t/* ", $2, " */"; count++; next;}
-		{print "0,\t/* ", $2, " */"; count++;}
-END		{printf("} /* %d entries */;\n\n", count);}
+$3 != "str"		{next;}
+$1 ~ /^acs_/		{print "-1,\t/* ", $2, " */"; count++; next;}
+$1 ~ /^label_format/	{print "-1,\t/* ", $2, " */"; count++; next;}
+$0 ~ /#[0-9]/		{print "1,\t/* ", $2, " */"; count++; next;}
+			{print "0,\t/* ", $2, " */"; count++;}
+END			{printf("} /* %d entries */;\n\n", count);}
 '
 
diff --git a/include/MKterm.h.awk b/include/MKterm.h.awk
deleted file mode 100644
index 238448c..0000000
--- a/include/MKterm.h.awk
+++ /dev/null
@@ -1,320 +0,0 @@
-# vile:awkmode
-BEGIN		{
-		    print  "/****************************************************************************"
-		    print  " * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc.              *"
-		    print  " *                                                                          *"
-		    print  " * Permission is hereby granted, free of charge, to any person obtaining a  *"
-		    print  " * copy of this software and associated documentation files (the            *"
-		    print  " * \"Software\"), to deal in the Software without restriction, including      *"
-		    print  " * without limitation the rights to use, copy, modify, merge, publish,      *"
-		    print  " * distribute, distribute with modifications, sublicense, and/or sell       *"
-		    print  " * copies of the Software, and to permit persons to whom the Software is    *"
-		    print  " * furnished to do so, subject to the following conditions:                 *"
-		    print  " *                                                                          *"
-		    print  " * The above copyright notice and this permission notice shall be included  *"
-		    print  " * in all copies or substantial portions of the Software.                   *"
-		    print  " *                                                                          *"
-		    print  " * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *"
-		    print  " * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *"
-		    print  " * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *"
-		    print  " * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *"
-		    print  " * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *"
-		    print  " * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *"
-		    print  " * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *"
-		    print  " *                                                                          *"
-		    print  " * Except as contained in this notice, the name(s) of the above copyright   *"
-		    print  " * holders shall not be used in advertising or otherwise to promote the     *"
-		    print  " * sale, use or other dealings in this Software without prior written       *"
-		    print  " * authorization.                                                           *"
-		    print  " ****************************************************************************/"
-		    print  ""
-		    print  "/****************************************************************************/"
-		    print  "/* Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995                */"
-		    print  "/*    and: Eric S. Raymond <esr@snark.thyrsus.com>                          */"
-		    print  "/*    and: Thomas E. Dickey                        1995-on                  */"
-		    print  "/****************************************************************************/"
-		    print  ""
-		    print  "/* $Id: MKterm.h.awk.in,v 1.50 2008/05/24 23:13:59 tom Exp $ */"
-		    print  ""
-		    print  "/*"
-		    print  "**	term.h -- Definition of struct term"
-		    print  "*/"
-		    print  ""
-		    print  "#ifndef NCURSES_TERM_H_incl"
-		    print  "#define NCURSES_TERM_H_incl 1"
-		    print  ""
-		    print  "#undef  NCURSES_VERSION"
-		    print  "#define NCURSES_VERSION \"5.7\""
-		    print  ""
-		    print  "#include <ncurses_dll.h>"
-		    print  ""
-		    print  "#ifdef __cplusplus"
-		    print  "extern \"C\" {"
-		    print  "#endif"
-		    print  ""
-		    print  "/* Make this file self-contained by providing defaults for the HAVE_TERMIO[S]_H"
-		    print  " * definition (based on the system for which this was configured)."
-		    print  " */"
-		    print  ""
-		    print  "#undef  NCURSES_CONST"
-		    print  "#define NCURSES_CONST /*nothing*/"
-		    print  ""
-		    print  "#undef  NCURSES_SBOOL"
-		    print  "#define NCURSES_SBOOL char"
-		    print  ""
-		    print  "#undef  NCURSES_XNAMES"
-		    print  "#define NCURSES_XNAMES 1"
-		    print  ""
-		    print  "/* We will use these symbols to hide differences between"
-		    print  " * termios/termio/sgttyb interfaces."
-		    print  " */"
-		    print  "#undef  TTY"
-		    print  "#undef  SET_TTY"
-		    print  "#undef  GET_TTY"
-		    print  ""
-		    print  "/* Assume POSIX termio if we have the header and function */"
-		    print  "/* #if HAVE_TERMIOS_H && HAVE_TCGETATTR */"
-		    print  "#if 1 && 1"
-		    print  ""
-		    print  "#undef  TERMIOS"
-		    print  "#define TERMIOS 1"
-		    print  ""
-		    print  "#include <termios.h>"
-		    print  "#define TTY struct termios"
-		    print  ""
-		    print  "#else /* !HAVE_TERMIOS_H */"
-		    print  ""
-		    print  "/* #if HAVE_TERMIO_H */"
-		    print  "#if 0"
-		    print  ""
-		    print  "#undef  TERMIOS"
-		    print  "#define TERMIOS 1"
-		    print  ""
-		    print  "#include <termio.h>"
-		    print  "#define TTY struct termio"
-		    print  ""
-		    print  "/* Add definitions to make termio look like termios."
-		    print  " * But ifdef it, since there are some implementations"
-		    print  " * that try to do this for us in a fake <termio.h>."
-		    print  " */"
-		    print  "#ifndef TCSANOW"
-		    print  "#define TCSANOW TCSETA"
-		    print  "#endif"
-		    print  "#ifndef TCSADRAIN"
-		    print  "#define TCSADRAIN TCSETAW"
-		    print  "#endif"
-		    print  "#ifndef TCSAFLUSH"
-		    print  "#define TCSAFLUSH TCSETAF"
-		    print  "#endif"
-		    print  "#ifndef tcsetattr"
-		    print  "#define tcsetattr(fd, cmd, arg) ioctl(fd, cmd, arg)"
-		    print  "#endif"
-		    print  "#ifndef tcgetattr"
-		    print  "#define tcgetattr(fd, arg) ioctl(fd, TCGETA, arg)"
-		    print  "#endif"
-		    print  "#ifndef cfgetospeed"
-		    print  "#define cfgetospeed(t) ((t)->c_cflag & CBAUD)"
-		    print  "#endif"
-		    print  "#ifndef TCIFLUSH "
-		    print  "#define TCIFLUSH 0"
-		    print  "#endif"
-		    print  "#ifndef TCOFLUSH "
-		    print  "#define TCOFLUSH 1"
-		    print  "#endif"
-		    print  "#ifndef TCIOFLUSH "
-		    print  "#define TCIOFLUSH 2"
-		    print  "#endif"
-		    print  "#ifndef tcflush"
-		    print  "#define tcflush(fd, arg) ioctl(fd, TCFLSH, arg)"
-		    print  "#endif"
-		    print  ""
-		    print  "#else /* !HAVE_TERMIO_H */"
-		    print  ""
-		    print  "#undef TERMIOS"
-		    print  "#include <sgtty.h>"
-		    print  "#include <sys/ioctl.h>"
-		    print  "#define TTY struct sgttyb"
-		    print  ""
-		    print  "#endif /* HAVE_TERMIO_H */"
-		    print  ""
-		    print  "#endif /* HAVE_TERMIOS_H */"
-		    print  ""
-		    print  "#ifdef TERMIOS"
-		    print  "#define GET_TTY(fd, buf) tcgetattr(fd, buf)"
-		    print  "#define SET_TTY(fd, buf) tcsetattr(fd, TCSADRAIN, buf)"
-		    print  "#else"
-		    print  "#define GET_TTY(fd, buf) gtty(fd, buf)"
-		    print  "#define SET_TTY(fd, buf) stty(fd, buf)"
-		    print  "#endif"
-		    print  ""
-		    print  "#define NAMESIZE 256"
-		    print  ""
-		    print  "#define CUR cur_term->type."
-		    print  ""
-		}
-
-$2 == "%%-STOP-HERE-%%"	{
-			print  ""
-			printf "#define BOOLWRITE %d\n", BoolCount
-			printf "#define NUMWRITE  %d\n", NumberCount
-			printf "#define STRWRITE  %d\n", StringCount
-			print  ""
-			print  "/* older synonyms for some capabilities */"
-			print  "#define beehive_glitch	no_esc_ctlc"
-			print  "#define teleray_glitch	dest_tabs_magic_smso"
-			print  "#define micro_char_size micro_col_size"
-			print  ""
-			print  "#ifdef __INTERNAL_CAPS_VISIBLE"
-		}
-
-/^#/		{next;}
-
-$1 == "acs_chars"	{acsindex = StringCount}
-
-$3 == "bool"	{
-		    printf "#define %-30s CUR Booleans[%d]\n", $1, BoolCount++
-		}
-
-$3 == "num"	{
-		    printf "#define %-30s CUR Numbers[%d]\n", $1, NumberCount++
-		}
-
-$3 == "str"	{
-		    printf "#define %-30s CUR Strings[%d]\n", $1, StringCount++
-		}
-
-END		{
-			print  "#endif /* __INTERNAL_CAPS_VISIBLE */"
-			print  ""
-			print  ""
-			print  "/*"
-			print  " * Predefined terminfo array sizes"
-			print  " */"
-			printf "#define BOOLCOUNT %d\n", BoolCount
-			printf "#define NUMCOUNT  %d\n", NumberCount
-			printf "#define STRCOUNT  %d\n", StringCount
-			print  ""
-			print  "/* used by code for comparing entries */"
-			print  "#define acs_chars_index	", acsindex
-			print  ""
-			print  "typedef struct termtype {	/* in-core form of terminfo data */"
-			print  "    char  *term_names;		/* str_table offset of term names */"
-			print  "    char  *str_table;		/* pointer to string table */"
-			print  "    NCURSES_SBOOL  *Booleans;	/* array of boolean values */"
-			print  "    short *Numbers;		/* array of integer values */"
-			print  "    char  **Strings;		/* array of string offsets */"
-			print  ""
-			print  "#if NCURSES_XNAMES"
-			print  "    char  *ext_str_table;	/* pointer to extended string table */"
-			print  "    char  **ext_Names;		/* corresponding names */"
-			print  ""
-			print  "    unsigned short num_Booleans;/* count total Booleans */"
-			print  "    unsigned short num_Numbers;	/* count total Numbers */"
-			print  "    unsigned short num_Strings;	/* count total Strings */"
-			print  ""
-			print  "    unsigned short ext_Booleans;/* count extensions to Booleans */"
-			print  "    unsigned short ext_Numbers;	/* count extensions to Numbers */"
-			print  "    unsigned short ext_Strings;	/* count extensions to Strings */"
-			print  "#endif /* NCURSES_XNAMES */"
-			print  ""
-			print  "} TERMTYPE;"
-			print  ""
-			print  "typedef struct term {		/* describe an actual terminal */"
-			print  "    TERMTYPE	type;		/* terminal type description */"
-			print  "    short	Filedes;	/* file description being written to */"
-			print  "    TTY		Ottyb,		/* original state of the terminal */"
-			print  "		Nttyb;		/* current state of the terminal */"
-			print  "    int		_baudrate;	/* used to compute padding */"
-			print  "    char *      _termname;      /* used for termname() */"
-			print  "} TERMINAL;"
-			print  ""
-			print  "#if 0 || 0"
-			print  "NCURSES_WRAPPED_VAR(TERMINAL *, cur_term);"
-			print  "NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, boolnames);"
-			print  "NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, boolcodes);"
-			print  "NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, boolfnames);"
-			print  "NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, numnames);"
-			print  "NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, numcodes);"
-			print  "NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, numfnames);"
-			print  "NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, strnames);"
-			print  "NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, strcodes);"
-			print  "NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, strfnames);"
-			print  ""
-			print  "#define cur_term   NCURSES_PUBLIC_VAR(cur_term())"
-			print  "#define boolnames  NCURSES_PUBLIC_VAR(boolnames())"
-			print  "#define boolcodes  NCURSES_PUBLIC_VAR(boolcodes())"
-			print  "#define boolfnames NCURSES_PUBLIC_VAR(boolfnames())"
-			print  "#define numnames   NCURSES_PUBLIC_VAR(numnames())"
-			print  "#define numcodes   NCURSES_PUBLIC_VAR(numcodes())"
-			print  "#define numfnames  NCURSES_PUBLIC_VAR(numfnames())"
-			print  "#define strnames   NCURSES_PUBLIC_VAR(strnames())"
-			print  "#define strcodes   NCURSES_PUBLIC_VAR(strcodes())"
-			print  "#define strfnames  NCURSES_PUBLIC_VAR(strfnames())"
-			print  ""
-			print  "#else"
-			print  ""
-			print  "extern NCURSES_EXPORT_VAR(TERMINAL *) cur_term;"
-			print  ""
-			print  "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) boolnames[];"
-			print  "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) boolcodes[];"
-			print  "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) boolfnames[];"
-			print  "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) numnames[];"
-			print  "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) numcodes[];"
-			print  "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) numfnames[];"
-			print  "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) strnames[];"
-			print  "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) strcodes[];"
-			print  "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) strfnames[];"
-			print  ""
-			print  "#endif"
-			print  ""
-			print  "/* internals */"
-			print  "extern NCURSES_EXPORT(int) _nc_set_tty_mode (TTY *buf);"
-			print  "extern NCURSES_EXPORT(int) _nc_get_tty_mode (TTY *buf);"
-			print  "extern NCURSES_EXPORT(int) _nc_read_entry (const char * const, char * const, TERMTYPE *const);"
-			print  "extern NCURSES_EXPORT(int) _nc_read_file_entry (const char *const, TERMTYPE *);"
-			print  "extern NCURSES_EXPORT(int) _nc_read_termtype (TERMTYPE *, char *, int);"
-			print  "extern NCURSES_EXPORT(char *) _nc_first_name (const char *const);"
-			print  "extern NCURSES_EXPORT(int) _nc_name_match (const char *const, const char *const, const char *const);"
-			print  "extern NCURSES_EXPORT(const TERMTYPE *) _nc_fallback (const char *);"
-			print  ""
-			print  "/* entry points */"
-			print  "extern NCURSES_EXPORT(TERMINAL *) set_curterm (TERMINAL *);"
-			print  "extern NCURSES_EXPORT(int) del_curterm (TERMINAL *);"
-			print  ""
-			print  "/* miscellaneous entry points */"
-			print  "extern NCURSES_EXPORT(int) restartterm (NCURSES_CONST char *, int, int *);"
-			print  "extern NCURSES_EXPORT(int) setupterm (NCURSES_CONST char *,int,int *);"
-			print  ""
-			print  "/* terminfo entry points, also declared in curses.h */"
-			print  "#if !defined(__NCURSES_H)"
-			print  "extern NCURSES_EXPORT(char *) tigetstr (NCURSES_CONST char *);"
-			print  "extern NCURSES_EXPORT_VAR(char) ttytype[];"
-			print  "extern NCURSES_EXPORT(int) putp (const char *);"
-			print  "extern NCURSES_EXPORT(int) tigetflag (NCURSES_CONST char *);"
-			print  "extern NCURSES_EXPORT(int) tigetnum (NCURSES_CONST char *);"
-			print  ""
-			print  "#if 1 /* NCURSES_TPARM_VARARGS */"
-			print  "extern NCURSES_EXPORT(char *) tparm (NCURSES_CONST char *, ...);	/* special */"
-			print  "#else"
-			print  "extern NCURSES_EXPORT(char *) tparm (NCURSES_CONST char *, long,long,long,long,long,long,long,long,long);	/* special */"
-			print  "extern NCURSES_EXPORT(char *) tparm_varargs (NCURSES_CONST char *, ...);	/* special */"
-			print  "#endif"
-			print  ""
-			print  "#endif /* __NCURSES_H */"
-			print  ""
-			print  "/* termcap database emulation (XPG4 uses const only for 2nd param of tgetent) */"
-			print  "#if !defined(NCURSES_TERMCAP_H_incl)"
-			print  "extern NCURSES_EXPORT(char *) tgetstr (NCURSES_CONST char *, char **);"
-			print  "extern NCURSES_EXPORT(char *) tgoto (const char *, int, int);"
-			print  "extern NCURSES_EXPORT(int) tgetent (char *, const char *);"
-			print  "extern NCURSES_EXPORT(int) tgetflag (NCURSES_CONST char *);"
-			print  "extern NCURSES_EXPORT(int) tgetnum (NCURSES_CONST char *);"
-			print  "extern NCURSES_EXPORT(int) tputs (const char *, int, int (*)(int));"
-			print  "#endif /* NCURSES_TERMCAP_H_incl */"
-			print  ""
-			print  "#ifdef __cplusplus"
-			print  "}"
-			print  "#endif"
-			print  ""
-			print  "#endif /* NCURSES_TERM_H_incl */"
-		}
diff --git a/include/MKterm.h.awk.in b/include/MKterm.h.awk.in
index 5fc2052..587ee52 100644
--- a/include/MKterm.h.awk.in
+++ b/include/MKterm.h.awk.in
@@ -1,7 +1,7 @@
 # vile:awkmode
 BEGIN		{
 		    print  "/****************************************************************************"
-		    print  " * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc.              *"
+		    print  " * Copyright (c) 1998-2011,2013 Free Software Foundation, Inc.              *"
 		    print  " *                                                                          *"
 		    print  " * Permission is hereby granted, free of charge, to any person obtaining a  *"
 		    print  " * copy of this software and associated documentation files (the            *"
@@ -34,7 +34,7 @@
 		    print  "/*    and: Thomas E. Dickey                        1995-on                  */"
 		    print  "/****************************************************************************/"
 		    print  ""
-		    print  "/* $Id: MKterm.h.awk.in,v 1.50 2008/05/24 23:13:59 tom Exp $ */"
+		    print  "/* $Id: MKterm.h.awk.in,v 1.62 2013/08/17 19:21:56 tom Exp $ */"
 		    print  ""
 		    print  "/*"
 		    print  "**	term.h -- Definition of struct term"
@@ -62,6 +62,12 @@
 		    print  "#undef  NCURSES_SBOOL"
 		    print  "#define NCURSES_SBOOL @NCURSES_SBOOL@"
 		    print  ""
+		    print  "#undef  NCURSES_USE_DATABASE"
+		    print  "#define NCURSES_USE_DATABASE @NCURSES_USE_DATABASE@"
+		    print  ""
+		    print  "#undef  NCURSES_USE_TERMCAP"
+		    print  "#define NCURSES_USE_TERMCAP @NCURSES_USE_TERMCAP@"
+		    print  ""
 		    print  "#undef  NCURSES_XNAMES"
 		    print  "#define NCURSES_XNAMES @NCURSES_XNAMES@"
 		    print  ""
@@ -93,48 +99,17 @@
 		    print  "#include <termio.h>"
 		    print  "#define TTY struct termio"
 		    print  ""
-		    print  "/* Add definitions to make termio look like termios."
-		    print  " * But ifdef it, since there are some implementations"
-		    print  " * that try to do this for us in a fake <termio.h>."
-		    print  " */"
-		    print  "#ifndef TCSANOW"
-		    print  "#define TCSANOW TCSETA"
-		    print  "#endif"
-		    print  "#ifndef TCSADRAIN"
-		    print  "#define TCSADRAIN TCSETAW"
-		    print  "#endif"
-		    print  "#ifndef TCSAFLUSH"
-		    print  "#define TCSAFLUSH TCSETAF"
-		    print  "#endif"
-		    print  "#ifndef tcsetattr"
-		    print  "#define tcsetattr(fd, cmd, arg) ioctl(fd, cmd, arg)"
-		    print  "#endif"
-		    print  "#ifndef tcgetattr"
-		    print  "#define tcgetattr(fd, arg) ioctl(fd, TCGETA, arg)"
-		    print  "#endif"
-		    print  "#ifndef cfgetospeed"
-		    print  "#define cfgetospeed(t) ((t)->c_cflag & CBAUD)"
-		    print  "#endif"
-		    print  "#ifndef TCIFLUSH "
-		    print  "#define TCIFLUSH 0"
-		    print  "#endif"
-		    print  "#ifndef TCOFLUSH "
-		    print  "#define TCOFLUSH 1"
-		    print  "#endif"
-		    print  "#ifndef TCIOFLUSH "
-		    print  "#define TCIOFLUSH 2"
-		    print  "#endif"
-		    print  "#ifndef tcflush"
-		    print  "#define tcflush(fd, arg) ioctl(fd, TCFLSH, arg)"
-		    print  "#endif"
-		    print  ""
 		    print  "#else /* !HAVE_TERMIO_H */"
 		    print  ""
+		    print  "#if __MINGW32__"
+		    print  "#  include <ncurses_mingw.h>"
+		    print  "#  define TTY struct termios"
+		    print  "#else"
 		    print  "#undef TERMIOS"
 		    print  "#include <sgtty.h>"
 		    print  "#include <sys/ioctl.h>"
 		    print  "#define TTY struct sgttyb"
-		    print  ""
+		    print  "#endif /* MINGW32 */"
 		    print  "#endif /* HAVE_TERMIO_H */"
 		    print  ""
 		    print  "#endif /* HAVE_TERMIOS_H */"
@@ -228,8 +203,16 @@
 			print  "    char *      _termname;      /* used for termname() */"
 			print  "} TERMINAL;"
 			print  ""
-			print  "#if @BROKEN_LINKER@ || @cf_cv_enable_reentrant@"
+			print  "#if @BROKEN_LINKER@ && !@cf_cv_enable_reentrant@"
+			print  "extern NCURSES_EXPORT_VAR(TERMINAL *) cur_term;"
+			print  "#elif @cf_cv_enable_reentrant@"
 			print  "NCURSES_WRAPPED_VAR(TERMINAL *, cur_term);"
+			print  "#define cur_term   NCURSES_PUBLIC_VAR(cur_term())"
+			print  "#else"
+			print  "extern NCURSES_EXPORT_VAR(TERMINAL *) cur_term;"
+			print  "#endif"
+			print  ""
+			print  "#if @BROKEN_LINKER@ || @cf_cv_enable_reentrant@"
 			print  "NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, boolnames);"
 			print  "NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, boolcodes);"
 			print  "NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, boolfnames);"
@@ -240,7 +223,6 @@
 			print  "NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, strcodes);"
 			print  "NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, strfnames);"
 			print  ""
-			print  "#define cur_term   NCURSES_PUBLIC_VAR(cur_term())"
 			print  "#define boolnames  NCURSES_PUBLIC_VAR(boolnames())"
 			print  "#define boolcodes  NCURSES_PUBLIC_VAR(boolcodes())"
 			print  "#define boolfnames NCURSES_PUBLIC_VAR(boolfnames())"
@@ -253,8 +235,6 @@
 			print  ""
 			print  "#else"
 			print  ""
-			print  "extern NCURSES_EXPORT_VAR(TERMINAL *) cur_term;"
-			print  ""
 			print  "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) boolnames[];"
 			print  "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) boolcodes[];"
 			print  "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) boolfnames[];"
@@ -272,6 +252,7 @@
 			print  "extern NCURSES_EXPORT(int) _nc_get_tty_mode (TTY *buf);"
 			print  "extern NCURSES_EXPORT(int) _nc_read_entry (const char * const, char * const, TERMTYPE *const);"
 			print  "extern NCURSES_EXPORT(int) _nc_read_file_entry (const char *const, TERMTYPE *);"
+			print  "extern NCURSES_EXPORT(void) _nc_init_termtype (TERMTYPE *const);"
 			print  "extern NCURSES_EXPORT(int) _nc_read_termtype (TERMTYPE *, char *, int);"
 			print  "extern NCURSES_EXPORT(char *) _nc_first_name (const char *const);"
 			print  "extern NCURSES_EXPORT(int) _nc_name_match (const char *const, const char *const, const char *const);"
@@ -300,6 +281,8 @@
 			print  "extern NCURSES_EXPORT(char *) tparm_varargs (NCURSES_CONST char *, ...);	/* special */"
 			print  "#endif"
 			print  ""
+			print  "extern NCURSES_EXPORT(char *) tiparm (const char *, ...);		/* special */"
+			print  ""
 			print  "#endif /* __NCURSES_H */"
 			print  ""
 			print  "/* termcap database emulation (XPG4 uses const only for 2nd param of tgetent) */"
@@ -312,6 +295,37 @@
 			print  "extern NCURSES_EXPORT(int) tputs (const char *, int, int (*)(int));"
 			print  "#endif /* NCURSES_TERMCAP_H_incl */"
 			print  ""
+			print  "/*"
+			print  " * Include curses.h before term.h to enable these extensions."
+			print  " */"
+			print  "#if defined(NCURSES_SP_FUNCS) && (NCURSES_SP_FUNCS != 0)"
+			print  ""
+			print  "extern NCURSES_EXPORT(char *)  NCURSES_SP_NAME(tigetstr) (SCREEN*, NCURSES_CONST char *);"
+			print  "extern NCURSES_EXPORT(int)     NCURSES_SP_NAME(putp) (SCREEN*, const char *);"
+			print  "extern NCURSES_EXPORT(int)     NCURSES_SP_NAME(tigetflag) (SCREEN*, NCURSES_CONST char *);"
+			print  "extern NCURSES_EXPORT(int)     NCURSES_SP_NAME(tigetnum) (SCREEN*, NCURSES_CONST char *);"
+			print  ""
+			print  "#if @NCURSES_TPARM_VARARGS@ /* NCURSES_TPARM_VARARGS */"
+			print  "extern NCURSES_EXPORT(char *)  NCURSES_SP_NAME(tparm) (SCREEN*, NCURSES_CONST char *, ...);	/* special */"
+			print  "#else"
+			print  "extern NCURSES_EXPORT(char *)  NCURSES_SP_NAME(tparm) (SCREEN*, NCURSES_CONST char *, long,long,long,long,long,long,long,long,long);	/* special */"
+			print  "extern NCURSES_EXPORT(char *)  NCURSES_SP_NAME(tparm_varargs) (SCREEN*, NCURSES_CONST char *, ...);	/* special */"
+			print  "#endif"
+			print  ""
+			print  "/* termcap database emulation (XPG4 uses const only for 2nd param of tgetent) */"
+			print  "extern NCURSES_EXPORT(char *)  NCURSES_SP_NAME(tgetstr) (SCREEN*, NCURSES_CONST char *, char **);"
+			print  "extern NCURSES_EXPORT(char *)  NCURSES_SP_NAME(tgoto) (SCREEN*, const char *, int, int);"
+			print  "extern NCURSES_EXPORT(int)     NCURSES_SP_NAME(tgetent) (SCREEN*, char *, const char *);"
+			print  "extern NCURSES_EXPORT(int)     NCURSES_SP_NAME(tgetflag) (SCREEN*, NCURSES_CONST char *);"
+			print  "extern NCURSES_EXPORT(int)     NCURSES_SP_NAME(tgetnum) (SCREEN*, NCURSES_CONST char *);"
+			print  "extern NCURSES_EXPORT(int)     NCURSES_SP_NAME(tputs) (SCREEN*, const char *, int, NCURSES_SP_OUTC);"
+			print  ""
+			print  "extern NCURSES_EXPORT(TERMINAL *) NCURSES_SP_NAME(set_curterm) (SCREEN*, TERMINAL *);"
+			print  "extern NCURSES_EXPORT(int)     NCURSES_SP_NAME(del_curterm) (SCREEN*, TERMINAL *);"
+			print  ""
+			print  "extern NCURSES_EXPORT(int)     NCURSES_SP_NAME(restartterm) (SCREEN*, NCURSES_CONST char *, int, int *);"
+			print  "#endif /* NCURSES_SP_FUNCS */"
+			print  ""
 			print  "#ifdef __cplusplus"
 			print  "}"
 			print  "#endif"
diff --git a/include/Makefile b/include/Makefile
deleted file mode 100644
index 75bd622..0000000
--- a/include/Makefile
+++ /dev/null
@@ -1,167 +0,0 @@
-# $Id: Makefile.in,v 1.35 2001/12/08 18:50:06 tom Exp $
-##############################################################################
-# Copyright (c) 1998,2000,2001 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: Thomas E. Dickey 1996-2001
-#
-# Makefile for ncurses source code.
-#
-# This makes/installs ncurses include-files
-#
-# The variable 'srcdir' refers to the source-distribution, and can be set with
-# the configure script by "--srcdir=DIR".
-
-# turn off _all_ suffix rules; we'll generate our own
-.SUFFIXES:
-
-SHELL		= /bin/sh
-THIS		= Makefile
-
-DESTDIR		= 
-srcdir		= .
-prefix		= /usr/local
-exec_prefix	= ${prefix}
-includedir	= ${prefix}/include/ncurses
-
-INSTALL		= /usr/bin/install -c
-INSTALL_DATA	= ${INSTALL} -m 644
-
-AWK		= mawk
-LN_S		= ln -s
-
-VERSION		= 5.7
-
-# The "Caps" file specifies the terminfo database format, as well as the list
-# of function keys.
-TERMINFO_CAPS	= $(srcdir)/Caps
-
-# These files are generated by the configure script
-CONFIG_SRC = \
-	MKterm.h.awk \
-	curses.head \
-	termcap.h \
-	unctrl.h
-
-# These files are generated by this makefile
-AUTO_SRC = \
-	curses.h \
-	hashsize.h \
-	ncurses_def.h \
-	parametrized.h \
-	term.h
-
-################################################################################
-all \
-libs \
-depend \
-sources \
-install ::	$(AUTO_SRC)
-
-curses.h : $(TERMINFO_CAPS) \
-		curses.head \
-		$(srcdir)/curses.tail \
-		$(srcdir)/MKkey_defs.sh
-	cat curses.head >$@
-	AWK=$(AWK) sh $(srcdir)/MKkey_defs.sh $(TERMINFO_CAPS) >>$@
-	sh -c 'if test "chtype" = "cchar_t" ; then cat $(srcdir)/curses.wide >>$@ ; fi'
-	cat $(srcdir)/curses.tail >>$@
-
-term.h: $(TERMINFO_CAPS) MKterm.h.awk
-	$(AWK) -f MKterm.h.awk $(TERMINFO_CAPS) > $@
-	sh $(srcdir)/edit_cfg.sh ../include/ncurses_cfg.h $@
-
-hashsize.h: $(TERMINFO_CAPS) $(srcdir)/MKhashsize.sh
-	sh $(srcdir)/MKhashsize.sh $(TERMINFO_CAPS) >$@
-
-ncurses_def.h: $(srcdir)/ncurses_defs $(srcdir)/MKncurses_def.sh
-	AWK=$(AWK) sh $(srcdir)/MKncurses_def.sh $(srcdir)/ncurses_defs >$@
-
-parametrized.h: $(TERMINFO_CAPS) $(srcdir)/MKparametrized.sh
-	AWK=$(AWK) sh $(srcdir)/MKparametrized.sh $(TERMINFO_CAPS) >$@
-
-tags:
-	ctags *.[ch]
-
-TAGS:
-	etags *.[ch]
-
-mostlyclean ::
-	-rm -f core tags TAGS *~ *.bak *.i *.ln *.atac trace
-
-clean :: mostlyclean
-	-rm -f $(AUTO_SRC)
-
-distclean :: clean
-	-rm -f Makefile $(CONFIG_SRC)
-
-realclean :: distclean
-
-###############################################################################
-# The remainder of this file is automatically generated during configuration
-###############################################################################
-
-# generated by mk-hdr.awk
-#  subset:     ticlib+termlib+ext_tinfo+base+ext_funcs
-#  compat:     yes
-
-${DESTDIR}${includedir} :
-	sh ${srcdir}/../mkdirs.sh $@
-
-install \
-install.libs \
-install.includes :: ${AUTO_SRC} ${DESTDIR}${includedir} \
-		term.h \
-		curses.h \
-		unctrl.h \
-		termcap.h \
-		$(srcdir)/ncurses_dll.h \
-		$(srcdir)/tic.h \
-		$(srcdir)/term_entry.h \
-		$(srcdir)/nc_tparm.h
-	@ (cd ${DESTDIR}${includedir} && rm -f term.h) ; ../headers.sh ${INSTALL_DATA} ${DESTDIR}${includedir} ${srcdir} term.h
-	@ (cd ${DESTDIR}${includedir} && rm -f curses.h) ; ../headers.sh ${INSTALL_DATA} ${DESTDIR}${includedir} ${srcdir} curses.h
-	@ (cd ${DESTDIR}${includedir} && rm -f ncurses.h && ${LN_S} curses.h ncurses.h)
-	@ (cd ${DESTDIR}${includedir} && rm -f unctrl.h) ; ../headers.sh ${INSTALL_DATA} ${DESTDIR}${includedir} ${srcdir} unctrl.h
-	@ (cd ${DESTDIR}${includedir} && rm -f termcap.h) ; ../headers.sh ${INSTALL_DATA} ${DESTDIR}${includedir} ${srcdir} termcap.h
-	@ (cd ${DESTDIR}${includedir} && rm -f ncurses_dll.h) ; ../headers.sh ${INSTALL_DATA} ${DESTDIR}${includedir} ${srcdir} $(srcdir)/ncurses_dll.h
-	@ (cd ${DESTDIR}${includedir} && rm -f tic.h) ; ../headers.sh ${INSTALL_DATA} ${DESTDIR}${includedir} ${srcdir} $(srcdir)/tic.h
-	@ (cd ${DESTDIR}${includedir} && rm -f term_entry.h) ; ../headers.sh ${INSTALL_DATA} ${DESTDIR}${includedir} ${srcdir} $(srcdir)/term_entry.h
-	@ (cd ${DESTDIR}${includedir} && rm -f nc_tparm.h) ; ../headers.sh ${INSTALL_DATA} ${DESTDIR}${includedir} ${srcdir} $(srcdir)/nc_tparm.h
-
-uninstall \
-uninstall.libs \
-uninstall.includes ::
-	-@ (cd ${DESTDIR}${includedir} && rm -f term.h)
-	-@ (cd ${DESTDIR}${includedir} && rm -f curses.h)
-	-@ (cd ${DESTDIR}${includedir} && rm -f ncurses.h)
-	-@ (cd ${DESTDIR}${includedir} && rm -f unctrl.h)
-	-@ (cd ${DESTDIR}${includedir} && rm -f termcap.h)
-	-@ (cd ${DESTDIR}${includedir} && rm -f ncurses_dll.h)
-	-@ (cd ${DESTDIR}${includedir} && rm -f tic.h)
-	-@ (cd ${DESTDIR}${includedir} && rm -f term_entry.h)
-	-@ (cd ${DESTDIR}${includedir} && rm -f nc_tparm.h)
diff --git a/include/Makefile.in b/include/Makefile.in
index 1a48a17..cfa9876 100644
--- a/include/Makefile.in
+++ b/include/Makefile.in
@@ -1,6 +1,6 @@
-# $Id: Makefile.in,v 1.35 2001/12/08 18:50:06 tom Exp $
+# $Id: Makefile.in,v 1.43 2015/08/05 09:25:55 tom Exp $
 ##############################################################################
-# Copyright (c) 1998,2000,2001 Free Software Foundation, Inc.                #
+# Copyright (c) 1998-2013,2015 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"), #
@@ -39,7 +39,8 @@
 # turn off _all_ suffix rules; we'll generate our own
 .SUFFIXES:
 
-SHELL		= /bin/sh
+SHELL		= @SHELL@
+VPATH		= @srcdir@
 THIS		= Makefile
 
 DESTDIR		= @DESTDIR@
@@ -47,6 +48,9 @@
 prefix		= @prefix@
 exec_prefix	= @exec_prefix@
 includedir	= @includedir@
+includesubdir	= @includesubdir@
+
+INCLUDEDIR	= $(DESTDIR)$(includedir)$(includesubdir)
 
 INSTALL		= @INSTALL@
 INSTALL_DATA	= @INSTALL_DATA@
@@ -54,6 +58,9 @@
 AWK		= @AWK@
 LN_S		= @LN_S@
 
+CTAGS		= @CTAGS@
+ETAGS		= @ETAGS@
+
 VERSION		= @cf_cv_rel_version@
 
 # The "Caps" file specifies the terminfo database format, as well as the list
@@ -64,6 +71,7 @@
 CONFIG_SRC = \
 	MKterm.h.awk \
 	curses.head \
+	ncurses_dll.h \
 	termcap.h \
 	unctrl.h
 
@@ -73,6 +81,7 @@
 	hashsize.h \
 	ncurses_def.h \
 	parametrized.h \
+	config.h \
 	term.h
 
 ################################################################################
@@ -87,37 +96,42 @@
 		$(srcdir)/curses.tail \
 		$(srcdir)/MKkey_defs.sh
 	cat curses.head >$@
-	AWK=$(AWK) sh $(srcdir)/MKkey_defs.sh $(TERMINFO_CAPS) >>$@
-	sh -c 'if test "@NCURSES_CH_T@" = "cchar_t" ; then cat $(srcdir)/curses.wide >>$@ ; fi'
+	AWK=$(AWK) $(SHELL) $(srcdir)/MKkey_defs.sh $(TERMINFO_CAPS) >>$@
+	$(SHELL) -c 'if test "@NCURSES_CH_T@" = "cchar_t" ; then cat $(srcdir)/curses.wide >>$@ ; fi'
 	cat $(srcdir)/curses.tail >>$@
 
 term.h: $(TERMINFO_CAPS) MKterm.h.awk
 	$(AWK) -f MKterm.h.awk $(TERMINFO_CAPS) > $@
-	sh $(srcdir)/edit_cfg.sh ../include/ncurses_cfg.h $@
+	$(SHELL) $(srcdir)/edit_cfg.sh ../include/ncurses_cfg.h $@
 
 hashsize.h: $(TERMINFO_CAPS) $(srcdir)/MKhashsize.sh
-	sh $(srcdir)/MKhashsize.sh $(TERMINFO_CAPS) >$@
+	$(SHELL) $(srcdir)/MKhashsize.sh $(TERMINFO_CAPS) >$@
 
 ncurses_def.h: $(srcdir)/ncurses_defs $(srcdir)/MKncurses_def.sh
-	AWK=$(AWK) sh $(srcdir)/MKncurses_def.sh $(srcdir)/ncurses_defs >$@
+	AWK=$(AWK) $(SHELL) $(srcdir)/MKncurses_def.sh $(srcdir)/ncurses_defs >$@
 
 parametrized.h: $(TERMINFO_CAPS) $(srcdir)/MKparametrized.sh
-	AWK=$(AWK) sh $(srcdir)/MKparametrized.sh $(TERMINFO_CAPS) >$@
+	AWK=$(AWK) $(SHELL) $(srcdir)/MKparametrized.sh $(TERMINFO_CAPS) >$@
+
+# This is required by pthread.h on MinGW
+config.h:
+	touch $@
 
 tags:
-	ctags *.[ch]
+	$(CTAGS) *.[ch]
 
 @MAKE_UPPER_TAGS@TAGS:
-@MAKE_UPPER_TAGS@	etags *.[ch]
+@MAKE_UPPER_TAGS@	$(ETAGS) *.[ch]
 
 mostlyclean ::
 	-rm -f core tags TAGS *~ *.bak *.i *.ln *.atac trace
 
 clean :: mostlyclean
 	-rm -f $(AUTO_SRC)
+	-rm -rf *.dSYM
 
 distclean :: clean
-	-rm -f Makefile $(CONFIG_SRC)
+	-rm -f Makefile $(CONFIG_SRC) config.h
 
 realclean :: distclean
 
diff --git a/include/capdefaults.c b/include/capdefaults.c
index 33f2fe8..da76cc1 100644
--- a/include/capdefaults.c
+++ b/include/capdefaults.c
@@ -32,7 +32,7 @@
  *     and: Thomas E. Dickey                        1996-on                 *
  ****************************************************************************/
 
-/* $Id: capdefaults.c,v 1.13 2008/08/04 12:33:42 tom Exp $ */
+/* $Id: capdefaults.c,v 1.14 2008/11/16 00:19:59 juergen Exp $ */
 
     /*
      * Compute obsolete capabilities.  The reason this is an include file is
@@ -44,11 +44,11 @@
      * postprocess_termcap().
      */
 {
-    char *sp;
+    char *strp;
     short capval;
 
 #define EXTRACT_DELAY(str) \
-    	(short) (sp = strchr(str, '*'), sp ? atoi(sp+1) : 0)
+    	(short) (strp = strchr(str, '*'), strp ? atoi(strp+1) : 0)
 
     /* current (4.4BSD) capabilities marked obsolete */
     if (VALID_STRING(carriage_return)
diff --git a/include/curses.h b/include/curses.h
deleted file mode 100644
index 19f2358..0000000
--- a/include/curses.h
+++ /dev/null
@@ -1,1505 +0,0 @@
-/****************************************************************************
- * Copyright (c) 1998-2007,2008 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>                         *
- *     and: Thomas E. Dickey                        1996-on                 *
- ****************************************************************************/
-
-/* $Id: curses.h.in,v 1.187 2008/08/30 20:11:29 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, some of the wide-character (enhanced) functionality is missing.
- * 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 5
-#define NCURSES_VERSION_MINOR 7
-#define NCURSES_VERSION_PATCH 20081102
-
-/* This is defined in more than one ncurses header, for identification */
-#undef  NCURSES_VERSION
-#define NCURSES_VERSION "5.7"
-
-/*
- * Identify the mouse encoding version.
- */
-#define NCURSES_MOUSE_VERSION 1
-
-/*
- * Definitions to facilitate DLL's.
- */
-#include <ncurses_dll.h>
-
-/*
- * User-definable tweak to disable the include of <stdbool.h>.
- */
-#ifndef NCURSES_ENABLE_STDBOOL_H
-#define NCURSES_ENABLE_STDBOOL_H 1
-#endif
-
-/*
- * NCURSES_ATTR_T is used to quiet compiler warnings when building ncurses
- * configured using --disable-macros.
- */
-#ifdef NCURSES_NOMACROS
-#ifndef NCURSES_ATTR_T
-#define NCURSES_ATTR_T attr_t
-#endif
-#endif /* NCURSES_NOMACROS */
-
-#ifndef NCURSES_ATTR_T
-#define NCURSES_ATTR_T int
-#endif
-
-/*
- * Expands to 'const' if ncurses is configured using --enable-const.  Note that
- * doing so makes it incompatible with other implementations of X/Open Curses.
- */
-#undef  NCURSES_CONST
-#define NCURSES_CONST /*nothing*/
-
-#undef NCURSES_INLINE
-#define NCURSES_INLINE inline
-
-/*
- * The internal type used for color values
- */
-#undef	NCURSES_COLOR_T
-#define	NCURSES_COLOR_T short
-
-/*
- * Definition used to make WINDOW and similar structs opaque.
- */
-#ifndef NCURSES_OPAQUE
-#define NCURSES_OPAQUE 0
-#endif
-
-/*
- * The internal type used for window dimensions.
- */
-#undef	NCURSES_SIZE_T
-#define	NCURSES_SIZE_T short
-
-/*
- * Control whether tparm() supports varargs or fixed-parameter list.
- */
-#undef NCURSES_TPARM_VARARGS
-#define NCURSES_TPARM_VARARGS 1
-
-/*
- * NCURSES_CH_T is used in building the library, but not used otherwise in
- * this header file, since that would make the normal/wide-character versions
- * of the header incompatible.
- */
-#undef	NCURSES_CH_T
-#define NCURSES_CH_T chtype
-
-#if 0 && defined(_LP64)
-typedef unsigned chtype;
-typedef unsigned mmask_t;
-#else
-typedef unsigned long chtype;
-typedef unsigned long mmask_t;
-#endif
-
-#include <stdio.h>
-#include <unctrl.h>
-#include <stdarg.h>	/* we need va_list */
-#ifdef _XOPEN_SOURCE_EXTENDED
-#include <stddef.h>	/* we want wchar_t */
-#endif /* _XOPEN_SOURCE_EXTENDED */
-
-/* X/Open 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.
- *
- * A further complication is that <stdbool.h> may declare 'bool' to be a
- * different type, such as an enum which is not necessarily compatible with
- * C++.  If we have <stdbool.h>, make 'bool' a macro, so users may #undef it.
- * Otherwise, let it remain a typedef to avoid conflicts with other #define's.
- * In either case, make a typedef for NCURSES_BOOL which can be used if needed
- * from either C or C++.
- */
-
-#undef TRUE
-#define TRUE    1
-
-#undef FALSE
-#define FALSE   0
-
-typedef unsigned NCURSES_BOOL;
-
-#if 0	/* __cplusplus, etc. */
-
-/* use the C++ compiler's bool type */
-#define NCURSES_BOOL bool
-
-#else			/* c89, c99, etc. */
-
-#if NCURSES_ENABLE_STDBOOL_H
-#include <stdbool.h>
-/* use whatever the C compiler decides bool really is */
-#define NCURSES_BOOL bool
-#else
-/* there is no predefined bool - use our own */
-#undef bool
-#define bool NCURSES_BOOL
-#endif
-
-#endif /* !__cplusplus, etc. */
-
-#ifdef __cplusplus
-extern "C" {
-#define NCURSES_CAST(type,value) static_cast<type>(value)
-#else
-#define NCURSES_CAST(type,value) (type)(value)
-#endif
-
-/*
- * X/Open attributes.  In the ncurses implementation, they are identical to the
- * A_ attributes.
- */
-#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 */
-#define COLOR_BLACK	0
-#define COLOR_RED	1
-#define COLOR_GREEN	2
-#define COLOR_YELLOW	3
-#define COLOR_BLUE	4
-#define COLOR_MAGENTA	5
-#define COLOR_CYAN	6
-#define COLOR_WHITE	7
-
-/* line graphics */
-
-#if 0 || 0
-NCURSES_WRAPPED_VAR(chtype*, acs_map);
-#define acs_map (_nc_acs_map())
-#else
-extern NCURSES_EXPORT_VAR(chtype) acs_map[];
-#endif
-
-#define NCURSES_ACS(c)	(acs_map[NCURSES_CAST(unsigned char,c)])
-
-/* VT100 symbols begin here */
-#define ACS_ULCORNER	NCURSES_ACS('l') /* upper left corner */
-#define ACS_LLCORNER	NCURSES_ACS('m') /* lower left corner */
-#define ACS_URCORNER	NCURSES_ACS('k') /* upper right corner */
-#define ACS_LRCORNER	NCURSES_ACS('j') /* lower right corner */
-#define ACS_LTEE	NCURSES_ACS('t') /* tee pointing right */
-#define ACS_RTEE	NCURSES_ACS('u') /* tee pointing left */
-#define ACS_BTEE	NCURSES_ACS('v') /* tee pointing up */
-#define ACS_TTEE	NCURSES_ACS('w') /* tee pointing down */
-#define ACS_HLINE	NCURSES_ACS('q') /* horizontal line */
-#define ACS_VLINE	NCURSES_ACS('x') /* vertical line */
-#define ACS_PLUS	NCURSES_ACS('n') /* large plus or crossover */
-#define ACS_S1		NCURSES_ACS('o') /* scan line 1 */
-#define ACS_S9		NCURSES_ACS('s') /* scan line 9 */
-#define ACS_DIAMOND	NCURSES_ACS('`') /* diamond */
-#define ACS_CKBOARD	NCURSES_ACS('a') /* checker board (stipple) */
-#define ACS_DEGREE	NCURSES_ACS('f') /* degree symbol */
-#define ACS_PLMINUS	NCURSES_ACS('g') /* plus/minus */
-#define ACS_BULLET	NCURSES_ACS('~') /* bullet */
-/* Teletype 5410v1 symbols begin here */
-#define ACS_LARROW	NCURSES_ACS(',') /* arrow pointing left */
-#define ACS_RARROW	NCURSES_ACS('+') /* arrow pointing right */
-#define ACS_DARROW	NCURSES_ACS('.') /* arrow pointing down */
-#define ACS_UARROW	NCURSES_ACS('-') /* arrow pointing up */
-#define ACS_BOARD	NCURSES_ACS('h') /* board of squares */
-#define ACS_LANTERN	NCURSES_ACS('i') /* lantern symbol */
-#define ACS_BLOCK	NCURSES_ACS('0') /* solid square block */
-/*
- * These aren't documented, but a lot of System Vs have them anyway
- * (you can spot pprryyzz{{||}} in a lot of AT&T terminfo strings).
- * The ACS_names may not match AT&T's, our source didn't know them.
- */
-#define ACS_S3		NCURSES_ACS('p') /* scan line 3 */
-#define ACS_S7		NCURSES_ACS('r') /* scan line 7 */
-#define ACS_LEQUAL	NCURSES_ACS('y') /* less/equal */
-#define ACS_GEQUAL	NCURSES_ACS('z') /* greater/equal */
-#define ACS_PI		NCURSES_ACS('{') /* Pi */
-#define ACS_NEQUAL	NCURSES_ACS('|') /* not equal */
-#define ACS_STERLING	NCURSES_ACS('}') /* UK pound sign */
-
-/*
- * Line drawing ACS names are of the form ACS_trbl, where t is the top, r
- * is the right, b is the bottom, and l is the left.  t, r, b, and l might
- * be B (blank), S (single), D (double), or T (thick).  The subset defined
- * here only uses B and S.
- */
-#define ACS_BSSB	ACS_ULCORNER
-#define ACS_SSBB	ACS_LLCORNER
-#define ACS_BBSS	ACS_URCORNER
-#define ACS_SBBS	ACS_LRCORNER
-#define ACS_SBSS	ACS_RTEE
-#define ACS_SSSB	ACS_LTEE
-#define ACS_SSBS	ACS_BTEE
-#define ACS_BSSS	ACS_TTEE
-#define ACS_BSBS	ACS_HLINE
-#define ACS_SBSB	ACS_VLINE
-#define ACS_SSSS	ACS_PLUS
-
-#undef	ERR
-#define ERR     (-1)
-
-#undef	OK
-#define OK      (0)
-
-/* values for the _flags member */
-#define _SUBWIN         0x01	/* is this a sub-window? */
-#define _ENDLINE        0x02	/* is the window flush right? */
-#define _FULLWIN        0x04	/* is the window full-screen? */
-#define _SCROLLWIN      0x08	/* bottom edge is at screen bottom? */
-#define _ISPAD	        0x10	/* is this window a pad? */
-#define _HASMOVED       0x20	/* has cursor moved since last refresh? */
-#define _WRAPPED        0x40	/* cursor was just wrappped */
-
-/*
- * this value is used in the firstchar and lastchar fields to mark
- * unchanged lines
- */
-#define _NOCHANGE       -1
-
-/*
- * this value is used in the oldindex field to mark lines created by insertions
- * and scrolls.
- */
-#define _NEWINDEX	-1
-
-typedef struct screen  SCREEN;
-typedef struct _win_st WINDOW;
-
-typedef	chtype	attr_t;		/* ...must be at least as wide as chtype */
-
-#ifdef _XOPEN_SOURCE_EXTENDED
-
-#if 0
-#ifdef mblen			/* libutf8.h defines it w/o undefining first */
-#undef mblen
-#endif
-#include <libutf8.h>
-#endif
-
-#if 0
-#include <wchar.h>		/* ...to get mbstate_t, etc. */
-#endif
-
-#if 0
-typedef unsigned short wchar_t;
-#endif
-
-#if 0
-typedef unsigned int wint_t;
-#endif
-
-#define CCHARW_MAX	5
-typedef struct
-{
-    attr_t	attr;
-    wchar_t	chars[CCHARW_MAX];
-#if 0
-#undef NCURSES_EXT_COLORS
-#define NCURSES_EXT_COLORS 20081102
-    int		ext_color;	/* color pair, must be more than 16-bits */
-#endif
-}
-cchar_t;
-
-#endif /* _XOPEN_SOURCE_EXTENDED */
-
-#if !NCURSES_OPAQUE
-struct ldat;
-
-struct _win_st
-{
-	NCURSES_SIZE_T _cury, _curx; /* current cursor position */
-
-	/* window location and size */
-	NCURSES_SIZE_T _maxy, _maxx; /* maximums of x and y, NOT window size */
-	NCURSES_SIZE_T _begy, _begx; /* screen coords of upper-left-hand corner */
-
-	short   _flags;		/* window state flags */
-
-	/* attribute tracking */
-	attr_t  _attrs;		/* current attribute for non-space character */
-	chtype  _bkgd;		/* current background char/attribute pair */
-
-	/* option values set by user */
-	bool	_notimeout;	/* no time out on function-key entry? */
-	bool	_clear;		/* consider all data in the window invalid? */
-	bool	_leaveok;	/* OK to not reset cursor on exit? */
-	bool	_scroll;	/* OK to scroll this window? */
-	bool	_idlok;		/* OK to use insert/delete line? */
-	bool	_idcok;		/* OK to use insert/delete char? */
-	bool	_immed;		/* window in immed mode? (not yet used) */
-	bool	_sync;		/* window in sync mode? */
-	bool	_use_keypad;	/* process function keys into KEY_ symbols? */
-	int	_delay;		/* 0 = nodelay, <0 = blocking, >0 = delay */
-
-	struct ldat *_line;	/* the actual line data */
-
-	/* global screen state */
-	NCURSES_SIZE_T _regtop;	/* top line of scrolling region */
-	NCURSES_SIZE_T _regbottom; /* bottom line of scrolling region */
-
-	/* these are used only if this is a sub-window */
-	int	_parx;		/* x coordinate of this window in parent */
-	int	_pary;		/* y coordinate of this window in parent */
-	WINDOW	*_parent;	/* pointer to parent if a sub-window */
-
-	/* these are used only if this is a pad */
-	struct pdat
-	{
-	    NCURSES_SIZE_T _pad_y,      _pad_x;
-	    NCURSES_SIZE_T _pad_top,    _pad_left;
-	    NCURSES_SIZE_T _pad_bottom, _pad_right;
-	} _pad;
-
-	NCURSES_SIZE_T _yoffset; /* real begy is _begy + _yoffset */
-
-#ifdef _XOPEN_SOURCE_EXTENDED
-	cchar_t  _bkgrnd;	/* current background char/attribute pair */
-#if 0
-	int	_color;		/* current color-pair for non-space character */
-#endif
-#endif
-};
-#endif /* NCURSES_OPAQUE */
-
-/*
- * This is an extension to support events...
- */
-#if 1
-#ifdef NCURSES_WGETCH_EVENTS
-#if !defined(__BEOS__) || defined(__HAIKU__)
-   /* Fix _nc_timed_wait() on BEOS... */
-#  define NCURSES_EVENT_VERSION	1
-#endif	/* !defined(__BEOS__) */
-
-/*
- * Bits to set in _nc_event.data.flags
- */
-#  define _NC_EVENT_TIMEOUT_MSEC	1
-#  define _NC_EVENT_FILE		2
-#  define _NC_EVENT_FILE_READABLE	2
-#  if 0					/* Not supported yet... */
-#    define _NC_EVENT_FILE_WRITABLE	4
-#    define _NC_EVENT_FILE_EXCEPTION	8
-#  endif
-
-typedef struct
-{
-    int type;
-    union
-    {
-	long timeout_msec;	/* _NC_EVENT_TIMEOUT_MSEC */
-	struct
-	{
-	    unsigned int flags;
-	    int fd;
-	    unsigned int result;
-	} fev;				/* _NC_EVENT_FILE */
-    } data;
-} _nc_event;
-
-typedef struct
-{
-    int count;
-    int result_flags;	/* _NC_EVENT_TIMEOUT_MSEC or _NC_EVENT_FILE_READABLE */
-    _nc_event *events[1];
-} _nc_eventlist;
-
-extern NCURSES_EXPORT(int) wgetch_events(WINDOW *, _nc_eventlist *);	/* experimental */
-extern NCURSES_EXPORT(int) wgetnstr_events(WINDOW *,char *,int,_nc_eventlist *);/* experimental */
-
-#endif /* NCURSES_WGETCH_EVENTS */
-#endif /* NCURSES_EXT_FUNCS */
-
-/*
- * 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.
- * Old versions of G++ do not accept it anyway, at least not consistently with
- * GCC.
- */
-#if !(defined(__GNUC__) || defined(__GNUG__) || defined(__attribute__))
-#define __attribute__(p) /* nothing */
-#endif
-
-/*
- * We cannot define these in ncurses_cfg.h, since they require parameters to be
- * passed (that is non-portable).  If you happen to be using gcc with warnings
- * enabled, define
- *	GCC_PRINTF
- *	GCC_SCANF
- * to improve checking of calls to printw(), etc.
- */
-#ifndef GCC_PRINTFLIKE
-#if defined(GCC_PRINTF) && !defined(printf)
-#define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var)))
-#else
-#define GCC_PRINTFLIKE(fmt,var) /*nothing*/
-#endif
-#endif
-
-#ifndef GCC_SCANFLIKE
-#if defined(GCC_SCANF) && !defined(scanf)
-#define GCC_SCANFLIKE(fmt,var)  __attribute__((format(scanf,fmt,var)))
-#else
-#define GCC_SCANFLIKE(fmt,var)  /*nothing*/
-#endif
-#endif
-
-#ifndef	GCC_NORETURN
-#define	GCC_NORETURN /* nothing */
-#endif
-
-#ifndef	GCC_UNUSED
-#define	GCC_UNUSED /* nothing */
-#endif
-
-/*
- * Function prototypes.  This is the complete X/Open Curses list of required
- * functions.  Those marked `generated' will have sources generated from the
- * macro definitions later in this file, in order to satisfy XPG4.2
- * requirements.
- */
-
-extern NCURSES_EXPORT(int) addch (const chtype);			/* generated */
-extern NCURSES_EXPORT(int) addchnstr (const chtype *, int);		/* generated */
-extern NCURSES_EXPORT(int) addchstr (const chtype *);			/* generated */
-extern NCURSES_EXPORT(int) addnstr (const char *, int);			/* generated */
-extern NCURSES_EXPORT(int) addstr (const char *);			/* generated */
-extern NCURSES_EXPORT(int) attroff (NCURSES_ATTR_T);			/* generated */
-extern NCURSES_EXPORT(int) attron (NCURSES_ATTR_T);			/* generated */
-extern NCURSES_EXPORT(int) attrset (NCURSES_ATTR_T);			/* generated */
-extern NCURSES_EXPORT(int) attr_get (attr_t *, short *, void *);	/* generated */
-extern NCURSES_EXPORT(int) attr_off (attr_t, void *);			/* generated */
-extern NCURSES_EXPORT(int) attr_on (attr_t, void *);			/* generated */
-extern NCURSES_EXPORT(int) attr_set (attr_t, short, void *);		/* generated */
-extern NCURSES_EXPORT(int) baudrate (void);				/* implemented */
-extern NCURSES_EXPORT(int) beep  (void);				/* implemented */
-extern NCURSES_EXPORT(int) bkgd (chtype);				/* generated */
-extern NCURSES_EXPORT(void) bkgdset (chtype);				/* generated */
-extern NCURSES_EXPORT(int) border (chtype,chtype,chtype,chtype,chtype,chtype,chtype,chtype);	/* generated */
-extern NCURSES_EXPORT(int) box (WINDOW *, chtype, chtype);		/* generated */
-extern NCURSES_EXPORT(bool) can_change_color (void);			/* implemented */
-extern NCURSES_EXPORT(int) cbreak (void);				/* implemented */
-extern NCURSES_EXPORT(int) chgat (int, attr_t, short, const void *);	/* generated */
-extern NCURSES_EXPORT(int) clear (void);				/* generated */
-extern NCURSES_EXPORT(int) clearok (WINDOW *,bool);			/* implemented */
-extern NCURSES_EXPORT(int) clrtobot (void);				/* generated */
-extern NCURSES_EXPORT(int) clrtoeol (void);				/* generated */
-extern NCURSES_EXPORT(int) color_content (short,short*,short*,short*);	/* implemented */
-extern NCURSES_EXPORT(int) color_set (short,void*);			/* generated */
-extern NCURSES_EXPORT(int) COLOR_PAIR (int);				/* generated */
-extern NCURSES_EXPORT(int) copywin (const WINDOW*,WINDOW*,int,int,int,int,int,int,int);	/* implemented */
-extern NCURSES_EXPORT(int) curs_set (int);				/* implemented */
-extern NCURSES_EXPORT(int) def_prog_mode (void);			/* implemented */
-extern NCURSES_EXPORT(int) def_shell_mode (void);			/* implemented */
-extern NCURSES_EXPORT(int) delay_output (int);				/* implemented */
-extern NCURSES_EXPORT(int) delch (void);				/* generated */
-extern NCURSES_EXPORT(void) delscreen (SCREEN *);			/* implemented */
-extern NCURSES_EXPORT(int) delwin (WINDOW *);				/* implemented */
-extern NCURSES_EXPORT(int) deleteln (void);				/* generated */
-extern NCURSES_EXPORT(WINDOW *) derwin (WINDOW *,int,int,int,int);	/* implemented */
-extern NCURSES_EXPORT(int) doupdate (void);				/* implemented */
-extern NCURSES_EXPORT(WINDOW *) dupwin (WINDOW *);			/* implemented */
-extern NCURSES_EXPORT(int) echo (void);					/* implemented */
-extern NCURSES_EXPORT(int) echochar (const chtype);			/* generated */
-extern NCURSES_EXPORT(int) erase (void);				/* generated */
-extern NCURSES_EXPORT(int) endwin (void);				/* implemented */
-extern NCURSES_EXPORT(char) erasechar (void);				/* implemented */
-extern NCURSES_EXPORT(void) filter (void);				/* implemented */
-extern NCURSES_EXPORT(int) flash (void);				/* implemented */
-extern NCURSES_EXPORT(int) flushinp (void);				/* implemented */
-extern NCURSES_EXPORT(chtype) getbkgd (WINDOW *);			/* generated */
-extern NCURSES_EXPORT(int) getch (void);				/* generated */
-extern NCURSES_EXPORT(int) getnstr (char *, int);			/* generated */
-extern NCURSES_EXPORT(int) getstr (char *);				/* generated */
-extern NCURSES_EXPORT(WINDOW *) getwin (FILE *);			/* implemented */
-extern NCURSES_EXPORT(int) halfdelay (int);				/* implemented */
-extern NCURSES_EXPORT(bool) has_colors (void);				/* implemented */
-extern NCURSES_EXPORT(bool) has_ic (void);				/* implemented */
-extern NCURSES_EXPORT(bool) has_il (void);				/* implemented */
-extern NCURSES_EXPORT(int) hline (chtype, int);				/* generated */
-extern NCURSES_EXPORT(void) idcok (WINDOW *, bool);			/* implemented */
-extern NCURSES_EXPORT(int) idlok (WINDOW *, bool);			/* implemented */
-extern NCURSES_EXPORT(void) immedok (WINDOW *, bool);			/* implemented */
-extern NCURSES_EXPORT(chtype) inch (void);				/* generated */
-extern NCURSES_EXPORT(int) inchnstr (chtype *, int);			/* generated */
-extern NCURSES_EXPORT(int) inchstr (chtype *);				/* generated */
-extern NCURSES_EXPORT(WINDOW *) initscr (void);				/* implemented */
-extern NCURSES_EXPORT(int) init_color (short,short,short,short);	/* implemented */
-extern NCURSES_EXPORT(int) init_pair (short,short,short);		/* implemented */
-extern NCURSES_EXPORT(int) innstr (char *, int);			/* generated */
-extern NCURSES_EXPORT(int) insch (chtype);				/* generated */
-extern NCURSES_EXPORT(int) insdelln (int);				/* generated */
-extern NCURSES_EXPORT(int) insertln (void);				/* generated */
-extern NCURSES_EXPORT(int) insnstr (const char *, int);			/* generated */
-extern NCURSES_EXPORT(int) insstr (const char *);			/* generated */
-extern NCURSES_EXPORT(int) instr (char *);				/* generated */
-extern NCURSES_EXPORT(int) intrflush (WINDOW *,bool);			/* implemented */
-extern NCURSES_EXPORT(bool) isendwin (void);				/* implemented */
-extern NCURSES_EXPORT(bool) is_linetouched (WINDOW *,int);		/* implemented */
-extern NCURSES_EXPORT(bool) is_wintouched (WINDOW *);			/* implemented */
-extern NCURSES_EXPORT(NCURSES_CONST char *) keyname (int);		/* implemented */
-extern NCURSES_EXPORT(int) keypad (WINDOW *,bool);			/* implemented */
-extern NCURSES_EXPORT(char) killchar (void);				/* implemented */
-extern NCURSES_EXPORT(int) leaveok (WINDOW *,bool);			/* implemented */
-extern NCURSES_EXPORT(char *) longname (void);				/* implemented */
-extern NCURSES_EXPORT(int) meta (WINDOW *,bool);			/* implemented */
-extern NCURSES_EXPORT(int) move (int, int);				/* generated */
-extern NCURSES_EXPORT(int) mvaddch (int, int, const chtype);		/* generated */
-extern NCURSES_EXPORT(int) mvaddchnstr (int, int, const chtype *, int);	/* generated */
-extern NCURSES_EXPORT(int) mvaddchstr (int, int, const chtype *);	/* generated */
-extern NCURSES_EXPORT(int) mvaddnstr (int, int, const char *, int);	/* generated */
-extern NCURSES_EXPORT(int) mvaddstr (int, int, const char *);		/* generated */
-extern NCURSES_EXPORT(int) mvchgat (int, int, int, attr_t, short, const void *);	/* generated */
-extern NCURSES_EXPORT(int) mvcur (int,int,int,int);			/* implemented */
-extern NCURSES_EXPORT(int) mvdelch (int, int);				/* generated */
-extern NCURSES_EXPORT(int) mvderwin (WINDOW *, int, int);		/* implemented */
-extern NCURSES_EXPORT(int) mvgetch (int, int);				/* generated */
-extern NCURSES_EXPORT(int) mvgetnstr (int, int, char *, int);		/* generated */
-extern NCURSES_EXPORT(int) mvgetstr (int, int, char *);			/* generated */
-extern NCURSES_EXPORT(int) mvhline (int, int, chtype, int);		/* generated */
-extern NCURSES_EXPORT(chtype) mvinch (int, int);			/* generated */
-extern NCURSES_EXPORT(int) mvinchnstr (int, int, chtype *, int);	/* generated */
-extern NCURSES_EXPORT(int) mvinchstr (int, int, chtype *);		/* generated */
-extern NCURSES_EXPORT(int) mvinnstr (int, int, char *, int);		/* generated */
-extern NCURSES_EXPORT(int) mvinsch (int, int, chtype);			/* generated */
-extern NCURSES_EXPORT(int) mvinsnstr (int, int, const char *, int);	/* generated */
-extern NCURSES_EXPORT(int) mvinsstr (int, int, const char *);		/* generated */
-extern NCURSES_EXPORT(int) mvinstr (int, int, char *);			/* generated */
-extern NCURSES_EXPORT(int) mvprintw (int,int, const char *,...)		/* implemented */
-		GCC_PRINTFLIKE(3,4);
-extern NCURSES_EXPORT(int) mvscanw (int,int, NCURSES_CONST char *,...)	/* implemented */
-		GCC_SCANFLIKE(3,4);
-extern NCURSES_EXPORT(int) mvvline (int, int, chtype, int);		/* generated */
-extern NCURSES_EXPORT(int) mvwaddch (WINDOW *, int, int, const chtype);	/* generated */
-extern NCURSES_EXPORT(int) mvwaddchnstr (WINDOW *, int, int, const chtype *, int);/* generated */
-extern NCURSES_EXPORT(int) mvwaddchstr (WINDOW *, int, int, const chtype *);	/* generated */
-extern NCURSES_EXPORT(int) mvwaddnstr (WINDOW *, int, int, const char *, int);	/* generated */
-extern NCURSES_EXPORT(int) mvwaddstr (WINDOW *, int, int, const char *);	/* generated */
-extern NCURSES_EXPORT(int) mvwchgat (WINDOW *, int, int, int, attr_t, short, const void *);/* generated */
-extern NCURSES_EXPORT(int) mvwdelch (WINDOW *, int, int);		/* generated */
-extern NCURSES_EXPORT(int) mvwgetch (WINDOW *, int, int);		/* generated */
-extern NCURSES_EXPORT(int) mvwgetnstr (WINDOW *, int, int, char *, int);	/* generated */
-extern NCURSES_EXPORT(int) mvwgetstr (WINDOW *, int, int, char *);	/* generated */
-extern NCURSES_EXPORT(int) mvwhline (WINDOW *, int, int, chtype, int);	/* generated */
-extern NCURSES_EXPORT(int) mvwin (WINDOW *,int,int);			/* implemented */
-extern NCURSES_EXPORT(chtype) mvwinch (WINDOW *, int, int);			/* generated */
-extern NCURSES_EXPORT(int) mvwinchnstr (WINDOW *, int, int, chtype *, int);	/* generated */
-extern NCURSES_EXPORT(int) mvwinchstr (WINDOW *, int, int, chtype *);		/* generated */
-extern NCURSES_EXPORT(int) mvwinnstr (WINDOW *, int, int, char *, int);		/* generated */
-extern NCURSES_EXPORT(int) mvwinsch (WINDOW *, int, int, chtype);		/* generated */
-extern NCURSES_EXPORT(int) mvwinsnstr (WINDOW *, int, int, const char *, int);	/* generated */
-extern NCURSES_EXPORT(int) mvwinsstr (WINDOW *, int, int, const char *);		/* generated */
-extern NCURSES_EXPORT(int) mvwinstr (WINDOW *, int, int, char *);		/* generated */
-extern NCURSES_EXPORT(int) mvwprintw (WINDOW*,int,int, const char *,...)	/* implemented */
-		GCC_PRINTFLIKE(4,5);
-extern NCURSES_EXPORT(int) mvwscanw (WINDOW *,int,int, NCURSES_CONST char *,...)	/* implemented */
-		GCC_SCANFLIKE(4,5);
-extern NCURSES_EXPORT(int) mvwvline (WINDOW *,int, int, chtype, int);	/* generated */
-extern NCURSES_EXPORT(int) napms (int);					/* implemented */
-extern NCURSES_EXPORT(WINDOW *) newpad (int,int);				/* implemented */
-extern NCURSES_EXPORT(SCREEN *) newterm (NCURSES_CONST char *,FILE *,FILE *);	/* implemented */
-extern NCURSES_EXPORT(WINDOW *) newwin (int,int,int,int);			/* implemented */
-extern NCURSES_EXPORT(int) nl (void);					/* implemented */
-extern NCURSES_EXPORT(int) nocbreak (void);				/* implemented */
-extern NCURSES_EXPORT(int) nodelay (WINDOW *,bool);			/* implemented */
-extern NCURSES_EXPORT(int) noecho (void);				/* implemented */
-extern NCURSES_EXPORT(int) nonl (void);					/* implemented */
-extern NCURSES_EXPORT(void) noqiflush (void);				/* implemented */
-extern NCURSES_EXPORT(int) noraw (void);				/* implemented */
-extern NCURSES_EXPORT(int) notimeout (WINDOW *,bool);			/* implemented */
-extern NCURSES_EXPORT(int) overlay (const WINDOW*,WINDOW *);		/* implemented */
-extern NCURSES_EXPORT(int) overwrite (const WINDOW*,WINDOW *);		/* implemented */
-extern NCURSES_EXPORT(int) pair_content (short,short*,short*);		/* implemented */
-extern NCURSES_EXPORT(int) PAIR_NUMBER (int);				/* generated */
-extern NCURSES_EXPORT(int) pechochar (WINDOW *, const chtype);		/* implemented */
-extern NCURSES_EXPORT(int) pnoutrefresh (WINDOW*,int,int,int,int,int,int);/* implemented */
-extern NCURSES_EXPORT(int) prefresh (WINDOW *,int,int,int,int,int,int);	/* implemented */
-extern NCURSES_EXPORT(int) printw (const char *,...)			/* implemented */
-		GCC_PRINTFLIKE(1,2);
-extern NCURSES_EXPORT(int) putwin (WINDOW *, FILE *);			/* implemented */
-extern NCURSES_EXPORT(void) qiflush (void);				/* implemented */
-extern NCURSES_EXPORT(int) raw (void);					/* implemented */
-extern NCURSES_EXPORT(int) redrawwin (WINDOW *);			/* generated */
-extern NCURSES_EXPORT(int) refresh (void);				/* generated */
-extern NCURSES_EXPORT(int) resetty (void);				/* implemented */
-extern NCURSES_EXPORT(int) reset_prog_mode (void);			/* implemented */
-extern NCURSES_EXPORT(int) reset_shell_mode (void);			/* implemented */
-extern NCURSES_EXPORT(int) ripoffline (int, int (*)(WINDOW *, int));	/* implemented */
-extern NCURSES_EXPORT(int) savetty (void);				/* implemented */
-extern NCURSES_EXPORT(int) scanw (NCURSES_CONST char *,...)		/* implemented */
-		GCC_SCANFLIKE(1,2);
-extern NCURSES_EXPORT(int) scr_dump (const char *);			/* implemented */
-extern NCURSES_EXPORT(int) scr_init (const char *);			/* implemented */
-extern NCURSES_EXPORT(int) scrl (int);					/* generated */
-extern NCURSES_EXPORT(int) scroll (WINDOW *);				/* generated */
-extern NCURSES_EXPORT(int) scrollok (WINDOW *,bool);			/* implemented */
-extern NCURSES_EXPORT(int) scr_restore (const char *);			/* implemented */
-extern NCURSES_EXPORT(int) scr_set (const char *);			/* implemented */
-extern NCURSES_EXPORT(int) setscrreg (int,int);				/* generated */
-extern NCURSES_EXPORT(SCREEN *) set_term (SCREEN *);			/* implemented */
-extern NCURSES_EXPORT(int) slk_attroff (const chtype);			/* implemented */
-extern NCURSES_EXPORT(int) slk_attr_off (const attr_t, void *);		/* generated:WIDEC */
-extern NCURSES_EXPORT(int) slk_attron (const chtype);			/* implemented */
-extern NCURSES_EXPORT(int) slk_attr_on (attr_t,void*);			/* generated:WIDEC */
-extern NCURSES_EXPORT(int) slk_attrset (const chtype);			/* implemented */
-extern NCURSES_EXPORT(attr_t) slk_attr (void);				/* implemented */
-extern NCURSES_EXPORT(int) slk_attr_set (const attr_t,short,void*);	/* implemented */
-extern NCURSES_EXPORT(int) slk_clear (void);				/* implemented */
-extern NCURSES_EXPORT(int) slk_color (short);				/* implemented */
-extern NCURSES_EXPORT(int) slk_init (int);				/* implemented */
-extern NCURSES_EXPORT(char *) slk_label (int);				/* implemented */
-extern NCURSES_EXPORT(int) slk_noutrefresh (void);			/* implemented */
-extern NCURSES_EXPORT(int) slk_refresh (void);				/* implemented */
-extern NCURSES_EXPORT(int) slk_restore (void);				/* implemented */
-extern NCURSES_EXPORT(int) slk_set (int,const char *,int);		/* implemented */
-extern NCURSES_EXPORT(int) slk_touch (void);				/* implemented */
-extern NCURSES_EXPORT(int) standout (void);				/* generated */
-extern NCURSES_EXPORT(int) standend (void);				/* generated */
-extern NCURSES_EXPORT(int) start_color (void);				/* implemented */
-extern NCURSES_EXPORT(WINDOW *) subpad (WINDOW *, int, int, int, int);	/* implemented */
-extern NCURSES_EXPORT(WINDOW *) subwin (WINDOW *, int, int, int, int);	/* implemented */
-extern NCURSES_EXPORT(int) syncok (WINDOW *, bool);			/* implemented */
-extern NCURSES_EXPORT(chtype) termattrs (void);				/* implemented */
-extern NCURSES_EXPORT(char *) termname (void);				/* implemented */
-extern NCURSES_EXPORT(void) timeout (int);				/* generated */
-extern NCURSES_EXPORT(int) touchline (WINDOW *, int, int);		/* generated */
-extern NCURSES_EXPORT(int) touchwin (WINDOW *);				/* generated */
-extern NCURSES_EXPORT(int) typeahead (int);				/* implemented */
-extern NCURSES_EXPORT(int) ungetch (int);				/* implemented */
-extern NCURSES_EXPORT(int) untouchwin (WINDOW *);			/* generated */
-extern NCURSES_EXPORT(void) use_env (bool);				/* implemented */
-extern NCURSES_EXPORT(int) vidattr (chtype);				/* implemented */
-extern NCURSES_EXPORT(int) vidputs (chtype, int (*)(int));		/* implemented */
-extern NCURSES_EXPORT(int) vline (chtype, int);				/* generated */
-extern NCURSES_EXPORT(int) vwprintw (WINDOW *, const char *,va_list);	/* implemented */
-extern NCURSES_EXPORT(int) vw_printw (WINDOW *, const char *,va_list);	/* generated */
-extern NCURSES_EXPORT(int) vwscanw (WINDOW *, NCURSES_CONST char *,va_list);	/* implemented */
-extern NCURSES_EXPORT(int) vw_scanw (WINDOW *, NCURSES_CONST char *,va_list);	/* generated */
-extern NCURSES_EXPORT(int) waddch (WINDOW *, const chtype);		/* implemented */
-extern NCURSES_EXPORT(int) waddchnstr (WINDOW *,const chtype *,int);	/* implemented */
-extern NCURSES_EXPORT(int) waddchstr (WINDOW *,const chtype *);		/* generated */
-extern NCURSES_EXPORT(int) waddnstr (WINDOW *,const char *,int);	/* implemented */
-extern NCURSES_EXPORT(int) waddstr (WINDOW *,const char *);		/* generated */
-extern NCURSES_EXPORT(int) wattron (WINDOW *, int);			/* generated */
-extern NCURSES_EXPORT(int) wattroff (WINDOW *, int);			/* generated */
-extern NCURSES_EXPORT(int) wattrset (WINDOW *, int);			/* generated */
-extern NCURSES_EXPORT(int) wattr_get (WINDOW *, attr_t *, short *, void *);	/* generated */
-extern NCURSES_EXPORT(int) wattr_on (WINDOW *, attr_t, void *);		/* implemented */
-extern NCURSES_EXPORT(int) wattr_off (WINDOW *, attr_t, void *);	/* implemented */
-extern NCURSES_EXPORT(int) wattr_set (WINDOW *, attr_t, short, void *);	/* generated */
-extern NCURSES_EXPORT(int) wbkgd (WINDOW *, chtype);			/* implemented */
-extern NCURSES_EXPORT(void) wbkgdset (WINDOW *,chtype);			/* implemented */
-extern NCURSES_EXPORT(int) wborder (WINDOW *,chtype,chtype,chtype,chtype,chtype,chtype,chtype,chtype);	/* implemented */
-extern NCURSES_EXPORT(int) wchgat (WINDOW *, int, attr_t, short, const void *);/* implemented */
-extern NCURSES_EXPORT(int) wclear (WINDOW *);				/* implemented */
-extern NCURSES_EXPORT(int) wclrtobot (WINDOW *);			/* implemented */
-extern NCURSES_EXPORT(int) wclrtoeol (WINDOW *);			/* implemented */
-extern NCURSES_EXPORT(int) wcolor_set (WINDOW*,short,void*);		/* implemented */
-extern NCURSES_EXPORT(void) wcursyncup (WINDOW *);			/* implemented */
-extern NCURSES_EXPORT(int) wdelch (WINDOW *);				/* implemented */
-extern NCURSES_EXPORT(int) wdeleteln (WINDOW *);			/* generated */
-extern NCURSES_EXPORT(int) wechochar (WINDOW *, const chtype);		/* implemented */
-extern NCURSES_EXPORT(int) werase (WINDOW *);				/* implemented */
-extern NCURSES_EXPORT(int) wgetch (WINDOW *);				/* implemented */
-extern NCURSES_EXPORT(int) wgetnstr (WINDOW *,char *,int);		/* implemented */
-extern NCURSES_EXPORT(int) wgetstr (WINDOW *, char *);			/* generated */
-extern NCURSES_EXPORT(int) whline (WINDOW *, chtype, int);		/* implemented */
-extern NCURSES_EXPORT(chtype) winch (WINDOW *);				/* implemented */
-extern NCURSES_EXPORT(int) winchnstr (WINDOW *, chtype *, int);		/* implemented */
-extern NCURSES_EXPORT(int) winchstr (WINDOW *, chtype *);		/* generated */
-extern NCURSES_EXPORT(int) winnstr (WINDOW *, char *, int);		/* implemented */
-extern NCURSES_EXPORT(int) winsch (WINDOW *, chtype);			/* implemented */
-extern NCURSES_EXPORT(int) winsdelln (WINDOW *,int);			/* implemented */
-extern NCURSES_EXPORT(int) winsertln (WINDOW *);			/* generated */
-extern NCURSES_EXPORT(int) winsnstr (WINDOW *, const char *,int);	/* implemented */
-extern NCURSES_EXPORT(int) winsstr (WINDOW *, const char *);		/* generated */
-extern NCURSES_EXPORT(int) winstr (WINDOW *, char *);			/* generated */
-extern NCURSES_EXPORT(int) wmove (WINDOW *,int,int);			/* implemented */
-extern NCURSES_EXPORT(int) wnoutrefresh (WINDOW *);			/* implemented */
-extern NCURSES_EXPORT(int) wprintw (WINDOW *, const char *,...)		/* implemented */
-		GCC_PRINTFLIKE(2,3);
-extern NCURSES_EXPORT(int) wredrawln (WINDOW *,int,int);		/* implemented */
-extern NCURSES_EXPORT(int) wrefresh (WINDOW *);				/* implemented */
-extern NCURSES_EXPORT(int) wscanw (WINDOW *, NCURSES_CONST char *,...)	/* implemented */
-		GCC_SCANFLIKE(2,3);
-extern NCURSES_EXPORT(int) wscrl (WINDOW *,int);			/* implemented */
-extern NCURSES_EXPORT(int) wsetscrreg (WINDOW *,int,int);		/* implemented */
-extern NCURSES_EXPORT(int) wstandout (WINDOW *);			/* generated */
-extern NCURSES_EXPORT(int) wstandend (WINDOW *);			/* generated */
-extern NCURSES_EXPORT(void) wsyncdown (WINDOW *);			/* implemented */
-extern NCURSES_EXPORT(void) wsyncup (WINDOW *);				/* implemented */
-extern NCURSES_EXPORT(void) wtimeout (WINDOW *,int);			/* implemented */
-extern NCURSES_EXPORT(int) wtouchln (WINDOW *,int,int,int);		/* implemented */
-extern NCURSES_EXPORT(int) wvline (WINDOW *,chtype,int);		/* implemented */
-
-/*
- * These are also declared in <term.h>:
- */
-extern NCURSES_EXPORT(int) tigetflag (NCURSES_CONST char *);		/* implemented */
-extern NCURSES_EXPORT(int) tigetnum (NCURSES_CONST char *);		/* implemented */
-extern NCURSES_EXPORT(char *) tigetstr (NCURSES_CONST char *);		/* implemented */
-extern NCURSES_EXPORT(int) putp (const char *);				/* implemented */
-
-#if NCURSES_TPARM_VARARGS
-extern NCURSES_EXPORT(char *) tparm (NCURSES_CONST char *, ...);	/* special */
-#else
-extern NCURSES_EXPORT(char *) tparm (NCURSES_CONST char *, long,long,long,long,long,long,long,long,long);	/* special */
-extern NCURSES_EXPORT(char *) tparm_varargs (NCURSES_CONST char *, ...);	/* special */
-#endif
-
-/*
- * These functions are not in X/Open, but we use them in macro definitions:
- */
-extern NCURSES_EXPORT(int) getattrs (const WINDOW *);			/* generated */
-extern NCURSES_EXPORT(int) getcurx (const WINDOW *);			/* generated */
-extern NCURSES_EXPORT(int) getcury (const WINDOW *);			/* generated */
-extern NCURSES_EXPORT(int) getbegx (const WINDOW *);			/* generated */
-extern NCURSES_EXPORT(int) getbegy (const WINDOW *);			/* generated */
-extern NCURSES_EXPORT(int) getmaxx (const WINDOW *);			/* generated */
-extern NCURSES_EXPORT(int) getmaxy (const WINDOW *);			/* generated */
-extern NCURSES_EXPORT(int) getparx (const WINDOW *);			/* generated */
-extern NCURSES_EXPORT(int) getpary (const WINDOW *);			/* generated */
-
-/*
- * vid_attr() was implemented originally based on a draft of X/Open curses.
- */
-#ifndef _XOPEN_SOURCE_EXTENDED
-#define vid_attr(a,pair,opts) vidattr(a)
-#endif
-
-/*
- * These functions are extensions - not in X/Open Curses.
- */
-#if 1
-#undef  NCURSES_EXT_FUNCS
-#define NCURSES_EXT_FUNCS 20081102
-typedef int (*NCURSES_WINDOW_CB)(WINDOW *, void *);
-typedef int (*NCURSES_SCREEN_CB)(SCREEN *, void *);
-extern NCURSES_EXPORT(bool) is_term_resized (int, int);
-extern NCURSES_EXPORT(char *) keybound (int, int);
-extern NCURSES_EXPORT(const char *) curses_version (void);
-extern NCURSES_EXPORT(int) assume_default_colors (int, int);
-extern NCURSES_EXPORT(int) define_key (const char *, int);
-extern NCURSES_EXPORT(int) key_defined (const char *);
-extern NCURSES_EXPORT(int) keyok (int, bool);
-extern NCURSES_EXPORT(int) resize_term (int, int);
-extern NCURSES_EXPORT(int) resizeterm (int, int);
-extern NCURSES_EXPORT(int) set_escdelay (int);
-extern NCURSES_EXPORT(int) set_tabsize (int);
-extern NCURSES_EXPORT(int) use_default_colors (void);
-extern NCURSES_EXPORT(int) use_extended_names (bool);
-extern NCURSES_EXPORT(int) use_legacy_coding (int);
-extern NCURSES_EXPORT(int) use_screen (SCREEN *, NCURSES_SCREEN_CB, void *);
-extern NCURSES_EXPORT(int) use_window (WINDOW *, NCURSES_WINDOW_CB, void *);
-extern NCURSES_EXPORT(int) wresize (WINDOW *, int, int);
-extern NCURSES_EXPORT(void) nofilter(void);
-
-/*
- * These extensions provide access to information stored in the WINDOW even
- * when NCURSES_OPAQUE is set:
- */
-extern NCURSES_EXPORT(WINDOW *) wgetparent (const WINDOW *);	/* generated */
-extern NCURSES_EXPORT(bool) is_cleared (const WINDOW *);	/* generated */
-extern NCURSES_EXPORT(bool) is_idcok (const WINDOW *);		/* generated */
-extern NCURSES_EXPORT(bool) is_idlok (const WINDOW *);		/* generated */
-extern NCURSES_EXPORT(bool) is_immedok (const WINDOW *);	/* generated */
-extern NCURSES_EXPORT(bool) is_keypad (const WINDOW *);		/* generated */
-extern NCURSES_EXPORT(bool) is_leaveok (const WINDOW *);	/* generated */
-extern NCURSES_EXPORT(bool) is_nodelay (const WINDOW *);	/* generated */
-extern NCURSES_EXPORT(bool) is_notimeout (const WINDOW *);	/* generated */
-extern NCURSES_EXPORT(bool) is_scrollok (const WINDOW *);	/* generated */
-extern NCURSES_EXPORT(bool) is_syncok (const WINDOW *);		/* generated */
-extern NCURSES_EXPORT(int) wgetscrreg (const WINDOW *, int *, int *); /* generated */
-
-#else
-#define curses_version() NCURSES_VERSION
-#endif
-
-/* attributes */
-
-#define NCURSES_ATTR_SHIFT       8
-#define NCURSES_BITS(mask,shift) ((mask) << ((shift) + NCURSES_ATTR_SHIFT))
-
-#define A_NORMAL	(1UL - 1UL)
-#define A_ATTRIBUTES	NCURSES_BITS(~(1UL - 1UL),0)
-#define A_CHARTEXT	(NCURSES_BITS(1UL,0) - 1UL)
-#define A_COLOR		NCURSES_BITS(((1UL) << 8) - 1UL,0)
-#define A_STANDOUT	NCURSES_BITS(1UL,8)
-#define A_UNDERLINE	NCURSES_BITS(1UL,9)
-#define A_REVERSE	NCURSES_BITS(1UL,10)
-#define A_BLINK		NCURSES_BITS(1UL,11)
-#define A_DIM		NCURSES_BITS(1UL,12)
-#define A_BOLD		NCURSES_BITS(1UL,13)
-#define A_ALTCHARSET	NCURSES_BITS(1UL,14)
-#define A_INVIS		NCURSES_BITS(1UL,15)
-#define A_PROTECT	NCURSES_BITS(1UL,16)
-#define A_HORIZONTAL	NCURSES_BITS(1UL,17)
-#define A_LEFT		NCURSES_BITS(1UL,18)
-#define A_LOW		NCURSES_BITS(1UL,19)
-#define A_RIGHT		NCURSES_BITS(1UL,20)
-#define A_TOP		NCURSES_BITS(1UL,21)
-#define A_VERTICAL	NCURSES_BITS(1UL,22)
-
-/*
- * Most of the pseudo functions are macros that either provide compatibility
- * with older versions of curses, or provide inline functionality to improve
- * performance.
- */
-
-/*
- * These pseudo functions are always implemented as macros:
- */
-
-#define getyx(win,y,x)   	(y = getcury(win), x = getcurx(win))
-#define getbegyx(win,y,x)	(y = getbegy(win), x = getbegx(win))
-#define getmaxyx(win,y,x)	(y = getmaxy(win), x = getmaxx(win))
-#define getparyx(win,y,x)	(y = getpary(win), x = getparx(win))
-
-#define getsyx(y,x) do { if (newscr) { \
-			     if (is_leaveok(newscr)) \
-				(y) = (x) = -1; \
-			     else \
-				 getyx(newscr,(y), (x)); \
-			} \
-		    } while(0)
-
-#define setsyx(y,x) do { if (newscr) { \
-			    if ((y) == -1 && (x) == -1) \
-				leaveok(newscr, TRUE); \
-			    else { \
-				leaveok(newscr, FALSE); \
-				wmove(newscr, (y), (x)); \
-			    } \
-			} \
-		    } while(0)
-
-#ifndef NCURSES_NOMACROS
-
-/*
- * These miscellaneous pseudo functions are provided for compatibility:
- */
-
-#define wgetstr(w, s)		wgetnstr(w, s, -1)
-#define getnstr(s, n)		wgetnstr(stdscr, s, n)
-
-#define setterm(term)		setupterm(term, 1, (int *)0)
-
-#define fixterm()		reset_prog_mode()
-#define resetterm()		reset_shell_mode()
-#define saveterm()		def_prog_mode()
-#define crmode()		cbreak()
-#define nocrmode()		nocbreak()
-#define gettmode()
-
-/* It seems older SYSV curses versions define these */
-#if !NCURSES_OPAQUE
-#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)
-#endif /* NCURSES_OPAQUE */
-
-#define wstandout(win)      	(wattrset(win,A_STANDOUT))
-#define wstandend(win)      	(wattrset(win,A_NORMAL))
-
-#define wattron(win,at)		wattr_on(win, NCURSES_CAST(attr_t, at), NULL)
-#define wattroff(win,at)	wattr_off(win, NCURSES_CAST(attr_t, at), NULL)
-
-#if !NCURSES_OPAQUE
-#if defined(_XOPEN_SOURCE_EXTENDED) && 0
-#define wattrset(win,at)	((win)->_color = PAIR_NUMBER(at), \
-				 (win)->_attrs = (at))
-#else
-#define wattrset(win,at)	((win)->_attrs = (at))
-#endif
-#endif /* NCURSES_OPAQUE */
-
-#define scroll(win)		wscrl(win,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, 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)
-#define hline(ch, n)		whline(stdscr, ch, n)
-#define vline(ch, n)		wvline(stdscr, ch, n)
-
-#define winstr(w, s)		winnstr(w, s, -1)
-#define winchstr(w, s)		winchnstr(w, s, -1)
-#define winsstr(w, s)		winsnstr(w, s, -1)
-
-#if !NCURSES_OPAQUE
-#define redrawwin(win)		wredrawln(win, 0, (win)->_maxy+1)
-#endif /* NCURSES_OPAQUE */
-
-#define waddstr(win,str)	waddnstr(win,str,-1)
-#define waddchstr(win,str)	waddchnstr(win,str,-1)
-
-/*
- * These apply to the first 256 color pairs.
- */
-#define COLOR_PAIR(n)	NCURSES_BITS(n, 0)
-#define PAIR_NUMBER(a)	(NCURSES_CAST(int,(((a) & A_COLOR) >> NCURSES_ATTR_SHIFT)))
-
-/*
- * pseudo functions for standard screen
- */
-
-#define addch(ch)		waddch(stdscr,ch)
-#define addchnstr(str,n)	waddchnstr(stdscr,str,n)
-#define addchstr(str)		waddchstr(stdscr,str)
-#define addnstr(str,n)		waddnstr(stdscr,str,n)
-#define addstr(str)		waddnstr(stdscr,str,-1)
-#define attroff(at)		wattroff(stdscr,at)
-#define attron(at)		wattron(stdscr,at)
-#define attrset(at)		wattrset(stdscr,at)
-#define attr_get(ap,cp,o)	wattr_get(stdscr,ap,cp,o)
-#define attr_off(a,o)		wattr_off(stdscr,a,o)
-#define attr_on(a,o)		wattr_on(stdscr,a,o)
-#define attr_set(a,c,o)		wattr_set(stdscr,a,c,o)
-#define bkgd(ch)		wbkgd(stdscr,ch)
-#define bkgdset(ch)		wbkgdset(stdscr,ch)
-#define chgat(n,a,c,o)		wchgat(stdscr,n,a,c,o)
-#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)
-#define erase()			werase(stdscr)
-#define getch()			wgetch(stdscr)
-#define getstr(str)		wgetstr(stdscr,str)
-#define inch()			winch(stdscr)
-#define inchnstr(s,n)		winchnstr(stdscr,s,n)
-#define inchstr(s)		winchstr(stdscr,s)
-#define innstr(s,n)		winnstr(stdscr,s,n)
-#define insch(c)		winsch(stdscr,c)
-#define insdelln(n)		winsdelln(stdscr,n)
-#define insertln()		winsdelln(stdscr,1)
-#define insnstr(s,n)		winsnstr(stdscr,s,n)
-#define insstr(s)		winsstr(stdscr,s)
-#define instr(s)		winstr(stdscr,s)
-#define move(y,x)		wmove(stdscr,y,x)
-#define refresh()		wrefresh(stdscr)
-#define scrl(n)			wscrl(stdscr,n)
-#define setscrreg(t,b)		wsetscrreg(stdscr,t,b)
-#define standend()		wstandend(stdscr)
-#define standout()		wstandout(stdscr)
-#define timeout(delay)		wtimeout(stdscr,delay)
-#define wdeleteln(win)		winsdelln(win,-1)
-#define winsertln(win)		winsdelln(win,1)
-
-/*
- * mv functions
- */
-
-#define mvwaddch(win,y,x,ch)		(wmove(win,y,x) == ERR ? ERR : waddch(win,ch))
-#define mvwaddchnstr(win,y,x,str,n)	(wmove(win,y,x) == ERR ? ERR : waddchnstr(win,str,n))
-#define mvwaddchstr(win,y,x,str)	(wmove(win,y,x) == ERR ? ERR : waddchnstr(win,str,-1))
-#define mvwaddnstr(win,y,x,str,n)	(wmove(win,y,x) == ERR ? ERR : waddnstr(win,str,n))
-#define mvwaddstr(win,y,x,str)		(wmove(win,y,x) == ERR ? ERR : waddnstr(win,str,-1))
-#define mvwdelch(win,y,x)		(wmove(win,y,x) == ERR ? ERR : wdelch(win))
-#define mvwchgat(win,y,x,n,a,c,o)	(wmove(win,y,x) == ERR ? ERR : wchgat(win,n,a,c,o))
-#define mvwgetch(win,y,x)		(wmove(win,y,x) == ERR ? ERR : wgetch(win))
-#define mvwgetnstr(win,y,x,str,n)	(wmove(win,y,x) == ERR ? ERR : wgetnstr(win,str,n))
-#define mvwgetstr(win,y,x,str)		(wmove(win,y,x) == ERR ? ERR : wgetstr(win,str))
-#define mvwhline(win,y,x,c,n)		(wmove(win,y,x) == ERR ? ERR : whline(win,c,n))
-#define mvwinch(win,y,x)		(wmove(win,y,x) == ERR ? NCURSES_CAST(chtype, ERR) : winch(win))
-#define mvwinchnstr(win,y,x,s,n)	(wmove(win,y,x) == ERR ? ERR : winchnstr(win,s,n))
-#define mvwinchstr(win,y,x,s)		(wmove(win,y,x) == ERR ? ERR : winchstr(win,s))
-#define mvwinnstr(win,y,x,s,n)		(wmove(win,y,x) == ERR ? ERR : winnstr(win,s,n))
-#define mvwinsch(win,y,x,c)		(wmove(win,y,x) == ERR ? ERR : winsch(win,c))
-#define mvwinsnstr(win,y,x,s,n)		(wmove(win,y,x) == ERR ? ERR : winsnstr(win,s,n))
-#define mvwinsstr(win,y,x,s)		(wmove(win,y,x) == ERR ? ERR : winsstr(win,s))
-#define mvwinstr(win,y,x,s)		(wmove(win,y,x) == ERR ? ERR : winstr(win,s))
-#define mvwvline(win,y,x,c,n)		(wmove(win,y,x) == ERR ? ERR : wvline(win,c,n))
-
-#define mvaddch(y,x,ch)			mvwaddch(stdscr,y,x,ch)
-#define mvaddchnstr(y,x,str,n)		mvwaddchnstr(stdscr,y,x,str,n)
-#define mvaddchstr(y,x,str)		mvwaddchstr(stdscr,y,x,str)
-#define mvaddnstr(y,x,str,n)		mvwaddnstr(stdscr,y,x,str,n)
-#define mvaddstr(y,x,str)		mvwaddstr(stdscr,y,x,str)
-#define mvchgat(y,x,n,a,c,o)		mvwchgat(stdscr,y,x,n,a,c,o)
-#define mvdelch(y,x)			mvwdelch(stdscr,y,x)
-#define mvgetch(y,x)			mvwgetch(stdscr,y,x)
-#define mvgetnstr(y,x,str,n)		mvwgetnstr(stdscr,y,x,str,n)
-#define mvgetstr(y,x,str)		mvwgetstr(stdscr,y,x,str)
-#define mvhline(y,x,c,n)		mvwhline(stdscr,y,x,c,n)
-#define mvinch(y,x)			mvwinch(stdscr,y,x)
-#define mvinchnstr(y,x,s,n)		mvwinchnstr(stdscr,y,x,s,n)
-#define mvinchstr(y,x,s)		mvwinchstr(stdscr,y,x,s)
-#define mvinnstr(y,x,s,n)		mvwinnstr(stdscr,y,x,s,n)
-#define mvinsch(y,x,c)			mvwinsch(stdscr,y,x,c)
-#define mvinsnstr(y,x,s,n)		mvwinsnstr(stdscr,y,x,s,n)
-#define mvinsstr(y,x,s)			mvwinsstr(stdscr,y,x,s)
-#define mvinstr(y,x,s)			mvwinstr(stdscr,y,x,s)
-#define mvvline(y,x,c,n)		mvwvline(stdscr,y,x,c,n)
-
-/*
- * Some wide-character functions can be implemented without the extensions.
- */
-#if !NCURSES_OPAQUE
-#define getbkgd(win)                    ((win)->_bkgd)
-#endif /* NCURSES_OPAQUE */
-
-#define slk_attr_off(a,v)		((v) ? ERR : slk_attroff(a))
-#define slk_attr_on(a,v)		((v) ? ERR : slk_attron(a))
-
-#if !NCURSES_OPAQUE
-#if defined(_XOPEN_SOURCE_EXTENDED) && 0
-#define wattr_set(win,a,p,opts)		((win)->_attrs = ((a) & ~A_COLOR), \
-					 (win)->_color = (p), \
-					 OK)
-#define wattr_get(win,a,p,opts)		((void)((a) != (void *)0 && (*(a) = (win)->_attrs)), \
-					 (void)((p) != (void *)0 && (*(p) = (win)->_color)), \
-					 OK)
-#else
-#define wattr_set(win,a,p,opts)		((win)->_attrs = (((a) & ~A_COLOR) | COLOR_PAIR(p)), OK)
-#define wattr_get(win,a,p,opts)		((void)((a) != (void *)0 && (*(a) = (win)->_attrs)), \
-					 (void)((p) != (void *)0 && (*(p) = PAIR_NUMBER((win)->_attrs))), \
-					 OK)
-#endif
-#endif /* NCURSES_OPAQUE */
-
-/*
- * X/Open curses deprecates SVr4 vwprintw/vwscanw, which are supposed to use
- * varargs.h.  It adds new calls vw_printw/vw_scanw, which are supposed to
- * use POSIX stdarg.h.  The ncurses versions of vwprintw/vwscanw already
- * use stdarg.h, so...
- */
-#define vw_printw		vwprintw
-#define vw_scanw		vwscanw
-
-/*
- * Export fallback function for use in C++ binding.
- */
-#if !1
-#define vsscanf(a,b,c) _nc_vsscanf(a,b,c)
-NCURSES_EXPORT(int) vsscanf(const char *, const char *, va_list);
-#endif
-
-/*
- * These macros are extensions - not in X/Open Curses.
- */
-#if 1
-#if !NCURSES_OPAQUE
-#define is_cleared(win)		((win)->_clear)
-#define is_idcok(win)		((win)->_idcok)
-#define is_idlok(win)		((win)->_idlok)
-#define is_immedok(win)		((win)->_immed)
-#define is_keypad(win)		((win)->_use_keypad)
-#define is_leaveok(win)		((win)->_leaveok)
-#define is_nodelay(win)		((win)->_delay == 0)
-#define is_notimeout(win)	((win)->_notimeout)
-#define is_scrollok(win)	((win)->_scroll)
-#define is_syncok(win)		((win)->_sync)
-#define wgetparent(win)		((win) ? (win)->_parent : 0)
-#define wgetscrreg(win,t,b)	((win) ? (*(t) = (win)->_regtop, *(b) = (win)->_regbottom, OK) : ERR)
-#endif
-#endif
-
-#endif /* NCURSES_NOMACROS */
-
-/*
- * Public variables.
- *
- * Notes:
- *	a. ESCDELAY was an undocumented feature under AIX curses.
- *	   It gives the ESC expire time in milliseconds.
- *	b. ttytype is needed for backward compatibility
- */
-#if 0
-
-NCURSES_WRAPPED_VAR(WINDOW *, curscr);
-NCURSES_WRAPPED_VAR(WINDOW *, newscr);
-NCURSES_WRAPPED_VAR(WINDOW *, stdscr);
-NCURSES_WRAPPED_VAR(char *, ttytype);
-NCURSES_WRAPPED_VAR(int, COLORS);
-NCURSES_WRAPPED_VAR(int, COLOR_PAIRS);
-NCURSES_WRAPPED_VAR(int, COLS);
-NCURSES_WRAPPED_VAR(int, ESCDELAY);
-NCURSES_WRAPPED_VAR(int, LINES);
-NCURSES_WRAPPED_VAR(int, TABSIZE);
-
-#define curscr      NCURSES_PUBLIC_VAR(curscr())
-#define newscr      NCURSES_PUBLIC_VAR(newscr())
-#define stdscr      NCURSES_PUBLIC_VAR(stdscr())
-#define ttytype     NCURSES_PUBLIC_VAR(ttytype())
-#define COLORS      NCURSES_PUBLIC_VAR(COLORS())
-#define COLOR_PAIRS NCURSES_PUBLIC_VAR(COLOR_PAIRS())
-#define COLS        NCURSES_PUBLIC_VAR(COLS())
-#define ESCDELAY    NCURSES_PUBLIC_VAR(ESCDELAY())
-#define LINES       NCURSES_PUBLIC_VAR(LINES())
-#define TABSIZE     NCURSES_PUBLIC_VAR(TABSIZE())
-
-#else
-
-extern NCURSES_EXPORT_VAR(WINDOW *) curscr;
-extern NCURSES_EXPORT_VAR(WINDOW *) newscr;
-extern NCURSES_EXPORT_VAR(WINDOW *) stdscr;
-extern NCURSES_EXPORT_VAR(char) ttytype[];
-extern NCURSES_EXPORT_VAR(int) COLORS;
-extern NCURSES_EXPORT_VAR(int) COLOR_PAIRS;
-extern NCURSES_EXPORT_VAR(int) COLS;
-extern NCURSES_EXPORT_VAR(int) ESCDELAY;
-extern NCURSES_EXPORT_VAR(int) LINES;
-extern NCURSES_EXPORT_VAR(int) TABSIZE;
-
-#endif
-
-/*
- * Pseudo-character tokens outside ASCII range.  The curses wgetch() function
- * will return any given one of these only if the corresponding k- capability
- * is defined in your terminal's terminfo entry.
- *
- * Some keys (KEY_A1, etc) are arranged like this:
- *	a1     up    a3
- *	left   b2    right
- *	c1     down  c3
- *
- * A few key codes do not depend upon the terminfo entry.
- */
-#define KEY_CODE_YES	0400		/* A wchar_t contains a key code */
-#define KEY_MIN		0401		/* Minimum curses key */
-#define KEY_BREAK	0401		/* Break key (unreliable) */
-#define KEY_SRESET	0530		/* Soft (partial) reset (unreliable) */
-#define KEY_RESET	0531		/* Reset or hard reset (unreliable) */
-/*
- * These definitions were generated by ./MKkey_defs.sh ./Caps
- */
-#define KEY_DOWN	0402		/* down-arrow key */
-#define KEY_UP		0403		/* up-arrow key */
-#define KEY_LEFT	0404		/* left-arrow key */
-#define KEY_RIGHT	0405		/* right-arrow key */
-#define KEY_HOME	0406		/* home key */
-#define KEY_BACKSPACE	0407		/* backspace key */
-#define KEY_F0		0410		/* Function keys.  Space for 64 */
-#define KEY_F(n)	(KEY_F0+(n))	/* Value of function key n */
-#define KEY_DL		0510		/* delete-line key */
-#define KEY_IL		0511		/* insert-line key */
-#define KEY_DC		0512		/* delete-character key */
-#define KEY_IC		0513		/* insert-character key */
-#define KEY_EIC		0514		/* sent by rmir or smir in insert mode */
-#define KEY_CLEAR	0515		/* clear-screen or erase key */
-#define KEY_EOS		0516		/* clear-to-end-of-screen key */
-#define KEY_EOL		0517		/* clear-to-end-of-line key */
-#define KEY_SF		0520		/* scroll-forward key */
-#define KEY_SR		0521		/* scroll-backward key */
-#define KEY_NPAGE	0522		/* next-page key */
-#define KEY_PPAGE	0523		/* previous-page key */
-#define KEY_STAB	0524		/* set-tab key */
-#define KEY_CTAB	0525		/* clear-tab key */
-#define KEY_CATAB	0526		/* clear-all-tabs key */
-#define KEY_ENTER	0527		/* enter/send key */
-#define KEY_PRINT	0532		/* print key */
-#define KEY_LL		0533		/* lower-left key (home down) */
-#define KEY_A1		0534		/* upper left of keypad */
-#define KEY_A3		0535		/* upper right of keypad */
-#define KEY_B2		0536		/* center of keypad */
-#define KEY_C1		0537		/* lower left of keypad */
-#define KEY_C3		0540		/* lower right of keypad */
-#define KEY_BTAB	0541		/* back-tab key */
-#define KEY_BEG		0542		/* begin key */
-#define KEY_CANCEL	0543		/* cancel key */
-#define KEY_CLOSE	0544		/* close key */
-#define KEY_COMMAND	0545		/* command key */
-#define KEY_COPY	0546		/* copy key */
-#define KEY_CREATE	0547		/* create key */
-#define KEY_END		0550		/* end key */
-#define KEY_EXIT	0551		/* exit key */
-#define KEY_FIND	0552		/* find key */
-#define KEY_HELP	0553		/* help key */
-#define KEY_MARK	0554		/* mark key */
-#define KEY_MESSAGE	0555		/* message key */
-#define KEY_MOVE	0556		/* move key */
-#define KEY_NEXT	0557		/* next key */
-#define KEY_OPEN	0560		/* open key */
-#define KEY_OPTIONS	0561		/* options key */
-#define KEY_PREVIOUS	0562		/* previous key */
-#define KEY_REDO	0563		/* redo key */
-#define KEY_REFERENCE	0564		/* reference key */
-#define KEY_REFRESH	0565		/* refresh key */
-#define KEY_REPLACE	0566		/* replace key */
-#define KEY_RESTART	0567		/* restart key */
-#define KEY_RESUME	0570		/* resume key */
-#define KEY_SAVE	0571		/* save key */
-#define KEY_SBEG	0572		/* shifted begin key */
-#define KEY_SCANCEL	0573		/* shifted cancel key */
-#define KEY_SCOMMAND	0574		/* shifted command key */
-#define KEY_SCOPY	0575		/* shifted copy key */
-#define KEY_SCREATE	0576		/* shifted create key */
-#define KEY_SDC		0577		/* shifted delete-character key */
-#define KEY_SDL		0600		/* shifted delete-line key */
-#define KEY_SELECT	0601		/* select key */
-#define KEY_SEND	0602		/* shifted end key */
-#define KEY_SEOL	0603		/* shifted clear-to-end-of-line key */
-#define KEY_SEXIT	0604		/* shifted exit key */
-#define KEY_SFIND	0605		/* shifted find key */
-#define KEY_SHELP	0606		/* shifted help key */
-#define KEY_SHOME	0607		/* shifted home key */
-#define KEY_SIC		0610		/* shifted insert-character key */
-#define KEY_SLEFT	0611		/* shifted left-arrow key */
-#define KEY_SMESSAGE	0612		/* shifted message key */
-#define KEY_SMOVE	0613		/* shifted move key */
-#define KEY_SNEXT	0614		/* shifted next key */
-#define KEY_SOPTIONS	0615		/* shifted options key */
-#define KEY_SPREVIOUS	0616		/* shifted previous key */
-#define KEY_SPRINT	0617		/* shifted print key */
-#define KEY_SREDO	0620		/* shifted redo key */
-#define KEY_SREPLACE	0621		/* shifted replace key */
-#define KEY_SRIGHT	0622		/* shifted right-arrow key */
-#define KEY_SRSUME	0623		/* shifted resume key */
-#define KEY_SSAVE	0624		/* shifted save key */
-#define KEY_SSUSPEND	0625		/* shifted suspend key */
-#define KEY_SUNDO	0626		/* shifted undo key */
-#define KEY_SUSPEND	0627		/* suspend key */
-#define KEY_UNDO	0630		/* undo key */
-#define KEY_MOUSE	0631		/* Mouse event has occurred */
-#define KEY_RESIZE	0632		/* Terminal resize event */
-#define KEY_EVENT	0633		/* We were interrupted by an event */
-
-#define KEY_MAX		0777		/* Maximum key value is 0633 */
-/* $Id: curses.tail,v 1.16 2008/07/05 20:20:38 tom Exp $ */
-/*
- * vile:cmode:
- * This file is part of ncurses, designed to be appended after curses.h.in
- * (see that file for the relevant copyright).
- */
-
-/* mouse interface */
-
-#if NCURSES_MOUSE_VERSION > 1
-#define NCURSES_MOUSE_MASK(b,m) ((m) << (((b) - 1) * 5))
-#else
-#define NCURSES_MOUSE_MASK(b,m) ((m) << (((b) - 1) * 6))
-#endif
-
-#define	NCURSES_BUTTON_RELEASED	001L
-#define	NCURSES_BUTTON_PRESSED	002L
-#define	NCURSES_BUTTON_CLICKED	004L
-#define	NCURSES_DOUBLE_CLICKED	010L
-#define	NCURSES_TRIPLE_CLICKED	020L
-#define	NCURSES_RESERVED_EVENT	040L
-
-/* event masks */
-#define	BUTTON1_RELEASED	NCURSES_MOUSE_MASK(1, NCURSES_BUTTON_RELEASED)
-#define	BUTTON1_PRESSED		NCURSES_MOUSE_MASK(1, NCURSES_BUTTON_PRESSED)
-#define	BUTTON1_CLICKED		NCURSES_MOUSE_MASK(1, NCURSES_BUTTON_CLICKED)
-#define	BUTTON1_DOUBLE_CLICKED	NCURSES_MOUSE_MASK(1, NCURSES_DOUBLE_CLICKED)
-#define	BUTTON1_TRIPLE_CLICKED	NCURSES_MOUSE_MASK(1, NCURSES_TRIPLE_CLICKED)
-
-#define	BUTTON2_RELEASED	NCURSES_MOUSE_MASK(2, NCURSES_BUTTON_RELEASED)
-#define	BUTTON2_PRESSED		NCURSES_MOUSE_MASK(2, NCURSES_BUTTON_PRESSED)
-#define	BUTTON2_CLICKED		NCURSES_MOUSE_MASK(2, NCURSES_BUTTON_CLICKED)
-#define	BUTTON2_DOUBLE_CLICKED	NCURSES_MOUSE_MASK(2, NCURSES_DOUBLE_CLICKED)
-#define	BUTTON2_TRIPLE_CLICKED	NCURSES_MOUSE_MASK(2, NCURSES_TRIPLE_CLICKED)
-
-#define	BUTTON3_RELEASED	NCURSES_MOUSE_MASK(3, NCURSES_BUTTON_RELEASED)
-#define	BUTTON3_PRESSED		NCURSES_MOUSE_MASK(3, NCURSES_BUTTON_PRESSED)
-#define	BUTTON3_CLICKED		NCURSES_MOUSE_MASK(3, NCURSES_BUTTON_CLICKED)
-#define	BUTTON3_DOUBLE_CLICKED	NCURSES_MOUSE_MASK(3, NCURSES_DOUBLE_CLICKED)
-#define	BUTTON3_TRIPLE_CLICKED	NCURSES_MOUSE_MASK(3, NCURSES_TRIPLE_CLICKED)
-
-#define	BUTTON4_RELEASED	NCURSES_MOUSE_MASK(4, NCURSES_BUTTON_RELEASED)
-#define	BUTTON4_PRESSED		NCURSES_MOUSE_MASK(4, NCURSES_BUTTON_PRESSED)
-#define	BUTTON4_CLICKED		NCURSES_MOUSE_MASK(4, NCURSES_BUTTON_CLICKED)
-#define	BUTTON4_DOUBLE_CLICKED	NCURSES_MOUSE_MASK(4, NCURSES_DOUBLE_CLICKED)
-#define	BUTTON4_TRIPLE_CLICKED	NCURSES_MOUSE_MASK(4, NCURSES_TRIPLE_CLICKED)
-
-/*
- * In 32 bits the version-1 scheme does not provide enough space for a 5th
- * button, unless we choose to change the ABI by omitting the reserved-events.
- */
-#if NCURSES_MOUSE_VERSION > 1
-
-#define	BUTTON5_RELEASED	NCURSES_MOUSE_MASK(5, NCURSES_BUTTON_RELEASED)
-#define	BUTTON5_PRESSED		NCURSES_MOUSE_MASK(5, NCURSES_BUTTON_PRESSED)
-#define	BUTTON5_CLICKED		NCURSES_MOUSE_MASK(5, NCURSES_BUTTON_CLICKED)
-#define	BUTTON5_DOUBLE_CLICKED	NCURSES_MOUSE_MASK(5, NCURSES_DOUBLE_CLICKED)
-#define	BUTTON5_TRIPLE_CLICKED	NCURSES_MOUSE_MASK(5, NCURSES_TRIPLE_CLICKED)
-
-#define	BUTTON_CTRL		NCURSES_MOUSE_MASK(6, 0001L)
-#define	BUTTON_SHIFT		NCURSES_MOUSE_MASK(6, 0002L)
-#define	BUTTON_ALT		NCURSES_MOUSE_MASK(6, 0004L)
-#define	REPORT_MOUSE_POSITION	NCURSES_MOUSE_MASK(6, 0010L)
-
-#else
-
-#define	BUTTON1_RESERVED_EVENT	NCURSES_MOUSE_MASK(1, NCURSES_RESERVED_EVENT)
-#define	BUTTON2_RESERVED_EVENT	NCURSES_MOUSE_MASK(2, NCURSES_RESERVED_EVENT)
-#define	BUTTON3_RESERVED_EVENT	NCURSES_MOUSE_MASK(3, NCURSES_RESERVED_EVENT)
-#define	BUTTON4_RESERVED_EVENT	NCURSES_MOUSE_MASK(4, NCURSES_RESERVED_EVENT)
-
-#define	BUTTON_CTRL		NCURSES_MOUSE_MASK(5, 0001L)
-#define	BUTTON_SHIFT		NCURSES_MOUSE_MASK(5, 0002L)
-#define	BUTTON_ALT		NCURSES_MOUSE_MASK(5, 0004L)
-#define	REPORT_MOUSE_POSITION	NCURSES_MOUSE_MASK(5, 0010L)
-
-#endif
-
-#define	ALL_MOUSE_EVENTS	(REPORT_MOUSE_POSITION - 1)
-
-/* macros to extract single event-bits from masks */
-#define	BUTTON_RELEASE(e, x)		((e) & NCURSES_MOUSE_MASK(x, 001))
-#define	BUTTON_PRESS(e, x)		((e) & NCURSES_MOUSE_MASK(x, 002))
-#define	BUTTON_CLICK(e, x)		((e) & NCURSES_MOUSE_MASK(x, 004))
-#define	BUTTON_DOUBLE_CLICK(e, x)	((e) & NCURSES_MOUSE_MASK(x, 010))
-#define	BUTTON_TRIPLE_CLICK(e, x)	((e) & NCURSES_MOUSE_MASK(x, 020))
-#define	BUTTON_RESERVED_EVENT(e, x)	((e) & NCURSES_MOUSE_MASK(x, 040))
-
-typedef struct
-{
-    short id;		/* ID to distinguish multiple devices */
-    int x, y, z;	/* event coordinates (character-cell) */
-    mmask_t bstate;	/* button state bits */
-}
-MEVENT;
-
-extern NCURSES_EXPORT(int) getmouse (MEVENT *);
-extern NCURSES_EXPORT(int) ungetmouse (MEVENT *);
-extern NCURSES_EXPORT(mmask_t) mousemask (mmask_t, mmask_t *);
-extern NCURSES_EXPORT(bool) wenclose (const WINDOW *, int, int);
-extern NCURSES_EXPORT(int) mouseinterval (int);
-extern NCURSES_EXPORT(bool) wmouse_trafo (const WINDOW*, int*, int*, bool);
-extern NCURSES_EXPORT(bool) mouse_trafo (int*, int*, bool);              /* generated */
-
-#define mouse_trafo(y,x,to_screen) wmouse_trafo(stdscr,y,x,to_screen)
-
-/* other non-XSI functions */
-
-extern NCURSES_EXPORT(int) mcprint (char *, int);	/* direct data to printer */
-extern NCURSES_EXPORT(int) has_key (int);		/* do we have given key? */
-
-/* Debugging : use with libncurses_g.a */
-
-extern NCURSES_EXPORT(void) _tracef (const char *, ...) GCC_PRINTFLIKE(1,2);
-extern NCURSES_EXPORT(void) _tracedump (const char *, WINDOW *);
-extern NCURSES_EXPORT(char *) _traceattr (attr_t);
-extern NCURSES_EXPORT(char *) _traceattr2 (int, chtype);
-extern NCURSES_EXPORT(char *) _nc_tracebits (void);
-extern NCURSES_EXPORT(char *) _tracechar (int);
-extern NCURSES_EXPORT(char *) _tracechtype (chtype);
-extern NCURSES_EXPORT(char *) _tracechtype2 (int, chtype);
-#ifdef _XOPEN_SOURCE_EXTENDED
-#define _tracech_t		_tracecchar_t
-extern NCURSES_EXPORT(char *) _tracecchar_t (const cchar_t *);
-#define _tracech_t2		_tracecchar_t2
-extern NCURSES_EXPORT(char *) _tracecchar_t2 (int, const cchar_t *);
-#else
-#define _tracech_t		_tracechtype
-#define _tracech_t2		_tracechtype2
-#endif
-extern NCURSES_EXPORT(char *) _tracemouse (const MEVENT *);
-extern NCURSES_EXPORT(void) trace (const unsigned int);
-
-/* trace masks */
-#define TRACE_DISABLE	0x0000	/* turn off tracing */
-#define TRACE_TIMES	0x0001	/* trace user and system times of updates */
-#define TRACE_TPUTS	0x0002	/* trace tputs calls */
-#define TRACE_UPDATE	0x0004	/* trace update actions, old & new screens */
-#define TRACE_MOVE	0x0008	/* trace cursor moves and scrolls */
-#define TRACE_CHARPUT	0x0010	/* trace all character outputs */
-#define TRACE_ORDINARY	0x001F	/* trace all update actions */
-#define TRACE_CALLS	0x0020	/* trace all curses calls */
-#define TRACE_VIRTPUT	0x0040	/* trace virtual character puts */
-#define TRACE_IEVENT	0x0080	/* trace low-level input processing */
-#define TRACE_BITS	0x0100	/* trace state of TTY control bits */
-#define TRACE_ICALLS	0x0200	/* trace internal/nested calls */
-#define TRACE_CCALLS	0x0400	/* trace per-character calls */
-#define TRACE_DATABASE	0x0800	/* trace read/write of terminfo/termcap data */
-#define TRACE_ATTRS	0x1000	/* trace attribute updates */
-
-#define TRACE_SHIFT	13	/* number of bits in the trace masks */
-#define TRACE_MAXIMUM	((1 << TRACE_SHIFT) - 1) /* maximum trace level */
-
-#if defined(TRACE) || defined(NCURSES_TEST)
-extern NCURSES_EXPORT_VAR(int) _nc_optimize_enable;		/* enable optimizations */
-extern NCURSES_EXPORT(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 */
-#define OPTIMIZE_ALL		0xff	/* enable all optimizations (dflt) */
-#endif
-
-#ifdef __cplusplus
-
-#ifndef NCURSES_NOMACROS
-
-/* these names conflict with STL */
-#undef box
-#undef clear
-#undef erase
-#undef move
-#undef refresh
-
-#endif /* NCURSES_NOMACROS */
-
-}
-#endif
-
-#endif /* __NCURSES_H */
diff --git a/include/curses.h.in b/include/curses.h.in
index 53da9a5..65eedaa 100644
--- a/include/curses.h.in
+++ b/include/curses.h.in
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2013,2014 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            *
@@ -32,7 +32,7 @@
  *     and: Thomas E. Dickey                        1996-on                 *
  ****************************************************************************/
 
-/* $Id: curses.h.in,v 1.187 2008/08/30 20:11:29 tom Exp $ */
+/* $Id: curses.h.in,v 1.241 2014/08/09 20:39:44 tom Exp $ */
 
 #ifndef __NCURSES_H
 #define __NCURSES_H
@@ -40,12 +40,6 @@
 #define CURSES 1
 #define CURSES_H 1
 
-/* This should be defined for the enhanced functionality to be visible.
- * However, some of the wide-character (enhanced) functionality is missing.
- * 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@
@@ -65,6 +59,10 @@
  */
 #include <ncurses_dll.h>
 
+#if @HAVE_STDINT_H@
+#include <stdint.h>
+#endif
+
 /*
  * User-definable tweak to disable the include of <stdbool.h>.
  */
@@ -76,12 +74,6 @@
  * NCURSES_ATTR_T is used to quiet compiler warnings when building ncurses
  * configured using --disable-macros.
  */
-#ifdef NCURSES_NOMACROS
-#ifndef NCURSES_ATTR_T
-#define NCURSES_ATTR_T attr_t
-#endif
-#endif /* NCURSES_NOMACROS */
-
 #ifndef NCURSES_ATTR_T
 #define NCURSES_ATTR_T int
 #endif
@@ -97,11 +89,20 @@
 #define NCURSES_INLINE @NCURSES_INLINE@
 
 /*
- * The internal type used for color values
+ * The internal type used for color values, and for color-pairs.  The latter
+ * allows the curses library to enumerate the combinations of foreground and
+ * background colors used by an application, and is normally the product of the
+ * total foreground and background colors.
+ *
+ * X/Open uses "short" for both of these types, ultimately because they are
+ * numbers from the terminal database, which uses 16-bit signed values.
  */
 #undef	NCURSES_COLOR_T
 #define	NCURSES_COLOR_T short
 
+#undef	NCURSES_PAIRS_T
+#define	NCURSES_PAIRS_T short
+
 /*
  * Definition used to make WINDOW and similar structs opaque.
  */
@@ -110,6 +111,19 @@
 #endif
 
 /*
+ * The reentrant code relies on the opaque setting, but adds features.
+ */
+#ifndef NCURSES_REENTRANT
+#define NCURSES_REENTRANT @cf_cv_enable_reentrant@
+#endif
+
+/*
+ * Control whether bindings for interop support are added.
+ */
+#undef	NCURSES_INTEROP_FUNCS
+#define	NCURSES_INTEROP_FUNCS @NCURSES_INTEROP_FUNCS@
+
+/*
  * The internal type used for window dimensions.
  */
 #undef	NCURSES_SIZE_T
@@ -122,6 +136,13 @@
 #define NCURSES_TPARM_VARARGS @NCURSES_TPARM_VARARGS@
 
 /*
+ * Control type used for tparm's arguments.  While X/Open equates long and
+ * char* values, this is not always workable for 64-bit platforms.
+ */
+#undef NCURSES_TPARM_ARG
+#define NCURSES_TPARM_ARG @NCURSES_TPARM_ARG@
+
+/*
  * NCURSES_CH_T is used in building the library, but not used otherwise in
  * this header file, since that would make the normal/wide-character versions
  * of the header incompatible.
@@ -133,16 +154,34 @@
 typedef unsigned chtype;
 typedef unsigned mmask_t;
 #else
-typedef unsigned @cf_cv_typeof_chtype@ chtype;
-typedef unsigned @cf_cv_typeof_mmask_t@ mmask_t;
+typedef @cf_cv_typeof_chtype@ chtype;
+typedef @cf_cv_typeof_mmask_t@ mmask_t;
 #endif
 
+/*
+ * We need FILE, etc.  Include this before checking any feature symbols.
+ */
 #include <stdio.h>
-#include <unctrl.h>
+
+/*
+ * With XPG4, you must define _XOPEN_SOURCE_EXTENDED, it is redundant (or
+ * conflicting) when _XOPEN_SOURCE is 500 or greater.  If NCURSES_WIDECHAR is
+ * not already defined, e.g., if the platform relies upon nonstandard feature
+ * test macros, define it at this point if the standard feature test macros
+ * indicate that it should be defined.
+ */
+#ifndef NCURSES_WIDECHAR
+#if defined(_XOPEN_SOURCE_EXTENDED) || (defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE - 0 >= 500))
+#define NCURSES_WIDECHAR 1
+#else
+#define NCURSES_WIDECHAR 0
+#endif
+#endif /* NCURSES_WIDECHAR */
+
 #include <stdarg.h>	/* we need va_list */
-#ifdef _XOPEN_SOURCE_EXTENDED
+#if NCURSES_WIDECHAR
 #include <stddef.h>	/* we want wchar_t */
-#endif /* _XOPEN_SOURCE_EXTENDED */
+#endif
 
 /* X/Open 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
@@ -212,6 +251,10 @@
 #define WA_TOP		A_TOP
 #define WA_VERTICAL	A_VERTICAL
 
+#if @NCURSES_EXT_FUNCS@
+#define WA_ITALIC	A_ITALIC	/* ncurses extension */
+#endif
+
 /* colors */
 #define COLOR_BLACK	0
 #define COLOR_RED	1
@@ -224,14 +267,14 @@
 
 /* line graphics */
 
-#if @BROKEN_LINKER@ || @cf_cv_enable_reentrant@
+#if @BROKEN_LINKER@ || NCURSES_REENTRANT
 NCURSES_WRAPPED_VAR(chtype*, acs_map);
-#define acs_map (_nc_acs_map())
+#define acs_map NCURSES_PUBLIC_VAR(acs_map())
 #else
 extern NCURSES_EXPORT_VAR(chtype) acs_map[];
 #endif
 
-#define NCURSES_ACS(c)	(acs_map[NCURSES_CAST(unsigned char,c)])
+#define NCURSES_ACS(c)	(acs_map[NCURSES_CAST(unsigned char,(c))])
 
 /* VT100 symbols begin here */
 #define ACS_ULCORNER	NCURSES_ACS('l') /* upper left corner */
@@ -323,7 +366,7 @@
 
 typedef	chtype	attr_t;		/* ...must be at least as wide as chtype */
 
-#ifdef _XOPEN_SOURCE_EXTENDED
+#if NCURSES_WIDECHAR
 
 #if @NCURSES_LIBUTF8@
 #ifdef mblen			/* libutf8.h defines it w/o undefining first */
@@ -344,7 +387,13 @@
 typedef unsigned int wint_t@NCURSES_OK_WCHAR_T@;
 #endif
 
-#define CCHARW_MAX	5
+/*
+ * cchar_t stores an array of CCHARW_MAX wide characters.  The first is
+ * normally a spacing character.  The others are non-spacing.  If those
+ * (spacing and nonspacing) do not fill the array, a null L'\0' follows.
+ * Otherwise, a null is assumed to follow when extracting via getcchar().
+ */
+#define CCHARW_MAX	@NCURSES_CCHARW_MAX@
 typedef struct
 {
     attr_t	attr;
@@ -357,7 +406,7 @@
 }
 cchar_t;
 
-#endif /* _XOPEN_SOURCE_EXTENDED */
+#endif /* NCURSES_WIDECHAR */
 
 #if !NCURSES_OPAQUE
 struct ldat;
@@ -409,7 +458,7 @@
 
 	NCURSES_SIZE_T _yoffset; /* real begy is _begy + _yoffset */
 
-#ifdef _XOPEN_SOURCE_EXTENDED
+#if NCURSES_WIDECHAR
 	cchar_t  _bkgrnd;	/* current background char/attribute pair */
 #if @NCURSES_EXT_COLORS@
 	int	_color;		/* current color-pair for non-space character */
@@ -461,8 +510,8 @@
     _nc_event *events[1];
 } _nc_eventlist;
 
-extern NCURSES_EXPORT(int) wgetch_events(WINDOW *, _nc_eventlist *);	/* experimental */
-extern NCURSES_EXPORT(int) wgetnstr_events(WINDOW *,char *,int,_nc_eventlist *);/* experimental */
+extern NCURSES_EXPORT(int) wgetch_events (WINDOW *, _nc_eventlist *);	/* experimental */
+extern NCURSES_EXPORT(int) wgetnstr_events (WINDOW *,char *,int,_nc_eventlist *);/* experimental */
 
 #endif /* NCURSES_WGETCH_EVENTS */
 #endif /* NCURSES_EXT_FUNCS */
@@ -511,6 +560,12 @@
 #endif
 
 /*
+ * Curses uses a helper function.  Define our type for this to simplify
+ * extending it for the sp-funcs feature.
+ */
+typedef int (*NCURSES_OUTC)(int);
+
+/*
  * Function prototypes.  This is the complete X/Open Curses list of required
  * functions.  Those marked `generated' will have sources generated from the
  * macro definitions later in this file, in order to satisfy XPG4.2
@@ -525,10 +580,10 @@
 extern NCURSES_EXPORT(int) attroff (NCURSES_ATTR_T);			/* generated */
 extern NCURSES_EXPORT(int) attron (NCURSES_ATTR_T);			/* generated */
 extern NCURSES_EXPORT(int) attrset (NCURSES_ATTR_T);			/* generated */
-extern NCURSES_EXPORT(int) attr_get (attr_t *, short *, void *);	/* generated */
+extern NCURSES_EXPORT(int) attr_get (attr_t *, NCURSES_PAIRS_T *, void *);	/* generated */
 extern NCURSES_EXPORT(int) attr_off (attr_t, void *);			/* generated */
 extern NCURSES_EXPORT(int) attr_on (attr_t, void *);			/* generated */
-extern NCURSES_EXPORT(int) attr_set (attr_t, short, void *);		/* generated */
+extern NCURSES_EXPORT(int) attr_set (attr_t, NCURSES_PAIRS_T, void *);		/* generated */
 extern NCURSES_EXPORT(int) baudrate (void);				/* implemented */
 extern NCURSES_EXPORT(int) beep  (void);				/* implemented */
 extern NCURSES_EXPORT(int) bkgd (chtype);				/* generated */
@@ -537,13 +592,13 @@
 extern NCURSES_EXPORT(int) box (WINDOW *, chtype, chtype);		/* generated */
 extern NCURSES_EXPORT(bool) can_change_color (void);			/* implemented */
 extern NCURSES_EXPORT(int) cbreak (void);				/* implemented */
-extern NCURSES_EXPORT(int) chgat (int, attr_t, short, const void *);	/* generated */
+extern NCURSES_EXPORT(int) chgat (int, attr_t, NCURSES_PAIRS_T, const void *);	/* generated */
 extern NCURSES_EXPORT(int) clear (void);				/* generated */
 extern NCURSES_EXPORT(int) clearok (WINDOW *,bool);			/* implemented */
 extern NCURSES_EXPORT(int) clrtobot (void);				/* generated */
 extern NCURSES_EXPORT(int) clrtoeol (void);				/* generated */
-extern NCURSES_EXPORT(int) color_content (short,short*,short*,short*);	/* implemented */
-extern NCURSES_EXPORT(int) color_set (short,void*);			/* generated */
+extern NCURSES_EXPORT(int) color_content (NCURSES_COLOR_T,NCURSES_COLOR_T*,NCURSES_COLOR_T*,NCURSES_COLOR_T*);	/* implemented */
+extern NCURSES_EXPORT(int) color_set (NCURSES_PAIRS_T,void*);			/* generated */
 extern NCURSES_EXPORT(int) COLOR_PAIR (int);				/* generated */
 extern NCURSES_EXPORT(int) copywin (const WINDOW*,WINDOW*,int,int,int,int,int,int,int);	/* implemented */
 extern NCURSES_EXPORT(int) curs_set (int);				/* implemented */
@@ -582,8 +637,8 @@
 extern NCURSES_EXPORT(int) inchnstr (chtype *, int);			/* generated */
 extern NCURSES_EXPORT(int) inchstr (chtype *);				/* generated */
 extern NCURSES_EXPORT(WINDOW *) initscr (void);				/* implemented */
-extern NCURSES_EXPORT(int) init_color (short,short,short,short);	/* implemented */
-extern NCURSES_EXPORT(int) init_pair (short,short,short);		/* implemented */
+extern NCURSES_EXPORT(int) init_color (NCURSES_COLOR_T,NCURSES_COLOR_T,NCURSES_COLOR_T,NCURSES_COLOR_T);	/* implemented */
+extern NCURSES_EXPORT(int) init_pair (NCURSES_PAIRS_T,NCURSES_COLOR_T,NCURSES_COLOR_T);		/* implemented */
 extern NCURSES_EXPORT(int) innstr (char *, int);			/* generated */
 extern NCURSES_EXPORT(int) insch (chtype);				/* generated */
 extern NCURSES_EXPORT(int) insdelln (int);				/* generated */
@@ -607,7 +662,7 @@
 extern NCURSES_EXPORT(int) mvaddchstr (int, int, const chtype *);	/* generated */
 extern NCURSES_EXPORT(int) mvaddnstr (int, int, const char *, int);	/* generated */
 extern NCURSES_EXPORT(int) mvaddstr (int, int, const char *);		/* generated */
-extern NCURSES_EXPORT(int) mvchgat (int, int, int, attr_t, short, const void *);	/* generated */
+extern NCURSES_EXPORT(int) mvchgat (int, int, int, attr_t, NCURSES_PAIRS_T, const void *);	/* generated */
 extern NCURSES_EXPORT(int) mvcur (int,int,int,int);			/* implemented */
 extern NCURSES_EXPORT(int) mvdelch (int, int);				/* generated */
 extern NCURSES_EXPORT(int) mvderwin (WINDOW *, int, int);		/* implemented */
@@ -633,7 +688,7 @@
 extern NCURSES_EXPORT(int) mvwaddchstr (WINDOW *, int, int, const chtype *);	/* generated */
 extern NCURSES_EXPORT(int) mvwaddnstr (WINDOW *, int, int, const char *, int);	/* generated */
 extern NCURSES_EXPORT(int) mvwaddstr (WINDOW *, int, int, const char *);	/* generated */
-extern NCURSES_EXPORT(int) mvwchgat (WINDOW *, int, int, int, attr_t, short, const void *);/* generated */
+extern NCURSES_EXPORT(int) mvwchgat (WINDOW *, int, int, int, attr_t, NCURSES_PAIRS_T, const void *);/* generated */
 extern NCURSES_EXPORT(int) mvwdelch (WINDOW *, int, int);		/* generated */
 extern NCURSES_EXPORT(int) mvwgetch (WINDOW *, int, int);		/* generated */
 extern NCURSES_EXPORT(int) mvwgetnstr (WINDOW *, int, int, char *, int);	/* generated */
@@ -646,7 +701,7 @@
 extern NCURSES_EXPORT(int) mvwinnstr (WINDOW *, int, int, char *, int);		/* generated */
 extern NCURSES_EXPORT(int) mvwinsch (WINDOW *, int, int, chtype);		/* generated */
 extern NCURSES_EXPORT(int) mvwinsnstr (WINDOW *, int, int, const char *, int);	/* generated */
-extern NCURSES_EXPORT(int) mvwinsstr (WINDOW *, int, int, const char *);		/* generated */
+extern NCURSES_EXPORT(int) mvwinsstr (WINDOW *, int, int, const char *);	/* generated */
 extern NCURSES_EXPORT(int) mvwinstr (WINDOW *, int, int, char *);		/* generated */
 extern NCURSES_EXPORT(int) mvwprintw (WINDOW*,int,int, const char *,...)	/* implemented */
 		GCC_PRINTFLIKE(4,5);
@@ -654,9 +709,9 @@
 		GCC_SCANFLIKE(4,5);
 extern NCURSES_EXPORT(int) mvwvline (WINDOW *,int, int, chtype, int);	/* generated */
 extern NCURSES_EXPORT(int) napms (int);					/* implemented */
-extern NCURSES_EXPORT(WINDOW *) newpad (int,int);				/* implemented */
+extern NCURSES_EXPORT(WINDOW *) newpad (int,int);		       	/* implemented */
 extern NCURSES_EXPORT(SCREEN *) newterm (NCURSES_CONST char *,FILE *,FILE *);	/* implemented */
-extern NCURSES_EXPORT(WINDOW *) newwin (int,int,int,int);			/* implemented */
+extern NCURSES_EXPORT(WINDOW *) newwin (int,int,int,int);	       	/* implemented */
 extern NCURSES_EXPORT(int) nl (void);					/* implemented */
 extern NCURSES_EXPORT(int) nocbreak (void);				/* implemented */
 extern NCURSES_EXPORT(int) nodelay (WINDOW *,bool);			/* implemented */
@@ -667,7 +722,7 @@
 extern NCURSES_EXPORT(int) notimeout (WINDOW *,bool);			/* implemented */
 extern NCURSES_EXPORT(int) overlay (const WINDOW*,WINDOW *);		/* implemented */
 extern NCURSES_EXPORT(int) overwrite (const WINDOW*,WINDOW *);		/* implemented */
-extern NCURSES_EXPORT(int) pair_content (short,short*,short*);		/* implemented */
+extern NCURSES_EXPORT(int) pair_content (NCURSES_PAIRS_T,NCURSES_COLOR_T*,NCURSES_COLOR_T*);		/* implemented */
 extern NCURSES_EXPORT(int) PAIR_NUMBER (int);				/* generated */
 extern NCURSES_EXPORT(int) pechochar (WINDOW *, const chtype);		/* implemented */
 extern NCURSES_EXPORT(int) pnoutrefresh (WINDOW*,int,int,int,int,int,int);/* implemented */
@@ -701,16 +756,16 @@
 extern NCURSES_EXPORT(int) slk_attr_on (attr_t,void*);			/* generated:WIDEC */
 extern NCURSES_EXPORT(int) slk_attrset (const chtype);			/* implemented */
 extern NCURSES_EXPORT(attr_t) slk_attr (void);				/* implemented */
-extern NCURSES_EXPORT(int) slk_attr_set (const attr_t,short,void*);	/* implemented */
+extern NCURSES_EXPORT(int) slk_attr_set (const attr_t,NCURSES_PAIRS_T,void*);	/* implemented */
 extern NCURSES_EXPORT(int) slk_clear (void);				/* implemented */
-extern NCURSES_EXPORT(int) slk_color (short);				/* implemented */
+extern NCURSES_EXPORT(int) slk_color (NCURSES_PAIRS_T);				/* implemented */
 extern NCURSES_EXPORT(int) slk_init (int);				/* implemented */
 extern NCURSES_EXPORT(char *) slk_label (int);				/* implemented */
 extern NCURSES_EXPORT(int) slk_noutrefresh (void);			/* implemented */
 extern NCURSES_EXPORT(int) slk_refresh (void);				/* implemented */
 extern NCURSES_EXPORT(int) slk_restore (void);				/* implemented */
 extern NCURSES_EXPORT(int) slk_set (int,const char *,int);		/* implemented */
-extern NCURSES_EXPORT(int) slk_touch (void);				/* implemented */
+extern NCURSES_EXPORT(int) slk_touch (void);	      	       		/* implemented */
 extern NCURSES_EXPORT(int) standout (void);				/* generated */
 extern NCURSES_EXPORT(int) standend (void);				/* generated */
 extern NCURSES_EXPORT(int) start_color (void);				/* implemented */
@@ -726,8 +781,9 @@
 extern NCURSES_EXPORT(int) ungetch (int);				/* implemented */
 extern NCURSES_EXPORT(int) untouchwin (WINDOW *);			/* generated */
 extern NCURSES_EXPORT(void) use_env (bool);				/* implemented */
+extern NCURSES_EXPORT(void) use_tioctl (bool);				/* implemented */
 extern NCURSES_EXPORT(int) vidattr (chtype);				/* implemented */
-extern NCURSES_EXPORT(int) vidputs (chtype, int (*)(int));		/* implemented */
+extern NCURSES_EXPORT(int) vidputs (chtype, NCURSES_OUTC);		/* implemented */
 extern NCURSES_EXPORT(int) vline (chtype, int);				/* generated */
 extern NCURSES_EXPORT(int) vwprintw (WINDOW *, const char *,va_list);	/* implemented */
 extern NCURSES_EXPORT(int) vw_printw (WINDOW *, const char *,va_list);	/* generated */
@@ -741,18 +797,18 @@
 extern NCURSES_EXPORT(int) wattron (WINDOW *, int);			/* generated */
 extern NCURSES_EXPORT(int) wattroff (WINDOW *, int);			/* generated */
 extern NCURSES_EXPORT(int) wattrset (WINDOW *, int);			/* generated */
-extern NCURSES_EXPORT(int) wattr_get (WINDOW *, attr_t *, short *, void *);	/* generated */
+extern NCURSES_EXPORT(int) wattr_get (WINDOW *, attr_t *, NCURSES_PAIRS_T *, void *);	/* generated */
 extern NCURSES_EXPORT(int) wattr_on (WINDOW *, attr_t, void *);		/* implemented */
 extern NCURSES_EXPORT(int) wattr_off (WINDOW *, attr_t, void *);	/* implemented */
-extern NCURSES_EXPORT(int) wattr_set (WINDOW *, attr_t, short, void *);	/* generated */
+extern NCURSES_EXPORT(int) wattr_set (WINDOW *, attr_t, NCURSES_PAIRS_T, void *);	/* generated */
 extern NCURSES_EXPORT(int) wbkgd (WINDOW *, chtype);			/* implemented */
 extern NCURSES_EXPORT(void) wbkgdset (WINDOW *,chtype);			/* implemented */
 extern NCURSES_EXPORT(int) wborder (WINDOW *,chtype,chtype,chtype,chtype,chtype,chtype,chtype,chtype);	/* implemented */
-extern NCURSES_EXPORT(int) wchgat (WINDOW *, int, attr_t, short, const void *);/* implemented */
+extern NCURSES_EXPORT(int) wchgat (WINDOW *, int, attr_t, NCURSES_PAIRS_T, const void *);/* implemented */
 extern NCURSES_EXPORT(int) wclear (WINDOW *);				/* implemented */
 extern NCURSES_EXPORT(int) wclrtobot (WINDOW *);			/* implemented */
 extern NCURSES_EXPORT(int) wclrtoeol (WINDOW *);			/* implemented */
-extern NCURSES_EXPORT(int) wcolor_set (WINDOW*,short,void*);		/* implemented */
+extern NCURSES_EXPORT(int) wcolor_set (WINDOW*,NCURSES_PAIRS_T,void*);		/* implemented */
 extern NCURSES_EXPORT(void) wcursyncup (WINDOW *);			/* implemented */
 extern NCURSES_EXPORT(int) wdelch (WINDOW *);				/* implemented */
 extern NCURSES_EXPORT(int) wdeleteln (WINDOW *);			/* generated */
@@ -801,10 +857,12 @@
 #if NCURSES_TPARM_VARARGS
 extern NCURSES_EXPORT(char *) tparm (NCURSES_CONST char *, ...);	/* special */
 #else
-extern NCURSES_EXPORT(char *) tparm (NCURSES_CONST char *, long,long,long,long,long,long,long,long,long);	/* special */
+extern NCURSES_EXPORT(char *) tparm (NCURSES_CONST char *, NCURSES_TPARM_ARG,NCURSES_TPARM_ARG,NCURSES_TPARM_ARG,NCURSES_TPARM_ARG,NCURSES_TPARM_ARG,NCURSES_TPARM_ARG,NCURSES_TPARM_ARG,NCURSES_TPARM_ARG,NCURSES_TPARM_ARG);	/* special */
 extern NCURSES_EXPORT(char *) tparm_varargs (NCURSES_CONST char *, ...);	/* special */
 #endif
 
+extern NCURSES_EXPORT(char *) tiparm (const char *, ...);		/* special */
+
 /*
  * These functions are not in X/Open, but we use them in macro definitions:
  */
@@ -821,7 +879,7 @@
 /*
  * vid_attr() was implemented originally based on a draft of X/Open curses.
  */
-#ifndef _XOPEN_SOURCE_EXTENDED
+#if !NCURSES_WIDECHAR
 #define vid_attr(a,pair,opts) vidattr(a)
 #endif
 
@@ -838,6 +896,7 @@
 extern NCURSES_EXPORT(const char *) curses_version (void);
 extern NCURSES_EXPORT(int) assume_default_colors (int, int);
 extern NCURSES_EXPORT(int) define_key (const char *, int);
+extern NCURSES_EXPORT(int) get_escdelay (void);
 extern NCURSES_EXPORT(int) key_defined (const char *);
 extern NCURSES_EXPORT(int) keyok (int, bool);
 extern NCURSES_EXPORT(int) resize_term (int, int);
@@ -856,27 +915,141 @@
  * These extensions provide access to information stored in the WINDOW even
  * when NCURSES_OPAQUE is set:
  */
-extern NCURSES_EXPORT(WINDOW *) wgetparent (const WINDOW *);	/* generated */
-extern NCURSES_EXPORT(bool) is_cleared (const WINDOW *);	/* generated */
-extern NCURSES_EXPORT(bool) is_idcok (const WINDOW *);		/* generated */
-extern NCURSES_EXPORT(bool) is_idlok (const WINDOW *);		/* generated */
-extern NCURSES_EXPORT(bool) is_immedok (const WINDOW *);	/* generated */
-extern NCURSES_EXPORT(bool) is_keypad (const WINDOW *);		/* generated */
-extern NCURSES_EXPORT(bool) is_leaveok (const WINDOW *);	/* generated */
-extern NCURSES_EXPORT(bool) is_nodelay (const WINDOW *);	/* generated */
-extern NCURSES_EXPORT(bool) is_notimeout (const WINDOW *);	/* generated */
-extern NCURSES_EXPORT(bool) is_scrollok (const WINDOW *);	/* generated */
-extern NCURSES_EXPORT(bool) is_syncok (const WINDOW *);		/* generated */
-extern NCURSES_EXPORT(int) wgetscrreg (const WINDOW *, int *, int *); /* generated */
+extern NCURSES_EXPORT(WINDOW *) wgetparent (const WINDOW *);	/* @GENERATED_EXT_FUNCS@ */
+extern NCURSES_EXPORT(bool) is_cleared (const WINDOW *);	/* @GENERATED_EXT_FUNCS@ */
+extern NCURSES_EXPORT(bool) is_idcok (const WINDOW *);		/* @GENERATED_EXT_FUNCS@ */
+extern NCURSES_EXPORT(bool) is_idlok (const WINDOW *);		/* @GENERATED_EXT_FUNCS@ */
+extern NCURSES_EXPORT(bool) is_immedok (const WINDOW *);	/* @GENERATED_EXT_FUNCS@ */
+extern NCURSES_EXPORT(bool) is_keypad (const WINDOW *);		/* @GENERATED_EXT_FUNCS@ */
+extern NCURSES_EXPORT(bool) is_leaveok (const WINDOW *);	/* @GENERATED_EXT_FUNCS@ */
+extern NCURSES_EXPORT(bool) is_nodelay (const WINDOW *);	/* @GENERATED_EXT_FUNCS@ */
+extern NCURSES_EXPORT(bool) is_notimeout (const WINDOW *);	/* @GENERATED_EXT_FUNCS@ */
+extern NCURSES_EXPORT(bool) is_pad (const WINDOW *);		/* @GENERATED_EXT_FUNCS@ */
+extern NCURSES_EXPORT(bool) is_scrollok (const WINDOW *);	/* @GENERATED_EXT_FUNCS@ */
+extern NCURSES_EXPORT(bool) is_subwin (const WINDOW *);		/* @GENERATED_EXT_FUNCS@ */
+extern NCURSES_EXPORT(bool) is_syncok (const WINDOW *);		/* @GENERATED_EXT_FUNCS@ */
+extern NCURSES_EXPORT(int) wgetdelay (const WINDOW *);		/* @GENERATED_EXT_FUNCS@ */
+extern NCURSES_EXPORT(int) wgetscrreg (const WINDOW *, int *, int *); /* @GENERATED_EXT_FUNCS@ */
 
 #else
 #define curses_version() NCURSES_VERSION
 #endif
 
+/*
+ * Extra extension-functions, which pass a SCREEN pointer rather than using
+ * a global variable SP.
+ */
+#if @NCURSES_SP_FUNCS@
+#undef  NCURSES_SP_FUNCS
+#define NCURSES_SP_FUNCS @NCURSES_PATCH@
+#define NCURSES_SP_NAME(name) name##_sp
+
+/* Define the sp-funcs helper function */
+#define NCURSES_SP_OUTC NCURSES_SP_NAME(NCURSES_OUTC)
+typedef int (*NCURSES_SP_OUTC)(SCREEN*, int);
+
+extern NCURSES_EXPORT(SCREEN *) new_prescr (void); /* implemented:SP_FUNC */
+
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(baudrate) (SCREEN*); /* implemented:SP_FUNC */
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(beep) (SCREEN*); /* implemented:SP_FUNC */
+extern NCURSES_EXPORT(bool) NCURSES_SP_NAME(can_change_color) (SCREEN*); /* implemented:SP_FUNC */
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(cbreak) (SCREEN*); /* implemented:SP_FUNC */
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(curs_set) (SCREEN*, int); /* implemented:SP_FUNC */
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(color_content) (SCREEN*, NCURSES_PAIRS_T, NCURSES_COLOR_T*, NCURSES_COLOR_T*, NCURSES_COLOR_T*); /* implemented:SP_FUNC */
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(def_prog_mode) (SCREEN*); /* implemented:SP_FUNC */
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(def_shell_mode) (SCREEN*); /* implemented:SP_FUNC */
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(delay_output) (SCREEN*, int); /* implemented:SP_FUNC */
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(doupdate) (SCREEN*); /* implemented:SP_FUNC */
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(echo) (SCREEN*); /* implemented:SP_FUNC */
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(endwin) (SCREEN*); /* implemented:SP_FUNC */
+extern NCURSES_EXPORT(char) NCURSES_SP_NAME(erasechar) (SCREEN*);/* implemented:SP_FUNC */
+extern NCURSES_EXPORT(void) NCURSES_SP_NAME(filter) (SCREEN*); /* implemented:SP_FUNC */
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(flash) (SCREEN*); /* implemented:SP_FUNC */
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(flushinp) (SCREEN*); /* implemented:SP_FUNC */
+extern NCURSES_EXPORT(WINDOW *) NCURSES_SP_NAME(getwin) (SCREEN*, FILE *);			/* implemented:SP_FUNC */
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(halfdelay) (SCREEN*, int); /* implemented:SP_FUNC */
+extern NCURSES_EXPORT(bool) NCURSES_SP_NAME(has_colors) (SCREEN*); /* implemented:SP_FUNC */
+extern NCURSES_EXPORT(bool) NCURSES_SP_NAME(has_ic) (SCREEN*); /* implemented:SP_FUNC */
+extern NCURSES_EXPORT(bool) NCURSES_SP_NAME(has_il) (SCREEN*); /* implemented:SP_FUNC */
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(init_color) (SCREEN*, NCURSES_COLOR_T, NCURSES_COLOR_T, NCURSES_COLOR_T, NCURSES_COLOR_T); /* implemented:SP_FUNC */
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(init_pair) (SCREEN*, NCURSES_PAIRS_T, NCURSES_COLOR_T, NCURSES_COLOR_T); /* implemented:SP_FUNC */
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(intrflush) (SCREEN*, WINDOW*, bool);	/* implemented:SP_FUNC */
+extern NCURSES_EXPORT(bool) NCURSES_SP_NAME(isendwin) (SCREEN*); /* implemented:SP_FUNC */
+extern NCURSES_EXPORT(NCURSES_CONST char *) NCURSES_SP_NAME(keyname) (SCREEN*, int); /* implemented:SP_FUNC */
+extern NCURSES_EXPORT(char) NCURSES_SP_NAME(killchar) (SCREEN*); /* implemented:SP_FUNC */
+extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(longname) (SCREEN*); /* implemented:SP_FUNC */
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(mvcur) (SCREEN*, int, int, int, int); /* implemented:SP_FUNC */
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(napms) (SCREEN*, int); /* implemented:SP_FUNC */
+extern NCURSES_EXPORT(WINDOW *) NCURSES_SP_NAME(newpad) (SCREEN*, int, int); /* implemented:SP_FUNC */
+extern NCURSES_EXPORT(SCREEN *) NCURSES_SP_NAME(newterm) (SCREEN*, NCURSES_CONST char *, FILE *, FILE *); /* implemented:SP_FUNC */
+extern NCURSES_EXPORT(WINDOW *) NCURSES_SP_NAME(newwin) (SCREEN*, int, int, int, int); /* implemented:SP_FUNC */
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(nl) (SCREEN*); /* implemented:SP_FUNC */
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(nocbreak) (SCREEN*); /* implemented:SP_FUNC */
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(noecho) (SCREEN*); /* implemented:SP_FUNC */
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(nonl) (SCREEN*); /* implemented:SP_FUNC */
+extern NCURSES_EXPORT(void) NCURSES_SP_NAME(noqiflush) (SCREEN*); /* implemented:SP_FUNC */
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(noraw) (SCREEN*); /* implemented:SP_FUNC */
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(pair_content) (SCREEN*, NCURSES_PAIRS_T, NCURSES_COLOR_T*, NCURSES_COLOR_T*); /* implemented:SP_FUNC */
+extern NCURSES_EXPORT(void) NCURSES_SP_NAME(qiflush) (SCREEN*); /* implemented:SP_FUNC */
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(raw) (SCREEN*); /* implemented:SP_FUNC */
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(reset_prog_mode) (SCREEN*); /* implemented:SP_FUNC */
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(reset_shell_mode) (SCREEN*); /* implemented:SP_FUNC */
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(resetty) (SCREEN*); /* implemented:SP_FUNC */
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(ripoffline) (SCREEN*, int, int (*)(WINDOW *, int));	/* implemented:SP_FUNC */
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(savetty) (SCREEN*); /* implemented:SP_FUNC */
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(scr_init) (SCREEN*, const char *); /* implemented:SP_FUNC */
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(scr_restore) (SCREEN*, const char *); /* implemented:SP_FUNC */
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(scr_set) (SCREEN*, const char *); /* implemented:SP_FUNC */
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_attroff) (SCREEN*, const chtype); /* implemented:SP_FUNC */
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_attron) (SCREEN*, const chtype); /* implemented:SP_FUNC */
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_attrset) (SCREEN*, const chtype); /* implemented:SP_FUNC */
+extern NCURSES_EXPORT(attr_t) NCURSES_SP_NAME(slk_attr) (SCREEN*); /* implemented:SP_FUNC */
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_attr_set) (SCREEN*, const attr_t, NCURSES_PAIRS_T, void*); /* implemented:SP_FUNC */
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_clear) (SCREEN*); /* implemented:SP_FUNC */
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_color) (SCREEN*, NCURSES_PAIRS_T); /* implemented:SP_FUNC */
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_init) (SCREEN*, int); /* implemented:SP_FUNC */
+extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(slk_label) (SCREEN*, int); /* implemented:SP_FUNC */
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_noutrefresh) (SCREEN*); /* implemented:SP_FUNC */
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_refresh) (SCREEN*); /* implemented:SP_FUNC */
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_restore) (SCREEN*); /* implemented:SP_FUNC */
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_set) (SCREEN*, int, const char *, int); /* implemented:SP_FUNC */
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_touch) (SCREEN*); /* implemented:SP_FUNC */
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(start_color) (SCREEN*); /* implemented:SP_FUNC */
+extern NCURSES_EXPORT(chtype) NCURSES_SP_NAME(termattrs) (SCREEN*); /* implemented:SP_FUNC */
+extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(termname) (SCREEN*); /* implemented:SP_FUNC */
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(typeahead) (SCREEN*, int); /* implemented:SP_FUNC */
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(ungetch) (SCREEN*, int); /* implemented:SP_FUNC */
+extern NCURSES_EXPORT(void) NCURSES_SP_NAME(use_env) (SCREEN*, bool); /* implemented:SP_FUNC */
+extern NCURSES_EXPORT(void) NCURSES_SP_NAME(use_tioctl) (SCREEN*, bool); /* implemented:SP_FUNC */
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(vidattr) (SCREEN*, chtype);	/* implemented:SP_FUNC */
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(vidputs) (SCREEN*, chtype, NCURSES_SP_OUTC); /* implemented:SP_FUNC */
+#if @NCURSES_EXT_FUNCS@
+extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(keybound) (SCREEN*, int, int);	/* implemented:EXT_SP_FUNC */
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(assume_default_colors) (SCREEN*, int, int);	/* implemented:EXT_SP_FUNC */
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(define_key) (SCREEN*, const char *, int);	/* implemented:EXT_SP_FUNC */
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(get_escdelay) (SCREEN*);	/* implemented:EXT_SP_FUNC */
+extern NCURSES_EXPORT(bool) NCURSES_SP_NAME(is_term_resized) (SCREEN*, int, int);	/* implemented:EXT_SP_FUNC */
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(key_defined) (SCREEN*, const char *);	/* implemented:EXT_SP_FUNC */
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(keyok) (SCREEN*, int, bool);	/* implemented:EXT_SP_FUNC */
+extern NCURSES_EXPORT(void) NCURSES_SP_NAME(nofilter) (SCREEN*); /* implemented */	/* implemented:EXT_SP_FUNC */
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(resize_term) (SCREEN*, int, int);	/* implemented:EXT_SP_FUNC */
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(resizeterm) (SCREEN*, int, int);	/* implemented:EXT_SP_FUNC */
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(set_escdelay) (SCREEN*, int);	/* implemented:EXT_SP_FUNC */
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(set_tabsize) (SCREEN*, int);	/* implemented:EXT_SP_FUNC */
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(use_default_colors) (SCREEN*);	/* implemented:EXT_SP_FUNC */
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(use_legacy_coding) (SCREEN*, int);	/* implemented:EXT_SP_FUNC */
+#endif
+#else
+#undef  NCURSES_SP_FUNCS
+#define NCURSES_SP_FUNCS 0
+#define NCURSES_SP_NAME(name) name
+#define NCURSES_SP_OUTC NCURSES_OUTC
+#endif
+
 /* attributes */
 
 #define NCURSES_ATTR_SHIFT       8
-#define NCURSES_BITS(mask,shift) ((mask) << ((shift) + NCURSES_ATTR_SHIFT))
+#define NCURSES_BITS(mask,shift) (NCURSES_CAST(chtype,(mask)) << ((shift) + NCURSES_ATTR_SHIFT))
 
 #define A_NORMAL	(@cf_cv_1UL@ - @cf_cv_1UL@)
 #define A_ATTRIBUTES	NCURSES_BITS(~(@cf_cv_1UL@ - @cf_cv_1UL@),0)
@@ -898,6 +1071,10 @@
 #define A_TOP		NCURSES_BITS(@cf_cv_1UL@,21)
 #define A_VERTICAL	NCURSES_BITS(@cf_cv_1UL@,22)
 
+#if @NCURSES_EXT_FUNCS@
+#define A_ITALIC	NCURSES_BITS(@cf_cv_1UL@,23)	/* ncurses extension */
+#endif
+
 /*
  * Most of the pseudo functions are macros that either provide compatibility
  * with older versions of curses, or provide inline functionality to improve
@@ -938,7 +1115,7 @@
  */
 
 #define wgetstr(w, s)		wgetnstr(w, s, -1)
-#define getnstr(s, n)		wgetnstr(stdscr, s, n)
+#define getnstr(s, n)		wgetnstr(stdscr, s, (n))
 
 #define setterm(term)		setupterm(term, 1, (int *)0)
 
@@ -951,7 +1128,7 @@
 
 /* It seems older SYSV curses versions define these */
 #if !NCURSES_OPAQUE
-#define getattrs(win)		((win) ? (win)->_attrs : A_NORMAL)
+#define getattrs(win)		NCURSES_CAST(int, (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)
@@ -969,11 +1146,17 @@
 #define wattroff(win,at)	wattr_off(win, NCURSES_CAST(attr_t, at), NULL)
 
 #if !NCURSES_OPAQUE
-#if defined(_XOPEN_SOURCE_EXTENDED) && @NCURSES_EXT_COLORS@
-#define wattrset(win,at)	((win)->_color = PAIR_NUMBER(at), \
-				 (win)->_attrs = (at))
+#if NCURSES_WIDECHAR && @NCURSES_EXT_COLORS@
+#define wattrset(win,at)	((win) \
+				  ? ((win)->_color = NCURSES_CAST(int, PAIR_NUMBER(at)), \
+                                     (win)->_attrs = NCURSES_CAST(attr_t, at), \
+                                     OK) \
+				  : ERR)
 #else
-#define wattrset(win,at)	((win)->_attrs = (at))
+#define wattrset(win,at)        ((win) \
+				  ? ((win)->_attrs = NCURSES_CAST(attr_t, at), \
+				     OK) \
+				  : ERR)
 #endif
 #endif /* NCURSES_OPAQUE */
 
@@ -985,15 +1168,15 @@
 
 #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)
-#define hline(ch, n)		whline(stdscr, ch, n)
-#define vline(ch, n)		wvline(stdscr, ch, n)
+#define hline(ch, n)		whline(stdscr, ch, (n))
+#define vline(ch, n)		wvline(stdscr, ch, (n))
 
 #define winstr(w, s)		winnstr(w, s, -1)
 #define winchstr(w, s)		winchnstr(w, s, -1)
 #define winsstr(w, s)		winsnstr(w, s, -1)
 
 #if !NCURSES_OPAQUE
-#define redrawwin(win)		wredrawln(win, 0, (win)->_maxy+1)
+#define redrawwin(win)		wredrawln(win, 0, ((win) ? (win)->_maxy+1 : -1))
 #endif /* NCURSES_OPAQUE */
 
 #define waddstr(win,str)	waddnstr(win,str,-1)
@@ -1002,55 +1185,55 @@
 /*
  * These apply to the first 256 color pairs.
  */
-#define COLOR_PAIR(n)	NCURSES_BITS(n, 0)
-#define PAIR_NUMBER(a)	(NCURSES_CAST(int,(((a) & A_COLOR) >> NCURSES_ATTR_SHIFT)))
+#define COLOR_PAIR(n)	NCURSES_BITS((n), 0)
+#define PAIR_NUMBER(a)	(NCURSES_CAST(int,((NCURSES_CAST(unsigned long,(a)) & A_COLOR) >> NCURSES_ATTR_SHIFT)))
 
 /*
  * pseudo functions for standard screen
  */
 
-#define addch(ch)		waddch(stdscr,ch)
-#define addchnstr(str,n)	waddchnstr(stdscr,str,n)
-#define addchstr(str)		waddchstr(stdscr,str)
-#define addnstr(str,n)		waddnstr(stdscr,str,n)
-#define addstr(str)		waddnstr(stdscr,str,-1)
-#define attroff(at)		wattroff(stdscr,at)
-#define attron(at)		wattron(stdscr,at)
-#define attrset(at)		wattrset(stdscr,at)
-#define attr_get(ap,cp,o)	wattr_get(stdscr,ap,cp,o)
-#define attr_off(a,o)		wattr_off(stdscr,a,o)
-#define attr_on(a,o)		wattr_on(stdscr,a,o)
-#define attr_set(a,c,o)		wattr_set(stdscr,a,c,o)
-#define bkgd(ch)		wbkgd(stdscr,ch)
-#define bkgdset(ch)		wbkgdset(stdscr,ch)
-#define chgat(n,a,c,o)		wchgat(stdscr,n,a,c,o)
+#define addch(ch)		waddch(stdscr,(ch))
+#define addchnstr(str,n)	waddchnstr(stdscr,(str),(n))
+#define addchstr(str)		waddchstr(stdscr,(str))
+#define addnstr(str,n)		waddnstr(stdscr,(str),(n))
+#define addstr(str)		waddnstr(stdscr,(str),-1)
+#define attroff(at)		wattroff(stdscr,(at))
+#define attron(at)		wattron(stdscr,(at))
+#define attrset(at)		wattrset(stdscr,(at))
+#define attr_get(ap,cp,o)	wattr_get(stdscr,(ap),(cp),(o))
+#define attr_off(a,o)		wattr_off(stdscr,(a),(o))
+#define attr_on(a,o)		wattr_on(stdscr,(a),(o))
+#define attr_set(a,c,o)		wattr_set(stdscr,(a),(c),(o))
+#define bkgd(ch)		wbkgd(stdscr,(ch))
+#define bkgdset(ch)		wbkgdset(stdscr,(ch))
+#define chgat(n,a,c,o)		wchgat(stdscr,(n),(a),(c),(o))
 #define clear()			wclear(stdscr)
 #define clrtobot()		wclrtobot(stdscr)
 #define clrtoeol()		wclrtoeol(stdscr)
-#define color_set(c,o)		wcolor_set(stdscr,c,o)
+#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)
+#define echochar(c)		wechochar(stdscr,(c))
 #define erase()			werase(stdscr)
 #define getch()			wgetch(stdscr)
-#define getstr(str)		wgetstr(stdscr,str)
+#define getstr(str)		wgetstr(stdscr,(str))
 #define inch()			winch(stdscr)
-#define inchnstr(s,n)		winchnstr(stdscr,s,n)
-#define inchstr(s)		winchstr(stdscr,s)
-#define innstr(s,n)		winnstr(stdscr,s,n)
-#define insch(c)		winsch(stdscr,c)
-#define insdelln(n)		winsdelln(stdscr,n)
+#define inchnstr(s,n)		winchnstr(stdscr,(s),(n))
+#define inchstr(s)		winchstr(stdscr,(s))
+#define innstr(s,n)		winnstr(stdscr,(s),(n))
+#define insch(c)		winsch(stdscr,(c))
+#define insdelln(n)		winsdelln(stdscr,(n))
 #define insertln()		winsdelln(stdscr,1)
-#define insnstr(s,n)		winsnstr(stdscr,s,n)
-#define insstr(s)		winsstr(stdscr,s)
-#define instr(s)		winstr(stdscr,s)
-#define move(y,x)		wmove(stdscr,y,x)
+#define insnstr(s,n)		winsnstr(stdscr,(s),(n))
+#define insstr(s)		winsstr(stdscr,(s))
+#define instr(s)		winstr(stdscr,(s))
+#define move(y,x)		wmove(stdscr,(y),(x))
 #define refresh()		wrefresh(stdscr)
-#define scrl(n)			wscrl(stdscr,n)
-#define setscrreg(t,b)		wsetscrreg(stdscr,t,b)
+#define scrl(n)			wscrl(stdscr,(n))
+#define setscrreg(t,b)		wsetscrreg(stdscr,(t),(b))
 #define standend()		wstandend(stdscr)
 #define standout()		wstandout(stdscr)
-#define timeout(delay)		wtimeout(stdscr,delay)
+#define timeout(delay)		wtimeout(stdscr,(delay))
 #define wdeleteln(win)		winsdelln(win,-1)
 #define winsertln(win)		winsdelln(win,1)
 
@@ -1058,70 +1241,75 @@
  * mv functions
  */
 
-#define mvwaddch(win,y,x,ch)		(wmove(win,y,x) == ERR ? ERR : waddch(win,ch))
-#define mvwaddchnstr(win,y,x,str,n)	(wmove(win,y,x) == ERR ? ERR : waddchnstr(win,str,n))
-#define mvwaddchstr(win,y,x,str)	(wmove(win,y,x) == ERR ? ERR : waddchnstr(win,str,-1))
-#define mvwaddnstr(win,y,x,str,n)	(wmove(win,y,x) == ERR ? ERR : waddnstr(win,str,n))
-#define mvwaddstr(win,y,x,str)		(wmove(win,y,x) == ERR ? ERR : waddnstr(win,str,-1))
-#define mvwdelch(win,y,x)		(wmove(win,y,x) == ERR ? ERR : wdelch(win))
-#define mvwchgat(win,y,x,n,a,c,o)	(wmove(win,y,x) == ERR ? ERR : wchgat(win,n,a,c,o))
-#define mvwgetch(win,y,x)		(wmove(win,y,x) == ERR ? ERR : wgetch(win))
-#define mvwgetnstr(win,y,x,str,n)	(wmove(win,y,x) == ERR ? ERR : wgetnstr(win,str,n))
-#define mvwgetstr(win,y,x,str)		(wmove(win,y,x) == ERR ? ERR : wgetstr(win,str))
-#define mvwhline(win,y,x,c,n)		(wmove(win,y,x) == ERR ? ERR : whline(win,c,n))
-#define mvwinch(win,y,x)		(wmove(win,y,x) == ERR ? NCURSES_CAST(chtype, ERR) : winch(win))
-#define mvwinchnstr(win,y,x,s,n)	(wmove(win,y,x) == ERR ? ERR : winchnstr(win,s,n))
-#define mvwinchstr(win,y,x,s)		(wmove(win,y,x) == ERR ? ERR : winchstr(win,s))
-#define mvwinnstr(win,y,x,s,n)		(wmove(win,y,x) == ERR ? ERR : winnstr(win,s,n))
-#define mvwinsch(win,y,x,c)		(wmove(win,y,x) == ERR ? ERR : winsch(win,c))
-#define mvwinsnstr(win,y,x,s,n)		(wmove(win,y,x) == ERR ? ERR : winsnstr(win,s,n))
-#define mvwinsstr(win,y,x,s)		(wmove(win,y,x) == ERR ? ERR : winsstr(win,s))
-#define mvwinstr(win,y,x,s)		(wmove(win,y,x) == ERR ? ERR : winstr(win,s))
-#define mvwvline(win,y,x,c,n)		(wmove(win,y,x) == ERR ? ERR : wvline(win,c,n))
+#define mvwaddch(win,y,x,ch)		(wmove((win),(y),(x)) == ERR ? ERR : waddch((win),(ch)))
+#define mvwaddchnstr(win,y,x,str,n)	(wmove((win),(y),(x)) == ERR ? ERR : waddchnstr((win),(str),(n)))
+#define mvwaddchstr(win,y,x,str)	(wmove((win),(y),(x)) == ERR ? ERR : waddchnstr((win),(str),-1))
+#define mvwaddnstr(win,y,x,str,n)	(wmove((win),(y),(x)) == ERR ? ERR : waddnstr((win),(str),(n)))
+#define mvwaddstr(win,y,x,str)		(wmove((win),(y),(x)) == ERR ? ERR : waddnstr((win),(str),-1))
+#define mvwdelch(win,y,x)		(wmove((win),(y),(x)) == ERR ? ERR : wdelch(win))
+#define mvwchgat(win,y,x,n,a,c,o)	(wmove((win),(y),(x)) == ERR ? ERR : wchgat((win),(n),(a),(c),(o)))
+#define mvwgetch(win,y,x)		(wmove((win),(y),(x)) == ERR ? ERR : wgetch(win))
+#define mvwgetnstr(win,y,x,str,n)	(wmove((win),(y),(x)) == ERR ? ERR : wgetnstr((win),(str),(n)))
+#define mvwgetstr(win,y,x,str)		(wmove((win),(y),(x)) == ERR ? ERR : wgetstr((win),(str)))
+#define mvwhline(win,y,x,c,n)		(wmove((win),(y),(x)) == ERR ? ERR : whline((win),(c),(n)))
+#define mvwinch(win,y,x)		(wmove((win),(y),(x)) == ERR ? NCURSES_CAST(chtype, ERR) : winch(win))
+#define mvwinchnstr(win,y,x,s,n)	(wmove((win),(y),(x)) == ERR ? ERR : winchnstr((win),(s),(n)))
+#define mvwinchstr(win,y,x,s)		(wmove((win),(y),(x)) == ERR ? ERR : winchstr((win),(s)))
+#define mvwinnstr(win,y,x,s,n)		(wmove((win),(y),(x)) == ERR ? ERR : winnstr((win),(s),(n)))
+#define mvwinsch(win,y,x,c)		(wmove((win),(y),(x)) == ERR ? ERR : winsch((win),(c)))
+#define mvwinsnstr(win,y,x,s,n)		(wmove((win),(y),(x)) == ERR ? ERR : winsnstr((win),(s),(n)))
+#define mvwinsstr(win,y,x,s)		(wmove((win),(y),(x)) == ERR ? ERR : winsstr((win),(s)))
+#define mvwinstr(win,y,x,s)		(wmove((win),(y),(x)) == ERR ? ERR : winstr((win),(s)))
+#define mvwvline(win,y,x,c,n)		(wmove((win),(y),(x)) == ERR ? ERR : wvline((win),(c),(n)))
 
-#define mvaddch(y,x,ch)			mvwaddch(stdscr,y,x,ch)
-#define mvaddchnstr(y,x,str,n)		mvwaddchnstr(stdscr,y,x,str,n)
-#define mvaddchstr(y,x,str)		mvwaddchstr(stdscr,y,x,str)
-#define mvaddnstr(y,x,str,n)		mvwaddnstr(stdscr,y,x,str,n)
-#define mvaddstr(y,x,str)		mvwaddstr(stdscr,y,x,str)
-#define mvchgat(y,x,n,a,c,o)		mvwchgat(stdscr,y,x,n,a,c,o)
-#define mvdelch(y,x)			mvwdelch(stdscr,y,x)
-#define mvgetch(y,x)			mvwgetch(stdscr,y,x)
-#define mvgetnstr(y,x,str,n)		mvwgetnstr(stdscr,y,x,str,n)
-#define mvgetstr(y,x,str)		mvwgetstr(stdscr,y,x,str)
-#define mvhline(y,x,c,n)		mvwhline(stdscr,y,x,c,n)
-#define mvinch(y,x)			mvwinch(stdscr,y,x)
-#define mvinchnstr(y,x,s,n)		mvwinchnstr(stdscr,y,x,s,n)
-#define mvinchstr(y,x,s)		mvwinchstr(stdscr,y,x,s)
-#define mvinnstr(y,x,s,n)		mvwinnstr(stdscr,y,x,s,n)
-#define mvinsch(y,x,c)			mvwinsch(stdscr,y,x,c)
-#define mvinsnstr(y,x,s,n)		mvwinsnstr(stdscr,y,x,s,n)
-#define mvinsstr(y,x,s)			mvwinsstr(stdscr,y,x,s)
-#define mvinstr(y,x,s)			mvwinstr(stdscr,y,x,s)
-#define mvvline(y,x,c,n)		mvwvline(stdscr,y,x,c,n)
+#define mvaddch(y,x,ch)			mvwaddch(stdscr,(y),(x),(ch))
+#define mvaddchnstr(y,x,str,n)		mvwaddchnstr(stdscr,(y),(x),(str),(n))
+#define mvaddchstr(y,x,str)		mvwaddchstr(stdscr,(y),(x),(str))
+#define mvaddnstr(y,x,str,n)		mvwaddnstr(stdscr,(y),(x),(str),(n))
+#define mvaddstr(y,x,str)		mvwaddstr(stdscr,(y),(x),(str))
+#define mvchgat(y,x,n,a,c,o)		mvwchgat(stdscr,(y),(x),(n),(a),(c),(o))
+#define mvdelch(y,x)			mvwdelch(stdscr,(y),(x))
+#define mvgetch(y,x)			mvwgetch(stdscr,(y),(x))
+#define mvgetnstr(y,x,str,n)		mvwgetnstr(stdscr,(y),(x),(str),(n))
+#define mvgetstr(y,x,str)		mvwgetstr(stdscr,(y),(x),(str))
+#define mvhline(y,x,c,n)		mvwhline(stdscr,(y),(x),(c),(n))
+#define mvinch(y,x)			mvwinch(stdscr,(y),(x))
+#define mvinchnstr(y,x,s,n)		mvwinchnstr(stdscr,(y),(x),(s),(n))
+#define mvinchstr(y,x,s)		mvwinchstr(stdscr,(y),(x),(s))
+#define mvinnstr(y,x,s,n)		mvwinnstr(stdscr,(y),(x),(s),(n))
+#define mvinsch(y,x,c)			mvwinsch(stdscr,(y),(x),(c))
+#define mvinsnstr(y,x,s,n)		mvwinsnstr(stdscr,(y),(x),(s),(n))
+#define mvinsstr(y,x,s)			mvwinsstr(stdscr,(y),(x),(s))
+#define mvinstr(y,x,s)			mvwinstr(stdscr,(y),(x),(s))
+#define mvvline(y,x,c,n)		mvwvline(stdscr,(y),(x),(c),(n))
 
 /*
  * Some wide-character functions can be implemented without the extensions.
  */
 #if !NCURSES_OPAQUE
-#define getbkgd(win)                    ((win)->_bkgd)
+#define getbkgd(win)                    ((win) ? ((win)->_bkgd) : 0)
 #endif /* NCURSES_OPAQUE */
 
 #define slk_attr_off(a,v)		((v) ? ERR : slk_attroff(a))
 #define slk_attr_on(a,v)		((v) ? ERR : slk_attron(a))
 
 #if !NCURSES_OPAQUE
-#if defined(_XOPEN_SOURCE_EXTENDED) && @NCURSES_EXT_COLORS@
-#define wattr_set(win,a,p,opts)		((win)->_attrs = ((a) & ~A_COLOR), \
-					 (win)->_color = (p), \
+#if NCURSES_WIDECHAR && @NCURSES_EXT_COLORS@
+#define wattr_set(win,a,p,opts)		(((win) \
+					  ? ((win)->_attrs = ((a) & ~A_COLOR), \
+					     (win)->_color = (p)) \
+					  : OK), \
 					 OK)
-#define wattr_get(win,a,p,opts)		((void)((a) != (void *)0 && (*(a) = (win)->_attrs)), \
-					 (void)((p) != (void *)0 && (*(p) = (win)->_color)), \
+#define wattr_get(win,a,p,opts)		((void)(((a) != (void *)0) ? (*(a) = (win) ? (win)->_attrs : 0) : OK), \
+					 (void)(((p) != (void *)0) ? (*(p) = (NCURSES_PAIRS_T) ((win) ? (win)->_color : 0)) : OK), \
 					 OK)
 #else
-#define wattr_set(win,a,p,opts)		((win)->_attrs = (((a) & ~A_COLOR) | COLOR_PAIR(p)), OK)
-#define wattr_get(win,a,p,opts)		((void)((a) != (void *)0 && (*(a) = (win)->_attrs)), \
-					 (void)((p) != (void *)0 && (*(p) = PAIR_NUMBER((win)->_attrs))), \
+#define wattr_set(win,a,p,opts)		(((win) \
+					  ? ((win)->_attrs = (((a) & ~A_COLOR) | (attr_t)COLOR_PAIR(p))) \
+					  : OK), \
+					 OK)
+#define wattr_get(win,a,p,opts)		((void)(((a) != (void *)0) ? (*(a) = (win) ? (win)->_attrs : 0) : OK), \
+					 (void)(((p) != (void *)0) ? (*(p) = (NCURSES_PAIRS_T) ((win) ? PAIR_NUMBER((win)->_attrs) : 0)) : OK), \
 					 OK)
 #endif
 #endif /* NCURSES_OPAQUE */
@@ -1148,16 +1336,19 @@
  */
 #if @NCURSES_EXT_FUNCS@
 #if !NCURSES_OPAQUE
-#define is_cleared(win)		((win)->_clear)
-#define is_idcok(win)		((win)->_idcok)
-#define is_idlok(win)		((win)->_idlok)
-#define is_immedok(win)		((win)->_immed)
-#define is_keypad(win)		((win)->_use_keypad)
-#define is_leaveok(win)		((win)->_leaveok)
-#define is_nodelay(win)		((win)->_delay == 0)
-#define is_notimeout(win)	((win)->_notimeout)
-#define is_scrollok(win)	((win)->_scroll)
-#define is_syncok(win)		((win)->_sync)
+#define is_cleared(win)		((win) ? (win)->_clear : FALSE)
+#define is_idcok(win)		((win) ? (win)->_idcok : FALSE)
+#define is_idlok(win)		((win) ? (win)->_idlok : FALSE)
+#define is_immedok(win)		((win) ? (win)->_immed : FALSE)
+#define is_keypad(win)		((win) ? (win)->_use_keypad : FALSE)
+#define is_leaveok(win)		((win) ? (win)->_leaveok : FALSE)
+#define is_nodelay(win)		((win) ? ((win)->_delay == 0) : FALSE)
+#define is_notimeout(win)	((win) ? (win)->_notimeout : FALSE)
+#define is_pad(win)		((win) ? ((win)->_flags & _ISPAD) != 0 : FALSE)
+#define is_scrollok(win)	((win) ? (win)->_scroll : FALSE)
+#define is_subwin(win)		((win) ? ((win)->_flags & _SUBWIN) != 0 : FALSE)
+#define is_syncok(win)		((win) ? (win)->_sync : FALSE)
+#define wgetdelay(win)		((win) ? (win)->_delay : 0)
 #define wgetparent(win)		((win) ? (win)->_parent : 0)
 #define wgetscrreg(win,t,b)	((win) ? (*(t) = (win)->_regtop, *(b) = (win)->_regbottom, OK) : ERR)
 #endif
@@ -1173,7 +1364,7 @@
  *	   It gives the ESC expire time in milliseconds.
  *	b. ttytype is needed for backward compatibility
  */
-#if @cf_cv_enable_reentrant@
+#if NCURSES_REENTRANT
 
 NCURSES_WRAPPED_VAR(WINDOW *, curscr);
 NCURSES_WRAPPED_VAR(WINDOW *, newscr);
diff --git a/include/curses.head b/include/curses.head
deleted file mode 100644
index c8b8dff..0000000
--- a/include/curses.head
+++ /dev/null
@@ -1,1231 +0,0 @@
-/****************************************************************************
- * Copyright (c) 1998-2007,2008 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>                         *
- *     and: Thomas E. Dickey                        1996-on                 *
- ****************************************************************************/
-
-/* $Id: curses.h.in,v 1.187 2008/08/30 20:11:29 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, some of the wide-character (enhanced) functionality is missing.
- * 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 5
-#define NCURSES_VERSION_MINOR 7
-#define NCURSES_VERSION_PATCH 20081102
-
-/* This is defined in more than one ncurses header, for identification */
-#undef  NCURSES_VERSION
-#define NCURSES_VERSION "5.7"
-
-/*
- * Identify the mouse encoding version.
- */
-#define NCURSES_MOUSE_VERSION 1
-
-/*
- * Definitions to facilitate DLL's.
- */
-#include <ncurses_dll.h>
-
-/*
- * User-definable tweak to disable the include of <stdbool.h>.
- */
-#ifndef NCURSES_ENABLE_STDBOOL_H
-#define NCURSES_ENABLE_STDBOOL_H 1
-#endif
-
-/*
- * NCURSES_ATTR_T is used to quiet compiler warnings when building ncurses
- * configured using --disable-macros.
- */
-#ifdef NCURSES_NOMACROS
-#ifndef NCURSES_ATTR_T
-#define NCURSES_ATTR_T attr_t
-#endif
-#endif /* NCURSES_NOMACROS */
-
-#ifndef NCURSES_ATTR_T
-#define NCURSES_ATTR_T int
-#endif
-
-/*
- * Expands to 'const' if ncurses is configured using --enable-const.  Note that
- * doing so makes it incompatible with other implementations of X/Open Curses.
- */
-#undef  NCURSES_CONST
-#define NCURSES_CONST /*nothing*/
-
-#undef NCURSES_INLINE
-#define NCURSES_INLINE inline
-
-/*
- * The internal type used for color values
- */
-#undef	NCURSES_COLOR_T
-#define	NCURSES_COLOR_T short
-
-/*
- * Definition used to make WINDOW and similar structs opaque.
- */
-#ifndef NCURSES_OPAQUE
-#define NCURSES_OPAQUE 0
-#endif
-
-/*
- * The internal type used for window dimensions.
- */
-#undef	NCURSES_SIZE_T
-#define	NCURSES_SIZE_T short
-
-/*
- * Control whether tparm() supports varargs or fixed-parameter list.
- */
-#undef NCURSES_TPARM_VARARGS
-#define NCURSES_TPARM_VARARGS 1
-
-/*
- * NCURSES_CH_T is used in building the library, but not used otherwise in
- * this header file, since that would make the normal/wide-character versions
- * of the header incompatible.
- */
-#undef	NCURSES_CH_T
-#define NCURSES_CH_T chtype
-
-#if 0 && defined(_LP64)
-typedef unsigned chtype;
-typedef unsigned mmask_t;
-#else
-typedef unsigned long chtype;
-typedef unsigned long mmask_t;
-#endif
-
-#include <stdio.h>
-#include <unctrl.h>
-#include <stdarg.h>	/* we need va_list */
-#ifdef _XOPEN_SOURCE_EXTENDED
-#include <stddef.h>	/* we want wchar_t */
-#endif /* _XOPEN_SOURCE_EXTENDED */
-
-/* X/Open 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.
- *
- * A further complication is that <stdbool.h> may declare 'bool' to be a
- * different type, such as an enum which is not necessarily compatible with
- * C++.  If we have <stdbool.h>, make 'bool' a macro, so users may #undef it.
- * Otherwise, let it remain a typedef to avoid conflicts with other #define's.
- * In either case, make a typedef for NCURSES_BOOL which can be used if needed
- * from either C or C++.
- */
-
-#undef TRUE
-#define TRUE    1
-
-#undef FALSE
-#define FALSE   0
-
-typedef unsigned NCURSES_BOOL;
-
-#if 0	/* __cplusplus, etc. */
-
-/* use the C++ compiler's bool type */
-#define NCURSES_BOOL bool
-
-#else			/* c89, c99, etc. */
-
-#if NCURSES_ENABLE_STDBOOL_H
-#include <stdbool.h>
-/* use whatever the C compiler decides bool really is */
-#define NCURSES_BOOL bool
-#else
-/* there is no predefined bool - use our own */
-#undef bool
-#define bool NCURSES_BOOL
-#endif
-
-#endif /* !__cplusplus, etc. */
-
-#ifdef __cplusplus
-extern "C" {
-#define NCURSES_CAST(type,value) static_cast<type>(value)
-#else
-#define NCURSES_CAST(type,value) (type)(value)
-#endif
-
-/*
- * X/Open attributes.  In the ncurses implementation, they are identical to the
- * A_ attributes.
- */
-#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 */
-#define COLOR_BLACK	0
-#define COLOR_RED	1
-#define COLOR_GREEN	2
-#define COLOR_YELLOW	3
-#define COLOR_BLUE	4
-#define COLOR_MAGENTA	5
-#define COLOR_CYAN	6
-#define COLOR_WHITE	7
-
-/* line graphics */
-
-#if 0 || 0
-NCURSES_WRAPPED_VAR(chtype*, acs_map);
-#define acs_map (_nc_acs_map())
-#else
-extern NCURSES_EXPORT_VAR(chtype) acs_map[];
-#endif
-
-#define NCURSES_ACS(c)	(acs_map[NCURSES_CAST(unsigned char,c)])
-
-/* VT100 symbols begin here */
-#define ACS_ULCORNER	NCURSES_ACS('l') /* upper left corner */
-#define ACS_LLCORNER	NCURSES_ACS('m') /* lower left corner */
-#define ACS_URCORNER	NCURSES_ACS('k') /* upper right corner */
-#define ACS_LRCORNER	NCURSES_ACS('j') /* lower right corner */
-#define ACS_LTEE	NCURSES_ACS('t') /* tee pointing right */
-#define ACS_RTEE	NCURSES_ACS('u') /* tee pointing left */
-#define ACS_BTEE	NCURSES_ACS('v') /* tee pointing up */
-#define ACS_TTEE	NCURSES_ACS('w') /* tee pointing down */
-#define ACS_HLINE	NCURSES_ACS('q') /* horizontal line */
-#define ACS_VLINE	NCURSES_ACS('x') /* vertical line */
-#define ACS_PLUS	NCURSES_ACS('n') /* large plus or crossover */
-#define ACS_S1		NCURSES_ACS('o') /* scan line 1 */
-#define ACS_S9		NCURSES_ACS('s') /* scan line 9 */
-#define ACS_DIAMOND	NCURSES_ACS('`') /* diamond */
-#define ACS_CKBOARD	NCURSES_ACS('a') /* checker board (stipple) */
-#define ACS_DEGREE	NCURSES_ACS('f') /* degree symbol */
-#define ACS_PLMINUS	NCURSES_ACS('g') /* plus/minus */
-#define ACS_BULLET	NCURSES_ACS('~') /* bullet */
-/* Teletype 5410v1 symbols begin here */
-#define ACS_LARROW	NCURSES_ACS(',') /* arrow pointing left */
-#define ACS_RARROW	NCURSES_ACS('+') /* arrow pointing right */
-#define ACS_DARROW	NCURSES_ACS('.') /* arrow pointing down */
-#define ACS_UARROW	NCURSES_ACS('-') /* arrow pointing up */
-#define ACS_BOARD	NCURSES_ACS('h') /* board of squares */
-#define ACS_LANTERN	NCURSES_ACS('i') /* lantern symbol */
-#define ACS_BLOCK	NCURSES_ACS('0') /* solid square block */
-/*
- * These aren't documented, but a lot of System Vs have them anyway
- * (you can spot pprryyzz{{||}} in a lot of AT&T terminfo strings).
- * The ACS_names may not match AT&T's, our source didn't know them.
- */
-#define ACS_S3		NCURSES_ACS('p') /* scan line 3 */
-#define ACS_S7		NCURSES_ACS('r') /* scan line 7 */
-#define ACS_LEQUAL	NCURSES_ACS('y') /* less/equal */
-#define ACS_GEQUAL	NCURSES_ACS('z') /* greater/equal */
-#define ACS_PI		NCURSES_ACS('{') /* Pi */
-#define ACS_NEQUAL	NCURSES_ACS('|') /* not equal */
-#define ACS_STERLING	NCURSES_ACS('}') /* UK pound sign */
-
-/*
- * Line drawing ACS names are of the form ACS_trbl, where t is the top, r
- * is the right, b is the bottom, and l is the left.  t, r, b, and l might
- * be B (blank), S (single), D (double), or T (thick).  The subset defined
- * here only uses B and S.
- */
-#define ACS_BSSB	ACS_ULCORNER
-#define ACS_SSBB	ACS_LLCORNER
-#define ACS_BBSS	ACS_URCORNER
-#define ACS_SBBS	ACS_LRCORNER
-#define ACS_SBSS	ACS_RTEE
-#define ACS_SSSB	ACS_LTEE
-#define ACS_SSBS	ACS_BTEE
-#define ACS_BSSS	ACS_TTEE
-#define ACS_BSBS	ACS_HLINE
-#define ACS_SBSB	ACS_VLINE
-#define ACS_SSSS	ACS_PLUS
-
-#undef	ERR
-#define ERR     (-1)
-
-#undef	OK
-#define OK      (0)
-
-/* values for the _flags member */
-#define _SUBWIN         0x01	/* is this a sub-window? */
-#define _ENDLINE        0x02	/* is the window flush right? */
-#define _FULLWIN        0x04	/* is the window full-screen? */
-#define _SCROLLWIN      0x08	/* bottom edge is at screen bottom? */
-#define _ISPAD	        0x10	/* is this window a pad? */
-#define _HASMOVED       0x20	/* has cursor moved since last refresh? */
-#define _WRAPPED        0x40	/* cursor was just wrappped */
-
-/*
- * this value is used in the firstchar and lastchar fields to mark
- * unchanged lines
- */
-#define _NOCHANGE       -1
-
-/*
- * this value is used in the oldindex field to mark lines created by insertions
- * and scrolls.
- */
-#define _NEWINDEX	-1
-
-typedef struct screen  SCREEN;
-typedef struct _win_st WINDOW;
-
-typedef	chtype	attr_t;		/* ...must be at least as wide as chtype */
-
-#ifdef _XOPEN_SOURCE_EXTENDED
-
-#if 0
-#ifdef mblen			/* libutf8.h defines it w/o undefining first */
-#undef mblen
-#endif
-#include <libutf8.h>
-#endif
-
-#if 0
-#include <wchar.h>		/* ...to get mbstate_t, etc. */
-#endif
-
-#if 0
-typedef unsigned short wchar_t;
-#endif
-
-#if 0
-typedef unsigned int wint_t;
-#endif
-
-#define CCHARW_MAX	5
-typedef struct
-{
-    attr_t	attr;
-    wchar_t	chars[CCHARW_MAX];
-#if 0
-#undef NCURSES_EXT_COLORS
-#define NCURSES_EXT_COLORS 20081102
-    int		ext_color;	/* color pair, must be more than 16-bits */
-#endif
-}
-cchar_t;
-
-#endif /* _XOPEN_SOURCE_EXTENDED */
-
-#if !NCURSES_OPAQUE
-struct ldat;
-
-struct _win_st
-{
-	NCURSES_SIZE_T _cury, _curx; /* current cursor position */
-
-	/* window location and size */
-	NCURSES_SIZE_T _maxy, _maxx; /* maximums of x and y, NOT window size */
-	NCURSES_SIZE_T _begy, _begx; /* screen coords of upper-left-hand corner */
-
-	short   _flags;		/* window state flags */
-
-	/* attribute tracking */
-	attr_t  _attrs;		/* current attribute for non-space character */
-	chtype  _bkgd;		/* current background char/attribute pair */
-
-	/* option values set by user */
-	bool	_notimeout;	/* no time out on function-key entry? */
-	bool	_clear;		/* consider all data in the window invalid? */
-	bool	_leaveok;	/* OK to not reset cursor on exit? */
-	bool	_scroll;	/* OK to scroll this window? */
-	bool	_idlok;		/* OK to use insert/delete line? */
-	bool	_idcok;		/* OK to use insert/delete char? */
-	bool	_immed;		/* window in immed mode? (not yet used) */
-	bool	_sync;		/* window in sync mode? */
-	bool	_use_keypad;	/* process function keys into KEY_ symbols? */
-	int	_delay;		/* 0 = nodelay, <0 = blocking, >0 = delay */
-
-	struct ldat *_line;	/* the actual line data */
-
-	/* global screen state */
-	NCURSES_SIZE_T _regtop;	/* top line of scrolling region */
-	NCURSES_SIZE_T _regbottom; /* bottom line of scrolling region */
-
-	/* these are used only if this is a sub-window */
-	int	_parx;		/* x coordinate of this window in parent */
-	int	_pary;		/* y coordinate of this window in parent */
-	WINDOW	*_parent;	/* pointer to parent if a sub-window */
-
-	/* these are used only if this is a pad */
-	struct pdat
-	{
-	    NCURSES_SIZE_T _pad_y,      _pad_x;
-	    NCURSES_SIZE_T _pad_top,    _pad_left;
-	    NCURSES_SIZE_T _pad_bottom, _pad_right;
-	} _pad;
-
-	NCURSES_SIZE_T _yoffset; /* real begy is _begy + _yoffset */
-
-#ifdef _XOPEN_SOURCE_EXTENDED
-	cchar_t  _bkgrnd;	/* current background char/attribute pair */
-#if 0
-	int	_color;		/* current color-pair for non-space character */
-#endif
-#endif
-};
-#endif /* NCURSES_OPAQUE */
-
-/*
- * This is an extension to support events...
- */
-#if 1
-#ifdef NCURSES_WGETCH_EVENTS
-#if !defined(__BEOS__) || defined(__HAIKU__)
-   /* Fix _nc_timed_wait() on BEOS... */
-#  define NCURSES_EVENT_VERSION	1
-#endif	/* !defined(__BEOS__) */
-
-/*
- * Bits to set in _nc_event.data.flags
- */
-#  define _NC_EVENT_TIMEOUT_MSEC	1
-#  define _NC_EVENT_FILE		2
-#  define _NC_EVENT_FILE_READABLE	2
-#  if 0					/* Not supported yet... */
-#    define _NC_EVENT_FILE_WRITABLE	4
-#    define _NC_EVENT_FILE_EXCEPTION	8
-#  endif
-
-typedef struct
-{
-    int type;
-    union
-    {
-	long timeout_msec;	/* _NC_EVENT_TIMEOUT_MSEC */
-	struct
-	{
-	    unsigned int flags;
-	    int fd;
-	    unsigned int result;
-	} fev;				/* _NC_EVENT_FILE */
-    } data;
-} _nc_event;
-
-typedef struct
-{
-    int count;
-    int result_flags;	/* _NC_EVENT_TIMEOUT_MSEC or _NC_EVENT_FILE_READABLE */
-    _nc_event *events[1];
-} _nc_eventlist;
-
-extern NCURSES_EXPORT(int) wgetch_events(WINDOW *, _nc_eventlist *);	/* experimental */
-extern NCURSES_EXPORT(int) wgetnstr_events(WINDOW *,char *,int,_nc_eventlist *);/* experimental */
-
-#endif /* NCURSES_WGETCH_EVENTS */
-#endif /* NCURSES_EXT_FUNCS */
-
-/*
- * 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.
- * Old versions of G++ do not accept it anyway, at least not consistently with
- * GCC.
- */
-#if !(defined(__GNUC__) || defined(__GNUG__) || defined(__attribute__))
-#define __attribute__(p) /* nothing */
-#endif
-
-/*
- * We cannot define these in ncurses_cfg.h, since they require parameters to be
- * passed (that is non-portable).  If you happen to be using gcc with warnings
- * enabled, define
- *	GCC_PRINTF
- *	GCC_SCANF
- * to improve checking of calls to printw(), etc.
- */
-#ifndef GCC_PRINTFLIKE
-#if defined(GCC_PRINTF) && !defined(printf)
-#define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var)))
-#else
-#define GCC_PRINTFLIKE(fmt,var) /*nothing*/
-#endif
-#endif
-
-#ifndef GCC_SCANFLIKE
-#if defined(GCC_SCANF) && !defined(scanf)
-#define GCC_SCANFLIKE(fmt,var)  __attribute__((format(scanf,fmt,var)))
-#else
-#define GCC_SCANFLIKE(fmt,var)  /*nothing*/
-#endif
-#endif
-
-#ifndef	GCC_NORETURN
-#define	GCC_NORETURN /* nothing */
-#endif
-
-#ifndef	GCC_UNUSED
-#define	GCC_UNUSED /* nothing */
-#endif
-
-/*
- * Function prototypes.  This is the complete X/Open Curses list of required
- * functions.  Those marked `generated' will have sources generated from the
- * macro definitions later in this file, in order to satisfy XPG4.2
- * requirements.
- */
-
-extern NCURSES_EXPORT(int) addch (const chtype);			/* generated */
-extern NCURSES_EXPORT(int) addchnstr (const chtype *, int);		/* generated */
-extern NCURSES_EXPORT(int) addchstr (const chtype *);			/* generated */
-extern NCURSES_EXPORT(int) addnstr (const char *, int);			/* generated */
-extern NCURSES_EXPORT(int) addstr (const char *);			/* generated */
-extern NCURSES_EXPORT(int) attroff (NCURSES_ATTR_T);			/* generated */
-extern NCURSES_EXPORT(int) attron (NCURSES_ATTR_T);			/* generated */
-extern NCURSES_EXPORT(int) attrset (NCURSES_ATTR_T);			/* generated */
-extern NCURSES_EXPORT(int) attr_get (attr_t *, short *, void *);	/* generated */
-extern NCURSES_EXPORT(int) attr_off (attr_t, void *);			/* generated */
-extern NCURSES_EXPORT(int) attr_on (attr_t, void *);			/* generated */
-extern NCURSES_EXPORT(int) attr_set (attr_t, short, void *);		/* generated */
-extern NCURSES_EXPORT(int) baudrate (void);				/* implemented */
-extern NCURSES_EXPORT(int) beep  (void);				/* implemented */
-extern NCURSES_EXPORT(int) bkgd (chtype);				/* generated */
-extern NCURSES_EXPORT(void) bkgdset (chtype);				/* generated */
-extern NCURSES_EXPORT(int) border (chtype,chtype,chtype,chtype,chtype,chtype,chtype,chtype);	/* generated */
-extern NCURSES_EXPORT(int) box (WINDOW *, chtype, chtype);		/* generated */
-extern NCURSES_EXPORT(bool) can_change_color (void);			/* implemented */
-extern NCURSES_EXPORT(int) cbreak (void);				/* implemented */
-extern NCURSES_EXPORT(int) chgat (int, attr_t, short, const void *);	/* generated */
-extern NCURSES_EXPORT(int) clear (void);				/* generated */
-extern NCURSES_EXPORT(int) clearok (WINDOW *,bool);			/* implemented */
-extern NCURSES_EXPORT(int) clrtobot (void);				/* generated */
-extern NCURSES_EXPORT(int) clrtoeol (void);				/* generated */
-extern NCURSES_EXPORT(int) color_content (short,short*,short*,short*);	/* implemented */
-extern NCURSES_EXPORT(int) color_set (short,void*);			/* generated */
-extern NCURSES_EXPORT(int) COLOR_PAIR (int);				/* generated */
-extern NCURSES_EXPORT(int) copywin (const WINDOW*,WINDOW*,int,int,int,int,int,int,int);	/* implemented */
-extern NCURSES_EXPORT(int) curs_set (int);				/* implemented */
-extern NCURSES_EXPORT(int) def_prog_mode (void);			/* implemented */
-extern NCURSES_EXPORT(int) def_shell_mode (void);			/* implemented */
-extern NCURSES_EXPORT(int) delay_output (int);				/* implemented */
-extern NCURSES_EXPORT(int) delch (void);				/* generated */
-extern NCURSES_EXPORT(void) delscreen (SCREEN *);			/* implemented */
-extern NCURSES_EXPORT(int) delwin (WINDOW *);				/* implemented */
-extern NCURSES_EXPORT(int) deleteln (void);				/* generated */
-extern NCURSES_EXPORT(WINDOW *) derwin (WINDOW *,int,int,int,int);	/* implemented */
-extern NCURSES_EXPORT(int) doupdate (void);				/* implemented */
-extern NCURSES_EXPORT(WINDOW *) dupwin (WINDOW *);			/* implemented */
-extern NCURSES_EXPORT(int) echo (void);					/* implemented */
-extern NCURSES_EXPORT(int) echochar (const chtype);			/* generated */
-extern NCURSES_EXPORT(int) erase (void);				/* generated */
-extern NCURSES_EXPORT(int) endwin (void);				/* implemented */
-extern NCURSES_EXPORT(char) erasechar (void);				/* implemented */
-extern NCURSES_EXPORT(void) filter (void);				/* implemented */
-extern NCURSES_EXPORT(int) flash (void);				/* implemented */
-extern NCURSES_EXPORT(int) flushinp (void);				/* implemented */
-extern NCURSES_EXPORT(chtype) getbkgd (WINDOW *);			/* generated */
-extern NCURSES_EXPORT(int) getch (void);				/* generated */
-extern NCURSES_EXPORT(int) getnstr (char *, int);			/* generated */
-extern NCURSES_EXPORT(int) getstr (char *);				/* generated */
-extern NCURSES_EXPORT(WINDOW *) getwin (FILE *);			/* implemented */
-extern NCURSES_EXPORT(int) halfdelay (int);				/* implemented */
-extern NCURSES_EXPORT(bool) has_colors (void);				/* implemented */
-extern NCURSES_EXPORT(bool) has_ic (void);				/* implemented */
-extern NCURSES_EXPORT(bool) has_il (void);				/* implemented */
-extern NCURSES_EXPORT(int) hline (chtype, int);				/* generated */
-extern NCURSES_EXPORT(void) idcok (WINDOW *, bool);			/* implemented */
-extern NCURSES_EXPORT(int) idlok (WINDOW *, bool);			/* implemented */
-extern NCURSES_EXPORT(void) immedok (WINDOW *, bool);			/* implemented */
-extern NCURSES_EXPORT(chtype) inch (void);				/* generated */
-extern NCURSES_EXPORT(int) inchnstr (chtype *, int);			/* generated */
-extern NCURSES_EXPORT(int) inchstr (chtype *);				/* generated */
-extern NCURSES_EXPORT(WINDOW *) initscr (void);				/* implemented */
-extern NCURSES_EXPORT(int) init_color (short,short,short,short);	/* implemented */
-extern NCURSES_EXPORT(int) init_pair (short,short,short);		/* implemented */
-extern NCURSES_EXPORT(int) innstr (char *, int);			/* generated */
-extern NCURSES_EXPORT(int) insch (chtype);				/* generated */
-extern NCURSES_EXPORT(int) insdelln (int);				/* generated */
-extern NCURSES_EXPORT(int) insertln (void);				/* generated */
-extern NCURSES_EXPORT(int) insnstr (const char *, int);			/* generated */
-extern NCURSES_EXPORT(int) insstr (const char *);			/* generated */
-extern NCURSES_EXPORT(int) instr (char *);				/* generated */
-extern NCURSES_EXPORT(int) intrflush (WINDOW *,bool);			/* implemented */
-extern NCURSES_EXPORT(bool) isendwin (void);				/* implemented */
-extern NCURSES_EXPORT(bool) is_linetouched (WINDOW *,int);		/* implemented */
-extern NCURSES_EXPORT(bool) is_wintouched (WINDOW *);			/* implemented */
-extern NCURSES_EXPORT(NCURSES_CONST char *) keyname (int);		/* implemented */
-extern NCURSES_EXPORT(int) keypad (WINDOW *,bool);			/* implemented */
-extern NCURSES_EXPORT(char) killchar (void);				/* implemented */
-extern NCURSES_EXPORT(int) leaveok (WINDOW *,bool);			/* implemented */
-extern NCURSES_EXPORT(char *) longname (void);				/* implemented */
-extern NCURSES_EXPORT(int) meta (WINDOW *,bool);			/* implemented */
-extern NCURSES_EXPORT(int) move (int, int);				/* generated */
-extern NCURSES_EXPORT(int) mvaddch (int, int, const chtype);		/* generated */
-extern NCURSES_EXPORT(int) mvaddchnstr (int, int, const chtype *, int);	/* generated */
-extern NCURSES_EXPORT(int) mvaddchstr (int, int, const chtype *);	/* generated */
-extern NCURSES_EXPORT(int) mvaddnstr (int, int, const char *, int);	/* generated */
-extern NCURSES_EXPORT(int) mvaddstr (int, int, const char *);		/* generated */
-extern NCURSES_EXPORT(int) mvchgat (int, int, int, attr_t, short, const void *);	/* generated */
-extern NCURSES_EXPORT(int) mvcur (int,int,int,int);			/* implemented */
-extern NCURSES_EXPORT(int) mvdelch (int, int);				/* generated */
-extern NCURSES_EXPORT(int) mvderwin (WINDOW *, int, int);		/* implemented */
-extern NCURSES_EXPORT(int) mvgetch (int, int);				/* generated */
-extern NCURSES_EXPORT(int) mvgetnstr (int, int, char *, int);		/* generated */
-extern NCURSES_EXPORT(int) mvgetstr (int, int, char *);			/* generated */
-extern NCURSES_EXPORT(int) mvhline (int, int, chtype, int);		/* generated */
-extern NCURSES_EXPORT(chtype) mvinch (int, int);			/* generated */
-extern NCURSES_EXPORT(int) mvinchnstr (int, int, chtype *, int);	/* generated */
-extern NCURSES_EXPORT(int) mvinchstr (int, int, chtype *);		/* generated */
-extern NCURSES_EXPORT(int) mvinnstr (int, int, char *, int);		/* generated */
-extern NCURSES_EXPORT(int) mvinsch (int, int, chtype);			/* generated */
-extern NCURSES_EXPORT(int) mvinsnstr (int, int, const char *, int);	/* generated */
-extern NCURSES_EXPORT(int) mvinsstr (int, int, const char *);		/* generated */
-extern NCURSES_EXPORT(int) mvinstr (int, int, char *);			/* generated */
-extern NCURSES_EXPORT(int) mvprintw (int,int, const char *,...)		/* implemented */
-		GCC_PRINTFLIKE(3,4);
-extern NCURSES_EXPORT(int) mvscanw (int,int, NCURSES_CONST char *,...)	/* implemented */
-		GCC_SCANFLIKE(3,4);
-extern NCURSES_EXPORT(int) mvvline (int, int, chtype, int);		/* generated */
-extern NCURSES_EXPORT(int) mvwaddch (WINDOW *, int, int, const chtype);	/* generated */
-extern NCURSES_EXPORT(int) mvwaddchnstr (WINDOW *, int, int, const chtype *, int);/* generated */
-extern NCURSES_EXPORT(int) mvwaddchstr (WINDOW *, int, int, const chtype *);	/* generated */
-extern NCURSES_EXPORT(int) mvwaddnstr (WINDOW *, int, int, const char *, int);	/* generated */
-extern NCURSES_EXPORT(int) mvwaddstr (WINDOW *, int, int, const char *);	/* generated */
-extern NCURSES_EXPORT(int) mvwchgat (WINDOW *, int, int, int, attr_t, short, const void *);/* generated */
-extern NCURSES_EXPORT(int) mvwdelch (WINDOW *, int, int);		/* generated */
-extern NCURSES_EXPORT(int) mvwgetch (WINDOW *, int, int);		/* generated */
-extern NCURSES_EXPORT(int) mvwgetnstr (WINDOW *, int, int, char *, int);	/* generated */
-extern NCURSES_EXPORT(int) mvwgetstr (WINDOW *, int, int, char *);	/* generated */
-extern NCURSES_EXPORT(int) mvwhline (WINDOW *, int, int, chtype, int);	/* generated */
-extern NCURSES_EXPORT(int) mvwin (WINDOW *,int,int);			/* implemented */
-extern NCURSES_EXPORT(chtype) mvwinch (WINDOW *, int, int);			/* generated */
-extern NCURSES_EXPORT(int) mvwinchnstr (WINDOW *, int, int, chtype *, int);	/* generated */
-extern NCURSES_EXPORT(int) mvwinchstr (WINDOW *, int, int, chtype *);		/* generated */
-extern NCURSES_EXPORT(int) mvwinnstr (WINDOW *, int, int, char *, int);		/* generated */
-extern NCURSES_EXPORT(int) mvwinsch (WINDOW *, int, int, chtype);		/* generated */
-extern NCURSES_EXPORT(int) mvwinsnstr (WINDOW *, int, int, const char *, int);	/* generated */
-extern NCURSES_EXPORT(int) mvwinsstr (WINDOW *, int, int, const char *);		/* generated */
-extern NCURSES_EXPORT(int) mvwinstr (WINDOW *, int, int, char *);		/* generated */
-extern NCURSES_EXPORT(int) mvwprintw (WINDOW*,int,int, const char *,...)	/* implemented */
-		GCC_PRINTFLIKE(4,5);
-extern NCURSES_EXPORT(int) mvwscanw (WINDOW *,int,int, NCURSES_CONST char *,...)	/* implemented */
-		GCC_SCANFLIKE(4,5);
-extern NCURSES_EXPORT(int) mvwvline (WINDOW *,int, int, chtype, int);	/* generated */
-extern NCURSES_EXPORT(int) napms (int);					/* implemented */
-extern NCURSES_EXPORT(WINDOW *) newpad (int,int);				/* implemented */
-extern NCURSES_EXPORT(SCREEN *) newterm (NCURSES_CONST char *,FILE *,FILE *);	/* implemented */
-extern NCURSES_EXPORT(WINDOW *) newwin (int,int,int,int);			/* implemented */
-extern NCURSES_EXPORT(int) nl (void);					/* implemented */
-extern NCURSES_EXPORT(int) nocbreak (void);				/* implemented */
-extern NCURSES_EXPORT(int) nodelay (WINDOW *,bool);			/* implemented */
-extern NCURSES_EXPORT(int) noecho (void);				/* implemented */
-extern NCURSES_EXPORT(int) nonl (void);					/* implemented */
-extern NCURSES_EXPORT(void) noqiflush (void);				/* implemented */
-extern NCURSES_EXPORT(int) noraw (void);				/* implemented */
-extern NCURSES_EXPORT(int) notimeout (WINDOW *,bool);			/* implemented */
-extern NCURSES_EXPORT(int) overlay (const WINDOW*,WINDOW *);		/* implemented */
-extern NCURSES_EXPORT(int) overwrite (const WINDOW*,WINDOW *);		/* implemented */
-extern NCURSES_EXPORT(int) pair_content (short,short*,short*);		/* implemented */
-extern NCURSES_EXPORT(int) PAIR_NUMBER (int);				/* generated */
-extern NCURSES_EXPORT(int) pechochar (WINDOW *, const chtype);		/* implemented */
-extern NCURSES_EXPORT(int) pnoutrefresh (WINDOW*,int,int,int,int,int,int);/* implemented */
-extern NCURSES_EXPORT(int) prefresh (WINDOW *,int,int,int,int,int,int);	/* implemented */
-extern NCURSES_EXPORT(int) printw (const char *,...)			/* implemented */
-		GCC_PRINTFLIKE(1,2);
-extern NCURSES_EXPORT(int) putwin (WINDOW *, FILE *);			/* implemented */
-extern NCURSES_EXPORT(void) qiflush (void);				/* implemented */
-extern NCURSES_EXPORT(int) raw (void);					/* implemented */
-extern NCURSES_EXPORT(int) redrawwin (WINDOW *);			/* generated */
-extern NCURSES_EXPORT(int) refresh (void);				/* generated */
-extern NCURSES_EXPORT(int) resetty (void);				/* implemented */
-extern NCURSES_EXPORT(int) reset_prog_mode (void);			/* implemented */
-extern NCURSES_EXPORT(int) reset_shell_mode (void);			/* implemented */
-extern NCURSES_EXPORT(int) ripoffline (int, int (*)(WINDOW *, int));	/* implemented */
-extern NCURSES_EXPORT(int) savetty (void);				/* implemented */
-extern NCURSES_EXPORT(int) scanw (NCURSES_CONST char *,...)		/* implemented */
-		GCC_SCANFLIKE(1,2);
-extern NCURSES_EXPORT(int) scr_dump (const char *);			/* implemented */
-extern NCURSES_EXPORT(int) scr_init (const char *);			/* implemented */
-extern NCURSES_EXPORT(int) scrl (int);					/* generated */
-extern NCURSES_EXPORT(int) scroll (WINDOW *);				/* generated */
-extern NCURSES_EXPORT(int) scrollok (WINDOW *,bool);			/* implemented */
-extern NCURSES_EXPORT(int) scr_restore (const char *);			/* implemented */
-extern NCURSES_EXPORT(int) scr_set (const char *);			/* implemented */
-extern NCURSES_EXPORT(int) setscrreg (int,int);				/* generated */
-extern NCURSES_EXPORT(SCREEN *) set_term (SCREEN *);			/* implemented */
-extern NCURSES_EXPORT(int) slk_attroff (const chtype);			/* implemented */
-extern NCURSES_EXPORT(int) slk_attr_off (const attr_t, void *);		/* generated:WIDEC */
-extern NCURSES_EXPORT(int) slk_attron (const chtype);			/* implemented */
-extern NCURSES_EXPORT(int) slk_attr_on (attr_t,void*);			/* generated:WIDEC */
-extern NCURSES_EXPORT(int) slk_attrset (const chtype);			/* implemented */
-extern NCURSES_EXPORT(attr_t) slk_attr (void);				/* implemented */
-extern NCURSES_EXPORT(int) slk_attr_set (const attr_t,short,void*);	/* implemented */
-extern NCURSES_EXPORT(int) slk_clear (void);				/* implemented */
-extern NCURSES_EXPORT(int) slk_color (short);				/* implemented */
-extern NCURSES_EXPORT(int) slk_init (int);				/* implemented */
-extern NCURSES_EXPORT(char *) slk_label (int);				/* implemented */
-extern NCURSES_EXPORT(int) slk_noutrefresh (void);			/* implemented */
-extern NCURSES_EXPORT(int) slk_refresh (void);				/* implemented */
-extern NCURSES_EXPORT(int) slk_restore (void);				/* implemented */
-extern NCURSES_EXPORT(int) slk_set (int,const char *,int);		/* implemented */
-extern NCURSES_EXPORT(int) slk_touch (void);				/* implemented */
-extern NCURSES_EXPORT(int) standout (void);				/* generated */
-extern NCURSES_EXPORT(int) standend (void);				/* generated */
-extern NCURSES_EXPORT(int) start_color (void);				/* implemented */
-extern NCURSES_EXPORT(WINDOW *) subpad (WINDOW *, int, int, int, int);	/* implemented */
-extern NCURSES_EXPORT(WINDOW *) subwin (WINDOW *, int, int, int, int);	/* implemented */
-extern NCURSES_EXPORT(int) syncok (WINDOW *, bool);			/* implemented */
-extern NCURSES_EXPORT(chtype) termattrs (void);				/* implemented */
-extern NCURSES_EXPORT(char *) termname (void);				/* implemented */
-extern NCURSES_EXPORT(void) timeout (int);				/* generated */
-extern NCURSES_EXPORT(int) touchline (WINDOW *, int, int);		/* generated */
-extern NCURSES_EXPORT(int) touchwin (WINDOW *);				/* generated */
-extern NCURSES_EXPORT(int) typeahead (int);				/* implemented */
-extern NCURSES_EXPORT(int) ungetch (int);				/* implemented */
-extern NCURSES_EXPORT(int) untouchwin (WINDOW *);			/* generated */
-extern NCURSES_EXPORT(void) use_env (bool);				/* implemented */
-extern NCURSES_EXPORT(int) vidattr (chtype);				/* implemented */
-extern NCURSES_EXPORT(int) vidputs (chtype, int (*)(int));		/* implemented */
-extern NCURSES_EXPORT(int) vline (chtype, int);				/* generated */
-extern NCURSES_EXPORT(int) vwprintw (WINDOW *, const char *,va_list);	/* implemented */
-extern NCURSES_EXPORT(int) vw_printw (WINDOW *, const char *,va_list);	/* generated */
-extern NCURSES_EXPORT(int) vwscanw (WINDOW *, NCURSES_CONST char *,va_list);	/* implemented */
-extern NCURSES_EXPORT(int) vw_scanw (WINDOW *, NCURSES_CONST char *,va_list);	/* generated */
-extern NCURSES_EXPORT(int) waddch (WINDOW *, const chtype);		/* implemented */
-extern NCURSES_EXPORT(int) waddchnstr (WINDOW *,const chtype *,int);	/* implemented */
-extern NCURSES_EXPORT(int) waddchstr (WINDOW *,const chtype *);		/* generated */
-extern NCURSES_EXPORT(int) waddnstr (WINDOW *,const char *,int);	/* implemented */
-extern NCURSES_EXPORT(int) waddstr (WINDOW *,const char *);		/* generated */
-extern NCURSES_EXPORT(int) wattron (WINDOW *, int);			/* generated */
-extern NCURSES_EXPORT(int) wattroff (WINDOW *, int);			/* generated */
-extern NCURSES_EXPORT(int) wattrset (WINDOW *, int);			/* generated */
-extern NCURSES_EXPORT(int) wattr_get (WINDOW *, attr_t *, short *, void *);	/* generated */
-extern NCURSES_EXPORT(int) wattr_on (WINDOW *, attr_t, void *);		/* implemented */
-extern NCURSES_EXPORT(int) wattr_off (WINDOW *, attr_t, void *);	/* implemented */
-extern NCURSES_EXPORT(int) wattr_set (WINDOW *, attr_t, short, void *);	/* generated */
-extern NCURSES_EXPORT(int) wbkgd (WINDOW *, chtype);			/* implemented */
-extern NCURSES_EXPORT(void) wbkgdset (WINDOW *,chtype);			/* implemented */
-extern NCURSES_EXPORT(int) wborder (WINDOW *,chtype,chtype,chtype,chtype,chtype,chtype,chtype,chtype);	/* implemented */
-extern NCURSES_EXPORT(int) wchgat (WINDOW *, int, attr_t, short, const void *);/* implemented */
-extern NCURSES_EXPORT(int) wclear (WINDOW *);				/* implemented */
-extern NCURSES_EXPORT(int) wclrtobot (WINDOW *);			/* implemented */
-extern NCURSES_EXPORT(int) wclrtoeol (WINDOW *);			/* implemented */
-extern NCURSES_EXPORT(int) wcolor_set (WINDOW*,short,void*);		/* implemented */
-extern NCURSES_EXPORT(void) wcursyncup (WINDOW *);			/* implemented */
-extern NCURSES_EXPORT(int) wdelch (WINDOW *);				/* implemented */
-extern NCURSES_EXPORT(int) wdeleteln (WINDOW *);			/* generated */
-extern NCURSES_EXPORT(int) wechochar (WINDOW *, const chtype);		/* implemented */
-extern NCURSES_EXPORT(int) werase (WINDOW *);				/* implemented */
-extern NCURSES_EXPORT(int) wgetch (WINDOW *);				/* implemented */
-extern NCURSES_EXPORT(int) wgetnstr (WINDOW *,char *,int);		/* implemented */
-extern NCURSES_EXPORT(int) wgetstr (WINDOW *, char *);			/* generated */
-extern NCURSES_EXPORT(int) whline (WINDOW *, chtype, int);		/* implemented */
-extern NCURSES_EXPORT(chtype) winch (WINDOW *);				/* implemented */
-extern NCURSES_EXPORT(int) winchnstr (WINDOW *, chtype *, int);		/* implemented */
-extern NCURSES_EXPORT(int) winchstr (WINDOW *, chtype *);		/* generated */
-extern NCURSES_EXPORT(int) winnstr (WINDOW *, char *, int);		/* implemented */
-extern NCURSES_EXPORT(int) winsch (WINDOW *, chtype);			/* implemented */
-extern NCURSES_EXPORT(int) winsdelln (WINDOW *,int);			/* implemented */
-extern NCURSES_EXPORT(int) winsertln (WINDOW *);			/* generated */
-extern NCURSES_EXPORT(int) winsnstr (WINDOW *, const char *,int);	/* implemented */
-extern NCURSES_EXPORT(int) winsstr (WINDOW *, const char *);		/* generated */
-extern NCURSES_EXPORT(int) winstr (WINDOW *, char *);			/* generated */
-extern NCURSES_EXPORT(int) wmove (WINDOW *,int,int);			/* implemented */
-extern NCURSES_EXPORT(int) wnoutrefresh (WINDOW *);			/* implemented */
-extern NCURSES_EXPORT(int) wprintw (WINDOW *, const char *,...)		/* implemented */
-		GCC_PRINTFLIKE(2,3);
-extern NCURSES_EXPORT(int) wredrawln (WINDOW *,int,int);		/* implemented */
-extern NCURSES_EXPORT(int) wrefresh (WINDOW *);				/* implemented */
-extern NCURSES_EXPORT(int) wscanw (WINDOW *, NCURSES_CONST char *,...)	/* implemented */
-		GCC_SCANFLIKE(2,3);
-extern NCURSES_EXPORT(int) wscrl (WINDOW *,int);			/* implemented */
-extern NCURSES_EXPORT(int) wsetscrreg (WINDOW *,int,int);		/* implemented */
-extern NCURSES_EXPORT(int) wstandout (WINDOW *);			/* generated */
-extern NCURSES_EXPORT(int) wstandend (WINDOW *);			/* generated */
-extern NCURSES_EXPORT(void) wsyncdown (WINDOW *);			/* implemented */
-extern NCURSES_EXPORT(void) wsyncup (WINDOW *);				/* implemented */
-extern NCURSES_EXPORT(void) wtimeout (WINDOW *,int);			/* implemented */
-extern NCURSES_EXPORT(int) wtouchln (WINDOW *,int,int,int);		/* implemented */
-extern NCURSES_EXPORT(int) wvline (WINDOW *,chtype,int);		/* implemented */
-
-/*
- * These are also declared in <term.h>:
- */
-extern NCURSES_EXPORT(int) tigetflag (NCURSES_CONST char *);		/* implemented */
-extern NCURSES_EXPORT(int) tigetnum (NCURSES_CONST char *);		/* implemented */
-extern NCURSES_EXPORT(char *) tigetstr (NCURSES_CONST char *);		/* implemented */
-extern NCURSES_EXPORT(int) putp (const char *);				/* implemented */
-
-#if NCURSES_TPARM_VARARGS
-extern NCURSES_EXPORT(char *) tparm (NCURSES_CONST char *, ...);	/* special */
-#else
-extern NCURSES_EXPORT(char *) tparm (NCURSES_CONST char *, long,long,long,long,long,long,long,long,long);	/* special */
-extern NCURSES_EXPORT(char *) tparm_varargs (NCURSES_CONST char *, ...);	/* special */
-#endif
-
-/*
- * These functions are not in X/Open, but we use them in macro definitions:
- */
-extern NCURSES_EXPORT(int) getattrs (const WINDOW *);			/* generated */
-extern NCURSES_EXPORT(int) getcurx (const WINDOW *);			/* generated */
-extern NCURSES_EXPORT(int) getcury (const WINDOW *);			/* generated */
-extern NCURSES_EXPORT(int) getbegx (const WINDOW *);			/* generated */
-extern NCURSES_EXPORT(int) getbegy (const WINDOW *);			/* generated */
-extern NCURSES_EXPORT(int) getmaxx (const WINDOW *);			/* generated */
-extern NCURSES_EXPORT(int) getmaxy (const WINDOW *);			/* generated */
-extern NCURSES_EXPORT(int) getparx (const WINDOW *);			/* generated */
-extern NCURSES_EXPORT(int) getpary (const WINDOW *);			/* generated */
-
-/*
- * vid_attr() was implemented originally based on a draft of X/Open curses.
- */
-#ifndef _XOPEN_SOURCE_EXTENDED
-#define vid_attr(a,pair,opts) vidattr(a)
-#endif
-
-/*
- * These functions are extensions - not in X/Open Curses.
- */
-#if 1
-#undef  NCURSES_EXT_FUNCS
-#define NCURSES_EXT_FUNCS 20081102
-typedef int (*NCURSES_WINDOW_CB)(WINDOW *, void *);
-typedef int (*NCURSES_SCREEN_CB)(SCREEN *, void *);
-extern NCURSES_EXPORT(bool) is_term_resized (int, int);
-extern NCURSES_EXPORT(char *) keybound (int, int);
-extern NCURSES_EXPORT(const char *) curses_version (void);
-extern NCURSES_EXPORT(int) assume_default_colors (int, int);
-extern NCURSES_EXPORT(int) define_key (const char *, int);
-extern NCURSES_EXPORT(int) key_defined (const char *);
-extern NCURSES_EXPORT(int) keyok (int, bool);
-extern NCURSES_EXPORT(int) resize_term (int, int);
-extern NCURSES_EXPORT(int) resizeterm (int, int);
-extern NCURSES_EXPORT(int) set_escdelay (int);
-extern NCURSES_EXPORT(int) set_tabsize (int);
-extern NCURSES_EXPORT(int) use_default_colors (void);
-extern NCURSES_EXPORT(int) use_extended_names (bool);
-extern NCURSES_EXPORT(int) use_legacy_coding (int);
-extern NCURSES_EXPORT(int) use_screen (SCREEN *, NCURSES_SCREEN_CB, void *);
-extern NCURSES_EXPORT(int) use_window (WINDOW *, NCURSES_WINDOW_CB, void *);
-extern NCURSES_EXPORT(int) wresize (WINDOW *, int, int);
-extern NCURSES_EXPORT(void) nofilter(void);
-
-/*
- * These extensions provide access to information stored in the WINDOW even
- * when NCURSES_OPAQUE is set:
- */
-extern NCURSES_EXPORT(WINDOW *) wgetparent (const WINDOW *);	/* generated */
-extern NCURSES_EXPORT(bool) is_cleared (const WINDOW *);	/* generated */
-extern NCURSES_EXPORT(bool) is_idcok (const WINDOW *);		/* generated */
-extern NCURSES_EXPORT(bool) is_idlok (const WINDOW *);		/* generated */
-extern NCURSES_EXPORT(bool) is_immedok (const WINDOW *);	/* generated */
-extern NCURSES_EXPORT(bool) is_keypad (const WINDOW *);		/* generated */
-extern NCURSES_EXPORT(bool) is_leaveok (const WINDOW *);	/* generated */
-extern NCURSES_EXPORT(bool) is_nodelay (const WINDOW *);	/* generated */
-extern NCURSES_EXPORT(bool) is_notimeout (const WINDOW *);	/* generated */
-extern NCURSES_EXPORT(bool) is_scrollok (const WINDOW *);	/* generated */
-extern NCURSES_EXPORT(bool) is_syncok (const WINDOW *);		/* generated */
-extern NCURSES_EXPORT(int) wgetscrreg (const WINDOW *, int *, int *); /* generated */
-
-#else
-#define curses_version() NCURSES_VERSION
-#endif
-
-/* attributes */
-
-#define NCURSES_ATTR_SHIFT       8
-#define NCURSES_BITS(mask,shift) ((mask) << ((shift) + NCURSES_ATTR_SHIFT))
-
-#define A_NORMAL	(1UL - 1UL)
-#define A_ATTRIBUTES	NCURSES_BITS(~(1UL - 1UL),0)
-#define A_CHARTEXT	(NCURSES_BITS(1UL,0) - 1UL)
-#define A_COLOR		NCURSES_BITS(((1UL) << 8) - 1UL,0)
-#define A_STANDOUT	NCURSES_BITS(1UL,8)
-#define A_UNDERLINE	NCURSES_BITS(1UL,9)
-#define A_REVERSE	NCURSES_BITS(1UL,10)
-#define A_BLINK		NCURSES_BITS(1UL,11)
-#define A_DIM		NCURSES_BITS(1UL,12)
-#define A_BOLD		NCURSES_BITS(1UL,13)
-#define A_ALTCHARSET	NCURSES_BITS(1UL,14)
-#define A_INVIS		NCURSES_BITS(1UL,15)
-#define A_PROTECT	NCURSES_BITS(1UL,16)
-#define A_HORIZONTAL	NCURSES_BITS(1UL,17)
-#define A_LEFT		NCURSES_BITS(1UL,18)
-#define A_LOW		NCURSES_BITS(1UL,19)
-#define A_RIGHT		NCURSES_BITS(1UL,20)
-#define A_TOP		NCURSES_BITS(1UL,21)
-#define A_VERTICAL	NCURSES_BITS(1UL,22)
-
-/*
- * Most of the pseudo functions are macros that either provide compatibility
- * with older versions of curses, or provide inline functionality to improve
- * performance.
- */
-
-/*
- * These pseudo functions are always implemented as macros:
- */
-
-#define getyx(win,y,x)   	(y = getcury(win), x = getcurx(win))
-#define getbegyx(win,y,x)	(y = getbegy(win), x = getbegx(win))
-#define getmaxyx(win,y,x)	(y = getmaxy(win), x = getmaxx(win))
-#define getparyx(win,y,x)	(y = getpary(win), x = getparx(win))
-
-#define getsyx(y,x) do { if (newscr) { \
-			     if (is_leaveok(newscr)) \
-				(y) = (x) = -1; \
-			     else \
-				 getyx(newscr,(y), (x)); \
-			} \
-		    } while(0)
-
-#define setsyx(y,x) do { if (newscr) { \
-			    if ((y) == -1 && (x) == -1) \
-				leaveok(newscr, TRUE); \
-			    else { \
-				leaveok(newscr, FALSE); \
-				wmove(newscr, (y), (x)); \
-			    } \
-			} \
-		    } while(0)
-
-#ifndef NCURSES_NOMACROS
-
-/*
- * These miscellaneous pseudo functions are provided for compatibility:
- */
-
-#define wgetstr(w, s)		wgetnstr(w, s, -1)
-#define getnstr(s, n)		wgetnstr(stdscr, s, n)
-
-#define setterm(term)		setupterm(term, 1, (int *)0)
-
-#define fixterm()		reset_prog_mode()
-#define resetterm()		reset_shell_mode()
-#define saveterm()		def_prog_mode()
-#define crmode()		cbreak()
-#define nocrmode()		nocbreak()
-#define gettmode()
-
-/* It seems older SYSV curses versions define these */
-#if !NCURSES_OPAQUE
-#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)
-#endif /* NCURSES_OPAQUE */
-
-#define wstandout(win)      	(wattrset(win,A_STANDOUT))
-#define wstandend(win)      	(wattrset(win,A_NORMAL))
-
-#define wattron(win,at)		wattr_on(win, NCURSES_CAST(attr_t, at), NULL)
-#define wattroff(win,at)	wattr_off(win, NCURSES_CAST(attr_t, at), NULL)
-
-#if !NCURSES_OPAQUE
-#if defined(_XOPEN_SOURCE_EXTENDED) && 0
-#define wattrset(win,at)	((win)->_color = PAIR_NUMBER(at), \
-				 (win)->_attrs = (at))
-#else
-#define wattrset(win,at)	((win)->_attrs = (at))
-#endif
-#endif /* NCURSES_OPAQUE */
-
-#define scroll(win)		wscrl(win,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, 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)
-#define hline(ch, n)		whline(stdscr, ch, n)
-#define vline(ch, n)		wvline(stdscr, ch, n)
-
-#define winstr(w, s)		winnstr(w, s, -1)
-#define winchstr(w, s)		winchnstr(w, s, -1)
-#define winsstr(w, s)		winsnstr(w, s, -1)
-
-#if !NCURSES_OPAQUE
-#define redrawwin(win)		wredrawln(win, 0, (win)->_maxy+1)
-#endif /* NCURSES_OPAQUE */
-
-#define waddstr(win,str)	waddnstr(win,str,-1)
-#define waddchstr(win,str)	waddchnstr(win,str,-1)
-
-/*
- * These apply to the first 256 color pairs.
- */
-#define COLOR_PAIR(n)	NCURSES_BITS(n, 0)
-#define PAIR_NUMBER(a)	(NCURSES_CAST(int,(((a) & A_COLOR) >> NCURSES_ATTR_SHIFT)))
-
-/*
- * pseudo functions for standard screen
- */
-
-#define addch(ch)		waddch(stdscr,ch)
-#define addchnstr(str,n)	waddchnstr(stdscr,str,n)
-#define addchstr(str)		waddchstr(stdscr,str)
-#define addnstr(str,n)		waddnstr(stdscr,str,n)
-#define addstr(str)		waddnstr(stdscr,str,-1)
-#define attroff(at)		wattroff(stdscr,at)
-#define attron(at)		wattron(stdscr,at)
-#define attrset(at)		wattrset(stdscr,at)
-#define attr_get(ap,cp,o)	wattr_get(stdscr,ap,cp,o)
-#define attr_off(a,o)		wattr_off(stdscr,a,o)
-#define attr_on(a,o)		wattr_on(stdscr,a,o)
-#define attr_set(a,c,o)		wattr_set(stdscr,a,c,o)
-#define bkgd(ch)		wbkgd(stdscr,ch)
-#define bkgdset(ch)		wbkgdset(stdscr,ch)
-#define chgat(n,a,c,o)		wchgat(stdscr,n,a,c,o)
-#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)
-#define erase()			werase(stdscr)
-#define getch()			wgetch(stdscr)
-#define getstr(str)		wgetstr(stdscr,str)
-#define inch()			winch(stdscr)
-#define inchnstr(s,n)		winchnstr(stdscr,s,n)
-#define inchstr(s)		winchstr(stdscr,s)
-#define innstr(s,n)		winnstr(stdscr,s,n)
-#define insch(c)		winsch(stdscr,c)
-#define insdelln(n)		winsdelln(stdscr,n)
-#define insertln()		winsdelln(stdscr,1)
-#define insnstr(s,n)		winsnstr(stdscr,s,n)
-#define insstr(s)		winsstr(stdscr,s)
-#define instr(s)		winstr(stdscr,s)
-#define move(y,x)		wmove(stdscr,y,x)
-#define refresh()		wrefresh(stdscr)
-#define scrl(n)			wscrl(stdscr,n)
-#define setscrreg(t,b)		wsetscrreg(stdscr,t,b)
-#define standend()		wstandend(stdscr)
-#define standout()		wstandout(stdscr)
-#define timeout(delay)		wtimeout(stdscr,delay)
-#define wdeleteln(win)		winsdelln(win,-1)
-#define winsertln(win)		winsdelln(win,1)
-
-/*
- * mv functions
- */
-
-#define mvwaddch(win,y,x,ch)		(wmove(win,y,x) == ERR ? ERR : waddch(win,ch))
-#define mvwaddchnstr(win,y,x,str,n)	(wmove(win,y,x) == ERR ? ERR : waddchnstr(win,str,n))
-#define mvwaddchstr(win,y,x,str)	(wmove(win,y,x) == ERR ? ERR : waddchnstr(win,str,-1))
-#define mvwaddnstr(win,y,x,str,n)	(wmove(win,y,x) == ERR ? ERR : waddnstr(win,str,n))
-#define mvwaddstr(win,y,x,str)		(wmove(win,y,x) == ERR ? ERR : waddnstr(win,str,-1))
-#define mvwdelch(win,y,x)		(wmove(win,y,x) == ERR ? ERR : wdelch(win))
-#define mvwchgat(win,y,x,n,a,c,o)	(wmove(win,y,x) == ERR ? ERR : wchgat(win,n,a,c,o))
-#define mvwgetch(win,y,x)		(wmove(win,y,x) == ERR ? ERR : wgetch(win))
-#define mvwgetnstr(win,y,x,str,n)	(wmove(win,y,x) == ERR ? ERR : wgetnstr(win,str,n))
-#define mvwgetstr(win,y,x,str)		(wmove(win,y,x) == ERR ? ERR : wgetstr(win,str))
-#define mvwhline(win,y,x,c,n)		(wmove(win,y,x) == ERR ? ERR : whline(win,c,n))
-#define mvwinch(win,y,x)		(wmove(win,y,x) == ERR ? NCURSES_CAST(chtype, ERR) : winch(win))
-#define mvwinchnstr(win,y,x,s,n)	(wmove(win,y,x) == ERR ? ERR : winchnstr(win,s,n))
-#define mvwinchstr(win,y,x,s)		(wmove(win,y,x) == ERR ? ERR : winchstr(win,s))
-#define mvwinnstr(win,y,x,s,n)		(wmove(win,y,x) == ERR ? ERR : winnstr(win,s,n))
-#define mvwinsch(win,y,x,c)		(wmove(win,y,x) == ERR ? ERR : winsch(win,c))
-#define mvwinsnstr(win,y,x,s,n)		(wmove(win,y,x) == ERR ? ERR : winsnstr(win,s,n))
-#define mvwinsstr(win,y,x,s)		(wmove(win,y,x) == ERR ? ERR : winsstr(win,s))
-#define mvwinstr(win,y,x,s)		(wmove(win,y,x) == ERR ? ERR : winstr(win,s))
-#define mvwvline(win,y,x,c,n)		(wmove(win,y,x) == ERR ? ERR : wvline(win,c,n))
-
-#define mvaddch(y,x,ch)			mvwaddch(stdscr,y,x,ch)
-#define mvaddchnstr(y,x,str,n)		mvwaddchnstr(stdscr,y,x,str,n)
-#define mvaddchstr(y,x,str)		mvwaddchstr(stdscr,y,x,str)
-#define mvaddnstr(y,x,str,n)		mvwaddnstr(stdscr,y,x,str,n)
-#define mvaddstr(y,x,str)		mvwaddstr(stdscr,y,x,str)
-#define mvchgat(y,x,n,a,c,o)		mvwchgat(stdscr,y,x,n,a,c,o)
-#define mvdelch(y,x)			mvwdelch(stdscr,y,x)
-#define mvgetch(y,x)			mvwgetch(stdscr,y,x)
-#define mvgetnstr(y,x,str,n)		mvwgetnstr(stdscr,y,x,str,n)
-#define mvgetstr(y,x,str)		mvwgetstr(stdscr,y,x,str)
-#define mvhline(y,x,c,n)		mvwhline(stdscr,y,x,c,n)
-#define mvinch(y,x)			mvwinch(stdscr,y,x)
-#define mvinchnstr(y,x,s,n)		mvwinchnstr(stdscr,y,x,s,n)
-#define mvinchstr(y,x,s)		mvwinchstr(stdscr,y,x,s)
-#define mvinnstr(y,x,s,n)		mvwinnstr(stdscr,y,x,s,n)
-#define mvinsch(y,x,c)			mvwinsch(stdscr,y,x,c)
-#define mvinsnstr(y,x,s,n)		mvwinsnstr(stdscr,y,x,s,n)
-#define mvinsstr(y,x,s)			mvwinsstr(stdscr,y,x,s)
-#define mvinstr(y,x,s)			mvwinstr(stdscr,y,x,s)
-#define mvvline(y,x,c,n)		mvwvline(stdscr,y,x,c,n)
-
-/*
- * Some wide-character functions can be implemented without the extensions.
- */
-#if !NCURSES_OPAQUE
-#define getbkgd(win)                    ((win)->_bkgd)
-#endif /* NCURSES_OPAQUE */
-
-#define slk_attr_off(a,v)		((v) ? ERR : slk_attroff(a))
-#define slk_attr_on(a,v)		((v) ? ERR : slk_attron(a))
-
-#if !NCURSES_OPAQUE
-#if defined(_XOPEN_SOURCE_EXTENDED) && 0
-#define wattr_set(win,a,p,opts)		((win)->_attrs = ((a) & ~A_COLOR), \
-					 (win)->_color = (p), \
-					 OK)
-#define wattr_get(win,a,p,opts)		((void)((a) != (void *)0 && (*(a) = (win)->_attrs)), \
-					 (void)((p) != (void *)0 && (*(p) = (win)->_color)), \
-					 OK)
-#else
-#define wattr_set(win,a,p,opts)		((win)->_attrs = (((a) & ~A_COLOR) | COLOR_PAIR(p)), OK)
-#define wattr_get(win,a,p,opts)		((void)((a) != (void *)0 && (*(a) = (win)->_attrs)), \
-					 (void)((p) != (void *)0 && (*(p) = PAIR_NUMBER((win)->_attrs))), \
-					 OK)
-#endif
-#endif /* NCURSES_OPAQUE */
-
-/*
- * X/Open curses deprecates SVr4 vwprintw/vwscanw, which are supposed to use
- * varargs.h.  It adds new calls vw_printw/vw_scanw, which are supposed to
- * use POSIX stdarg.h.  The ncurses versions of vwprintw/vwscanw already
- * use stdarg.h, so...
- */
-#define vw_printw		vwprintw
-#define vw_scanw		vwscanw
-
-/*
- * Export fallback function for use in C++ binding.
- */
-#if !1
-#define vsscanf(a,b,c) _nc_vsscanf(a,b,c)
-NCURSES_EXPORT(int) vsscanf(const char *, const char *, va_list);
-#endif
-
-/*
- * These macros are extensions - not in X/Open Curses.
- */
-#if 1
-#if !NCURSES_OPAQUE
-#define is_cleared(win)		((win)->_clear)
-#define is_idcok(win)		((win)->_idcok)
-#define is_idlok(win)		((win)->_idlok)
-#define is_immedok(win)		((win)->_immed)
-#define is_keypad(win)		((win)->_use_keypad)
-#define is_leaveok(win)		((win)->_leaveok)
-#define is_nodelay(win)		((win)->_delay == 0)
-#define is_notimeout(win)	((win)->_notimeout)
-#define is_scrollok(win)	((win)->_scroll)
-#define is_syncok(win)		((win)->_sync)
-#define wgetparent(win)		((win) ? (win)->_parent : 0)
-#define wgetscrreg(win,t,b)	((win) ? (*(t) = (win)->_regtop, *(b) = (win)->_regbottom, OK) : ERR)
-#endif
-#endif
-
-#endif /* NCURSES_NOMACROS */
-
-/*
- * Public variables.
- *
- * Notes:
- *	a. ESCDELAY was an undocumented feature under AIX curses.
- *	   It gives the ESC expire time in milliseconds.
- *	b. ttytype is needed for backward compatibility
- */
-#if 0
-
-NCURSES_WRAPPED_VAR(WINDOW *, curscr);
-NCURSES_WRAPPED_VAR(WINDOW *, newscr);
-NCURSES_WRAPPED_VAR(WINDOW *, stdscr);
-NCURSES_WRAPPED_VAR(char *, ttytype);
-NCURSES_WRAPPED_VAR(int, COLORS);
-NCURSES_WRAPPED_VAR(int, COLOR_PAIRS);
-NCURSES_WRAPPED_VAR(int, COLS);
-NCURSES_WRAPPED_VAR(int, ESCDELAY);
-NCURSES_WRAPPED_VAR(int, LINES);
-NCURSES_WRAPPED_VAR(int, TABSIZE);
-
-#define curscr      NCURSES_PUBLIC_VAR(curscr())
-#define newscr      NCURSES_PUBLIC_VAR(newscr())
-#define stdscr      NCURSES_PUBLIC_VAR(stdscr())
-#define ttytype     NCURSES_PUBLIC_VAR(ttytype())
-#define COLORS      NCURSES_PUBLIC_VAR(COLORS())
-#define COLOR_PAIRS NCURSES_PUBLIC_VAR(COLOR_PAIRS())
-#define COLS        NCURSES_PUBLIC_VAR(COLS())
-#define ESCDELAY    NCURSES_PUBLIC_VAR(ESCDELAY())
-#define LINES       NCURSES_PUBLIC_VAR(LINES())
-#define TABSIZE     NCURSES_PUBLIC_VAR(TABSIZE())
-
-#else
-
-extern NCURSES_EXPORT_VAR(WINDOW *) curscr;
-extern NCURSES_EXPORT_VAR(WINDOW *) newscr;
-extern NCURSES_EXPORT_VAR(WINDOW *) stdscr;
-extern NCURSES_EXPORT_VAR(char) ttytype[];
-extern NCURSES_EXPORT_VAR(int) COLORS;
-extern NCURSES_EXPORT_VAR(int) COLOR_PAIRS;
-extern NCURSES_EXPORT_VAR(int) COLS;
-extern NCURSES_EXPORT_VAR(int) ESCDELAY;
-extern NCURSES_EXPORT_VAR(int) LINES;
-extern NCURSES_EXPORT_VAR(int) TABSIZE;
-
-#endif
-
-/*
- * Pseudo-character tokens outside ASCII range.  The curses wgetch() function
- * will return any given one of these only if the corresponding k- capability
- * is defined in your terminal's terminfo entry.
- *
- * Some keys (KEY_A1, etc) are arranged like this:
- *	a1     up    a3
- *	left   b2    right
- *	c1     down  c3
- *
- * A few key codes do not depend upon the terminfo entry.
- */
-#define KEY_CODE_YES	0400		/* A wchar_t contains a key code */
-#define KEY_MIN		0401		/* Minimum curses key */
-#define KEY_BREAK	0401		/* Break key (unreliable) */
-#define KEY_SRESET	0530		/* Soft (partial) reset (unreliable) */
-#define KEY_RESET	0531		/* Reset or hard reset (unreliable) */
diff --git a/include/curses.tail b/include/curses.tail
index aef7c37..5f911ae 100644
--- a/include/curses.tail
+++ b/include/curses.tail
@@ -1,4 +1,4 @@
-/* $Id: curses.tail,v 1.16 2008/07/05 20:20:38 tom Exp $ */
+/* $Id: curses.tail,v 1.21 2011/10/29 20:03:22 tom Exp $ */
 /*
  * vile:cmode:
  * This file is part of ncurses, designed to be appended after curses.h.in
@@ -94,13 +94,22 @@
 }
 MEVENT;
 
-extern NCURSES_EXPORT(int) getmouse (MEVENT *);
-extern NCURSES_EXPORT(int) ungetmouse (MEVENT *);
+extern NCURSES_EXPORT(bool)    has_mouse(void);
+extern NCURSES_EXPORT(int)     getmouse (MEVENT *);
+extern NCURSES_EXPORT(int)     ungetmouse (MEVENT *);
 extern NCURSES_EXPORT(mmask_t) mousemask (mmask_t, mmask_t *);
-extern NCURSES_EXPORT(bool) wenclose (const WINDOW *, int, int);
-extern NCURSES_EXPORT(int) mouseinterval (int);
-extern NCURSES_EXPORT(bool) wmouse_trafo (const WINDOW*, int*, int*, bool);
-extern NCURSES_EXPORT(bool) mouse_trafo (int*, int*, bool);              /* generated */
+extern NCURSES_EXPORT(bool)    wenclose (const WINDOW *, int, int);
+extern NCURSES_EXPORT(int)     mouseinterval (int);
+extern NCURSES_EXPORT(bool)    wmouse_trafo (const WINDOW*, int*, int*, bool);
+extern NCURSES_EXPORT(bool)    mouse_trafo (int*, int*, bool);              /* generated */
+
+#if NCURSES_SP_FUNCS
+extern NCURSES_EXPORT(bool)    NCURSES_SP_NAME(has_mouse) (SCREEN*);
+extern NCURSES_EXPORT(int)     NCURSES_SP_NAME(getmouse) (SCREEN*, MEVENT *);
+extern NCURSES_EXPORT(int)     NCURSES_SP_NAME(ungetmouse) (SCREEN*,MEVENT *);
+extern NCURSES_EXPORT(mmask_t) NCURSES_SP_NAME(mousemask) (SCREEN*, mmask_t, mmask_t *);
+extern NCURSES_EXPORT(int)     NCURSES_SP_NAME(mouseinterval) (SCREEN*, int);
+#endif
 
 #define mouse_trafo(y,x,to_screen) wmouse_trafo(stdscr,y,x,to_screen)
 
@@ -109,6 +118,11 @@
 extern NCURSES_EXPORT(int) mcprint (char *, int);	/* direct data to printer */
 extern NCURSES_EXPORT(int) has_key (int);		/* do we have given key? */
 
+#if NCURSES_SP_FUNCS
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(has_key) (SCREEN*, int);    /* do we have given key? */
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(mcprint) (SCREEN*, char *, int);	/* direct data to printer */
+#endif
+
 /* Debugging : use with libncurses_g.a */
 
 extern NCURSES_EXPORT(void) _tracef (const char *, ...) GCC_PRINTFLIKE(1,2);
@@ -119,7 +133,7 @@
 extern NCURSES_EXPORT(char *) _tracechar (int);
 extern NCURSES_EXPORT(char *) _tracechtype (chtype);
 extern NCURSES_EXPORT(char *) _tracechtype2 (int, chtype);
-#ifdef _XOPEN_SOURCE_EXTENDED
+#if NCURSES_WIDECHAR
 #define _tracech_t		_tracecchar_t
 extern NCURSES_EXPORT(char *) _tracecchar_t (const cchar_t *);
 #define _tracech_t2		_tracecchar_t2
@@ -160,6 +174,8 @@
 #define OPTIMIZE_ALL		0xff	/* enable all optimizations (dflt) */
 #endif
 
+#include <unctrl.h>
+
 #ifdef __cplusplus
 
 #ifndef NCURSES_NOMACROS
diff --git a/include/curses.wide b/include/curses.wide
index 0c799e4..5d130a9 100644
--- a/include/curses.wide
+++ b/include/curses.wide
@@ -1,14 +1,16 @@
-/* $Id: curses.wide,v 1.34 2007/03/10 17:52:23 tom Exp $ */
+/* $Id: curses.wide,v 1.46 2014/02/01 22:00:32 tom Exp $ */
 /*
  * vile:cmode:
  * This file is part of ncurses, designed to be appended after curses.h.in
  * (see that file for the relevant copyright).
  */
-#ifdef _XOPEN_SOURCE_EXTENDED
+#define _XOPEN_CURSES 1
+
+#if NCURSES_WIDECHAR
 
 extern NCURSES_EXPORT_VAR(cchar_t *) _nc_wacs;
 
-#define NCURSES_WACS(c)	(&_nc_wacs[(unsigned char)c])
+#define NCURSES_WACS(c)	(&_nc_wacs[NCURSES_CAST(unsigned char,(c))])
 
 #define WACS_BSSB	NCURSES_WACS('l')
 #define WACS_SSBB	NCURSES_WACS('m')
@@ -60,6 +62,56 @@
 #define WACS_NEQUAL	NCURSES_WACS('|') /* not equal */
 #define WACS_STERLING	NCURSES_WACS('}') /* UK pound sign */
 
+	/* double lines */
+#define WACS_BDDB	NCURSES_WACS('C')
+#define WACS_DDBB	NCURSES_WACS('D')
+#define WACS_BBDD	NCURSES_WACS('B')
+#define WACS_DBBD	NCURSES_WACS('A')
+#define WACS_DBDD	NCURSES_WACS('G')
+#define WACS_DDDB	NCURSES_WACS('F')
+#define WACS_DDBD	NCURSES_WACS('H')
+#define WACS_BDDD	NCURSES_WACS('I')
+#define WACS_BDBD	NCURSES_WACS('R')
+#define WACS_DBDB	NCURSES_WACS('Y')
+#define WACS_DDDD	NCURSES_WACS('E')
+
+#define WACS_D_ULCORNER	WACS_BDDB
+#define WACS_D_LLCORNER	WACS_DDBB
+#define WACS_D_URCORNER	WACS_BBDD
+#define WACS_D_LRCORNER	WACS_DBBD
+#define WACS_D_RTEE	WACS_DBDD
+#define WACS_D_LTEE	WACS_DDDB
+#define WACS_D_BTEE	WACS_DDBD
+#define WACS_D_TTEE	WACS_BDDD
+#define WACS_D_HLINE	WACS_BDBD
+#define WACS_D_VLINE	WACS_DBDB
+#define WACS_D_PLUS	WACS_DDDD
+
+	/* thick lines */
+#define WACS_BTTB	NCURSES_WACS('L')
+#define WACS_TTBB	NCURSES_WACS('M')
+#define WACS_BBTT	NCURSES_WACS('K')
+#define WACS_TBBT	NCURSES_WACS('J')
+#define WACS_TBTT	NCURSES_WACS('U')
+#define WACS_TTTB	NCURSES_WACS('T')
+#define WACS_TTBT	NCURSES_WACS('V')
+#define WACS_BTTT	NCURSES_WACS('W')
+#define WACS_BTBT	NCURSES_WACS('Q')
+#define WACS_TBTB	NCURSES_WACS('X')
+#define WACS_TTTT	NCURSES_WACS('N')
+
+#define WACS_T_ULCORNER	WACS_BTTB
+#define WACS_T_LLCORNER	WACS_TTBB
+#define WACS_T_URCORNER	WACS_BBTT
+#define WACS_T_LRCORNER	WACS_TBBT
+#define WACS_T_RTEE	WACS_TBTT
+#define WACS_T_LTEE	WACS_TTTB
+#define WACS_T_BTEE	WACS_TTBT
+#define WACS_T_TTEE	WACS_BTTT
+#define WACS_T_HLINE	WACS_BTBT
+#define WACS_T_VLINE	WACS_TBTB
+#define WACS_T_PLUS	WACS_TTTT
+
 /*
  * Function prototypes for wide-character operations.
  *
@@ -83,7 +135,7 @@
 extern NCURSES_EXPORT(int) get_wch (wint_t *);				/* generated:WIDEC */
 extern NCURSES_EXPORT(int) get_wstr (wint_t *);				/* generated:WIDEC */
 extern NCURSES_EXPORT(int) getbkgrnd (cchar_t *);			/* generated:WIDEC */
-extern NCURSES_EXPORT(int) getcchar (const cchar_t *, wchar_t*, attr_t*, short*, void*);	/* implemented */
+extern NCURSES_EXPORT(int) getcchar (const cchar_t *, wchar_t*, attr_t*, NCURSES_PAIRS_T*, void*);	/* implemented */
 extern NCURSES_EXPORT(int) getn_wstr (wint_t *, int);			/* generated:WIDEC */
 extern NCURSES_EXPORT(int) hline_set (const cchar_t *, int);		/* generated:WIDEC */
 extern NCURSES_EXPORT(int) in_wch (cchar_t *);				/* generated:WIDEC */
@@ -133,12 +185,12 @@
 extern NCURSES_EXPORT(int) mvwinwstr (WINDOW *, int, int, wchar_t *);		/* generated:WIDEC */
 extern NCURSES_EXPORT(int) mvwvline_set (WINDOW *, int,int, const cchar_t *,int); /* generated:WIDEC */
 extern NCURSES_EXPORT(int) pecho_wchar (WINDOW *, const cchar_t *);	/* implemented */
-extern NCURSES_EXPORT(int) setcchar (cchar_t *, const wchar_t *, const attr_t, short, const void *);	/* implemented */
+extern NCURSES_EXPORT(int) setcchar (cchar_t *, const wchar_t *, const attr_t, NCURSES_PAIRS_T, const void *);	/* implemented */
 extern NCURSES_EXPORT(int) slk_wset (int, const wchar_t *, int);	/* implemented */
 extern NCURSES_EXPORT(attr_t) term_attrs (void);			/* implemented */
 extern NCURSES_EXPORT(int) unget_wch (const wchar_t);			/* implemented */
-extern NCURSES_EXPORT(int) vid_attr (attr_t, short, void *);		/* implemented */
-extern NCURSES_EXPORT(int) vid_puts (attr_t, short, void *, int (*)(int)); /* implemented */
+extern NCURSES_EXPORT(int) vid_attr (attr_t, NCURSES_PAIRS_T, void *);		/* implemented */
+extern NCURSES_EXPORT(int) vid_puts (attr_t, NCURSES_PAIRS_T, void *, NCURSES_OUTC); /* implemented */
 extern NCURSES_EXPORT(int) vline_set (const cchar_t *, int);		/* generated:WIDEC */
 extern NCURSES_EXPORT(int) wadd_wch (WINDOW *,const cchar_t *);		/* implemented */
 extern NCURSES_EXPORT(int) wadd_wchnstr (WINDOW *,const cchar_t *,int);	/* implemented */
@@ -165,82 +217,90 @@
 extern NCURSES_EXPORT(wchar_t*) wunctrl (cchar_t *);			/* implemented */
 extern NCURSES_EXPORT(int) wvline_set (WINDOW *, const cchar_t *, int);	/* implemented */
 
+#if NCURSES_SP_FUNCS
+extern NCURSES_EXPORT(attr_t) NCURSES_SP_NAME(term_attrs) (SCREEN*);		/* implemented:SP_FUNC */
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(unget_wch) (SCREEN*, const wchar_t);	/* implemented:SP_FUNC */
+extern NCURSES_EXPORT(wchar_t*) NCURSES_SP_NAME(wunctrl) (SCREEN*, cchar_t *);	/* implemented:SP_FUNC */
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(vid_attr) (SCREEN*, attr_t, NCURSES_PAIRS_T, void *);	/* implemented:SP_FUNC */
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(vid_puts) (SCREEN*, attr_t, NCURSES_PAIRS_T, void *, NCURSES_SP_OUTC);	/* implemented:SP_FUNC */
+#endif
+
 #ifndef NCURSES_NOMACROS
 
 /*
  * XSI curses macros for XPG4 conformance.
  */
-#define add_wch(c)			wadd_wch(stdscr,c)
-#define add_wchnstr(str,n)		wadd_wchnstr(stdscr,str,n)
-#define add_wchstr(str)			wadd_wchstr(stdscr,str)
-#define addnwstr(wstr,n)		waddnwstr(stdscr,wstr,n)
-#define addwstr(wstr)			waddwstr(stdscr,wstr)
-#define bkgrnd(c)			wbkgrnd(stdscr,c)
-#define bkgrndset(c)			wbkgrndset(stdscr,c)
-#define border_set(l,r,t,b,tl,tr,bl,br) wborder_set(stdscr,l,r,t,b,tl,tr,bl,br)
-#define box_set(w,v,h)			wborder_set(w,v,v,h,h,0,0,0,0)
-#define echo_wchar(c)			wecho_wchar(stdscr,c)
-#define get_wch(c)			wget_wch(stdscr,c)
-#define get_wstr(t)			wget_wstr(stdscr,t)
-#define getbkgrnd(wch)			wgetbkgrnd(stdscr,wch)
-#define getn_wstr(t,n)			wgetn_wstr(stdscr,t,n)
-#define hline_set(c,n)			whline_set(stdscr,c,n)
-#define in_wch(c)			win_wch(stdscr,c)
-#define in_wchnstr(c,n)			win_wchnstr(stdscr,c,n)
-#define in_wchstr(c)			win_wchstr(stdscr,c)
-#define innwstr(c,n)			winnwstr(stdscr,c,n)
-#define ins_nwstr(t,n)			wins_nwstr(stdscr,t,n)
-#define ins_wch(c)			wins_wch(stdscr,c)
-#define ins_wstr(t)			wins_wstr(stdscr,t)
-#define inwstr(c)			winwstr(stdscr,c)
-#define vline_set(c,n)			wvline_set(stdscr,c,n)
-#define wadd_wchstr(win,str)		wadd_wchnstr(win,str,-1)
-#define waddwstr(win,wstr)		waddnwstr(win,wstr,-1)
-#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)
+#define add_wch(c)			wadd_wch(stdscr,(c))
+#define add_wchnstr(str,n)		wadd_wchnstr(stdscr,(str),(n))
+#define add_wchstr(str)			wadd_wchstr(stdscr,(str))
+#define addnwstr(wstr,n)		waddnwstr(stdscr,(wstr),(n))
+#define addwstr(wstr)			waddwstr(stdscr,(wstr))
+#define bkgrnd(c)			wbkgrnd(stdscr,(c))
+#define bkgrndset(c)			wbkgrndset(stdscr,(c))
+#define border_set(l,r,t,b,tl,tr,bl,br) wborder_set(stdscr,(l),(r),(t),(b),tl,tr,bl,br)
+#define box_set(w,v,h)			wborder_set((w),(v),(v),(h),(h),0,0,0,0)
+#define echo_wchar(c)			wecho_wchar(stdscr,(c))
+#define get_wch(c)			wget_wch(stdscr,(c))
+#define get_wstr(t)			wget_wstr(stdscr,(t))
+#define getbkgrnd(wch)			wgetbkgrnd(stdscr,(wch))
+#define getn_wstr(t,n)			wgetn_wstr(stdscr,(t),(n))
+#define hline_set(c,n)			whline_set(stdscr,(c),(n))
+#define in_wch(c)			win_wch(stdscr,(c))
+#define in_wchnstr(c,n)			win_wchnstr(stdscr,(c),(n))
+#define in_wchstr(c)			win_wchstr(stdscr,(c))
+#define innwstr(c,n)			winnwstr(stdscr,(c),(n))
+#define ins_nwstr(t,n)			wins_nwstr(stdscr,(t),(n))
+#define ins_wch(c)			wins_wch(stdscr,(c))
+#define ins_wstr(t)			wins_wstr(stdscr,(t))
+#define inwstr(c)			winwstr(stdscr,(c))
+#define vline_set(c,n)			wvline_set(stdscr,(c),(n))
+#define wadd_wchstr(win,str)		wadd_wchnstr((win),(str),-1)
+#define waddwstr(win,wstr)		waddnwstr((win),(wstr),-1)
+#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)
 
 #if !NCURSES_OPAQUE
-#define wgetbkgrnd(win,wch)		(*wch = win->_bkgrnd, OK)
+#define wgetbkgrnd(win,wch)		((win) ? (*(wch) = (win)->_bkgrnd) : *(wch), OK)
 #endif
 
-#define mvadd_wch(y,x,c)		mvwadd_wch(stdscr,y,x,c)
-#define mvadd_wchnstr(y,x,s,n)		mvwadd_wchnstr(stdscr,y,x,s,n)
-#define mvadd_wchstr(y,x,s)		mvwadd_wchstr(stdscr,y,x,s)
-#define mvaddnwstr(y,x,wstr,n)		mvwaddnwstr(stdscr,y,x,wstr,n)
-#define mvaddwstr(y,x,wstr)		mvwaddwstr(stdscr,y,x,wstr)
-#define mvget_wch(y,x,c)		mvwget_wch(stdscr,y,x,c)
-#define mvget_wstr(y,x,t)		mvwget_wstr(stdscr,y,x,t)
-#define mvgetn_wstr(y,x,t,n)		mvwgetn_wstr(stdscr,y,x,t,n)
-#define mvhline_set(y,x,c,n)		mvwhline_set(stdscr,y,x,c,n)
-#define mvin_wch(y,x,c)			mvwin_wch(stdscr,y,x,c)
-#define mvin_wchnstr(y,x,c,n)		mvwin_wchnstr(stdscr,y,x,c,n)
-#define mvin_wchstr(y,x,c)		mvwin_wchstr(stdscr,y,x,c)
-#define mvinnwstr(y,x,c,n)		mvwinnwstr(stdscr,y,x,c,n)
-#define mvins_nwstr(y,x,t,n)		mvwins_nwstr(stdscr,y,x,t,n)
-#define mvins_wch(y,x,c)		mvwins_wch(stdscr,y,x,c)
-#define mvins_wstr(y,x,t)		mvwins_wstr(stdscr,y,x,t)
-#define mvinwstr(y,x,c)			mvwinwstr(stdscr,y,x,c)
-#define mvvline_set(y,x,c,n)		mvwvline_set(stdscr,y,x,c,n)
+#define mvadd_wch(y,x,c)		mvwadd_wch(stdscr,(y),(x),(c))
+#define mvadd_wchnstr(y,x,s,n)		mvwadd_wchnstr(stdscr,(y),(x),(s),(n))
+#define mvadd_wchstr(y,x,s)		mvwadd_wchstr(stdscr,(y),(x),(s))
+#define mvaddnwstr(y,x,wstr,n)		mvwaddnwstr(stdscr,(y),(x),(wstr),(n))
+#define mvaddwstr(y,x,wstr)		mvwaddwstr(stdscr,(y),(x),(wstr))
+#define mvget_wch(y,x,c)		mvwget_wch(stdscr,(y),(x),(c))
+#define mvget_wstr(y,x,t)		mvwget_wstr(stdscr,(y),(x),(t))
+#define mvgetn_wstr(y,x,t,n)		mvwgetn_wstr(stdscr,(y),(x),(t),(n))
+#define mvhline_set(y,x,c,n)		mvwhline_set(stdscr,(y),(x),(c),(n))
+#define mvin_wch(y,x,c)			mvwin_wch(stdscr,(y),(x),(c))
+#define mvin_wchnstr(y,x,c,n)		mvwin_wchnstr(stdscr,(y),(x),(c),(n))
+#define mvin_wchstr(y,x,c)		mvwin_wchstr(stdscr,(y),(x),(c))
+#define mvinnwstr(y,x,c,n)		mvwinnwstr(stdscr,(y),(x),(c),(n))
+#define mvins_nwstr(y,x,t,n)		mvwins_nwstr(stdscr,(y),(x),(t),(n))
+#define mvins_wch(y,x,c)		mvwins_wch(stdscr,(y),(x),(c))
+#define mvins_wstr(y,x,t)		mvwins_wstr(stdscr,(y),(x),(t))
+#define mvinwstr(y,x,c)			mvwinwstr(stdscr,(y),(x),(c))
+#define mvvline_set(y,x,c,n)		mvwvline_set(stdscr,(y),(x),(c),(n))
 
-#define mvwadd_wch(win,y,x,c)		(wmove(win,y,x) == ERR ? ERR : wadd_wch(win,c))
-#define mvwadd_wchnstr(win,y,x,s,n)	(wmove(win,y,x) == ERR ? ERR : wadd_wchnstr(win,s,n))
-#define mvwadd_wchstr(win,y,x,s)	(wmove(win,y,x) == ERR ? ERR : wadd_wchstr(win,s))
-#define mvwaddnwstr(win,y,x,wstr,n)	(wmove(win,y,x) == ERR ? ERR : waddnwstr(win,wstr,n))
-#define mvwaddwstr(win,y,x,wstr)	(wmove(win,y,x) == ERR ? ERR : waddwstr(win,wstr))
-#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 : wget_wstr(win,t))
-#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))
-#define mvwin_wch(win,y,x,c)		(wmove(win,y,x) == ERR ? ERR : win_wch(win,c))
-#define mvwin_wchnstr(win,y,x,c,n)	(wmove(win,y,x) == ERR ? ERR : win_wchnstr(win,c,n))
-#define mvwin_wchstr(win,y,x,c)		(wmove(win,y,x) == ERR ? ERR : win_wchstr(win,c))
-#define mvwinnwstr(win,y,x,c,n)		(wmove(win,y,x) == ERR ? ERR : winnwstr(win,c,n))
-#define mvwins_nwstr(win,y,x,t,n)	(wmove(win,y,x) == ERR ? ERR : wins_nwstr(win,t,n))
-#define mvwins_wch(win,y,x,c)		(wmove(win,y,x) == ERR ? ERR : wins_wch(win,c))
-#define mvwins_wstr(win,y,x,t)		(wmove(win,y,x) == ERR ? ERR : wins_wstr(win,t))
-#define mvwinwstr(win,y,x,c)		(wmove(win,y,x) == ERR ? ERR : winwstr(win,c))
-#define mvwvline_set(win,y,x,c,n)	(wmove(win,y,x) == ERR ? ERR : wvline_set(win,c,n))
+#define mvwadd_wch(win,y,x,c)		(wmove(win,(y),(x)) == ERR ? ERR : wadd_wch((win),(c)))
+#define mvwadd_wchnstr(win,y,x,s,n)	(wmove(win,(y),(x)) == ERR ? ERR : wadd_wchnstr((win),(s),(n)))
+#define mvwadd_wchstr(win,y,x,s)	(wmove(win,(y),(x)) == ERR ? ERR : wadd_wchstr((win),(s)))
+#define mvwaddnwstr(win,y,x,wstr,n)	(wmove(win,(y),(x)) == ERR ? ERR : waddnwstr((win),(wstr),(n)))
+#define mvwaddwstr(win,y,x,wstr)	(wmove(win,(y),(x)) == ERR ? ERR : waddwstr((win),(wstr)))
+#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 : wget_wstr((win),(t)))
+#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)))
+#define mvwin_wch(win,y,x,c)		(wmove(win,(y),(x)) == ERR ? ERR : win_wch((win),(c)))
+#define mvwin_wchnstr(win,y,x,c,n)	(wmove(win,(y),(x)) == ERR ? ERR : win_wchnstr((win),(c),(n)))
+#define mvwin_wchstr(win,y,x,c)		(wmove(win,(y),(x)) == ERR ? ERR : win_wchstr((win),(c)))
+#define mvwinnwstr(win,y,x,c,n)		(wmove(win,(y),(x)) == ERR ? ERR : winnwstr((win),(c),(n)))
+#define mvwins_nwstr(win,y,x,t,n)	(wmove(win,(y),(x)) == ERR ? ERR : wins_nwstr((win),(t),(n)))
+#define mvwins_wch(win,y,x,c)		(wmove(win,(y),(x)) == ERR ? ERR : wins_wch((win),(c)))
+#define mvwins_wstr(win,y,x,t)		(wmove(win,(y),(x)) == ERR ? ERR : wins_wstr((win),(t)))
+#define mvwinwstr(win,y,x,c)		(wmove(win,(y),(x)) == ERR ? ERR : winwstr((win),(c)))
+#define mvwvline_set(win,y,x,c,n)	(wmove(win,(y),(x)) == ERR ? ERR : wvline_set((win),(c),(n)))
 
 #endif /* NCURSES_NOMACROS */
 
@@ -249,4 +309,4 @@
 extern NCURSES_EXPORT(const char *) _nc_viswibuf(const wint_t *);
 #endif
 
-#endif /* _XOPEN_SOURCE_EXTENDED */
+#endif /* NCURSES_WIDECHAR */
diff --git a/include/form.h b/include/form.h
deleted file mode 100644
index a4691a8..0000000
--- a/include/form.h
+++ /dev/null
@@ -1,403 +0,0 @@
-/****************************************************************************
- * Copyright (c) 1998-2003,2004 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:  Juergen Pfeifer, 1995,1997                                    *
- ****************************************************************************/
-
-/* $Id: form.h,v 0.20 2004/12/04 22:22:10 tom Exp $ */
-
-#ifndef FORM_H
-#define FORM_H
-
-#include <curses.h>
-#include <eti.h>
-
-#ifdef __cplusplus
-  extern "C" {
-#endif
-
-#ifndef FORM_PRIV_H
-typedef void *FIELD_CELL;
-#endif
-
-#ifndef NCURSES_FIELD_INTERNALS
-#define NCURSES_FIELD_INTERNALS /* nothing */
-#endif
-
-typedef int Form_Options;
-typedef int Field_Options;
-
-	/**********
-	*  _PAGE  *
-	**********/
-
-typedef struct {
-  short pmin;		/* index of first field on page			*/
-  short pmax;		/* index of last field on page			*/
-  short smin;		/* index of top leftmost field on page		*/
-  short smax;		/* index of bottom rightmost field on page	*/
-} _PAGE;
-
-	/**********
-	*  FIELD  *
-	**********/
-
-typedef struct fieldnode {
-  unsigned short	status;		/* flags			*/
-  short			rows;		/* size in rows			*/
-  short			cols;		/* size in cols			*/
-  short			frow;		/* first row			*/
-  short			fcol;		/* first col			*/
-  int			drows;		/* dynamic rows			*/
-  int			dcols;		/* dynamic cols			*/
-  int			maxgrow;	/* maximum field growth		*/
-  int			nrow;		/* off-screen rows		*/
-  short			nbuf;		/* additional buffers		*/
-  short			just;		/* justification		*/
-  short			page;		/* page on form			*/
-  short			index;		/* into form -> field		*/
-  int			pad;		/* pad character		*/
-  chtype		fore;		/* foreground attribute		*/
-  chtype		back;		/* background attribute		*/
-  Field_Options		opts;		/* options			*/
-  struct fieldnode *	snext;		/* sorted order pointer		*/
-  struct fieldnode *	sprev;		/* sorted order pointer		*/
-  struct fieldnode *	link;		/* linked field chain		*/
-  struct formnode *	form;		/* containing form		*/
-  struct typenode *	type;		/* field type			*/
-  void *		arg;		/* argument for type		*/
-  FIELD_CELL *		buf;		/* field buffers		*/
-  void *		usrptr;		/* user pointer			*/
-  /*
-   * The wide-character configuration requires extra information.  Because
-   * there are existing applications that manipulate the members of FIELD
-   * directly, we cannot make the struct opaque.  Offsets of members up to
-   * this point are the same in the narrow- and wide-character configuration.
-   * But note that the type of buf depends on the configuration, and is made
-   * opaque for that reason.
-   */
-  NCURSES_FIELD_INTERNALS
-} FIELD;
-
-	/**************
-	*  FIELDTYPE  *
-	**************/
-
-typedef struct typenode {
-  unsigned short	status;			/* flags		*/
-  long			ref;			/* reference count	*/
-  struct typenode *	left;			/* ptr to operand for | */
-  struct typenode *	right;			/* ptr to operand for | */
-
-  void* (*makearg)(va_list *);			/* make fieldtype arg	*/
-  void* (*copyarg)(const void *);		/* copy fieldtype arg	*/
-  void	(*freearg)(void *);			/* free fieldtype arg	*/
-
-  bool	(*fcheck)(FIELD *,const void *);	/* field validation	*/
-  bool	(*ccheck)(int,const void *);		/* character validation */
-
-  bool	(*next)(FIELD *,const void *);		/* enumerate next value */
-  bool	(*prev)(FIELD *,const void *);		/* enumerate prev value */
-
-} FIELDTYPE;
-
-	/*********
-	*  FORM  *
-	*********/
-
-typedef struct formnode {
-  unsigned short	status;		/* flags			*/
-  short			rows;		/* size in rows			*/
-  short			cols;		/* size in cols			*/
-  int			currow;		/* current row in field window	*/
-  int			curcol;		/* current col in field window	*/
-  int			toprow;		/* in scrollable field window	*/
-  int			begincol;	/* in horiz. scrollable field	*/
-  short			maxfield;	/* number of fields		*/
-  short			maxpage;	/* number of pages		*/
-  short			curpage;	/* index into page		*/
-  Form_Options		opts;		/* options			*/
-  WINDOW *		win;		/* window			*/
-  WINDOW *		sub;		/* subwindow			*/
-  WINDOW *		w;		/* window for current field	*/
-  FIELD **		field;		/* field [maxfield]		*/
-  FIELD *		current;	/* current field		*/
-  _PAGE *		page;		/* page [maxpage]		*/
-  void *		usrptr;		/* user pointer			*/
-
-  void			(*forminit)(struct formnode *);
-  void			(*formterm)(struct formnode *);
-  void			(*fieldinit)(struct formnode *);
-  void			(*fieldterm)(struct formnode *);
-
-} FORM;
-
-typedef void (*Form_Hook)(FORM *);
-
-	/***************************
-	*  miscellaneous #defines  *
-	***************************/
-
-/* field justification */
-#define NO_JUSTIFICATION	(0)
-#define JUSTIFY_LEFT		(1)
-#define JUSTIFY_CENTER		(2)
-#define JUSTIFY_RIGHT		(3)
-
-/* field options */
-#define O_VISIBLE		(0x0001U)
-#define O_ACTIVE		(0x0002U)
-#define O_PUBLIC		(0x0004U)
-#define O_EDIT			(0x0008U)
-#define O_WRAP			(0x0010U)
-#define O_BLANK			(0x0020U)
-#define O_AUTOSKIP		(0x0040U)
-#define O_NULLOK		(0x0080U)
-#define O_PASSOK		(0x0100U)
-#define O_STATIC		(0x0200U)
-
-/* form options */
-#define O_NL_OVERLOAD		(0x0001U)
-#define O_BS_OVERLOAD		(0x0002U)
-
-/* form driver commands */
-#define REQ_NEXT_PAGE	 (KEY_MAX + 1)	/* move to next page		*/
-#define REQ_PREV_PAGE	 (KEY_MAX + 2)	/* move to previous page	*/
-#define REQ_FIRST_PAGE	 (KEY_MAX + 3)	/* move to first page		*/
-#define REQ_LAST_PAGE	 (KEY_MAX + 4)	/* move to last page		*/
-
-#define REQ_NEXT_FIELD	 (KEY_MAX + 5)	/* move to next field		*/
-#define REQ_PREV_FIELD	 (KEY_MAX + 6)	/* move to previous field	*/
-#define REQ_FIRST_FIELD	 (KEY_MAX + 7)	/* move to first field		*/
-#define REQ_LAST_FIELD	 (KEY_MAX + 8)	/* move to last field		*/
-#define REQ_SNEXT_FIELD	 (KEY_MAX + 9)	/* move to sorted next field	*/
-#define REQ_SPREV_FIELD	 (KEY_MAX + 10)	/* move to sorted prev field	*/
-#define REQ_SFIRST_FIELD (KEY_MAX + 11)	/* move to sorted first field	*/
-#define REQ_SLAST_FIELD	 (KEY_MAX + 12)	/* move to sorted last field	*/
-#define REQ_LEFT_FIELD	 (KEY_MAX + 13)	/* move to left to field	*/
-#define REQ_RIGHT_FIELD	 (KEY_MAX + 14)	/* move to right to field	*/
-#define REQ_UP_FIELD	 (KEY_MAX + 15)	/* move to up to field		*/
-#define REQ_DOWN_FIELD	 (KEY_MAX + 16)	/* move to down to field	*/
-
-#define REQ_NEXT_CHAR	 (KEY_MAX + 17)	/* move to next char in field	*/
-#define REQ_PREV_CHAR	 (KEY_MAX + 18)	/* move to prev char in field	*/
-#define REQ_NEXT_LINE	 (KEY_MAX + 19)	/* move to next line in field	*/
-#define REQ_PREV_LINE	 (KEY_MAX + 20)	/* move to prev line in field	*/
-#define REQ_NEXT_WORD	 (KEY_MAX + 21)	/* move to next word in field	*/
-#define REQ_PREV_WORD	 (KEY_MAX + 22)	/* move to prev word in field	*/
-#define REQ_BEG_FIELD	 (KEY_MAX + 23)	/* move to first char in field	*/
-#define REQ_END_FIELD	 (KEY_MAX + 24)	/* move after last char in fld	*/
-#define REQ_BEG_LINE	 (KEY_MAX + 25)	/* move to beginning of line	*/
-#define REQ_END_LINE	 (KEY_MAX + 26)	/* move after last char in line	*/
-#define REQ_LEFT_CHAR	 (KEY_MAX + 27)	/* move left in field		*/
-#define REQ_RIGHT_CHAR	 (KEY_MAX + 28)	/* move right in field		*/
-#define REQ_UP_CHAR	 (KEY_MAX + 29)	/* move up in field		*/
-#define REQ_DOWN_CHAR	 (KEY_MAX + 30)	/* move down in field		*/
-
-#define REQ_NEW_LINE	 (KEY_MAX + 31)	/* insert/overlay new line	*/
-#define REQ_INS_CHAR	 (KEY_MAX + 32)	/* insert blank char at cursor	*/
-#define REQ_INS_LINE	 (KEY_MAX + 33)	/* insert blank line at cursor	*/
-#define REQ_DEL_CHAR	 (KEY_MAX + 34)	/* delete char at cursor	*/
-#define REQ_DEL_PREV	 (KEY_MAX + 35)	/* delete char before cursor	*/
-#define REQ_DEL_LINE	 (KEY_MAX + 36)	/* delete line at cursor	*/
-#define REQ_DEL_WORD	 (KEY_MAX + 37)	/* delete word at cursor	*/
-#define REQ_CLR_EOL	 (KEY_MAX + 38)	/* clear to end of line		*/
-#define REQ_CLR_EOF	 (KEY_MAX + 39)	/* clear to end of field	*/
-#define REQ_CLR_FIELD	 (KEY_MAX + 40)	/* clear entire field		*/
-#define REQ_OVL_MODE	 (KEY_MAX + 41)	/* begin overlay mode		*/
-#define REQ_INS_MODE	 (KEY_MAX + 42)	/* begin insert mode		*/
-#define REQ_SCR_FLINE	 (KEY_MAX + 43)	/* scroll field forward a line	*/
-#define REQ_SCR_BLINE	 (KEY_MAX + 44)	/* scroll field backward a line	*/
-#define REQ_SCR_FPAGE	 (KEY_MAX + 45)	/* scroll field forward a page	*/
-#define REQ_SCR_BPAGE	 (KEY_MAX + 46)	/* scroll field backward a page	*/
-#define REQ_SCR_FHPAGE	 (KEY_MAX + 47) /* scroll field forward	 half page */
-#define REQ_SCR_BHPAGE	 (KEY_MAX + 48) /* scroll field backward half page */
-#define REQ_SCR_FCHAR	 (KEY_MAX + 49) /* horizontal scroll char	*/
-#define REQ_SCR_BCHAR	 (KEY_MAX + 50) /* horizontal scroll char	*/
-#define REQ_SCR_HFLINE	 (KEY_MAX + 51) /* horizontal scroll line	*/
-#define REQ_SCR_HBLINE	 (KEY_MAX + 52) /* horizontal scroll line	*/
-#define REQ_SCR_HFHALF	 (KEY_MAX + 53) /* horizontal scroll half line	*/
-#define REQ_SCR_HBHALF	 (KEY_MAX + 54) /* horizontal scroll half line	*/
-
-#define REQ_VALIDATION	 (KEY_MAX + 55)	/* validate field		*/
-#define REQ_NEXT_CHOICE	 (KEY_MAX + 56)	/* display next field choice	*/
-#define REQ_PREV_CHOICE	 (KEY_MAX + 57)	/* display prev field choice	*/
-
-#define MIN_FORM_COMMAND (KEY_MAX + 1)	/* used by form_driver		*/
-#define MAX_FORM_COMMAND (KEY_MAX + 57)	/* used by form_driver		*/
-
-#if defined(MAX_COMMAND)
-#  if (MAX_FORM_COMMAND > MAX_COMMAND)
-#    error Something is wrong -- MAX_FORM_COMMAND is greater than MAX_COMMAND
-#  elif (MAX_COMMAND != (KEY_MAX + 128))
-#    error Something is wrong -- MAX_COMMAND is already inconsistently defined.
-#  endif
-#else
-#  define MAX_COMMAND (KEY_MAX + 128)
-#endif
-
-	/*************************
-	*  standard field types  *
-	*************************/
-extern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_ALPHA;
-extern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_ALNUM;
-extern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_ENUM;
-extern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_INTEGER;
-extern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_NUMERIC;
-extern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_REGEXP;
-
-	/************************************
-	*  built-in additional field types  *
-	*  They are not defined in SVr4     *
-	************************************/
-extern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_IPV4;      /* Internet IP Version 4 address */
-
-	/***********************
-	*   Default objects    *
-	***********************/
-extern NCURSES_EXPORT_VAR(FORM *)	_nc_Default_Form;
-extern NCURSES_EXPORT_VAR(FIELD *)	_nc_Default_Field;
-
-
-	/***********************
-	*  FIELDTYPE routines  *
-	***********************/
-extern NCURSES_EXPORT(FIELDTYPE *) new_fieldtype (
-		    bool (* const field_check)(FIELD *,const void *),
-		    bool (* const char_check)(int,const void *));
-extern NCURSES_EXPORT(FIELDTYPE *) link_fieldtype(
-		    FIELDTYPE *, FIELDTYPE *);
-
-extern NCURSES_EXPORT(int)	free_fieldtype (FIELDTYPE *);
-extern NCURSES_EXPORT(int)	set_fieldtype_arg (FIELDTYPE *,
-		    void * (* const make_arg)(va_list *),
-		    void * (* const copy_arg)(const void *),
-		    void (* const free_arg)(void *));
-extern NCURSES_EXPORT(int)	 set_fieldtype_choice (FIELDTYPE *,
-		    bool (* const next_choice)(FIELD *,const void *),
-	      	    bool (* const prev_choice)(FIELD *,const void *));
-
-	/*******************
-	*  FIELD routines  *
-	*******************/
-extern NCURSES_EXPORT(FIELD *)	new_field (int,int,int,int,int,int);
-extern NCURSES_EXPORT(FIELD *)	dup_field (FIELD *,int,int);
-extern NCURSES_EXPORT(FIELD *)	link_field (FIELD *,int,int);
-
-extern NCURSES_EXPORT(int)	free_field (FIELD *);
-extern NCURSES_EXPORT(int)	field_info (const FIELD *,int *,int *,int *,int *,int *,int *);
-extern NCURSES_EXPORT(int)	dynamic_field_info (const FIELD *,int *,int *,int *);
-extern NCURSES_EXPORT(int)	set_max_field ( FIELD *,int);
-extern NCURSES_EXPORT(int)	move_field (FIELD *,int,int);
-extern NCURSES_EXPORT(int)	set_field_type (FIELD *,FIELDTYPE *,...);
-extern NCURSES_EXPORT(int)	set_new_page (FIELD *,bool);
-extern NCURSES_EXPORT(int)	set_field_just (FIELD *,int);
-extern NCURSES_EXPORT(int)	field_just (const FIELD *);
-extern NCURSES_EXPORT(int)	set_field_fore (FIELD *,chtype);
-extern NCURSES_EXPORT(int)	set_field_back (FIELD *,chtype);
-extern NCURSES_EXPORT(int)	set_field_pad (FIELD *,int);
-extern NCURSES_EXPORT(int)	field_pad (const FIELD *);
-extern NCURSES_EXPORT(int)	set_field_buffer (FIELD *,int,const char *);
-extern NCURSES_EXPORT(int)	set_field_status (FIELD *,bool);
-extern NCURSES_EXPORT(int)	set_field_userptr (FIELD *, void *);
-extern NCURSES_EXPORT(int)	set_field_opts (FIELD *,Field_Options);
-extern NCURSES_EXPORT(int)	field_opts_on (FIELD *,Field_Options);
-extern NCURSES_EXPORT(int)	field_opts_off (FIELD *,Field_Options);
-
-extern NCURSES_EXPORT(chtype)	field_fore (const FIELD *);
-extern NCURSES_EXPORT(chtype)	field_back (const FIELD *);
-
-extern NCURSES_EXPORT(bool)	new_page (const FIELD *);
-extern NCURSES_EXPORT(bool)	field_status (const FIELD *);
-
-extern NCURSES_EXPORT(void *)	field_arg (const FIELD *);
-
-extern NCURSES_EXPORT(void *)	field_userptr (const FIELD *);
-
-extern NCURSES_EXPORT(FIELDTYPE *)	field_type (const FIELD *);
-
-extern NCURSES_EXPORT(char *)	field_buffer (const FIELD *,int);
-
-extern NCURSES_EXPORT(Field_Options)	field_opts (const FIELD *);
-
-	/******************
-	*  FORM routines  *
-	******************/
-
-extern NCURSES_EXPORT(FORM *)	new_form (FIELD **);
-
-extern NCURSES_EXPORT(FIELD **)	form_fields (const FORM *);
-extern NCURSES_EXPORT(FIELD *)	current_field (const FORM *);
-
-extern NCURSES_EXPORT(WINDOW *)	form_win (const FORM *);
-extern NCURSES_EXPORT(WINDOW *)	form_sub (const FORM *);
-
-extern NCURSES_EXPORT(Form_Hook)	form_init (const FORM *);
-extern NCURSES_EXPORT(Form_Hook)	form_term (const FORM *);
-extern NCURSES_EXPORT(Form_Hook)	field_init (const FORM *);
-extern NCURSES_EXPORT(Form_Hook)	field_term (const FORM *);
-
-extern NCURSES_EXPORT(int)	free_form (FORM *);
-extern NCURSES_EXPORT(int)	set_form_fields (FORM *,FIELD **);
-extern NCURSES_EXPORT(int)	field_count (const FORM *);
-extern NCURSES_EXPORT(int)	set_form_win (FORM *,WINDOW *);
-extern NCURSES_EXPORT(int)	set_form_sub (FORM *,WINDOW *);
-extern NCURSES_EXPORT(int)	set_current_field (FORM *,FIELD *);
-extern NCURSES_EXPORT(int)	field_index (const FIELD *);
-extern NCURSES_EXPORT(int)	set_form_page (FORM *,int);
-extern NCURSES_EXPORT(int)	form_page (const FORM *);
-extern NCURSES_EXPORT(int)	scale_form (const FORM *,int *,int *);
-extern NCURSES_EXPORT(int)	set_form_init (FORM *,Form_Hook);
-extern NCURSES_EXPORT(int)	set_form_term (FORM *,Form_Hook);
-extern NCURSES_EXPORT(int)	set_field_init (FORM *,Form_Hook);
-extern NCURSES_EXPORT(int)	set_field_term (FORM *,Form_Hook);
-extern NCURSES_EXPORT(int)	post_form (FORM *);
-extern NCURSES_EXPORT(int)	unpost_form (FORM *);
-extern NCURSES_EXPORT(int)	pos_form_cursor (FORM *);
-extern NCURSES_EXPORT(int)	form_driver (FORM *,int);
-extern NCURSES_EXPORT(int)	set_form_userptr (FORM *,void *);
-extern NCURSES_EXPORT(int)	set_form_opts (FORM *,Form_Options);
-extern NCURSES_EXPORT(int)	form_opts_on (FORM *,Form_Options);
-extern NCURSES_EXPORT(int)	form_opts_off (FORM *,Form_Options);
-extern NCURSES_EXPORT(int)	form_request_by_name (const char *);
-
-extern NCURSES_EXPORT(const char *)	form_request_name (int);
-
-extern NCURSES_EXPORT(void *)	form_userptr (const FORM *);
-
-extern NCURSES_EXPORT(Form_Options)	form_opts (const FORM *);
-
-extern NCURSES_EXPORT(bool)	data_ahead (const FORM *);
-extern NCURSES_EXPORT(bool)	data_behind (const FORM *);
-
-#ifdef __cplusplus
-  }
-#endif
-
-#endif	/* FORM_H */
diff --git a/include/hashed_db.h b/include/hashed_db.h
index 4dd3933..1ae29b0 100644
--- a/include/hashed_db.h
+++ b/include/hashed_db.h
@@ -31,7 +31,7 @@
  ****************************************************************************/
 
 /*
- * $Id: hashed_db.h,v 1.5 2006/08/19 15:58:34 tom Exp $
+ * $Id: hashed_db.h,v 1.6 2014/04/12 22:41:10 tom Exp $
  */
 
 #ifndef HASHED_DB_H
@@ -41,6 +41,8 @@
 
 #if USE_HASHED_DB
 
+#define DB_DBM_HSEARCH 0	/* quiet gcc -Wundef with db6 */
+
 #include <db.h>
 
 #ifndef DBN_SUFFIX
diff --git a/include/hashsize.h b/include/hashsize.h
deleted file mode 100644
index 478fd59..0000000
--- a/include/hashsize.h
+++ /dev/null
@@ -1,6 +0,0 @@
-/*
- * hashsize.h -- hash and token table constants
- */
-
-#define CAPTABSIZE	497
-#define HASHTABSIZE	(497 * 2)
diff --git a/include/headers b/include/headers
index a24bd90..2f20bed 100644
--- a/include/headers
+++ b/include/headers
@@ -1,6 +1,6 @@
-# $Id: headers,v 1.9 2007/01/20 19:57:04 Miroslav.Lichvar Exp $
+# $Id: headers,v 1.13 2013/10/20 00:32:21 tom Exp $
 ##############################################################################
-# Copyright (c) 1998-2006,2007 Free Software Foundation, Inc.                #
+# Copyright (c) 1998-2012,2013 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"), #
@@ -29,14 +29,24 @@
 #
 # Author: Thomas E. Dickey	1996-on
 #
-term.h
 curses.h
 unctrl.h
+ncurses_dll.h
+
+# Support for termcap (and tic, etc.), which can be a separate library
+@ termlib
+term.h
 termcap.h
-$(srcdir)/ncurses_dll.h
+
+# Headers used only for tic, other programs using internal interfaces
 @ ticlib
 $(srcdir)/tic.h
 $(srcdir)/term_entry.h
 $(srcdir)/nc_tparm.h
 
+# Porting
+@ port_win32con
+$(srcdir)/ncurses_mingw.h
+$(srcdir)/nc_mingw.h
+
 # vile:makemode
diff --git a/include/menu.h b/include/menu.h
deleted file mode 100644
index 84352eb..0000000
--- a/include/menu.h
+++ /dev/null
@@ -1,256 +0,0 @@
-/****************************************************************************
- * Copyright (c) 1998-2003,2007 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:  Juergen Pfeifer, 1995,1997                                    *
- ****************************************************************************/
-
-/* $Id: menu.h,v 1.19 2007/02/24 17:32:13 tom Exp $ */
-
-#ifndef ETI_MENU
-#define ETI_MENU
-
-#ifdef AMIGA
-#define TEXT TEXT_ncurses
-#endif
-
-#include <curses.h>
-#include <eti.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef int Menu_Options;
-typedef int Item_Options;
-
-/* Menu options: */
-#define O_ONEVALUE      (0x01)
-#define O_SHOWDESC      (0x02)
-#define O_ROWMAJOR      (0x04)
-#define O_IGNORECASE    (0x08)
-#define O_SHOWMATCH     (0x10)
-#define O_NONCYCLIC     (0x20)
-
-/* Item options: */
-#define O_SELECTABLE    (0x01)
-
-typedef struct
-{
-  const char* str;
-  unsigned short length;
-} TEXT;
-
-typedef struct tagITEM 
-{
-  TEXT           name;        /* name of menu item                         */
-  TEXT           description; /* description of item, optional in display  */ 
-  struct tagMENU *imenu;      /* Pointer to parent menu                    */
-  void           *userptr;    /* Pointer to user defined per item data     */ 
-  Item_Options   opt;         /* Item options                              */ 
-  short          index;       /* Item number if connected to a menu        */
-  short          y;           /* y and x location of item in menu          */
-  short          x;
-  bool           value;       /* Selection value                           */
-                             
-  struct tagITEM *left;       /* neighbor items                            */
-  struct tagITEM *right;
-  struct tagITEM *up;
-  struct tagITEM *down;
-
-} ITEM;
-
-typedef void (*Menu_Hook)(struct tagMENU *);
-
-typedef struct tagMENU 
-{
-  short          height;                /* Nr. of chars high               */
-  short          width;                 /* Nr. of chars wide               */
-  short          rows;                  /* Nr. of items high               */
-  short          cols;                  /* Nr. of items wide               */
-  short          frows;                 /* Nr. of formatted items high     */
-  short          fcols;                 /* Nr. of formatted items wide     */
-  short          arows;                 /* Nr. of items high (actual)      */
-  short          namelen;               /* Max. name length                */
-  short          desclen;               /* Max. description length         */
-  short          marklen;               /* Length of mark, if any          */
-  short          itemlen;               /* Length of one item              */
-  short          spc_desc;              /* Spacing for descriptor          */
-  short          spc_cols;              /* Spacing for columns             */
-  short          spc_rows;              /* Spacing for rows                */ 
-  char          *pattern;               /* Buffer to store match chars     */
-  short          pindex;                /* Index into pattern buffer       */
-  WINDOW        *win;                   /* Window containing menu          */
-  WINDOW        *sub;                   /* Subwindow for menu display      */
-  WINDOW        *userwin;               /* User's window                   */
-  WINDOW        *usersub;               /* User's subwindow                */
-  ITEM          **items;                /* array of items                  */ 
-  short          nitems;                /* Nr. of items in menu            */
-  ITEM          *curitem;               /* Current item                    */
-  short          toprow;                /* Top row of menu                 */
-  chtype         fore;                  /* Selection attribute             */
-  chtype         back;                  /* Nonselection attribute          */
-  chtype         grey;                  /* Inactive attribute              */
-  unsigned char  pad;                   /* Pad character                   */
-
-  Menu_Hook      menuinit;              /* User hooks                      */
-  Menu_Hook      menuterm;
-  Menu_Hook      iteminit;
-  Menu_Hook      itemterm;
-
-  void          *userptr;               /* Pointer to menus user data      */
-  char          *mark;                  /* Pointer to marker string        */
-
-  Menu_Options   opt;                   /* Menu options                    */
-  unsigned short status;                /* Internal state of menu          */
-
-} MENU;
-
-
-/* Define keys */
-
-#define REQ_LEFT_ITEM           (KEY_MAX + 1)
-#define REQ_RIGHT_ITEM          (KEY_MAX + 2)
-#define REQ_UP_ITEM             (KEY_MAX + 3)
-#define REQ_DOWN_ITEM           (KEY_MAX + 4)
-#define REQ_SCR_ULINE           (KEY_MAX + 5)
-#define REQ_SCR_DLINE           (KEY_MAX + 6)
-#define REQ_SCR_DPAGE           (KEY_MAX + 7)
-#define REQ_SCR_UPAGE           (KEY_MAX + 8)
-#define REQ_FIRST_ITEM          (KEY_MAX + 9)
-#define REQ_LAST_ITEM           (KEY_MAX + 10)
-#define REQ_NEXT_ITEM           (KEY_MAX + 11)
-#define REQ_PREV_ITEM           (KEY_MAX + 12)
-#define REQ_TOGGLE_ITEM         (KEY_MAX + 13)
-#define REQ_CLEAR_PATTERN       (KEY_MAX + 14)
-#define REQ_BACK_PATTERN        (KEY_MAX + 15)
-#define REQ_NEXT_MATCH          (KEY_MAX + 16)
-#define REQ_PREV_MATCH          (KEY_MAX + 17)
-
-#define MIN_MENU_COMMAND        (KEY_MAX + 1)
-#define MAX_MENU_COMMAND        (KEY_MAX + 17)
-
-/*
- * Some AT&T code expects MAX_COMMAND to be out-of-band not
- * just for menu commands but for forms ones as well.
- */
-#if defined(MAX_COMMAND)
-#  if (MAX_MENU_COMMAND > MAX_COMMAND)
-#    error Something is wrong -- MAX_MENU_COMMAND is greater than MAX_COMMAND
-#  elif (MAX_COMMAND != (KEY_MAX + 128))
-#    error Something is wrong -- MAX_COMMAND is already inconsistently defined.
-#  endif
-#else
-#  define MAX_COMMAND (KEY_MAX + 128)
-#endif
-
-
-/* --------- prototypes for libmenu functions ----------------------------- */
-
-extern NCURSES_EXPORT(ITEM **)	menu_items (const MENU *);
-extern NCURSES_EXPORT(ITEM *)	current_item (const MENU *);
-extern NCURSES_EXPORT(ITEM *)	new_item (const char *,const char *);
-
-extern NCURSES_EXPORT(MENU *)	new_menu (ITEM **);
-
-extern NCURSES_EXPORT(Item_Options)	item_opts (const ITEM *);
-extern NCURSES_EXPORT(Menu_Options)	menu_opts (const MENU *);
-
-extern NCURSES_EXPORT(Menu_Hook)	item_init (const MENU *);
-extern NCURSES_EXPORT(Menu_Hook)	item_term (const MENU *);
-extern NCURSES_EXPORT(Menu_Hook)	menu_init (const MENU *);
-extern NCURSES_EXPORT(Menu_Hook)	menu_term (const MENU *);
-
-extern NCURSES_EXPORT(WINDOW *)	menu_sub (const MENU *);
-extern NCURSES_EXPORT(WINDOW *)	menu_win (const MENU *);
-
-extern NCURSES_EXPORT(const char *)	item_description (const ITEM *);
-extern NCURSES_EXPORT(const char *)	item_name (const ITEM *);
-extern NCURSES_EXPORT(const char *)	menu_mark (const MENU *);
-extern NCURSES_EXPORT(const char *)	menu_request_name (int);
-
-extern NCURSES_EXPORT(char *)	menu_pattern (const MENU *);
-
-extern NCURSES_EXPORT(void *)	menu_userptr (const MENU *);
-extern NCURSES_EXPORT(void *)	item_userptr (const ITEM *);
-
-extern NCURSES_EXPORT(chtype)	menu_back (const MENU *);
-extern NCURSES_EXPORT(chtype)	menu_fore (const MENU *);
-extern NCURSES_EXPORT(chtype)	menu_grey (const MENU *);
-
-extern NCURSES_EXPORT(int)	free_item (ITEM *);
-extern NCURSES_EXPORT(int)	free_menu (MENU *);
-extern NCURSES_EXPORT(int)	item_count (const MENU *);
-extern NCURSES_EXPORT(int)	item_index (const ITEM *);
-extern NCURSES_EXPORT(int)	item_opts_off (ITEM *,Item_Options);
-extern NCURSES_EXPORT(int)	item_opts_on (ITEM *,Item_Options);
-extern NCURSES_EXPORT(int)	menu_driver (MENU *,int);
-extern NCURSES_EXPORT(int)	menu_opts_off (MENU *,Menu_Options);
-extern NCURSES_EXPORT(int)	menu_opts_on (MENU *,Menu_Options);
-extern NCURSES_EXPORT(int)	menu_pad (const MENU *);
-extern NCURSES_EXPORT(int)	pos_menu_cursor (const MENU *);
-extern NCURSES_EXPORT(int)	post_menu (MENU *);
-extern NCURSES_EXPORT(int)	scale_menu (const MENU *,int *,int *);
-extern NCURSES_EXPORT(int)	set_current_item (MENU *menu,ITEM *item);
-extern NCURSES_EXPORT(int)	set_item_init (MENU *, Menu_Hook);
-extern NCURSES_EXPORT(int)	set_item_opts (ITEM *,Item_Options);
-extern NCURSES_EXPORT(int)	set_item_term (MENU *, Menu_Hook);
-extern NCURSES_EXPORT(int)	set_item_userptr (ITEM *, void *);
-extern NCURSES_EXPORT(int)	set_item_value (ITEM *,bool);
-extern NCURSES_EXPORT(int)	set_menu_back (MENU *,chtype);
-extern NCURSES_EXPORT(int)	set_menu_fore (MENU *,chtype);
-extern NCURSES_EXPORT(int)	set_menu_format (MENU *,int,int);
-extern NCURSES_EXPORT(int)	set_menu_grey (MENU *,chtype);
-extern NCURSES_EXPORT(int)	set_menu_init (MENU *, Menu_Hook);
-extern NCURSES_EXPORT(int)	set_menu_items (MENU *,ITEM **);
-extern NCURSES_EXPORT(int)	set_menu_mark (MENU *, const char *);
-extern NCURSES_EXPORT(int)	set_menu_opts (MENU *,Menu_Options);
-extern NCURSES_EXPORT(int)	set_menu_pad (MENU *,int);
-extern NCURSES_EXPORT(int)	set_menu_pattern (MENU *,const char *);
-extern NCURSES_EXPORT(int)	set_menu_sub (MENU *,WINDOW *);
-extern NCURSES_EXPORT(int)	set_menu_term (MENU *, Menu_Hook);
-extern NCURSES_EXPORT(int)	set_menu_userptr (MENU *,void *);
-extern NCURSES_EXPORT(int)	set_menu_win (MENU *,WINDOW *);
-extern NCURSES_EXPORT(int)	set_top_row (MENU *,int);
-extern NCURSES_EXPORT(int)	top_row (const MENU *);
-extern NCURSES_EXPORT(int)	unpost_menu (MENU *);
-extern NCURSES_EXPORT(int)	menu_request_by_name (const char *);
-extern NCURSES_EXPORT(int)	set_menu_spacing (MENU *,int,int,int);
-extern NCURSES_EXPORT(int)	menu_spacing (const MENU *,int *,int *,int *);
-
-
-extern NCURSES_EXPORT(bool)	item_value (const ITEM *);
-extern NCURSES_EXPORT(bool)	item_visible (const ITEM *);
-
-extern NCURSES_EXPORT(void)	menu_format (const MENU *,int *,int *);
-
-#ifdef __cplusplus
-  }
-#endif
-
-#endif /* ETI_MENU */
diff --git a/include/mf_common.h b/include/mf_common.h
deleted file mode 100644
index 681672d..0000000
--- a/include/mf_common.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/****************************************************************************
- * Copyright (c) 1998-2003,2004 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:  Juergen Pfeifer, 1995,1997                                    *
- ****************************************************************************/
-
-/* $Id: mf_common.h,v 0.22 2005/11/26 15:26:52 tom Exp $ */
-
-/* Common internal header for menu and form library */
-
-#ifndef MF_COMMON_H_incl
-#define MF_COMMON_H_incl 1
-
-#include <ncurses_cfg.h>
-#include <curses.h>
-
-#include <stdlib.h>
-#include <sys/types.h>
-#include <assert.h>
-#include <string.h>
-#include <ctype.h>
-#include <errno.h>
-
-#if DECL_ERRNO
-extern int errno;
-#endif
-
-/* in case of debug version we ignore the suppression of assertions */
-#ifdef TRACE
-#  ifdef NDEBUG
-#    undef NDEBUG
-#  endif
-#endif
-
-#include <nc_alloc.h>
-
-#if USE_RCS_IDS
-#define MODULE_ID(id) static const char Ident[] = id;
-#else
-#define MODULE_ID(id) /*nothing*/
-#endif
-
-
-/* Maximum regular 8-bit character code */
-#define MAX_REGULAR_CHARACTER (0xff)
-
-#define SET_ERROR(code) (errno=(code))
-#define GET_ERROR()     (errno)
-
-#ifdef TRACE
-#define RETURN(code)    returnCode( SET_ERROR(code) )
-#else
-#define RETURN(code)    return( SET_ERROR(code) )
-#endif
-
-/* The few common values in the status fields for menus and forms */
-#define _POSTED         (0x01U)  /* menu or form is posted                  */
-#define _IN_DRIVER      (0x02U)  /* menu or form is processing hook routine */
-
-/* Call object hook */
-#define Call_Hook( object, handler ) \
-   if ( (object) != 0 && ((object)->handler) != (void *) 0 )\
-   {\
-	(object)->status |= _IN_DRIVER;\
-	(object)->handler(object);\
-	(object)->status &= ~_IN_DRIVER;\
-   }
-
-#endif /* MF_COMMON_H_incl */
diff --git a/include/nc_alloc.h b/include/nc_alloc.h
index f521bff..356f605 100644
--- a/include/nc_alloc.h
+++ b/include/nc_alloc.h
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2012,2013 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            *
@@ -29,16 +29,17 @@
 /****************************************************************************
  *  Author: Thomas E. Dickey                    1996-on                     *
  ****************************************************************************/
-/* $Id: nc_alloc.h,v 1.16 2008/09/27 22:30:33 tom Exp $ */
+/* $Id: nc_alloc.h,v 1.22 2013/01/26 21:56:51 tom Exp $ */
 
 #ifndef NC_ALLOC_included
 #define NC_ALLOC_included 1
+/* *INDENT-OFF* */
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-#if HAVE_LIBDMALLOC
+#if defined(HAVE_LIBDMALLOC) && HAVE_LIBDMALLOC
 #include <string.h>
 #undef strndup		/* workaround for #define in GLIBC 2.7 */
 #include <dmalloc.h>    /* Gray Watson's library */
@@ -47,14 +48,14 @@
 #define HAVE_LIBDMALLOC 0
 #endif
 
-#if HAVE_LIBDBMALLOC
+#if defined(HAVE_LIBDBMALLOC) && HAVE_LIBDBMALLOC
 #include <dbmalloc.h>   /* Conor Cahill's library */
 #else
 #undef  HAVE_LIBDBMALLOC
 #define HAVE_LIBDBMALLOC 0
 #endif
 
-#if HAVE_LIBMPATROL
+#if defined(HAVE_LIBMPATROL) && HAVE_LIBMPATROL
 #include <mpatrol.h>    /* Memory-Patrol library */
 #else
 #undef  HAVE_LIBMPATROL
@@ -74,9 +75,15 @@
 extern NCURSES_EXPORT(void) _nc_free_tparm(void);
 extern NCURSES_EXPORT(void) _nc_leaks_dump_entry(void);
 extern NCURSES_EXPORT(void) _nc_leaks_tic(void);
-#define ExitProgram(code) _nc_free_and_exit(code)
+
+#if NCURSES_SP_FUNCS
+extern NCURSES_EXPORT(void) NCURSES_SP_NAME(_nc_free_and_exit)(SCREEN*, int) GCC_NORETURN;
 #endif
 
+#define ExitProgram(code) _nc_free_and_exit(code)
+
+#endif /* NO_LEAKS, etc */
+
 #ifndef HAVE_NC_FREEALL
 #define HAVE_NC_FREEALL 0
 #endif
@@ -88,6 +95,7 @@
 /* doalloc.c */
 extern NCURSES_EXPORT(void *) _nc_doalloc(void *, size_t);
 #if !HAVE_STRDUP
+#undef strdup
 #define strdup _nc_strdup
 extern NCURSES_EXPORT(char *) _nc_strdup(const char *);
 #endif
@@ -95,12 +103,14 @@
 /* entries.c */
 extern NCURSES_EXPORT(void) _nc_leaks_tinfo(void);
 
-#define typeMalloc(type,elts) (type *)malloc((elts)*sizeof(type))
-#define typeCalloc(type,elts) (type *)calloc((elts),sizeof(type))
-#define typeRealloc(type,elts,ptr) (type *)_nc_doalloc(ptr, (elts)*sizeof(type))
+#define typeMalloc(type,elts) (type *)malloc((size_t)(elts)*sizeof(type))
+#define typeCalloc(type,elts) (type *)calloc((size_t)(elts),sizeof(type))
+#define typeRealloc(type,elts,ptr) (type *)_nc_doalloc(ptr, (size_t)(elts)*sizeof(type))
 
 #ifdef __cplusplus
 }
 #endif
 
+/* *INDENT-ON* */
+
 #endif /* NC_ALLOC_included */
diff --git a/include/unctrl.h b/include/nc_mingw.h
similarity index 71%
rename from include/unctrl.h
rename to include/nc_mingw.h
index 6adc216..3247003 100644
--- a/include/unctrl.h
+++ b/include/nc_mingw.h
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998,2000 Free Software Foundation, Inc.                   *
+ * Copyright (c) 2008-2009,2010 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            *
@@ -27,37 +27,43 @@
  ****************************************************************************/
 
 /****************************************************************************
- *  Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995               *
- *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
+ * Author: Thomas Dickey, 2008-on                                           * 
+ *                                                                          *
  ****************************************************************************/
 
-/*
- * unctrl.h
- *
- * Display a printable version of a control character.
- * Control characters are displayed in caret notation (^x), DELETE is displayed
- * as ^?. Printable characters are displayed as is.
- */
+/* $Id: nc_mingw.h,v 1.3 2010/09/25 22:16:12 juergen Exp $ */
 
-/* $Id: unctrl.h.in,v 1.10 2001/03/24 21:53:25 tom Exp $ */
+#ifndef NC_MINGW_H
+#define NC_MINGW_H 1
 
-#ifndef NCURSES_UNCTRL_H_incl
-#define NCURSES_UNCTRL_H_incl	1
-
-#undef  NCURSES_VERSION
-#define NCURSES_VERSION "5.7"
-
-#ifdef __cplusplus
-extern "C" {
+#ifdef WINVER
+#  if WINVER < 0x0501
+#    error WINVER must at least be 0x0501
+#  endif  
+#else
+#  define WINVER 0x0501
 #endif
+#include <windows.h>
 
-#include <curses.h>
+#undef sleep
+#define sleep(n) Sleep((n) * 1000)
 
-#undef unctrl
-NCURSES_EXPORT(NCURSES_CONST char *) unctrl (chtype);
+#undef gettimeofday
+#define gettimeofday(tv,tz) _nc_gettimeofday(tv,tz)
 
-#ifdef __cplusplus
-}
-#endif
+#include <sys/time.h>	/* for struct timeval */
 
-#endif /* NCURSES_UNCTRL_H_incl */
+extern int _nc_gettimeofday(struct timeval *, void *);
+
+#undef HAVE_GETTIMEOFDAY
+#define HAVE_GETTIMEOFDAY 1
+
+#define SIGHUP  1
+#define SIGKILL 9
+#define getlogin() "username"
+
+#undef wcwidth
+#define wcwidth(ucs) _nc_wcwidth(ucs)
+extern int _nc_wcwidth(wchar_t);
+
+#endif /* NC_MINGW_H */
diff --git a/include/nc_panel.h b/include/nc_panel.h
index 6578577..6a9ffea 100644
--- a/include/nc_panel.h
+++ b/include/nc_panel.h
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2000,2008 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2008,2009 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            *
@@ -31,9 +31,8 @@
  *     and: Thomas E. Dickey                                                *
  ****************************************************************************/
 
-
 /*
- * $Id: nc_panel.h,v 1.5 2008/08/04 18:26:46 tom Exp $
+ * $Id: nc_panel.h,v 1.7 2009/07/04 18:20:02 tom Exp $
  *
  *	nc_panel.h
  *
@@ -45,25 +44,33 @@
 #define NC_PANEL_H 1
 
 #ifdef __cplusplus
-extern "C" {
+extern "C"
+{
 #endif
 
-struct panel; /* Forward Declaration */
+  struct panel;			/* Forward Declaration */
 
-struct panelhook {
-  struct panel*   top_panel;
-  struct panel*   bottom_panel;
-  struct panel*   stdscr_pseudo_panel;
+  struct panelhook
+    {
+      struct panel *top_panel;
+      struct panel *bottom_panel;
+      struct panel *stdscr_pseudo_panel;
 #if NO_LEAKS
-  int (*destroy)(struct panel *);
+      int (*destroy) (struct panel *);
 #endif
-};
+    };
 
-/* Retrieve the panelhook of the current screen */
-extern NCURSES_EXPORT(struct panelhook*) _nc_panelhook (void);
+  struct screen;		/* Forward declaration */
+/* Retrieve the panelhook of the specified screen */
+  extern NCURSES_EXPORT(struct panelhook *)
+    _nc_panelhook (void);
+#if NCURSES_SP_FUNCS
+  extern NCURSES_EXPORT(struct panelhook *)
+    NCURSES_SP_NAME(_nc_panelhook) (SCREEN *);
+#endif
 
 #ifdef __cplusplus
 }
 #endif
 
-#endif /* NC_PANEL_H */
+#endif				/* NC_PANEL_H */
diff --git a/include/termcap.h b/include/nc_string.h
similarity index 62%
rename from include/termcap.h
rename to include/nc_string.h
index 68b0883..7e6ccd4 100644
--- a/include/termcap.h
+++ b/include/nc_string.h
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998,2000 Free Software Foundation, Inc.                   *
+ * Copyright (c) 2012,2013 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            *
@@ -27,49 +27,51 @@
  ****************************************************************************/
 
 /****************************************************************************
- *  Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995               *
- *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
+ *  Author: Thomas E. Dickey                        2012                    *
  ****************************************************************************/
 
-/* $Id: termcap.h.in,v 1.16 2001/03/24 21:53:27 tom Exp $ */
+#ifndef STRING_HACKS_H
+#define STRING_HACKS_H 1
 
-#ifndef NCURSES_TERMCAP_H_incl
-#define NCURSES_TERMCAP_H_incl	1
+#include <ncurses_cfg.h>
 
-#undef  NCURSES_VERSION
-#define NCURSES_VERSION "5.7"
-
-#include <ncurses_dll.h>
+/*
+ * $Id: nc_string.h,v 1.4 2013/12/15 01:09:19 tom Exp $
+ *
+ * String-hacks.  Use these macros to stifle warnings on (presumably) correct
+ * uses of strcat, strcpy and sprintf.
+ *
+ * By the way -
+ * A fundamental limitation of the interfaces (and frequent issue in bug
+ * reports using these functions) is that sizes are passed as unsigned values
+ * (with associated sign-extension problems), limiting their effectiveness
+ * when checking for buffer overflow.
+ */
 
 #ifdef __cplusplus
-extern "C"
-{
-#endif /* __cplusplus */
-
-#include <sys/types.h>
-
-#undef  NCURSES_CONST 
-#define NCURSES_CONST /*nothing*/ 
-
-#undef  NCURSES_OSPEED 
-#define NCURSES_OSPEED short 
-
-extern NCURSES_EXPORT_VAR(char) PC;
-extern NCURSES_EXPORT_VAR(char *) UP;
-extern NCURSES_EXPORT_VAR(char *) BC;
-extern NCURSES_EXPORT_VAR(NCURSES_OSPEED) ospeed; 
-
-#if !defined(NCURSES_TERM_H_incl)
-extern NCURSES_EXPORT(char *) tgetstr (NCURSES_CONST char *, char **);
-extern NCURSES_EXPORT(char *) tgoto (const char *, int, int);
-extern NCURSES_EXPORT(int) tgetent (char *, const char *);
-extern NCURSES_EXPORT(int) tgetflag (NCURSES_CONST char *);
-extern NCURSES_EXPORT(int) tgetnum (NCURSES_CONST char *);
-extern NCURSES_EXPORT(int) tputs (const char *, int, int (*)(int));
+#define NCURSES_VOID		/* nothing */
+#else
+#define NCURSES_VOID (void)
 #endif
 
-#ifdef __cplusplus
-}
+#if USE_STRING_HACKS && HAVE_STRLCAT
+#define _nc_STRCAT(d,s,n)	NCURSES_VOID strlcat((d),(s),NCURSES_CAST(size_t,n))
+#else
+#define _nc_STRCAT(d,s,n)	NCURSES_VOID strcat((d),(s))
 #endif
 
-#endif /* NCURSES_TERMCAP_H_incl */
+#if USE_STRING_HACKS && HAVE_STRLCPY
+#define _nc_STRCPY(d,s,n)	NCURSES_VOID strlcpy((d),(s),NCURSES_CAST(size_t,n))
+#else
+#define _nc_STRCPY(d,s,n)	NCURSES_VOID strcpy((d),(s))
+#endif
+
+#if USE_STRING_HACKS && HAVE_SNPRINTF
+#define _nc_SPRINTF             NCURSES_VOID snprintf
+#define _nc_SLIMIT(n)           NCURSES_CAST(size_t,n),
+#else
+#define _nc_SPRINTF             NCURSES_VOID sprintf
+#define _nc_SLIMIT(n)		/* nothing */
+#endif
+
+#endif /* STRING_HACKS_H */
diff --git a/include/nc_termios.h b/include/nc_termios.h
new file mode 100644
index 0000000..2217f07
--- /dev/null
+++ b/include/nc_termios.h
@@ -0,0 +1,161 @@
+/****************************************************************************
+ * Copyright (c) 2011,2014 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: Thomas E. Dickey                        2011                    *
+ ****************************************************************************/
+
+/* $Id: nc_termios.h,v 1.3 2014/05/03 19:40:10 juergen Exp $ */
+
+#ifndef NC_TERMIOS_included
+#define NC_TERMIOS_included 1
+
+#if HAVE_TERMIOS_H && HAVE_TCGETATTR
+
+#else /* !HAVE_TERMIOS_H */
+
+#if HAVE_TERMIO_H
+
+/* Add definitions to make termio look like termios.
+ * But ifdef it, since there are some implementations
+ * that try to do this for us in a fake <termio.h>.
+ */
+#ifndef TCSADRAIN
+#define TCSADRAIN TCSETAW
+#endif
+#ifndef TCSAFLUSH
+#define TCSAFLUSH TCSETAF
+#endif
+#ifndef tcsetattr
+#define tcsetattr(fd, cmd, arg) ioctl(fd, cmd, arg)
+#endif
+#ifndef tcgetattr
+#define tcgetattr(fd, arg) ioctl(fd, TCGETA, arg)
+#endif
+#ifndef cfgetospeed
+#define cfgetospeed(t) ((t)->c_cflag & CBAUD)
+#endif
+#ifndef TCIFLUSH
+#define TCIFLUSH 0
+#endif
+#ifndef tcflush
+#define tcflush(fd, arg) ioctl(fd, TCFLSH, arg)
+#endif
+
+#else /* !HAVE_TERMIO_H */
+
+#if __MINGW32__
+
+/* lflag bits */
+#define ISIG	0x0001
+#define ICANON	0x0002
+#define ECHO	0x0004
+#define ECHOE	0x0008
+#define ECHOK	0x0010
+#define ECHONL	0x0020
+#define NOFLSH	0x0040
+#define IEXTEN	0x0100
+
+#define VEOF	     4
+#define VERASE	     5
+#define VINTR	     6
+#define VKILL	     7
+#define VMIN	     9
+#define VQUIT	    10
+#define VTIME	    16
+
+/* iflag bits */
+#define IGNBRK	0x00001
+#define BRKINT	0x00002
+#define IGNPAR	0x00004
+#define INPCK	0x00010
+#define ISTRIP	0x00020
+#define INLCR	0x00040
+#define IGNCR	0x00080
+#define ICRNL	0x00100
+#define IXON	0x00400
+#define IXOFF	0x01000
+#define PARMRK	0x10000
+
+/* oflag bits */
+#define OPOST	0x00001
+
+/* cflag bits */
+#define CBAUD	 0x0100f
+#define B0	 0x00000
+#define B50	 0x00001
+#define B75	 0x00002
+#define B110	 0x00003
+#define B134	 0x00004
+#define B150	 0x00005
+#define B200	 0x00006
+#define B300	 0x00007
+#define B600	 0x00008
+#define B1200	 0x00009
+#define B1800	 0x0000a
+#define B2400	 0x0000b
+#define B4800	 0x0000c
+#define B9600	 0x0000d
+
+#define CSIZE	 0x00030
+#define CS8	 0x00030
+#define CSTOPB	 0x00040
+#define CREAD	 0x00080
+#define PARENB	 0x00100
+#define PARODD	 0x00200
+#define HUPCL	 0x00400
+#define CLOCAL	 0x00800
+
+#define TCIFLUSH	0
+#define TCSADRAIN	3
+
+#ifndef cfgetospeed
+#define cfgetospeed(t) ((t)->c_cflag & CBAUD)
+#endif
+
+#ifndef tcsetattr
+#define tcsetattr(fd, opt, arg) _nc_mingw_tcsetattr(fd, opt, arg)
+#endif
+
+#ifndef tcgetattr
+#define tcgetattr(fd, arg) _nc_mingw_tcgetattr(fd, arg)
+#endif
+
+#ifndef tcflush
+#define tcflush(fd, queue) _nc_mingw_tcflush(fd, queue)
+#endif
+
+#undef  ttyname
+#define ttyname(fd) NULL
+
+#endif /* __MINGW32__ */
+#endif /* HAVE_TERMIO_H */
+
+#endif /* HAVE_TERMIOS_H */
+
+#endif /* NC_TERMIOS_included */
diff --git a/include/nc_tparm.h b/include/nc_tparm.h
index d1d769b..248f6c0 100644
--- a/include/nc_tparm.h
+++ b/include/nc_tparm.h
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 2006 Free Software Foundation, Inc.                        *
+ * Copyright (c) 2006-2010,2012 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            *
@@ -30,13 +30,23 @@
  *  Author: Thomas E. Dickey                        2006                    *
  ****************************************************************************/
 
-/* $Id: nc_tparm.h,v 1.4 2006/11/26 00:49:25 tom Exp $ */
+/* $Id: nc_tparm.h,v 1.6 2012/02/18 21:34:42 tom Exp $ */
+
+#ifndef NC_TPARM_included
+#define NC_TPARM_included 1
 
 /*
  * Cast parameters past the formatting-string for tparm() to match the
  * assumption of the varargs code.
  */
+#ifndef TPARM_ARG
+#ifdef NCURSES_TPARM_ARG
+#define TPARM_ARG NCURSES_TPARM_ARG
+#else
 #define TPARM_ARG long
+#endif
+#endif /* TPARAM_ARG */
+
 #define TPARM_N(n) (TPARM_ARG)(n)
 
 #define TPARM_9(a,b,c,d,e,f,g,h,i,j) tparm(a,TPARM_N(b),TPARM_N(c),TPARM_N(d),TPARM_N(e),TPARM_N(f),TPARM_N(g),TPARM_N(h),TPARM_N(i),TPARM_N(j))
@@ -63,3 +73,5 @@
 #define TPARM_1(a,b) TPARM_2(a,b,0)
 #define TPARM_0(a) TPARM_1(a,0)
 #endif
+
+#endif /* NC_TPARM_included */
diff --git a/include/ncurses.h b/include/ncurses.h
deleted file mode 100644
index 19f2358..0000000
--- a/include/ncurses.h
+++ /dev/null
@@ -1,1505 +0,0 @@
-/****************************************************************************
- * Copyright (c) 1998-2007,2008 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>                         *
- *     and: Thomas E. Dickey                        1996-on                 *
- ****************************************************************************/
-
-/* $Id: curses.h.in,v 1.187 2008/08/30 20:11:29 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, some of the wide-character (enhanced) functionality is missing.
- * 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 5
-#define NCURSES_VERSION_MINOR 7
-#define NCURSES_VERSION_PATCH 20081102
-
-/* This is defined in more than one ncurses header, for identification */
-#undef  NCURSES_VERSION
-#define NCURSES_VERSION "5.7"
-
-/*
- * Identify the mouse encoding version.
- */
-#define NCURSES_MOUSE_VERSION 1
-
-/*
- * Definitions to facilitate DLL's.
- */
-#include <ncurses_dll.h>
-
-/*
- * User-definable tweak to disable the include of <stdbool.h>.
- */
-#ifndef NCURSES_ENABLE_STDBOOL_H
-#define NCURSES_ENABLE_STDBOOL_H 1
-#endif
-
-/*
- * NCURSES_ATTR_T is used to quiet compiler warnings when building ncurses
- * configured using --disable-macros.
- */
-#ifdef NCURSES_NOMACROS
-#ifndef NCURSES_ATTR_T
-#define NCURSES_ATTR_T attr_t
-#endif
-#endif /* NCURSES_NOMACROS */
-
-#ifndef NCURSES_ATTR_T
-#define NCURSES_ATTR_T int
-#endif
-
-/*
- * Expands to 'const' if ncurses is configured using --enable-const.  Note that
- * doing so makes it incompatible with other implementations of X/Open Curses.
- */
-#undef  NCURSES_CONST
-#define NCURSES_CONST /*nothing*/
-
-#undef NCURSES_INLINE
-#define NCURSES_INLINE inline
-
-/*
- * The internal type used for color values
- */
-#undef	NCURSES_COLOR_T
-#define	NCURSES_COLOR_T short
-
-/*
- * Definition used to make WINDOW and similar structs opaque.
- */
-#ifndef NCURSES_OPAQUE
-#define NCURSES_OPAQUE 0
-#endif
-
-/*
- * The internal type used for window dimensions.
- */
-#undef	NCURSES_SIZE_T
-#define	NCURSES_SIZE_T short
-
-/*
- * Control whether tparm() supports varargs or fixed-parameter list.
- */
-#undef NCURSES_TPARM_VARARGS
-#define NCURSES_TPARM_VARARGS 1
-
-/*
- * NCURSES_CH_T is used in building the library, but not used otherwise in
- * this header file, since that would make the normal/wide-character versions
- * of the header incompatible.
- */
-#undef	NCURSES_CH_T
-#define NCURSES_CH_T chtype
-
-#if 0 && defined(_LP64)
-typedef unsigned chtype;
-typedef unsigned mmask_t;
-#else
-typedef unsigned long chtype;
-typedef unsigned long mmask_t;
-#endif
-
-#include <stdio.h>
-#include <unctrl.h>
-#include <stdarg.h>	/* we need va_list */
-#ifdef _XOPEN_SOURCE_EXTENDED
-#include <stddef.h>	/* we want wchar_t */
-#endif /* _XOPEN_SOURCE_EXTENDED */
-
-/* X/Open 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.
- *
- * A further complication is that <stdbool.h> may declare 'bool' to be a
- * different type, such as an enum which is not necessarily compatible with
- * C++.  If we have <stdbool.h>, make 'bool' a macro, so users may #undef it.
- * Otherwise, let it remain a typedef to avoid conflicts with other #define's.
- * In either case, make a typedef for NCURSES_BOOL which can be used if needed
- * from either C or C++.
- */
-
-#undef TRUE
-#define TRUE    1
-
-#undef FALSE
-#define FALSE   0
-
-typedef unsigned NCURSES_BOOL;
-
-#if 0	/* __cplusplus, etc. */
-
-/* use the C++ compiler's bool type */
-#define NCURSES_BOOL bool
-
-#else			/* c89, c99, etc. */
-
-#if NCURSES_ENABLE_STDBOOL_H
-#include <stdbool.h>
-/* use whatever the C compiler decides bool really is */
-#define NCURSES_BOOL bool
-#else
-/* there is no predefined bool - use our own */
-#undef bool
-#define bool NCURSES_BOOL
-#endif
-
-#endif /* !__cplusplus, etc. */
-
-#ifdef __cplusplus
-extern "C" {
-#define NCURSES_CAST(type,value) static_cast<type>(value)
-#else
-#define NCURSES_CAST(type,value) (type)(value)
-#endif
-
-/*
- * X/Open attributes.  In the ncurses implementation, they are identical to the
- * A_ attributes.
- */
-#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 */
-#define COLOR_BLACK	0
-#define COLOR_RED	1
-#define COLOR_GREEN	2
-#define COLOR_YELLOW	3
-#define COLOR_BLUE	4
-#define COLOR_MAGENTA	5
-#define COLOR_CYAN	6
-#define COLOR_WHITE	7
-
-/* line graphics */
-
-#if 0 || 0
-NCURSES_WRAPPED_VAR(chtype*, acs_map);
-#define acs_map (_nc_acs_map())
-#else
-extern NCURSES_EXPORT_VAR(chtype) acs_map[];
-#endif
-
-#define NCURSES_ACS(c)	(acs_map[NCURSES_CAST(unsigned char,c)])
-
-/* VT100 symbols begin here */
-#define ACS_ULCORNER	NCURSES_ACS('l') /* upper left corner */
-#define ACS_LLCORNER	NCURSES_ACS('m') /* lower left corner */
-#define ACS_URCORNER	NCURSES_ACS('k') /* upper right corner */
-#define ACS_LRCORNER	NCURSES_ACS('j') /* lower right corner */
-#define ACS_LTEE	NCURSES_ACS('t') /* tee pointing right */
-#define ACS_RTEE	NCURSES_ACS('u') /* tee pointing left */
-#define ACS_BTEE	NCURSES_ACS('v') /* tee pointing up */
-#define ACS_TTEE	NCURSES_ACS('w') /* tee pointing down */
-#define ACS_HLINE	NCURSES_ACS('q') /* horizontal line */
-#define ACS_VLINE	NCURSES_ACS('x') /* vertical line */
-#define ACS_PLUS	NCURSES_ACS('n') /* large plus or crossover */
-#define ACS_S1		NCURSES_ACS('o') /* scan line 1 */
-#define ACS_S9		NCURSES_ACS('s') /* scan line 9 */
-#define ACS_DIAMOND	NCURSES_ACS('`') /* diamond */
-#define ACS_CKBOARD	NCURSES_ACS('a') /* checker board (stipple) */
-#define ACS_DEGREE	NCURSES_ACS('f') /* degree symbol */
-#define ACS_PLMINUS	NCURSES_ACS('g') /* plus/minus */
-#define ACS_BULLET	NCURSES_ACS('~') /* bullet */
-/* Teletype 5410v1 symbols begin here */
-#define ACS_LARROW	NCURSES_ACS(',') /* arrow pointing left */
-#define ACS_RARROW	NCURSES_ACS('+') /* arrow pointing right */
-#define ACS_DARROW	NCURSES_ACS('.') /* arrow pointing down */
-#define ACS_UARROW	NCURSES_ACS('-') /* arrow pointing up */
-#define ACS_BOARD	NCURSES_ACS('h') /* board of squares */
-#define ACS_LANTERN	NCURSES_ACS('i') /* lantern symbol */
-#define ACS_BLOCK	NCURSES_ACS('0') /* solid square block */
-/*
- * These aren't documented, but a lot of System Vs have them anyway
- * (you can spot pprryyzz{{||}} in a lot of AT&T terminfo strings).
- * The ACS_names may not match AT&T's, our source didn't know them.
- */
-#define ACS_S3		NCURSES_ACS('p') /* scan line 3 */
-#define ACS_S7		NCURSES_ACS('r') /* scan line 7 */
-#define ACS_LEQUAL	NCURSES_ACS('y') /* less/equal */
-#define ACS_GEQUAL	NCURSES_ACS('z') /* greater/equal */
-#define ACS_PI		NCURSES_ACS('{') /* Pi */
-#define ACS_NEQUAL	NCURSES_ACS('|') /* not equal */
-#define ACS_STERLING	NCURSES_ACS('}') /* UK pound sign */
-
-/*
- * Line drawing ACS names are of the form ACS_trbl, where t is the top, r
- * is the right, b is the bottom, and l is the left.  t, r, b, and l might
- * be B (blank), S (single), D (double), or T (thick).  The subset defined
- * here only uses B and S.
- */
-#define ACS_BSSB	ACS_ULCORNER
-#define ACS_SSBB	ACS_LLCORNER
-#define ACS_BBSS	ACS_URCORNER
-#define ACS_SBBS	ACS_LRCORNER
-#define ACS_SBSS	ACS_RTEE
-#define ACS_SSSB	ACS_LTEE
-#define ACS_SSBS	ACS_BTEE
-#define ACS_BSSS	ACS_TTEE
-#define ACS_BSBS	ACS_HLINE
-#define ACS_SBSB	ACS_VLINE
-#define ACS_SSSS	ACS_PLUS
-
-#undef	ERR
-#define ERR     (-1)
-
-#undef	OK
-#define OK      (0)
-
-/* values for the _flags member */
-#define _SUBWIN         0x01	/* is this a sub-window? */
-#define _ENDLINE        0x02	/* is the window flush right? */
-#define _FULLWIN        0x04	/* is the window full-screen? */
-#define _SCROLLWIN      0x08	/* bottom edge is at screen bottom? */
-#define _ISPAD	        0x10	/* is this window a pad? */
-#define _HASMOVED       0x20	/* has cursor moved since last refresh? */
-#define _WRAPPED        0x40	/* cursor was just wrappped */
-
-/*
- * this value is used in the firstchar and lastchar fields to mark
- * unchanged lines
- */
-#define _NOCHANGE       -1
-
-/*
- * this value is used in the oldindex field to mark lines created by insertions
- * and scrolls.
- */
-#define _NEWINDEX	-1
-
-typedef struct screen  SCREEN;
-typedef struct _win_st WINDOW;
-
-typedef	chtype	attr_t;		/* ...must be at least as wide as chtype */
-
-#ifdef _XOPEN_SOURCE_EXTENDED
-
-#if 0
-#ifdef mblen			/* libutf8.h defines it w/o undefining first */
-#undef mblen
-#endif
-#include <libutf8.h>
-#endif
-
-#if 0
-#include <wchar.h>		/* ...to get mbstate_t, etc. */
-#endif
-
-#if 0
-typedef unsigned short wchar_t;
-#endif
-
-#if 0
-typedef unsigned int wint_t;
-#endif
-
-#define CCHARW_MAX	5
-typedef struct
-{
-    attr_t	attr;
-    wchar_t	chars[CCHARW_MAX];
-#if 0
-#undef NCURSES_EXT_COLORS
-#define NCURSES_EXT_COLORS 20081102
-    int		ext_color;	/* color pair, must be more than 16-bits */
-#endif
-}
-cchar_t;
-
-#endif /* _XOPEN_SOURCE_EXTENDED */
-
-#if !NCURSES_OPAQUE
-struct ldat;
-
-struct _win_st
-{
-	NCURSES_SIZE_T _cury, _curx; /* current cursor position */
-
-	/* window location and size */
-	NCURSES_SIZE_T _maxy, _maxx; /* maximums of x and y, NOT window size */
-	NCURSES_SIZE_T _begy, _begx; /* screen coords of upper-left-hand corner */
-
-	short   _flags;		/* window state flags */
-
-	/* attribute tracking */
-	attr_t  _attrs;		/* current attribute for non-space character */
-	chtype  _bkgd;		/* current background char/attribute pair */
-
-	/* option values set by user */
-	bool	_notimeout;	/* no time out on function-key entry? */
-	bool	_clear;		/* consider all data in the window invalid? */
-	bool	_leaveok;	/* OK to not reset cursor on exit? */
-	bool	_scroll;	/* OK to scroll this window? */
-	bool	_idlok;		/* OK to use insert/delete line? */
-	bool	_idcok;		/* OK to use insert/delete char? */
-	bool	_immed;		/* window in immed mode? (not yet used) */
-	bool	_sync;		/* window in sync mode? */
-	bool	_use_keypad;	/* process function keys into KEY_ symbols? */
-	int	_delay;		/* 0 = nodelay, <0 = blocking, >0 = delay */
-
-	struct ldat *_line;	/* the actual line data */
-
-	/* global screen state */
-	NCURSES_SIZE_T _regtop;	/* top line of scrolling region */
-	NCURSES_SIZE_T _regbottom; /* bottom line of scrolling region */
-
-	/* these are used only if this is a sub-window */
-	int	_parx;		/* x coordinate of this window in parent */
-	int	_pary;		/* y coordinate of this window in parent */
-	WINDOW	*_parent;	/* pointer to parent if a sub-window */
-
-	/* these are used only if this is a pad */
-	struct pdat
-	{
-	    NCURSES_SIZE_T _pad_y,      _pad_x;
-	    NCURSES_SIZE_T _pad_top,    _pad_left;
-	    NCURSES_SIZE_T _pad_bottom, _pad_right;
-	} _pad;
-
-	NCURSES_SIZE_T _yoffset; /* real begy is _begy + _yoffset */
-
-#ifdef _XOPEN_SOURCE_EXTENDED
-	cchar_t  _bkgrnd;	/* current background char/attribute pair */
-#if 0
-	int	_color;		/* current color-pair for non-space character */
-#endif
-#endif
-};
-#endif /* NCURSES_OPAQUE */
-
-/*
- * This is an extension to support events...
- */
-#if 1
-#ifdef NCURSES_WGETCH_EVENTS
-#if !defined(__BEOS__) || defined(__HAIKU__)
-   /* Fix _nc_timed_wait() on BEOS... */
-#  define NCURSES_EVENT_VERSION	1
-#endif	/* !defined(__BEOS__) */
-
-/*
- * Bits to set in _nc_event.data.flags
- */
-#  define _NC_EVENT_TIMEOUT_MSEC	1
-#  define _NC_EVENT_FILE		2
-#  define _NC_EVENT_FILE_READABLE	2
-#  if 0					/* Not supported yet... */
-#    define _NC_EVENT_FILE_WRITABLE	4
-#    define _NC_EVENT_FILE_EXCEPTION	8
-#  endif
-
-typedef struct
-{
-    int type;
-    union
-    {
-	long timeout_msec;	/* _NC_EVENT_TIMEOUT_MSEC */
-	struct
-	{
-	    unsigned int flags;
-	    int fd;
-	    unsigned int result;
-	} fev;				/* _NC_EVENT_FILE */
-    } data;
-} _nc_event;
-
-typedef struct
-{
-    int count;
-    int result_flags;	/* _NC_EVENT_TIMEOUT_MSEC or _NC_EVENT_FILE_READABLE */
-    _nc_event *events[1];
-} _nc_eventlist;
-
-extern NCURSES_EXPORT(int) wgetch_events(WINDOW *, _nc_eventlist *);	/* experimental */
-extern NCURSES_EXPORT(int) wgetnstr_events(WINDOW *,char *,int,_nc_eventlist *);/* experimental */
-
-#endif /* NCURSES_WGETCH_EVENTS */
-#endif /* NCURSES_EXT_FUNCS */
-
-/*
- * 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.
- * Old versions of G++ do not accept it anyway, at least not consistently with
- * GCC.
- */
-#if !(defined(__GNUC__) || defined(__GNUG__) || defined(__attribute__))
-#define __attribute__(p) /* nothing */
-#endif
-
-/*
- * We cannot define these in ncurses_cfg.h, since they require parameters to be
- * passed (that is non-portable).  If you happen to be using gcc with warnings
- * enabled, define
- *	GCC_PRINTF
- *	GCC_SCANF
- * to improve checking of calls to printw(), etc.
- */
-#ifndef GCC_PRINTFLIKE
-#if defined(GCC_PRINTF) && !defined(printf)
-#define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var)))
-#else
-#define GCC_PRINTFLIKE(fmt,var) /*nothing*/
-#endif
-#endif
-
-#ifndef GCC_SCANFLIKE
-#if defined(GCC_SCANF) && !defined(scanf)
-#define GCC_SCANFLIKE(fmt,var)  __attribute__((format(scanf,fmt,var)))
-#else
-#define GCC_SCANFLIKE(fmt,var)  /*nothing*/
-#endif
-#endif
-
-#ifndef	GCC_NORETURN
-#define	GCC_NORETURN /* nothing */
-#endif
-
-#ifndef	GCC_UNUSED
-#define	GCC_UNUSED /* nothing */
-#endif
-
-/*
- * Function prototypes.  This is the complete X/Open Curses list of required
- * functions.  Those marked `generated' will have sources generated from the
- * macro definitions later in this file, in order to satisfy XPG4.2
- * requirements.
- */
-
-extern NCURSES_EXPORT(int) addch (const chtype);			/* generated */
-extern NCURSES_EXPORT(int) addchnstr (const chtype *, int);		/* generated */
-extern NCURSES_EXPORT(int) addchstr (const chtype *);			/* generated */
-extern NCURSES_EXPORT(int) addnstr (const char *, int);			/* generated */
-extern NCURSES_EXPORT(int) addstr (const char *);			/* generated */
-extern NCURSES_EXPORT(int) attroff (NCURSES_ATTR_T);			/* generated */
-extern NCURSES_EXPORT(int) attron (NCURSES_ATTR_T);			/* generated */
-extern NCURSES_EXPORT(int) attrset (NCURSES_ATTR_T);			/* generated */
-extern NCURSES_EXPORT(int) attr_get (attr_t *, short *, void *);	/* generated */
-extern NCURSES_EXPORT(int) attr_off (attr_t, void *);			/* generated */
-extern NCURSES_EXPORT(int) attr_on (attr_t, void *);			/* generated */
-extern NCURSES_EXPORT(int) attr_set (attr_t, short, void *);		/* generated */
-extern NCURSES_EXPORT(int) baudrate (void);				/* implemented */
-extern NCURSES_EXPORT(int) beep  (void);				/* implemented */
-extern NCURSES_EXPORT(int) bkgd (chtype);				/* generated */
-extern NCURSES_EXPORT(void) bkgdset (chtype);				/* generated */
-extern NCURSES_EXPORT(int) border (chtype,chtype,chtype,chtype,chtype,chtype,chtype,chtype);	/* generated */
-extern NCURSES_EXPORT(int) box (WINDOW *, chtype, chtype);		/* generated */
-extern NCURSES_EXPORT(bool) can_change_color (void);			/* implemented */
-extern NCURSES_EXPORT(int) cbreak (void);				/* implemented */
-extern NCURSES_EXPORT(int) chgat (int, attr_t, short, const void *);	/* generated */
-extern NCURSES_EXPORT(int) clear (void);				/* generated */
-extern NCURSES_EXPORT(int) clearok (WINDOW *,bool);			/* implemented */
-extern NCURSES_EXPORT(int) clrtobot (void);				/* generated */
-extern NCURSES_EXPORT(int) clrtoeol (void);				/* generated */
-extern NCURSES_EXPORT(int) color_content (short,short*,short*,short*);	/* implemented */
-extern NCURSES_EXPORT(int) color_set (short,void*);			/* generated */
-extern NCURSES_EXPORT(int) COLOR_PAIR (int);				/* generated */
-extern NCURSES_EXPORT(int) copywin (const WINDOW*,WINDOW*,int,int,int,int,int,int,int);	/* implemented */
-extern NCURSES_EXPORT(int) curs_set (int);				/* implemented */
-extern NCURSES_EXPORT(int) def_prog_mode (void);			/* implemented */
-extern NCURSES_EXPORT(int) def_shell_mode (void);			/* implemented */
-extern NCURSES_EXPORT(int) delay_output (int);				/* implemented */
-extern NCURSES_EXPORT(int) delch (void);				/* generated */
-extern NCURSES_EXPORT(void) delscreen (SCREEN *);			/* implemented */
-extern NCURSES_EXPORT(int) delwin (WINDOW *);				/* implemented */
-extern NCURSES_EXPORT(int) deleteln (void);				/* generated */
-extern NCURSES_EXPORT(WINDOW *) derwin (WINDOW *,int,int,int,int);	/* implemented */
-extern NCURSES_EXPORT(int) doupdate (void);				/* implemented */
-extern NCURSES_EXPORT(WINDOW *) dupwin (WINDOW *);			/* implemented */
-extern NCURSES_EXPORT(int) echo (void);					/* implemented */
-extern NCURSES_EXPORT(int) echochar (const chtype);			/* generated */
-extern NCURSES_EXPORT(int) erase (void);				/* generated */
-extern NCURSES_EXPORT(int) endwin (void);				/* implemented */
-extern NCURSES_EXPORT(char) erasechar (void);				/* implemented */
-extern NCURSES_EXPORT(void) filter (void);				/* implemented */
-extern NCURSES_EXPORT(int) flash (void);				/* implemented */
-extern NCURSES_EXPORT(int) flushinp (void);				/* implemented */
-extern NCURSES_EXPORT(chtype) getbkgd (WINDOW *);			/* generated */
-extern NCURSES_EXPORT(int) getch (void);				/* generated */
-extern NCURSES_EXPORT(int) getnstr (char *, int);			/* generated */
-extern NCURSES_EXPORT(int) getstr (char *);				/* generated */
-extern NCURSES_EXPORT(WINDOW *) getwin (FILE *);			/* implemented */
-extern NCURSES_EXPORT(int) halfdelay (int);				/* implemented */
-extern NCURSES_EXPORT(bool) has_colors (void);				/* implemented */
-extern NCURSES_EXPORT(bool) has_ic (void);				/* implemented */
-extern NCURSES_EXPORT(bool) has_il (void);				/* implemented */
-extern NCURSES_EXPORT(int) hline (chtype, int);				/* generated */
-extern NCURSES_EXPORT(void) idcok (WINDOW *, bool);			/* implemented */
-extern NCURSES_EXPORT(int) idlok (WINDOW *, bool);			/* implemented */
-extern NCURSES_EXPORT(void) immedok (WINDOW *, bool);			/* implemented */
-extern NCURSES_EXPORT(chtype) inch (void);				/* generated */
-extern NCURSES_EXPORT(int) inchnstr (chtype *, int);			/* generated */
-extern NCURSES_EXPORT(int) inchstr (chtype *);				/* generated */
-extern NCURSES_EXPORT(WINDOW *) initscr (void);				/* implemented */
-extern NCURSES_EXPORT(int) init_color (short,short,short,short);	/* implemented */
-extern NCURSES_EXPORT(int) init_pair (short,short,short);		/* implemented */
-extern NCURSES_EXPORT(int) innstr (char *, int);			/* generated */
-extern NCURSES_EXPORT(int) insch (chtype);				/* generated */
-extern NCURSES_EXPORT(int) insdelln (int);				/* generated */
-extern NCURSES_EXPORT(int) insertln (void);				/* generated */
-extern NCURSES_EXPORT(int) insnstr (const char *, int);			/* generated */
-extern NCURSES_EXPORT(int) insstr (const char *);			/* generated */
-extern NCURSES_EXPORT(int) instr (char *);				/* generated */
-extern NCURSES_EXPORT(int) intrflush (WINDOW *,bool);			/* implemented */
-extern NCURSES_EXPORT(bool) isendwin (void);				/* implemented */
-extern NCURSES_EXPORT(bool) is_linetouched (WINDOW *,int);		/* implemented */
-extern NCURSES_EXPORT(bool) is_wintouched (WINDOW *);			/* implemented */
-extern NCURSES_EXPORT(NCURSES_CONST char *) keyname (int);		/* implemented */
-extern NCURSES_EXPORT(int) keypad (WINDOW *,bool);			/* implemented */
-extern NCURSES_EXPORT(char) killchar (void);				/* implemented */
-extern NCURSES_EXPORT(int) leaveok (WINDOW *,bool);			/* implemented */
-extern NCURSES_EXPORT(char *) longname (void);				/* implemented */
-extern NCURSES_EXPORT(int) meta (WINDOW *,bool);			/* implemented */
-extern NCURSES_EXPORT(int) move (int, int);				/* generated */
-extern NCURSES_EXPORT(int) mvaddch (int, int, const chtype);		/* generated */
-extern NCURSES_EXPORT(int) mvaddchnstr (int, int, const chtype *, int);	/* generated */
-extern NCURSES_EXPORT(int) mvaddchstr (int, int, const chtype *);	/* generated */
-extern NCURSES_EXPORT(int) mvaddnstr (int, int, const char *, int);	/* generated */
-extern NCURSES_EXPORT(int) mvaddstr (int, int, const char *);		/* generated */
-extern NCURSES_EXPORT(int) mvchgat (int, int, int, attr_t, short, const void *);	/* generated */
-extern NCURSES_EXPORT(int) mvcur (int,int,int,int);			/* implemented */
-extern NCURSES_EXPORT(int) mvdelch (int, int);				/* generated */
-extern NCURSES_EXPORT(int) mvderwin (WINDOW *, int, int);		/* implemented */
-extern NCURSES_EXPORT(int) mvgetch (int, int);				/* generated */
-extern NCURSES_EXPORT(int) mvgetnstr (int, int, char *, int);		/* generated */
-extern NCURSES_EXPORT(int) mvgetstr (int, int, char *);			/* generated */
-extern NCURSES_EXPORT(int) mvhline (int, int, chtype, int);		/* generated */
-extern NCURSES_EXPORT(chtype) mvinch (int, int);			/* generated */
-extern NCURSES_EXPORT(int) mvinchnstr (int, int, chtype *, int);	/* generated */
-extern NCURSES_EXPORT(int) mvinchstr (int, int, chtype *);		/* generated */
-extern NCURSES_EXPORT(int) mvinnstr (int, int, char *, int);		/* generated */
-extern NCURSES_EXPORT(int) mvinsch (int, int, chtype);			/* generated */
-extern NCURSES_EXPORT(int) mvinsnstr (int, int, const char *, int);	/* generated */
-extern NCURSES_EXPORT(int) mvinsstr (int, int, const char *);		/* generated */
-extern NCURSES_EXPORT(int) mvinstr (int, int, char *);			/* generated */
-extern NCURSES_EXPORT(int) mvprintw (int,int, const char *,...)		/* implemented */
-		GCC_PRINTFLIKE(3,4);
-extern NCURSES_EXPORT(int) mvscanw (int,int, NCURSES_CONST char *,...)	/* implemented */
-		GCC_SCANFLIKE(3,4);
-extern NCURSES_EXPORT(int) mvvline (int, int, chtype, int);		/* generated */
-extern NCURSES_EXPORT(int) mvwaddch (WINDOW *, int, int, const chtype);	/* generated */
-extern NCURSES_EXPORT(int) mvwaddchnstr (WINDOW *, int, int, const chtype *, int);/* generated */
-extern NCURSES_EXPORT(int) mvwaddchstr (WINDOW *, int, int, const chtype *);	/* generated */
-extern NCURSES_EXPORT(int) mvwaddnstr (WINDOW *, int, int, const char *, int);	/* generated */
-extern NCURSES_EXPORT(int) mvwaddstr (WINDOW *, int, int, const char *);	/* generated */
-extern NCURSES_EXPORT(int) mvwchgat (WINDOW *, int, int, int, attr_t, short, const void *);/* generated */
-extern NCURSES_EXPORT(int) mvwdelch (WINDOW *, int, int);		/* generated */
-extern NCURSES_EXPORT(int) mvwgetch (WINDOW *, int, int);		/* generated */
-extern NCURSES_EXPORT(int) mvwgetnstr (WINDOW *, int, int, char *, int);	/* generated */
-extern NCURSES_EXPORT(int) mvwgetstr (WINDOW *, int, int, char *);	/* generated */
-extern NCURSES_EXPORT(int) mvwhline (WINDOW *, int, int, chtype, int);	/* generated */
-extern NCURSES_EXPORT(int) mvwin (WINDOW *,int,int);			/* implemented */
-extern NCURSES_EXPORT(chtype) mvwinch (WINDOW *, int, int);			/* generated */
-extern NCURSES_EXPORT(int) mvwinchnstr (WINDOW *, int, int, chtype *, int);	/* generated */
-extern NCURSES_EXPORT(int) mvwinchstr (WINDOW *, int, int, chtype *);		/* generated */
-extern NCURSES_EXPORT(int) mvwinnstr (WINDOW *, int, int, char *, int);		/* generated */
-extern NCURSES_EXPORT(int) mvwinsch (WINDOW *, int, int, chtype);		/* generated */
-extern NCURSES_EXPORT(int) mvwinsnstr (WINDOW *, int, int, const char *, int);	/* generated */
-extern NCURSES_EXPORT(int) mvwinsstr (WINDOW *, int, int, const char *);		/* generated */
-extern NCURSES_EXPORT(int) mvwinstr (WINDOW *, int, int, char *);		/* generated */
-extern NCURSES_EXPORT(int) mvwprintw (WINDOW*,int,int, const char *,...)	/* implemented */
-		GCC_PRINTFLIKE(4,5);
-extern NCURSES_EXPORT(int) mvwscanw (WINDOW *,int,int, NCURSES_CONST char *,...)	/* implemented */
-		GCC_SCANFLIKE(4,5);
-extern NCURSES_EXPORT(int) mvwvline (WINDOW *,int, int, chtype, int);	/* generated */
-extern NCURSES_EXPORT(int) napms (int);					/* implemented */
-extern NCURSES_EXPORT(WINDOW *) newpad (int,int);				/* implemented */
-extern NCURSES_EXPORT(SCREEN *) newterm (NCURSES_CONST char *,FILE *,FILE *);	/* implemented */
-extern NCURSES_EXPORT(WINDOW *) newwin (int,int,int,int);			/* implemented */
-extern NCURSES_EXPORT(int) nl (void);					/* implemented */
-extern NCURSES_EXPORT(int) nocbreak (void);				/* implemented */
-extern NCURSES_EXPORT(int) nodelay (WINDOW *,bool);			/* implemented */
-extern NCURSES_EXPORT(int) noecho (void);				/* implemented */
-extern NCURSES_EXPORT(int) nonl (void);					/* implemented */
-extern NCURSES_EXPORT(void) noqiflush (void);				/* implemented */
-extern NCURSES_EXPORT(int) noraw (void);				/* implemented */
-extern NCURSES_EXPORT(int) notimeout (WINDOW *,bool);			/* implemented */
-extern NCURSES_EXPORT(int) overlay (const WINDOW*,WINDOW *);		/* implemented */
-extern NCURSES_EXPORT(int) overwrite (const WINDOW*,WINDOW *);		/* implemented */
-extern NCURSES_EXPORT(int) pair_content (short,short*,short*);		/* implemented */
-extern NCURSES_EXPORT(int) PAIR_NUMBER (int);				/* generated */
-extern NCURSES_EXPORT(int) pechochar (WINDOW *, const chtype);		/* implemented */
-extern NCURSES_EXPORT(int) pnoutrefresh (WINDOW*,int,int,int,int,int,int);/* implemented */
-extern NCURSES_EXPORT(int) prefresh (WINDOW *,int,int,int,int,int,int);	/* implemented */
-extern NCURSES_EXPORT(int) printw (const char *,...)			/* implemented */
-		GCC_PRINTFLIKE(1,2);
-extern NCURSES_EXPORT(int) putwin (WINDOW *, FILE *);			/* implemented */
-extern NCURSES_EXPORT(void) qiflush (void);				/* implemented */
-extern NCURSES_EXPORT(int) raw (void);					/* implemented */
-extern NCURSES_EXPORT(int) redrawwin (WINDOW *);			/* generated */
-extern NCURSES_EXPORT(int) refresh (void);				/* generated */
-extern NCURSES_EXPORT(int) resetty (void);				/* implemented */
-extern NCURSES_EXPORT(int) reset_prog_mode (void);			/* implemented */
-extern NCURSES_EXPORT(int) reset_shell_mode (void);			/* implemented */
-extern NCURSES_EXPORT(int) ripoffline (int, int (*)(WINDOW *, int));	/* implemented */
-extern NCURSES_EXPORT(int) savetty (void);				/* implemented */
-extern NCURSES_EXPORT(int) scanw (NCURSES_CONST char *,...)		/* implemented */
-		GCC_SCANFLIKE(1,2);
-extern NCURSES_EXPORT(int) scr_dump (const char *);			/* implemented */
-extern NCURSES_EXPORT(int) scr_init (const char *);			/* implemented */
-extern NCURSES_EXPORT(int) scrl (int);					/* generated */
-extern NCURSES_EXPORT(int) scroll (WINDOW *);				/* generated */
-extern NCURSES_EXPORT(int) scrollok (WINDOW *,bool);			/* implemented */
-extern NCURSES_EXPORT(int) scr_restore (const char *);			/* implemented */
-extern NCURSES_EXPORT(int) scr_set (const char *);			/* implemented */
-extern NCURSES_EXPORT(int) setscrreg (int,int);				/* generated */
-extern NCURSES_EXPORT(SCREEN *) set_term (SCREEN *);			/* implemented */
-extern NCURSES_EXPORT(int) slk_attroff (const chtype);			/* implemented */
-extern NCURSES_EXPORT(int) slk_attr_off (const attr_t, void *);		/* generated:WIDEC */
-extern NCURSES_EXPORT(int) slk_attron (const chtype);			/* implemented */
-extern NCURSES_EXPORT(int) slk_attr_on (attr_t,void*);			/* generated:WIDEC */
-extern NCURSES_EXPORT(int) slk_attrset (const chtype);			/* implemented */
-extern NCURSES_EXPORT(attr_t) slk_attr (void);				/* implemented */
-extern NCURSES_EXPORT(int) slk_attr_set (const attr_t,short,void*);	/* implemented */
-extern NCURSES_EXPORT(int) slk_clear (void);				/* implemented */
-extern NCURSES_EXPORT(int) slk_color (short);				/* implemented */
-extern NCURSES_EXPORT(int) slk_init (int);				/* implemented */
-extern NCURSES_EXPORT(char *) slk_label (int);				/* implemented */
-extern NCURSES_EXPORT(int) slk_noutrefresh (void);			/* implemented */
-extern NCURSES_EXPORT(int) slk_refresh (void);				/* implemented */
-extern NCURSES_EXPORT(int) slk_restore (void);				/* implemented */
-extern NCURSES_EXPORT(int) slk_set (int,const char *,int);		/* implemented */
-extern NCURSES_EXPORT(int) slk_touch (void);				/* implemented */
-extern NCURSES_EXPORT(int) standout (void);				/* generated */
-extern NCURSES_EXPORT(int) standend (void);				/* generated */
-extern NCURSES_EXPORT(int) start_color (void);				/* implemented */
-extern NCURSES_EXPORT(WINDOW *) subpad (WINDOW *, int, int, int, int);	/* implemented */
-extern NCURSES_EXPORT(WINDOW *) subwin (WINDOW *, int, int, int, int);	/* implemented */
-extern NCURSES_EXPORT(int) syncok (WINDOW *, bool);			/* implemented */
-extern NCURSES_EXPORT(chtype) termattrs (void);				/* implemented */
-extern NCURSES_EXPORT(char *) termname (void);				/* implemented */
-extern NCURSES_EXPORT(void) timeout (int);				/* generated */
-extern NCURSES_EXPORT(int) touchline (WINDOW *, int, int);		/* generated */
-extern NCURSES_EXPORT(int) touchwin (WINDOW *);				/* generated */
-extern NCURSES_EXPORT(int) typeahead (int);				/* implemented */
-extern NCURSES_EXPORT(int) ungetch (int);				/* implemented */
-extern NCURSES_EXPORT(int) untouchwin (WINDOW *);			/* generated */
-extern NCURSES_EXPORT(void) use_env (bool);				/* implemented */
-extern NCURSES_EXPORT(int) vidattr (chtype);				/* implemented */
-extern NCURSES_EXPORT(int) vidputs (chtype, int (*)(int));		/* implemented */
-extern NCURSES_EXPORT(int) vline (chtype, int);				/* generated */
-extern NCURSES_EXPORT(int) vwprintw (WINDOW *, const char *,va_list);	/* implemented */
-extern NCURSES_EXPORT(int) vw_printw (WINDOW *, const char *,va_list);	/* generated */
-extern NCURSES_EXPORT(int) vwscanw (WINDOW *, NCURSES_CONST char *,va_list);	/* implemented */
-extern NCURSES_EXPORT(int) vw_scanw (WINDOW *, NCURSES_CONST char *,va_list);	/* generated */
-extern NCURSES_EXPORT(int) waddch (WINDOW *, const chtype);		/* implemented */
-extern NCURSES_EXPORT(int) waddchnstr (WINDOW *,const chtype *,int);	/* implemented */
-extern NCURSES_EXPORT(int) waddchstr (WINDOW *,const chtype *);		/* generated */
-extern NCURSES_EXPORT(int) waddnstr (WINDOW *,const char *,int);	/* implemented */
-extern NCURSES_EXPORT(int) waddstr (WINDOW *,const char *);		/* generated */
-extern NCURSES_EXPORT(int) wattron (WINDOW *, int);			/* generated */
-extern NCURSES_EXPORT(int) wattroff (WINDOW *, int);			/* generated */
-extern NCURSES_EXPORT(int) wattrset (WINDOW *, int);			/* generated */
-extern NCURSES_EXPORT(int) wattr_get (WINDOW *, attr_t *, short *, void *);	/* generated */
-extern NCURSES_EXPORT(int) wattr_on (WINDOW *, attr_t, void *);		/* implemented */
-extern NCURSES_EXPORT(int) wattr_off (WINDOW *, attr_t, void *);	/* implemented */
-extern NCURSES_EXPORT(int) wattr_set (WINDOW *, attr_t, short, void *);	/* generated */
-extern NCURSES_EXPORT(int) wbkgd (WINDOW *, chtype);			/* implemented */
-extern NCURSES_EXPORT(void) wbkgdset (WINDOW *,chtype);			/* implemented */
-extern NCURSES_EXPORT(int) wborder (WINDOW *,chtype,chtype,chtype,chtype,chtype,chtype,chtype,chtype);	/* implemented */
-extern NCURSES_EXPORT(int) wchgat (WINDOW *, int, attr_t, short, const void *);/* implemented */
-extern NCURSES_EXPORT(int) wclear (WINDOW *);				/* implemented */
-extern NCURSES_EXPORT(int) wclrtobot (WINDOW *);			/* implemented */
-extern NCURSES_EXPORT(int) wclrtoeol (WINDOW *);			/* implemented */
-extern NCURSES_EXPORT(int) wcolor_set (WINDOW*,short,void*);		/* implemented */
-extern NCURSES_EXPORT(void) wcursyncup (WINDOW *);			/* implemented */
-extern NCURSES_EXPORT(int) wdelch (WINDOW *);				/* implemented */
-extern NCURSES_EXPORT(int) wdeleteln (WINDOW *);			/* generated */
-extern NCURSES_EXPORT(int) wechochar (WINDOW *, const chtype);		/* implemented */
-extern NCURSES_EXPORT(int) werase (WINDOW *);				/* implemented */
-extern NCURSES_EXPORT(int) wgetch (WINDOW *);				/* implemented */
-extern NCURSES_EXPORT(int) wgetnstr (WINDOW *,char *,int);		/* implemented */
-extern NCURSES_EXPORT(int) wgetstr (WINDOW *, char *);			/* generated */
-extern NCURSES_EXPORT(int) whline (WINDOW *, chtype, int);		/* implemented */
-extern NCURSES_EXPORT(chtype) winch (WINDOW *);				/* implemented */
-extern NCURSES_EXPORT(int) winchnstr (WINDOW *, chtype *, int);		/* implemented */
-extern NCURSES_EXPORT(int) winchstr (WINDOW *, chtype *);		/* generated */
-extern NCURSES_EXPORT(int) winnstr (WINDOW *, char *, int);		/* implemented */
-extern NCURSES_EXPORT(int) winsch (WINDOW *, chtype);			/* implemented */
-extern NCURSES_EXPORT(int) winsdelln (WINDOW *,int);			/* implemented */
-extern NCURSES_EXPORT(int) winsertln (WINDOW *);			/* generated */
-extern NCURSES_EXPORT(int) winsnstr (WINDOW *, const char *,int);	/* implemented */
-extern NCURSES_EXPORT(int) winsstr (WINDOW *, const char *);		/* generated */
-extern NCURSES_EXPORT(int) winstr (WINDOW *, char *);			/* generated */
-extern NCURSES_EXPORT(int) wmove (WINDOW *,int,int);			/* implemented */
-extern NCURSES_EXPORT(int) wnoutrefresh (WINDOW *);			/* implemented */
-extern NCURSES_EXPORT(int) wprintw (WINDOW *, const char *,...)		/* implemented */
-		GCC_PRINTFLIKE(2,3);
-extern NCURSES_EXPORT(int) wredrawln (WINDOW *,int,int);		/* implemented */
-extern NCURSES_EXPORT(int) wrefresh (WINDOW *);				/* implemented */
-extern NCURSES_EXPORT(int) wscanw (WINDOW *, NCURSES_CONST char *,...)	/* implemented */
-		GCC_SCANFLIKE(2,3);
-extern NCURSES_EXPORT(int) wscrl (WINDOW *,int);			/* implemented */
-extern NCURSES_EXPORT(int) wsetscrreg (WINDOW *,int,int);		/* implemented */
-extern NCURSES_EXPORT(int) wstandout (WINDOW *);			/* generated */
-extern NCURSES_EXPORT(int) wstandend (WINDOW *);			/* generated */
-extern NCURSES_EXPORT(void) wsyncdown (WINDOW *);			/* implemented */
-extern NCURSES_EXPORT(void) wsyncup (WINDOW *);				/* implemented */
-extern NCURSES_EXPORT(void) wtimeout (WINDOW *,int);			/* implemented */
-extern NCURSES_EXPORT(int) wtouchln (WINDOW *,int,int,int);		/* implemented */
-extern NCURSES_EXPORT(int) wvline (WINDOW *,chtype,int);		/* implemented */
-
-/*
- * These are also declared in <term.h>:
- */
-extern NCURSES_EXPORT(int) tigetflag (NCURSES_CONST char *);		/* implemented */
-extern NCURSES_EXPORT(int) tigetnum (NCURSES_CONST char *);		/* implemented */
-extern NCURSES_EXPORT(char *) tigetstr (NCURSES_CONST char *);		/* implemented */
-extern NCURSES_EXPORT(int) putp (const char *);				/* implemented */
-
-#if NCURSES_TPARM_VARARGS
-extern NCURSES_EXPORT(char *) tparm (NCURSES_CONST char *, ...);	/* special */
-#else
-extern NCURSES_EXPORT(char *) tparm (NCURSES_CONST char *, long,long,long,long,long,long,long,long,long);	/* special */
-extern NCURSES_EXPORT(char *) tparm_varargs (NCURSES_CONST char *, ...);	/* special */
-#endif
-
-/*
- * These functions are not in X/Open, but we use them in macro definitions:
- */
-extern NCURSES_EXPORT(int) getattrs (const WINDOW *);			/* generated */
-extern NCURSES_EXPORT(int) getcurx (const WINDOW *);			/* generated */
-extern NCURSES_EXPORT(int) getcury (const WINDOW *);			/* generated */
-extern NCURSES_EXPORT(int) getbegx (const WINDOW *);			/* generated */
-extern NCURSES_EXPORT(int) getbegy (const WINDOW *);			/* generated */
-extern NCURSES_EXPORT(int) getmaxx (const WINDOW *);			/* generated */
-extern NCURSES_EXPORT(int) getmaxy (const WINDOW *);			/* generated */
-extern NCURSES_EXPORT(int) getparx (const WINDOW *);			/* generated */
-extern NCURSES_EXPORT(int) getpary (const WINDOW *);			/* generated */
-
-/*
- * vid_attr() was implemented originally based on a draft of X/Open curses.
- */
-#ifndef _XOPEN_SOURCE_EXTENDED
-#define vid_attr(a,pair,opts) vidattr(a)
-#endif
-
-/*
- * These functions are extensions - not in X/Open Curses.
- */
-#if 1
-#undef  NCURSES_EXT_FUNCS
-#define NCURSES_EXT_FUNCS 20081102
-typedef int (*NCURSES_WINDOW_CB)(WINDOW *, void *);
-typedef int (*NCURSES_SCREEN_CB)(SCREEN *, void *);
-extern NCURSES_EXPORT(bool) is_term_resized (int, int);
-extern NCURSES_EXPORT(char *) keybound (int, int);
-extern NCURSES_EXPORT(const char *) curses_version (void);
-extern NCURSES_EXPORT(int) assume_default_colors (int, int);
-extern NCURSES_EXPORT(int) define_key (const char *, int);
-extern NCURSES_EXPORT(int) key_defined (const char *);
-extern NCURSES_EXPORT(int) keyok (int, bool);
-extern NCURSES_EXPORT(int) resize_term (int, int);
-extern NCURSES_EXPORT(int) resizeterm (int, int);
-extern NCURSES_EXPORT(int) set_escdelay (int);
-extern NCURSES_EXPORT(int) set_tabsize (int);
-extern NCURSES_EXPORT(int) use_default_colors (void);
-extern NCURSES_EXPORT(int) use_extended_names (bool);
-extern NCURSES_EXPORT(int) use_legacy_coding (int);
-extern NCURSES_EXPORT(int) use_screen (SCREEN *, NCURSES_SCREEN_CB, void *);
-extern NCURSES_EXPORT(int) use_window (WINDOW *, NCURSES_WINDOW_CB, void *);
-extern NCURSES_EXPORT(int) wresize (WINDOW *, int, int);
-extern NCURSES_EXPORT(void) nofilter(void);
-
-/*
- * These extensions provide access to information stored in the WINDOW even
- * when NCURSES_OPAQUE is set:
- */
-extern NCURSES_EXPORT(WINDOW *) wgetparent (const WINDOW *);	/* generated */
-extern NCURSES_EXPORT(bool) is_cleared (const WINDOW *);	/* generated */
-extern NCURSES_EXPORT(bool) is_idcok (const WINDOW *);		/* generated */
-extern NCURSES_EXPORT(bool) is_idlok (const WINDOW *);		/* generated */
-extern NCURSES_EXPORT(bool) is_immedok (const WINDOW *);	/* generated */
-extern NCURSES_EXPORT(bool) is_keypad (const WINDOW *);		/* generated */
-extern NCURSES_EXPORT(bool) is_leaveok (const WINDOW *);	/* generated */
-extern NCURSES_EXPORT(bool) is_nodelay (const WINDOW *);	/* generated */
-extern NCURSES_EXPORT(bool) is_notimeout (const WINDOW *);	/* generated */
-extern NCURSES_EXPORT(bool) is_scrollok (const WINDOW *);	/* generated */
-extern NCURSES_EXPORT(bool) is_syncok (const WINDOW *);		/* generated */
-extern NCURSES_EXPORT(int) wgetscrreg (const WINDOW *, int *, int *); /* generated */
-
-#else
-#define curses_version() NCURSES_VERSION
-#endif
-
-/* attributes */
-
-#define NCURSES_ATTR_SHIFT       8
-#define NCURSES_BITS(mask,shift) ((mask) << ((shift) + NCURSES_ATTR_SHIFT))
-
-#define A_NORMAL	(1UL - 1UL)
-#define A_ATTRIBUTES	NCURSES_BITS(~(1UL - 1UL),0)
-#define A_CHARTEXT	(NCURSES_BITS(1UL,0) - 1UL)
-#define A_COLOR		NCURSES_BITS(((1UL) << 8) - 1UL,0)
-#define A_STANDOUT	NCURSES_BITS(1UL,8)
-#define A_UNDERLINE	NCURSES_BITS(1UL,9)
-#define A_REVERSE	NCURSES_BITS(1UL,10)
-#define A_BLINK		NCURSES_BITS(1UL,11)
-#define A_DIM		NCURSES_BITS(1UL,12)
-#define A_BOLD		NCURSES_BITS(1UL,13)
-#define A_ALTCHARSET	NCURSES_BITS(1UL,14)
-#define A_INVIS		NCURSES_BITS(1UL,15)
-#define A_PROTECT	NCURSES_BITS(1UL,16)
-#define A_HORIZONTAL	NCURSES_BITS(1UL,17)
-#define A_LEFT		NCURSES_BITS(1UL,18)
-#define A_LOW		NCURSES_BITS(1UL,19)
-#define A_RIGHT		NCURSES_BITS(1UL,20)
-#define A_TOP		NCURSES_BITS(1UL,21)
-#define A_VERTICAL	NCURSES_BITS(1UL,22)
-
-/*
- * Most of the pseudo functions are macros that either provide compatibility
- * with older versions of curses, or provide inline functionality to improve
- * performance.
- */
-
-/*
- * These pseudo functions are always implemented as macros:
- */
-
-#define getyx(win,y,x)   	(y = getcury(win), x = getcurx(win))
-#define getbegyx(win,y,x)	(y = getbegy(win), x = getbegx(win))
-#define getmaxyx(win,y,x)	(y = getmaxy(win), x = getmaxx(win))
-#define getparyx(win,y,x)	(y = getpary(win), x = getparx(win))
-
-#define getsyx(y,x) do { if (newscr) { \
-			     if (is_leaveok(newscr)) \
-				(y) = (x) = -1; \
-			     else \
-				 getyx(newscr,(y), (x)); \
-			} \
-		    } while(0)
-
-#define setsyx(y,x) do { if (newscr) { \
-			    if ((y) == -1 && (x) == -1) \
-				leaveok(newscr, TRUE); \
-			    else { \
-				leaveok(newscr, FALSE); \
-				wmove(newscr, (y), (x)); \
-			    } \
-			} \
-		    } while(0)
-
-#ifndef NCURSES_NOMACROS
-
-/*
- * These miscellaneous pseudo functions are provided for compatibility:
- */
-
-#define wgetstr(w, s)		wgetnstr(w, s, -1)
-#define getnstr(s, n)		wgetnstr(stdscr, s, n)
-
-#define setterm(term)		setupterm(term, 1, (int *)0)
-
-#define fixterm()		reset_prog_mode()
-#define resetterm()		reset_shell_mode()
-#define saveterm()		def_prog_mode()
-#define crmode()		cbreak()
-#define nocrmode()		nocbreak()
-#define gettmode()
-
-/* It seems older SYSV curses versions define these */
-#if !NCURSES_OPAQUE
-#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)
-#endif /* NCURSES_OPAQUE */
-
-#define wstandout(win)      	(wattrset(win,A_STANDOUT))
-#define wstandend(win)      	(wattrset(win,A_NORMAL))
-
-#define wattron(win,at)		wattr_on(win, NCURSES_CAST(attr_t, at), NULL)
-#define wattroff(win,at)	wattr_off(win, NCURSES_CAST(attr_t, at), NULL)
-
-#if !NCURSES_OPAQUE
-#if defined(_XOPEN_SOURCE_EXTENDED) && 0
-#define wattrset(win,at)	((win)->_color = PAIR_NUMBER(at), \
-				 (win)->_attrs = (at))
-#else
-#define wattrset(win,at)	((win)->_attrs = (at))
-#endif
-#endif /* NCURSES_OPAQUE */
-
-#define scroll(win)		wscrl(win,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, 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)
-#define hline(ch, n)		whline(stdscr, ch, n)
-#define vline(ch, n)		wvline(stdscr, ch, n)
-
-#define winstr(w, s)		winnstr(w, s, -1)
-#define winchstr(w, s)		winchnstr(w, s, -1)
-#define winsstr(w, s)		winsnstr(w, s, -1)
-
-#if !NCURSES_OPAQUE
-#define redrawwin(win)		wredrawln(win, 0, (win)->_maxy+1)
-#endif /* NCURSES_OPAQUE */
-
-#define waddstr(win,str)	waddnstr(win,str,-1)
-#define waddchstr(win,str)	waddchnstr(win,str,-1)
-
-/*
- * These apply to the first 256 color pairs.
- */
-#define COLOR_PAIR(n)	NCURSES_BITS(n, 0)
-#define PAIR_NUMBER(a)	(NCURSES_CAST(int,(((a) & A_COLOR) >> NCURSES_ATTR_SHIFT)))
-
-/*
- * pseudo functions for standard screen
- */
-
-#define addch(ch)		waddch(stdscr,ch)
-#define addchnstr(str,n)	waddchnstr(stdscr,str,n)
-#define addchstr(str)		waddchstr(stdscr,str)
-#define addnstr(str,n)		waddnstr(stdscr,str,n)
-#define addstr(str)		waddnstr(stdscr,str,-1)
-#define attroff(at)		wattroff(stdscr,at)
-#define attron(at)		wattron(stdscr,at)
-#define attrset(at)		wattrset(stdscr,at)
-#define attr_get(ap,cp,o)	wattr_get(stdscr,ap,cp,o)
-#define attr_off(a,o)		wattr_off(stdscr,a,o)
-#define attr_on(a,o)		wattr_on(stdscr,a,o)
-#define attr_set(a,c,o)		wattr_set(stdscr,a,c,o)
-#define bkgd(ch)		wbkgd(stdscr,ch)
-#define bkgdset(ch)		wbkgdset(stdscr,ch)
-#define chgat(n,a,c,o)		wchgat(stdscr,n,a,c,o)
-#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)
-#define erase()			werase(stdscr)
-#define getch()			wgetch(stdscr)
-#define getstr(str)		wgetstr(stdscr,str)
-#define inch()			winch(stdscr)
-#define inchnstr(s,n)		winchnstr(stdscr,s,n)
-#define inchstr(s)		winchstr(stdscr,s)
-#define innstr(s,n)		winnstr(stdscr,s,n)
-#define insch(c)		winsch(stdscr,c)
-#define insdelln(n)		winsdelln(stdscr,n)
-#define insertln()		winsdelln(stdscr,1)
-#define insnstr(s,n)		winsnstr(stdscr,s,n)
-#define insstr(s)		winsstr(stdscr,s)
-#define instr(s)		winstr(stdscr,s)
-#define move(y,x)		wmove(stdscr,y,x)
-#define refresh()		wrefresh(stdscr)
-#define scrl(n)			wscrl(stdscr,n)
-#define setscrreg(t,b)		wsetscrreg(stdscr,t,b)
-#define standend()		wstandend(stdscr)
-#define standout()		wstandout(stdscr)
-#define timeout(delay)		wtimeout(stdscr,delay)
-#define wdeleteln(win)		winsdelln(win,-1)
-#define winsertln(win)		winsdelln(win,1)
-
-/*
- * mv functions
- */
-
-#define mvwaddch(win,y,x,ch)		(wmove(win,y,x) == ERR ? ERR : waddch(win,ch))
-#define mvwaddchnstr(win,y,x,str,n)	(wmove(win,y,x) == ERR ? ERR : waddchnstr(win,str,n))
-#define mvwaddchstr(win,y,x,str)	(wmove(win,y,x) == ERR ? ERR : waddchnstr(win,str,-1))
-#define mvwaddnstr(win,y,x,str,n)	(wmove(win,y,x) == ERR ? ERR : waddnstr(win,str,n))
-#define mvwaddstr(win,y,x,str)		(wmove(win,y,x) == ERR ? ERR : waddnstr(win,str,-1))
-#define mvwdelch(win,y,x)		(wmove(win,y,x) == ERR ? ERR : wdelch(win))
-#define mvwchgat(win,y,x,n,a,c,o)	(wmove(win,y,x) == ERR ? ERR : wchgat(win,n,a,c,o))
-#define mvwgetch(win,y,x)		(wmove(win,y,x) == ERR ? ERR : wgetch(win))
-#define mvwgetnstr(win,y,x,str,n)	(wmove(win,y,x) == ERR ? ERR : wgetnstr(win,str,n))
-#define mvwgetstr(win,y,x,str)		(wmove(win,y,x) == ERR ? ERR : wgetstr(win,str))
-#define mvwhline(win,y,x,c,n)		(wmove(win,y,x) == ERR ? ERR : whline(win,c,n))
-#define mvwinch(win,y,x)		(wmove(win,y,x) == ERR ? NCURSES_CAST(chtype, ERR) : winch(win))
-#define mvwinchnstr(win,y,x,s,n)	(wmove(win,y,x) == ERR ? ERR : winchnstr(win,s,n))
-#define mvwinchstr(win,y,x,s)		(wmove(win,y,x) == ERR ? ERR : winchstr(win,s))
-#define mvwinnstr(win,y,x,s,n)		(wmove(win,y,x) == ERR ? ERR : winnstr(win,s,n))
-#define mvwinsch(win,y,x,c)		(wmove(win,y,x) == ERR ? ERR : winsch(win,c))
-#define mvwinsnstr(win,y,x,s,n)		(wmove(win,y,x) == ERR ? ERR : winsnstr(win,s,n))
-#define mvwinsstr(win,y,x,s)		(wmove(win,y,x) == ERR ? ERR : winsstr(win,s))
-#define mvwinstr(win,y,x,s)		(wmove(win,y,x) == ERR ? ERR : winstr(win,s))
-#define mvwvline(win,y,x,c,n)		(wmove(win,y,x) == ERR ? ERR : wvline(win,c,n))
-
-#define mvaddch(y,x,ch)			mvwaddch(stdscr,y,x,ch)
-#define mvaddchnstr(y,x,str,n)		mvwaddchnstr(stdscr,y,x,str,n)
-#define mvaddchstr(y,x,str)		mvwaddchstr(stdscr,y,x,str)
-#define mvaddnstr(y,x,str,n)		mvwaddnstr(stdscr,y,x,str,n)
-#define mvaddstr(y,x,str)		mvwaddstr(stdscr,y,x,str)
-#define mvchgat(y,x,n,a,c,o)		mvwchgat(stdscr,y,x,n,a,c,o)
-#define mvdelch(y,x)			mvwdelch(stdscr,y,x)
-#define mvgetch(y,x)			mvwgetch(stdscr,y,x)
-#define mvgetnstr(y,x,str,n)		mvwgetnstr(stdscr,y,x,str,n)
-#define mvgetstr(y,x,str)		mvwgetstr(stdscr,y,x,str)
-#define mvhline(y,x,c,n)		mvwhline(stdscr,y,x,c,n)
-#define mvinch(y,x)			mvwinch(stdscr,y,x)
-#define mvinchnstr(y,x,s,n)		mvwinchnstr(stdscr,y,x,s,n)
-#define mvinchstr(y,x,s)		mvwinchstr(stdscr,y,x,s)
-#define mvinnstr(y,x,s,n)		mvwinnstr(stdscr,y,x,s,n)
-#define mvinsch(y,x,c)			mvwinsch(stdscr,y,x,c)
-#define mvinsnstr(y,x,s,n)		mvwinsnstr(stdscr,y,x,s,n)
-#define mvinsstr(y,x,s)			mvwinsstr(stdscr,y,x,s)
-#define mvinstr(y,x,s)			mvwinstr(stdscr,y,x,s)
-#define mvvline(y,x,c,n)		mvwvline(stdscr,y,x,c,n)
-
-/*
- * Some wide-character functions can be implemented without the extensions.
- */
-#if !NCURSES_OPAQUE
-#define getbkgd(win)                    ((win)->_bkgd)
-#endif /* NCURSES_OPAQUE */
-
-#define slk_attr_off(a,v)		((v) ? ERR : slk_attroff(a))
-#define slk_attr_on(a,v)		((v) ? ERR : slk_attron(a))
-
-#if !NCURSES_OPAQUE
-#if defined(_XOPEN_SOURCE_EXTENDED) && 0
-#define wattr_set(win,a,p,opts)		((win)->_attrs = ((a) & ~A_COLOR), \
-					 (win)->_color = (p), \
-					 OK)
-#define wattr_get(win,a,p,opts)		((void)((a) != (void *)0 && (*(a) = (win)->_attrs)), \
-					 (void)((p) != (void *)0 && (*(p) = (win)->_color)), \
-					 OK)
-#else
-#define wattr_set(win,a,p,opts)		((win)->_attrs = (((a) & ~A_COLOR) | COLOR_PAIR(p)), OK)
-#define wattr_get(win,a,p,opts)		((void)((a) != (void *)0 && (*(a) = (win)->_attrs)), \
-					 (void)((p) != (void *)0 && (*(p) = PAIR_NUMBER((win)->_attrs))), \
-					 OK)
-#endif
-#endif /* NCURSES_OPAQUE */
-
-/*
- * X/Open curses deprecates SVr4 vwprintw/vwscanw, which are supposed to use
- * varargs.h.  It adds new calls vw_printw/vw_scanw, which are supposed to
- * use POSIX stdarg.h.  The ncurses versions of vwprintw/vwscanw already
- * use stdarg.h, so...
- */
-#define vw_printw		vwprintw
-#define vw_scanw		vwscanw
-
-/*
- * Export fallback function for use in C++ binding.
- */
-#if !1
-#define vsscanf(a,b,c) _nc_vsscanf(a,b,c)
-NCURSES_EXPORT(int) vsscanf(const char *, const char *, va_list);
-#endif
-
-/*
- * These macros are extensions - not in X/Open Curses.
- */
-#if 1
-#if !NCURSES_OPAQUE
-#define is_cleared(win)		((win)->_clear)
-#define is_idcok(win)		((win)->_idcok)
-#define is_idlok(win)		((win)->_idlok)
-#define is_immedok(win)		((win)->_immed)
-#define is_keypad(win)		((win)->_use_keypad)
-#define is_leaveok(win)		((win)->_leaveok)
-#define is_nodelay(win)		((win)->_delay == 0)
-#define is_notimeout(win)	((win)->_notimeout)
-#define is_scrollok(win)	((win)->_scroll)
-#define is_syncok(win)		((win)->_sync)
-#define wgetparent(win)		((win) ? (win)->_parent : 0)
-#define wgetscrreg(win,t,b)	((win) ? (*(t) = (win)->_regtop, *(b) = (win)->_regbottom, OK) : ERR)
-#endif
-#endif
-
-#endif /* NCURSES_NOMACROS */
-
-/*
- * Public variables.
- *
- * Notes:
- *	a. ESCDELAY was an undocumented feature under AIX curses.
- *	   It gives the ESC expire time in milliseconds.
- *	b. ttytype is needed for backward compatibility
- */
-#if 0
-
-NCURSES_WRAPPED_VAR(WINDOW *, curscr);
-NCURSES_WRAPPED_VAR(WINDOW *, newscr);
-NCURSES_WRAPPED_VAR(WINDOW *, stdscr);
-NCURSES_WRAPPED_VAR(char *, ttytype);
-NCURSES_WRAPPED_VAR(int, COLORS);
-NCURSES_WRAPPED_VAR(int, COLOR_PAIRS);
-NCURSES_WRAPPED_VAR(int, COLS);
-NCURSES_WRAPPED_VAR(int, ESCDELAY);
-NCURSES_WRAPPED_VAR(int, LINES);
-NCURSES_WRAPPED_VAR(int, TABSIZE);
-
-#define curscr      NCURSES_PUBLIC_VAR(curscr())
-#define newscr      NCURSES_PUBLIC_VAR(newscr())
-#define stdscr      NCURSES_PUBLIC_VAR(stdscr())
-#define ttytype     NCURSES_PUBLIC_VAR(ttytype())
-#define COLORS      NCURSES_PUBLIC_VAR(COLORS())
-#define COLOR_PAIRS NCURSES_PUBLIC_VAR(COLOR_PAIRS())
-#define COLS        NCURSES_PUBLIC_VAR(COLS())
-#define ESCDELAY    NCURSES_PUBLIC_VAR(ESCDELAY())
-#define LINES       NCURSES_PUBLIC_VAR(LINES())
-#define TABSIZE     NCURSES_PUBLIC_VAR(TABSIZE())
-
-#else
-
-extern NCURSES_EXPORT_VAR(WINDOW *) curscr;
-extern NCURSES_EXPORT_VAR(WINDOW *) newscr;
-extern NCURSES_EXPORT_VAR(WINDOW *) stdscr;
-extern NCURSES_EXPORT_VAR(char) ttytype[];
-extern NCURSES_EXPORT_VAR(int) COLORS;
-extern NCURSES_EXPORT_VAR(int) COLOR_PAIRS;
-extern NCURSES_EXPORT_VAR(int) COLS;
-extern NCURSES_EXPORT_VAR(int) ESCDELAY;
-extern NCURSES_EXPORT_VAR(int) LINES;
-extern NCURSES_EXPORT_VAR(int) TABSIZE;
-
-#endif
-
-/*
- * Pseudo-character tokens outside ASCII range.  The curses wgetch() function
- * will return any given one of these only if the corresponding k- capability
- * is defined in your terminal's terminfo entry.
- *
- * Some keys (KEY_A1, etc) are arranged like this:
- *	a1     up    a3
- *	left   b2    right
- *	c1     down  c3
- *
- * A few key codes do not depend upon the terminfo entry.
- */
-#define KEY_CODE_YES	0400		/* A wchar_t contains a key code */
-#define KEY_MIN		0401		/* Minimum curses key */
-#define KEY_BREAK	0401		/* Break key (unreliable) */
-#define KEY_SRESET	0530		/* Soft (partial) reset (unreliable) */
-#define KEY_RESET	0531		/* Reset or hard reset (unreliable) */
-/*
- * These definitions were generated by ./MKkey_defs.sh ./Caps
- */
-#define KEY_DOWN	0402		/* down-arrow key */
-#define KEY_UP		0403		/* up-arrow key */
-#define KEY_LEFT	0404		/* left-arrow key */
-#define KEY_RIGHT	0405		/* right-arrow key */
-#define KEY_HOME	0406		/* home key */
-#define KEY_BACKSPACE	0407		/* backspace key */
-#define KEY_F0		0410		/* Function keys.  Space for 64 */
-#define KEY_F(n)	(KEY_F0+(n))	/* Value of function key n */
-#define KEY_DL		0510		/* delete-line key */
-#define KEY_IL		0511		/* insert-line key */
-#define KEY_DC		0512		/* delete-character key */
-#define KEY_IC		0513		/* insert-character key */
-#define KEY_EIC		0514		/* sent by rmir or smir in insert mode */
-#define KEY_CLEAR	0515		/* clear-screen or erase key */
-#define KEY_EOS		0516		/* clear-to-end-of-screen key */
-#define KEY_EOL		0517		/* clear-to-end-of-line key */
-#define KEY_SF		0520		/* scroll-forward key */
-#define KEY_SR		0521		/* scroll-backward key */
-#define KEY_NPAGE	0522		/* next-page key */
-#define KEY_PPAGE	0523		/* previous-page key */
-#define KEY_STAB	0524		/* set-tab key */
-#define KEY_CTAB	0525		/* clear-tab key */
-#define KEY_CATAB	0526		/* clear-all-tabs key */
-#define KEY_ENTER	0527		/* enter/send key */
-#define KEY_PRINT	0532		/* print key */
-#define KEY_LL		0533		/* lower-left key (home down) */
-#define KEY_A1		0534		/* upper left of keypad */
-#define KEY_A3		0535		/* upper right of keypad */
-#define KEY_B2		0536		/* center of keypad */
-#define KEY_C1		0537		/* lower left of keypad */
-#define KEY_C3		0540		/* lower right of keypad */
-#define KEY_BTAB	0541		/* back-tab key */
-#define KEY_BEG		0542		/* begin key */
-#define KEY_CANCEL	0543		/* cancel key */
-#define KEY_CLOSE	0544		/* close key */
-#define KEY_COMMAND	0545		/* command key */
-#define KEY_COPY	0546		/* copy key */
-#define KEY_CREATE	0547		/* create key */
-#define KEY_END		0550		/* end key */
-#define KEY_EXIT	0551		/* exit key */
-#define KEY_FIND	0552		/* find key */
-#define KEY_HELP	0553		/* help key */
-#define KEY_MARK	0554		/* mark key */
-#define KEY_MESSAGE	0555		/* message key */
-#define KEY_MOVE	0556		/* move key */
-#define KEY_NEXT	0557		/* next key */
-#define KEY_OPEN	0560		/* open key */
-#define KEY_OPTIONS	0561		/* options key */
-#define KEY_PREVIOUS	0562		/* previous key */
-#define KEY_REDO	0563		/* redo key */
-#define KEY_REFERENCE	0564		/* reference key */
-#define KEY_REFRESH	0565		/* refresh key */
-#define KEY_REPLACE	0566		/* replace key */
-#define KEY_RESTART	0567		/* restart key */
-#define KEY_RESUME	0570		/* resume key */
-#define KEY_SAVE	0571		/* save key */
-#define KEY_SBEG	0572		/* shifted begin key */
-#define KEY_SCANCEL	0573		/* shifted cancel key */
-#define KEY_SCOMMAND	0574		/* shifted command key */
-#define KEY_SCOPY	0575		/* shifted copy key */
-#define KEY_SCREATE	0576		/* shifted create key */
-#define KEY_SDC		0577		/* shifted delete-character key */
-#define KEY_SDL		0600		/* shifted delete-line key */
-#define KEY_SELECT	0601		/* select key */
-#define KEY_SEND	0602		/* shifted end key */
-#define KEY_SEOL	0603		/* shifted clear-to-end-of-line key */
-#define KEY_SEXIT	0604		/* shifted exit key */
-#define KEY_SFIND	0605		/* shifted find key */
-#define KEY_SHELP	0606		/* shifted help key */
-#define KEY_SHOME	0607		/* shifted home key */
-#define KEY_SIC		0610		/* shifted insert-character key */
-#define KEY_SLEFT	0611		/* shifted left-arrow key */
-#define KEY_SMESSAGE	0612		/* shifted message key */
-#define KEY_SMOVE	0613		/* shifted move key */
-#define KEY_SNEXT	0614		/* shifted next key */
-#define KEY_SOPTIONS	0615		/* shifted options key */
-#define KEY_SPREVIOUS	0616		/* shifted previous key */
-#define KEY_SPRINT	0617		/* shifted print key */
-#define KEY_SREDO	0620		/* shifted redo key */
-#define KEY_SREPLACE	0621		/* shifted replace key */
-#define KEY_SRIGHT	0622		/* shifted right-arrow key */
-#define KEY_SRSUME	0623		/* shifted resume key */
-#define KEY_SSAVE	0624		/* shifted save key */
-#define KEY_SSUSPEND	0625		/* shifted suspend key */
-#define KEY_SUNDO	0626		/* shifted undo key */
-#define KEY_SUSPEND	0627		/* suspend key */
-#define KEY_UNDO	0630		/* undo key */
-#define KEY_MOUSE	0631		/* Mouse event has occurred */
-#define KEY_RESIZE	0632		/* Terminal resize event */
-#define KEY_EVENT	0633		/* We were interrupted by an event */
-
-#define KEY_MAX		0777		/* Maximum key value is 0633 */
-/* $Id: curses.tail,v 1.16 2008/07/05 20:20:38 tom Exp $ */
-/*
- * vile:cmode:
- * This file is part of ncurses, designed to be appended after curses.h.in
- * (see that file for the relevant copyright).
- */
-
-/* mouse interface */
-
-#if NCURSES_MOUSE_VERSION > 1
-#define NCURSES_MOUSE_MASK(b,m) ((m) << (((b) - 1) * 5))
-#else
-#define NCURSES_MOUSE_MASK(b,m) ((m) << (((b) - 1) * 6))
-#endif
-
-#define	NCURSES_BUTTON_RELEASED	001L
-#define	NCURSES_BUTTON_PRESSED	002L
-#define	NCURSES_BUTTON_CLICKED	004L
-#define	NCURSES_DOUBLE_CLICKED	010L
-#define	NCURSES_TRIPLE_CLICKED	020L
-#define	NCURSES_RESERVED_EVENT	040L
-
-/* event masks */
-#define	BUTTON1_RELEASED	NCURSES_MOUSE_MASK(1, NCURSES_BUTTON_RELEASED)
-#define	BUTTON1_PRESSED		NCURSES_MOUSE_MASK(1, NCURSES_BUTTON_PRESSED)
-#define	BUTTON1_CLICKED		NCURSES_MOUSE_MASK(1, NCURSES_BUTTON_CLICKED)
-#define	BUTTON1_DOUBLE_CLICKED	NCURSES_MOUSE_MASK(1, NCURSES_DOUBLE_CLICKED)
-#define	BUTTON1_TRIPLE_CLICKED	NCURSES_MOUSE_MASK(1, NCURSES_TRIPLE_CLICKED)
-
-#define	BUTTON2_RELEASED	NCURSES_MOUSE_MASK(2, NCURSES_BUTTON_RELEASED)
-#define	BUTTON2_PRESSED		NCURSES_MOUSE_MASK(2, NCURSES_BUTTON_PRESSED)
-#define	BUTTON2_CLICKED		NCURSES_MOUSE_MASK(2, NCURSES_BUTTON_CLICKED)
-#define	BUTTON2_DOUBLE_CLICKED	NCURSES_MOUSE_MASK(2, NCURSES_DOUBLE_CLICKED)
-#define	BUTTON2_TRIPLE_CLICKED	NCURSES_MOUSE_MASK(2, NCURSES_TRIPLE_CLICKED)
-
-#define	BUTTON3_RELEASED	NCURSES_MOUSE_MASK(3, NCURSES_BUTTON_RELEASED)
-#define	BUTTON3_PRESSED		NCURSES_MOUSE_MASK(3, NCURSES_BUTTON_PRESSED)
-#define	BUTTON3_CLICKED		NCURSES_MOUSE_MASK(3, NCURSES_BUTTON_CLICKED)
-#define	BUTTON3_DOUBLE_CLICKED	NCURSES_MOUSE_MASK(3, NCURSES_DOUBLE_CLICKED)
-#define	BUTTON3_TRIPLE_CLICKED	NCURSES_MOUSE_MASK(3, NCURSES_TRIPLE_CLICKED)
-
-#define	BUTTON4_RELEASED	NCURSES_MOUSE_MASK(4, NCURSES_BUTTON_RELEASED)
-#define	BUTTON4_PRESSED		NCURSES_MOUSE_MASK(4, NCURSES_BUTTON_PRESSED)
-#define	BUTTON4_CLICKED		NCURSES_MOUSE_MASK(4, NCURSES_BUTTON_CLICKED)
-#define	BUTTON4_DOUBLE_CLICKED	NCURSES_MOUSE_MASK(4, NCURSES_DOUBLE_CLICKED)
-#define	BUTTON4_TRIPLE_CLICKED	NCURSES_MOUSE_MASK(4, NCURSES_TRIPLE_CLICKED)
-
-/*
- * In 32 bits the version-1 scheme does not provide enough space for a 5th
- * button, unless we choose to change the ABI by omitting the reserved-events.
- */
-#if NCURSES_MOUSE_VERSION > 1
-
-#define	BUTTON5_RELEASED	NCURSES_MOUSE_MASK(5, NCURSES_BUTTON_RELEASED)
-#define	BUTTON5_PRESSED		NCURSES_MOUSE_MASK(5, NCURSES_BUTTON_PRESSED)
-#define	BUTTON5_CLICKED		NCURSES_MOUSE_MASK(5, NCURSES_BUTTON_CLICKED)
-#define	BUTTON5_DOUBLE_CLICKED	NCURSES_MOUSE_MASK(5, NCURSES_DOUBLE_CLICKED)
-#define	BUTTON5_TRIPLE_CLICKED	NCURSES_MOUSE_MASK(5, NCURSES_TRIPLE_CLICKED)
-
-#define	BUTTON_CTRL		NCURSES_MOUSE_MASK(6, 0001L)
-#define	BUTTON_SHIFT		NCURSES_MOUSE_MASK(6, 0002L)
-#define	BUTTON_ALT		NCURSES_MOUSE_MASK(6, 0004L)
-#define	REPORT_MOUSE_POSITION	NCURSES_MOUSE_MASK(6, 0010L)
-
-#else
-
-#define	BUTTON1_RESERVED_EVENT	NCURSES_MOUSE_MASK(1, NCURSES_RESERVED_EVENT)
-#define	BUTTON2_RESERVED_EVENT	NCURSES_MOUSE_MASK(2, NCURSES_RESERVED_EVENT)
-#define	BUTTON3_RESERVED_EVENT	NCURSES_MOUSE_MASK(3, NCURSES_RESERVED_EVENT)
-#define	BUTTON4_RESERVED_EVENT	NCURSES_MOUSE_MASK(4, NCURSES_RESERVED_EVENT)
-
-#define	BUTTON_CTRL		NCURSES_MOUSE_MASK(5, 0001L)
-#define	BUTTON_SHIFT		NCURSES_MOUSE_MASK(5, 0002L)
-#define	BUTTON_ALT		NCURSES_MOUSE_MASK(5, 0004L)
-#define	REPORT_MOUSE_POSITION	NCURSES_MOUSE_MASK(5, 0010L)
-
-#endif
-
-#define	ALL_MOUSE_EVENTS	(REPORT_MOUSE_POSITION - 1)
-
-/* macros to extract single event-bits from masks */
-#define	BUTTON_RELEASE(e, x)		((e) & NCURSES_MOUSE_MASK(x, 001))
-#define	BUTTON_PRESS(e, x)		((e) & NCURSES_MOUSE_MASK(x, 002))
-#define	BUTTON_CLICK(e, x)		((e) & NCURSES_MOUSE_MASK(x, 004))
-#define	BUTTON_DOUBLE_CLICK(e, x)	((e) & NCURSES_MOUSE_MASK(x, 010))
-#define	BUTTON_TRIPLE_CLICK(e, x)	((e) & NCURSES_MOUSE_MASK(x, 020))
-#define	BUTTON_RESERVED_EVENT(e, x)	((e) & NCURSES_MOUSE_MASK(x, 040))
-
-typedef struct
-{
-    short id;		/* ID to distinguish multiple devices */
-    int x, y, z;	/* event coordinates (character-cell) */
-    mmask_t bstate;	/* button state bits */
-}
-MEVENT;
-
-extern NCURSES_EXPORT(int) getmouse (MEVENT *);
-extern NCURSES_EXPORT(int) ungetmouse (MEVENT *);
-extern NCURSES_EXPORT(mmask_t) mousemask (mmask_t, mmask_t *);
-extern NCURSES_EXPORT(bool) wenclose (const WINDOW *, int, int);
-extern NCURSES_EXPORT(int) mouseinterval (int);
-extern NCURSES_EXPORT(bool) wmouse_trafo (const WINDOW*, int*, int*, bool);
-extern NCURSES_EXPORT(bool) mouse_trafo (int*, int*, bool);              /* generated */
-
-#define mouse_trafo(y,x,to_screen) wmouse_trafo(stdscr,y,x,to_screen)
-
-/* other non-XSI functions */
-
-extern NCURSES_EXPORT(int) mcprint (char *, int);	/* direct data to printer */
-extern NCURSES_EXPORT(int) has_key (int);		/* do we have given key? */
-
-/* Debugging : use with libncurses_g.a */
-
-extern NCURSES_EXPORT(void) _tracef (const char *, ...) GCC_PRINTFLIKE(1,2);
-extern NCURSES_EXPORT(void) _tracedump (const char *, WINDOW *);
-extern NCURSES_EXPORT(char *) _traceattr (attr_t);
-extern NCURSES_EXPORT(char *) _traceattr2 (int, chtype);
-extern NCURSES_EXPORT(char *) _nc_tracebits (void);
-extern NCURSES_EXPORT(char *) _tracechar (int);
-extern NCURSES_EXPORT(char *) _tracechtype (chtype);
-extern NCURSES_EXPORT(char *) _tracechtype2 (int, chtype);
-#ifdef _XOPEN_SOURCE_EXTENDED
-#define _tracech_t		_tracecchar_t
-extern NCURSES_EXPORT(char *) _tracecchar_t (const cchar_t *);
-#define _tracech_t2		_tracecchar_t2
-extern NCURSES_EXPORT(char *) _tracecchar_t2 (int, const cchar_t *);
-#else
-#define _tracech_t		_tracechtype
-#define _tracech_t2		_tracechtype2
-#endif
-extern NCURSES_EXPORT(char *) _tracemouse (const MEVENT *);
-extern NCURSES_EXPORT(void) trace (const unsigned int);
-
-/* trace masks */
-#define TRACE_DISABLE	0x0000	/* turn off tracing */
-#define TRACE_TIMES	0x0001	/* trace user and system times of updates */
-#define TRACE_TPUTS	0x0002	/* trace tputs calls */
-#define TRACE_UPDATE	0x0004	/* trace update actions, old & new screens */
-#define TRACE_MOVE	0x0008	/* trace cursor moves and scrolls */
-#define TRACE_CHARPUT	0x0010	/* trace all character outputs */
-#define TRACE_ORDINARY	0x001F	/* trace all update actions */
-#define TRACE_CALLS	0x0020	/* trace all curses calls */
-#define TRACE_VIRTPUT	0x0040	/* trace virtual character puts */
-#define TRACE_IEVENT	0x0080	/* trace low-level input processing */
-#define TRACE_BITS	0x0100	/* trace state of TTY control bits */
-#define TRACE_ICALLS	0x0200	/* trace internal/nested calls */
-#define TRACE_CCALLS	0x0400	/* trace per-character calls */
-#define TRACE_DATABASE	0x0800	/* trace read/write of terminfo/termcap data */
-#define TRACE_ATTRS	0x1000	/* trace attribute updates */
-
-#define TRACE_SHIFT	13	/* number of bits in the trace masks */
-#define TRACE_MAXIMUM	((1 << TRACE_SHIFT) - 1) /* maximum trace level */
-
-#if defined(TRACE) || defined(NCURSES_TEST)
-extern NCURSES_EXPORT_VAR(int) _nc_optimize_enable;		/* enable optimizations */
-extern NCURSES_EXPORT(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 */
-#define OPTIMIZE_ALL		0xff	/* enable all optimizations (dflt) */
-#endif
-
-#ifdef __cplusplus
-
-#ifndef NCURSES_NOMACROS
-
-/* these names conflict with STL */
-#undef box
-#undef clear
-#undef erase
-#undef move
-#undef refresh
-
-#endif /* NCURSES_NOMACROS */
-
-}
-#endif
-
-#endif /* __NCURSES_H */
diff --git a/include/ncurses_cfg.h b/include/ncurses_cfg.h
deleted file mode 100644
index 19a1d82..0000000
--- a/include/ncurses_cfg.h
+++ /dev/null
@@ -1,174 +0,0 @@
-/* include/ncurses_cfg.h.  Generated automatically by configure.  */
-/****************************************************************************
- * Copyright (c) 1998-2004,2005 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: Thomas E. Dickey <dickey@clark.net> 1997                        *
- ****************************************************************************/
-/*
- * $Id: ncurses_cfg.hin,v 1.7 2005/01/02 01:26:58 tom Exp $
- *
- * This is a template-file used to generate the "ncurses_cfg.h" file.
- *
- * Rather than list every definition, the configuration script substitutes the
- * definitions that it finds using 'sed'.  You need a patch (original date
- * 971222) to autoconf 2.12 or 2.13 to do this.
- *
- * See:
- *	http://invisible-island.net/autoconf/
- *	ftp://invisible-island.net/autoconf/
- */
-#ifndef NC_CONFIG_H
-#define NC_CONFIG_H
-
-#define SYSTEM_NAME "eabi"
-#define CC_HAS_PROTOS 1
-#if 0
-void exit (int);
-#endif
-#define HAVE_LONG_FILE_NAMES 1
-#define MIXEDCASE_FILENAMES 1
-#define USE_DATABASE 1
-#define TERMINFO_DIRS "/usr/local/share/terminfo"
-#define TERMINFO "/usr/local/share/terminfo"
-#define PURE_TERMINFO 1
-#define USE_HOME_TERMINFO 1
-#define USE_ROOT_ENVIRON 1
-#define HAVE_REMOVE 1
-#define HAVE_UNLINK 1
-#define HAVE_LINK 1
-#define HAVE_SYMLINK 1
-#define USE_LINKS 1
-#define HAVE_FSEEKO 1
-#define HAVE_CURSES_VERSION 1
-#define HAVE_HAS_KEY 1
-#define HAVE_RESIZETERM 1
-#define HAVE_RESIZE_TERM 1
-#define HAVE_USE_DEFAULT_COLORS 1
-#define HAVE_WRESIZE 1
-#define NCURSES_EXT_FUNCS 1
-#define NCURSES_NO_PADDING 1
-#define STDC_HEADERS 1
-#define HAVE_SYS_TYPES_H 1
-#define HAVE_SYS_STAT_H 1
-#define HAVE_STDLIB_H 1
-#define HAVE_STRING_H 1
-#define HAVE_MEMORY_H 1
-#define HAVE_STRINGS_H 1
-#define HAVE_INTTYPES_H 1
-#define HAVE_STDINT_H 1
-#define HAVE_UNISTD_H 1
-#define SIZEOF_SIGNED_CHAR 1
-#define USE_SIGWINCH 1
-#define USE_ASSUMED_COLOR 1
-#define USE_HASHMAP 1
-#define GCC_SCANF 1
-#define GCC_PRINTF 1
-#define GCC_UNUSED __attribute__((unused))
-#define GCC_NORETURN __attribute__((noreturn))
-#define NDEBUG 1
-#define HAVE_NC_ALLOC_H 1
-#define HAVE_GETTIMEOFDAY 1
-#define STDC_HEADERS 1
-#define HAVE_DIRENT_H 1
-#define TIME_WITH_SYS_TIME 1
-#define HAVE_FCNTL_H 1
-#define HAVE_GETOPT_H 1
-#define HAVE_LIMITS_H 1
-#define HAVE_POLL_H 1
-#define HAVE_SYS_IOCTL_H 1
-#define HAVE_SYS_PARAM_H 1
-#define HAVE_SYS_POLL_H 1
-#define HAVE_SYS_SELECT_H 1
-#define HAVE_SYS_TIME_H 1
-#define HAVE_SYS_TIMES_H 1
-#define HAVE_UNISTD_H 1
-#define HAVE_WCTYPE_H 1
-#define HAVE_SYS_TIME_SELECT 1
-#define SIG_ATOMIC_T volatile sig_atomic_t
-#define TYPEOF_CHTYPE long
-#define HAVE_GETCWD 1
-#define HAVE_GETEGID 1
-#define HAVE_GETEUID 1
-#define HAVE_ISSETUGID 1
-#define HAVE_POLL 1
-#define HAVE_REMOVE 1
-#define HAVE_SELECT 1
-#define HAVE_SETBUF 1
-#define HAVE_SETBUFFER 1
-#define HAVE_SETVBUF 1
-#define HAVE_SIGACTION 1
-#define HAVE_STRDUP 1
-#define HAVE_STRSTR 1
-#define HAVE_TCGETPGRP 1
-#define HAVE_TIMES 1
-#define HAVE_VSNPRINTF 1
-#define HAVE_ISASCII 1
-#define HAVE_TERMIOS_H 1
-#define HAVE_UNISTD_H 1
-#define HAVE_TCGETATTR 1
-#define HAVE_VSSCANF 1
-#define RETSIGTYPE void
-#define HAVE_SIZECHANGE 1
-#define HAVE_IOSTREAM 1
-#define HAVE_TYPEINFO 1
-#define CPP_HAS_STATIC_CAST 1
-#define HAVE_SLK_COLOR 1
-#define HAVE_PANEL_H 1
-#define HAVE_LIBPANEL 1
-#define HAVE_MENU_H 1
-#define HAVE_LIBMENU 1
-#define HAVE_FORM_H 1
-#define HAVE_LIBFORM 1
-#define NCURSES_PATHSEP ':'
-#define NCURSES_VERSION_STRING "5.7.20081102"
-
-#include <ncurses_def.h>
-
-	/* The C compiler may not treat these properly but C++ has to */
-#ifdef __cplusplus
-#undef const
-#undef inline
-#else
-#if defined(lint) || defined(TRACE)
-#undef inline
-#define inline /* nothing */
-#endif
-#endif
-
-	/* On HP-UX, the C compiler doesn't grok mbstate_t without
-	   -D_XOPEN_SOURCE=500. However, this causes problems on
-	   IRIX. So, we #define mbstate_t to int in configure.in
-	   only for the C compiler if needed. */
-#ifndef __cplusplus
-#ifdef NEED_MBSTATE_T_DEF
-#define mbstate_t int
-#endif
-#endif
-
-#endif /* NC_CONFIG_H */
diff --git a/include/ncurses_def.h b/include/ncurses_def.h
deleted file mode 100644
index 9dd8d90..0000000
--- a/include/ncurses_def.h
+++ /dev/null
@@ -1,708 +0,0 @@
-/*
- * This file is generated by ./MKncurses_def.sh
- */
-
-#ifndef NC_DEFINE_H
-#define NC_DEFINE_H 1
-
-#ifndef BROKEN_LINKER
-#define BROKEN_LINKER 0
-#endif
-
-#ifndef BSD_TPUTS
-#define BSD_TPUTS 0
-#endif
-
-#ifndef CC_HAS_PROTOS
-#define CC_HAS_PROTOS 0
-#endif
-
-#ifndef CPP_HAS_PARAM_INIT
-#define CPP_HAS_PARAM_INIT 0
-#endif
-
-#ifndef CURSES_ACS_ARRAY
-#define CURSES_ACS_ARRAY acs_map
-#endif
-
-#ifndef CURSES_WACS_ARRAY
-#define CURSES_WACS_ARRAY _nc_wacs
-#endif
-
-#ifndef DECL_ERRNO
-#define DECL_ERRNO 0
-#endif
-
-#ifndef ETIP_NEEDS_MATH_H
-#define ETIP_NEEDS_MATH_H 0
-#endif
-
-#ifndef GCC_NORETURN
-#define GCC_NORETURN /* nothing */
-#endif
-
-#ifndef GCC_UNUSED
-#define GCC_UNUSED /* nothing */
-#endif
-
-#ifndef HAVE_BIG_CORE
-#define HAVE_BIG_CORE 0
-#endif
-
-#ifndef HAVE_BSD_CGETENT
-#define HAVE_BSD_CGETENT 0
-#endif
-
-#ifndef HAVE_BSD_SIGNAL_H
-#define HAVE_BSD_SIGNAL_H 0
-#endif
-
-#ifndef HAVE_BTOWC
-#define HAVE_BTOWC 0
-#endif
-
-#ifndef HAVE_BUILTIN_H
-#define HAVE_BUILTIN_H 0
-#endif
-
-#ifndef HAVE_CHGAT
-#define HAVE_CHGAT 1
-#endif
-
-#ifndef HAVE_COLOR_SET
-#define HAVE_COLOR_SET 1
-#endif
-
-#ifndef HAVE_DIRENT_H
-#define HAVE_DIRENT_H 0
-#endif
-
-#ifndef HAVE_ERRNO
-#define HAVE_ERRNO 0
-#endif
-
-#ifndef HAVE_FCNTL_H
-#define HAVE_FCNTL_H 0
-#endif
-
-#ifndef HAVE_FILTER
-#define HAVE_FILTER 1
-#endif
-
-#ifndef HAVE_FORM_H
-#define HAVE_FORM_H 0
-#endif
-
-#ifndef HAVE_GETBEGX
-#define HAVE_GETBEGX 1
-#endif
-
-#ifndef HAVE_GETCURX
-#define HAVE_GETCURX 1
-#endif
-
-#ifndef HAVE_GETCWD
-#define HAVE_GETCWD 0
-#endif
-
-#ifndef HAVE_GETEGID
-#define HAVE_GETEGID 0
-#endif
-
-#ifndef HAVE_GETEUID
-#define HAVE_GETEUID 0
-#endif
-
-#ifndef HAVE_GETMAXX
-#define HAVE_GETMAXX 1
-#endif
-
-#ifndef HAVE_GETNSTR
-#define HAVE_GETNSTR 0
-#endif
-
-#ifndef HAVE_GETOPT_H
-#define HAVE_GETOPT_H 0
-#endif
-
-#ifndef HAVE_GETPARX
-#define HAVE_GETPARX 1
-#endif
-
-#ifndef HAVE_GETTIMEOFDAY
-#define HAVE_GETTIMEOFDAY 0
-#endif
-
-#ifndef HAVE_GETTTYNAM
-#define HAVE_GETTTYNAM 0
-#endif
-
-#ifndef HAVE_GETWIN
-#define HAVE_GETWIN 1
-#endif
-
-#ifndef HAVE_GPM_H
-#define HAVE_GPM_H 0
-#endif
-
-#ifndef HAVE_GPP_BUILTIN_H
-#define HAVE_GPP_BUILTIN_H 0
-#endif
-
-#ifndef HAVE_GXX_BUILTIN_H
-#define HAVE_GXX_BUILTIN_H 0
-#endif
-
-#ifndef HAVE_HAS_KEY
-#define HAVE_HAS_KEY 0
-#endif
-
-#ifndef HAVE_IOSTREAM
-#define HAVE_IOSTREAM 0
-#endif
-
-#ifndef HAVE_ISASCII
-#define HAVE_ISASCII 0
-#endif
-
-#ifndef HAVE_ISSETUGID
-#define HAVE_ISSETUGID 0
-#endif
-
-#ifndef HAVE_LANGINFO_CODESET
-#define HAVE_LANGINFO_CODESET 0
-#endif
-
-#ifndef HAVE_LIBC_H
-#define HAVE_LIBC_H 0
-#endif
-
-#ifndef HAVE_LIBDBMALLOC
-#define HAVE_LIBDBMALLOC 0
-#endif
-
-#ifndef HAVE_LIBDMALLOC
-#define HAVE_LIBDMALLOC 0
-#endif
-
-#ifndef HAVE_LIBFORM
-#define HAVE_LIBFORM 0
-#endif
-
-#ifndef HAVE_LIBGPM
-#define HAVE_LIBGPM 0
-#endif
-
-#ifndef HAVE_LIBMENU
-#define HAVE_LIBMENU 0
-#endif
-
-#ifndef HAVE_LIBMPATROL
-#define HAVE_LIBMPATROL 0
-#endif
-
-#ifndef HAVE_LIBPANEL
-#define HAVE_LIBPANEL 0
-#endif
-
-#ifndef HAVE_LIMITS_H
-#define HAVE_LIMITS_H 0
-#endif
-
-#ifndef HAVE_LINK
-#define HAVE_LINK 0
-#endif
-
-#ifndef HAVE_LOCALE_H
-#define HAVE_LOCALE_H 0
-#endif
-
-#ifndef HAVE_LONG_FILE_NAMES
-#define HAVE_LONG_FILE_NAMES 0
-#endif
-
-#ifndef HAVE_MBLEN
-#define HAVE_MBLEN 0
-#endif
-
-#ifndef HAVE_MBRLEN
-#define HAVE_MBRLEN 0
-#endif
-
-#ifndef HAVE_MBRTOWC
-#define HAVE_MBRTOWC 0
-#endif
-
-#ifndef HAVE_MBSRTOWCS
-#define HAVE_MBSRTOWCS 0
-#endif
-
-#ifndef HAVE_MBSTOWCS
-#define HAVE_MBSTOWCS 0
-#endif
-
-#ifndef HAVE_MBTOWC
-#define HAVE_MBTOWC 0
-#endif
-
-#ifndef HAVE_MENU_H
-#define HAVE_MENU_H 0
-#endif
-
-#ifndef HAVE_MKSTEMP
-#define HAVE_MKSTEMP 0
-#endif
-
-#ifndef HAVE_MVVLINE
-#define HAVE_MVVLINE 1
-#endif
-
-#ifndef HAVE_MVWVLINE
-#define HAVE_MVWVLINE 1
-#endif
-
-#ifndef HAVE_NANOSLEEP
-#define HAVE_NANOSLEEP 0
-#endif
-
-#ifndef HAVE_NC_ALLOC_H
-#define HAVE_NC_ALLOC_H 0
-#endif
-
-#ifndef HAVE_PANEL_H
-#define HAVE_PANEL_H 0
-#endif
-
-#ifndef HAVE_POLL
-#define HAVE_POLL 0
-#endif
-
-#ifndef HAVE_POLL_H
-#define HAVE_POLL_H 0
-#endif
-
-#ifndef HAVE_PURIFY
-#define HAVE_PURIFY 0
-#endif
-
-#ifndef HAVE_PUTWC
-#define HAVE_PUTWC 0
-#endif
-
-#ifndef HAVE_PUTWIN
-#define HAVE_PUTWIN 1
-#endif
-
-#ifndef HAVE_REGEXPR_H_FUNCS
-#define HAVE_REGEXPR_H_FUNCS 0
-#endif
-
-#ifndef HAVE_REGEXP_H_FUNCS
-#define HAVE_REGEXP_H_FUNCS 0
-#endif
-
-#ifndef HAVE_REGEX_H_FUNCS
-#define HAVE_REGEX_H_FUNCS 0
-#endif
-
-#ifndef HAVE_REMOVE
-#define HAVE_REMOVE 0
-#endif
-
-#ifndef HAVE_RESIZETERM
-#define HAVE_RESIZETERM 0
-#endif
-
-#ifndef HAVE_RESIZE_TERM
-#define HAVE_RESIZE_TERM 0
-#endif
-
-#ifndef HAVE_RIPOFFLINE
-#define HAVE_RIPOFFLINE 1
-#endif
-
-#ifndef HAVE_SELECT
-#define HAVE_SELECT 0
-#endif
-
-#ifndef HAVE_SETBUF
-#define HAVE_SETBUF 0
-#endif
-
-#ifndef HAVE_SETBUFFER
-#define HAVE_SETBUFFER 0
-#endif
-
-#ifndef HAVE_SETUPTERM
-#define HAVE_SETUPTERM 1
-#endif
-
-#ifndef HAVE_SETVBUF
-#define HAVE_SETVBUF 0
-#endif
-
-#ifndef HAVE_SIGACTION
-#define HAVE_SIGACTION 0
-#endif
-
-#ifndef HAVE_SIGVEC
-#define HAVE_SIGVEC 0
-#endif
-
-#ifndef HAVE_SIZECHANGE
-#define HAVE_SIZECHANGE 0
-#endif
-
-#ifndef HAVE_SLK_COLOR
-#define HAVE_SLK_COLOR 0
-#endif
-
-#ifndef HAVE_SLK_INIT
-#define HAVE_SLK_INIT 1
-#endif
-
-#ifndef HAVE_STRDUP
-#define HAVE_STRDUP 0
-#endif
-
-#ifndef HAVE_STRSTR
-#define HAVE_STRSTR 0
-#endif
-
-#ifndef HAVE_SYMLINK
-#define HAVE_SYMLINK 0
-#endif
-
-#ifndef HAVE_SYS_BSDTYPES_H
-#define HAVE_SYS_BSDTYPES_H 0
-#endif
-
-#ifndef HAVE_SYS_IOCTL_H
-#define HAVE_SYS_IOCTL_H 0
-#endif
-
-#ifndef HAVE_SYS_PARAM_H
-#define HAVE_SYS_PARAM_H 0
-#endif
-
-#ifndef HAVE_SYS_POLL_H
-#define HAVE_SYS_POLL_H 0
-#endif
-
-#ifndef HAVE_SYS_SELECT_H
-#define HAVE_SYS_SELECT_H 0
-#endif
-
-#ifndef HAVE_SYS_TERMIO_H
-#define HAVE_SYS_TERMIO_H 0
-#endif
-
-#ifndef HAVE_SYS_TIMES_H
-#define HAVE_SYS_TIMES_H 0
-#endif
-
-#ifndef HAVE_SYS_TIME_H
-#define HAVE_SYS_TIME_H 0
-#endif
-
-#ifndef HAVE_SYS_TIME_SELECT
-#define HAVE_SYS_TIME_SELECT 0
-#endif
-
-#ifndef HAVE_TCGETATTR
-#define HAVE_TCGETATTR 0
-#endif
-
-#ifndef HAVE_TCGETPGRP
-#define HAVE_TCGETPGRP 0
-#endif
-
-#ifndef HAVE_TELL
-#define HAVE_TELL 0
-#endif
-
-#ifndef HAVE_TERMATTRS
-#define HAVE_TERMATTRS 1
-#endif
-
-#ifndef HAVE_TERMIOS_H
-#define HAVE_TERMIOS_H 0
-#endif
-
-#ifndef HAVE_TERMIO_H
-#define HAVE_TERMIO_H 0
-#endif
-
-#ifndef HAVE_TERMNAME
-#define HAVE_TERMNAME 1
-#endif
-
-#ifndef HAVE_TERM_H
-#define HAVE_TERM_H 1
-#endif
-
-#ifndef HAVE_TGETENT
-#define HAVE_TGETENT 1
-#endif
-
-#ifndef HAVE_TIGETNUM
-#define HAVE_TIGETNUM 1
-#endif
-
-#ifndef HAVE_TIGETSTR
-#define HAVE_TIGETSTR 1
-#endif
-
-#ifndef HAVE_TIMES
-#define HAVE_TIMES 0
-#endif
-
-#ifndef HAVE_TTYENT_H
-#define HAVE_TTYENT_H 0
-#endif
-
-#ifndef HAVE_TYPEAHEAD
-#define HAVE_TYPEAHEAD 1
-#endif
-
-#ifndef HAVE_TYPEINFO
-#define HAVE_TYPEINFO 0
-#endif
-
-#ifndef HAVE_TYPE_ATTR_T
-#define HAVE_TYPE_ATTR_T 0
-#endif
-
-#ifndef HAVE_TYPE_SIGACTION
-#define HAVE_TYPE_SIGACTION 0
-#endif
-
-#ifndef HAVE_UNISTD_H
-#define HAVE_UNISTD_H 0
-#endif
-
-#ifndef HAVE_UNLINK
-#define HAVE_UNLINK 0
-#endif
-
-#ifndef HAVE_USE_DEFAULT_COLORS
-#define HAVE_USE_DEFAULT_COLORS 0
-#endif
-
-#ifndef HAVE_VFSCANF
-#define HAVE_VFSCANF 0
-#endif
-
-#ifndef HAVE_VSNPRINTF
-#define HAVE_VSNPRINTF 0
-#endif
-
-#ifndef HAVE_VSSCANF
-#define HAVE_VSSCANF 0
-#endif
-
-#ifndef HAVE_WCSRTOMBS
-#define HAVE_WCSRTOMBS 0
-#endif
-
-#ifndef HAVE_WCSTOMBS
-#define HAVE_WCSTOMBS 0
-#endif
-
-#ifndef HAVE_WCTOB
-#define HAVE_WCTOB 0
-#endif
-
-#ifndef HAVE_WCTOMB
-#define HAVE_WCTOMB 0
-#endif
-
-#ifndef HAVE_WCTYPE_H
-#define HAVE_WCTYPE_H 0
-#endif
-
-#ifndef HAVE_WINSSTR
-#define HAVE_WINSSTR 1
-#endif
-
-#ifndef HAVE_WORKING_POLL
-#define HAVE_WORKING_POLL 0
-#endif
-
-#ifndef HAVE_WRESIZE
-#define HAVE_WRESIZE 0
-#endif
-
-#ifndef HAVE__DOSCAN
-#define HAVE__DOSCAN 0
-#endif
-
-#ifndef MIXEDCASE_FILENAMES
-#define MIXEDCASE_FILENAMES 0
-#endif
-
-#ifndef NCURSES_CHAR_EQ
-#define NCURSES_CHAR_EQ 0
-#endif
-
-#ifndef NCURSES_EXPANDED
-#define NCURSES_EXPANDED 0
-#endif
-
-#ifndef NCURSES_EXT_COLORS
-#define NCURSES_EXT_COLORS 0
-#endif
-
-#ifndef NCURSES_EXT_FUNCS
-#define NCURSES_EXT_FUNCS 0
-#endif
-
-#ifndef NCURSES_NO_PADDING
-#define NCURSES_NO_PADDING 0
-#endif
-
-#ifndef NCURSES_PATHSEP
-#define NCURSES_PATHSEP ':'
-#endif
-
-#ifndef NDEBUG
-#define NDEBUG 0
-#endif
-
-#ifndef NEED_PTEM_H
-#define NEED_PTEM_H 0
-#endif
-
-#ifndef NO_LEAKS
-#define NO_LEAKS 0
-#endif
-
-#ifndef PURE_TERMINFO
-#define PURE_TERMINFO 0
-#endif
-
-#ifndef RETSIGTYPE
-#define RETSIGTYPE 0
-#endif
-
-#ifndef STDC_HEADERS
-#define STDC_HEADERS 0
-#endif
-
-#ifndef SVR4_ACTION
-#define SVR4_ACTION 0
-#endif
-
-#ifndef SVR4_TERMIO
-#define SVR4_TERMIO 0
-#endif
-
-#ifndef SYSTEM_NAME
-#define SYSTEM_NAME "unknown"
-#endif
-
-#ifndef TERMINFO
-#define TERMINFO "none"
-#endif
-
-#ifndef TERMPATH
-#define TERMPATH "none"
-#endif
-
-#ifndef TIME_WITH_SYS_TIME
-#define TIME_WITH_SYS_TIME 0
-#endif
-
-#ifndef TYPEOF_CHTYPE
-#define TYPEOF_CHTYPE 0
-#endif
-
-#ifndef USE_COLORFGBG
-#define USE_COLORFGBG 0
-#endif
-
-#ifndef USE_DATABASE
-#define USE_DATABASE 0
-#endif
-
-#ifndef USE_GETCAP
-#define USE_GETCAP 0
-#endif
-
-#ifndef USE_GETCAP_CACHE
-#define USE_GETCAP_CACHE 0
-#endif
-
-#ifndef USE_HARD_TABS
-#define USE_HARD_TABS 0
-#endif
-
-#ifndef USE_HASHED_DB
-#define USE_HASHED_DB 0
-#endif
-
-#ifndef USE_HASHMAP
-#define USE_HASHMAP 0
-#endif
-
-#ifndef USE_HOME_TERMINFO
-#define USE_HOME_TERMINFO 0
-#endif
-
-#ifndef USE_LINKS
-#define USE_LINKS 0
-#endif
-
-#ifndef USE_MY_MEMMOVE
-#define USE_MY_MEMMOVE 0
-#endif
-
-#ifndef USE_OK_BCOPY
-#define USE_OK_BCOPY 0
-#endif
-
-#ifndef USE_RCS_IDS
-#define USE_RCS_IDS 0
-#endif
-
-#ifndef USE_REENTRANT
-#define USE_REENTRANT 0
-#endif
-
-#ifndef USE_SAFE_SPRINTF
-#define USE_SAFE_SPRINTF 0
-#endif
-
-#ifndef USE_SCROLL_HINTS
-#define USE_SCROLL_HINTS 0
-#endif
-
-#ifndef USE_SIGWINCH
-#define USE_SIGWINCH 0
-#endif
-
-#ifndef USE_SYMLINKS
-#define USE_SYMLINKS 0
-#endif
-
-#ifndef USE_SYSMOUSE
-#define USE_SYSMOUSE 0
-#endif
-
-#ifndef USE_TERMCAP
-#define USE_TERMCAP 0
-#endif
-
-#ifndef USE_WEAK_SYMBOLS
-#define USE_WEAK_SYMBOLS 0
-#endif
-
-#ifndef USE_WIDEC_SUPPORT
-#define USE_WIDEC_SUPPORT 0
-#endif
-
-#ifndef USE_XMC_SUPPORT
-#define USE_XMC_SUPPORT 0
-#endif
-
-#endif /* NC_DEFINE_H */
diff --git a/include/ncurses_defs b/include/ncurses_defs
index 97a377d..efaf635 100644
--- a/include/ncurses_defs
+++ b/include/ncurses_defs
@@ -1,6 +1,6 @@
-# $Id: ncurses_defs,v 1.40 2008/09/06 15:57:41 tom Exp $
+# $Id: ncurses_defs,v 1.69 2015/03/27 10:47:31 tom Exp $
 ##############################################################################
-# Copyright (c) 2000-2007,2008 Free Software Foundation, Inc.                #
+# Copyright (c) 2000-2014,2015 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"), #
@@ -33,7 +33,7 @@
 
 BROKEN_LINKER
 BSD_TPUTS
-CC_HAS_PROTOS
+CGETENT_CONST	/* nothing */
 CPP_HAS_PARAM_INIT
 CURSES_ACS_ARRAY	acs_map
 CURSES_WACS_ARRAY	_nc_wacs
@@ -41,6 +41,7 @@
 ETIP_NEEDS_MATH_H
 GCC_NORETURN	/* nothing */
 GCC_UNUSED	/* nothing */
+HAVE_ASSUME_DEFAULT_COLORS
 HAVE_BIG_CORE
 HAVE_BSD_CGETENT
 HAVE_BSD_SIGNAL_H
@@ -69,6 +70,7 @@
 HAVE_GPP_BUILTIN_H
 HAVE_GXX_BUILTIN_H
 HAVE_HAS_KEY
+HAVE_INTTYPES_H
 HAVE_IOSTREAM
 HAVE_ISASCII
 HAVE_ISSETUGID
@@ -85,6 +87,7 @@
 HAVE_LINK
 HAVE_LOCALE_H
 HAVE_LONG_FILE_NAMES
+HAVE_MATH_H
 HAVE_MBLEN
 HAVE_MBRLEN
 HAVE_MBRTOWC
@@ -101,6 +104,7 @@
 HAVE_POLL
 HAVE_POLL_H
 HAVE_PURIFY
+HAVE_PUTENV
 HAVE_PUTWC 
 HAVE_PUTWIN	1
 HAVE_REGEXPR_H_FUNCS
@@ -110,17 +114,24 @@
 HAVE_RESIZETERM
 HAVE_RESIZE_TERM
 HAVE_RIPOFFLINE	1
+HAVE_SCR_DUMP 1
 HAVE_SELECT
 HAVE_SETBUF
 HAVE_SETBUFFER
+HAVE_SETENV
 HAVE_SETUPTERM	1
 HAVE_SETVBUF
+HAVE_SGTTY_H
 HAVE_SIGACTION
 HAVE_SIGVEC
 HAVE_SIZECHANGE
 HAVE_SLK_COLOR
 HAVE_SLK_INIT	1
+HAVE_SNPRINTF
+HAVE_STDINT_H
 HAVE_STRDUP
+HAVE_STRLCAT
+HAVE_STRLCPY
 HAVE_STRSTR
 HAVE_SYMLINK
 HAVE_SYS_BSDTYPES_H
@@ -139,6 +150,7 @@
 HAVE_TERMIOS_H
 HAVE_TERMIO_H
 HAVE_TERMNAME	1
+HAVE_TERM_ENTRY_H	1
 HAVE_TERM_H	1
 HAVE_TGETENT	1
 HAVE_TIGETNUM	1
@@ -149,10 +161,17 @@
 HAVE_TYPEINFO
 HAVE_TYPE_ATTR_T
 HAVE_TYPE_SIGACTION
+HAVE_UNCTRL_H	1
 HAVE_UNISTD_H
 HAVE_UNLINK
 HAVE_USE_DEFAULT_COLORS
+HAVE_USE_ENV	1
+HAVE_USE_EXTENDED_NAMES
+HAVE_USE_SCREEN
+HAVE_USE_WINDOW
 HAVE_VFSCANF
+HAVE_VIDPUTS	1
+HAVE_VID_PUTS	1
 HAVE_VSNPRINTF
 HAVE_VSSCANF
 HAVE_WCSRTOMBS
@@ -163,19 +182,21 @@
 HAVE_WINSSTR	1
 HAVE_WORKING_POLL
 HAVE_WRESIZE
+HAVE_WSYNCDOWN	1
 HAVE__DOSCAN
 MIXEDCASE_FILENAMES
 NCURSES_CHAR_EQ
 NCURSES_EXPANDED
 NCURSES_EXT_COLORS
 NCURSES_EXT_FUNCS
+NCURSES_EXT_PUTWIN
 NCURSES_NO_PADDING
+NCURSES_OSPEED_COMPAT
 NCURSES_PATHSEP	':'
-NDEBUG
+NCURSES_WIDECHAR
 NEED_PTEM_H
 NO_LEAKS
 PURE_TERMINFO
-RETSIGTYPE
 STDC_HEADERS
 SVR4_ACTION
 SVR4_TERMIO
@@ -185,7 +206,6 @@
 TIME_WITH_SYS_TIME
 TYPEOF_CHTYPE
 USE_COLORFGBG
-USE_DATABASE
 USE_GETCAP
 USE_GETCAP_CACHE
 USE_HARD_TABS
@@ -195,14 +215,15 @@
 USE_LINKS
 USE_MY_MEMMOVE
 USE_OK_BCOPY
+USE_PTHREADS_EINTR
 USE_RCS_IDS
 USE_REENTRANT
 USE_SAFE_SPRINTF
 USE_SCROLL_HINTS
 USE_SIGWINCH
+USE_STRING_HACKS
 USE_SYMLINKS
 USE_SYSMOUSE
-USE_TERMCAP
 USE_WEAK_SYMBOLS
 USE_WIDEC_SUPPORT
 USE_XMC_SUPPORT
diff --git a/include/ncurses_dll.h b/include/ncurses_dll.h.in
similarity index 85%
rename from include/ncurses_dll.h
rename to include/ncurses_dll.h.in
index e24feee..676850c 100644
--- a/include/ncurses_dll.h
+++ b/include/ncurses_dll.h.in
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2006,2007 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2009,2014 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            *
@@ -25,11 +25,34 @@
  * sale, use or other dealings in this Software without prior written       *
  * authorization.                                                           *
  ****************************************************************************/
-/* $Id: ncurses_dll.h,v 1.6 2007/03/10 19:21:49 tom Exp $ */
+/* $Id: ncurses_dll.h.in,v 1.9 2014/08/02 21:30:20 tom Exp $ */
 
 #ifndef NCURSES_DLL_H_incl
 #define NCURSES_DLL_H_incl 1
 
+/* 2014-08-02 workaround for broken MinGW compiler.
+ * Oddly, only TRACE is mapped to trace - the other -D's are okay.
+ * suggest TDM as an alternative.
+ */
+#if defined(__MINGW64__)
+#elif defined(__MINGW32__)
+#if (__GNUC__ == 4) && (__GNUC_MINOR__ == 8)
+
+#ifdef trace
+#undef trace
+#define TRACE
+#endif
+
+#endif	/* broken compiler */
+#endif	/* MingW */
+
+/*
+ * For reentrant code, we map the various global variables into SCREEN by
+ * using functions to access them.
+ */
+#define NCURSES_PUBLIC_VAR(name) @NCURSES_WRAP_PREFIX@##name
+#define NCURSES_WRAPPED_VAR(type,name) extern type NCURSES_PUBLIC_VAR(name)(void)
+
 /* no longer needed on cygwin or mingw, thanks to auto-import       */
 /* but this structure may be useful at some point for an MSVC build */
 /* so, for now unconditionally define the important flags           */
@@ -37,7 +60,7 @@
 #undef NCURSES_DLL
 #define NCURSES_STATIC
 
-#if defined(__CYGWIN__)
+#if defined(__CYGWIN__) || defined(__MINGW32__)
 #  if defined(NCURSES_DLL)
 #    if defined(NCURSES_STATIC)
 #      undef NCURSES_STATIC
@@ -76,11 +99,4 @@
 #  define NCURSES_EXPORT_VAR(type) NCURSES_IMPEXP type
 #endif
 
-/*
- * For reentrant code, we map the various global variables into SCREEN by
- * using functions to access them.
- */
-#define NCURSES_PUBLIC_VAR(name) _nc_##name
-#define NCURSES_WRAPPED_VAR(type,name) extern type NCURSES_PUBLIC_VAR(name)(void)
-
 #endif /* NCURSES_DLL_H_incl */
diff --git a/include/eti.h b/include/ncurses_mingw.h
similarity index 63%
rename from include/eti.h
rename to include/ncurses_mingw.h
index baa6190..2bbad76 100644
--- a/include/eti.h
+++ b/include/ncurses_mingw.h
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2011,2014 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            *
@@ -27,28 +27,56 @@
  ****************************************************************************/
 
 /****************************************************************************
- *   Author:  Juergen Pfeifer, 1995,1997                                    *
+ * Author: Juergen Pfeifer, 2008-on                                         * 
+ *                                                                          *
  ****************************************************************************/
 
-/* $Id: eti.h,v 1.8 2003/10/25 15:24:29 tom Exp $ */
+/* $Id: ncurses_mingw.h,v 1.3 2014/05/03 19:40:19 juergen Exp $ */
 
-#ifndef NCURSES_ETI_H_incl
-#define NCURSES_ETI_H_incl 1
+/*
+ * This is a placeholder up to now and describes what needs to be implemented
+ * to support I/O to external terminals with ncurses on the Windows OS.
+ */
 
-#define	E_OK			(0)
-#define	E_SYSTEM_ERROR	 	(-1)
-#define	E_BAD_ARGUMENT	 	(-2)
-#define	E_POSTED	 	(-3)
-#define	E_CONNECTED	 	(-4)
-#define	E_BAD_STATE	 	(-5)
-#define	E_NO_ROOM	 	(-6)
-#define	E_NOT_POSTED		(-7)
-#define	E_UNKNOWN_COMMAND	(-8)
-#define	E_NO_MATCH		(-9)
-#define	E_NOT_SELECTABLE	(-10)
-#define	E_NOT_CONNECTED	        (-11)
-#define	E_REQUEST_DENIED	(-12)
-#define	E_INVALID_FIELD	        (-13)
-#define	E_CURRENT		(-14)
+#if __MINGW32__
+#ifndef _NC_MINGWH
+#define _NC_MINGWH
 
-#endif
+#define USE_CONSOLE_DRIVER 1
+
+#undef  TERMIOS
+#define TERMIOS 1
+
+typedef unsigned char cc_t;
+typedef unsigned int  tcflag_t;
+typedef unsigned int  speed_t;
+typedef unsigned short otcflag_t;
+typedef unsigned char ospeed_t;
+
+#define NCCS 18
+struct termios
+{
+  tcflag_t	c_iflag;
+  tcflag_t	c_oflag;
+  tcflag_t	c_cflag;
+  tcflag_t	c_lflag;
+  char		c_line;
+  cc_t		c_cc[NCCS];
+  speed_t	c_ispeed;
+  speed_t	c_ospeed;
+};
+
+extern NCURSES_EXPORT(int)  _nc_mingw_tcsetattr(
+    int fd, 
+    int optional_actions, 
+    const struct termios* arg);
+extern NCURSES_EXPORT(int)  _nc_mingw_tcgetattr(
+    int fd, 
+    struct termios* arg);
+extern NCURSES_EXPORT(int)  _nc_mingw_tcflush(
+    int fd, 
+    int queue);
+extern NCURSES_EXPORT(void) _nc_set_term_driver(void* term);
+
+#endif /* _NC_MINGWH */
+#endif /* __MINGW32__ */
diff --git a/include/panel.h b/include/panel.h
deleted file mode 100644
index 1e02091..0000000
--- a/include/panel.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/****************************************************************************
- * Copyright (c) 1998-2001,2006 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> 1995                    *
- *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
- ****************************************************************************/
-
-/* $Id: panel.h,v 1.10 2006/05/27 19:49:40 tom Exp $ */
-
-/* panel.h -- interface file for panels library */
-
-#ifndef NCURSES_PANEL_H_incl
-#define NCURSES_PANEL_H_incl 1
-
-#include <curses.h>
-
-typedef struct panel
-{
-  WINDOW *win;
-  struct panel *below;
-  struct panel *above;
-  NCURSES_CONST void *user;
-} PANEL;
-
-#if	defined(__cplusplus)
-extern "C" {
-#endif
-
-extern NCURSES_EXPORT(WINDOW*) panel_window (const PANEL *);
-extern NCURSES_EXPORT(void)    update_panels (void);
-extern NCURSES_EXPORT(int)     hide_panel (PANEL *);
-extern NCURSES_EXPORT(int)     show_panel (PANEL *);
-extern NCURSES_EXPORT(int)     del_panel (PANEL *);
-extern NCURSES_EXPORT(int)     top_panel (PANEL *);
-extern NCURSES_EXPORT(int)     bottom_panel (PANEL *);
-extern NCURSES_EXPORT(PANEL*)  new_panel (WINDOW *);
-extern NCURSES_EXPORT(PANEL*)  panel_above (const PANEL *);
-extern NCURSES_EXPORT(PANEL*)  panel_below (const PANEL *);
-extern NCURSES_EXPORT(int)     set_panel_userptr (PANEL *, NCURSES_CONST void *);
-extern NCURSES_EXPORT(NCURSES_CONST void*) panel_userptr (const PANEL *);
-extern NCURSES_EXPORT(int)     move_panel (PANEL *, int, int);
-extern NCURSES_EXPORT(int)     replace_panel (PANEL *,WINDOW *);
-extern NCURSES_EXPORT(int)     panel_hidden (const PANEL *);
-
-#if	defined(__cplusplus)
-}
-#endif
-
-#endif /* NCURSES_PANEL_H_incl */
-
-/* end of panel.h */
diff --git a/include/parametrized.h b/include/parametrized.h
deleted file mode 100644
index 950a947..0000000
--- a/include/parametrized.h
+++ /dev/null
@@ -1,560 +0,0 @@
-/*
- * parametrized.h --- is a termcap capability parametrized?
- *
- * Note: this file is generated using MKparametrized.sh, do not edit by hand.
- * A value of -1 in the table means suppress both pad and % translations.
- * A value of 0 in the table means do pad but not % translations.
- * A value of 1 in the table means do both pad and % translations.
- */
-
-static short const parametrized[] = {
-0,	/*  cbt  */
-0,	/*  bel  */
-0,	/*  cr  */
-1,	/*  csr  */
-0,	/*  tbc  */
-0,	/*  clear  */
-0,	/*  el  */
-0,	/*  ed  */
-1,	/*  hpa  */
-0,	/*  cmdch  */
-1,	/*  cup  */
-0,	/*  cud1  */
-0,	/*  home  */
-0,	/*  civis  */
-0,	/*  cub1  */
-1,	/*  mrcup  */
-0,	/*  cnorm  */
-0,	/*  cuf1  */
-0,	/*  ll  */
-0,	/*  cuu1  */
-0,	/*  cvvis  */
-0,	/*  dch1  */
-0,	/*  dl1  */
-0,	/*  dsl  */
-0,	/*  hd  */
-0,	/*  smacs  */
-0,	/*  blink  */
-0,	/*  bold  */
-0,	/*  smcup  */
-0,	/*  smdc  */
-0,	/*  dim  */
-0,	/*  smir  */
-0,	/*  invis  */
-0,	/*  prot  */
-0,	/*  rev  */
-0,	/*  smso  */
-0,	/*  smul  */
-1,	/*  ech  */
-0,	/*  rmacs  */
-0,	/*  sgr0  */
-0,	/*  rmcup  */
-0,	/*  rmdc  */
-0,	/*  rmir  */
-0,	/*  rmso  */
-0,	/*  rmul  */
-0,	/*  flash  */
-0,	/*  ff  */
-0,	/*  fsl  */
-0,	/*  is1  */
-0,	/*  is2  */
-0,	/*  is3  */
-0,	/*  if  */
-0,	/*  ich1  */
-0,	/*  il1  */
-0,	/*  ip  */
-0,	/*  kbs  */
-0,	/*  ktbc  */
-0,	/*  kclr  */
-0,	/*  kctab  */
-0,	/*  kdch1  */
-0,	/*  kdl1  */
-0,	/*  kcud1  */
-0,	/*  krmir  */
-0,	/*  kel  */
-0,	/*  ked  */
-0,	/*  kf0  */
-0,	/*  kf1  */
-0,	/*  kf10  */
-0,	/*  kf2  */
-0,	/*  kf3  */
-0,	/*  kf4  */
-0,	/*  kf5  */
-0,	/*  kf6  */
-0,	/*  kf7  */
-0,	/*  kf8  */
-0,	/*  kf9  */
-0,	/*  khome  */
-0,	/*  kich1  */
-0,	/*  kil1  */
-0,	/*  kcub1  */
-0,	/*  kll  */
-0,	/*  knp  */
-0,	/*  kpp  */
-0,	/*  kcuf1  */
-0,	/*  kind  */
-0,	/*  kri  */
-0,	/*  khts  */
-0,	/*  kcuu1  */
-0,	/*  rmkx  */
-0,	/*  smkx  */
-0,	/*  lf0  */
-0,	/*  lf1  */
-0,	/*  lf10  */
-0,	/*  lf2  */
-0,	/*  lf3  */
-0,	/*  lf4  */
-0,	/*  lf5  */
-0,	/*  lf6  */
-0,	/*  lf7  */
-0,	/*  lf8  */
-0,	/*  lf9  */
-0,	/*  rmm  */
-0,	/*  smm  */
-0,	/*  nel  */
-0,	/*  pad  */
-1,	/*  dch  */
-1,	/*  dl  */
-1,	/*  cud  */
-1,	/*  ich  */
-1,	/*  indn  */
-1,	/*  il  */
-1,	/*  cub  */
-1,	/*  cuf  */
-1,	/*  rin  */
-1,	/*  cuu  */
-1,	/*  pfkey  */
-1,	/*  pfloc  */
-1,	/*  pfx  */
-0,	/*  mc0  */
-0,	/*  mc4  */
-0,	/*  mc5  */
-1,	/*  rep  */
-0,	/*  rs1  */
-0,	/*  rs2  */
-0,	/*  rs3  */
-0,	/*  rf  */
-0,	/*  rc  */
-1,	/*  vpa  */
-0,	/*  sc  */
-0,	/*  ind  */
-0,	/*  ri  */
-1,	/*  sgr  */
-0,	/*  hts  */
-1,	/*  wind  */
-0,	/*  ht  */
-1,	/*  tsl  */
-0,	/*  uc  */
-0,	/*  hu  */
-0,	/*  iprog  */
-0,	/*  ka1  */
-0,	/*  ka3  */
-0,	/*  kb2  */
-0,	/*  kc1  */
-0,	/*  kc3  */
-1,	/*  mc5p  */
-0,	/*  rmp  */
--1,	/*  acsc  */
-1,	/*  pln  */
-0,	/*  kcbt  */
-0,	/*  smxon  */
-0,	/*  rmxon  */
-0,	/*  smam  */
-0,	/*  rmam  */
-0,	/*  xonc  */
-0,	/*  xoffc  */
-0,	/*  enacs  */
-0,	/*  smln  */
-0,	/*  rmln  */
-0,	/*  kbeg  */
-0,	/*  kcan  */
-0,	/*  kclo  */
-0,	/*  kcmd  */
-0,	/*  kcpy  */
-0,	/*  kcrt  */
-0,	/*  kend  */
-0,	/*  kent  */
-0,	/*  kext  */
-0,	/*  kfnd  */
-0,	/*  khlp  */
-0,	/*  kmrk  */
-0,	/*  kmsg  */
-0,	/*  kmov  */
-0,	/*  knxt  */
-0,	/*  kopn  */
-0,	/*  kopt  */
-0,	/*  kprv  */
-0,	/*  kprt  */
-0,	/*  krdo  */
-0,	/*  kref  */
-0,	/*  krfr  */
-0,	/*  krpl  */
-0,	/*  krst  */
-0,	/*  kres  */
-0,	/*  ksav  */
-0,	/*  kspd  */
-0,	/*  kund  */
-0,	/*  kBEG  */
-0,	/*  kCAN  */
-0,	/*  kCMD  */
-0,	/*  kCPY  */
-0,	/*  kCRT  */
-0,	/*  kDC  */
-0,	/*  kDL  */
-0,	/*  kslt  */
-0,	/*  kEND  */
-0,	/*  kEOL  */
-0,	/*  kEXT  */
-0,	/*  kFND  */
-1,	/*  kHLP  */
-1,	/*  kHOM  */
-1,	/*  kIC  */
-1,	/*  kLFT  */
-0,	/*  kMSG  */
-0,	/*  kMOV  */
-0,	/*  kNXT  */
-0,	/*  kOPT  */
-0,	/*  kPRV  */
-0,	/*  kPRT  */
-0,	/*  kRDO  */
-0,	/*  kRPL  */
-0,	/*  kRIT  */
-0,	/*  kRES  */
-0,	/*  kSAV  */
-0,	/*  kSPD  */
-0,	/*  kUND  */
-0,	/*  rfi  */
-0,	/*  kf11  */
-0,	/*  kf12  */
-0,	/*  kf13  */
-0,	/*  kf14  */
-0,	/*  kf15  */
-0,	/*  kf16  */
-0,	/*  kf17  */
-0,	/*  kf18  */
-0,	/*  kf19  */
-0,	/*  kf20  */
-0,	/*  kf21  */
-0,	/*  kf22  */
-0,	/*  kf23  */
-0,	/*  kf24  */
-0,	/*  kf25  */
-0,	/*  kf26  */
-0,	/*  kf27  */
-0,	/*  kf28  */
-0,	/*  kf29  */
-0,	/*  kf30  */
-0,	/*  kf31  */
-0,	/*  kf32  */
-0,	/*  kf33  */
-0,	/*  kf34  */
-0,	/*  kf35  */
-0,	/*  kf36  */
-0,	/*  kf37  */
-0,	/*  kf38  */
-0,	/*  kf39  */
-0,	/*  kf40  */
-0,	/*  kf41  */
-0,	/*  kf42  */
-0,	/*  kf43  */
-0,	/*  kf44  */
-0,	/*  kf45  */
-0,	/*  kf46  */
-0,	/*  kf47  */
-0,	/*  kf48  */
-0,	/*  kf49  */
-0,	/*  kf50  */
-0,	/*  kf51  */
-0,	/*  kf52  */
-0,	/*  kf53  */
-0,	/*  kf54  */
-0,	/*  kf55  */
-0,	/*  kf56  */
-0,	/*  kf57  */
-0,	/*  kf58  */
-0,	/*  kf59  */
-0,	/*  kf60  */
-0,	/*  kf61  */
-0,	/*  kf62  */
-0,	/*  kf63  */
-0,	/*  el1  */
-0,	/*  mgc  */
-0,	/*  smgl  */
-0,	/*  smgr  */
-0,	/*  fln  */
-1,	/*  sclk  */
-0,	/*  dclk  */
-0,	/*  rmclk  */
-1,	/*  cwin  */
-1,	/*  wingo  */
-0,	/*  hup  */
-1,	/*  dial  */
-1,	/*  qdial  */
-0,	/*  tone  */
-0,	/*  pulse  */
-0,	/*  hook  */
-0,	/*  pause  */
-0,	/*  wait  */
-1,	/*  u0  */
-1,	/*  u1  */
-1,	/*  u2  */
-1,	/*  u3  */
-1,	/*  u4  */
-1,	/*  u5  */
-1,	/*  u6  */
-1,	/*  u7  */
-1,	/*  u8  */
-1,	/*  u9  */
-0,	/*  op  */
-0,	/*  oc  */
-1,	/*  initc  */
-1,	/*  initp  */
-1,	/*  scp  */
-1,	/*  setf  */
-1,	/*  setb  */
-1,	/*  cpi  */
-1,	/*  lpi  */
-1,	/*  chr  */
-1,	/*  cvr  */
-1,	/*  defc  */
-0,	/*  swidm  */
-0,	/*  sdrfq  */
-0,	/*  sitm  */
-0,	/*  slm  */
-0,	/*  smicm  */
-0,	/*  snlq  */
-0,	/*  snrmq  */
-0,	/*  sshm  */
-0,	/*  ssubm  */
-0,	/*  ssupm  */
-0,	/*  sum  */
-0,	/*  rwidm  */
-0,	/*  ritm  */
-0,	/*  rlm  */
-0,	/*  rmicm  */
-0,	/*  rshm  */
-0,	/*  rsubm  */
-0,	/*  rsupm  */
-0,	/*  rum  */
-0,	/*  mhpa  */
-0,	/*  mcud1  */
-0,	/*  mcub1  */
-0,	/*  mcuf1  */
-1,	/*  mvpa  */
-0,	/*  mcuu1  */
-0,	/*  porder  */
-0,	/*  mcud  */
-0,	/*  mcub  */
-0,	/*  mcuf  */
-0,	/*  mcuu  */
-1,	/*  scs  */
-0,	/*  smgb  */
-1,	/*  smgbp  */
-1,	/*  smglp  */
-1,	/*  smgrp  */
-0,	/*  smgt  */
-1,	/*  smgtp  */
-0,	/*  sbim  */
-1,	/*  scsd  */
-0,	/*  rbim  */
-1,	/*  rcsd  */
-0,	/*  subcs  */
-0,	/*  supcs  */
-0,	/*  docr  */
-0,	/*  zerom  */
-1,	/*  csnm  */
-0,	/*  kmous  */
-0,	/*  minfo  */
-0,	/*  reqmp  */
-1,	/*  getm  */
-1,	/*  setaf  */
-1,	/*  setab  */
-1,	/*  pfxl  */
-0,	/*  devt  */
-0,	/*  csin  */
-0,	/*  s0ds  */
-0,	/*  s1ds  */
-0,	/*  s2ds  */
-0,	/*  s3ds  */
-1,	/*  smglr  */
-1,	/*  smgtb  */
-1,	/*  birep  */
-0,	/*  binel  */
-0,	/*  bicr  */
-1,	/*  colornm  */
-0,	/*  defbi  */
-0,	/*  endbi  */
-1,	/*  setcolor  */
-1,	/*  slines  */
-1,	/*  dispc  */
-0,	/*  smpch  */
-0,	/*  rmpch  */
-0,	/*  smsc  */
-0,	/*  rmsc  */
-0,	/*  pctrm  */
-0,	/*  scesc  */
-0,	/*  scesa  */
-0,	/*  ehhlm  */
-0,	/*  elhlm  */
-0,	/*  elohlm  */
-0,	/*  erhlm  */
-0,	/*  ethlm  */
-0,	/*  evhlm  */
-1,	/*  sgr1  */
-1,	/*  slength  */
-0,	/*  OTi2  */
-0,	/*  OTrs  */
-0,	/*  OTnl  */
-0,	/*  OTbc  */
-0,	/*  OTko  */
-0,	/*  OTma  */
--1,	/*  OTG2  */
--1,	/*  OTG3  */
--1,	/*  OTG1  */
--1,	/*  OTG4  */
--1,	/*  OTGR  */
--1,	/*  OTGL  */
--1,	/*  OTGU  */
--1,	/*  OTGD  */
--1,	/*  OTGH  */
--1,	/*  OTGV  */
--1,	/*  OTGC  */
-0,	/*  meml  */
-0,	/*  memu  */
-1,	/*  pln  */
-0,	/*  smln  */
-0,	/*  rmln  */
-0,	/*  kf11  */
-0,	/*  kf12  */
-0,	/*  kf13  */
-0,	/*  kf14  */
-0,	/*  kf15  */
-0,	/*  kf16  */
-0,	/*  kf17  */
-0,	/*  kf18  */
-0,	/*  kf19  */
-0,	/*  kf20  */
-0,	/*  kf21  */
-0,	/*  kf22  */
-0,	/*  kf23  */
-0,	/*  kf24  */
-0,	/*  kf25  */
-0,	/*  kf26  */
-0,	/*  kf27  */
-0,	/*  kf28  */
-0,	/*  kf29  */
-0,	/*  kf30  */
-0,	/*  kf31  */
-0,	/*  kf32  */
-0,	/*  kf33  */
-0,	/*  kf34  */
-0,	/*  kf35  */
-0,	/*  kf36  */
-0,	/*  kf37  */
-0,	/*  kf38  */
-0,	/*  kf39  */
-0,	/*  kf40  */
-0,	/*  kf41  */
-0,	/*  kf42  */
-0,	/*  kf43  */
-0,	/*  kf44  */
-0,	/*  kf45  */
-0,	/*  kf46  */
-0,	/*  kf47  */
-0,	/*  kf48  */
-0,	/*  kf49  */
-0,	/*  kf50  */
-0,	/*  kf51  */
-0,	/*  kf52  */
-0,	/*  kf53  */
-0,	/*  kf54  */
-0,	/*  kf55  */
-0,	/*  kf56  */
-0,	/*  kf57  */
-0,	/*  kf58  */
-0,	/*  kf59  */
-0,	/*  kf60  */
-0,	/*  kf61  */
-0,	/*  kf62  */
-0,	/*  kf63  */
-0,	/*  box1  */
-0,	/*  box2  */
-0,	/*  batt1  */
-0,	/*  batt2  */
-0,	/*  colb0  */
-0,	/*  colb1  */
-0,	/*  colb2  */
-0,	/*  colb3  */
-0,	/*  colb4  */
-0,	/*  colb5  */
-0,	/*  colb6  */
-0,	/*  colb7  */
-0,	/*  colf0  */
-0,	/*  colf1  */
-0,	/*  colf2  */
-0,	/*  colf3  */
-0,	/*  colf4  */
-0,	/*  colf5  */
-0,	/*  colf6  */
-0,	/*  colf7  */
-0,	/*  font0  */
-0,	/*  font1  */
-0,	/*  font2  */
-0,	/*  font3  */
-0,	/*  font4  */
-0,	/*  font5  */
-0,	/*  font6  */
-0,	/*  font7  */
-0,	/*  kbtab  */
-0,	/*  kdo  */
-0,	/*  kcmd  */
-0,	/*  kcpn  */
-0,	/*  kend  */
-0,	/*  khlp  */
-0,	/*  knl  */
-0,	/*  knpn  */
-0,	/*  kppn  */
-0,	/*  kppn  */
-0,	/*  kquit  */
-0,	/*  ksel  */
-0,	/*  kscl  */
-0,	/*  kscr  */
-0,	/*  ktab  */
-0,	/*  kmpf1  */
-0,	/*  kmpt1  */
-0,	/*  kmpf2  */
-0,	/*  kmpt2  */
-0,	/*  kmpf3  */
-0,	/*  kmpt3  */
-0,	/*  kmpf4  */
-0,	/*  kmpt4  */
-0,	/*  kmpf5  */
-0,	/*  kmpt5  */
-0,	/*  apstr  */
-0,	/*  kmpf6  */
-0,	/*  kmpt6  */
-0,	/*  kmpf7  */
-0,	/*  kmpt7  */
-0,	/*  kmpf8  */
-0,	/*  kmpt8  */
-0,	/*  kmpf9  */
-0,	/*  kmpt9  */
-0,	/*  ksf1  */
-0,	/*  ksf2  */
-0,	/*  ksf3  */
-0,	/*  ksf4  */
-0,	/*  ksf5  */
-0,	/*  ksf6  */
-0,	/*  ksf7  */
-0,	/*  ksf8  */
-0,	/*  ksf9  */
-0,	/*  ksf10  */
-0,	/*  kf11  */
-0,	/*  kf12  */
-0,	/*  kact  */
-0,	/*  topl  */
-0,	/*  btml  */
-0,	/*  rvert  */
-0,	/*  lvert  */
-} /* 548 entries */;
-
diff --git a/include/term.h b/include/term.h
deleted file mode 100644
index 6ab89c2..0000000
--- a/include/term.h
+++ /dev/null
@@ -1,792 +0,0 @@
-/****************************************************************************
- * Copyright (c) 1998-2007,2008 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>                          */
-/*    and: Thomas E. Dickey                        1995-on                  */
-/****************************************************************************/
-
-/* $Id: MKterm.h.awk.in,v 1.50 2008/05/24 23:13:59 tom Exp $ */
-
-/*
-**	term.h -- Definition of struct term
-*/
-
-#ifndef NCURSES_TERM_H_incl
-#define NCURSES_TERM_H_incl 1
-
-#undef  NCURSES_VERSION
-#define NCURSES_VERSION "5.7"
-
-#include <ncurses_dll.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Make this file self-contained by providing defaults for the HAVE_TERMIO[S]_H
- * definition (based on the system for which this was configured).
- */
-
-#undef  NCURSES_CONST
-#define NCURSES_CONST /*nothing*/
-
-#undef  NCURSES_SBOOL
-#define NCURSES_SBOOL char
-
-#undef  NCURSES_XNAMES
-#define NCURSES_XNAMES 1
-
-/* We will use these symbols to hide differences between
- * termios/termio/sgttyb interfaces.
- */
-#undef  TTY
-#undef  SET_TTY
-#undef  GET_TTY
-
-/* Assume POSIX termio if we have the header and function */
-/* #if HAVE_TERMIOS_H && HAVE_TCGETATTR */
-#if 1 && 1
-
-#undef  TERMIOS
-#define TERMIOS 1
-
-#include <termios.h>
-#define TTY struct termios
-
-#else /* !HAVE_TERMIOS_H */
-
-/* #if HAVE_TERMIO_H */
-#if 0
-
-#undef  TERMIOS
-#define TERMIOS 1
-
-#include <termio.h>
-#define TTY struct termio
-
-/* Add definitions to make termio look like termios.
- * But ifdef it, since there are some implementations
- * that try to do this for us in a fake <termio.h>.
- */
-#ifndef TCSANOW
-#define TCSANOW TCSETA
-#endif
-#ifndef TCSADRAIN
-#define TCSADRAIN TCSETAW
-#endif
-#ifndef TCSAFLUSH
-#define TCSAFLUSH TCSETAF
-#endif
-#ifndef tcsetattr
-#define tcsetattr(fd, cmd, arg) ioctl(fd, cmd, arg)
-#endif
-#ifndef tcgetattr
-#define tcgetattr(fd, arg) ioctl(fd, TCGETA, arg)
-#endif
-#ifndef cfgetospeed
-#define cfgetospeed(t) ((t)->c_cflag & CBAUD)
-#endif
-#ifndef TCIFLUSH 
-#define TCIFLUSH 0
-#endif
-#ifndef TCOFLUSH 
-#define TCOFLUSH 1
-#endif
-#ifndef TCIOFLUSH 
-#define TCIOFLUSH 2
-#endif
-#ifndef tcflush
-#define tcflush(fd, arg) ioctl(fd, TCFLSH, arg)
-#endif
-
-#else /* !HAVE_TERMIO_H */
-
-#undef TERMIOS
-#include <sgtty.h>
-#include <sys/ioctl.h>
-#define TTY struct sgttyb
-
-#endif /* HAVE_TERMIO_H */
-
-#endif /* HAVE_TERMIOS_H */
-
-#ifdef TERMIOS
-#define GET_TTY(fd, buf) tcgetattr(fd, buf)
-#define SET_TTY(fd, buf) tcsetattr(fd, TCSADRAIN, buf)
-#else
-#define GET_TTY(fd, buf) gtty(fd, buf)
-#define SET_TTY(fd, buf) stty(fd, buf)
-#endif
-
-#define NAMESIZE 256
-
-#define CUR cur_term->type.
-
-#define auto_left_margin               CUR Booleans[0]
-#define auto_right_margin              CUR Booleans[1]
-#define no_esc_ctlc                    CUR Booleans[2]
-#define ceol_standout_glitch           CUR Booleans[3]
-#define eat_newline_glitch             CUR Booleans[4]
-#define erase_overstrike               CUR Booleans[5]
-#define generic_type                   CUR Booleans[6]
-#define hard_copy                      CUR Booleans[7]
-#define has_meta_key                   CUR Booleans[8]
-#define has_status_line                CUR Booleans[9]
-#define insert_null_glitch             CUR Booleans[10]
-#define memory_above                   CUR Booleans[11]
-#define memory_below                   CUR Booleans[12]
-#define move_insert_mode               CUR Booleans[13]
-#define move_standout_mode             CUR Booleans[14]
-#define over_strike                    CUR Booleans[15]
-#define status_line_esc_ok             CUR Booleans[16]
-#define dest_tabs_magic_smso           CUR Booleans[17]
-#define tilde_glitch                   CUR Booleans[18]
-#define transparent_underline          CUR Booleans[19]
-#define xon_xoff                       CUR Booleans[20]
-#define needs_xon_xoff                 CUR Booleans[21]
-#define prtr_silent                    CUR Booleans[22]
-#define hard_cursor                    CUR Booleans[23]
-#define non_rev_rmcup                  CUR Booleans[24]
-#define no_pad_char                    CUR Booleans[25]
-#define non_dest_scroll_region         CUR Booleans[26]
-#define can_change                     CUR Booleans[27]
-#define back_color_erase               CUR Booleans[28]
-#define hue_lightness_saturation       CUR Booleans[29]
-#define col_addr_glitch                CUR Booleans[30]
-#define cr_cancels_micro_mode          CUR Booleans[31]
-#define has_print_wheel                CUR Booleans[32]
-#define row_addr_glitch                CUR Booleans[33]
-#define semi_auto_right_margin         CUR Booleans[34]
-#define cpi_changes_res                CUR Booleans[35]
-#define lpi_changes_res                CUR Booleans[36]
-#define columns                        CUR Numbers[0]
-#define init_tabs                      CUR Numbers[1]
-#define lines                          CUR Numbers[2]
-#define lines_of_memory                CUR Numbers[3]
-#define magic_cookie_glitch            CUR Numbers[4]
-#define padding_baud_rate              CUR Numbers[5]
-#define virtual_terminal               CUR Numbers[6]
-#define width_status_line              CUR Numbers[7]
-#define num_labels                     CUR Numbers[8]
-#define label_height                   CUR Numbers[9]
-#define label_width                    CUR Numbers[10]
-#define max_attributes                 CUR Numbers[11]
-#define maximum_windows                CUR Numbers[12]
-#define max_colors                     CUR Numbers[13]
-#define max_pairs                      CUR Numbers[14]
-#define no_color_video                 CUR Numbers[15]
-#define buffer_capacity                CUR Numbers[16]
-#define dot_vert_spacing               CUR Numbers[17]
-#define dot_horz_spacing               CUR Numbers[18]
-#define max_micro_address              CUR Numbers[19]
-#define max_micro_jump                 CUR Numbers[20]
-#define micro_col_size                 CUR Numbers[21]
-#define micro_line_size                CUR Numbers[22]
-#define number_of_pins                 CUR Numbers[23]
-#define output_res_char                CUR Numbers[24]
-#define output_res_line                CUR Numbers[25]
-#define output_res_horz_inch           CUR Numbers[26]
-#define output_res_vert_inch           CUR Numbers[27]
-#define print_rate                     CUR Numbers[28]
-#define wide_char_size                 CUR Numbers[29]
-#define buttons                        CUR Numbers[30]
-#define bit_image_entwining            CUR Numbers[31]
-#define bit_image_type                 CUR Numbers[32]
-#define back_tab                       CUR Strings[0]
-#define bell                           CUR Strings[1]
-#define carriage_return                CUR Strings[2]
-#define change_scroll_region           CUR Strings[3]
-#define clear_all_tabs                 CUR Strings[4]
-#define clear_screen                   CUR Strings[5]
-#define clr_eol                        CUR Strings[6]
-#define clr_eos                        CUR Strings[7]
-#define column_address                 CUR Strings[8]
-#define command_character              CUR Strings[9]
-#define cursor_address                 CUR Strings[10]
-#define cursor_down                    CUR Strings[11]
-#define cursor_home                    CUR Strings[12]
-#define cursor_invisible               CUR Strings[13]
-#define cursor_left                    CUR Strings[14]
-#define cursor_mem_address             CUR Strings[15]
-#define cursor_normal                  CUR Strings[16]
-#define cursor_right                   CUR Strings[17]
-#define cursor_to_ll                   CUR Strings[18]
-#define cursor_up                      CUR Strings[19]
-#define cursor_visible                 CUR Strings[20]
-#define delete_character               CUR Strings[21]
-#define delete_line                    CUR Strings[22]
-#define dis_status_line                CUR Strings[23]
-#define down_half_line                 CUR Strings[24]
-#define enter_alt_charset_mode         CUR Strings[25]
-#define enter_blink_mode               CUR Strings[26]
-#define enter_bold_mode                CUR Strings[27]
-#define enter_ca_mode                  CUR Strings[28]
-#define enter_delete_mode              CUR Strings[29]
-#define enter_dim_mode                 CUR Strings[30]
-#define enter_insert_mode              CUR Strings[31]
-#define enter_secure_mode              CUR Strings[32]
-#define enter_protected_mode           CUR Strings[33]
-#define enter_reverse_mode             CUR Strings[34]
-#define enter_standout_mode            CUR Strings[35]
-#define enter_underline_mode           CUR Strings[36]
-#define erase_chars                    CUR Strings[37]
-#define exit_alt_charset_mode          CUR Strings[38]
-#define exit_attribute_mode            CUR Strings[39]
-#define exit_ca_mode                   CUR Strings[40]
-#define exit_delete_mode               CUR Strings[41]
-#define exit_insert_mode               CUR Strings[42]
-#define exit_standout_mode             CUR Strings[43]
-#define exit_underline_mode            CUR Strings[44]
-#define flash_screen                   CUR Strings[45]
-#define form_feed                      CUR Strings[46]
-#define from_status_line               CUR Strings[47]
-#define init_1string                   CUR Strings[48]
-#define init_2string                   CUR Strings[49]
-#define init_3string                   CUR Strings[50]
-#define init_file                      CUR Strings[51]
-#define insert_character               CUR Strings[52]
-#define insert_line                    CUR Strings[53]
-#define insert_padding                 CUR Strings[54]
-#define key_backspace                  CUR Strings[55]
-#define key_catab                      CUR Strings[56]
-#define key_clear                      CUR Strings[57]
-#define key_ctab                       CUR Strings[58]
-#define key_dc                         CUR Strings[59]
-#define key_dl                         CUR Strings[60]
-#define key_down                       CUR Strings[61]
-#define key_eic                        CUR Strings[62]
-#define key_eol                        CUR Strings[63]
-#define key_eos                        CUR Strings[64]
-#define key_f0                         CUR Strings[65]
-#define key_f1                         CUR Strings[66]
-#define key_f10                        CUR Strings[67]
-#define key_f2                         CUR Strings[68]
-#define key_f3                         CUR Strings[69]
-#define key_f4                         CUR Strings[70]
-#define key_f5                         CUR Strings[71]
-#define key_f6                         CUR Strings[72]
-#define key_f7                         CUR Strings[73]
-#define key_f8                         CUR Strings[74]
-#define key_f9                         CUR Strings[75]
-#define key_home                       CUR Strings[76]
-#define key_ic                         CUR Strings[77]
-#define key_il                         CUR Strings[78]
-#define key_left                       CUR Strings[79]
-#define key_ll                         CUR Strings[80]
-#define key_npage                      CUR Strings[81]
-#define key_ppage                      CUR Strings[82]
-#define key_right                      CUR Strings[83]
-#define key_sf                         CUR Strings[84]
-#define key_sr                         CUR Strings[85]
-#define key_stab                       CUR Strings[86]
-#define key_up                         CUR Strings[87]
-#define keypad_local                   CUR Strings[88]
-#define keypad_xmit                    CUR Strings[89]
-#define lab_f0                         CUR Strings[90]
-#define lab_f1                         CUR Strings[91]
-#define lab_f10                        CUR Strings[92]
-#define lab_f2                         CUR Strings[93]
-#define lab_f3                         CUR Strings[94]
-#define lab_f4                         CUR Strings[95]
-#define lab_f5                         CUR Strings[96]
-#define lab_f6                         CUR Strings[97]
-#define lab_f7                         CUR Strings[98]
-#define lab_f8                         CUR Strings[99]
-#define lab_f9                         CUR Strings[100]
-#define meta_off                       CUR Strings[101]
-#define meta_on                        CUR Strings[102]
-#define newline                        CUR Strings[103]
-#define pad_char                       CUR Strings[104]
-#define parm_dch                       CUR Strings[105]
-#define parm_delete_line               CUR Strings[106]
-#define parm_down_cursor               CUR Strings[107]
-#define parm_ich                       CUR Strings[108]
-#define parm_index                     CUR Strings[109]
-#define parm_insert_line               CUR Strings[110]
-#define parm_left_cursor               CUR Strings[111]
-#define parm_right_cursor              CUR Strings[112]
-#define parm_rindex                    CUR Strings[113]
-#define parm_up_cursor                 CUR Strings[114]
-#define pkey_key                       CUR Strings[115]
-#define pkey_local                     CUR Strings[116]
-#define pkey_xmit                      CUR Strings[117]
-#define print_screen                   CUR Strings[118]
-#define prtr_off                       CUR Strings[119]
-#define prtr_on                        CUR Strings[120]
-#define repeat_char                    CUR Strings[121]
-#define reset_1string                  CUR Strings[122]
-#define reset_2string                  CUR Strings[123]
-#define reset_3string                  CUR Strings[124]
-#define reset_file                     CUR Strings[125]
-#define restore_cursor                 CUR Strings[126]
-#define row_address                    CUR Strings[127]
-#define save_cursor                    CUR Strings[128]
-#define scroll_forward                 CUR Strings[129]
-#define scroll_reverse                 CUR Strings[130]
-#define set_attributes                 CUR Strings[131]
-#define set_tab                        CUR Strings[132]
-#define set_window                     CUR Strings[133]
-#define tab                            CUR Strings[134]
-#define to_status_line                 CUR Strings[135]
-#define underline_char                 CUR Strings[136]
-#define up_half_line                   CUR Strings[137]
-#define init_prog                      CUR Strings[138]
-#define key_a1                         CUR Strings[139]
-#define key_a3                         CUR Strings[140]
-#define key_b2                         CUR Strings[141]
-#define key_c1                         CUR Strings[142]
-#define key_c3                         CUR Strings[143]
-#define prtr_non                       CUR Strings[144]
-#define char_padding                   CUR Strings[145]
-#define acs_chars                      CUR Strings[146]
-#define plab_norm                      CUR Strings[147]
-#define key_btab                       CUR Strings[148]
-#define enter_xon_mode                 CUR Strings[149]
-#define exit_xon_mode                  CUR Strings[150]
-#define enter_am_mode                  CUR Strings[151]
-#define exit_am_mode                   CUR Strings[152]
-#define xon_character                  CUR Strings[153]
-#define xoff_character                 CUR Strings[154]
-#define ena_acs                        CUR Strings[155]
-#define label_on                       CUR Strings[156]
-#define label_off                      CUR Strings[157]
-#define key_beg                        CUR Strings[158]
-#define key_cancel                     CUR Strings[159]
-#define key_close                      CUR Strings[160]
-#define key_command                    CUR Strings[161]
-#define key_copy                       CUR Strings[162]
-#define key_create                     CUR Strings[163]
-#define key_end                        CUR Strings[164]
-#define key_enter                      CUR Strings[165]
-#define key_exit                       CUR Strings[166]
-#define key_find                       CUR Strings[167]
-#define key_help                       CUR Strings[168]
-#define key_mark                       CUR Strings[169]
-#define key_message                    CUR Strings[170]
-#define key_move                       CUR Strings[171]
-#define key_next                       CUR Strings[172]
-#define key_open                       CUR Strings[173]
-#define key_options                    CUR Strings[174]
-#define key_previous                   CUR Strings[175]
-#define key_print                      CUR Strings[176]
-#define key_redo                       CUR Strings[177]
-#define key_reference                  CUR Strings[178]
-#define key_refresh                    CUR Strings[179]
-#define key_replace                    CUR Strings[180]
-#define key_restart                    CUR Strings[181]
-#define key_resume                     CUR Strings[182]
-#define key_save                       CUR Strings[183]
-#define key_suspend                    CUR Strings[184]
-#define key_undo                       CUR Strings[185]
-#define key_sbeg                       CUR Strings[186]
-#define key_scancel                    CUR Strings[187]
-#define key_scommand                   CUR Strings[188]
-#define key_scopy                      CUR Strings[189]
-#define key_screate                    CUR Strings[190]
-#define key_sdc                        CUR Strings[191]
-#define key_sdl                        CUR Strings[192]
-#define key_select                     CUR Strings[193]
-#define key_send                       CUR Strings[194]
-#define key_seol                       CUR Strings[195]
-#define key_sexit                      CUR Strings[196]
-#define key_sfind                      CUR Strings[197]
-#define key_shelp                      CUR Strings[198]
-#define key_shome                      CUR Strings[199]
-#define key_sic                        CUR Strings[200]
-#define key_sleft                      CUR Strings[201]
-#define key_smessage                   CUR Strings[202]
-#define key_smove                      CUR Strings[203]
-#define key_snext                      CUR Strings[204]
-#define key_soptions                   CUR Strings[205]
-#define key_sprevious                  CUR Strings[206]
-#define key_sprint                     CUR Strings[207]
-#define key_sredo                      CUR Strings[208]
-#define key_sreplace                   CUR Strings[209]
-#define key_sright                     CUR Strings[210]
-#define key_srsume                     CUR Strings[211]
-#define key_ssave                      CUR Strings[212]
-#define key_ssuspend                   CUR Strings[213]
-#define key_sundo                      CUR Strings[214]
-#define req_for_input                  CUR Strings[215]
-#define key_f11                        CUR Strings[216]
-#define key_f12                        CUR Strings[217]
-#define key_f13                        CUR Strings[218]
-#define key_f14                        CUR Strings[219]
-#define key_f15                        CUR Strings[220]
-#define key_f16                        CUR Strings[221]
-#define key_f17                        CUR Strings[222]
-#define key_f18                        CUR Strings[223]
-#define key_f19                        CUR Strings[224]
-#define key_f20                        CUR Strings[225]
-#define key_f21                        CUR Strings[226]
-#define key_f22                        CUR Strings[227]
-#define key_f23                        CUR Strings[228]
-#define key_f24                        CUR Strings[229]
-#define key_f25                        CUR Strings[230]
-#define key_f26                        CUR Strings[231]
-#define key_f27                        CUR Strings[232]
-#define key_f28                        CUR Strings[233]
-#define key_f29                        CUR Strings[234]
-#define key_f30                        CUR Strings[235]
-#define key_f31                        CUR Strings[236]
-#define key_f32                        CUR Strings[237]
-#define key_f33                        CUR Strings[238]
-#define key_f34                        CUR Strings[239]
-#define key_f35                        CUR Strings[240]
-#define key_f36                        CUR Strings[241]
-#define key_f37                        CUR Strings[242]
-#define key_f38                        CUR Strings[243]
-#define key_f39                        CUR Strings[244]
-#define key_f40                        CUR Strings[245]
-#define key_f41                        CUR Strings[246]
-#define key_f42                        CUR Strings[247]
-#define key_f43                        CUR Strings[248]
-#define key_f44                        CUR Strings[249]
-#define key_f45                        CUR Strings[250]
-#define key_f46                        CUR Strings[251]
-#define key_f47                        CUR Strings[252]
-#define key_f48                        CUR Strings[253]
-#define key_f49                        CUR Strings[254]
-#define key_f50                        CUR Strings[255]
-#define key_f51                        CUR Strings[256]
-#define key_f52                        CUR Strings[257]
-#define key_f53                        CUR Strings[258]
-#define key_f54                        CUR Strings[259]
-#define key_f55                        CUR Strings[260]
-#define key_f56                        CUR Strings[261]
-#define key_f57                        CUR Strings[262]
-#define key_f58                        CUR Strings[263]
-#define key_f59                        CUR Strings[264]
-#define key_f60                        CUR Strings[265]
-#define key_f61                        CUR Strings[266]
-#define key_f62                        CUR Strings[267]
-#define key_f63                        CUR Strings[268]
-#define clr_bol                        CUR Strings[269]
-#define clear_margins                  CUR Strings[270]
-#define set_left_margin                CUR Strings[271]
-#define set_right_margin               CUR Strings[272]
-#define label_format                   CUR Strings[273]
-#define set_clock                      CUR Strings[274]
-#define display_clock                  CUR Strings[275]
-#define remove_clock                   CUR Strings[276]
-#define create_window                  CUR Strings[277]
-#define goto_window                    CUR Strings[278]
-#define hangup                         CUR Strings[279]
-#define dial_phone                     CUR Strings[280]
-#define quick_dial                     CUR Strings[281]
-#define tone                           CUR Strings[282]
-#define pulse                          CUR Strings[283]
-#define flash_hook                     CUR Strings[284]
-#define fixed_pause                    CUR Strings[285]
-#define wait_tone                      CUR Strings[286]
-#define user0                          CUR Strings[287]
-#define user1                          CUR Strings[288]
-#define user2                          CUR Strings[289]
-#define user3                          CUR Strings[290]
-#define user4                          CUR Strings[291]
-#define user5                          CUR Strings[292]
-#define user6                          CUR Strings[293]
-#define user7                          CUR Strings[294]
-#define user8                          CUR Strings[295]
-#define user9                          CUR Strings[296]
-#define orig_pair                      CUR Strings[297]
-#define orig_colors                    CUR Strings[298]
-#define initialize_color               CUR Strings[299]
-#define initialize_pair                CUR Strings[300]
-#define set_color_pair                 CUR Strings[301]
-#define set_foreground                 CUR Strings[302]
-#define set_background                 CUR Strings[303]
-#define change_char_pitch              CUR Strings[304]
-#define change_line_pitch              CUR Strings[305]
-#define change_res_horz                CUR Strings[306]
-#define change_res_vert                CUR Strings[307]
-#define define_char                    CUR Strings[308]
-#define enter_doublewide_mode          CUR Strings[309]
-#define enter_draft_quality            CUR Strings[310]
-#define enter_italics_mode             CUR Strings[311]
-#define enter_leftward_mode            CUR Strings[312]
-#define enter_micro_mode               CUR Strings[313]
-#define enter_near_letter_quality      CUR Strings[314]
-#define enter_normal_quality           CUR Strings[315]
-#define enter_shadow_mode              CUR Strings[316]
-#define enter_subscript_mode           CUR Strings[317]
-#define enter_superscript_mode         CUR Strings[318]
-#define enter_upward_mode              CUR Strings[319]
-#define exit_doublewide_mode           CUR Strings[320]
-#define exit_italics_mode              CUR Strings[321]
-#define exit_leftward_mode             CUR Strings[322]
-#define exit_micro_mode                CUR Strings[323]
-#define exit_shadow_mode               CUR Strings[324]
-#define exit_subscript_mode            CUR Strings[325]
-#define exit_superscript_mode          CUR Strings[326]
-#define exit_upward_mode               CUR Strings[327]
-#define micro_column_address           CUR Strings[328]
-#define micro_down                     CUR Strings[329]
-#define micro_left                     CUR Strings[330]
-#define micro_right                    CUR Strings[331]
-#define micro_row_address              CUR Strings[332]
-#define micro_up                       CUR Strings[333]
-#define order_of_pins                  CUR Strings[334]
-#define parm_down_micro                CUR Strings[335]
-#define parm_left_micro                CUR Strings[336]
-#define parm_right_micro               CUR Strings[337]
-#define parm_up_micro                  CUR Strings[338]
-#define select_char_set                CUR Strings[339]
-#define set_bottom_margin              CUR Strings[340]
-#define set_bottom_margin_parm         CUR Strings[341]
-#define set_left_margin_parm           CUR Strings[342]
-#define set_right_margin_parm          CUR Strings[343]
-#define set_top_margin                 CUR Strings[344]
-#define set_top_margin_parm            CUR Strings[345]
-#define start_bit_image                CUR Strings[346]
-#define start_char_set_def             CUR Strings[347]
-#define stop_bit_image                 CUR Strings[348]
-#define stop_char_set_def              CUR Strings[349]
-#define subscript_characters           CUR Strings[350]
-#define superscript_characters         CUR Strings[351]
-#define these_cause_cr                 CUR Strings[352]
-#define zero_motion                    CUR Strings[353]
-#define char_set_names                 CUR Strings[354]
-#define key_mouse                      CUR Strings[355]
-#define mouse_info                     CUR Strings[356]
-#define req_mouse_pos                  CUR Strings[357]
-#define get_mouse                      CUR Strings[358]
-#define set_a_foreground               CUR Strings[359]
-#define set_a_background               CUR Strings[360]
-#define pkey_plab                      CUR Strings[361]
-#define device_type                    CUR Strings[362]
-#define code_set_init                  CUR Strings[363]
-#define set0_des_seq                   CUR Strings[364]
-#define set1_des_seq                   CUR Strings[365]
-#define set2_des_seq                   CUR Strings[366]
-#define set3_des_seq                   CUR Strings[367]
-#define set_lr_margin                  CUR Strings[368]
-#define set_tb_margin                  CUR Strings[369]
-#define bit_image_repeat               CUR Strings[370]
-#define bit_image_newline              CUR Strings[371]
-#define bit_image_carriage_return      CUR Strings[372]
-#define color_names                    CUR Strings[373]
-#define define_bit_image_region        CUR Strings[374]
-#define end_bit_image_region           CUR Strings[375]
-#define set_color_band                 CUR Strings[376]
-#define set_page_length                CUR Strings[377]
-#define display_pc_char                CUR Strings[378]
-#define enter_pc_charset_mode          CUR Strings[379]
-#define exit_pc_charset_mode           CUR Strings[380]
-#define enter_scancode_mode            CUR Strings[381]
-#define exit_scancode_mode             CUR Strings[382]
-#define pc_term_options                CUR Strings[383]
-#define scancode_escape                CUR Strings[384]
-#define alt_scancode_esc               CUR Strings[385]
-#define enter_horizontal_hl_mode       CUR Strings[386]
-#define enter_left_hl_mode             CUR Strings[387]
-#define enter_low_hl_mode              CUR Strings[388]
-#define enter_right_hl_mode            CUR Strings[389]
-#define enter_top_hl_mode              CUR Strings[390]
-#define enter_vertical_hl_mode         CUR Strings[391]
-#define set_a_attributes               CUR Strings[392]
-#define set_pglen_inch                 CUR Strings[393]
-
-#define BOOLWRITE 37
-#define NUMWRITE  33
-#define STRWRITE  394
-
-/* older synonyms for some capabilities */
-#define beehive_glitch	no_esc_ctlc
-#define teleray_glitch	dest_tabs_magic_smso
-#define micro_char_size micro_col_size
-
-#ifdef __INTERNAL_CAPS_VISIBLE
-#define termcap_init2                  CUR Strings[394]
-#define termcap_reset                  CUR Strings[395]
-#define magic_cookie_glitch_ul         CUR Numbers[33]
-#define backspaces_with_bs             CUR Booleans[37]
-#define crt_no_scrolling               CUR Booleans[38]
-#define no_correctly_working_cr        CUR Booleans[39]
-#define carriage_return_delay          CUR Numbers[34]
-#define new_line_delay                 CUR Numbers[35]
-#define linefeed_if_not_lf             CUR Strings[396]
-#define backspace_if_not_bs            CUR Strings[397]
-#define gnu_has_meta_key               CUR Booleans[40]
-#define linefeed_is_newline            CUR Booleans[41]
-#define backspace_delay                CUR Numbers[36]
-#define horizontal_tab_delay           CUR Numbers[37]
-#define number_of_function_keys        CUR Numbers[38]
-#define other_non_function_keys        CUR Strings[398]
-#define arrow_key_map                  CUR Strings[399]
-#define has_hardware_tabs              CUR Booleans[42]
-#define return_does_clr_eol            CUR Booleans[43]
-#define acs_ulcorner                   CUR Strings[400]
-#define acs_llcorner                   CUR Strings[401]
-#define acs_urcorner                   CUR Strings[402]
-#define acs_lrcorner                   CUR Strings[403]
-#define acs_ltee                       CUR Strings[404]
-#define acs_rtee                       CUR Strings[405]
-#define acs_btee                       CUR Strings[406]
-#define acs_ttee                       CUR Strings[407]
-#define acs_hline                      CUR Strings[408]
-#define acs_vline                      CUR Strings[409]
-#define acs_plus                       CUR Strings[410]
-#define memory_lock                    CUR Strings[411]
-#define memory_unlock                  CUR Strings[412]
-#define box_chars_1                    CUR Strings[413]
-#endif /* __INTERNAL_CAPS_VISIBLE */
-
-
-/*
- * Predefined terminfo array sizes
- */
-#define BOOLCOUNT 44
-#define NUMCOUNT  39
-#define STRCOUNT  414
-
-/* used by code for comparing entries */
-#define acs_chars_index	 146
-
-typedef struct termtype {	/* in-core form of terminfo data */
-    char  *term_names;		/* str_table offset of term names */
-    char  *str_table;		/* pointer to string table */
-    NCURSES_SBOOL  *Booleans;	/* array of boolean values */
-    short *Numbers;		/* array of integer values */
-    char  **Strings;		/* array of string offsets */
-
-#if NCURSES_XNAMES
-    char  *ext_str_table;	/* pointer to extended string table */
-    char  **ext_Names;		/* corresponding names */
-
-    unsigned short num_Booleans;/* count total Booleans */
-    unsigned short num_Numbers;	/* count total Numbers */
-    unsigned short num_Strings;	/* count total Strings */
-
-    unsigned short ext_Booleans;/* count extensions to Booleans */
-    unsigned short ext_Numbers;	/* count extensions to Numbers */
-    unsigned short ext_Strings;	/* count extensions to Strings */
-#endif /* NCURSES_XNAMES */
-
-} TERMTYPE;
-
-typedef struct term {		/* describe an actual terminal */
-    TERMTYPE	type;		/* terminal type description */
-    short	Filedes;	/* file description being written to */
-    TTY		Ottyb,		/* original state of the terminal */
-		Nttyb;		/* current state of the terminal */
-    int		_baudrate;	/* used to compute padding */
-    char *      _termname;      /* used for termname() */
-} TERMINAL;
-
-#if 0 || 0
-NCURSES_WRAPPED_VAR(TERMINAL *, cur_term);
-NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, boolnames);
-NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, boolcodes);
-NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, boolfnames);
-NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, numnames);
-NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, numcodes);
-NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, numfnames);
-NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, strnames);
-NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, strcodes);
-NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, strfnames);
-
-#define cur_term   NCURSES_PUBLIC_VAR(cur_term())
-#define boolnames  NCURSES_PUBLIC_VAR(boolnames())
-#define boolcodes  NCURSES_PUBLIC_VAR(boolcodes())
-#define boolfnames NCURSES_PUBLIC_VAR(boolfnames())
-#define numnames   NCURSES_PUBLIC_VAR(numnames())
-#define numcodes   NCURSES_PUBLIC_VAR(numcodes())
-#define numfnames  NCURSES_PUBLIC_VAR(numfnames())
-#define strnames   NCURSES_PUBLIC_VAR(strnames())
-#define strcodes   NCURSES_PUBLIC_VAR(strcodes())
-#define strfnames  NCURSES_PUBLIC_VAR(strfnames())
-
-#else
-
-extern NCURSES_EXPORT_VAR(TERMINAL *) cur_term;
-
-extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) boolnames[];
-extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) boolcodes[];
-extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) boolfnames[];
-extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) numnames[];
-extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) numcodes[];
-extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) numfnames[];
-extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) strnames[];
-extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) strcodes[];
-extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) strfnames[];
-
-#endif
-
-/* internals */
-extern NCURSES_EXPORT(int) _nc_set_tty_mode (TTY *buf);
-extern NCURSES_EXPORT(int) _nc_get_tty_mode (TTY *buf);
-extern NCURSES_EXPORT(int) _nc_read_entry (const char * const, char * const, TERMTYPE *const);
-extern NCURSES_EXPORT(int) _nc_read_file_entry (const char *const, TERMTYPE *);
-extern NCURSES_EXPORT(int) _nc_read_termtype (TERMTYPE *, char *, int);
-extern NCURSES_EXPORT(char *) _nc_first_name (const char *const);
-extern NCURSES_EXPORT(int) _nc_name_match (const char *const, const char *const, const char *const);
-extern NCURSES_EXPORT(const TERMTYPE *) _nc_fallback (const char *);
-
-/* entry points */
-extern NCURSES_EXPORT(TERMINAL *) set_curterm (TERMINAL *);
-extern NCURSES_EXPORT(int) del_curterm (TERMINAL *);
-
-/* miscellaneous entry points */
-extern NCURSES_EXPORT(int) restartterm (NCURSES_CONST char *, int, int *);
-extern NCURSES_EXPORT(int) setupterm (NCURSES_CONST char *,int,int *);
-
-/* terminfo entry points, also declared in curses.h */
-#if !defined(__NCURSES_H)
-extern NCURSES_EXPORT(char *) tigetstr (NCURSES_CONST char *);
-extern NCURSES_EXPORT_VAR(char) ttytype[];
-extern NCURSES_EXPORT(int) putp (const char *);
-extern NCURSES_EXPORT(int) tigetflag (NCURSES_CONST char *);
-extern NCURSES_EXPORT(int) tigetnum (NCURSES_CONST char *);
-
-#if 1 /* NCURSES_TPARM_VARARGS */
-extern NCURSES_EXPORT(char *) tparm (NCURSES_CONST char *, ...);	/* special */
-#else
-extern NCURSES_EXPORT(char *) tparm (NCURSES_CONST char *, long,long,long,long,long,long,long,long,long);	/* special */
-extern NCURSES_EXPORT(char *) tparm_varargs (NCURSES_CONST char *, ...);	/* special */
-#endif
-
-#endif /* __NCURSES_H */
-
-/* termcap database emulation (XPG4 uses const only for 2nd param of tgetent) */
-#if !defined(NCURSES_TERMCAP_H_incl)
-extern NCURSES_EXPORT(char *) tgetstr (NCURSES_CONST char *, char **);
-extern NCURSES_EXPORT(char *) tgoto (const char *, int, int);
-extern NCURSES_EXPORT(int) tgetent (char *, const char *);
-extern NCURSES_EXPORT(int) tgetflag (NCURSES_CONST char *);
-extern NCURSES_EXPORT(int) tgetnum (NCURSES_CONST char *);
-extern NCURSES_EXPORT(int) tputs (const char *, int, int (*)(int));
-#endif /* NCURSES_TERMCAP_H_incl */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* NCURSES_TERM_H_incl */
diff --git a/include/term_entry.h b/include/term_entry.h
index fb87540..b12710d 100644
--- a/include/term_entry.h
+++ b/include/term_entry.h
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2005,2008 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2013,2014 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            *
@@ -32,7 +32,7 @@
  *     and: Thomas E. Dickey                        1998-on                 *
  ****************************************************************************/
 
-/* $Id: term_entry.h,v 1.35 2008/08/16 16:16:03 tom Exp $ */
+/* $Id: term_entry.h,v 1.45 2014/11/01 14:47:00 tom Exp $ */
 
 /*
  *	term_entry.h -- interface to entry-manipulation code
@@ -47,28 +47,46 @@
 
 #include <term.h>
 
+    /*
+     * see db_iterator.c - this enumeration lists the places searched for a
+     * terminal description and defines the order in which they are searched.
+     */
+    typedef enum {
+	dbdTIC = 0,		/* special, used by tic when writing entry */
+#if NCURSES_USE_DATABASE
+	dbdEnvOnce,		/* the $TERMINFO environment variable */
+	dbdHome,		/* $HOME/.terminfo */
+	dbdEnvList,		/* the $TERMINFO_DIRS environment variable */
+	dbdCfgList,		/* the compiled-in TERMINFO_DIRS value */
+	dbdCfgOnce,		/* the compiled-in TERMINFO value */
+#endif
+#if NCURSES_USE_TERMCAP
+	dbdEnvOnce2,		/* the $TERMCAP environment variable */
+	dbdEnvList2,		/* the $TERMPATH environment variable */
+	dbdCfgList2,		/* the compiled-in TERMPATH */
+#endif
+	dbdLAST
+    } DBDIRS;
+
 #define MAX_USES	32
 #define MAX_CROSSLINKS	16
 
-typedef struct entry {
-	TERMTYPE	tterm;
-	unsigned	nuses;
-	struct
-        {
-	    char		*name;
-	    struct entry	*link;
-	    long		line;
-        }
-	uses[MAX_USES];
-	int		ncrosslinks;
-	struct entry	*crosslinks[MAX_CROSSLINKS];
-	long		cstart, cend;
-	long		startline;
-	struct entry	*next;
-	struct entry	*last;
-}
-ENTRY;
-
+    typedef struct entry {
+	TERMTYPE tterm;
+	unsigned nuses;
+	struct {
+	    char *name;
+	    struct entry *link;
+	    long line;
+	} uses[MAX_USES];
+	int ncrosslinks;
+	struct entry *crosslinks[MAX_CROSSLINKS];
+	long cstart, cend;
+	long startline;
+	struct entry *next;
+	struct entry *last;
+    } ENTRY;
+/* *INDENT-OFF* */
 #if NCURSES_XNAMES
 #define NUM_BOOLEANS(tp) (tp)->num_Booleans
 #define NUM_NUMBERS(tp)  (tp)->num_Numbers
@@ -81,12 +99,18 @@
 #define EXT_NAMES(tp,i,limit,index,table) table[i]
 #endif
 
-#define NUM_EXT_NAMES(tp) ((tp)->ext_Booleans + (tp)->ext_Numbers + (tp)->ext_Strings)
+#define NUM_EXT_NAMES(tp) (unsigned) ((tp)->ext_Booleans + (tp)->ext_Numbers + (tp)->ext_Strings)
 
 #define for_each_boolean(n,tp) for(n = 0; n < NUM_BOOLEANS(tp); n++)
 #define for_each_number(n,tp)  for(n = 0; n < NUM_NUMBERS(tp);  n++)
 #define for_each_string(n,tp)  for(n = 0; n < NUM_STRINGS(tp);  n++)
 
+#if NCURSES_XNAMES
+#define for_each_ext_boolean(n,tp) for(n = BOOLCOUNT; n < NUM_BOOLEANS(tp); n++)
+#define for_each_ext_number(n,tp)  for(n = NUMCOUNT; n < NUM_NUMBERS(tp);  n++)
+#define for_each_ext_string(n,tp)  for(n = STRCOUNT; n < NUM_STRINGS(tp);  n++)
+#endif
+
 #define ExtBoolname(tp,i,names) EXT_NAMES(tp, i, BOOLCOUNT, (i - (tp->num_Booleans - tp->ext_Booleans)), names)
 #define ExtNumname(tp,i,names)  EXT_NAMES(tp, i, NUMCOUNT, (i - (tp->num_Numbers - tp->ext_Numbers)) + tp->ext_Booleans, names)
 #define ExtStrname(tp,i,names)  EXT_NAMES(tp, i, STRCOUNT, (i - (tp->num_Strings - tp->ext_Strings)) + (tp->ext_Numbers + tp->ext_Booleans), names)
@@ -126,7 +150,7 @@
 
 /* alloc_ttype.c: elementary allocation code */
 extern NCURSES_EXPORT(void) _nc_align_termtype (TERMTYPE *, TERMTYPE *);
-extern NCURSES_EXPORT(void) _nc_copy_termtype (TERMTYPE *, TERMTYPE *);
+extern NCURSES_EXPORT(void) _nc_copy_termtype (TERMTYPE *, const TERMTYPE *);
 
 /* free_ttype.c: elementary allocation code */
 extern NCURSES_EXPORT(void) _nc_free_termtype (TERMTYPE *);
@@ -146,7 +170,7 @@
 extern NCURSES_EXPORT(int) _nc_capcmp (const char *, const char *);
 
 /* write_entry.c: writing an entry to the file system */
-extern NCURSES_EXPORT(void) _nc_set_writedir (char *);
+extern NCURSES_EXPORT(void) _nc_set_writedir (const char *);
 extern NCURSES_EXPORT(void) _nc_write_entry (TERMTYPE *const);
 
 /* comp_parse.c: entry list handling */
@@ -160,9 +184,9 @@
 
 /* trace_xnames.c */
 extern NCURSES_EXPORT(void) _nc_trace_xnames (TERMTYPE *);
+/* *INDENT-ON* */
 
 #ifdef __cplusplus
 }
 #endif
-
-#endif /* NCURSES_TERM_ENTRY_H_incl */
+#endif				/* NCURSES_TERM_ENTRY_H_incl */
diff --git a/include/tic.h b/include/tic.h
index 4e10399..528a1b7 100644
--- a/include/tic.h
+++ b/include/tic.h
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2006,2007 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2011,2012 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            *
@@ -33,14 +33,14 @@
  ****************************************************************************/
 
 /*
- * $Id: tic.h,v 1.62 2007/08/11 16:12:43 tom Exp $
+ * $Id: tic.h,v 1.69 2012/03/17 18:22:10 tom Exp $
  *	tic.h - Global variables and structures for the terminfo
  *			compiler.
  */
 
 #ifndef __TIC_H
 #define __TIC_H
-
+/* *INDENT-OFF* */
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -183,6 +183,8 @@
 
 #endif
 
+typedef short HashValue;
+
 	/*
 	 * The file comp_captab.c contains an array of these structures, one
 	 * per possible capability.  These are indexed by a hash table array of
@@ -193,10 +195,21 @@
 {
 	const char *nte_name;	/* name to hash on */
 	int	nte_type;	/* BOOLEAN, NUMBER or STRING */
-	short	nte_index;	/* index of associated variable in its array */
-	short	nte_link;	/* index in table of next hash, or -1 */
+	HashValue nte_index;	/* index of associated variable in its array */
+	HashValue nte_link;	/* index in table of next hash, or -1 */
 };
 
+	/*
+	 * Use this structure to hide differences between terminfo and termcap
+	 * tables.
+	 */
+typedef struct {
+	unsigned table_size;
+	const HashValue *table_data;
+	HashValue (*hash_of)(const char *);
+	int (*compare_names)(const char *, const char *);
+} HashData;
+
 struct alias
 {
 	const char	*from;
@@ -205,11 +218,18 @@
 };
 
 extern NCURSES_EXPORT(const struct name_table_entry *) _nc_get_table (bool);
-extern NCURSES_EXPORT(const short *) _nc_get_hash_table (bool);
+extern NCURSES_EXPORT(const HashData *) _nc_get_hash_info (bool);
+extern NCURSES_EXPORT(const HashValue *) _nc_get_hash_table (bool);
 extern NCURSES_EXPORT(const struct alias *) _nc_get_alias_table (bool);
 
 #define NOTFOUND	((struct name_table_entry *) 0)
 
+/*
+ * The casts are required for correct sign-propagation with systems such as
+ * AIX, IRIX64, Solaris which default to unsigned characters.  The C standard
+ * leaves this detail unspecified.
+ */
+
 /* out-of-band values for representing absent capabilities */
 #define ABSENT_BOOLEAN		((signed char)-1)	/* 255 */
 #define ABSENT_NUMERIC		(-1)
@@ -234,6 +254,8 @@
 #define TERMINFO "/usr/share/terminfo"
 #endif
 
+#ifdef NCURSES_TERM_ENTRY_H_incl
+
 /* access.c */
 extern NCURSES_EXPORT(unsigned) _nc_pathlast (const char *);
 extern NCURSES_EXPORT(bool) _nc_is_abs_path (const char *);
@@ -244,9 +266,9 @@
 
 /* comp_hash.c: name lookup */
 extern NCURSES_EXPORT(struct name_table_entry const *) _nc_find_entry
-	(const char *, const short *);
+	(const char *, const HashValue *);
 extern NCURSES_EXPORT(struct name_table_entry const *) _nc_find_type_entry
-	(const char *, int, const struct name_table_entry *);
+	(const char *, int, bool);
 
 /* comp_scan.c: lexical analysis */
 extern NCURSES_EXPORT(int)  _nc_get_token (bool);
@@ -256,6 +278,7 @@
 extern NCURSES_EXPORT_VAR(int) _nc_curr_col;
 extern NCURSES_EXPORT_VAR(int) _nc_curr_line;
 extern NCURSES_EXPORT_VAR(int) _nc_syntax;
+extern NCURSES_EXPORT_VAR(int) _nc_strict_bsd;
 extern NCURSES_EXPORT_VAR(long) _nc_comment_end;
 extern NCURSES_EXPORT_VAR(long) _nc_comment_start;
 extern NCURSES_EXPORT_VAR(long) _nc_curr_file_pos;
@@ -300,23 +323,6 @@
 extern const char * _nc_progname;
 
 /* db_iterator.c */
-typedef enum {
-    dbdTIC = 0,
-#if USE_DATABASE
-    dbdEnvOnce,
-    dbdHome,
-    dbdEnvList,
-    dbdCfgList,
-    dbdCfgOnce,
-#endif
-#if USE_TERMCAP
-    dbdEnvOnce2,
-    dbdEnvList2,
-    dbdCfgList2,
-#endif
-    dbdLAST
-} DBDIRS;
-
 extern NCURSES_EXPORT(const char *) _nc_next_db(DBDIRS *, int *);
 extern NCURSES_EXPORT(const char *) _nc_tic_dir (const char *);
 extern NCURSES_EXPORT(void) _nc_first_db(DBDIRS *, int *);
@@ -325,8 +331,11 @@
 /* write_entry.c */
 extern NCURSES_EXPORT(int) _nc_tic_written (void);
 
+#endif /* NCURSES_TERM_ENTRY_H_incl */
+
 #ifdef __cplusplus
 }
 #endif
 
+/* *INDENT-ON* */
 #endif /* __TIC_H */
diff --git a/include/unctrl.h.in b/include/unctrl.h.in
index 70d74b7..e08bc81 100644
--- a/include/unctrl.h.in
+++ b/include/unctrl.h.in
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998,2000 Free Software Foundation, Inc.                   *
+ * Copyright (c) 1998-2008,2009 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            *
@@ -39,7 +39,7 @@
  * as ^?. Printable characters are displayed as is.
  */
 
-/* $Id: unctrl.h.in,v 1.10 2001/03/24 21:53:25 tom Exp $ */
+/* $Id: unctrl.h.in,v 1.11 2009/04/18 21:00:52 tom Exp $ */
 
 #ifndef NCURSES_UNCTRL_H_incl
 #define NCURSES_UNCTRL_H_incl	1
@@ -56,6 +56,10 @@
 #undef unctrl
 NCURSES_EXPORT(NCURSES_CONST char *) unctrl (chtype);
 
+#if @NCURSES_SP_FUNCS@
+NCURSES_EXPORT(NCURSES_CONST char *) NCURSES_SP_NAME(unctrl) (SCREEN*, chtype);
+#endif
+
 #ifdef __cplusplus
 }
 #endif